addSelectAjax( 'course_name', null, [], [ 'id' => 'course_name', 'placeholder' => get_lang('Search courses'), 'url' => api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_course', ] ); if (!empty($courseId)) { $courseInfo = api_get_course_info_by_id($courseId); $courseSelect->addOption($courseInfo['title'], $courseInfo['code'], ['selected' => 'selected']); } $url = api_get_self(); $actions = ' '; // jqgrid will use this URL to do the selects if (!empty($courseId)) { $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_sessions&course_id='.$courseId; } else { $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_sessions'; } if (isset($_REQUEST['keyword'])) { //Begin with see the searchOper param $filter = new stdClass(); $filter->groupOp = 'OR'; $rule = new stdClass(); $rule->field = 'category_name'; $rule->op = 'in'; $rule->data = Security::remove_XSS($_REQUEST['keyword']); $filter->rules[] = $rule; $filter->groupOp = 'OR'; $filter = json_encode($filter); $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?' .http_build_query([ 'a' => 'get_sessions', '_force_search' => 'true', 'rows' => 20, 'page' => 1, 'sidx' => '', 'sord' => 'asc', 'filters' => $filter, 'searchField' => 's.title', 'searchString' => Security::remove_XSS($_REQUEST['keyword']), 'searchOper' => 'in', ]); } if (isset($_REQUEST['id_category'])) { $sessionCategory = SessionManager::get_session_category($_REQUEST['id_category']); if (!empty($sessionCategory)) { //Begin with see the searchOper param $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?' .http_build_query([ 'a' => 'get_sessions', '_force_search' => 'true', 'rows' => 20, 'page' => 1, 'sidx' => '', 'sord' => 'asc', 'filters' => '', 'searchField' => 'sc.title', 'searchString' => Security::remove_XSS($sessionCategory['title']), 'searchOper' => 'in', ]); } } $url .= '&list_type='.$listType; $result = SessionManager::getGridColumns($listType); $columns = $result['columns']; $column_model = $result['column_model']; $extra_params['autowidth'] = 'true'; $extra_params['height'] = 'auto'; switch ($listType) { case 'custom': $extra_params['sortname'] = 'display_end_date'; $extra_params['sortorder'] = 'desc'; break; } if (!isset($_GET['keyword'])) { $extra_params['postData'] = [ 'filters' => [ 'groupOp' => 'AND', 'rules' => $result['rules'], ], ]; } $hideSearch = ('true' === api_get_setting('session.hide_search_form_in_session_list')); $copySessionContentLink = ''; if ($addSessionContent) { $copySessionContentLink = ' '. Display::return_icon('copy.png', get_lang('CopyWithSessionContent'), '', ICON_SIZE_SMALL).''; } //With this function we can add actions to the jgrid (edit, delete, etc) $action_links = 'function action_formatter(cellvalue, options, rowObject) { return \''.Display::getMdiIcon('pencil', 'ch-tool-icon', null, 22, get_lang('Edit')).''. ' '.Display::getMdiIcon('account-multiple-plus', 'ch-tool-icon', null, 22, get_lang('Subscribe users to this session')).''. ' '.Display::getMdiIcon('book-open-page-variant', 'ch-tool-icon', null, 22, get_lang('Add courses to this session')).''. ' '.Display::getMdiIcon('text-box-plus', 'ch-tool-icon', null, 22, get_lang('Copy')).''. $copySessionContentLink. ''. '\'; }'; $urlAjaxExtraField = api_get_path(WEB_AJAX_PATH).'extra_field.ajax.php?1=1'; $orderUrl = api_get_path(WEB_AJAX_PATH).'session.ajax.php?a=order'; $deleteUrl = api_get_self().'?list_type='.$listType.'&action=delete_multiple'; $copyUrl = api_get_self().'?list_type='.$listType.'&action=copy_multiple'; $exportUrl = api_get_self().'?list_type='.$listType.'&action=export_multiple'; $exportCsvUrl = api_get_self().'?list_type='.$listType.'&action=export_csv'; $extra_params['multiselect'] = true; ?> '. Display::getMdiIcon('google-classroom', 'ch-tool-icon-gradient', null, 32, get_lang('Add a training session')).''; if (api_is_platform_admin()) { $actionsLeft .= ''. Display::getMdiIcon('tab-plus', 'ch-tool-icon-gradient', null, 32, get_lang('Add training sessions to categories')).''; $actionsLeft .= ''. Display::getMdiIcon('file-tree-outline', 'ch-tool-icon-gradient', null, 32, get_lang('Sessions categories list')).''; } echo $actions; if (api_is_platform_admin()) { $actionsRight .= $sessionFilter->returnForm(); // Create a search-box $form = new FormValidator( 'search_simple', 'get', api_get_self().'?list_type='.$listType, '', [], FormValidator::LAYOUT_INLINE ); $form->addElement('text', 'keyword', null, ['aria-label' => get_lang('Search')]); $form->addHidden('list_type', $listType); $form->addButtonSearch(get_lang('Search')); $actionsRight .= $form->returnForm(); } echo Display::toolbarAction('toolbar', [$actionsLeft, $actionsRight]); echo SessionManager::getSessionListTabs($listType); echo '
'; echo Display::grid_html('sessions'); echo '
'; Display::display_footer();