'index.php',"name" => get_lang('PlatformAdmin')); $interbreadcrumb[] = array('url' => "session_list.php","name" => get_lang('SessionList')); $interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$id,"name" => get_lang('SessionOverview')); list($year_start, $month_start, $day_start) = explode('-', $infos['date_start']); list($year_end, $month_end, $day_end) = explode('-', $infos['date_end']); // Default value $showDescriptionChecked = 'checked'; if (isset($infos['show_description'])) { if (!empty($infos['show_description'])) { $showDescriptionChecked = 'checked'; } else { $showDescriptionChecked = null; } } $end_year_disabled = $end_month_disabled = $end_day_disabled = ''; if (isset($_POST['formSent']) && $_POST['formSent']) { $formSent = 1; } $order_clause = 'ORDER BY '; $order_clause .= api_sort_by_first_name() ? 'firstname, lastname, username' : 'lastname, firstname, username'; $sql="SELECT user_id,lastname,firstname,username FROM $tbl_user WHERE status='1'".$order_clause; if (api_is_multiple_url_enabled()) { $table_access_url_rel_user= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $access_url_id = api_get_current_access_url_id(); if ($access_url_id != -1) { $sql="SELECT DISTINCT u.user_id,lastname,firstname,username FROM $tbl_user u INNER JOIN $table_access_url_rel_user url_rel_user ON (url_rel_user.user_id = u.user_id) WHERE status='1' AND access_url_id = '$access_url_id' $order_clause"; } } $result = Database::query($sql); $coaches = Database::store_result($result); $thisYear = date('Y'); $daysOption = array(); for ($i = 1; $i <= 31; $i++) { $day = sprintf("%02d", $i); $daysOption[$day] = $day; } $monthsOption = array(); for ($i = 1; $i <= 12; $i++) { $month = sprintf("%02d", $i); $monthsOption[$month] = $month; } $yearsOption = array(); for ($i = $thisYear - 5; $i <= ($thisYear + 5); $i++) { $yearsOption[$i] = $i; } $coachesOption = array( '' => '----- ' . get_lang('None') . ' -----' ); foreach ($coaches as $coach) { $personName = api_get_person_name($coach['firstname'], $coach['lastname']); $coachesOption[$coach['user_id']] = "$personName ({$coach['username']})"; } $Categories = SessionManager::get_all_session_category(); $categoriesOption = array( '0' => get_lang('None') ); if ($Categories != false) { foreach ($categoriesList as $categoryItem) { $categoriesOption[$categoryItem['id']] = $categoryItem['name']; } } $formAction = api_get_self() . '?'; $formAction .= http_build_query(array( 'page' => Security::remove_XSS($_GET['page']), 'id' => $id )); $form = new FormValidator('edit_session', 'post', $formAction); $form->addElement('header', $tool_name); $form->addElement('text', 'name', get_lang('SessionName'), array( 'class' => 'span4', 'maxlength' => 50, 'value' => $formSent ? api_htmlentities($name,ENT_QUOTES,$charset) : '' )); $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required'); $form->addRule('name', get_lang('SessionNameAlreadyExists'), 'callback', 'check_session_name'); $form->addElement('select', 'id_coach', get_lang('CoachName'), $coachesOption, array( 'id' => 'coach_username', 'class' => 'chzn-select', 'style' => 'width:370px;', 'title' => get_lang('Choose') )); $form->addRule('id_coach', get_lang('ThisFieldIsRequired'), 'required'); $form->add_select('session_category', get_lang('SessionCategory'), $categoriesOption, array( 'id' => 'session_category', 'class' => 'chzn-select', 'style' => 'width:370px;' )); $form->addElement('advanced_settings',''.get_lang('DefineSessionOptions').''); if ($infos['nb_days_access_before_beginning'] != 0 || $infos['nb_days_access_after_end'] != 0) { $form->addElement('html','