function selectAll(idCheck,numRows,action) { for(i=0;i '; $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); $tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY); $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); $tbl_session_rel_course_rel_user=Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); $tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER); $tbl_user = Database::get_main_table(TABLE_MAIN_USER); $page=intval($_GET['page']); $action=$_REQUEST['action']; $sort=in_array($_GET['sort'],array('name', 'nbr_courses', 'name_category', 'date_start', 'date_end','visibility'))?$_GET['sort']:'name'; $idChecked = $_REQUEST['idChecked']; $id_category = intval($_REQUEST['id_category']); $cond_url = ''; if ($action == 'delete') { SessionManager::delete_session($idChecked); header('Location: '.api_get_self().'?sort='.$sort); exit(); } $interbreadcrumb[]=array("url" => "index.php","name" => get_lang('PlatformAdmin')); //table for the search if (isset ($_GET['search']) && $_GET['search'] == 'advanced') { $interbreadcrumb[] = array ("url" => 'session_list.php', "name" => get_lang('SessionList')); $tool_name = get_lang('SearchASession'); Display :: display_header($tool_name); $form = new FormValidator('advanced_search','get'); $form->addElement('header', '', $tool_name); $form->add_textfield('keyword_name', get_lang('NameOfTheSession'), false); $form->add_textfield('keyword_category', get_lang('CategoryName'), false); $form->add_textfield('keyword_firstname', get_lang('FirstName'), false); $form->add_textfield('keyword_lastname', get_lang('LastName'), false); $status_options = array(); $status_options['%'] = get_lang('All'); $status_options[SESSION_VISIBLE_READ_ONLY] = get_lang('ReadOnly'); $status_options[SESSION_VISIBLE] = get_lang('Visible'); $status_options[SESSION_INVISIBLE] = get_lang('Invisible'); $form->addElement('select','keyword_visibility',get_lang('Status'),$status_options); $active_group = array(); $active_group[] = $form->createElement('checkbox','active','',get_lang('Active')); $active_group[] = $form->createElement('checkbox','inactive','',get_lang('Inactive')); $form->addGroup($active_group,'',get_lang('ActiveSession'),'
',false); $defaults['active'] = 0; $defaults['inactive'] = 0; $form->addElement('style_submit_button', 'submit',get_lang('Search'),'class="search"'); $form->setDefaults($defaults); $form->display(); } else { $limit=20; $from=$page * $limit; $where = 'WHERE 1=1 '; //Prevent hacking keyword if ( isset ($_GET['keyword'])) { $keyword = Database::escape_string(trim($_GET['keyword'])); } else if (isset ($_GET['keyword_name'])) { $keyword_name = Database::escape_string(trim($_GET['keyword_name'])); $keyword_category = Database::escape_string(trim($_GET['keyword_category'])); $keyword_visibility = Database::escape_string(trim($_GET['keyword_visibility'])); $keyword_firstname = Database::escape_string(trim($_GET['keyword_firstname'])); $keyword_lastname = Database::escape_string(trim($_GET['keyword_lastname'])); } //Process for the search advanced if (!empty($_REQUEST['keyword_name'])) { $where .= " AND s.name LIKE '%".$keyword_name."%'"; } if (!empty($_REQUEST['keyword_category'])) { $where .= " AND sc.name LIKE '%".$keyword_category."%'"; } if (!empty($_REQUEST['keyword_visibility']) AND $_REQUEST['keyword_visibility']!='%') { $where .= " AND s.visibility LIKE '%".$keyword_visibility."%'"; } if (!empty($_REQUEST['keyword_firstname'])) { $where .= " AND u.firstname LIKE '%".$keyword_firstname."%'"; } if (!empty($_REQUEST['keyword_lastname'])) { $where .= " AND u.lastname LIKE '%".$keyword_lastname."%'"; } if (isset($_REQUEST['active']) && isset($_REQUEST['inactive'] )) { // if both are set we search all sessions $cond_url = '&active='.Security::remove_XSS($_REQUEST['active']); $cond_url .= '&inactive='.Security::remove_XSS($_REQUEST['inactive']); } else { if (isset($_REQUEST['active'])) { $where .= ' AND ( (s.date_start <= CURDATE() AND s.date_end >= CURDATE()) OR s.date_start="0000-00-00" ) '; $cond_url = '&active='.Security::remove_XSS($_REQUEST['active']); } if (isset($_REQUEST['inactive'])) { $where .= ' AND ( (s.date_start > CURDATE() AND s.date_end < CURDATE()) AND s.date_start<>"0000-00-00" ) '; $cond_url = '&inactive='.Security::remove_XSS($_REQUEST['inactive']); } } if(isset($_GET['id_category'])){ $where.= ' AND '; $id_category = Security::remove_XSS($id_category); $where.= ' session_category_id = "'.$id_category.'" '; $cond_url.= '&id_category='.$id_category; } $user_id= $_user['user_id']; if (api_is_session_admin()==true) { $where.=" AND s.session_admin_id = $user_id "; } //Get list sessions $sort = ($sort != "name_category")? 's.'.$sort : 'category_name'; $query = "SELECT s.id, s.name, s.nbr_courses, s.date_start, s.date_end, u.firstname, u.lastname , sc.name as category_name, s.visibility FROM $tbl_session s LEFT JOIN $tbl_session_category sc ON s.session_category_id = sc.id INNER JOIN $tbl_user u ON s.id_coach = u.user_id $where ORDER BY $sort "; //query which allows me to get a record without taking into account the page $query_rows = "SELECT count(*) as total_rows FROM $tbl_session s LEFT JOIN $tbl_session_category sc ON s.session_category_id = sc.id INNER JOIN $tbl_user u ON s.id_coach = u.user_id $where "; //filtering the session list by access_url if ($_configuration['multiple_access_urls'] == true){ $table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); $access_url_id = api_get_current_access_url_id(); if ($access_url_id != -1) { $where.= " AND ar.access_url_id = $access_url_id "; $query = "SELECT s.id, s.name, s.nbr_courses, s.date_start, s.date_end, u.firstname, u.lastname , sc.name as category_name , s.visibility FROM $tbl_session s LEFT JOIN $tbl_session_category sc ON s.session_category_id = sc.id INNER JOIN $tbl_user u ON s.id_coach = u.user_id INNER JOIN $table_access_url_rel_session ar ON ar.session_id = s.id $where ORDER BY $sort LIMIT $from,".($limit+1); $query_rows = "SELECT count(*) as total_rows FROM $tbl_session s LEFT JOIN $tbl_session_category sc ON s.session_category_id = sc.id INNER JOIN $tbl_user u ON s.id_coach = u.user_id INNER JOIN $table_access_url_rel_session ar ON ar.session_id = s.id $where "; } } $result_rows = Database::query($query_rows); $recorset = Database::fetch_array($result_rows); $num = $recorset['total_rows']; $result=Database::query($query); $Sessions=Database::store_result($result); $nbr_results=sizeof($Sessions); $tool_name = get_lang('SessionList'); Display::display_header($tool_name); //api_display_tool_title($tool_name); if (!empty($_GET['warn'])) { Display::display_warning_message(urldecode($_GET['warn']),false); } if(isset($_GET['action'])) { Display::display_normal_message(stripslashes($_GET['message']),false); } ?>
'.Display::return_icon('view_more_stats.gif',get_lang('AddSession')).get_lang('AddSession').' '.Display::return_icon('view_more_stats.gif',get_lang('AddSessionsInCategories')).get_lang('AddSessionsInCategories').'
'; ?>

'; } else { if($num>$limit){ if($page) { ?> | $limit) { ?>

$enreg) { if($key == $limit) { break; } $sql = 'SELECT COUNT(course_code) FROM '.$tbl_session_rel_course.' WHERE id_session='.intval($enreg['id']); $rs = Database::query($sql); list($nb_courses) = Database::fetch_array($rs); ?>
 
cours

$limit) { if($page) { ?> | $limit) { ?>

 -