From c86517066f4c3c7323ee3dc705150992ee0bd193 Mon Sep 17 00:00:00 2001 From: Julio Date: Thu, 15 Oct 2015 09:29:15 +0200 Subject: [PATCH] Fix commit f2a03393774e8dd02f1d33acc69022f3cd6fb133 --- main/gradebook/index.php | 4 +- main/gradebook/lib/be/category.class.php | 2 +- main/inc/ajax/chat.ajax.php | 3 +- main/inc/introductionSection.inc.php | 41 +++++++------ main/inc/lib/course.lib.php | 10 +-- main/inc/lib/display.lib.php | 61 +++++++++++++------ main/inc/lib/javascript/chat/video.php | 2 +- main/newscorm/learnpath.class.php | 21 ++++--- .../default/auth/courses_categories.php | 28 ++++++--- main/tracking/courseLog.php | 8 +-- 10 files changed, 109 insertions(+), 71 deletions(-) diff --git a/main/gradebook/index.php b/main/gradebook/index.php index 7d395deee7..d8b855f1d2 100755 --- a/main/gradebook/index.php +++ b/main/gradebook/index.php @@ -771,7 +771,7 @@ if ($category != '0') { $stud_id ); if (isset($certificate['pdf_url'])) { - $actionsLeft .= Display::url(Display::returnFontAswesomeIcon('file-pdf-o') . + $actionsLeft .= Display::url(Display::returnFontAwesomeIcon('file-pdf-o') . get_lang('DownloadCertificatePdf'), $certificate['pdf_url'], ['class' => 'btn btn-default'] @@ -786,7 +786,7 @@ if ($category != '0') { if (!api_is_allowed_to_edit(null, true)) { $actionsLeft .= Display::url( - Display::returnFontAswesomeIcon('file-pdf-o') . get_lang('DownloadReportPdf'), + Display::returnFontAwesomeIcon('file-pdf-o') . get_lang('DownloadReportPdf'), api_get_self()."?".api_get_self()."&action=export_table", ['class' => 'btn btn-default'] ); diff --git a/main/gradebook/lib/be/category.class.php b/main/gradebook/lib/be/category.class.php index 5664f6976b..85c7739f6a 100755 --- a/main/gradebook/lib/be/category.class.php +++ b/main/gradebook/lib/be/category.class.php @@ -1998,7 +1998,7 @@ class Category implements GradebookItem $url = api_get_path(WEB_PATH) . 'certificates/index.php?id=' . $my_certificate['id']; $certificates = Display::url( - Display::returnFontAswesomeIcon('download').' '.get_lang('DownloadCertificate'), + Display::returnFontAwesomeIcon('download').' '.get_lang('DownloadCertificate'), $url, array( 'target' => '_blank', diff --git a/main/inc/ajax/chat.ajax.php b/main/inc/ajax/chat.ajax.php index b64e637d74..18a4a46dc6 100755 --- a/main/inc/ajax/chat.ajax.php +++ b/main/inc/ajax/chat.ajax.php @@ -29,7 +29,6 @@ if ($action == 'preview') { ); } - if (api_get_setting('allow_global_chat') == 'false') { exit; } @@ -88,7 +87,7 @@ switch ($action) { $videoChatUrl = api_get_path(WEB_LIBRARY_JS_PATH) . "chat/video.php?room={$room['id']}"; $videoChatLink = Display::url( - Display::returnFontAswesomeIcon('video-camera') . get_lang('StartVideoChat'), + Display::returnFontAwesomeIcon('video-camera') . get_lang('StartVideoChat'), $videoChatUrl ); diff --git a/main/inc/introductionSection.inc.php b/main/inc/introductionSection.inc.php index 29ace677d2..62cdebdffa 100755 --- a/main/inc/introductionSection.inc.php +++ b/main/inc/introductionSection.inc.php @@ -250,26 +250,27 @@ if ($tool == TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) { $userInfo = $_SESSION['_user']; $courseInfo = api_get_course_info(); $titleThematic = $thematic_advance .' : '. $courseInfo['name'] . ' ( '. $thematicScore .' )'; - - - + + + $infoUser = '
'; $infoUser .= '
'.$thematicScore.'
'; - - - $thematicItemOne = '
-
-
' . $subTitle1 . '
-

' . Display::returnFontAswesomeIcon('book') . $thematic_info['title'] . '

-

' . Display::returnFontAswesomeIcon('calendar-o') . $thematic_advance_info['start_date'] . '

-
' . Display::returnFontAswesomeIcon('file-text-o') . strip_tags($thematic_advance_info['content']). '
-

'. Display::returnFontAswesomeIcon('clock-o') . get_lang('DurationInHours') . ' : ' . $thematic_advance_info['duration'] . ' - ' . get_lang('SeeDetail') . '

-
-
'; + + + $thematicItemOne = ' +
+
+
' . $subTitle1 . '
+

' . Display::returnFontAwesomeIcon('book') . $thematic_info['title'] . '

+

' . Display::returnFontAwesomeIcon('calendar-o') . $thematic_advance_info['start_date'] . '

+
' . Display::returnFontAwesomeIcon('file-text-o') . strip_tags($thematic_advance_info['content']). '
+

'. Display::returnFontAwesomeIcon('clock-o') . get_lang('DurationInHours') . ' : ' . $thematic_advance_info['duration'] . ' - ' . get_lang('SeeDetail') . '

+
+
'; if (!empty($thematic_advance_info2)) { $thematic_info2 = $thematic->get_thematic_list($thematic_advance_info2['thematic_id']); @@ -280,15 +281,15 @@ if ($tool == TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) {
'.$subTitle2.'
-

'. Display::returnFontAswesomeIcon('book') . $thematic_info2['title'].'

-

' . Display::returnFontAswesomeIcon('calendar-o') .$thematic_advance_info2['start_date'].'

-
' . Display::returnFontAswesomeIcon('file-text-o') . strip_tags($thematic_advance_info2['content']).'
-

'. Display::returnFontAswesomeIcon('clock-o') .get_lang('DurationInHours').' : '.$thematic_advance_info2['duration'].' - '.get_lang('SeeDetail').'

+

'. Display::returnFontAwesomeIcon('book') . $thematic_info2['title'].'

+

' . Display::returnFontAwesomeIcon('calendar-o') .$thematic_advance_info2['start_date'].'

+
' . Display::returnFontAwesomeIcon('file-text-o') . strip_tags($thematic_advance_info2['content']).'
+

'. Display::returnFontAwesomeIcon('clock-o') .get_lang('DurationInHours').' : '.$thematic_advance_info2['duration'].' - '.get_lang('SeeDetail').'

'; } - - + + $thematicPanel = '
'; $thematicPanel .= '
' . $infoUser . '
'; $thematicPanel .= '
' . $thematicItemOne . $thematicItemTwo . '
'; diff --git a/main/inc/lib/course.lib.php b/main/inc/lib/course.lib.php index 9f620043f8..9798000bd4 100755 --- a/main/inc/lib/course.lib.php +++ b/main/inc/lib/course.lib.php @@ -4600,7 +4600,7 @@ class CourseManager //Course visibility if ($access_link && in_array('register', $access_link)) { $my_course['extra_info']['register_button'] = Display::url( - Display::returnFontAswesomeIcon('sign-in'), + 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'))); } @@ -4609,14 +4609,14 @@ class CourseManager $access_link) || $course_info['visibility'] == COURSE_VISIBILITY_OPEN_WORLD ) { $my_course['extra_info']['go_to_course_button'] = Display::url( - Display::returnFontAswesomeIcon('share'), + 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::returnFontAswesomeIcon('sign-out'), + 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'))); } @@ -4627,13 +4627,13 @@ class CourseManager $my_course_code_list) ) { */ $my_course['extra_info']['description_button'] = Display::url( - Display::returnFontAswesomeIcon('info-circle'), + 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') */ diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index a516a91309..f10bc3f776 100755 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.php @@ -1881,6 +1881,7 @@ class Display * Prints a tooltip * @param string $text * @param string $tip + * * @return string */ public static function tip($text, $tip) @@ -2071,15 +2072,16 @@ class Display return $editProfileUrl; } - + /** * Get the vCard for a user * @param int $userId The user id - * @return *.*vcf file + * @return string *.*vcf file */ public static function getVCardUserLink($userId) - { + { $vCardUrl = api_get_path(WEB_PATH).'main/social/vcard_export.php?userId='.intval($userId);; + return $vCardUrl; } @@ -2128,8 +2130,13 @@ class Display * @param array $attributes The additional attributes * @return string The button HTML */ - public static function toolbarButton($text, $url, $icon = 'check', $type = 'default', array $attributes = []) - { + public static function toolbarButton( + $text, + $url, + $icon = 'check', + $type = 'default', + array $attributes = [] + ) { $buttonClass = "btn btn-$type"; $icon = self::tag('i', null, ['class' => "fa fa-$icon"]); $attributes['class'] = isset($attributes['class']) ? "$buttonClass {$attributes['class']}" : $buttonClass; @@ -2179,17 +2186,17 @@ class Display * Get a HTML code for a icon by Font Awesome * @param string $name The icon name * @param boolean $fixWidth Optional. Whether add the fw class - * @param int|string $size Optional. The size for the icon. - * @param string $aditionalClass Optional. Additional class + * @param int|string $size Optional. The size for the icon. + * @param string $additionalClass Optional. Additional class + * * @return string */ - public static function returnFontAswesomeIcon( + public static function returnFontAwesomeIcon( $name, $fixWidth = false, $size = null, - $aditionalClass = null - ) - { + $additionalClass = null + ) { $className = "fa fa-$name"; if ($fixWidth) { @@ -2211,24 +2218,44 @@ class Display break; } - if (!empty($aditionalClass)) { - $className .= " $aditionalClass"; + if (!empty($additionalClass)) { + $className .= " $additionalClass"; } $icon = self::tag('em', null, ['class' => $className]); return "$icon "; } - public static function panelCollapse($title, $content, $id = null, $params = null, $idAccordion = null, $idCollpase = null, $open = true, $arrow = false) - { + + /** + * @param string $title + * @param string $content + * @param null $id + * @param array $params + * @param null $idAccordion + * @param null $idCollapse + * @param bool|true $open + * @param bool|false $arrow + * @return null|string + */ + public static function panelCollapse( + $title, + $content, + $id = null, + $params = array(), + $idAccordion = null, + $idCollapse = null, + $open = true, + $arrow = false + ) { if (!empty($idAccordion)) { $html = null; $html .= '
' . PHP_EOL; $html .= '
' . PHP_EOL; $html .= '' . PHP_EOL; - $html .= '
' . PHP_EOL; + $html .= '
' . PHP_EOL; $html .= '
'.$content.'
' . PHP_EOL; $html .= '
' . PHP_EOL; diff --git a/main/inc/lib/javascript/chat/video.php b/main/inc/lib/javascript/chat/video.php index 42384c2516..16e33827c0 100644 --- a/main/inc/lib/javascript/chat/video.php +++ b/main/inc/lib/javascript/chat/video.php @@ -45,7 +45,7 @@ $template->assign('block_friends', $friend_html); $content = $template->fetch('default/chat/video.tpl'); -$templateHeader = Display::returnFontAswesomeIcon('video-camera', true, 'lg') +$templateHeader = Display::returnFontAwesomeIcon('video-camera', true, 'lg') . $chatVideo->getRoomName(); $template->assign('header', $templateHeader); diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index d08877f455..ebd2516c8e 100755 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -1899,7 +1899,7 @@ class learnpath $this->index = count($this->ordered_items) - 1; return $this->ordered_items[$this->index]; } - + return false; } @@ -3115,7 +3115,7 @@ class learnpath } //$html = '
'.Security::remove_XSS($this->get_name()) . '
'; $html = '
'; - + $html .= '
'; require_once 'resourcelinker.inc.php'; @@ -3212,18 +3212,18 @@ class learnpath $html .= "
"; return $html; } - + /** * 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) { $gradebook = ''; if (!empty($_GET['gradebook'])) { @@ -3232,15 +3232,18 @@ class learnpath if ($this->get_lp_session_id() == api_get_session_id()) { $html .= ''; } } return $html; - + } /** * Gets the learnpath maker name - generally the editor's name diff --git a/main/template/default/auth/courses_categories.php b/main/template/default/auth/courses_categories.php index e8f7406cd4..ae8cdc2ee0 100755 --- a/main/template/default/auth/courses_categories.php +++ b/main/template/default/auth/courses_categories.php @@ -229,12 +229,12 @@ if ($showCourses && $action != 'display_sessions') { $html .= '
'; $html .= '
'; // if user registered as student - + $html .= return_description_button($course, $icon_title); - + if ($user_registerd_in_course_as_student) { $html .= return_already_registered_label('student'); - + if (!$course_closed) { if ($course_unsubscribe_allowed) { $html .= return_unregister_button($course, $stok, $search_term, $code); @@ -248,7 +248,7 @@ if ($showCourses && $action != 'display_sessions') { $html .= return_unregister_button($course, $stok, $search_term, $code); } $html .= return_already_registered_label('teacher'); - + } else { // if user not registered in the course if (!$course_closed) { @@ -259,7 +259,7 @@ if ($showCourses && $action != 'display_sessions') { } } } - + } $html .= '
'; $html .= '
'; @@ -345,7 +345,8 @@ function return_description_button($course, $icon_title) $title = $course['title']; $html = ''; if (api_get_setting('show_courses_descriptions_in_catalog') == 'true') { - $html = '' . Display::returnFontAswesomeIcon('info-circle') . ''; + $html = '' . + Display::returnFontAwesomeIcon('info-circle') . ''; } return $html; @@ -357,7 +358,8 @@ function return_description_button($course, $icon_title) */ function return_goto_button($course) { - $html = ' '.Display::returnFontAswesomeIcon('share').''; + $html = ' '. + Display::returnFontAwesomeIcon('share').''; return $html; } @@ -372,7 +374,11 @@ function return_already_registered_label($in_status) if ($in_status == 'student') { $icon = Display::return_icon('user.png', get_lang('Student'), null, ICON_SIZE_TINY); } - $html = Display::tag('button',$icon, array('id' => 'register', 'class' => 'btn btn-default btn-sm', 'title' => get_lang("AlreadyRegisteredToCourse"))); + $html = Display::tag( + 'button', + $icon, + array('id' => 'register', 'class' => 'btn btn-default btn-sm', 'title' => get_lang("AlreadyRegisteredToCourse")) + ); return $html; } @@ -386,7 +392,8 @@ function return_already_registered_label($in_status) */ function return_register_button($course, $stok, $code, $search_term) { - $html = ' ' . Display::returnFontAswesomeIcon('sign-in') . ''; + $html = ' ' . + Display::returnFontAwesomeIcon('sign-in') . ''; return $html; } @@ -399,6 +406,7 @@ function return_register_button($course, $stok, $code, $search_term) */ function return_unregister_button($course, $stok, $search_term, $code) { - $html = ' ' . Display::returnFontAswesomeIcon('sign-out') . ''; + $html = ' ' . + Display::returnFontAwesomeIcon('sign-out') . ''; return $html; } diff --git a/main/tracking/courseLog.php b/main/tracking/courseLog.php index 4bbce5dd13..f1c6afe5f3 100755 --- a/main/tracking/courseLog.php +++ b/main/tracking/courseLog.php @@ -270,7 +270,7 @@ $course_name = get_lang('Course').' '.$courseInfo['name']; if ($session_id) { $titleSession = Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.api_get_session_name($session_id); $titleCourse = Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$course_name; - + } else { $titleSession = Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$courseInfo['name']; } @@ -280,7 +280,7 @@ $teacherList = CourseManager::get_teacher_list_from_course_code_to_string( $courseInfo['code'], ',', false, - true + true ); $coaches = null; @@ -290,7 +290,7 @@ if (!empty($session_id)) { $courseInfo['real_id'], ',', false, - true + true ); } $html = ''; @@ -345,7 +345,7 @@ if (count($a_students) > 0) { ); $el = $form->addSelect( 'since', - Display::returnFontAswesomeIcon('warning') . get_lang('RemindInactivesLearnersSince'), + Display::returnFontAwesomeIcon('warning') . get_lang('RemindInactivesLearnersSince'), $options, ['class' => 'col-sm-3'] );