You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
2.3 KiB
PHP
53 lines
2.3 KiB
PHP
<?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' );
|
|
}
|