merge diverse trees
commit
91e81db30b
@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function fulcrm_membership_admin_form_submit( $form, &$form_state ) {
|
||||||
|
variable_set( 'fulcrm_membership_self_set_membership_ids', $form_state[ 'values' ][ 'self_set_membership_ids' ] );
|
||||||
|
|
||||||
|
drupal_set_message( t('Settings saved.'), 'status' );
|
||||||
|
}
|
||||||
|
|
||||||
|
function fulcrm_membership_admin_form( $form, &$form_state ) {
|
||||||
|
global $is_https;
|
||||||
|
|
||||||
|
$form[ 'title' ] = array( '#type' => 'item',
|
||||||
|
'#title' => 'fulcrm Membership Integration Settings',
|
||||||
|
'#description' => '',
|
||||||
|
);
|
||||||
|
|
||||||
|
$products = array( '' => '-- disabled --' );
|
||||||
|
|
||||||
|
$membership_data = fulcrm_apiv2_GET( 'membership/',
|
||||||
|
$query = array( 'page_size' => 1000,
|
||||||
|
) );
|
||||||
|
if ( $membership_data[ 'success' ] ) {
|
||||||
|
if ( $membership_data[ 'data' ][ 'results' ] ) {
|
||||||
|
foreach ( $membership_data[ 'data' ][ 'results' ] as $membership ) {
|
||||||
|
$memberships[ $membership[ 'id' ] ] = $membership[ 'name' ];
|
||||||
|
if ( $membership[ 'archived' ] )
|
||||||
|
$memberships[ $membership[ 'id' ] ] .= ' (archived)';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$memberships[ 'ERROR' ] = '** ERROR fetching memberships from fulcrm **';
|
||||||
|
}
|
||||||
|
|
||||||
|
$form[ 'self_set_membership_ids' ] = array( '#type' => 'checkboxes',
|
||||||
|
'#title' => 'Self-Set Memberships',
|
||||||
|
'#options' => $memberships,
|
||||||
|
'#default_value' => variable_get( 'fulcrm_membership_self_set_membership_ids', array() ),
|
||||||
|
'#description' => 'Which memberships can users add/remove for themselves?',
|
||||||
|
);
|
||||||
|
|
||||||
|
$form[ 'actions' ] = array( '#type' => 'actions' );
|
||||||
|
$form[ 'actions' ][ 'save' ] = array( '#type' => 'submit',
|
||||||
|
'#value' => t('Save'),
|
||||||
|
'#submit' => array( 'fulcrm_membership_admin_form_submit' ),
|
||||||
|
);
|
||||||
|
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
|
function fulcrm_membership_admin() {
|
||||||
|
return drupal_get_form( 'fulcrm_membership_admin_form' );
|
||||||
|
}
|
Loading…
Reference in New Issue