"index.php","name" => get_lang('PlatformAdmin')); $tool_name = get_lang('SessionList'); Display::display_header($tool_name); $error_message = ''; // Avoid conflict with the global variable $error_msg (array type) in add_course.conf.php. if (isset($_GET['action']) && $_GET['action'] == 'show_message') { $error_message = Security::remove_XSS($_GET['message']); } if (!empty($error_message)) { Display::display_normal_message($error_message, false); } $sessionFilter = new FormValidator('course_filter', 'get', '', '', array(), FormValidator::LAYOUT_INLINE); $url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_course'; $courseList = array(); $courseId = isset($_GET['course_id']) ? $_GET['course_id'] : null; if (!empty($courseId)) { $courseInfo = api_get_course_info_by_id($courseId); $parents = getParentsToString($courseInfo['categoryCode']); $courseList[] = array('id' => $courseInfo['code'], 'text' => $parents.$courseInfo['title']); } $sessionFilter->addElement('select_ajax', 'course_name', get_lang('SearchCourse'), null, array('url' => $url, 'defaults' => $courseList)); $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'; } } //The order is important you need to check the the $column variable in the model.ajax.php file $columns = array( get_lang('Name'), get_lang('NumberOfCourses'), get_lang('NumberOfUsers'), get_lang('SessionCategoryName'), get_lang('StartDate'), get_lang('EndDate'), get_lang('Coach'), get_lang('Status'), get_lang('Visibility'), get_lang('Actions') ); //Column config $column_model = array( array('name'=>'name', 'index'=>'s.name', 'width'=>'160', 'align'=>'left', 'search' => 'true', 'wrap_cell' => "true"), array('name'=>'nbr_courses', 'index'=>'nbr_courses', 'width'=>'30', 'align'=>'left', 'search' => 'true'), array('name'=>'nbr_users', 'index'=>'nbr_users', 'width'=>'30', 'align'=>'left', 'search' => 'true'), array('name'=>'category_name', 'index'=>'sc.name', 'width'=>'70', 'align'=>'left', 'search' => 'true'), array('name'=>'date_start', 'index'=>'s.date_start', 'width'=>'40', 'align'=>'left', 'search' => 'true'), array('name'=>'date_end', 'index'=>'s.date_end', 'width'=>'40', 'align'=>'left', 'search' => 'true'), array('name'=>'coach_name', 'index'=>'coach_name', 'width'=>'80', 'align'=>'left', 'search' => 'false'), array('name'=>'status', 'index'=>'session_active','width'=>'45', 'align'=>'left', 'search' => 'true', 'stype'=>'select', //for the bottom bar 'searchoptions' => array( 'defaultValue' => ':', 'value' => ':'.get_lang('All').';1:'.get_lang('Active').';0:'.get_lang('Inactive') ), //for the top bar 'editoptions' => array( 'value' => ':'.get_lang('All').';1:'.get_lang('Active').';0:'.get_lang('Inactive') ) ), array('name'=>'visibility', 'index'=>'visibility', 'width'=>'45', 'align'=>'left', 'search' => 'false'), array('name'=>'actions', 'index'=>'actions', 'width'=>'90', 'align'=>'left','formatter'=>'action_formatter','sortable'=>'false', 'search' => 'false') ); //Autowidth $extra_params['autowidth'] = 'true'; //height auto $extra_params['height'] = 'auto'; //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).''. '\'; }'; ?>