addElement( 'select_ajax', 'course_name', get_lang('Search courses'), null, [ 'id' => 'course_name', 'url' => api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_course', ] ); if (!empty($courseId)) { $courseInfo = api_get_course_info_by_id($courseId); $parents = CourseCategory::getParentsToString($courseInfo['categoryCode']); $courseSelect->addOption($parents.$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?a=get_sessions&_force_search=true&rows=20&page=1&sidx=&sord=asc&filters='.$filter.'&searchField=s.name&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?a=get_sessions&_force_search=true&rows=20&page=1&sidx=&sord=asc&filters=&searchField=sc.name&searchString='.Security::remove_XSS($sessionCategory['name']).'&searchOper=in'; } } $url .= '&list_type='.$list_type; $result = SessionManager::getGridColumns($list_type); $columns = $result['columns']; $column_model = $result['column_model']; // Autowidth $extra_params['autowidth'] = 'true'; // height auto $extra_params['height'] = 'auto'; if (!isset($_GET['keyword'])) { $extra_params['postData'] = [ 'filters' => [ 'groupOp' => 'AND', 'rules' => $result['rules'], ], ]; } $hideSearch = api_get_configuration_value('hide_search_form_in_session_list'); //With this function we can add actions to the jgrid (edit, delete, etc) $action_links = 'function action_formatter(cellvalue, options, rowObject) { return \''.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).''. ' '.Display::return_icon('user_subscribe_session.png', get_lang('Subscribe users to this session'), '', ICON_SIZE_SMALL).''. ' '.Display::return_icon('courses_to_session.png', get_lang('Add courses to this session'), '', ICON_SIZE_SMALL).''. ' '.Display::return_icon('copy.png', get_lang('Copy'), '', ICON_SIZE_SMALL).''. ' '.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).''. '\'; }'; $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'; ?>