$all_datas = array(); $course_code = $_course['id']; $user_ids = array_keys($a_students); $table = new SortableTable( 'users_tracking', array('TrackingCourseLog', 'get_number_of_users'), array('TrackingCourseLog', 'get_user_data'), (api_is_western_name_order() xor api_sort_by_first_name()) ? 3 : 2); $parameters['cidReq'] = Security::remove_XSS($_GET['cidReq']); $parameters['id_session'] = $session_id; $parameters['from'] = isset($_GET['myspace']) ? Security::remove_XSS($_GET['myspace']) : null; $table->set_additional_parameters($parameters); $tab_table_header = array(); // tab of header texts $table->set_header(0, get_lang('OfficialCode'), true); $tab_table_header[] = get_lang('OfficialCode'); if ($is_western_name_order) { $table->set_header(1, get_lang('FirstName'), true); $tab_table_header[] = get_lang('FirstName'); $table->set_header(2, get_lang('LastName'), true); $tab_table_header[] = get_lang('LastName'); } else { $table->set_header(1, get_lang('LastName'), true); $tab_table_header[] = get_lang('LastName'); $table->set_header(2, get_lang('FirstName'), true); $tab_table_header[] = get_lang('FirstName'); }
static function print_activities_stats() { echo '<h4>' . get_lang('ImportantActivities') . '</h4>'; // Create a search-box $form = new FormValidator('search_simple', 'get', api_get_path(WEB_CODE_PATH) . 'admin/statistics/index.php', '', 'width=200px', false); $renderer =& $form->defaultRenderer(); $renderer->setElementTemplate('<span>{element}</span> '); $form->addElement('hidden', 'report', 'activities'); $form->addElement('hidden', 'activities_direction', 'DESC'); $form->addElement('hidden', 'activities_column', '4'); $form->addElement('text', 'keyword', get_lang('keyword')); $form->addElement('style_submit_button', 'submit', get_lang('Search'), 'class="search"'); echo '<div class="actions">'; $form->display(); echo '</div>'; $table = new SortableTable('activities', array('Statistics', 'get_number_of_activities'), array('Statistics', 'get_activities_data'), 5, 50, 'DESC'); $parameters = array(); $parameters['report'] = 'activities'; if (isset($_GET['keyword'])) { $parameters['keyword'] = Security::remove_XSS($_GET['keyword']); } $table->set_additional_parameters($parameters); $table->set_header(0, get_lang('EventType')); $table->set_header(1, get_lang('DataType')); $table->set_header(2, get_lang('Value')); $table->set_header(3, get_lang('UserName')); $table->set_header(4, get_lang('IPAddress')); $table->set_header(5, get_lang('Date')); $table->display(); }
function display_data($return = false) { $count = array($this, 'count'); $data = array($this, 'get_data'); $parameters = array(); $parameters['sec_token'] = Security::get_token(); $parameters['ceiling'] = $this->get_ceiling(); $parameters['active_only'] = $this->get_active_only() ? 'true' : 'false'; $additional_parameters = $this->get_additional_parameters(); $parameters = array_merge($additional_parameters, $parameters); $table = new SortableTable('users', $count, $data, 1, 50); $table->set_additional_parameters($parameters); $col = 0; $table->set_header($col++, '', false); $table->set_header($col++, get_lang('Code')); $table->set_header($col++, get_lang('FirstName')); $table->set_header($col++, get_lang('LastName')); $table->set_header($col++, get_lang('LoginName')); $table->set_header($col++, get_lang('Email')); $table->set_header($col++, get_lang('Profile')); $table->set_header($col++, get_lang('AuthenticationSource')); $table->set_header($col++, get_lang('RegisteredDate')); $table->set_header($col++, get_lang('LastAccess'), false); $table->set_header($col++, get_lang('Active'), false); $table->set_column_filter(5, array($this, 'format_email')); $table->set_column_filter(6, array($this, 'format_status')); $table->set_column_filter(10, array($this, 'format_active')); $table->set_form_actions(array('activate' => get_lang('Activate'), 'deactivate' => get_lang('Deactivate'), 'delete' => get_lang('Delete'))); if ($return) { return $table->return_table(); } else { echo $table->return_table(); } }
break; case 'show_message': $message = Display::return_message(Security::remove_XSS(stripslashes($_GET['message']))); break; } } // Create a search-box $form = new FormValidator('search_simple', 'get', '', '', null, false); $renderer =& $form->defaultRenderer(); $renderer->setElementTemplate('<span>{element}</span> '); $form->addElement('text', 'keyword', get_lang('keyword')); $form->addElement('button', 'submit', get_lang('Search')); $content .= $form->return_form(); // Create the sortable table with class information $table = new SortableTable('classes', 'get_number_of_classes', 'get_class_data', 1); $table->set_additional_parameters(array('keyword' => $_GET['keyword'])); $table->set_header(0, '', false); $table->set_header(1, get_lang('ClassName')); $table->set_header(2, get_lang('NumberOfUsers')); $table->set_header(3, '', false); $table->set_column_filter(3, 'modify_filter'); $table->set_form_actions(array('delete_classes' => get_lang('DeleteSelectedClasses')), 'class'); $content .= $table->return_table(); $actions .= Display::url(Display::return_icon('add.png', get_lang('Add'), array(), ICON_SIZE_MEDIUM), 'class_add.php'); $actions .= Display::url(Display::return_icon('import_csv.png', get_lang('AddUsersToAClass'), array(), ICON_SIZE_MEDIUM), 'class_user_import.php'); $actions .= Display::url(Display::return_icon('import_csv.png', get_lang('ImportClassListCSV'), array(), ICON_SIZE_MEDIUM), 'class_import.php'); $app['title'] = $tool_name; $tpl = $app['template']; $tpl->assign('content', $content); $tpl->assign('actions', $actions); $tpl->assign('message', $message);
/** * @return string */ static function outbox_display() { $social_link = false; if (isset($_REQUEST['f']) && $_REQUEST['f'] == 'social') { $social_link = 'f=social'; } $success = get_lang('SelectedMessagesDeleted') . ' </b><br /><a href="outbox.php?' . $social_link . '">' . get_lang('BackToOutbox') . '</a>'; $html = null; if (isset($_REQUEST['action'])) { switch ($_REQUEST['action']) { case 'delete': $number_of_selected_messages = count($_POST['id']); if ($number_of_selected_messages != 0) { foreach ($_POST['id'] as $index => $message_id) { MessageManager::delete_message_by_user_receiver(api_get_user_id(), $message_id); } } $html .= Display::return_message(api_xml_http_response_encode($success), 'normal', false); break; case 'deleteone': MessageManager::delete_message_by_user_receiver(api_get_user_id(), $_GET['id']); $html .= Display::return_message(api_xml_http_response_encode($success), 'normal', false); $html .= '<br/>'; break; } } // display sortable table with messages of the current user $table = new SortableTable('message_outbox', array('MessageManager', 'get_number_of_messages_sent'), array('MessageManager', 'get_message_data_sent'), 3, 20, 'DESC'); $parameters['f'] = isset($_GET['f']) && $_GET['f'] == 'social' ? 'social' : null; $table->set_additional_parameters($parameters); $table->set_header(0, '', false, array('style' => 'width:15px;')); $table->set_header(1, get_lang('Messages'), false); $table->set_header(2, get_lang('Date'), true, array('style' => 'width:160px;')); $table->set_header(3, get_lang('Modify'), false, array('style' => 'width:70px;')); $table->set_form_actions(array('delete' => get_lang('DeleteSelectedMessages'))); $html .= $table->return_table(); return $html; }
function display_survey_list_for_coach() { $parameters = array(); $parameters['cidReq'] = api_get_course_id(); if (isset($_GET['do_search'])) { $message = get_lang('DisplaySearchResults') . '<br />'; $message .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '">' . get_lang('DisplayAll') . '</a>'; Display::display_normal_message($message, false); } // Create a sortable table with survey-data $table = new SortableTable('surveys_coach', 'get_number_of_surveys_for_coach', 'get_survey_data_for_coach', 2); $table->set_additional_parameters($parameters); $table->set_header(0, '', false); $table->set_header(1, get_lang('SurveyName')); $table->set_header(2, get_lang('SurveyCode')); $table->set_header(3, get_lang('NumberOfQuestions')); $table->set_header(4, get_lang('Author')); //$table->set_header(5, get_lang('Language')); //$table->set_header(6, get_lang('Shared')); $table->set_header(5, get_lang('AvailableFrom')); $table->set_header(6, get_lang('AvailableUntil')); $table->set_header(7, get_lang('Invite')); $table->set_header(8, get_lang('Anonymous')); $table->set_header(9, get_lang('Modify'), false, 'width="130"'); $table->set_column_filter(8, 'anonymous_filter'); $table->set_column_filter(9, 'modify_filter_for_coach'); $table->display(); }
public static function display_tracking_coach_overview($export_csv) { global $charset; if ($export_csv) { $is_western_name_order = api_is_western_name_order(PERSON_NAME_DATA_EXPORT); } else { $is_western_name_order = api_is_western_name_order(); } $sort_by_first_name = api_sort_by_first_name(); $tracking_column = isset($_GET['tracking_list_coaches_column']) ? $_GET['tracking_list_coaches_column'] : ($is_western_name_order xor $sort_by_first_name) ? 1 : 0; $tracking_direction = isset($_GET['tracking_list_coaches_direction']) && in_array(strtoupper($_GET['tracking_list_coaches_direction']), array('ASC', 'DESC', 'ASCENDING', 'DESCENDING', '0', '1')) ? $_GET['tracking_list_coaches_direction'] : 'DESC'; // Prepare array for column order - when impossible, use some of user names. if ($is_western_name_order) { $order = array(0 => 'firstname', 1 => 'lastname', 2 => $sort_by_first_name ? 'firstname' : 'lastname', 3 => 'login_date', 4 => $sort_by_first_name ? 'firstname' : 'lastname', 5 => $sort_by_first_name ? 'firstname' : 'lastname'); } else { $order = array(0 => 'lastname', 1 => 'firstname', 2 => $sort_by_first_name ? 'firstname' : 'lastname', 3 => 'login_date', 4 => $sort_by_first_name ? 'firstname' : 'lastname', 5 => $sort_by_first_name ? 'firstname' : 'lastname'); } $table = new SortableTable('tracking_list_coaches_myspace', array('MySpace', 'count_coaches'), null, ($is_western_name_order xor $sort_by_first_name) ? 1 : 0); $parameters['view'] = 'admin'; $table->set_additional_parameters($parameters); if ($is_western_name_order) { $table->set_header(0, get_lang('FirstName'), true); $table->set_header(1, get_lang('LastName'), true); } else { $table->set_header(0, get_lang('LastName'), true); $table->set_header(1, get_lang('FirstName'), true); } $table->set_header(2, get_lang('TimeSpentOnThePlatform'), false); $table->set_header(3, get_lang('LastConnexion'), false); $table->set_header(4, get_lang('NbStudents'), false); $table->set_header(5, get_lang('CountCours'), false); $table->set_header(6, get_lang('NumberOfSessions'), false); $table->set_header(7, get_lang('Sessions'), false); if ($is_western_name_order) { $csv_header[] = array(get_lang('FirstName', ''), get_lang('LastName', ''), get_lang('TimeSpentOnThePlatform', ''), get_lang('LastConnexion', ''), get_lang('NbStudents', ''), get_lang('CountCours', ''), get_lang('NumberOfSessions', '')); } else { $csv_header[] = array(get_lang('LastName', ''), get_lang('FirstName', ''), get_lang('TimeSpentOnThePlatform', ''), get_lang('LastConnexion', ''), get_lang('NbStudents', ''), get_lang('CountCours', ''), get_lang('NumberOfSessions', '')); } $tbl_track_login = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN); $tbl_user = Database::get_main_table(TABLE_MAIN_USER); $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); $tbl_sessions = Database::get_main_table(TABLE_MAIN_SESSION); $sqlCoachs = "SELECT DISTINCT\n scu.user_id as id_coach,\n u.id as user_id,\n lastname,\n firstname,\n MAX(login_date) as login_date\n FROM {$tbl_user} u, {$tbl_session_course_user} scu, {$tbl_track_login}\n WHERE\n scu.user_id = u.id AND scu.status=2 AND login_user_id=u.id\n GROUP BY user_id "; if (api_is_multiple_url_enabled()) { $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); $access_url_id = api_get_current_access_url_id(); if ($access_url_id != -1) { $sqlCoachs = "SELECT DISTINCT\n scu.user_id as id_coach,\n u.id as user_id,\n lastname,\n firstname,\n MAX(login_date) as login_date\n FROM {$tbl_user} u,\n {$tbl_session_course_user} scu,\n {$tbl_track_login} ,\n {$tbl_session_rel_access_url} session_rel_url\n WHERE\n scu.user_id = u.id AND\n scu.status = 2 AND\n login_user_id = u.id AND\n access_url_id = {$access_url_id} AND\n session_rel_url.session_id = scu.session_id\n GROUP BY u.id"; } } if (!empty($order[$tracking_column])) { $sqlCoachs .= "ORDER BY " . $order[$tracking_column] . " " . $tracking_direction; } $result_coaches = Database::query($sqlCoachs); $total_no_coaches = Database::num_rows($result_coaches); $global_coaches = array(); while ($coach = Database::fetch_array($result_coaches)) { $global_coaches[$coach['user_id']] = $coach; } $sql_session_coach = 'SELECT session.id_coach, u.id as user_id, lastname, firstname, MAX(login_date) as login_date FROM ' . $tbl_user . ' u ,' . $tbl_sessions . ' as session,' . $tbl_track_login . ' WHERE id_coach = u.id AND login_user_id = u.id GROUP BY u.id ORDER BY login_date ' . $tracking_direction; if (api_is_multiple_url_enabled()) { $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); $access_url_id = api_get_current_access_url_id(); if ($access_url_id != -1) { $sql_session_coach = 'SELECT session.id_coach, u.id as user_id, lastname, firstname, MAX(login_date) as login_date FROM ' . $tbl_user . ' u ,' . $tbl_sessions . ' as session, ' . $tbl_track_login . ' , ' . $tbl_session_rel_access_url . ' as session_rel_url WHERE id_coach = u.id AND login_user_id = u.id AND access_url_id = ' . $access_url_id . ' AND session_rel_url.session_id = session.id GROUP BY u.id ORDER BY login_date ' . $tracking_direction; } } $result_sessions_coach = Database::query($sql_session_coach); $total_no_coaches += Database::num_rows($result_sessions_coach); while ($coach = Database::fetch_array($result_sessions_coach)) { $global_coaches[$coach['user_id']] = $coach; } $all_datas = array(); foreach ($global_coaches as $id_coach => $coaches) { $time_on_platform = api_time_to_hms(Tracking::get_time_spent_on_the_platform($coaches['user_id'])); $last_connection = Tracking::get_last_connection_date($coaches['user_id']); $nb_students = count(Tracking::get_student_followed_by_coach($coaches['user_id'])); $nb_courses = count(Tracking::get_courses_followed_by_coach($coaches['user_id'])); $nb_sessions = count(Tracking::get_sessions_coached_by_user($coaches['user_id'])); $table_row = array(); if ($is_western_name_order) { $table_row[] = $coaches['firstname']; $table_row[] = $coaches['lastname']; } else { $table_row[] = $coaches['lastname']; $table_row[] = $coaches['firstname']; } $table_row[] = $time_on_platform; $table_row[] = $last_connection; $table_row[] = $nb_students; $table_row[] = $nb_courses; $table_row[] = $nb_sessions; $table_row[] = '<a href="session.php?id_coach=' . $coaches['user_id'] . '"><img src="' . api_get_path(WEB_IMG_PATH) . 'icons/22/2rightarrow.png" border="0" /></a>'; $all_datas[] = $table_row; if ($is_western_name_order) { $csv_content[] = array(api_html_entity_decode($coaches['firstname'], ENT_QUOTES), api_html_entity_decode($coaches['lastname'], ENT_QUOTES), $time_on_platform, $last_connection, $nb_students, $nb_courses, $nb_sessions); } else { $csv_content[] = array(api_html_entity_decode($coaches['lastname'], ENT_QUOTES), api_html_entity_decode($coaches['firstname'], ENT_QUOTES), $time_on_platform, $last_connection, $nb_students, $nb_courses, $nb_sessions); } } if ($tracking_column != 3) { if ($tracking_direction == 'DESC') { usort($all_datas, array('MySpace', 'rsort_users')); } else { usort($all_datas, array('MySpace', 'sort_users')); } } if ($export_csv && $tracking_column != 3) { usort($csv_content, 'sort_users'); } if ($export_csv) { $csv_content = array_merge($csv_header, $csv_content); } foreach ($all_datas as $row) { $table->addRow($row, 'align="right"'); } $table->display(); }
Display::display_header($tool_name); api_display_tool_title($tool_name); echo $msg; if ($_GET['action'] == 'blackout') { $result = Rsys::black_out_changer($_GET['id']); Display::display_normal_message(get_lang('BlackoutPage' . $result), false); } echo '<form id="cat_form" action="m_item.php" method="get"><div style="float: left;"><a href="m_item.php?action=add">' . get_lang('AddNewItem') . '</a></div><div style="text-align: right;">' . get_lang('CategoryFilter') . ': <select name="cat" onchange="this.form.submit();"><option value="0">*** ' . get_lang('All') . ' ***</option>'; $cats = Rsys::get_category_with_items_manager(); foreach ($cats as $cat) { echo '<option value="' . $cat['id'] . '"' . ($cat['id'] == $_GET['cat'] ? ' selected="selected"' : '') . '>' . $cat['name'] . '</option>'; } echo '</select></div></form>'; echo "hier"; $table = new SortableTable('item', array('Rsys', 'get_num_items'), array('Rsys', 'get_table_items'), 1); echo "hier2"; $table->set_additional_parameters(array('cat' => $_GET['cat'])); $table->set_header(0, '', false, array('style' => 'width:10px')); $table->set_header(1, get_lang('ItemName'), true); $table->set_header(2, get_lang('ItemDescription'), true); $table->set_header(3, get_lang('Category'), true); $table->set_header(4, get_lang('ItemCreator'), true); $table->set_header(5, '', false, array('style' => 'width:100px;')); $table->set_column_filter(5, 'modify_filter'); $table->set_form_actions(array('delete_items' => get_lang('DeleteSelectedItems')), 'items'); $table->display(); } /** --------------------------------------------------------------------- */ Display::display_footer();
/** * Display a sortable table with all the templates that the platform administrator has defined. * * @author Patrick Cool <*****@*****.**>, Ghent University, Belgium * @version August 2008 * @since Dokeos 1.8.6 */ function display_templates() { $table = new SortableTable('templates', 'get_number_of_templates', 'get_template_data', 1); $table->set_additional_parameters(array('category' => Security::remove_XSS($_GET['category']))); $table->set_header(0, get_lang('Image'), true, array('style' => 'width: 101px;')); $table->set_header(1, get_lang('Title')); $table->set_header(2, get_lang('Actions'), false, array('style' => 'width:50px;')); $table->set_column_filter(2, 'actions_filter'); $table->set_column_filter(0, 'image_filter'); $table->display(); }