'index.php', 'name' => get_lang('MySpace')]; Display::display_header(get_lang('Sessions')); if (api_is_platform_admin(true, true)) { $a_sessions = SessionManager::get_sessions_followed_by_drh(api_get_user_id()); if (!api_is_session_admin()) { $menu_items[] = Display::url( Display::return_icon('statistics.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH).'auth/my_progress.php' ); $menu_items[] = Display::url( Display::return_icon('user.png', get_lang('Students'), [], ICON_SIZE_MEDIUM), 'index.php?view=drh_students&display=yourstudents' ); $menu_items[] = Display::url( Display::return_icon('teacher.png', get_lang('Trainers'), [], ICON_SIZE_MEDIUM), 'teachers.php' ); $menu_items[] = Display::url( Display::return_icon('course.png', get_lang('Courses'), [], ICON_SIZE_MEDIUM), 'course.php' ); $menu_items[] = Display::url( Display::return_icon('session_na.png', get_lang('Sessions'), [], ICON_SIZE_MEDIUM), '#' ); } $menu_items[] = Display::url( Display::return_icon('works.png', get_lang('WorksReport'), [], ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH).'mySpace/works_in_session_report.php' ); $menu_items[] = Display::url( Display::return_icon('clock.png', get_lang('TeacherTimeReportBySession'), [], ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH).'admin/teachers_time_by_session_report.php' ); if (!api_is_session_admin()) { $menu_items[] = Display::url( Display::return_icon('1day.png', get_lang('SessionsPlanCalendar'), [], ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH)."calendar/planification.php" ); } $actionsLeft = ''; $nb_menu_items = count($menu_items); if ($nb_menu_items > 1) { foreach ($menu_items as $key => $item) { $actionsLeft .= $item; } } $actionsRight = ''; if (count($a_sessions) > 0) { $actionsRight = Display::url( Display::return_icon('printer.png', get_lang('Print'), [], 32), 'javascript: void(0);', ['onclick' => 'javascript: window.print();'] ); $actionsRight .= Display::url( Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), [], 32), api_get_self().'?export=csv' ); } $toolbar = Display::toolbarAction( 'toolbar-session', [$actionsLeft, $actionsRight] ); echo $toolbar; echo Display::page_header(get_lang('YourSessionsList')); } elseif (api_is_teacher()) { $actionsRight = Display::url( Display::return_icon('clock.png', get_lang('TeacherTimeReportBySession'), [], ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH).'admin/teachers_time_by_session_report.php' ); $toolbar = Display::toolbarAction( 'toolbar-session', ['', $actionsRight] ); echo $toolbar; echo Display::page_header(get_lang('YourSessionsList')); } else { $a_sessions = Tracking::get_sessions_coached_by_user($id_coach); } $form = new FormValidator( 'search_course', 'post', api_get_path(WEB_CODE_PATH).'mySpace/session.php' ); $form->addElement('text', 'keyword', get_lang('Keyword')); $extraFieldSession = new ExtraField('session'); $extraFieldSession->addElements( $form, null, [], //exclude true ); $form->addButtonSearch(get_lang('Search')); $keyword = ''; $result = SessionManager::getGridColumns('my_space'); $columns = $result['columns']; $columnModel = $result['column_model']; $filterToString = ''; if ($form->validate()) { $values = $form->getSubmitValues(); $keyword = Security::remove_XSS($form->getSubmitValue('keyword')); $extraField = new ExtraField('session'); $extraFields = $extraField->get_all(null, 'option_order'); $extraFields = array_column($extraFields, 'variable'); $filter = new stdClass(); $filter->groupOp = 'AND'; foreach ($columnModel as $col) { if (isset($values[$col['index']]) && !empty($values[$col['index']]) && in_array(str_replace('extra_', '', $col['index']), $extraFields) ) { $rule = new stdClass(); $rule->field = $col['index']; $rule->op = 'in'; $rule->data = Security::remove_XSS($values[$col['index']]); $filter->rules[] = $rule; $filter->groupOp = 'AND'; } } $filterToString = json_encode($filter); } $form->setDefaults(['keyword' => $keyword]); $url = api_get_path(WEB_AJAX_PATH). 'model.ajax.php?a=get_sessions_tracking&_search=true&_force_search=true&filters='.$filterToString.'&keyword='.$keyword; // Column config $extraParams = [ 'autowidth' => 'true', 'height' => 'auto', ]; /*$extraParams['postData'] = [ 'filters' => [ 'groupOp' => 'AND', 'rules' => $result['rules'], ], ];*/ $urlAjaxExtraField = api_get_path(WEB_AJAX_PATH).'extra_field.ajax.php?1=1'; $allowOrder = api_get_configuration_value('session_list_order'); $orderUrl = api_get_path(WEB_AJAX_PATH).'session.ajax.php?a=order'; ?> display(); echo Display::grid_html('sessions'); Display::display_footer();