/** * Display the unregister button of a course in the course catalog * @param $course * @param $stok * @param $search_term * @param $code */ function return_unregister_button($course, $stok, $search_term, $code) { $html = ' <a class="btn btn-danger btn-sm" title="' . get_lang('Unsubscribe') . '" href="' . api_get_self() . '?action=unsubscribe&sec_token=' . $stok . '&unsubscribe=' . $course['code'] . '&search_term=' . $search_term . '&category_code=' . $code . '">' . Display::returnFontAwesomeIcon('sign-out') . '</a>'; return $html; }
$chatVideo = $entityManager->find('ChamiloCoreBundle:ChatVideo', $roomId); if (!$chatVideo) { header('Location: ' . api_get_path(WEB_PATH)); exit; } $friend_html = SocialManager::listMyFriendsBlock($user_id, '', false); $isSender = $chatVideo->getFromUser() === api_get_user_id(); $isReceiver = $chatVideo->getToUser() === api_get_user_id(); if (!$isSender && !$isReceiver) { header('Location: ' . api_get_path(WEB_PATH)); exit; } if ($isSender) { $chatUser = api_get_user_info($chatVideo->getToUser()); } elseif ($isReceiver) { $chatUser = api_get_user_info($chatVideo->getFromUser()); } $idUserLocal = api_get_user_id(); $userLocal = api_get_user_info($idUserLocal, true); $htmlHeadXtra[] = '<script type="text/javascript" src="' . api_get_path(WEB_PATH) . 'web/assets/SimpleWebRTC/latest.js' . '"></script>' . "\n"; $template = new Template(); $template->assign('room_name', $chatVideo->getRoomName()); $template->assign('chat_user', $chatUser); $template->assign('user_local', $userLocal); $template->assign('block_friends', $friend_html); $content = $template->fetch('default/chat/video.tpl'); $templateHeader = Display::returnFontAwesomeIcon('video-camera', true, 'lg') . $chatVideo->getRoomName(); $template->assign('header', $templateHeader); $template->assign('content', $content); $template->assign('message', Display::return_message(get_lang('YourBroswerDoesNotSupportWebRTC'), 'warning')); $template->display_one_col_template();
<div class="views">' . Display::returnFontAwesomeIcon('file-text-o') . strip_tags($thematic_advance_info['content']) . '</div> <p class="time">' . Display::returnFontAwesomeIcon('clock-o') . get_lang('DurationInHours') . ' : ' . $thematic_advance_info['duration'] . ' - <a href="' . $thematicUrl . '">' . get_lang('SeeDetail') . '</a></p> </div> </div>'; if (!empty($thematic_advance_info2)) { $thematic_info2 = $thematic->get_thematic_list($thematic_advance_info2['thematic_id']); $thematic_advance_info2['start_date'] = api_get_local_time($thematic_advance_info2['start_date']); $thematic_advance_info2['start_date'] = api_format_date($thematic_advance_info2['start_date'], DATE_TIME_FORMAT_LONG); $thematicItemTwo = ' <div class="col-md-6 items-progress"> <div class="thematic-cont"> <div class="topics">' . $subTitle2 . '</div> <h4 class="title-topics">' . Display::returnFontAwesomeIcon('book') . $thematic_info2['title'] . '</h4> <p class="date">' . Display::returnFontAwesomeIcon('calendar-o') . $thematic_advance_info2['start_date'] . '</p> <div class="views">' . Display::returnFontAwesomeIcon('file-text-o') . strip_tags($thematic_advance_info2['content']) . '</div> <p class="time">' . Display::returnFontAwesomeIcon('clock-o') . get_lang('DurationInHours') . ' : ' . $thematic_advance_info2['duration'] . ' - <a href="' . $thematicUrl . '">' . get_lang('SeeDetail') . '</a></p> </div> </div>'; } $thematicPanel = '<div class="row">'; $thematicPanel .= '<div class="col-md-2">' . $infoUser . '</div>'; $thematicPanel .= '<div class="col-md-10"><div class="row">' . $thematicItemOne . $thematicItemTwo . '</div></div>'; $thematicPanel .= '</div>'; $thematicPanel .= '<div class="separate"> <a href="' . $thematicUrl . '" class="btn btn-default btn-block">' . get_lang('ShowFullCourseAdvance') . '</a> </div>'; $thematicProgress = Display::panelCollapse($titleThematic, $thematicPanel, 'thematic', null, 'accordion-thematic', 'collapse-thematic', false); } } $introduction_section .= '<div class="row">'; if (!empty($thematic_advance_info)) {
$course_id = CourseManager::get_course_by_category($category_id); $show_message = $cat->show_message_resource_delete($course_id); if ($show_message == '') { // Student if (!api_is_allowed_to_edit() && !api_is_excluded_user_type()) { $certificate = Category::register_user_certificate($category_id, $stud_id); if (isset($certificate['pdf_url'])) { $actionsLeft .= Display::url(Display::returnFontAwesomeIcon('file-pdf-o') . get_lang('DownloadCertificatePdf'), $certificate['pdf_url'], ['class' => 'btn btn-default']); } $currentScore = Category::getCurrentScore($stud_id, $category_id, $course_code, $session_id, true); Category::registerCurrentScore($currentScore, $stud_id, $category_id); } } } if (!api_is_allowed_to_edit(null, true)) { $actionsLeft .= Display::url(Display::returnFontAwesomeIcon('file-pdf-o') . get_lang('DownloadReportPdf'), api_get_self() . "?" . api_get_self() . "&action=export_table", ['class' => 'btn btn-default']); } echo $toolbar = Display::toolbarAction('gradebook-student-actions', array(0 => $actionsLeft, 1 => '')); if (api_is_allowed_to_edit(null, true)) { // Tool introduction Display::display_introduction_section(TOOL_GRADEBOOK, array('ToolbarSet' => 'AssessmentsIntroduction')); if (isset($_GET['selectcat']) && $_GET['selectcat'] != 0) { // } else { if (isset($_GET['selectcat']) && $_GET['selectcat'] == 0 || isset($_GET['cidReq']) && $_GET['cidReq'] !== '' || isset($_GET['isStudentView']) && $_GET['isStudentView'] == 'false') { $cats = Category::load(null, null, $course_code, null, null, $session_id, false); } } } if (isset($first_time) && $first_time == 1 && api_is_allowed_to_edit(null, true)) { echo '<meta http-equiv="refresh" content="0;url=' . api_get_self() . '?cidReq=' . $course_code . '" />';
/** * @param array $courses * @param array $my_course_code_list * @return mixed */ public static function process_hot_course_item($courses, $my_course_code_list = array()) { $hotCourses = []; $ajax_url = api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?a=add_course_vote'; $stok = Security::get_existing_token(); foreach ($courses as $courseId) { $course_info = api_get_course_info_by_id($courseId['c_id']); $courseCode = $course_info['code']; $categoryCode = !empty($course_info['categoryCode']) ? $course_info['categoryCode'] : ""; $my_course['extra_info'] = $course_info; $my_course['extra_info']['go_to_course_button'] = ''; $my_course['extra_info']['register_button'] = ''; $access_link = self::get_access_link_by_user(api_get_user_id(), $course_info, $my_course_code_list); //Course visibility if ($access_link && in_array('register', $access_link)) { $my_course['extra_info']['register_button'] = Display::url(Display::returnFontAwesomeIcon('sign-in'), api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/index.php?action=subscribe&sec_token=' . $stok, array('class' => 'btn btn-success btn-sm', 'title' => get_lang('Subscribe'))); } if ($access_link && in_array('enter', $access_link) || $course_info['visibility'] == COURSE_VISIBILITY_OPEN_WORLD) { $my_course['extra_info']['go_to_course_button'] = Display::url(Display::returnFontAwesomeIcon('share'), api_get_path(WEB_COURSE_PATH) . $course_info['path'] . '/index.php', array('class' => 'btn btn-default btn-sm', 'title' => get_lang('GoToCourse'))); } if ($access_link && in_array('unsubscribe', $access_link)) { $my_course['extra_info']['unsubscribe_button'] = Display::url(Display::returnFontAwesomeIcon('sign-out'), api_get_path(WEB_CODE_PATH) . 'auth/courses.php?action=unsubscribe&unsubscribe=' . $courseCode . '&sec_token=' . $stok . '&category_code=' . $categoryCode, array('class' => 'btn btn-danger btn-sm', 'title' => get_lang('Unreg'))); } //Description $my_course['extra_info']['description_button'] = ''; /* if ($course_info['visibility'] == COURSE_VISIBILITY_OPEN_WORLD || in_array($course_info['real_id'], $my_course_code_list) ) { */ $my_course['extra_info']['description_button'] = Display::url(Display::returnFontAwesomeIcon('info-circle'), api_get_path(WEB_AJAX_PATH) . 'course_home.ajax.php?a=show_course_information&code=' . $course_info['code'], ['class' => 'btn btn-default btn-sm ajax', 'data-title' => get_lang('Description'), 'title' => get_lang('Description')]); //} /* get_lang('Description') */ $my_course['extra_info']['teachers'] = CourseManager::getTeacherListFromCourseToString($course_info['real_id']); $point_info = self::get_course_ranking($course_info['real_id'], 0); $my_course['extra_info']['rating_html'] = Display::return_rating_system('star_' . $course_info['real_id'], $ajax_url . '&course_id=' . $course_info['real_id'], $point_info); $hotCourses[] = $my_course; } return $hotCourses; }
$grid_newest_groups = array(); foreach ($results as $result) { $result['name'] = Security::remove_XSS($result['name'], STUDENT, true); $result['description'] = Security::remove_XSS($result['description'], STUDENT, true); $id = $result['id']; $name = cut($result['name'], GROUP_TITLE_LENGTH, true); $count_users_group = count($usergroup->get_users_by_group($id, false, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_MODERATOR), 0, 1000)); if ($count_users_group == 1) { $count_users_group = $count_users_group . ' ' . get_lang('Member'); } else { $count_users_group = $count_users_group . ' ' . get_lang('Members'); } $url = '<a href="group_view.php?id=' . $id . '">' . $name . '</a>'; $picture = $usergroup->get_picture_group($result['id'], $result['picture'], 80); $result['picture'] = '<img class="social-groups-image" src="' . $picture['file'] . '" />'; $members = Display::returnFontAwesomeIcon('user') . $count_users_group; $html = '<div class="row">'; $html .= '<div class="col-md-2">'; $html .= $result['picture']; $html .= '</div>'; $html .= '<div class="col-md-10">'; $html .= '<div class="title-groups">'; $html .= Display::tag('h5', $url); $html .= '</div>'; $html .= '<div class="members-groups">' . $members . '</div>'; if ($result['description'] != '') { $html .= '<div class="description-groups">' . cut($result['description'], 100, true) . '</div>'; } else { $html .= ''; } //Avoiding my groups
$iconCourse = Display::return_icon('course.png', null, null, ICON_SIZE_TINY); $html .= '<ul class="session-list">'; foreach ($sessionList as $session) { $url = api_get_path(WEB_CODE_PATH) . 'mySpace/course.php?session_id=' . $session['id'] . '&cidReq=' . $courseInfo['code']; $html .= Display::tag('li', $iconCourse . ' ' . Display::url($session['name'], $url)); } $html .= '</ul>'; } $html .= Display::page_subheader2(get_lang('StudentList')); // PERSON_NAME_DATA_EXPORT is buggy $is_western_name_order = api_is_western_name_order(); if (count($a_students) > 0) { $getLangXDays = get_lang('XDays'); $form = new FormValidator('reminder_form', 'get', api_get_path(WEB_CODE_PATH) . 'announcements/announcements.php?' . api_get_cidreq(), null, ['style' => 'margin-bottom: 10px'], FormValidator::LAYOUT_INLINE); $options = array(2 => sprintf($getLangXDays, 2), 3 => sprintf($getLangXDays, 3), 4 => sprintf($getLangXDays, 4), 5 => sprintf($getLangXDays, 5), 6 => sprintf($getLangXDays, 6), 7 => sprintf($getLangXDays, 7), 15 => sprintf($getLangXDays, 15), 30 => sprintf($getLangXDays, 30), 'never' => get_lang('Never')); $el = $form->addSelect('since', Display::returnFontAwesomeIcon('warning') . get_lang('RemindInactivesLearnersSince'), $options, ['class' => 'col-sm-3']); $el->setSelected(7); $form->addElement('hidden', 'action', 'add'); $form->addElement('hidden', 'remindallinactives', 'true'); $form->addElement('hidden', 'cidReq', $courseInfo['code']); $form->addElement('hidden', 'id_session', api_get_session_id()); $form->addButtonSend(get_lang('SendNotification')); $extra_field_select = TrackingCourseLog::display_additional_profile_fields(); if (!empty($extra_field_select)) { $html .= $extra_field_select; } $html .= $form->return_form(); if ($export_csv) { $csv_content = array(); //override the SortableTable "per page" limit if CSV $_GET['users_tracking_per_page'] = 1000000;
var free_answers = {}; $.each(question_list, function(index, my_question_id) { // Checking FCK if (my_question_id) { if (CKEDITOR.instances["choice["+my_question_id+"]"]) { var ckContent = CKEDITOR.instances["choice["+my_question_id+"]"].getData(); free_answers["free_choice["+my_question_id+"]"] = ckContent; } } }); free_answers = $.param(free_answers); $("#save_all_reponse").html(\'' . Display::returnFontAwesomeIcon('spinner', true, null, 'fa-spin') . '\'); $.ajax({ type:"post", async: false, url: "' . api_get_path(WEB_AJAX_PATH) . 'exercise.ajax.php?' . api_get_cidreq() . '&a=save_exercise_by_now", data: "' . $params . '&type=all&"+my_choice+"&"+hotspot+"&"+free_answers+"&"+remind_list, success: function(return_value) { if (return_value == "ok") { //$("#save_all_reponse").html(\'' . Display::return_icon('accept.png') . '\'); if (validate == "validate") { window.location = "' . $script_php . '?' . $params . '"; } else { $("#save_all_reponse").html(\'' . Display::return_icon('accept.png') . '\'); } } else {
$chat->send(api_get_user_id(), $to_user_id, $message); break; case 'startchatsession': $chat->startSession(); break; case 'set_status': $status = isset($_REQUEST['status']) ? intval($_REQUEST['status']) : 0; $chat->setUserStatus($status); break; case 'create_room': $room = VideoChat::getChatRoomByUsers(api_get_user_id(), $to_user_id); if ($room === false) { $createdRoom = VideoChat::createRoom(api_get_user_id(), $to_user_id); if ($createdRoom === false) { echo Display::return_message(get_lang('ChatRoomNotCreated'), 'error'); break; } $room = VideoChat::getChatRoomByUsers(api_get_user_id(), $to_user_id); } $videoChatUrl = api_get_path(WEB_LIBRARY_JS_PATH) . "chat/video.php?room={$room['id']}"; $videoChatLink = Display::url(Display::returnFontAwesomeIcon('video-camera') . get_lang('StartVideoChat'), $videoChatUrl); $chat->send(api_get_user_id(), $to_user_id, $videoChatLink, false, false); echo Display::tag('p', $videoChatLink, ['class' => 'lead']); break; case 'notify_not_support': $chat->send(api_get_user_id(), $to_user_id, get_lang('TheXUserBrowserDoesNotSupportWebRTC')); break; default: echo ''; } exit;
/** * Returns an HTML-formatted string ready to display with teacher buttons * in LP view menu * @return string HTML TOC ready to display */ public function get_teacher_toc_buttons() { $is_allowed_to_edit = api_is_allowed_to_edit(null, true, false, false); $hide_teacher_icons_lp = api_get_configuration_value('hide_teacher_icons_lp'); $html = ''; if ($is_allowed_to_edit && $hide_teacher_icons_lp == false) { if ($this->get_lp_session_id() == api_get_session_id()) { $html .= '<div id="actions_lp" class="actions_lp">'; $html .= '<div class="btn-group">'; $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?" . api_get_cidreq() . "&action=build&lp_id=" . $this->lp_id . "' target='_parent'>" . Display::returnFontAwesomeIcon('street-view') . get_lang('Overview') . "</a>"; $html .= "<a class='btn btn-sm btn-default' href='lp_controller.php?" . api_get_cidreq() . "&action=add_item&type=step&lp_id=" . $this->lp_id . "' target='_parent'>" . Display::returnFontAwesomeIcon('pencil') . get_lang('Edit') . "</a>"; $html .= '<a class="btn btn-sm btn-default" href="lp_controller.php?' . api_get_cidreq() . "&action=edit&lp_id=" . $this->lp_id . '">' . Display::returnFontAwesomeIcon('cog') . get_lang('Settings') . '</a>'; $html .= '</div>'; $html .= '</div>'; } } return $html; }
} } // Top popular $results = $userGroup->get_groups_by_popularity(1, false); $groups_pop = array(); foreach ($results as $result) { $result['description'] = Security::remove_XSS($result['description'], STUDENT, true); $result['name'] = Security::remove_XSS($result['name'], STUDENT, true); $id = $result['id']; $group_url = "group_view.php?id={$id}"; if ($result['count'] == 1) { $result['count'] = '1 ' . get_lang('Member'); } else { $result['count'] = $result['count'] . ' ' . get_lang('Members'); } $result['name'] = '<div class="group-name">' . Display::url(api_ucwords(cut($result['name'], 40, true)), $group_url) . '</div><div class="count-username">' . Display::returnFontAwesomeIcon('user') . $result['count'] . '</div>'; $picture = $userGroup->get_picture_group($id, $result['picture'], 80); $result['picture_uri'] = '<img class="group-image" src="' . $picture['file'] . '" />'; $group_actions = '<div class="group-more" ><a href="groups.php?#tab_browse-3">' . get_lang('SeeMore') . '</a></div>'; $group_info = '<div class="description"><p>' . cut($result['description'], 120, true) . "</p></div>"; $groups_pop[] = array(Display::url($result['picture_uri'], $group_url), $result['name'], $group_info . $group_actions); } $list = count($groups_newest); $social_group_block = null; if ($list > 0) { $social_group_block .= '<div class="list-group-newest">'; $social_group_block .= '<div class="group-title">' . get_lang('Newest') . '</div>'; for ($i = 0; $i < $list; $i++) { $social_group_block .= '<div class="row">'; $social_group_block .= '<div class="col-md-2">' . $groups_newest[$i][0] . '</div>'; $social_group_block .= '<div class="col-md-10">' . $groups_newest[$i][1];
/** * @param int $category_id * @param int $user_id * @return bool|string */ public static function register_user_certificate($category_id, $user_id) { $courseId = api_get_course_int_id(); $courseCode = api_get_course_id(); $sessionId = api_get_session_id(); // Generating the total score for a course $cats_course = Category::load($category_id, null, null, null, null, $sessionId, false); /** @var Category $category */ $category = $cats_course[0]; //@todo move these in a function $sum_categories_weight_array = array(); if (isset($cats_course) && !empty($cats_course)) { $categories = Category::load(null, null, null, $category_id); if (!empty($categories)) { foreach ($categories as $subCategory) { $sum_categories_weight_array[$subCategory->get_id()] = $subCategory->get_weight(); } } else { $sum_categories_weight_array[$category_id] = $cats_course[0]->get_weight(); } } $main_weight = $cats_course[0]->get_weight(); $cattotal = Category::load($category_id); $scoretotal = $cattotal[0]->calc_score($user_id); // Do not remove this the gradebook/lib/fe/gradebooktable.class.php // file load this variable as a global $scoredisplay = ScoreDisplay::instance(); $my_score_in_gradebook = $scoredisplay->display_score($scoretotal, SCORE_SIMPLE); // A student always sees only the teacher's repartition $scoretotal_display = $scoredisplay->display_score($scoretotal, SCORE_DIV_PERCENT); if (!self::userFinishedCourse($user_id, $cats_course[0], 0, $courseCode, $sessionId, true)) { return false; } $skillToolEnabled = api_get_setting('skill.allow_skills_tool') == 'true'; $userHasSkills = false; if ($skillToolEnabled) { if (!$category->getGenerateCertificates()) { $skill = new Skill(); $skill->add_skill_to_user($user_id, $category_id, $courseId, $sessionId); } $objSkillRelUser = new SkillRelUser(); $userSkills = $objSkillRelUser->get_user_skills($user_id, $courseId, $sessionId); $userHasSkills = !empty($userSkills); if (!$category->getGenerateCertificates() && $userHasSkills) { return ['badge_link' => Display::url(get_lang('DownloadBadges'), api_get_path(WEB_CODE_PATH) . "gradebook/get_badges.php?user={$user_id}", array('target' => '_blank', 'class' => 'btn btn-default'))]; } } $my_certificate = GradebookUtils::get_certificate_by_user_id($cats_course[0]->get_id(), $user_id); if (empty($my_certificate)) { GradebookUtils::register_user_info_about_certificate($category_id, $user_id, $my_score_in_gradebook, api_get_utc_datetime()); $my_certificate = GradebookUtils::get_certificate_by_user_id($cats_course[0]->get_id(), $user_id); } $html = array(); if (!empty($my_certificate)) { $certificate_obj = new Certificate($my_certificate['id']); $fileWasGenerated = $certificate_obj->html_file_is_generated(); if (!empty($fileWasGenerated)) { $url = api_get_path(WEB_PATH) . 'certificates/index.php?id=' . $my_certificate['id']; $certificates = Display::url(Display::returnFontAwesomeIcon('download') . ' ' . get_lang('DownloadCertificate'), $url, array('target' => '_blank', 'class' => 'btn btn-sm btn-primary')); $exportToPDF = Display::url(Display::return_icon('pdf.png', get_lang('ExportToPDF'), array(), ICON_SIZE_MEDIUM), "{$url}&action=export"); $hideExportLink = api_get_setting('hide_certificate_export_link'); $hideExportLinkStudent = api_get_setting('hide_certificate_export_link_students'); if ($hideExportLink === 'true' || api_is_student() && $hideExportLinkStudent === 'true') { $exportToPDF = null; } $html = array('certificate_link' => $certificates, 'pdf_link' => $exportToPDF, 'pdf_url' => "{$url}&action=export"); if ($skillToolEnabled && $userHasSkills) { $html['badge_link'] = Display::url(get_lang('DownloadBadges'), api_get_path(WEB_CODE_PATH) . "gradebook/get_badges.php?user={$user_id}", array('target' => '_blank', 'class' => 'btn btn-default')); } } return $html; } }