registerFunction('search_sessions'); // setting the section (for the tabs) $this_section = SECTION_PLATFORM_ADMIN; // Access restrictions api_protect_admin_script(true); // setting breadcrumbs $interbreadcrumb[] = ['url' => 'index.php', 'name' => get_lang('PlatformAdmin')]; $interbreadcrumb[] = ['url' => 'career_dashboard.php', 'name' => get_lang('CareersAndPromotions')]; // Setting the name of the tool $tool_name = get_lang('SubscribeSessionsToPromotions'); $add_type = 'multiple'; if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') { $add_type = Security::remove_XSS($_REQUEST['add_type']); } $htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/'); $htmlHeadXtra[] = ''; $form_sent = 0; $errorMsg = ''; $users = $sessions = []; $promotion = new Promotion(); $id = intval($_GET['id']); if (isset($_POST['form_sent']) && $_POST['form_sent']) { $form_sent = $_POST['form_sent']; $session_in_promotion_posted = $_POST['session_in_promotion_name']; if (!is_array($session_in_promotion_posted)) { $session_in_promotion_posted = [$session_in_promotion_posted]; } if ($form_sent == 1) { // Added a parameter to send emails when registering a user SessionManager::subscribe_sessions_to_promotion($id, $session_in_promotion_posted); header('Location: promotions.php'); exit; } } $promotion_data = $promotion->get($id); $session_list = SessionManager::get_sessions_list([], ['name']); $session_not_in_promotion = $session_in_promotion = []; if (!empty($session_list)) { foreach ($session_list as $session) { $promotion_id = $session['promotion_id']; if (isset($promotion_id) && !empty($promotion_id)) { if ($promotion_id == $id) { $session_in_promotion[$session['id']] = $session['name']; } else { $session_not_in_promotion[$session['id']] = $session['name']; } } else { $session_not_in_promotion[$session['id']] = $session['name']; } } } $ajax_search = $add_type == 'unique' ? true : false; // Checking for extra field with filter on $xajax->processRequests(); Display::display_header($tool_name); if ($add_type == 'multiple') { $link_add_type_unique = ''.Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').''; $link_add_type_multiple = Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple'); } else { $link_add_type_unique = Display::return_icon('single.gif').get_lang('SessionAddTypeUnique'); $link_add_type_multiple = ''.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').''; } echo '
'; echo ''.Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).''; echo '
'; ?>
> '.$tool_name.' '.$promotion_data['name'].''; if ($add_type == 'multiple') { $extraField = new \ExtraField('session'); $extra_field_list = $extraField->get_all_extra_field_by_type(ExtraField::FIELD_TYPE_SELECT); $new_field_list = []; if (is_array($extra_field_list) && (count($extra_field_list) > 0)) { echo '

'.get_lang('FilterSessions').'

'; foreach ($extra_field_list as $new_field) { echo $new_field['name']; $varname = 'field_'.$new_field['variable']; echo ' '; echo '  '; } echo ''; echo '

'; } } echo Display::input('hidden', 'id', $id); echo Display::input('hidden', 'form_sent', '1'); echo Display::input('hidden', 'add_type', null); if (!empty($errorMsg)) { echo Display::return_message($errorMsg, 'normal'); //main API } ?>
: :
:  
'width:360px', 'multiple' => 'multiple', 'id' => 'session_not_in_promotion', 'size' => '15px'], false); ?>








'width:360px', 'multiple' => 'multiple', 'id' => 'session_in_promotion', 'size' => '15px'], false ); unset($sessionUsersList); ?>

'.get_lang('SubscribeSessionsToPromotion').''; ?>
['operator' => 'LIKE', 'value' => "$needle%"]] ); $return .= ''; $xajax_response->addAssign('ajax_list_multiple', 'innerHTML', api_utf8_encode($return)); } return $xajax_response; }