/** * UserPortal view for session, return the HTLK of the course list * @param $user_id * @return string */ public function returnCoursesAndSessionsViewBySession($user_id) { $sessionCount = 0; $courseCount = 0; $load_history = isset($_GET['history']) && intval($_GET['history']) == 1 ? true : false; if ($load_history) { //Load sessions in category in *history* $session_categories = UserManager::get_sessions_by_category($user_id, true); } else { //Load sessions in category $session_categories = UserManager::get_sessions_by_category($user_id, false); } $html = ''; //Showing history title if ($load_history) { $html .= Display::page_subheader(get_lang('HistoryTrainingSession')); if (empty($session_categories)) { $html .= get_lang('YouDoNotHaveAnySessionInItsHistory'); } } $specialCourses = ''; $loadDirs = $this->load_directories_preview; // If we're not in the history view... $listCoursesInfo = array(); if (!isset($_GET['history'])) { // Display special courses $specialCoursesResult = CourseManager::display_special_courses($user_id, $loadDirs); $specialCourses = $specialCoursesResult['html']; // Display courses // [code=>xxx, real_id=>000] $listCourses = CourseManager::get_courses_list_by_user_id($user_id, false); foreach ($listCourses as $i => $listCourseCodeId) { list($userCategoryId, $userCatTitle) = CourseManager::getUserCourseCategoryForCourse($user_id, $listCourseCodeId['real_id']); $listCourse = api_get_course_info_by_id($listCourseCodeId['real_id']); $listCoursesInfo[] = array('course' => $listCourse, 'code' => $listCourseCodeId['code'], 'id' => $listCourseCodeId['real_id'], 'title' => $listCourse['title'], 'userCatId' => $userCategoryId, 'userCatTitle' => $userCatTitle); $courseCount++; } usort($listCoursesInfo, 'self::compareByCourse'); } if (is_array($session_categories)) { // all courses that are in a session $listCoursesInSession = SessionManager::getNamedSessionCourseForCoach($user_id); } // we got all courses // for each user category, sorted alphabetically, display courses $listUserCategories = CourseManager::get_user_course_categories($user_id); $listCoursesAlreadyDisplayed = array(); uasort($listUserCategories, "self::compareListUserCategory"); $listUserCategories[0] = ''; $html = '<div class="session-view-block">'; foreach ($listUserCategories as $userCategoryId => $userCatTitle) { // add user category $userCategoryHtml = ''; if ($userCategoryId != 0) { $userCategoryHtml = '<div class="session-view-well ">'; } $userCategoryHtml .= self::getHtmlForUserCategory($userCategoryId, $userCatTitle); // look for course in this userCat in session courses : $listCoursesInSession $htmlCategory = ''; if (isset($listCoursesInSession[$userCategoryId])) { // list of courses in this user cat foreach ($listCoursesInSession[$userCategoryId]['courseInUserCatList'] as $i => $listCourse) { // add course $listCoursesAlreadyDisplayed[$listCourse['courseId']] = 1; if ($userCategoryId == 0) { $htmlCategory .= '<div class="session-view-well session-view-row well" >'; } else { $htmlCategory .= '<div class="session-view-row" >'; } $coursesInfo = $listCourse['course']; $htmlCategory .= self::getHtmlForCourse($coursesInfo, $userCategoryId, 1, $loadDirs); // list of session category $htmlSessionCategory = '<div class="session-view-row" style="display:none;" id="courseblock-' . $coursesInfo['real_id'] . '">'; foreach ($listCourse['sessionCatList'] as $j => $listCategorySession) { // add session category $htmlSessionCategory .= self::getHtmlSessionCategory($listCategorySession['catSessionId'], $listCategorySession['catSessionName']); // list of session $htmlSession = ''; // start foreach ($listCategorySession['sessionList'] as $k => $listSession) { // add session $htmlSession .= '<div class="session-view-row">'; $htmlSession .= self::getHtmlForSession($listSession['sessionId'], $listSession['sessionName'], $listCategorySession['catSessionId'], $coursesInfo); $htmlSession .= '</div>'; $sessionCount++; } $htmlSession .= ''; // end session block $htmlSessionCategory .= $htmlSession; } $htmlSessionCategory .= '</div>'; // end session cat block $htmlCategory .= $htmlSessionCategory . '</div>'; $htmlCategory .= ''; // end course block } $userCategoryHtml .= $htmlCategory; } // look for courses in this userCat in not in session courses : $listCoursesInfo // if course not already added $htmlCategory = ''; foreach ($listCoursesInfo as $i => $listCourse) { if ($listCourse['userCatId'] == $userCategoryId && !isset($listCoursesAlreadyDisplayed[$listCourse['id']])) { if ($userCategoryId != 0) { $htmlCategory .= '<div class="session-view-row" >'; } else { $htmlCategory .= '<div class="session-view-well well">'; } $htmlCategory .= self::getHtmlForCourse($listCourse['course'], $userCategoryId, 0, $loadDirs); $htmlCategory .= '</div>'; } } $htmlCategory .= ''; $userCategoryHtml .= $htmlCategory; // end user cat block if ($userCategoryId != 0) { $userCategoryHtml .= '</div>'; } $html .= $userCategoryHtml; // } $html .= '</div>'; return ['html' => $html . $specialCourses, 'session_count' => $sessionCount, 'course_count' => $courseCount]; }
<input type="hidden" name="unsubscribe" value="<?php echo $course['code']; ?>" /> <button class="btn" value="<?php echo get_lang('Unsubscribe'); ?>" name="unsub"> <?php echo get_lang('Unsubscribe'); ?> </button> </form> </div> <?php } } $key++; } echo '</table>'; } } } echo Display::page_subheader(get_lang('NoCourseCategory')); echo '<table class="data_table">'; // COURSES WITHOUT CATEGORY if (!empty($courses_without_category)) { $number_of_courses = count($courses_without_category); $key = 0; foreach ($courses_without_category as $course) { echo '<tr>'; ?> <td> <a name="course<?php echo $course['code']; ?>"></a> <strong><?php echo $course['title']; ?></strong><br /> <?php
//height auto $extra_params['height'] = 'auto'; //With this function we can add actions to the jgrid (edit, delete, etc) /* $action_links = 'function action_formatter(cellvalue, options, rowObject) { return \'<a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'. ' <a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="?sec_token='.$token.'&action=copy&id=\'+options.rowId+\'">'.Display::return_icon('copy.png',get_lang('Copy'),'',ICON_SIZE_SMALL).'</a>'. ' <a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;" href="?sec_token='.$token.'&action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'. '\'; }';*/ $action_links = null; $room = UserManager::get_extra_user_data_by_field(api_get_user_id(), 'exam_room'); $room = $room['exam_room']; $schedule = UserManager::get_extra_user_data_by_field(api_get_user_id(), 'exam_schedule'); $schedule = $schedule['exam_schedule']; echo Display::page_subheader(get_lang('UserList') . ": " . $room . " - " . $schedule); ?> <script> $(function() { <?php echo Display::grid_js('user_list', $url, $columns, $column_model, $extra_params, array(), $action_links, true); ?> jQuery("#user_list").jqGrid("navGrid","#user_list_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true}); jQuery("#user_list").jqGrid("navButtonAdd","#user_list_pager",{ caption:"", onClickButton : function () { jQuery("#user_list").jqGrid("excelExport",{"url": "<? echo $url?>&export_format=xls"}); } }); });
break; } } Display::display_header($tool_name); echo '<div class="actions"> <a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/myStudents.php?student=' . intval($_GET['user_id']) . '" title="' . get_lang('Reporting') . '">' . Display::return_icon('statistics.png', get_lang('Reporting'), '', ICON_SIZE_MEDIUM) . ' </a> ' . $login_as_icon . ' ' . $editUser . ' ' . $exportLink . ' </div>'; echo Display::page_header($tool_name); $fullUrlBig = Usermanager::getUserPicture($user['user_id'], USER_IMAGE_SIZE_BIG); $fullUrl = Usermanager::getUserPicture($user['user_id'], USER_IMAGE_SIZE_ORIGINAL); echo '<div class="row">'; echo '<div class="col-md-2">'; echo '<a class="expand-image" href="' . $fullUrlBig . '">' . '<img src="' . $fullUrl . '" /></a><br />'; echo '</div>'; echo $message; echo '<div class="col-md-5">'; echo $userInformation; echo '</div>'; echo '<div class="col-md-5">'; echo $trackingInformation; echo '</div>'; echo '</div>'; echo Display::page_subheader(get_lang('SessionList')); echo $sessionInformation; echo $courseInformation; echo $urlInformation; Display::display_footer();
$counter = 1; foreach ($rows as $row) { if ($row['status'] == '0') { $style = " id = 'post" . $post_en . "' class=\"hide-me\" style=\"border:1px solid red; display:none; background-color:#F7F7F7; width:95%; margin: 0px 0px 4px 40px; \" "; $url_post = ''; } else { $style = ""; $post_en = $row['post_parent_id']; } if ($row['user_id'] == '0') { $name = prepare4display($row['poster_name']); } else { $name = api_get_person_name($row['firstname'], $row['lastname']); } if ($counter == 1) { echo Display::page_subheader($name); } echo "<div " . $style . "><table class=\"data_table\">"; if ($row['visible'] == '0') { $titleclass = 'forum_message_post_title_2_be_approved'; $messageclass = 'forum_message_post_text_2_be_approved'; $leftclass = 'forum_message_left_2_be_approved'; } else { $titleclass = 'forum_message_post_title'; $messageclass = 'forum_message_post_text'; $leftclass = 'forum_message_left'; } echo "<tr>"; echo "<td rowspan=\"3\" class=\"{$leftclass}\">"; echo '<br /><b>' . api_convert_and_format_date($row['post_date'], DATE_TIME_FORMAT_LONG) . '</b><br />'; if (api_is_allowed_to_edit(null, true)) {
$column++; $table->setCellContents($row, $column, $userResult['sent_date']); $column++; $dateQualification = !empty($workExtraData['expires_on']) ? api_get_local_time($workExtraData['expires_on']) : '-'; $table->setCellContents($row, $column, $dateQualification); $column++; $score = null; $score = $userResult['qualification']; $table->setCellContents($row, $column, $score); $column++; // Actions $links = null; // is a text $url = api_get_path(WEB_CODE_PATH) . 'work/view.php?' . api_get_cidreq() . '&id=' . $itemId; $links .= Display::url(Display::return_icon('default.png', get_lang('View')), $url); if (!empty($userResult['url'])) { $url = api_get_path(WEB_CODE_PATH) . 'work/download.php?' . api_get_cidreq() . '&id=' . $itemId; $links .= Display::url(Display::return_icon('save.png', get_lang('Download')), $url); } if (api_is_allowed_to_edit()) { $url = api_get_path(WEB_CODE_PATH) . 'work/edit.php?' . api_get_cidreq() . '&item_id=' . $itemId . '&id=' . $workId . '&parent_id=' . $workId; $links .= Display::url(Display::return_icon('rate_work.png', get_lang('Comment')), $url); } $table->setCellContents($row, $column, $links); $row++; $column = 0; } } echo Display::page_subheader($userInfo['complete_name']); echo $table->toHtml(); Display::display_footer();
/** * Displays messages of a group with nested view * @param $group_id * @param $topic_id * @param $is_member * @param $message_id * @return string */ public static function display_message_for_group($group_id, $topic_id, $is_member, $message_id) { global $my_group_role; $main_message = self::get_message_by_id($topic_id); if (empty($main_message)) { return false; } $rows = self::get_messages_by_group_by_message($group_id, $topic_id); $rows = self::calculate_children($rows, $topic_id); $current_user_id = api_get_user_id(); $items_per_page = 50; $query_vars = array('id' => $group_id, 'topic_id' => $topic_id, 'topics_page_nr' => 0); // Main message $links = ''; $main_content = ''; $items_page_nr = null; $html = ''; $delete_button = ''; if (api_is_platform_admin()) { $delete_button = Display::url(Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL), 'group_topics.php?action=delete&id=' . $group_id . '&topic_id=' . $topic_id); } $html .= Display::page_subheader(Security::remove_XSS($main_message['title'] . $delete_button, STUDENT, true)); $user_sender_info = api_get_user_info($main_message['user_sender_id']); $files_attachments = self::get_links_message_attachment_files($main_message['id']); $name = $user_sender_info['complete_name']; $topic_page_nr = isset($_GET['topics_page_nr']) ? intval($_GET['topics_page_nr']) : null; $links .= '<div id="message-reply-link">'; if ($my_group_role == GROUP_USER_PERMISSION_ADMIN || $my_group_role == GROUP_USER_PERMISSION_MODERATOR || $main_message['user_sender_id'] == $current_user_id) { $urlEdit = api_get_path(WEB_CODE_PATH); $urlEdit .= 'social/message_for_group_form.inc.php?'; $urlEdit .= http_build_query(['user_friend' => $current_user_id, 'group_id' => $group_id, 'message_id' => $main_message['id'], 'action' => 'edit_message_group', 'anchor_topic' => 'topic_' . $main_message['id'], 'topics_page_nr' => $topic_page_nr, 'items_page_nr' => $items_page_nr, 'topic_id' => $main_message['id']]); $links .= Display::url(Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), $urlEdit, ['class' => 'ajax btn btn-default', 'title' => get_lang('Edit'), 'data-title' => get_lang('Edit'), 'data-size' => 'lg']); } $urlReply = api_get_path(WEB_CODE_PATH); $urlReply .= 'social/message_for_group_form.inc.php?'; $urlReply .= http_build_query(['user_friend' => api_get_user_id(), 'group_id' => $group_id, 'message_id' => $main_message['id'], 'action' => 'reply_message_group', 'anchor_topic' => 'topic_' . $main_message['id'], 'topics_page_nr' => $topic_page_nr, 'topic_id' => $main_message['id']]); $links .= Display::url(Display::return_icon('talk.png', get_lang('Reply')), $urlReply, ['class' => 'ajax btn btn-default', 'title' => get_lang('Reply'), 'data-title' => get_lang('Reply'), 'data-size' => 'lg']); $links .= '</div>'; $userPicture = $user_sender_info['avatar']; $main_content .= '<div class="message-group-author"> <img src="' . $userPicture . '" alt="' . $name . '" width="32" height="32" title="' . $name . '" /></div>'; $user_link = '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $main_message['user_sender_id'] . '">' . $name . ' </a>'; $date = ''; if ($main_message['send_date'] != $main_message['update_date']) { if (!empty($main_message['update_date']) && $main_message['update_date'] != '0000-00-00 00:00:00') { $date = '<div class="message-group-date"> ' . get_lang('LastUpdate') . ' ' . date_to_str_ago($main_message['update_date']) . '</div>'; } } else { $date = '<div class="message-group-date"> ' . get_lang('Created') . ' ' . date_to_str_ago($main_message['send_date']) . '</div>'; } $attachment = '<div class="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '') . '</div>'; $main_content .= '<div class="message-group-content">' . $links . $user_link . ' ' . $date . $main_message['content'] . $attachment . '</div>'; $main_content = Security::remove_XSS($main_content, STUDENT, true); $html .= Display::div(Display::div(Display::div($main_content, array('class' => 'group_social_sub_item', 'style' => 'background-color:#fff;')), array('class' => 'group_social_item')), array('class' => 'group_social_grid')); $topic_id = $main_message['id']; if (is_array($rows) && count($rows) > 0) { $topics = $rows; $array_html_items = array(); foreach ($topics as $index => $topic) { if (empty($topic['id'])) { continue; } $items_page_nr = isset($_GET['items_' . $topic['id'] . '_page_nr']) ? intval($_GET['items_' . $topic['id'] . '_page_nr']) : null; $links = ''; $html_items = ''; $user_sender_info = api_get_user_info($topic['user_sender_id']); $files_attachments = self::get_links_message_attachment_files($topic['id']); $name = $user_sender_info['complete_name']; $links .= '<div id="message-reply-link">'; if ($my_group_role == GROUP_USER_PERMISSION_ADMIN || $my_group_role == GROUP_USER_PERMISSION_MODERATOR || $topic['user_sender_id'] == $current_user_id) { $links .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'social/message_for_group_form.inc.php?height=400&width=800&&user_friend=' . $current_user_id . '&group_id=' . $group_id . '&message_id=' . $topic['id'] . '&action=edit_message_group&anchor_topic=topic_' . $topic_id . '&topics_page_nr=' . $topic_page_nr . '&items_page_nr=' . $items_page_nr . '&topic_id=' . $topic_id . '" class="ajax btn" data-size="lg" data-title="' . get_lang('Edit') . '" title="' . get_lang('Edit') . '">' . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>'; } $links .= ' <a href="' . api_get_path(WEB_CODE_PATH) . 'social/message_for_group_form.inc.php?height=400&width=800&&user_friend=' . api_get_user_id() . '&group_id=' . $group_id . '&message_id=' . $topic['id'] . '&action=reply_message_group&anchor_topic=topic_' . $topic_id . '&topics_page_nr=' . $topic_page_nr . '&items_page_nr=' . $items_page_nr . '&topic_id=' . $topic_id . '" class="ajax btn" data-size="lg" data-title="' . get_lang('Reply') . '" title="' . get_lang('Reply') . '">'; $links .= Display::return_icon('talk.png', get_lang('Reply')) . '</a>'; $links .= '</div>'; $userPicture = $user_sender_info['avatar']; $html_items .= '<div class="message-group-author"><img src="' . $userPicture . '" alt="' . $name . '" width="32" height="32" title="' . $name . '" /></div>'; $user_link = '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $topic['user_sender_id'] . '">' . $name . ' </a>'; $date = ''; if ($topic['send_date'] != $topic['update_date']) { if (!empty($topic['update_date']) && $topic['update_date'] != '0000-00-00 00:00:00') { $date = '<div class="message-group-date"> ' . get_lang('LastUpdate') . ' ' . date_to_str_ago($topic['update_date']) . '</div>'; } } else { $date = '<div class="message-group-date"> ' . get_lang('Created') . ' ' . date_to_str_ago($topic['send_date']) . '</div>'; } $attachment = '<div class="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '') . '</div>'; $html_items .= '<div class="message-group-content">' . $links . $user_link . ' ' . $date . Security::remove_XSS($topic['content'], STUDENT, true) . $attachment . '</div>'; $base_padding = 20; if ($topic['indent_cnt'] == 0) { $indent = $base_padding; } else { $indent = intval($topic['indent_cnt']) * $base_padding + $base_padding; } $class = 'group_social_sub_item'; if (isset($message_id) && $message_id == $topic['id']) { $class .= ' group_social_sub_item_highlight'; } $html_items = Display::div($html_items, array('class' => $class, 'id' => 'msg_' . $topic['id'])); $html_items = Display::div($html_items, array('class' => '', 'style' => 'margin-left:' . $indent . 'px')); $array_html_items[] = array($html_items); } // grids for items with paginations $options = array('hide_navigation' => false, 'per_page' => $items_per_page); $visibility = array(true, true, true, false); $style_class = array('item' => array('class' => 'group_social_item'), 'main' => array('class' => 'group_social_grid')); if (!empty($array_html_items)) { $html .= Display::return_sortable_grid('items_' . $topic['id'], array(), $array_html_items, $options, $query_vars, null, $visibility, false, $style_class); } } return $html; }
$date = api_convert_and_format_date($invitation['send_date'], DATE_TIME_FORMAT_LONG); $social_right_content .= ' <div class="span2"> <a class="thumbnail" href="' . $userInfo['profile_url'] . '"> <img src="' . $friends_profile['file'] . '" /></a> </div> <div class="span3"> <a class="profile_link" href="' . $userInfo['profile_url'] . '">' . $userInfo['complete_name'] . '</a> <div>' . $title . ' : ' . $content . '</div> <div>' . get_lang('DateSend') . ' : ' . $date . '</div> </div> </div>'; } } if (count($pending_invitations) > 0) { $social_right_content .= Display::page_subheader(get_lang('GroupsWaitingApproval')); $new_invitation = array(); foreach ($pending_invitations as $invitation) { $picture = $usergroup->get_picture_group($invitation['id'], $invitation['picture'], 80); $img = '<img class="social-groups-image" src="' . $picture['file'] . '" hspace="4" height="50" border="2" align="left" width="50" />'; $invitation['picture'] = '<a href="groups.php?id=' . $invitation['id'] . '">' . $img . '</a>'; $invitation['name'] = '<a href="groups.php?id=' . $invitation['id'] . '">' . Text::cut($invitation['name'], 120, true) . '</a>'; $invitation['join'] = '<a class="btn btn-primary" href="invitations.php?accept=' . $invitation['id'] . '">' . get_lang('AcceptInvitation') . '</a>'; $invitation['deny'] = '<a class="btn btn-danger" href="invitations.php?deny=' . $invitation['id'] . '">' . get_lang('DenyInvitation') . '</a>'; $invitation['description'] = Text::cut($invitation['description'], 220, true); $new_invitation[] = $invitation; } $social_right_content .= Display::return_sortable_grid('waiting_user', array(), $new_invitation, array('hide_navigation' => true, 'per_page' => 100), array(), false, array(true, true, true, false, false, true, true, true, true)); } $social_right_content = Display::div($social_right_content, array('class' => 'span9')); $tpl = $app['template'];
$photo = '<img src="' . $userInfo['avatar'] . '" alt="' . $completeName . '" width="32" height="32" title="' . $completeName . '" />'; $tutor_info .= '<li>'; $tutor_info .= Display::url($userInfo['complete_name'], $userInfo['profile_url']); $tutor_info .= '</li>'; } $tutor_info .= '</ul>'; } echo Display::page_subheader(get_lang('GroupTutors')); if (!empty($tutor_info)) { echo $tutor_info; } echo '<br />'; /* * List all the members of the current group */ echo Display::page_subheader(get_lang('GroupMembers')); $table = new SortableTable('group_users', 'get_number_of_group_users', 'get_group_user_data', (api_is_western_name_order() xor api_sort_by_first_name()) ? 2 : 1); $my_cidreq = isset($_GET['cidReq']) ? Security::remove_XSS($_GET['cidReq']) : ''; $my_origin = isset($_GET['origin']) ? Security::remove_XSS($_GET['origin']) : ''; $my_gidreq = isset($_GET['gidReq']) ? Security::remove_XSS($_GET['gidReq']) : ''; $parameters = array('cidReq' => $my_cidreq, 'origin' => $my_origin, 'gidReq' => $my_gidreq); $table->set_additional_parameters($parameters); $table->set_header(0, ''); if (api_is_western_name_order()) { $table->set_header(1, get_lang('FirstName')); $table->set_header(2, get_lang('LastName')); } else { $table->set_header(1, get_lang('LastName')); $table->set_header(2, get_lang('FirstName')); } if (api_get_setting('display.show_email_addresses') == 'true') {
$form->addElement('date_picker', 'end_date_time', get_lang('RepeatEnd'), array('form_name' => 'attendance_calendar_add')); $defaults['end_date_time'] = date('Y-m-d'); $form->addElement('html', '</div>'); $defaults['repeat_type'] = 'weekly'; $form->addSelect('groups', get_lang('Group'), $groupIdList); $form->addButtonCreate(get_lang('Save')); $form->setDefaults($defaults); $form->display(); } else { // Calendar list $groupList = GroupManager::get_group_list(); $groupIdList = array('--'); foreach ($groupList as $group) { $groupIdList[$group['id']] = $group['name']; } echo Display::page_subheader(get_lang('CalendarList')); echo '<div class="attendance-calendar-list">'; if (!empty($attendance_calendar)) { foreach ($attendance_calendar as $calendar) { echo '<div class="attendance-calendar-row">'; if (isset($action) && $action == 'calendar_edit' && (isset($calendar_id) && $calendar_id == $calendar['id'])) { // calendar edit form echo '<div class="attendance-calendar-edit">'; $form = new FormValidator('attendance_calendar_edit', 'POST', 'index.php?action=calendar_edit&attendance_id=' . $attendance_id . '&calendar_id=' . $calendar_id . '&' . api_get_cidreq() . $param_gradebook, ''); $form->addElement('date_time_picker', 'date_time', '', array('form_name' => 'attendance_calendar_edit'), 5); $defaults['date_time'] = $calendar['date_time']; $form->addButtonSave(get_lang('Save')); $form->addButtonCancel(get_lang('Cancel'), 'cancel'); $form->setDefaults($defaults); $form->display(); echo '</div>';
/** * Prints the session and course list (user_portal.php) * @param int $user_id * @return string */ public function return_courses_and_sessions($user_id) { global $_configuration; $load_history = (isset($_GET['history']) && intval($_GET['history']) == 1) ? true : false; if ($load_history) { // Load sessions in category in *history* $session_categories = UserManager::get_sessions_by_category( $user_id, true ); } else { // Load sessions in category $session_categories = UserManager::get_sessions_by_category( $user_id, false ); } $html = ''; // Showing history title if ($load_history) { $html .= Display::page_subheader(get_lang('HistoryTrainingSession')); if (empty($session_categories)) { $html .= get_lang('YouDoNotHaveAnySessionInItsHistory'); } } $courses_html = ''; $special_courses = ''; // If we're not in the history view... if (!isset($_GET['history'])) { // Display special courses. $special_courses = CourseManager::display_special_courses($user_id, $this->load_directories_preview); // Display courses. $courses_html .= CourseManager::display_courses($user_id, $this->load_directories_preview); } $sessions_with_category = ''; $sessions_with_no_category = ''; if (is_array($session_categories)) { foreach ($session_categories as $session_category) { $session_category_id = $session_category['session_category']['id']; // Sessions and courses that are not in a session category if ($session_category_id == 0 && isset($session_category['sessions']) ) { // Independent sessions foreach ($session_category['sessions'] as $session) { $session_id = $session['session_id']; // Don't show empty sessions. if (count($session['courses']) < 1) { continue; } // Courses inside the current session. $date_session_start = $session['date_start']; $date_session_end = $session['date_end']; $days_access_before_beginning = $session['nb_days_access_before_beginning']; $days_access_after_end = $session['nb_days_access_after_end']; $session_now = time(); $count_courses_session = 0; // Loop course content $html_courses_session = ''; $atLeastOneCourseIsVisible = false; foreach ($session['courses'] as $course) { $is_coach_course = api_is_coach($session_id, $course['code']); $allowed_time = 0; $dif_time_after = 0; if ($date_session_start != '0000-00-00') { if ($is_coach_course) { $allowed_time = api_strtotime($date_session_start.' 00:00:00') - ($days_access_before_beginning * 86400); } else { $allowed_time = api_strtotime($date_session_start.' 00:00:00'); } if (!isset($_GET['history'])) { if ($date_session_end != '0000-00-00') { $endSessionToTms = api_strtotime($date_session_end.' 23:59:59'); if ($session_now > $endSessionToTms) { $dif_time_after = $session_now - $endSessionToTms; $dif_time_after = round($dif_time_after/86400); } } } } if ($session_now > $allowed_time && $days_access_after_end > $dif_time_after - 1 ) { // Read only and accessible. $atLeastOneCourseIsVisible = true; if (api_get_setting('hide_courses_in_sessions') == 'false') { $c = CourseManager::get_logged_user_course_html( $course, $session_id, 'session_course_item', true, $this->load_directories_preview ); $html_courses_session .= isset($c[1]) ? $c[1] : null; } $count_courses_session++; } } // No courses to show. if ($atLeastOneCourseIsVisible == false) { if (empty($html_courses_session)) { continue; } } if ($count_courses_session > 0) { $params = array(); $session_box = Display::get_session_title_box($session_id); $params['icon'] = Display::return_icon( 'window_list.png', $session_box['title'], array('id' => 'session_img_' . $session_id), ICON_SIZE_LARGE ); $extra_info = !empty($session_box['coach']) ? $session_box['coach'] : null; $extra_info .= !empty($session_box['coach']) ? ' - '.$session_box['dates'] : $session_box['dates']; $extra_info .= isset($session_box['duration']) ? ' '.$session_box['duration'] : null; if (api_is_drh()) { $session_link = $session_box['title']; $params['link'] = null; } else { $session_link = Display::tag( 'a', $session_box['title'], array( 'href' => api_get_path( WEB_CODE_PATH ) . 'session/index.php?session_id=' . $session_id ) ); $params['link'] = api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$session_id; } $params['title'] = $session_link; $params['subtitle'] = $extra_info; $params['right_actions'] = ''; if (api_is_platform_admin()) { $params['right_actions'] .= '<a href="'.api_get_path(WEB_CODE_PATH).'admin/resume_session.php?id_session='.$session_id.'">'; $params['right_actions'] .= Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL).'</a>'; } if (api_get_setting('hide_courses_in_sessions') == 'false') { // $params['extra'] .= $html_courses_session; } $params['description'] = isset($session_box['description']) ? $session_box['description'] : null; $parentInfo = CourseManager::course_item_html($params, true); if (isset($_configuration['show_simple_session_info']) && $_configuration['show_simple_session_info'] ) { $params['title'] = $session_box['title']; $parentInfo = CourseManager::course_item_html_no_icon($params); } $sessions_with_no_category .= CourseManager::course_item_parent( $parentInfo, $html_courses_session ); } } } else { // All sessions included in $count_courses_session = 0; $html_sessions = ''; if (isset($session_category['sessions'])) { foreach ($session_category['sessions'] as $session) { $session_id = $session['session_id']; // Don't show empty sessions. if (count($session['courses']) < 1) { continue; } $date_session_start = $session['date_start']; $date_session_end = $session['date_end']; $days_access_before_beginning = $session['nb_days_access_before_beginning']; $days_access_after_end = $session['nb_days_access_after_end']; $session_now = time(); $html_courses_session = ''; $count = 0; foreach ($session['courses'] as $course) { $is_coach_course = api_is_coach( $session_id, $course['code'] ); $dif_time_after = 0; $allowed_time = 0; if ($is_coach_course) { // 24 hours = 86400 if ($date_session_start != '0000-00-00') { $allowed_time = api_strtotime($date_session_start . ' 00:00:00') - ($days_access_before_beginning * 86400); } if (!isset($_GET['history'])) { if ($date_session_end != '0000-00-00') { $endSessionToTms = api_strtotime( $date_session_end . ' 23:59:59' ); if ($session_now > $endSessionToTms) { $dif_time_after = $session_now - $endSessionToTms; $dif_time_after = round( $dif_time_after / 86400 ); } } } } else { $allowed_time = api_strtotime( $date_session_start . ' 00:00:00' ); } if ($session_now > $allowed_time && $days_access_after_end > $dif_time_after - 1 ) { if (api_get_setting('hide_courses_in_sessions') == 'false') { $c = CourseManager:: get_logged_user_course_html( $course, $session_id, 'session_course_item' ); $html_courses_session .= $c[1]; } $count_courses_session++; $count++; } } $params = array(); if ($count > 0) { $session_box = Display:: get_session_title_box( $session_id ); $params['icon'] = Display::return_icon( 'window_list.png', $session_box['title'], array( 'width' => '48px', 'align' => 'absmiddle', 'id' => 'session_img_' . $session_id ) ) . ' '; if (api_is_drh()) { $session_link = $session_box['title']; $params['link'] = null; } else { $session_link = Display::tag( 'a', $session_box['title'], array( 'href' => api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . $session_id ) ); $params['link'] = api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . $session_id; } $params['title'] = $session_link; $params['subtitle'] = (!empty($session_box['coach']) ? $session_box['coach'] . ' | ' : '') . $session_box['dates']; if (api_is_platform_admin()) { $params['right_actions'] = '<a href="' . api_get_path(WEB_CODE_PATH) . 'admin/resume_session.php?id_session=' . $session_id . '">' . Display::return_icon( 'edit.png', get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL ) . '</a>'; } $parentInfo = CourseManager::course_item_html( $params, true ); if (isset($_configuration['show_simple_session_info']) && $_configuration['show_simple_session_info']) { $params['title'] = $session_box['title']; $parentInfo = CourseManager::course_item_html_no_icon( $params ); } $html_sessions .= $parentInfo . $html_courses_session; } } } if ($count_courses_session > 0) { $params = array(); $params['icon'] = Display::return_icon('folder_blue.png', $session_category['session_category']['name'], array(), ICON_SIZE_LARGE); if (api_is_platform_admin()) { $params['right_actions'] = '<a href="'.api_get_path(WEB_CODE_PATH).'admin/session_category_edit.php?&id='.$session_category['session_category']['id'].'">'.Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>'; } $params['title'] = $session_category['session_category']['name']; if (api_is_platform_admin()) { $params['link'] = api_get_path(WEB_CODE_PATH).'admin/session_category_edit.php?&id='.$session_category['session_category']['id']; } $session_category_start_date = $session_category['session_category']['date_start']; $session_category_end_date = $session_category['session_category']['date_end']; if (!empty($session_category_start_date) && $session_category_start_date != '0000-00-00' && !empty($session_category_end_date) && $session_category_end_date != '0000-00-00' ) { $params['subtitle'] = sprintf(get_lang('FromDateXToDateY'), $session_category['session_category']['date_start'], $session_category['session_category']['date_end']); } else { if (!empty($session_category_start_date) && $session_category_start_date != '0000-00-00') { $params['subtitle'] = get_lang('From').' '.$session_category_start_date; } if (!empty($session_category_end_date) && $session_category_end_date != '0000-00-00') { $params['subtitle'] = get_lang('Until').' '.$session_category_end_date; } } $sessions_with_category .= CourseManager::course_item_parent( CourseManager::course_item_html($params, true), $html_sessions ); } } } } return $sessions_with_category. $sessions_with_no_category. $courses_html.$special_courses; }
$table->setCellContents($row, 2, $link); $row++; } $userListToShow .= $table->toHtml(); } /** @var SequenceRepository $repo */ $repo = Database::getManager()->getRepository('ChamiloCoreBundle:SequenceResource'); $requirementAndDependencies = $repo->getRequirementAndDependencies($sessionId, SequenceResource::SESSION_TYPE); $requirements = ''; if (!empty($requirementAndDependencies['requirements'])) { $requirements = Display::page_subheader(get_lang('Requirements')); $requirements .= implode(' + ', array_column($requirementAndDependencies['requirements'], 'admin_link')); } $dependencies = ''; if (!empty($requirementAndDependencies['dependencies'])) { $dependencies = Display::page_subheader(get_lang('Dependencies')); $dependencies .= implode(', ', array_column($requirementAndDependencies['dependencies'], 'admin_link')); } //$tpl = new Template(get_lang('Session')); $tpl = Container::getTwig(); $tpl->addGlobal('session_header', $sessionHeader); $tpl->addGlobal('title', $sessionTitle); $tpl->addGlobal('general_coach', $generalCoach); $tpl->addGlobal('session_admin', api_get_user_info($session->getSessionAdminId())); $tpl->addGlobal('session', $sessionInfo); $tpl->addGlobal('session_category', is_null($sessionCategory) ? null : $sessionCategory->getName()); $tpl->addGlobal('session_dates', SessionManager::parseSessionDates($sessionInfo)); $tpl->addGlobal('session_visibility', SessionManager::getSessionVisibility($sessionInfo)); $tpl->addGlobal('url_list', $urlList); $tpl->addGlobal('extra_fields', $extraFieldData); $tpl->addGlobal('course_list', $courseListToShow);
$items = getAllUserToWork($workId, api_get_course_int_id()); $usersAdded = array(); if (!empty($items)) { echo Display::page_subheader(get_lang('UsersAdded')); echo '<div class="well">'; foreach ($items as $data) { $myUserId = $data['user_id']; $usersAdded[] = $myUserId; $userInfo = api_get_user_info($myUserId); $url = api_get_path(WEB_CODE_PATH) . 'work/add_user.php?action=delete&id=' . $workId . '&user_id=' . $myUserId; $link = Display::url(get_lang('Delete'), $url); echo $userInfo['complete_name'] . ' ' . $link . '<br />'; } echo '</div>'; } $userList = CourseManager::get_user_list_from_course_code($courseInfo['code'], api_get_session_id(), null, null, STUDENT); echo Display::page_subheader(get_lang('UserToAdd')); if (!empty($userList)) { echo '<div class="well">'; foreach ($userList as $user) { if (in_array($user['user_id'], $usersAdded)) { continue; } $userName = api_get_person_name($user['firstname'], $user['lastname']); $url = api_get_path(WEB_CODE_PATH) . 'work/add_user.php?action=add&id=' . $workId . '&user_id=' . $user['user_id']; $link = Display::url(get_lang('Add'), $url); echo $userName . ' ' . $link . '<br />'; } echo '</div>'; } echo '<hr /><div class="clear"></div>';
$issues .= '<li id ="' . $login . '"> <div class="row"> <div class="col-md-12"><div class="thumbnail">' . $course_image . '</div> </div> <div class="col-md-3">' . sprintf(get_lang('YouHaveEnteredTheCourseXInY'), $courseInfo['code'], api_convert_and_format_date($login, DATE_FORMAT_LONG)) . '</div> </li>'; $count++; } } $content = Tracking::show_user_progress(api_get_user_id(), $sessionId); $content .= Tracking::show_course_detail(api_get_user_id(), $courseCode, $sessionId); if (!empty($dates)) { if (!empty($content)) { $content .= '<br /><br />'; } $content .= '<div class="row"><div class="col-md-12">' . Display::page_subheader(get_lang('Timeline')) . '</div>'; $content .= '<div id="my_timeline"> <div class="actions"> <a href="#" id="prev"></a> <!-- optional --> <a href="#" id="next"></a> <!-- optional --> </div> <ul id="dates"> ' . $dates . ' </ul> <ul id="issues"> ' . $issues . ' </ul> </div></div>'; } $message = null; if (empty($content)) {
$interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'work/work_list.php?'.api_get_cidreq().'&id='.$workId, 'name' => $my_folder_data['title']); $documentsAddedInWork = getAllDocumentsFromWorkToString($workId, $courseInfo); Display :: display_header(null); echo '<div class="actions">'; echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq().'&origin='.$origin.'">'.Display::return_icon('back.png', get_lang('BackToWorksList'),'',ICON_SIZE_MEDIUM).'</a>'; if (api_is_allowed_to_session_edit(false, true) && !empty($workId)) { echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/upload.php?'.api_get_cidreq().'&id='.$workId.'&origin='.$origin.'">'; echo Display::return_icon('upload_file.png', get_lang('UploadADocument'), '', ICON_SIZE_MEDIUM).'</a>'; } echo '</div>'; if (!empty($my_folder_data['title'])) { echo Display::page_subheader($my_folder_data['title']); } $error_message = Session::read('error_message'); if (!empty($error_message)) { echo $error_message; Session::erase('error_message'); } if (!empty($my_folder_data['description'])) { echo '<p><div><strong>'.get_lang('Description').':</strong><p>'.Security::remove_XSS($my_folder_data['description']).'</p></div></p>'; } $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : null; $item_id = isset($_REQUEST['item_id']) ? intval($_REQUEST['item_id']) : null;
/** * This function allows easy activating and inactivating of dashboard plugins * @return void */ public static function handle_dashboard_plugins() { $token = Security::get_existing_token(); $tokenCondition = '&sec_token=' . $token; /* We scan the plugin directory. Each folder is a potential plugin. */ $dashboard_pluginpath = api_get_path(SYS_PLUGIN_PATH) . 'dashboard/'; $possibleplugins = self::get_posible_dashboard_plugins_path(); $table_cols = array('name', 'version', 'description'); echo Display::page_subheader(get_lang('DashboardPlugins')); echo '<form name="plugins" method="post" action="' . api_get_self() . '?category=' . Security::remove_XSS($_GET['category']) . $tokenCondition . '">'; echo '<table class="data_table">'; echo '<tr>'; echo '<th width="50px">' . get_lang('Enabled') . '</th>'; echo '<th width="250px">' . get_lang('Name') . '</th>'; echo '<th width="100px">' . get_lang('Version') . '</th>'; echo '<th>' . get_lang('Description') . '</th>'; echo '</tr>'; $disabled_blocks_data = self::get_block_data_without_plugin(); // We display all the possible enabled or disabled plugins foreach ($possibleplugins as $testplugin) { $plugin_info_file = $dashboard_pluginpath . $testplugin . "/{$testplugin}.info"; if (file_exists($plugin_info_file) && is_readable($plugin_info_file)) { $plugin_info = parse_info_file($plugin_info_file); // change index to lower case $plugin_info = array_change_key_case($plugin_info); echo '<tr>'; self::display_dashboard_plugin_checkboxes($testplugin); for ($i = 0; $i < count($table_cols); $i++) { if (isset($plugin_info[strtolower($table_cols[$i])])) { echo '<td>'; echo $plugin_info[$table_cols[$i]]; echo '</td>'; } else { echo '<td></td>'; } } echo '</tr>'; } else { echo Display::tag('tr', Display::tag('td', get_lang('CheckFilePermissions') . ' ' . Security::remove_XSS($plugin_info_file), array('colspan' => '3'))); } } // display all disabled block data if (count($disabled_blocks_data) > 0) { foreach ($disabled_blocks_data as $disabled_block) { echo '<tr style="background-color:#eee">'; echo '<td><center><input type="checkbox" name="disabled_block" value="true" checked disabled /></center>'; for ($j = 0; $j < count($table_cols); $j++) { if (isset($disabled_block[strtolower($table_cols[$j])])) { if ($j == 2) { echo '<td>'; echo '<font color="#aaa">' . $disabled_block[$table_cols[$j]] . '</font><br />'; echo '<font color="red">' . get_lang('ThisPluginHasbeenDeletedFromDashboardPluginDirectory') . '</font>'; echo '</td>'; } else { echo '<td>'; echo '<font color="#aaa">' . $disabled_block[$table_cols[$j]] . '</font>'; echo '</td>'; } } else { echo '<td> </td>'; } } echo '</tr>'; } } echo '</table>'; echo '<br />'; echo '<button class="btn btn-default" type="submit" name="submit_dashboard_plugins" value="' . get_lang('EnableDashboardPlugins') . '">' . get_lang('EnableDashboardPlugins') . '</button></form>'; }
} $form = new FormValidator('search_user', 'get', api_get_path(WEB_CODE_PATH) . 'mySpace/student.php'); $form = Tracking::setUserSearchForm($form); $form->setDefaults($params); if ($export_csv) { // send the csv file if asked $content = $table->get_table_data(); foreach ($content as &$row) { unset($row[4]); } $csv_content = array_merge($csv_header, $content); ob_end_clean(); Export::arrayToCsv($csv_content, 'reporting_student_list'); exit; } else { Display::display_header($nameTools); echo $actions; $page_title = get_lang('Students'); echo Display::page_subheader($page_title); if (isset($active)) { if ($active) { $activeLabel = get_lang('ActiveUsers'); } else { $activeLabel = get_lang('InactiveUsers'); } echo Display::page_subheader2($activeLabel); } $form->display(); $table->display(); } Display::display_footer();
$file = null; if (isset($lp_item->audio) && !empty($lp_item->audio)) { $file = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document/audio/' . $lp_item->audio; $urlFile = api_get_path(WEB_COURSE_PATH) . $courseInfo['path'] . '/document/audio/' . $lp_item->audio . '?' . api_get_cidreq(); if (!file_exists($file)) { $file = api_get_path(SYS_COURSE_PATH) . $courseInfo['path'] . '/document' . $lpPathInfo['dir'] . $lp_item->audio; $urlFile = api_get_path(WEB_COURSE_PATH) . $courseInfo['path'] . '/document' . $lpPathInfo['dir'] . $lp_item->audio . '?' . api_get_cidreq(); } } $page = $_SESSION['oLP']->build_action_menu(true); $page .= '<div class="row" style="overflow:hidden">'; $page .= '<div id="lp_sidebar" class="col-md-4">'; $page .= $_SESSION['oLP']->return_new_tree(null, true); // Show the template list. $page .= '</div>'; $recordVoiceForm = Display::page_subheader(get_lang('RecordYourVoice')); $page .= '<div id="doc_form" class="col-md-8">'; $tpl = new Template(null); $tpl->assign('unique_file_id', api_get_unique_id()); $tpl->assign('course_code', api_get_course_id()); $tpl->assign('php_session_id', session_id()); $tpl->assign('filename', $lp_item->get_title() . '_nano.wav'); $tpl->assign('enable_nanogong', api_get_setting('enable_nanogong') == 'true' ? 1 : 0); $tpl->assign('enable_wami', api_get_setting('enable_wami_record') == 'true' ? 1 : 0); $tpl->assign('cur_dir_path', '/audio'); $tpl->assign('lp_item_id', $lp_item_id); $tpl->assign('lp_dir', api_remove_trailing_slash($lpPathInfo['dir'])); $recordVoiceForm .= $tpl->fetch('default/learnpath/record_voice.tpl'); $form->addElement('header', get_lang('Or')); $form->addElement('header', get_lang('AudioFile')); $form->addElement('html', sprintf(get_lang('AudioFileForItemX'), $lp_item->get_title()));
echo $_SESSION['oLP']->build_action_menu(); echo '<div class="row-fluid">'; echo '<div class="span4">'; // Build the tree with the menu items in it. echo $_SESSION['oLP']->return_new_tree(); echo '</div>'; echo '<div class="span8">'; if (isset($is_success) && $is_success === true) { Display::display_confirmation_message(get_lang('ItemRemoved')); } else { if ($is_new) { Display::display_normal_message(get_lang('LearnpathAdded'), false); } // Display::display_normal_message(get_lang('LPCreatedAddChapterStep'), false); $gradebook = isset($_GET['gradebook']) ? Security::remove_XSS($_GET['gradebook']) : null; echo Display::page_subheader(get_lang('LearnPathAddedTitle')); echo '<ul id="lp_overview" class="thumbnails">'; echo show_block('lp_controller.php?' . api_get_cidreq() . '&gradebook=' . $gradebook . '&action=add_item&type=step&lp_id=' . $_SESSION['oLP']->lp_id, get_lang("NewStep"), get_lang('NewStepComment'), 'tools.png'); // echo show_block('lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=admin_view&updateaudio=true&lp_id=' . $_SESSION['oLP']->lp_id, get_lang("BasicOverview"), get_lang('BasicOverviewComment'), 'audio.png'); echo show_block('lp_controller.php?' . api_get_cidreq() . '&gradebook=' . $gradebook . '&action=view&lp_id=' . $_SESSION['oLP']->lp_id, get_lang("Display"), get_lang('DisplayComment'), 'view.png'); //echo show_block('lp_controller.php?'.api_get_cidreq().'&gradebook='.$gradebook.'&action=edit&lp_id=' . $_SESSION['oLP']->lp_id, get_lang("Settings"), null, 'reference.png'); echo '</ul>'; } echo '</div>'; echo '</div>'; function show_block($link, $title, $subtitle, $icon) { $html = '<li class="span4">'; $html .= '<div class="thumbnail">'; $html .= '<a href="' . $link . '" title="' . $title . '">'; $html .= Display::return_icon($icon, $title, array(), ICON_SIZE_BIG);
// Only show empty actions bar if delete users has been blocked if (api_is_platform_admin() && !$deleteUserAvailable) { $table->set_form_actions(array('delete' => get_lang('DeleteFromPlatform'))); } else { $table->set_form_actions(array('none' => get_lang('NoActionAvailable'))); } $table_result = $table->return_table(); $extra_search_options = ''; //Try to search the user everywhere if ($table->get_total_number_of_items() == 0) { if (api_get_multiple_access_url() && isset($_REQUEST['keyword'])) { $keyword = Database::escape_string($_REQUEST['keyword']); $conditions = array('username' => $keyword); $user_list = UserManager::get_user_list($conditions, array(), false, ' OR '); if (!empty($user_list)) { $extra_search_options = Display::page_subheader(get_lang('UsersFoundInOtherPortals')); $table = new HTML_Table(array('class' => 'data_table')); $column = 0; $row = 0; $headers = array(get_lang('User'), 'URL', get_lang('Actions')); foreach ($headers as $header) { $table->setHeaderContents($row, $column, $header); $column++; } $row++; foreach ($user_list as $user) { $column = 0; $access_info = UrlManager::get_access_url_from_user($user['id']); $access_info_to_string = ''; $add_user = true; if (!empty($access_info)) {
/** * @param $userId * @param $courseInfo * @param int $sessionId * @return array */ public static function getToolInformation($userId, $courseInfo, $sessionId = 0) { $csvContent = array(); $courseToolInformation = null; $headerTool = array(array(get_lang('Title')), array(get_lang('CreatedAt')), array(get_lang('UpdatedAt'))); $headerListForCSV = array(); foreach ($headerTool as $item) { $headerListForCSV[] = $item[0]; } $courseForumInformationArray = getForumCreatedByUser($userId, $courseInfo['real_id'], $sessionId); if (!empty($courseForumInformationArray)) { $csvContent[] = array(); $csvContent[] = get_lang('Forums'); $csvContent[] = $headerListForCSV; foreach ($courseForumInformationArray as $row) { $csvContent[] = $row; } $courseToolInformation .= Display::page_subheader2(get_lang('Forums')); $courseToolInformation .= Display::return_sortable_table($headerTool, $courseForumInformationArray); } $courseWorkInformationArray = getWorkCreatedByUser($userId, $courseInfo['real_id'], $sessionId); if (!empty($courseWorkInformationArray)) { $csvContent[] = null; $csvContent[] = get_lang('Works'); $csvContent[] = $headerListForCSV; foreach ($courseWorkInformationArray as $row) { $csvContent[] = $row; } $csvContent[] = null; $courseToolInformation .= Display::page_subheader2(get_lang('Works')); $courseToolInformation .= Display::return_sortable_table($headerTool, $courseWorkInformationArray); } $courseToolInformationTotal = null; if (!empty($courseToolInformation)) { $sessionTitle = null; if (!empty($sessionId)) { $sessionTitle = ' (' . api_get_session_name($sessionId) . ')'; } $courseToolInformationTotal .= Display::page_subheader($courseInfo['title'] . $sessionTitle); $courseToolInformationTotal .= $courseToolInformation; } return array('array' => $csvContent, 'html' => $courseToolInformationTotal); }
if ($document_data['insert_user_id'] == api_get_user_id() && $document_data['filetype'] == 'file') { $quota_bytes += $document_data['size']; } } if ($quota_bytes != 0) { $quota_percentage = round($quota_bytes / $total_quota_bytes, 2) * 100; } $session[] = array(addslashes(get_lang('Teacher') . ': ' . $user_name) . ' (' . format_file_size($quota_bytes) . ')', $quota_percentage); //if a sesson is active if ($session_id != 0) { if (!empty($course_list)) { $total_courses_quota = 0; $total_quota_bytes = 0; foreach ($course_list as $course_data) { $total_quota_bytes += DocumentManager::get_course_quota($course_data['id']); } if ($quota_bytes != 0) { $quota_percentage = round($quota_bytes / $total_quota_bytes, 2) * 100; } } $session[] = array(addslashes(sprintf(get_lang('TeacherXInSession'), $user_name)), $quota_percentage); } } $quota_percentage = round(($total_quota_bytes - $used_quota_bytes) / $total_quota_bytes, 2) * 100; $session[] = array(addslashes(get_lang('ShowCourseQuotaUse')) . ' (' . format_file_size($total_quota_bytes - $used_quota_bytes) . ') ', $quota_percentage); $quota_data = json_encode($session); $htmlHeadXtra[] = "\n<script>\n\$(document).ready(function(){\n var data = " . $quota_data . ";\n var plot1 = jQuery.jqplot ('chart1', [data], {\n seriesDefaults: {\n // Make this a pie chart\n renderer: jQuery.jqplot.PieRenderer,\n rendererOptions: {\n // Put data labels on the pie slices.\n // By default, labels show the percentage of the slice.\n showDataLabels: true\n }\n },\n legend: { show:true, location: 'e' }\n }\n );\n});\n</script>"; $tpl = new Template($tool_name); $content = Display::page_subheader(get_lang('ShowCourseQuotaUse')) . '<div id="chart1"></div>'; $tpl->assign('content', $content); $tpl->display_one_col_template();
$class = "add"; $text = get_lang('AddCategory'); $form->setDefaults(array('auth_course_child' => 'TRUE')); $form->addButtonCreate($text); } $form->display(); } elseif (api_get_multiple_access_url() && api_get_current_access_url_id() != 1) { // If multiple URLs and not main URL, prevent edition and inform user Display::display_warning_message(get_lang('CourseCategoriesAreGlobal')); } } else { // If multiple URLs and not main URL, prevent deletion and inform user if ($action == 'delete' && api_get_multiple_access_url() && api_get_current_access_url_id() != 1) { Display::display_warning_message(get_lang('CourseCategoriesAreGlobal')); } echo '<div class="actions">'; $link = null; if (!empty($parentInfo)) { $parentCode = $parentInfo['parent_id']; echo Display::url(Display::return_icon('back.png', get_lang("Back"), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . 'admin/course_category.php?category=' . $parentCode); } if (empty($parentInfo) || $parentInfo['auth_cat_child'] == 'TRUE') { echo Display::url(Display::return_icon('new_folder.png', get_lang("AddACategory"), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . 'admin/course_category.php?action=add&category=' . Security::remove_XSS($category)); } echo '</div>'; if (!empty($parentInfo)) { echo Display::page_subheader($parentInfo['name'] . ' (' . $parentInfo['code'] . ')'); } echo listCategories($category); } Display::display_footer();
public function returnSessionsCategories($user_id, $filter, $page) { if (empty($user_id)) { return false; } $load_history = isset($filter) && $filter == 'history' ? true : false; $start = ($page - 1) * $this->maxPerPage; $nbResults = UserManager::getCategories($user_id, false, true, true); $session_categories = UserManager::getCategories($user_id, false, false, true, $start, $this->maxPerPage); $html = null; //Showing history title if ($load_history) { $html .= Display::page_subheader(get_lang('HistoryTrainingSession')); if (empty($session_categories)) { $html .= get_lang('YouDoNotHaveAnySessionInItsHistory'); } } $load_directories_preview = api_get_setting('show_documents_preview') == 'true' ? true : false; $sessions_with_category = $html; if (isset($session_categories) && !empty($session_categories)) { foreach ($session_categories as $session_category) { $session_category_id = $session_category['session_category']['id']; // All sessions included in $count_courses_session = 0; $html_sessions = ''; foreach ($session_category['sessions'] as $session) { $session_id = $session['session_id']; // Don't show empty sessions. if (count($session['courses']) < 1) { continue; } $html_courses_session = ''; $count = 0; foreach ($session['courses'] as $course) { if (api_get_setting('hide_courses_in_sessions') == 'false') { $html_courses_session .= CourseManager::get_logged_user_course_html($course, $session_id); } $count_courses_session++; $count++; } $params = array(); if ($count > 0) { $params['icon'] = Display::return_icon('window_list.png', $session['session_name'], array('id' => 'session_img_' . $session_id), ICON_SIZE_LARGE); //Default session name $session_link = $session['session_name']; $params['link'] = null; if (api_get_setting('session_page_enabled') == 'true' && !api_is_drh()) { //session name with link $session_link = Display::tag('a', $session['session_name'], array('href' => api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . $session_id)); $params['link'] = api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . $session_id; } $params['title'] = $session_link; $moved_status = SessionManager::get_session_change_user_reason($session['moved_status']); $moved_status = isset($moved_status) && !empty($moved_status) ? ' (' . $moved_status . ')' : null; $params['subtitle'] = isset($session['coach_info']) ? $session['coach_info']['complete_name'] : null . $moved_status; $params['dates'] = $session['date_message']; if (api_is_platform_admin()) { $params['right_actions'] = '<a href="' . api_get_path(WEB_CODE_PATH) . 'admin/resume_session.php?id_session=' . $session_id . '">' . Display::return_icon('edit.png', get_lang('Edit'), array('align' => 'absmiddle'), ICON_SIZE_SMALL) . '</a>'; } $html_sessions .= CourseManager::course_item_html($params, true) . $html_courses_session; } } if ($count_courses_session > 0) { $params = array(); $params['icon'] = Display::return_icon('folder_blue.png', $session_category['session_category']['name'], array(), ICON_SIZE_LARGE); if (api_is_platform_admin()) { $params['right_actions'] = '<a href="' . api_get_path(WEB_CODE_PATH) . 'admin/session_category_edit.php?&id=' . $session_category['session_category']['id'] . '">' . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>'; } $params['title'] = $session_category['session_category']['name']; if (api_is_platform_admin()) { $params['link'] = api_get_path(WEB_CODE_PATH) . 'admin/session_category_edit.php?&id=' . $session_category['session_category']['id']; } $session_category_start_date = $session_category['session_category']['date_start']; $session_category_end_date = $session_category['session_category']['date_end']; if (!empty($session_category_start_date) && $session_category_start_date != '0000-00-00' && !empty($session_category_end_date) && $session_category_end_date != '0000-00-00') { $params['subtitle'] = sprintf(get_lang('FromDateXToDateY'), $session_category['session_category']['date_start'], $session_category['session_category']['date_end']); } else { if (!empty($session_category_start_date) && $session_category_start_date != '0000-00-00') { $params['subtitle'] = get_lang('From') . ' ' . $session_category_start_date; } if (!empty($session_category_end_date) && $session_category_end_date != '0000-00-00') { $params['subtitle'] = get_lang('Until') . ' ' . $session_category_end_date; } } $sessions_with_category .= CourseManager::course_item_parent(CourseManager::course_item_html($params, true), $html_sessions); } } //Pagination $adapter = new FixedAdapter($nbResults, array()); $pagerfanta = new Pagerfanta($adapter); $pagerfanta->setMaxPerPage($this->maxPerPage); // 10 by default $pagerfanta->setCurrentPage($page); // 1 by default $this->app['pagerfanta.view.router.name'] = 'userportal'; $this->app['pagerfanta.view.router.params'] = array('filter' => $filter, 'type' => 'sessioncategories', 'page' => $page); $this->app['template']->assign('pagination', $pagerfanta); } return $sessions_with_category; }
$student_list = get_thread_users_qualify($_GET['id']); $nrorow3 = -2; $active = 2; break; case 'notqualify': $student_list = get_thread_users_not_qualify($_GET['id']); $nrorow3 = -2; $active = 3; break; default: $student_list = get_thread_users_details($_GET['id']); $nrorow3 = Database::num_rows($student_list); $active = 1; break; } $table_list = Display::page_subheader(get_lang('ThreadUsersList') . ': ' . get_name_thread_by_id($_GET['id'])); if ($nrorow3 > 0 || $nrorow3 == -2) { $url = 'cidReq=' . Security::remove_XSS($_GET['cidReq']) . '&forum=' . Security::remove_XSS($my_forum) . '&action=' . Security::remove_XSS($_GET['action']) . '&content=' . Security::remove_XSS($_GET['content'], STUDENT) . '&id=' . intval($_GET['id']); $tabs = array(array('content' => get_lang('AllStudents'), 'url' => $forumUrl . 'viewforum.php?' . $url . '&origin=' . $origin . '&list=all'), array('content' => get_lang('StudentsQualified'), 'url' => $forumUrl . 'viewforum.php?' . $url . '&origin=' . $origin . '&list=qualify'), array('content' => get_lang('StudentsNotQualified'), 'url' => $forumUrl . 'viewforum.php?' . $url . '&origin=' . $origin . '&list=notqualify')); $table_list .= Display::tabs_only_link($tabs, $active); $icon_qualify = 'blog_new.gif'; $table_list .= '<center><br /><table class="data_table" style="width:50%">'; // The column headers (TODO: Make this sortable). $table_list .= '<tr >'; $table_list .= '<th height="24">' . get_lang('NamesAndLastNames') . '</th>'; if ($_GET['list'] == 'qualify') { $table_list .= '<th>' . get_lang('Qualification') . '</th>'; } if (api_is_allowed_to_edit(null, true)) { $table_list .= '<th>' . get_lang('Qualify') . '</th>'; }
if ($user_info['user_is_online']) { $status_icon = Display::span('', array('class' => 'online_user_in_text')); } else { $status_icon = Display::span('', array('class' => 'offline_user_in_text')); } $user['tag'] = isset($user['tag']) ? $user['tag'] : null; $user_info['complete_name'] = Display::url($status_icon . $user_info['complete_name'], $url) . '<br />' . $user['tag']; $results .= '<li class="col-md-3"><div class="thumbnail">' . $img . '<div class="caption">' . $user_info['complete_name'] . $user['tag'] . '</div</div></li>'; } $results .= '</ul></div></div>'; $social_right_content .= $results; } $grid_groups = array(); if (is_array($groups) && count($groups) > 0) { $social_right_content .= '<div class="col-md-12">'; $social_right_content .= Display::page_subheader(get_lang('Groups')); foreach ($groups as $group) { $group['name'] = Security::remove_XSS($group['name'], STUDENT, true); ${$group}['description'] = Security::remove_XSS($group['description'], STUDENT, true); $id = $group['id']; $url_open = '<a href="groups.php?id=' . $id . '" >'; $url_close = '</a>'; $name = Text::cut($group['name'], 25, true); $count_users_group = count($usergroup->get_all_users_by_group($id)); if ($count_users_group == 1) { $count_users_group = $count_users_group . ' ' . get_lang('Member'); } else { $count_users_group = $count_users_group . ' ' . get_lang('Members'); } $picture = $usergroup->get_picture_group($group['id'], $group['picture'], 80); $tags = $usergroup->get_group_tags($group['id']);
$form_search->addElement('hidden', 'id_session', $sessionId); $form_search->addElement('text', 'user_keyword'); $form_search->addElement('style_submit_button', 'submit', get_lang('SearchUsers'), 'class="search"'); $form_search->display(); echo '</div>'; $course_name = get_lang('Course').' '.$courseInfo['name']; if ($session_id) { echo Display::page_subheader( Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.api_get_session_name($session_id).' '. Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$course_name ); } else { echo Display::page_subheader( Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$courseInfo['name'] ); } $teacherList = CourseManager::get_teacher_list_from_course_code_to_string( $courseInfo['code'], ',', false ); $coaches = null; if (!empty($session_id)) { $coaches = CourseManager::get_coachs_from_course_to_string( $session_id, $courseInfo['code'], ',',
if (api_get_setting('allow_students_to_create_groups_in_social') == 'true') { $create_group_item = '<a class="btn btn-default" href="' . api_get_path(WEB_PATH) . 'main/social/group_add.php">' . get_lang('CreateASocialGroup') . '</a>'; } else { if (api_is_allowed_to_edit(null, true)) { $create_group_item = '<a class="btn btn-default" href="' . api_get_path(WEB_PATH) . 'main/social/group_add.php">' . get_lang('CreateASocialGroup') . '</a>'; } } if (count($grid_newest_groups) > 0) { $newest_content = Display::return_sortable_grid('mygroups', array(), $grid_newest_groups, array('hide_navigation' => true, 'per_page' => 100), $query_vars, false, array(true, true, true, false)); } if (count($grid_pop_groups) > 0) { $popular_content = Display::return_sortable_grid('mygroups', array(), $grid_pop_groups, array('hide_navigation' => true, 'per_page' => 100), $query_vars, false, array(true, true, true, true, true)); } } if (!empty($create_group_item)) { $social_right_content .= Display::page_subheader($create_group_item); } $headers = array(get_lang('Newest'), get_lang('Popular'), get_lang('MyGroups')); $social_right_content .= Display::tabs($headers, array($newest_content, $popular_content, $my_group_content), 'tab_browse'); $show_message = null; if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'show_message' && isset($_REQUEST['msg']) && $_REQUEST['msg'] == 'topic_deleted') { $show_message = Display::return_message(get_lang('Deleted'), 'success'); } $tpl = new Template(null); // Block Social Avatar SocialManager::setSocialUserBlock($tpl, $user_id, $show_menu); $show_menu = 'browse_groups'; if (isset($_GET['view']) && $_GET['view'] == 'mygroups') { $show_menu = $_GET['view']; } $social_menu_block = SocialManager::show_social_menu($show_menu);
public function show_media_content() { $html = null; if ($this->parent_id != 0) { $parent_question = Question::read($this->parent_id); $html = $parent_question->show_media_content(); } else { $html .= Display::page_subheader($this->selectTitle()); $html .= $this->selectDescription(); } return $html; }
} if ($origin != 'learnpath') { Display::display_header(); } else { Display::display_reduced_header(); } $html = ''; $message = ''; $is_allowed_to_edit = api_is_allowed_to_edit(null, true); $edit_link = ''; if ($is_allowed_to_edit) { $url = api_get_path(WEB_CODE_PATH) . 'exercice/admin.php?' . api_get_cidreq() . '&id_session=' . api_get_session_id() . '&exerciseId=' . $objExercise->id; $edit_link = Display::url(Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), $url); } //Exercise name $html .= Display::page_subheader($objExercise->name . ' ' . $edit_link); //Exercise description if (!empty($objExercise->description)) { $html .= Display::div($objExercise->description, array('class' => 'exercise_description')); } $extra_params = ''; if (isset($_GET['preview'])) { $extra_params = '&preview=1'; } $attempt_list = null; if (isset($exercise_stat_info['exe_id'])) { $attempt_list = getAllExerciseEventByExeId($exercise_stat_info['exe_id']); } //1. Check if this is a new attempt or a previous $label = get_lang('StartTest'); if ($time_control && !empty($clock_expired_time) || !empty($attempt_list)) {