merge diverse trees

master
Marek Isalski 4 years ago
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' );
}

@ -1,5 +1,12 @@
<?php /* -*- php -*- */
function fulcrm_membership_permission() {
return array( 'administer fulcrm membership' => array( 'title' => t('Administer fulcrm membership'),
'description' => t('Perform main installation/administration tasks for fulcrm membership integration.'),
),
);
}
function fulcrm_membership_menu() {
$items = array();

Loading…
Cancel
Save