addElement( 'select_ajax', 'course_name', get_lang('SearchCourse'), null, array('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 $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=s.name&searchString='.Security::remove_XSS($_REQUEST['keyword']).'&searchOper=bw'; } 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=bw'; } } $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'; $extra_params['postData'] = array( 'filters' => array( "groupOp" => "AND", "rules" => $result['rules'], /*array( array( "field" => "display_start_date", "op" => "gt", "data" => ""), array( "field" => "display_end_date", "op" => "gt", "data" => "") ),*/ //'groups' => $groups ) ); $defaultValues = []; $filters = isset($_GET['filters']) ? $_GET['filters'] : ''; $filterToSend = []; if (!empty($filters)) { $filterToSend = ['groupOp' => 'AND']; $filters = unserialize(urldecode($filters)); if ($filters) { $count = 1; $countExtraField = 1; foreach ($result['column_model'] as $column) { if ($count > 5) { if (isset($filters[$column['name']])) { $defaultValues['jqg'.$countExtraField] = $filters[$column['name']]; $filterToSend['rules'][] = ['field' => $column['name'], 'op' => 'cn', 'data' => $filters[$column['name']]]; } $countExtraField++; } $count++; } } } $defaultValues = json_encode($defaultValues); // 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 $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=s.name&searchString='.Security::remove_XSS($_REQUEST['keyword']).'&searchOper=bw'; } 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=bw'; } } $url .= '&list_type='.$list_type; //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('SubscribeUsersToSession'), '', ICON_SIZE_SMALL).''. ' '.Display::return_icon('courses_to_session.png', get_lang('SubscribeCoursesToSession'), '', 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'; ?>
'. Display::return_icon('new_session.png', get_lang('AddSession'), '', ICON_SIZE_MEDIUM).''; if (api_is_platform_admin()) { echo ''. Display::return_icon('session_to_category.png', get_lang('AddSessionsInCategories'), '', ICON_SIZE_MEDIUM).''; echo ''. Display::return_icon('folder.png', get_lang('ListSessionCategory'), '', ICON_SIZE_MEDIUM).''; } if ($list_type == 'complete') { echo ''.Display::return_icon('view_remove.png', get_lang('Simple'), '', ICON_SIZE_MEDIUM).''; } else { echo ''.Display::return_icon('view_text.png', get_lang('Complete'), '', ICON_SIZE_MEDIUM).''; } echo $actions; if (api_is_platform_admin()) { echo '
'; // Create a search-box $form = new FormValidator( 'search_simple', 'get', '', '', [], FormValidator::LAYOUT_INLINE ); $form->addElement('text', 'keyword', null, array( 'aria-label' => get_lang('Search') )); $form->addButtonSearch(get_lang('Search')); $form->display(); echo '
'; echo '
'; echo $sessionFilter->returnForm(); echo '
'; } echo '
'; echo '
'; echo Display::grid_html('sessions'); echo '
'; Display::display_footer();