$nbr_affected_rows = Database::affected_rows($result); Database::query("UPDATE {$tbl_session} SET nbr_users=nbr_users-{$nbr_affected_rows} WHERE id='{$id_session}'"); $result = Database::query("DELETE FROM {$tbl_session_rel_course_rel_user} WHERE session_id ='{$id_session}' AND user_id=" . intval($_GET['user'])); $nbr_affected_rows = Database::affected_rows($result); Database::query("UPDATE {$tbl_session_rel_course} SET nbr_users=nbr_users-{$nbr_affected_rows} WHERE session_id ='{$id_session}'"); } break; } Display::display_header($tool_name); if (!empty($_GET['warn'])) { Display::display_warning_message(urldecode($_GET['warn'])); } if (!empty($message)) { echo $message; } echo Display::page_header(Display::return_icon('session.png', get_lang('Session')) . ' ' . $session['name']); echo Display::page_subheader(get_lang('GeneralProperties') . $url); ?> <!-- General properties --> <table class="data_table"> <tr> <td><?php echo get_lang('GeneralCoach'); ?> :</td> <td><?php echo api_get_person_name($session['firstname'], $session['lastname']) . ' (' . $session['username'] . ')'; ?> </td> </tr> <?php
/* For licensing terms, see /license.txt */ /** * Script * @package chamilo.gradebook */ //$cidReset = true; require_once '../inc/global.inc.php'; api_block_anonymous_users(); GradebookUtils::block_students(); $interbreadcrumb[] = array('url' => $_SESSION['gradebook_dest'] . '?', 'name' => get_lang('Gradebook')); $interbreadcrumb[] = array('url' => $_SESSION['gradebook_dest'] . '?selectcat=' . Security::remove_XSS($_GET['selectcat']), 'name' => get_lang('Details')); $interbreadcrumb[] = array('url' => 'gradebook_showlog_eval.php?visiblelog=' . Security::remove_XSS($_GET['visiblelog']) . '&selectcat=' . Security::remove_XSS($_GET['selectcat']), 'name' => get_lang('GradebookQualifyLog')); $this_section = SECTION_COURSES; Display::display_header(''); echo Display::page_header(get_lang('GradebookQualifyLog')); $t_linkeval_log = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG); $t_user = Database::get_main_table(TABLE_MAIN_USER); $visible_log = Security::remove_XSS($_GET['visiblelog']); $evaledit = Evaluation::load($visible_log); $sql = "SELECT le.name,le.description,le.weight,le.visible,le.type,le.created_at,us.username FROM " . $t_linkeval_log . " le INNER JOIN " . $t_user . " us\n ON le.user_id_log=us.user_id where id_linkeval_log=" . $evaledit[0]->get_id() . " and type='evaluation';"; $result = Database::query($sql); $list_info = array(); while ($row = Database::fetch_row($result)) { $list_info[] = $row; } foreach ($list_info as $key => $info_log) { $list_info[$key][5] = $info_log[5] ? api_convert_and_format_date($info_log[5]) : 'N/A'; $list_info[$key][3] = $info_log[3] == 1 ? get_lang('GradebookVisible') : get_lang('GradebookInvisible'); } $parameters = array('visiblelog' => $visible_log, 'selectcat' => intval($_GET['selectcat']));
$this_section = SECTION_COURSES; $current_course_tool = TOOL_COURSE_MAINTENANCE; api_protect_course_script(true); $_course = api_get_course_info(); $current_course_code = $_course['official_code']; $current_course_name = $_course['name']; if (!api_is_allowed_to_edit()) { api_not_allowed(true); } $tool_name = get_lang('DelCourse'); if (isset($_GET['delete']) && $_GET['delete'] == 'yes') { CourseManager::delete_course($_course['sysCode']); $obj_cat = new Category(); $obj_cat->update_category_delete($_course['sysCode']); // DELETE CONFIRMATION MESSAGE Session::erase('_cid'); Session::erase('_real_cid'); $noPHP_SELF = true; $message = '<h2>' . get_lang('Course') . ' : ' . $current_course_name . ' (' . $current_course_code . ') </h2>'; $message .= get_lang('HasDel'); $message .= '<br /><br /><a href="../../index.php">' . get_lang('BackHome') . ' ' . api_get_setting('platform.site_name') . '</a>'; } else { $message = '<h3>' . get_lang('Course') . ' : ' . $current_course_name . ' (' . $current_course_code . ') </h3>'; $message .= '<p>' . get_lang('ByDel') . '</p>'; $message .= '<p><a class="btn btn-primary" href="' . api_get_path(WEB_CODE_PATH) . 'course_info/maintenance.php?' . api_get_cidreq() . '">' . get_lang('No') . '</a> <a class="btn" href="' . api_get_self() . '?delete=yes&' . api_get_cidreq() . '">' . get_lang('Yes') . '</a></p>'; $interbreadcrumb[] = array('url' => 'maintenance.php', 'name' => get_lang('Maintenance')); } Display::display_header($tool_name, 'Settings'); echo Display::page_header($tool_name); Display::display_warning_message($message, false); Display::display_footer();
} $table->set_header(3, get_lang('Email'), true); $table->set_header(4, get_lang('Status'), true); $table->set_header(5, '', false); $table->display(); } else { echo get_lang('NoUsersInCourse'); } $session_list = SessionManager::get_session_by_course($course->code); $url = api_get_path(WEB_CODE_PATH); if (!empty($session_list)) { foreach ($session_list as &$session) { $session[0] = Display::url($session[0], $url . 'admin/resume_session.php?id_session=' . $session['id']); unset($session[1]); } echo Display::page_header(get_lang('Sessions')); $table = new SortableTableFromArray($session_list, 0, 20, 'user_table'); $table->display(); } /*$group = new UserGroup(); $usegroups = $group->get_usergroup_by_course($course->id);*/ /*@todo This should be dissapear classes are a deprecated feature*/ /* //Show all classes subscribed in this course $table_course_class = Database :: get_main_table(TABLE_MAIN_COURSE_CLASS); $table_class = Database :: get_main_table(TABLE_MAIN_CLASS); $sql = "SELECT * FROM $table_course_class cc, $table_class c WHERE cc.class_id = c.id AND cc.course_code = '".$code."'"; $res = Database::query($sql); if (Database::num_rows($res) > 0) { $data = array ();
} } // Display header Display::display_header($tool_name); // actions if ($userStatus != STUDENT_BOSS) { $actionsLeft = Display::url(Display::return_icon('course-add.png', get_lang('AssignCourses'), null, ICON_SIZE_MEDIUM), "dashboard_add_courses_to_user.php?user={$user_id}"); $actionsLeft .= Display::url(Display::return_icon('session-add.png', get_lang('AssignSessions'), null, ICON_SIZE_MEDIUM), "dashboard_add_sessions_to_user.php?user={$user_id}"); } $actionsRight = Display::url('<em class="fa fa-search"></em> ' . get_lang('AdvancedSearch'), '#', array('class' => 'btn btn-default advanced_options', 'id' => 'advanced_search')); $toolbar = Display::toolbarAction('toolbar-dashboard', $content = array(0 => $actionsLeft, 1 => $actionsRight)); echo $toolbar; echo '<div id="advanced_search_options" style="display:none">'; $searchForm->display(); echo '</div>'; echo Display::page_header(sprintf(get_lang('AssignUsersToX'), api_get_person_name($user_info['firstname'], $user_info['lastname'])), null, $size = 'h3'); $assigned_users_to_hrm = array(); switch ($userStatus) { case DRH: //no break; //no break; case PLATFORM_ADMIN: $assigned_users_to_hrm = UserManager::get_users_followed_by_drh($user_id); break; case STUDENT_BOSS: $assigned_users_to_hrm = UserManager::getUsersFollowedByStudentBoss($user_id); break; } $assigned_users_id = array_keys($assigned_users_to_hrm); $without_assigned_users = ''; if (count($assigned_users_id) > 0) {
$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 \'<a href="?action=edit&' . $params . '&id=\'+options.rowId+\'">' . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a>' . ' <a onclick="javascript:if(!confirm(' . "\\'" . addslashes(get_lang("ConfirmYourChoice")) . "\\'" . ')) return false;" href="?sec_token=' . $token . '&action=delete&' . $params . '&id=\'+options.rowId+\'">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>' . '\'; }'; $htmlHeadXtra[] = ' <script> $(function() { // grid definition see the $obj->display() function ' . Display::grid_js('extra_field_options', $url, $columns, $column_model, $extra_params, array(), $action_links, true) . ' }); </script>'; // The header. Display::display_header($tool_name); echo Display::page_header($extra_field_info['field_display_text']); $obj = new ExtraFieldOption($extra_field->type); $obj->field_id = $field_id; // Action handling: Add switch ($action) { case 'add': if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { api_not_allowed(); } $url = api_get_self() . '?action=' . Security::remove_XSS($_GET['action']) . '&' . $params; $form = $obj->return_form($url, 'add'); // The validation or display if ($form->validate()) { if ($check) { $values = $form->exportValues(); $res = $obj->save_one_item($values);
/** * @param array $user_data result of api_get_user_info() * @param null $start_date * @param null $duration * @param string $ip Optional. The user IP * @return string */ public function show_exercise_result_header($user_data, $start_date = null, $duration = null, $ip = null) { $array = array(); if (!empty($user_data)) { $array[] = array('title' => get_lang('Name'), 'content' => $user_data['complete_name']); $array[] = array('title' => get_lang('Username'), 'content' => $user_data['username']); if (!empty($user_data['official_code'])) { $array[] = array('title' => get_lang('OfficialCode'), 'content' => $user_data['official_code']); } } // Description can be very long and is generally meant to explain // rules *before* the exam. Leaving here to make display easier if // necessary /* if (!empty($this->description)) { $array[] = array('title' => get_lang("Description"), 'content' => $this->description); } */ if (!empty($start_date)) { $array[] = array('title' => get_lang('StartDate'), 'content' => $start_date); } if (!empty($duration)) { $array[] = array('title' => get_lang('Duration'), 'content' => $duration); } if (!empty($ip)) { $array[] = array('title' => get_lang('IP'), 'content' => $ip); } $html = '<div class="question-result">'; $html .= Display::page_header(Display::return_icon('test-quiz.png', get_lang('Result'), null, ICON_SIZE_MEDIUM) . ' ' . $this->exercise . ' : ' . get_lang('Result')); $html .= Display::description($array); $html .= "</div>"; return $html; }
foreach ($group_cats as $index => $category) { $categoryId = $category['id']; $group_list = GroupManager::get_group_list($categoryId); $groupToShow = GroupManager::process_groups($group_list, $categoryId); if (empty($groupToShow)) { continue; } $label = Display::label(count($group_list) . ' ' . get_lang('ExistingGroups'), 'info'); $actions = null; if (api_is_allowed_to_edit(false, true) && !empty($categoryId)) { $actions .= '<a href="group_category.php?' . api_get_cidreq() . '&id=' . $categoryId . '" title="' . get_lang('Edit') . '">' . Display::return_icon('edit.png', get_lang('EditGroup'), '', ICON_SIZE_SMALL) . '</a>'; $actions .= Display::url(Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL), 'group.php?' . api_get_cidreq() . '&action=delete_category&id=' . $categoryId, array('onclick' => 'javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)) . "'" . ')) return false;')); if ($index != 0) { $actions .= ' <a href="group.php?' . api_get_cidreq() . '&action=swap_cat_order&id1=' . $categoryId . '&id2=' . $group_cats[$index - 1]['id'] . '">' . Display::return_icon('up.png', ' ', '', ICON_SIZE_SMALL) . '</a>'; } if ($index != count($group_cats) - 1) { $actions .= ' <a href="group.php?' . api_get_cidreq() . '&action=swap_cat_order&id1=' . $categoryId . '&id2=' . $group_cats[$index + 1]['id'] . '">' . Display::return_icon('down.png', ' ', '', ICON_SIZE_SMALL) . '</a>'; } } echo Display::page_header(Security::remove_XSS($category['title'] . ' ' . $label . ' ') . $actions, null, 'h4', false); echo $category['description']; echo $groupToShow; } } else { $group_list = GroupManager::get_group_list(); echo GroupManager::process_groups($group_list); } if (!isset($_GET['origin']) || $_GET['origin'] != 'learnpath') { Display::display_footer(); } Session::write('_gid', 0);
// forcing the escape_string $courseInfo = api_get_course_info($courseCode); SessionManager::unsubscribe_course_from_session($sessionId, $courseInfo['real_id']); } } if (!empty($_GET['class'])) { $result = Database::query("DELETE FROM {$tbl_session_rel_class}\n WHERE session_id='{$sessionId}' AND class_id=" . intval($_GET['class'])); $nbr_affected_rows = Database::affected_rows($result); Database::query("UPDATE {$tbl_session} SET nbr_classes=nbr_classes-{$nbr_affected_rows} WHERE id='{$sessionId}'"); } if (!empty($_GET['user'])) { SessionManager::unsubscribe_user_from_session($sessionId, $_GET['user']); } break; } $sessionHeader = Display::page_header(Display::return_icon('session.png', get_lang('Session')) . ' ' . $sessionInfo['name'], null, 'h3'); $url = Display::url(Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), "session_edit.php?page=resume_session.php&id={$sessionId}"); $sessionTitle = Display::page_subheader(get_lang('GeneralProperties') . $url); $generalCoach = api_get_user_info($sessionInfo['id_coach']); $sessionField = new ExtraField('session'); $extraFieldData = $sessionField->getDataAndFormattedValues($sessionId); $multiple_url_is_on = api_get_multiple_access_url(); $urlList = []; if ($multiple_url_is_on) { $urlList = UrlManager::get_access_url_from_session($sessionId); } $url = Display::url(Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), "add_courses_to_session.php?page=resume_session.php&id_session={$sessionId}"); $courseListToShow = Display::page_subheader(get_lang('CourseList') . $url); $courseListToShow .= '<table id="session-list-course" class="data_table"> <tr> <th width="35%">' . get_lang('CourseTitle') . '</th>
$htmlHeadXtra[] = ' <script> $(function() { $( ".datepicker" ).datepicker(); }); </script> '; //Changes END $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('AccessDetails')); Display::display_header(''); $main_user_info = api_get_user_info($user_id); $result_to_print = ''; $sql_result = MySpace::get_connections_to_course($user_id, $course_code); $result_to_print = convert_to_string($sql_result); echo Display::page_header(get_lang('DetailsStudentInCourse')); echo Display::page_subheader(get_lang('User') . ': ' . api_get_person_name($main_user_info['firstName'], $main_user_info['lastName']) . ' - ' . get_lang('Course') . ': ' . $course_code); ?> <div> <table width="300"> <FORM name="formulario" action="javascript:path()"> <tr height="2%"> <!-- td height="2%" align = "right"><span class="Filtro">De:</span></td> <td height="2%" align="center"><INPUT hidden TYPE="text" NAME="date1" class = "datepicker" id="fecha_1" /><br /></td --> <td height="2%" align="center"><INPUT hidden TYPE="hidden" NAME="date1" class = "datepicker" id="fecha_1" /><br /></td> </tr> <tr height="2%"> <!-- td height="2%" align = "right"><span class="Filtro">Hasta:</span></td> <td height="2%" align="center"><INPUT hidden TYPE="text" NAME="date2" class = "datepicker" id="fecha_2" /></td -->
} $group_cats = GroupManager::get_categories(api_get_course_id()); echo '</div>'; /* List all categories */ if (api_get_setting('allow_group_categories') == 'true') { foreach ($group_cats as $index => $category) { $group_list = GroupManager::get_group_list($category['id']); $label = Display::label(count($group_list) . ' ' . get_lang('ExistingGroups'), 'info'); $actions = null; if (api_is_allowed_to_edit(false, true)) { $actions .= '<a href="group_category.php?' . api_get_cidreq() . '&id=' . $category['id'] . '" title="' . get_lang('Edit') . '">' . Display::return_icon('edit.png', get_lang('EditGroup'), '', ICON_SIZE_SMALL) . '</a>'; $actions .= '<a href="group.php?' . api_get_cidreq() . '&action=delete_category&id=' . $category['id'] . '" onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES)) . "'" . ')) return false;" title="' . get_lang('Delete') . '">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>'; if ($index != 0) { $actions .= ' <a href="group.php?' . api_get_cidreq() . '&action=swap_cat_order&id1=' . $category['id'] . '&id2=' . $group_cats[$index - 1]['id'] . '">' . Display::return_icon('up.png', ' ', '', ICON_SIZE_SMALL) . '</a>'; } if ($index != count($group_cats) - 1) { $actions .= ' <a href="group.php?' . api_get_cidreq() . '&action=swap_cat_order&id1=' . $category['id'] . '&id2=' . $group_cats[$index + 1]['id'] . '">' . Display::return_icon('down.png', ' ', '', ICON_SIZE_SMALL) . '</a>'; } } echo Display::page_header($category['title'] . ' ' . $label . ' ' . $actions); echo '<p style="margin: 0px;margin-left: 50px;">' . $category['description'] . '</p><p/>'; GroupManager::process_groups($group_list, $category['id']); } } else { $group_list = GroupManager::get_group_list(); GroupManager::process_groups($group_list); } if (!isset($_GET['origin']) || $_GET['origin'] != 'learnpath') { Display::display_footer(); } $_SESSION['_gid'] = 0;
$().ready( function() { $(".select_all").on("click", function() { $("#workflow :checkbox").prop("checked", 1); $("#workflow :hidden").prop("value", 1); return false; }); $(".unselect_all").on("click", function() { $("#workflow :checkbox").prop("checked", 0); $("#workflow :hidden").prop("value", 0); return false; }); }); </script>'; // The header. Display::display_header($tool_name); echo Display::page_header($extraFieldInfo['display_text']); $obj = new ExtraFieldOption($type); $columns = array('display_text', 'option_value', 'option_order'); $result = Database::select('*', $obj->table, array('where' => array("field_id = ? " => $field_id), 'order' => "option_order ASC")); $table = new HTML_Table(array('class' => 'data_table')); $column = 0; $row = 0; $table->setHeaderContents($row, $column, get_lang('CurrentStatus')); $column++; foreach ($result as $item) { $table->setHeaderContents($row, $column, $item['option_display_text']); $column++; } $row++; $form = new FormValidator('workflow', 'post', api_get_self() . '?' . $params); $options = api_get_user_roles();
$("#cev_button").hide(); $("#container-9").tabs({remote: true}); }); </script>';*/ $htmlHeadXtra[] = ' <script> $(function() { $( ".datepicker" ).datepicker(); }); </script> '; //Changes END $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('AccessDetails')); Display::display_header(''); echo Display::page_header('Desempeño Curso'); echo Display::page_subheader('Estadisticas generales'); ?> <div> <table width="300"> <FORM name="formulario" action="javascript:path()"> <tr height="2%"> <!-- td height="2%" align = "right"><span class="Filtro">De:</span></td> <td height="2%" align="center"><INPUT TYPE="text" NAME="date1" class = "datepicker" id="fecha_1" /><br /></td --> <td height="2%" align="center"><INPUT TYPE="hidden" NAME="date1" class = "datepicker" id="fecha_1" /><br /></td> </tr> <tr height="2%"> <!-- td height="2%" align = "right"><span class="Filtro">Hasta:</span></td> <td height="2%" align="center"><INPUT TYPE="text" NAME="date2" class = "datepicker" id="fecha_2" /></td --> <td height="2%" align="center"><INPUT TYPE="hidden" NAME="date2" class = "datepicker" id="fecha_2" /></td> </tr>
if (!api_is_allowed_to_edit()) { api_not_allowed(true); } // Remove memory and time limits as much as possible as this might be a long process... if (function_exists('ini_set')) { api_set_memory_limit('256M'); ini_set('max_execution_time', 1800); //ini_set('post_max_size', "512M"); } // Breadcrumbs $interbreadcrumb[] = array('url' => '../course_info/maintenance.php', 'name' => get_lang('Maintenance')); // The section (for the tabs) $this_section = SECTION_COURSES; // Display the header Display::display_header(get_lang('CopyCourse')); echo Display::page_header(get_lang('CopyCourse')); /* MAIN CODE */ // If a CourseSelectForm is posted or we should copy all resources, then copy them if (isset($_POST['action']) && $_POST['action'] == 'course_select_form' || isset($_POST['copy_option']) && $_POST['copy_option'] == 'full_copy') { if (isset($_POST['action']) && $_POST['action'] == 'course_select_form') { $course = CourseSelectForm::get_posted_course('copy_course'); } else { $cb = new CourseBuilder(); $course = $cb->build(); } $cr = new CourseRestorer($course); $cr->set_file_option($_POST['same_file_name_option']); $cr->restore($_POST['destination_course']); Display::display_normal_message(get_lang('CopyFinished') . ': <a href="' . api_get_course_url($_POST['destination_course']) . '">' . $_POST['destination_course'] . '</a>', false); } elseif (isset($_POST['copy_option']) && $_POST['copy_option'] == 'select_items') { $cb = new CourseBuilder();
* @author Created on 18 October 2006 by Elixir Interactive http://www.elixir-interactive.com * @package chamilo.course_info */ /** * Code */ // Language files that need to be included $language_file = array('admin', 'create_course', 'course_info', 'coursebackup'); require_once '../inc/global.inc.php'; $current_course_tool = TOOL_COURSE_MAINTENANCE; $this_section = SECTION_COURSES; $nameTools = get_lang('Maintenance'); api_protect_course_script(true); api_block_anonymous_users(); Display::display_header($nameTools); echo Display::page_header($nameTools); ?> <div class="sectiontitle"><?php Display::display_icon('save_import.gif', get_lang('backup')); ?> <a href="../coursecopy/backup.php?<?php echo api_get_cidreq(); ?> "><?php echo get_lang('backup'); ?> </a></div> <div class="sectioncomment"> <ul> <li><a href="../coursecopy/create_backup.php?<?php
$tpl->assign('text_after_registration', $text_after_registration); $tpl->assign('hide_header', $hideHeaders); $inscription = $tpl->get_template('auth/inscription.tpl'); $tpl->display($inscription); } } else { // Custom pages if (CustomPages::enabled()) { CustomPages::display(CustomPages::REGISTRATION, array('form' => $form)); } else { if (!api_is_anonymous()) { // Saving user to course if it was set. if (!empty($course_code_redirect)) { $course_info = api_get_course_info($course_code_redirect); if (!empty($course_info)) { if (in_array($course_info['visibility'], array(COURSE_VISIBILITY_OPEN_PLATFORM, COURSE_VISIBILITY_OPEN_WORLD))) { CourseManager::subscribe_user($user_id, $course_info['code']); } } } CourseManager::redirectToCourse([]); } $tpl = new Template($tool_name); $tpl->assign('inscription_header', Display::page_header($tool_name)); $tpl->assign('inscription_content', $content); $tpl->assign('form', $form->returnForm()); $tpl->assign('hide_header', $hideHeaders); $inscription = $tpl->get_template('auth/inscription.tpl'); $tpl->display($inscription); } }
/** * Display list of courses in a category. * (for anonymous users) * * @version 1.1 * @author Patrick Cool <*****@*****.**>, Ghent University - refactoring and code cleaning * @author Julio Montoya <*****@*****.**>, Beeznest template modifs * @assert () !== 0 */ public function return_courses_in_categories() { $result = ''; $stok = Security::get_token(); // Initialization. $user_identified = api_get_user_id() > 0 && !api_is_anonymous(); $web_course_path = api_get_path(WEB_COURSE_PATH); $category = Database::escape_string($_GET['category']); $setting_show_also_closed_courses = api_get_setting('show_closed_courses') == 'true'; // Database table definitions. $main_course_table = Database::get_main_table(TABLE_MAIN_COURSE); $main_category_table = Database::get_main_table(TABLE_MAIN_CATEGORY); // Get list of courses in category $category. $sql_get_course_list = "SELECT * FROM {$main_course_table} cours\n WHERE category_code = '" . Database::escape_string($_GET['category']) . "'\n ORDER BY title, UPPER(visual_code)"; // Showing only the courses of the current access_url_id. if (api_is_multiple_url_enabled()) { $url_access_id = api_get_current_access_url_id(); if ($url_access_id != -1) { $tbl_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); $sql_get_course_list = "SELECT * FROM {$main_course_table} as course INNER JOIN {$tbl_url_rel_course} as url_rel_course\n ON (url_rel_course.c_id = course.id)\n WHERE access_url_id = {$url_access_id} AND category_code = '" . Database::escape_string($_GET['category']) . "' ORDER BY title, UPPER(visual_code)"; } } // Removed: AND cours.visibility='".COURSE_VISIBILITY_OPEN_WORLD."' $sql_result_courses = Database::query($sql_get_course_list); while ($course_result = Database::fetch_array($sql_result_courses)) { $course_list[] = $course_result; } $platform_visible_courses = ''; // $setting_show_also_closed_courses if ($user_identified) { if ($setting_show_also_closed_courses) { $platform_visible_courses = ''; } else { $platform_visible_courses = " AND (t3.visibility='" . COURSE_VISIBILITY_OPEN_WORLD . "' OR t3.visibility='" . COURSE_VISIBILITY_OPEN_PLATFORM . "' )"; } } else { if ($setting_show_also_closed_courses) { $platform_visible_courses = ''; } else { $platform_visible_courses = " AND (t3.visibility='" . COURSE_VISIBILITY_OPEN_WORLD . "' )"; } } $sqlGetSubCatList = "\n SELECT t1.name,t1.code,t1.parent_id,t1.children_count,COUNT(DISTINCT t3.code) AS nbCourse\n FROM {$main_category_table} t1\n LEFT JOIN {$main_category_table} t2 ON t1.code=t2.parent_id\n LEFT JOIN {$main_course_table} t3 ON (t3.category_code=t1.code {$platform_visible_courses})\n WHERE t1.parent_id " . (empty($category) ? "IS NULL" : "='{$category}'") . "\n GROUP BY t1.name,t1.code,t1.parent_id,t1.children_count ORDER BY t1.tree_pos, t1.name"; // Showing only the category of courses of the current access_url_id if (api_is_multiple_url_enabled()) { $url_access_id = api_get_current_access_url_id(); if ($url_access_id != -1) { $tbl_url_rel_course = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE); $sqlGetSubCatList = "\n SELECT t1.name,t1.code,t1.parent_id,t1.children_count,COUNT(DISTINCT t3.code) AS nbCourse\n FROM {$main_category_table} t1\n LEFT JOIN {$main_category_table} t2 ON t1.code=t2.parent_id\n LEFT JOIN {$main_course_table} t3 ON (t3.category_code=t1.code {$platform_visible_courses})\n INNER JOIN {$tbl_url_rel_course} as url_rel_course\n ON (url_rel_course.c_id = t3.id)\n WHERE access_url_id = {$url_access_id} AND t1.parent_id " . (empty($category) ? "IS NULL" : "='{$category}'") . "\n GROUP BY t1.name,t1.code,t1.parent_id,t1.children_count ORDER BY t1.tree_pos, t1.name"; } } $resCats = Database::query($sqlGetSubCatList); $thereIsSubCat = false; if (Database::num_rows($resCats) > 0) { $htmlListCat = Display::page_header(get_lang('CatList')); $htmlListCat .= '<ul>'; while ($catLine = Database::fetch_array($resCats)) { if ($catLine['code'] != $category) { $category_has_open_courses = $this->category_has_open_courses($catLine['code']); if ($category_has_open_courses) { // The category contains courses accessible to anonymous visitors. $htmlListCat .= '<li>'; $htmlListCat .= '<a href="' . api_get_self() . '?category=' . $catLine['code'] . '">' . $catLine['name'] . '</a>'; if (api_get_setting('show_number_of_courses') == 'true') { $htmlListCat .= ' (' . $catLine['nbCourse'] . ' ' . get_lang('Courses') . ')'; } $htmlListCat .= "</li>"; $thereIsSubCat = true; } elseif ($catLine['children_count'] > 0) { // The category has children, subcategories. $htmlListCat .= '<li>'; $htmlListCat .= '<a href="' . api_get_self() . '?category=' . $catLine['code'] . '">' . $catLine['name'] . '</a>'; $htmlListCat .= "</li>"; $thereIsSubCat = true; } elseif (api_get_setting('show_empty_course_categories') == 'true') { $htmlListCat .= '<li>'; $htmlListCat .= $catLine['name']; $htmlListCat .= "</li>"; $thereIsSubCat = true; } // Else don't set thereIsSubCat to true to avoid printing things if not requested. } else { $htmlTitre = '<p>'; if (api_get_setting('show_back_link_on_top_of_tree') == 'true') { $htmlTitre .= '<a href="' . api_get_self() . '"><< ' . get_lang('BackToHomePage') . '</a>'; } if (!is_null($catLine['parent_id']) || api_get_setting('show_back_link_on_top_of_tree') != 'true' && !is_null($catLine['code'])) { $htmlTitre .= '<a href="' . api_get_self() . '?category=' . $catLine['parent_id'] . '"><< ' . get_lang('Up') . '</a>'; } $htmlTitre .= "</p>"; if ($category != "" && !is_null($catLine['code'])) { $htmlTitre .= '<h3>' . $catLine['name'] . "</h3>"; } else { $htmlTitre .= '<h3>' . get_lang('Categories') . "</h3>"; } } } $htmlListCat .= "</ul>"; } $result .= $htmlTitre; if ($thereIsSubCat) { $result .= $htmlListCat; } while ($categoryName = Database::fetch_array($resCats)) { $result .= '<h3>' . $categoryName['name'] . "</h3>\n"; } $numrows = Database::num_rows($sql_result_courses); $courses_list_string = ''; $courses_shown = 0; if ($numrows > 0) { $courses_list_string .= Display::page_header(get_lang('CourseList')); $courses_list_string .= "<ul>"; if (api_get_user_id()) { $courses_of_user = $this->get_courses_of_user(api_get_user_id()); } foreach ($course_list as $course) { // $setting_show_also_closed_courses if (!$setting_show_also_closed_courses) { // If we do not show the closed courses // we only show the courses that are open to the world (to everybody) // and the courses that are open to the platform (if the current user is a registered user. if ($user_identified && $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM || $course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD) { $courses_shown++; $courses_list_string .= "<li>\n"; $courses_list_string .= '<a href="' . $web_course_path . $course['directory'] . '/">' . $course['title'] . '</a><br />'; $course_details = array(); if (api_get_setting('display_coursecode_in_courselist') == 'true') { $course_details[] = $course['visual_code']; } if (api_get_setting('display_teacher_in_courselist') == 'true') { $course_details[] = $course['tutor_name']; } if (api_get_setting('show_different_course_language') == 'true' && $course['course_language'] != api_get_setting('platformLanguage')) { $course_details[] = $course['course_language']; } $courses_list_string .= implode(' - ', $course_details); $courses_list_string .= "</li>\n"; } } else { // We DO show the closed courses. // The course is accessible if (link to the course homepage): // 1. the course is open to the world (doesn't matter if the user is logged in or not): $course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD); // 2. the user is logged in and the course is open to the world or open to the platform: ($user_identified && $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM); // 3. the user is logged in and the user is subscribed to the course and the course visibility is not COURSE_VISIBILITY_CLOSED; // 4. the user is logged in and the user is course admin of te course (regardless of the course visibility setting); // 5. the user is the platform admin api_is_platform_admin(). // $courses_shown++; $courses_list_string .= "<li>\n"; if ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD || $user_identified && $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM || $user_identified && key_exists($course['code'], $courses_of_user) && $course['visibility'] != COURSE_VISIBILITY_CLOSED || $courses_of_user[$course['code']]['status'] == '1' || api_is_platform_admin()) { $courses_list_string .= '<a href="' . $web_course_path . $course['directory'] . '/">'; } $courses_list_string .= $course['title']; if ($course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD || $user_identified && $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM || $user_identified && key_exists($course['code'], $courses_of_user) && $course['visibility'] != COURSE_VISIBILITY_CLOSED || $courses_of_user[$course['code']]['status'] == '1' || api_is_platform_admin()) { $courses_list_string .= '</a><br />'; } $course_details = array(); if (api_get_setting('display_coursecode_in_courselist') == 'true') { $course_details[] = $course['visual_code']; } // if (api_get_setting('display_coursecode_in_courselist') == 'true' && api_get_setting('display_teacher_in_courselist') == 'true') { // $courses_list_string .= ' - '; // } if (api_get_setting('display_teacher_in_courselist') == 'true') { $course_details[] = $course['tutor_name']; } if (api_get_setting('show_different_course_language') == 'true' && $course['course_language'] != api_get_setting('platformLanguage')) { $course_details[] = $course['course_language']; } if (api_get_setting('show_different_course_language') == 'true' && $course['course_language'] != api_get_setting('platformLanguage')) { $course_details[] = $course['course_language']; } $courses_list_string .= implode(' - ', $course_details); // We display a subscription link if: // 1. it is allowed to register for the course and if the course is not already in the courselist of the user and if the user is identiefied // 2. if ($user_identified && !key_exists($course['code'], $courses_of_user)) { if ($course['subscribe'] == '1') { $courses_list_string .= '<form action="main/auth/courses.php?action=subscribe&category=' . Security::remove_XSS($_GET['category']) . '" method="post">'; $courses_list_string .= '<input type="hidden" name="sec_token" value="' . $stok . '">'; $courses_list_string .= '<input type="hidden" name="subscribe" value="' . $course['code'] . '" />'; $courses_list_string .= '<input type="image" name="unsub" src="main/img/enroll.gif" alt="' . get_lang('Subscribe') . '" />' . get_lang('Subscribe') . '</form>'; } else { $courses_list_string .= '<br />' . get_lang('SubscribingNotAllowed'); } } $courses_list_string .= "</li>"; } //end else } // end foreach $courses_list_string .= "</ul>"; } if ($courses_shown > 0) { // Only display the list of courses and categories if there was more than // 0 courses visible to the world (we're in the anonymous list here). $result .= $courses_list_string; } if ($category != '') { $result .= '<p><a href="' . api_get_self() . '"> ' . Display::return_icon('back.png', get_lang('BackToHomePage')) . get_lang('BackToHomePage') . '</a></p>'; } return $result; }
} /* * Unregister from group */ $unsubscribe_group = ''; if (GroupManager::is_self_unregistration_allowed($user_id, $current_group['id'])) { $unsubscribe_group = '<a class="btn btn-default" href="' . api_get_self() . '?selfUnReg=1" onclick="javascript: if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES)) . "'" . ')) return false;">' . get_lang("StudentUnsubscribe") . '</a>'; } echo ' </div>'; /* Main Display Area */ $edit_url = ''; if (api_is_allowed_to_edit(false, true) || GroupManager::is_tutor_of_group(api_get_user_id(), api_get_group_id())) { $my_origin = isset($origin) ? $origin : ''; $edit_url = '<a href="' . api_get_path(WEB_CODE_PATH) . 'group/settings.php?' . api_get_cidreq() . '&origin=' . $my_origin . '">' . Display::return_icon('edit.png', get_lang('EditGroup'), '', ICON_SIZE_SMALL) . '</a>'; } echo Display::page_header(Security::remove_XSS($current_group['name']) . ' ' . $edit_url . ' ' . $subscribe_group . ' ' . $unsubscribe_group); if (!empty($current_group['description'])) { echo '<p>' . Security::remove_XSS($current_group['description']) . '</p>'; } /* * Group Tools */ // If the user is subscribed to the group or the user is a tutor of the group then if (api_is_allowed_to_edit(false, true) || GroupManager::is_user_in_group(api_get_user_id(), $current_group['id'])) { $actions_array = array(); // Link to the forum of this group $forums_of_groups = get_forums_of_group($current_group['id']); if (is_array($forums_of_groups)) { if ($current_group['forum_state'] != GroupManager::TOOL_NOT_AVAILABLE) { foreach ($forums_of_groups as $key => $value) { if ($value['forum_group_public_private'] == 'public' || $value['forum_group_public_private'] == 'private' || !empty($user_is_tutor) || api_is_allowed_to_edit(false, true)) {
$text_after_registration .= $form_register->returnForm(); // Just in case Session::erase('course_redirect'); Session::erase('exercise_redirect'); if (CustomPages::enabled()) { CustomPages::display(CustomPages::REGISTRATION_FEEDBACK, array('info' => $text_after_registration)); } else { //$tpl = new Template($tool_name); echo Container::getTemplating()->render('@template_style/auth/inscription.html.twig', ['inscription_content' => $content, 'text_after_registration' => $text_after_registration, 'hide_header' => $hideHeaders]); } } else { // Custom pages if (CustomPages::enabled()) { CustomPages::display(CustomPages::REGISTRATION, array('form' => $form)); } else { if (!api_is_anonymous()) { // Saving user to course if it was set. if (!empty($course_code_redirect)) { $course_info = api_get_course_info($course_code_redirect); if (!empty($course_info)) { if (in_array($course_info['visibility'], array(COURSE_VISIBILITY_OPEN_PLATFORM, COURSE_VISIBILITY_OPEN_WORLD))) { CourseManager::subscribe_user($user_id, $course_info['code']); } } } CourseManager::redirectToCourse([]); } //$tpl = new Template($tool_name); echo Container::getTemplating()->render('@template_style/auth/inscription.html.twig', ['inscription_header' => Display::page_header($tool_name), 'inscription_content' => $content, 'hide_header' => $hideHeaders, 'form', $form->returnForm()]); } }
/** * Displays announcements as an slideshow * @param int $visible VISIBLE_GUEST, VISIBLE_STUDENT or VISIBLE_TEACHER * @param int $id The identifier of the announcement to display * @param string $type * @return string */ public static function displayAnnouncementsList($visible, $id = null, $type = 'resumed') { $announcements = self::getAnnouncements($visible, $id, $type); $html = null; if (!empty($announcements)) { $html .= Display::page_header(get_lang('SystemAnnouncements')); foreach ($announcements as $announcement) { $html .= Display::page_subheader2($announcement['title']); $html .= "<p> " . $announcement['content'] . "</p>"; } } return $html; }
echo get_lang('Save'); ?> </button> <?php } } ?> </div> </div> </form> <?php } else { echo Display::display_warning_message('<a href="' . api_get_path(WEB_CODE_PATH) . 'user/user.php?' . api_get_cidreq() . '">' . get_lang('ThereAreNoRegisteredLearnersInsidetheCourse') . '</a>', false); } } else { echo Display::page_header(get_lang('AttendanceSheetReport')); // View for students ?> <?php if (!empty($users_presence)) { ?> <div> <table width="250px;"> <tr> <td><?php echo get_lang('ToAttend') . ': '; ?> </td> <td> <center><div class="attendance-faults-bar" style="background-color:<?php echo !empty($faults['color_bar']) ? $faults['color_bar'] : 'none';
$menu_items[] = Display::url(Display::return_icon('session.png', get_lang('Sessions'), array(), 32), 'session.php'); } echo '<div class="actions">'; $nb_menu_items = count($menu_items); if ($nb_menu_items > 1) { foreach ($menu_items as $key => $item) { echo $item; } } if (count($a_courses) > 0) { echo '<span style="float:right">'; echo Display::url(Display::return_icon('printer.png', get_lang('Print'), array(), 32), 'javascript: void(0);', array('onclick' => 'javascript: window.print();')); echo '</span>'; } echo '</div>'; echo Display::page_header($title); } // Database Table Definitions $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); $tbl_user_course = Database::get_main_table(TABLE_MAIN_COURSE_USER); if (isset($_GET['action'])) { if ($_GET['action'] == 'show_message') { Display::display_normal_message(stripslashes($_GET['message']), false); } if ($_GET['action'] == 'error_message') { Display::display_error_message(stripslashes($_GET['message']), false); } } if ($show_import_icon) { echo "<div align=\"right\">"; echo '<a href="user_import.php?id_session=' . $id_session . '&action=export&type=xml">' . Display::return_icon('excel.gif', get_lang('ImportUserListXMLCSV')) . ' ' . get_lang('ImportUserListXMLCSV') . '</a>';
/** * @param int $user_id * @param array $courseInfo * @param int $session_id * @param string $origin * @param bool $export_csv * @param int $lp_id * @param int $lp_item_id * @param int $extendId * @param int $extendAttemptId * @param string $extendedAttempt * @param string $extendedAll * @param string $type classic or simple * @param boolean $allowExtend Optional. Allow or not extend te results * @return null|string */ public static function getLpStats($user_id, $courseInfo, $session_id, $origin, $export_csv, $lp_id, $lp_item_id = null, $extendId = null, $extendAttemptId = null, $extendedAttempt = null, $extendedAll = null, $type = 'classic', $allowExtend = true) { if (empty($courseInfo) || empty($lp_id)) { return null; } $lp_id = intval($lp_id); $lp_item_id = intval($lp_item_id); $user_id = intval($user_id); $session_id = intval($session_id); $origin = Security::remove_XSS($origin); $list = learnpath::get_flat_ordered_items_list($lp_id, 0, $courseInfo['real_id']); $is_allowed_to_edit = api_is_allowed_to_edit(null, true); $course_id = $courseInfo['real_id']; $courseCode = $courseInfo['code']; $session_condition = api_get_session_condition($session_id); // Extend all button $output = null; $extend_all = 0; if ($origin == 'tracking') { $url_suffix = '&session_id=' . $session_id . '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . $lp_id . '&origin=' . $origin; } else { $url_suffix = '&lp_id=' . $lp_id; } if (!empty($extendedAll)) { $extend_all_link = Display::url(Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')), api_get_self() . '?action=stats' . $url_suffix); $extend_all = 1; } else { $extend_all_link = Display::url(Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttempts')), api_get_self() . '?action=stats&extend_all=1' . $url_suffix); } if ($origin != 'tracking') { $output .= '<div class="section-status">'; $output .= Display::page_header(get_lang('ScormMystatus')); $output .= '</div>'; } $actionColumn = null; if ($type == 'classic') { $actionColumn = ' <th>' . get_lang('Actions') . '</th>'; } $output .= '<div class="table-responsive">'; $output .= '<table class="table tracking"> <thead> <tr class="table-header"> <th width="16">' . ($allowExtend == true ? $extend_all_link : ' ') . '</th> <th colspan="4"> ' . get_lang('ScormLessonTitle') . ' </th> <th colspan="2"> ' . get_lang('ScormStatus') . ' </th> <th colspan="2"> ' . get_lang('ScormScore') . ' </th> <th colspan="2"> ' . get_lang('ScormTime') . ' </th> ' . $actionColumn . ' </tr> </thead> <tbody> '; // Going through the items using the $items[] array instead of the database order ensures // we get them in the same order as in the imsmanifest file, which is rather random when using // the database table. $TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM); $TBL_LP_ITEM_VIEW = Database::get_course_table(TABLE_LP_ITEM_VIEW); $TBL_LP_VIEW = Database::get_course_table(TABLE_LP_VIEW); $tbl_quiz_questions = Database::get_course_table(TABLE_QUIZ_QUESTION); $TBL_QUIZ = Database::get_course_table(TABLE_QUIZ_TEST); $tbl_stats_exercices = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES); $tbl_stats_attempts = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT); $sql = "SELECT max(view_count)\n FROM {$TBL_LP_VIEW}\n WHERE\n c_id = {$course_id} AND\n lp_id = {$lp_id} AND\n user_id = {$user_id}\n {$session_condition}"; $res = Database::query($sql); $view = ''; if (Database::num_rows($res) > 0) { $myrow = Database::fetch_array($res); $view = $myrow[0]; } $counter = 0; $total_time = 0; $h = get_lang('h'); if (!empty($export_csv)) { $csv_content[] = array(get_lang('ScormLessonTitle'), get_lang('ScormStatus'), get_lang('ScormScore'), get_lang('ScormTime')); } $result_disabled_ext_all = true; $chapterTypes = learnpath::getChapterTypes(); // Show lp items if (is_array($list) && count($list) > 0) { foreach ($list as $my_item_id) { $extend_this = 0; $order = 'DESC'; if (!empty($extendId) && $extendId == $my_item_id || $extend_all) { $extend_this = 1; $order = 'ASC'; } // Prepare statement to go through each attempt. $viewCondition = null; if (!empty($view)) { $viewCondition = " AND v.view_count = {$view} "; } $sql = "SELECT\n iv.status as mystatus,\n v.view_count as mycount,\n iv.score as myscore,\n iv.total_time as mytime,\n i.id as myid,\n i.lp_id as mylpid,\n iv.lp_view_id as mylpviewid,\n i.title as mytitle,\n i.max_score as mymaxscore,\n iv.max_score as myviewmaxscore,\n i.item_type as item_type,\n iv.view_count as iv_view_count,\n iv.id as iv_id,\n path\n FROM {$TBL_LP_ITEM} as i\n INNER JOIN {$TBL_LP_ITEM_VIEW} as iv\n ON (i.id = iv.lp_item_id AND i.c_id = iv.c_id)\n INNER JOIN {$TBL_LP_VIEW} as v\n ON (iv.lp_view_id = v.id AND v.c_id = iv.c_id)\n WHERE\n v.c_id = {$course_id} AND\n i.id = {$my_item_id} AND\n i.lp_id = {$lp_id} AND\n v.user_id = {$user_id} AND\n v.session_id = {$session_id}\n {$viewCondition}\n ORDER BY iv.view_count {$order} "; $result = Database::query($sql); $num = Database::num_rows($result); $time_for_total = 'NaN'; // Extend all if (($extend_this || $extend_all) && $num > 0) { $row = Database::fetch_array($result); $result_disabled_ext_all = false; if ($row['item_type'] == 'quiz') { // Check results_disabled in quiz table. $my_path = Database::escape_string($row['path']); $sql = "SELECT results_disabled\n FROM {$TBL_QUIZ}\n WHERE\n c_id = {$course_id} AND\n id ='" . $my_path . "'"; $res_result_disabled = Database::query($sql); $row_result_disabled = Database::fetch_row($res_result_disabled); if (Database::num_rows($res_result_disabled) > 0 && (int) $row_result_disabled[0] === 1) { $result_disabled_ext_all = true; } } // If there are several attempts, and the link to extend has been clicked, show each attempt... if ($counter % 2 == 0) { $oddclass = 'row_odd'; } else { $oddclass = 'row_even'; } $extend_link = ''; if (!empty($inter_num)) { $extend_link = Display::url(Display::return_icon('visible.gif', get_lang('HideAttemptView')), api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix); } $title = $row['mytitle']; if (empty($title)) { $title = rl_get_resource_name($courseInfo['code'], $lp_id, $row['myid']); } if (in_array($row['item_type'], $chapterTypes)) { $title = "<h4> {$title} </h4>"; } $lesson_status = $row['mystatus']; $title = Security::remove_XSS($title); $counter++; $action = null; if ($type == 'classic') { $action = '<td></td>'; } if (in_array($row['item_type'], $chapterTypes)) { $output .= '<tr class="' . $oddclass . '"> <td>' . $extend_link . '</td> <td colspan="4"> ' . $title . ' </td> <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type) . '</td> <td colspan="2"></td> <td colspan="2"></td> ' . $action . ' </tr>'; continue; } else { $output .= '<tr class="' . $oddclass . '"> <td>' . $extend_link . '</td> <td colspan="4"> ' . $title . ' </td> <td colspan="2"></td> <td colspan="2"></td> <td colspan="2"></td> ' . $action . ' </tr>'; } $attemptCount = 1; do { // Check if there are interactions below. $extend_attempt_link = ''; $extend_this_attempt = 0; if ((learnpath::get_interactions_count_from_db($row['iv_id'], $course_id) > 0 || learnpath::get_objectives_count_from_db($row['iv_id'], $course_id) > 0) && !$extend_all) { if ($extendAttemptId == $row['iv_id']) { // The extend button for this attempt has been clicked. $extend_this_attempt = 1; $extend_attempt_link = Display::url(Display::return_icon('visible.gif', get_lang('HideAttemptView')), api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix); } else { // Same case if fold_attempt_id is set, so not implemented explicitly. // The extend button for this attempt has not been clicked. $extend_attempt_link = Display::url(Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix); } } if ($counter % 2 == 0) { $oddclass = 'row_odd'; } else { $oddclass = 'row_even'; } $lesson_status = $row['mystatus']; $score = $row['myscore']; $time_for_total = $row['mytime']; $time = learnpathItem::getScormTimeFromParameter('js', $row['mytime']); if ($score == 0) { $maxscore = $row['mymaxscore']; } else { if ($row['item_type'] == 'sco') { if (!empty($row['myviewmaxscore']) && $row['myviewmaxscore'] > 0) { $maxscore = $row['myviewmaxscore']; } elseif ($row['myviewmaxscore'] === '') { $maxscore = 0; } else { $maxscore = $row['mymaxscore']; } } else { $maxscore = $row['mymaxscore']; } } // Remove "NaN" if any (@todo: locate the source of these NaN) $time = str_replace('NaN', '00' . $h . '00\'00"', $time); if ($row['item_type'] != 'dokeos_chapter') { if (!$is_allowed_to_edit && $result_disabled_ext_all) { $view_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting')); } else { switch ($row['item_type']) { case 'sco': if ($maxscore == 0) { $view_score = $score; } else { $view_score = ExerciseLib::show_score($score, $maxscore, false); } break; case 'document': $view_score = $score == 0 ? '/' : ExerciseLib::show_score($score, $maxscore, false); break; default: $view_score = ExerciseLib::show_score($score, $maxscore, false); break; } } $action = null; if ($type == 'classic') { $action = '<td></td>'; } $output .= '<tr class="' . $oddclass . '"> <td></td> <td>' . $extend_attempt_link . '</td> <td colspan="3">' . get_lang('Attempt') . ' ' . $attemptCount . '</td> <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type) . '</td> <td colspan="2">' . $view_score . '</td> <td colspan="2">' . $time . '</td> ' . $action . ' </tr>'; $attemptCount++; if (!empty($export_csv)) { $temp = array(); $temp[] = $title = Security::remove_XSS($title); $temp[] = Security::remove_XSS(learnpathItem::humanize_status($lesson_status, false, $type)); if ($row['item_type'] == 'quiz') { if (!$is_allowed_to_edit && $result_disabled_ext_all) { $temp[] = '/'; } else { $temp[] = $score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)); } } else { $temp[] = $score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)); } $temp[] = $time; $csv_content[] = $temp; } } $counter++; $action = null; if ($type == 'classic') { $action = '<td></td>'; } if ($extend_this_attempt || $extend_all) { $list1 = learnpath::get_iv_interactions_array($row['iv_id']); foreach ($list1 as $id => $interaction) { if ($counter % 2 == 0) { $oddclass = 'row_odd'; } else { $oddclass = 'row_even'; } $student_response = urldecode($interaction['student_response']); $content_student_response = explode('__|', $student_response); if (count($content_student_response) > 0) { if (count($content_student_response) >= 3) { // Pop the element off the end of array. array_pop($content_student_response); } $student_response = implode(',', $content_student_response); } $output .= '<tr class="' . $oddclass . '"> <td></td> <td></td> <td></td> <td>' . $interaction['order_id'] . '</td> <td>' . $interaction['id'] . '</td> <td colspan="2">' . $interaction['type'] . '</td> <td>' . $student_response . '</td> <td>' . $interaction['result'] . '</td> <td>' . $interaction['latency'] . '</td> <td>' . $interaction['time'] . '</td> ' . $action . ' </tr>'; $counter++; } $list2 = learnpath::get_iv_objectives_array($row['iv_id']); foreach ($list2 as $id => $interaction) { if ($counter % 2 == 0) { $oddclass = 'row_odd'; } else { $oddclass = 'row_even'; } $output .= '<tr class="' . $oddclass . '"> <td></td> <td></td> <td></td> <td>' . $interaction['order_id'] . '</td> <td colspan="2">' . $interaction['objective_id'] . '</td> <td colspan="2">' . $interaction['status'] . '</td> <td>' . $interaction['score_raw'] . '</td> <td>' . $interaction['score_max'] . '</td> <td>' . $interaction['score_min'] . '</td> ' . $action . ' </tr>'; $counter++; } } } while ($row = Database::fetch_array($result)); } elseif ($num > 0) { // Not extended. $row = Database::fetch_array($result, 'ASSOC'); $my_id = $row['myid']; $my_lp_id = $row['mylpid']; $my_lp_view_id = $row['mylpviewid']; $my_path = $row['path']; $result_disabled_ext_all = false; if ($row['item_type'] == 'quiz') { // Check results_disabled in quiz table. $my_path = Database::escape_string($my_path); $sql = "SELECT results_disabled\n FROM {$TBL_QUIZ}\n WHERE c_id = {$course_id} AND id ='" . $my_path . "'"; $res_result_disabled = Database::query($sql); $row_result_disabled = Database::fetch_row($res_result_disabled); if (Database::num_rows($res_result_disabled) > 0 && (int) $row_result_disabled[0] === 1) { $result_disabled_ext_all = true; } } // Check if there are interactions below $extend_this_attempt = 0; $inter_num = learnpath::get_interactions_count_from_db($row['iv_id'], $course_id); $objec_num = learnpath::get_objectives_count_from_db($row['iv_id'], $course_id); $extend_attempt_link = ''; if ($inter_num > 0 || $objec_num > 0) { if (!empty($extendAttemptId) && $extendAttemptId == $row['iv_id']) { // The extend button for this attempt has been clicked. $extend_this_attempt = 1; $extend_attempt_link = Display::url(Display::return_icon('visible.gif', get_lang('HideAttemptView')), api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix); } else { // Same case if fold_attempt_id is set, so not implemented explicitly. // The extend button for this attempt has not been clicked. $extend_attempt_link = Display::url(Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix); } } if ($counter % 2 == 0) { $oddclass = 'row_odd'; } else { $oddclass = 'row_even'; } $extend_link = ''; if ($inter_num > 1) { $extend_link = Display::url(Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix); } $lesson_status = $row['mystatus']; $score = $row['myscore']; $subtotal_time = $row['mytime']; while ($tmp_row = Database::fetch_array($result)) { $subtotal_time += $tmp_row['mytime']; } $title = $row['mytitle']; // Selecting the exe_id from stats attempts tables in order to look the max score value. $sql = 'SELECT * FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . $row['path'] . '" AND exe_user_id="' . $user_id . '" AND orig_lp_id = "' . $lp_id . '" AND orig_lp_item_id = "' . $row['myid'] . '" AND c_id = ' . $course_id . ' AND status <> "incomplete" AND session_id = ' . $session_id . ' ORDER BY exe_date DESC LIMIT 1'; $resultLastAttempt = Database::query($sql); $num = Database::num_rows($resultLastAttempt); $id_last_attempt = null; if ($num > 0) { while ($rowLA = Database::fetch_array($resultLastAttempt)) { $id_last_attempt = $rowLA['exe_id']; } } if ($score == 0) { $maxscore = $row['mymaxscore']; } else { if ($row['item_type'] == 'sco') { if (!empty($row['myviewmaxscore']) and $row['myviewmaxscore'] > 0) { $maxscore = $row['myviewmaxscore']; } elseif ($row['myviewmaxscore'] === '') { $maxscore = 0; } else { $maxscore = $row['mymaxscore']; } } else { if ($row['item_type'] == 'quiz') { // Get score and total time from last attempt of a exercise en lp. $sql = "SELECT score\n FROM {$TBL_LP_ITEM_VIEW}\n WHERE\n c_id = {$course_id} AND\n lp_item_id = '" . (int) $my_id . "' AND\n lp_view_id = '" . (int) $my_lp_view_id . "'\n ORDER BY view_count DESC limit 1"; $res_score = Database::query($sql); $row_score = Database::fetch_array($res_score); $sql = "SELECT SUM(total_time) as total_time\n FROM {$TBL_LP_ITEM_VIEW}\n WHERE\n c_id = {$course_id} AND\n lp_item_id = '" . (int) $my_id . "' AND\n lp_view_id = '" . (int) $my_lp_view_id . "'"; $res_time = Database::query($sql); $row_time = Database::fetch_array($res_time); if (Database::num_rows($res_score) > 0 && Database::num_rows($res_time) > 0) { $score = (double) $row_score['score']; $subtotal_time = (int) $row_time['total_time']; } else { $score = 0; $subtotal_time = 0; } // Selecting the max score from an attempt. $sql = "SELECT SUM(t.ponderation) as maxscore\n FROM (\n SELECT DISTINCT\n question_id, marks, ponderation\n FROM {$tbl_stats_attempts} as at\n INNER JOIN {$tbl_quiz_questions} as q\n ON (q.id = at.question_id AND q.c_id = {$course_id})\n WHERE exe_id ='{$id_last_attempt}'\n ) as t"; $result = Database::query($sql); $row_max_score = Database::fetch_array($result); $maxscore = $row_max_score['maxscore']; } else { $maxscore = $row['mymaxscore']; } } } $time_for_total = $subtotal_time; $time = learnpathItem::getScormTimeFromParameter('js', $subtotal_time); if (empty($title)) { $title = rl_get_resource_name($courseInfo['code'], $lp_id, $row['myid']); } $action = null; if ($type == 'classic') { $action = '<td></td>'; } if (in_array($row['item_type'], $chapterTypes)) { $title = Security::remove_XSS($title); $output .= '<tr class="' . $oddclass . '"> <td>' . $extend_link . '</td> <td colspan="4"> <h4>' . $title . '</h4> </td> <td colspan="2">' . learnpathitem::humanize_status($lesson_status) . '</td> <td colspan="2"></td> <td colspan="2"></td> ' . $action . ' </tr>'; } else { $correct_test_link = '-'; if ($row['item_type'] == 'quiz') { $my_url_suffix = '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . intval($row['mylpid']) . '&origin=' . $origin; $sql = 'SELECT * FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . $row['path'] . '" AND exe_user_id="' . $user_id . '" AND orig_lp_id = "' . $lp_id . '" AND orig_lp_item_id = "' . $row['myid'] . '" AND c_id = ' . $course_id . ' AND status <> "incomplete" AND session_id = ' . $session_id . ' ORDER BY exe_date DESC '; $resultLastAttempt = Database::query($sql); $num = Database::num_rows($resultLastAttempt); if ($num > 0) { if ($extendedAttempt == 1 && $lp_id == $my_lp_id && $lp_item_id == $my_id) { $correct_test_link = Display::url(Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')), api_get_self() . '?action=stats' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id); } else { $correct_test_link = Display::url(Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttemptsByExercise')), api_get_self() . '?action=stats&extend_attempt=1' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id); } } } $title = Security::remove_XSS($title); $action = null; if ($type == 'classic') { $action = '<td>' . $correct_test_link . '</td>'; } if ($lp_id == $my_lp_id && false) { $output .= '<tr class =' . $oddclass . '> <td>' . $extend_link . '</td> <td colspan="4">' . $title . '</td> <td colspan="2"> </td> <td colspan="2"> </td> <td colspan="2"> </td> ' . $action . ' </tr>'; $output .= '</tr>'; } else { if ($lp_id == $my_lp_id && $lp_item_id == $my_id) { $output .= "<tr class='{$oddclass}'>"; } else { $output .= "<tr class='{$oddclass}'>"; } $scoreItem = null; if ($row['item_type'] == 'quiz') { if (!$is_allowed_to_edit && $result_disabled_ext_all) { $scoreItem .= Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting')); } else { $scoreItem .= ExerciseLib::show_score($score, $maxscore, false); } } else { $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . $maxscore); } $output .= ' <td>' . $extend_link . '</td> <td colspan="4">' . $title . '</td> <td colspan="2">' . learnpathitem::humanize_status($lesson_status) . '</td> <td colspan="2">' . $scoreItem . '</td> <td colspan="2">' . $time . '</td> ' . $action . ' '; $output .= '</tr>'; } if (!empty($export_csv)) { $temp = array(); $temp[] = api_html_entity_decode($title, ENT_QUOTES); $temp[] = api_html_entity_decode($lesson_status, ENT_QUOTES); if ($row['item_type'] == 'quiz') { if (!$is_allowed_to_edit && $result_disabled_ext_all) { $temp[] = '/'; } else { $temp[] = $score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)); } } else { $temp[] = $score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1)); } $temp[] = $time; $csv_content[] = $temp; } } $counter++; $action = null; if ($type == 'classic') { $action = '<td></td>'; } if ($extend_this_attempt || $extend_all) { $list1 = learnpath::get_iv_interactions_array($row['iv_id']); foreach ($list1 as $id => $interaction) { if ($counter % 2 == 0) { $oddclass = 'row_odd'; } else { $oddclass = 'row_even'; } $output .= '<tr class="' . $oddclass . '"> <td></td> <td></td> <td></td> <td>' . $interaction['order_id'] . '</td> <td>' . $interaction['id'] . '</td> <td colspan="2">' . $interaction['type'] . '</td> <td>' . urldecode($interaction['student_response']) . '</td> <td>' . $interaction['result'] . '</td> <td>' . $interaction['latency'] . '</td> <td>' . $interaction['time'] . '</td> ' . $action . ' </tr>'; $counter++; } $list2 = learnpath::get_iv_objectives_array($row['iv_id']); foreach ($list2 as $id => $interaction) { if ($counter % 2 == 0) { $oddclass = 'row_odd'; } else { $oddclass = 'row_even'; } $output .= '<tr class="' . $oddclass . '"> <td></td> <td></td> <td></td> <td>' . $interaction['order_id'] . '</td> <td colspan="2">' . $interaction['objective_id'] . '</td> <td colspan="2">' . $interaction['status'] . '</td> <td>' . $interaction['score_raw'] . '</td> <td>' . $interaction['score_max'] . '</td> <td>' . $interaction['score_min'] . '</td> ' . $action . ' </tr>'; $counter++; } } // Attempts listing by exercise. if ($lp_id == $my_lp_id && $lp_item_id == $my_id && $extendedAttempt) { // Get attempts of a exercise. if (!empty($lp_id) && !empty($lp_item_id) && $row['item_type'] === 'quiz') { $sql = "SELECT path FROM {$TBL_LP_ITEM}\n WHERE\n c_id = {$course_id} AND\n id = '{$lp_item_id}' AND\n lp_id = '{$lp_id}'"; $res_path = Database::query($sql); $row_path = Database::fetch_array($res_path); if (Database::num_rows($res_path) > 0) { $sql = 'SELECT * FROM ' . $tbl_stats_exercices . ' WHERE exe_exo_id="' . (int) $row_path['path'] . '" AND status <> "incomplete" AND exe_user_id="' . $user_id . '" AND orig_lp_id = "' . (int) $lp_id . '" AND orig_lp_item_id = "' . (int) $lp_item_id . '" AND c_id = ' . $course_id . ' AND session_id = ' . $session_id . ' ORDER BY exe_date'; $res_attempts = Database::query($sql); $num_attempts = Database::num_rows($res_attempts); if ($num_attempts > 0) { $n = 1; while ($row_attempts = Database::fetch_array($res_attempts)) { $my_score = $row_attempts['exe_result']; $my_maxscore = $row_attempts['exe_weighting']; $my_exe_id = $row_attempts['exe_id']; $my_orig_lp = $row_attempts['orig_lp_id']; $my_orig_lp_item = $row_attempts['orig_lp_item_id']; $my_exo_exe_id = $row_attempts['exe_exo_id']; $mktime_start_date = api_strtotime($row_attempts['start_date'], 'UTC'); $mktime_exe_date = api_strtotime($row_attempts['exe_date'], 'UTC'); if ($mktime_start_date && $mktime_exe_date) { $mytime = (int) $mktime_exe_date - (int) $mktime_start_date; $time_attemp = learnpathItem::getScormTimeFromParameter('js', $mytime); $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp); } else { $time_attemp = ' - '; } if (!$is_allowed_to_edit && $result_disabled_ext_all) { $view_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting')); } else { // Show only float when need it if ($my_score == 0) { $view_score = ExerciseLib::show_score(0, $my_maxscore, false); } else { if ($my_maxscore == 0) { $view_score = $my_score; } else { $view_score = ExerciseLib::show_score($my_score, $my_maxscore, false); } } } $my_lesson_status = $row_attempts['status']; if ($my_lesson_status == '') { $my_lesson_status = learnpathitem::humanize_status('completed'); } elseif ($my_lesson_status == 'incomplete') { $my_lesson_status = learnpathitem::humanize_status('incomplete'); } $output .= '<tr class="' . $oddclass . '" > <td></td> <td>' . $extend_attempt_link . '</td> <td colspan="3">' . get_lang('Attempt') . ' ' . $n . '</td> <td colspan="2">' . $my_lesson_status . '</td> <td colspan="2">' . $view_score . '</td> <td colspan="2">' . $time_attemp . '</td>'; if ($action == 'classic') { if ($origin != 'tracking') { if (!$is_allowed_to_edit && $result_disabled_ext_all) { $output .= '<td> <img src="' . api_get_path(WEB_IMG_PATH) . 'quiz_na.gif" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '"> </td>'; } else { $output .= '<td> <a href="../exercice/exercise_show.php?origin=' . $origin . '&id=' . $my_exe_id . '&cidReq=' . $courseCode . '" target="_parent"> <img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '"> </a></td>'; } } else { if (!$is_allowed_to_edit && $result_disabled_ext_all) { $output .= '<td> <img src="' . api_get_path(WEB_IMG_PATH) . 'quiz_na.gif" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></td>'; } else { $output .= '<td> <a href="../exercice/exercise_show.php?cidReq=' . $courseCode . '&origin=correct_exercise_in_lp&id=' . $my_exe_id . '" target="_parent"> <img src="' . api_get_path(WEB_IMG_PATH) . 'quiz.gif" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></a></td>'; } } } $output .= '</tr>'; $n++; } } $output .= '<tr><td colspan="12"> </td></tr>'; } } } } $total_time += $time_for_total; // QUIZZ IN LP $a_my_id = array(); if (!empty($my_lp_id)) { $a_my_id[] = $my_lp_id; } } } // NOT Extend all "left green cross" if (!empty($a_my_id)) { if ($extendedAttempt) { // "Right green cross" extended $total_score = self::get_avg_student_score($user_id, $course_id, $a_my_id, $session_id, false, false); } else { // "Left green cross" extended $total_score = self::get_avg_student_score($user_id, $course_id, $a_my_id, $session_id, false, true); } } else { // Extend all "left green cross" $total_score = self::get_avg_student_score($user_id, $course_id, array($lp_id), $session_id, false, false); } $total_time = learnpathItem::getScormTimeFromParameter('js', $total_time); $total_time = str_replace('NaN', '00' . $h . '00\'00"', $total_time); if (!$is_allowed_to_edit && $result_disabled_ext_all) { $final_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting')); } else { if (is_numeric($total_score)) { $final_score = $total_score . '%'; } else { $final_score = $total_score; } } $progress = learnpath::getProgress($lp_id, $user_id, $course_id, $session_id); if ($counter % 2 == 0) { $oddclass = 'row_odd'; } else { $oddclass = 'row_even'; } $action = null; if ($type == 'classic') { $action = '<td></td>'; } $output .= '<tr class="' . $oddclass . '"> <td></td> <td colspan="4"> <i>' . get_lang('AccomplishedStepsTotal') . '</i> </td> <td colspan="2">' . $progress . '%</td> <td colspan="2"> ' . $final_score . ' </td> <td colspan="2">' . $total_time . '</div> ' . $action . ' </tr>'; $output .= ' </tbody> </table> </div> '; if (!empty($export_csv)) { $temp = array('', '', '', ''); $csv_content[] = $temp; $temp = array(get_lang('AccomplishedStepsTotal'), '', $final_score, $total_time); $csv_content[] = $temp; ob_end_clean(); Export::arrayToCsv($csv_content, 'reporting_learning_path_details'); exit; } return $output; }
/** * Displays announcements as an slideshow * @param int $visible VISIBLE_GUEST, VISIBLE_STUDENT or VISIBLE_TEACHER * @param int $id The identifier of the announcement to display */ public static function display_announcements_slider($visible, $id = null) { $user_selected_language = Database::escape_string(api_get_interface_language()); $table = Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); $cut_size = 500; $now = api_get_utc_datetime(); $sql = "SELECT * FROM " . $table . "\n\t\t\t\tWHERE ( lang = '{$user_selected_language}' OR lang IS NULL) AND ( '{$now}' >= date_start AND '{$now}' <= date_end) "; switch ($visible) { case self::VISIBLE_GUEST: $sql .= " AND visible_guest = 1 "; break; case self::VISIBLE_STUDENT: $sql .= " AND visible_student = 1 "; break; case self::VISIBLE_TEACHER: $sql .= " AND visible_teacher = 1 "; break; } if (isset($id) && !empty($id)) { $id = intval($id); $sql .= " AND id = {$id} "; } if (api_is_multiple_url_enabled()) { $current_url_id = api_get_current_access_url_id(); $sql .= " AND access_url_id IN ('1', '{$current_url_id}') "; } $sql .= " ORDER BY date_start DESC"; $announcements = Database::query($sql); $html = ''; if (Database::num_rows($announcements) > 0) { $html .= Display::page_header(get_lang('SystemAnnouncements')); $html .= '<div id="container-slider" class="span6"><ul id="slider">'; while ($announcement = Database::fetch_object($announcements)) { $content = $announcement->content; $url = api_get_path(WEB_PUBLIC_PATH) . 'news/' . $announcement->id; if (empty($id)) { if (api_strlen(strip_tags($content)) > $cut_size) { $content = Text::cut($announcement->content, $cut_size) . ' ' . Display::url(get_lang('More'), $url); } } $html .= '<li><h2>' . $announcement->title . '</h2>' . $content . '</li>'; } $html .= '</ul></div>'; } return $html; }
if ($affected_rows) { $msg = get_lang('AssignedSessionsHaveBeenUpdatedSuccessfully'); } } // display header Display::display_header($tool_name); // actions echo '<div class="actions">'; if ($user_info['status'] != SESSIONADMIN) { echo '<span style="float: right;margin:0px;padding:0px;"> <a href="dashboard_add_users_to_user.php?user='******'">' . Display::return_icon('add_user_big.gif', get_lang('AssignUsers'), array('style' => 'vertical-align:middle')) . ' ' . get_lang('AssignUsers') . '</a> <a href="dashboard_add_courses_to_user.php?user='******'">' . Display::return_icon('course_add.gif', get_lang('AssignCourses'), array('style' => 'vertical-align:middle')) . ' ' . get_lang('AssignCourses') . '</a> </span>'; } echo '</div>'; echo Display::page_header(sprintf(get_lang('AssignSessionsToX'), api_get_person_name($user_info['firstname'], $user_info['lastname']))); $assigned_sessions_to_hrm = SessionManager::get_sessions_followed_by_drh($user_id); $assigned_sessions_id = array_keys($assigned_sessions_to_hrm); $without_assigned_sessions = ''; if (count($assigned_sessions_id) > 0) { $without_assigned_sessions = " AND s.id NOT IN(" . implode(',', $assigned_sessions_id) . ")"; } $needle = '%'; if (isset($_POST['firstLetterSession'])) { $needle = Database::escape_string($_POST['firstLetterSession']); $needle = "{$needle}%"; } if ($_configuration['multiple_access_urls']) { $sql = " SELECT s.id, s.name FROM {$tbl_session} s LEFT JOIN {$tbl_session_rel_access_url} a ON (s.id = a.session_id)\n\t\t\t\tWHERE s.name LIKE '{$needle}%' {$without_assigned_sessions} AND access_url_id = " . api_get_current_access_url_id() . "\n ORDER BY s.name"; } else { $sql = " SELECT s.id, s.name FROM {$tbl_session} s\n\t\t\t\tWHERE s.name LIKE '{$needle}%' {$without_assigned_sessions}\n ORDER BY s.name\n ";
<?php /* For licensing terms, see /license.txt */ /** * OpenID * @package chamilo.auth.openid */ /** * Code */ require_once '../../inc/global.inc.php'; Display::display_header('OpenID', NULL); echo Display::page_header(get_lang('OpenIDWhatIs')); echo get_lang('OpenIDDescription'); Display::display_footer();
Display::display_header(''); if (isset($_GET['action']) && $_GET['action'] == 'delete') { $check = Security::check_token('get'); if ($check) { $certificate = new Certificate($_GET['certificate_id']); $result = $certificate->delete(true); Security::clear_token(); if ($result == true) { Display::display_confirmation_message(get_lang('CertificateRemoved')); } else { Display::display_error_message(get_lang('CertificateNotRemoved')); } } } $token = Security::get_token(); echo Display::page_header(get_lang('GradebookListOfStudentsCertificates')); //@todo replace all this code with something like get_total_weight() $cats = Category::load($cat_id, null, null, null, null, null, false); if (!empty($cats)) { //with this fix the teacher only can view 1 gradebook if (api_is_platform_admin()) { $stud_id = api_is_allowed_to_edit() ? null : api_get_user_id(); } else { $stud_id = api_get_user_id(); } $total_weight = $cats[0]->get_weight(); $allcat = $cats[0]->get_subcategories($stud_id, api_get_course_id(), api_get_session_id()); $alleval = $cats[0]->get_evaluations($stud_id); $alllink = $cats[0]->get_links($stud_id); $datagen = new GradebookDataGenerator($allcat, $alleval, $alllink); $total_resource_weight = 0;
$interbreadcrumb[] = array("url" => "exercise.php?" . api_get_cidreq(), "name" => get_lang('Exercises')); if ($origin != 'learnpath') { //so we are not in learnpath tool Display::display_header($nameTools, get_lang('Exercise')); } else { Display::display_reduced_header(); } /* DISPLAY AND MAIN PROCESS */ // I'm in a preview mode as course admin. Display the action menu. if (api_is_course_admin() && $origin != 'learnpath') { echo '<div class="actions">'; echo '<a href="admin.php?' . api_get_cidreq() . '&exerciseId=' . $objExercise->id . '">' . Display::return_icon('back.png', get_lang('GoBackToQuestionList'), array(), 32) . '</a>'; echo '<a href="exercise_admin.php?' . api_get_cidreq() . '&modifyExercise=yes&exerciseId=' . $objExercise->id . '">' . Display::return_icon('edit.png', get_lang('ModifyExercise'), array(), 32) . '</a>'; echo '</div>'; } echo Display::page_header(get_lang('QuestionsToReview')); if ($time_control) { echo $objExercise->return_time_left_div(); } echo Display::div('', array('id' => 'message')); echo '<script> lp_data = $.param({"learnpath_id": ' . $learnpath_id . ', "learnpath_item_id" : ' . $learnpath_item_id . ', "learnpath_item_view_id": ' . $learnpath_item_view_id . '}); function final_submit() { //Normal inputs window.location = "exercise_result.php?origin=' . $origin . '&exe_id=' . $exe_id . '&" + lp_data; } function review_questions() { var is_checked = 1; $("input[type=checkbox]").each(function () {
} $actionsLeft = ''; $nb_menu_items = count($menu_items); if ($nb_menu_items > 1) { foreach ($menu_items as $key => $item) { $actionsLeft .= $item; } } $actionsRight = ''; if (count($a_sessions) > 0) { $actionsRight = Display::url(Display::return_icon('printer.png', get_lang('Print'), array(), 32), 'javascript: void(0);', array('onclick' => 'javascript: window.print();')); $actionsRight .= Display::url(Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), array(), 32), api_get_self() . '?export=csv'); } $toolbar = Display::toolbarAction('toolbar-session', $content = array(0 => $actionsLeft, 1 => $actionsRight)); echo $toolbar; echo Display::page_header(get_lang('YourSessionsList')); } else { $a_sessions = Tracking::get_sessions_coached_by_user($id_coach); } $form = new FormValidator('search_course', 'get', api_get_path(WEB_CODE_PATH) . 'mySpace/session.php'); $form->addElement('text', 'keyword', get_lang('Keyword')); $form->addButtonSearch(get_lang('Search')); $keyword = ''; if ($form->validate()) { $keyword = $form->getSubmitValue('keyword'); } $form->setDefaults(array('keyword' => $keyword)); $url = api_get_path(WEB_AJAX_PATH) . 'model.ajax.php?a=get_sessions_tracking&keyword=' . Security::remove_XSS($keyword); $columns = array(get_lang('Title'), get_lang('Date'), get_lang('NbCoursesPerSession'), get_lang('NbStudentPerSession'), get_lang('Details')); // Column config $columnModel = array(array('name' => 'name', 'index' => 'name', 'width' => '255', 'align' => 'left'), array('name' => 'date', 'index' => 'date', 'width' => '150', 'align' => 'left', 'sortable' => 'false'), array('name' => 'course_per_session', 'index' => 'course_per_session', 'width' => '150', 'sortable' => 'false'), array('name' => 'student_per_session', 'index' => 'student_per_session', 'width' => '100', 'sortable' => 'false'), array('name' => 'details', 'index' => 'details', 'width' => '100', 'sortable' => 'false'));
$nameTools=get_lang("DetailsStudentInCourse"); } $interbreadcrumb[] = array("url" => "myStudents.php?student=".$user_id."&course=".$courseCode."&details=true&origin=".$origin , "name" => get_lang("DetailsStudentInCourse")); $nameTools = get_lang('LearningPathDetails'); $sql = 'SELECT name FROM '.Database::get_course_table(TABLE_LP_MAIN).' WHERE c_id = '.$course_info['real_id'].' AND id='.$lp_id; $rs = Database::query($sql); $lp_title = Database::result($rs, 0, 0); $origin = 'tracking'; $output = require_once api_get_path(SYS_CODE_PATH).'newscorm/lp_stats.php'; Display :: display_header($nameTools); echo '<div class ="actions">'; echo '<a href="javascript:history.back();">'.Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>'; echo '<a href="javascript: void(0);" onclick="javascript: window.print();"> '.Display::return_icon('printer.png',get_lang('Print'),'',ICON_SIZE_MEDIUM).'</a>'; echo '<a href="'.api_get_self().'?export=csv&'.Security::remove_XSS($_SERVER['QUERY_STRING']).'"> '.Display::return_icon('export_csv.png',get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a>'; echo '</div>'; echo '<div class="clear"></div>'; $session_name = api_get_session_name($session_id); $table_title = ($session_name? Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.' ':' '). Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$course_info['name'].' '. Display::return_icon('user.png', get_lang('User'), array(), ICON_SIZE_SMALL).' '.$name; echo Display::page_header($table_title); echo Display::page_subheader('<h3>'.Display::return_icon('learnpath.png', get_lang('ToolLearnpath'), array(), ICON_SIZE_SMALL).' '.$lp_title.'</h3>'); echo $output; Display :: display_footer();