Minor - flint fixes

pull/2818/head
Julio Montoya 7 years ago
parent 53253908e3
commit 5e3679d495
  1. 2
      main/admin/index.php
  2. 4
      main/admin/system_announcements.php
  3. 4
      main/auth/courses.php
  4. 226
      main/auth/courses_categories.php
  5. 4
      main/auth/courses_list.php
  6. 1
      main/course_description/course_description_controller.php
  7. 2
      main/course_info/about.php
  8. 2
      main/document/document_slideshow.inc.php
  9. 2
      main/dropbox/dropbox_functions.inc.php
  10. 12
      main/dropbox/index.php
  11. 2
      main/exercise/MultipleAnswerTrueFalseDegreeCertainty.php
  12. 26
      main/exercise/ReadingComprehension.php
  13. 2
      main/exercise/TestCategory.php
  14. 44
      main/exercise/question.class.php
  15. 4
      main/gradebook/lib/be/category.class.php
  16. 2
      main/gradebook/lib/be/exerciselink.class.php
  17. 2
      main/gradebook/lib/fe/gradebooktable.class.php
  18. 4
      main/gradebook/lib/fe/linkform.class.php
  19. 2
      main/gradebook/lib/fe/resulttable.class.php
  20. 2
      main/gradebook/lib/gradebook_data_generator.class.php
  21. 3
      main/inc/lib/CoursesAndSessionsCatalog.class.php
  22. 2
      main/inc/lib/MoodleImport.php
  23. 4
      main/inc/lib/api.lib.php
  24. 6
      main/inc/lib/blog.lib.php
  25. 19
      main/inc/lib/course.lib.php
  26. 2
      main/inc/lib/course_category.lib.php
  27. 47
      main/inc/lib/display.lib.php
  28. 8
      main/inc/lib/document.lib.php
  29. 2
      main/inc/lib/extra_field_option.lib.php
  30. 29
      main/inc/lib/link.lib.php
  31. 2
      main/inc/lib/plugin.lib.php
  32. 6
      main/inc/lib/social.lib.php
  33. 14
      main/inc/lib/system_announcements.lib.php
  34. 41
      main/inc/lib/usergroup.lib.php
  35. 287
      main/inc/lib/userportal.lib.php
  36. 2
      main/lp/learnpath.class.php
  37. 4
      main/lp/learnpathItem.class.php
  38. 2
      main/lp/lp_ajax_save_item.php
  39. 2
      main/mySpace/student.php
  40. 2
      main/mySpace/users.php
  41. 1
      main/social/group_view.php
  42. 4
      main/social/groups.php
  43. 6
      main/social/home.php
  44. 1
      main/ticket/ticket_details.php
  45. 2
      main/webservices/lp.php
  46. 18
      main/webservices/registration.soap.php
  47. 2
      main/work/work.lib.php
  48. 4
      plugin/advanced_subscription/src/HookAdvancedSubscription.php
  49. 2
      src/ApiBundle/GraphQL/Resolver/CourseResolver.php
  50. 5
      src/CoreBundle/Block/BreadcrumbBlockService.php
  51. 4
      src/CoreBundle/Component/Editor/CkEditor/Toolbar/TestMatching.php
  52. 2
      src/CoreBundle/Controller/EditorController.php
  53. 2
      src/CoreBundle/Controller/ResourceController.php
  54. 2
      src/CoreBundle/EventListener/LoginSuccessHandler.php
  55. 2
      src/CoreBundle/EventListener/LogoutSuccessHandler.php
  56. 2
      src/CoreBundle/Framework/PageController.php
  57. 6
      src/CoreBundle/Settings/AbstractSettingsSchema.php
  58. 6
      src/CourseBundle/Controller/Home/HomeController.php
  59. 14
      src/LtiBundle/Entity/ExternalTool.php
  60. 1
      src/UserBundle/Entity/User.php
  61. 2
      src/UserBundle/Repository/UserRepository.php
  62. 2
      src/UserBundle/Security/LoginFormAuthenticator.php
  63. 4
      user_portal.php

@ -689,7 +689,7 @@ if (api_is_platform_admin()) {
// The template contains the call to the AJAX version checker
$template = $tpl->get_template('admin/index.html.twig');
$content = $tpl->fetch($template);
$tpl->assign('content',$content);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
//$tpl->display($template);

@ -185,7 +185,6 @@ if ($action_todo) {
$allowed_picture_types
);
$image = '';
// Display announcements picture
$store_path = api_get_path(SYS_UPLOAD_PATH).'announcements'; // course path
@ -198,7 +197,6 @@ if ($action_todo) {
$form->addHtml($image);
$form->addElement('checkbox', 'delete_picture', null, get_lang('DeletePicture'));
}
} catch (Exception $e) {
} catch (HTML_QuickForm_Error $e) {
error_log($e);
@ -285,7 +283,6 @@ if ($action_todo) {
);
if ($announcement_id !== false) {
// ADD Picture
$picture = $_FILES['picture'];
if (!empty($picture['name'])) {
@ -325,7 +322,6 @@ if ($action_todo) {
$sendMail,
$sendMailTest
)) {
$deletePicture = isset($values['delete_picture']) ? $values['delete_picture'] : '';
if ($deletePicture) {

@ -220,8 +220,8 @@ switch ($action) {
if ($form->validate()) {
if (sha1($_POST['course_registration_code']) === $courseInfo['registration_code']) {
CourseManager::autoSubscribeToCourse($_POST['subscribe_user_with_password']);
header('Location: '.api_get_self());
exit;
header('Location: '.api_get_self());
exit;
} else {
Display::addFlash(Display::return_message(get_lang('CourseRegistrationCodeIncorrect')), 'warning');
header('Location: '.$action);

@ -75,25 +75,23 @@ $message = null;
<?php
if (!isset($_GET['hidden_links']) || intval($_GET['hidden_links']) != 1) {
$term = empty($_POST['search_term']) ? '': api_htmlentities($searchTerm);
$term = empty($_POST['search_term']) ? '' : api_htmlentities($searchTerm);
$urlAction = CourseCategory::getCourseCategoryUrl(1, $pageLength, 'ALL', 0, 'subscribe');
$formSearch = new FormValidator('search_catalog', 'post', $urlAction, null, [], FormValidator::LAYOUT_BOX_SEARCH);
$formSearch->addHidden('sec_token', $stok);
$formSearch->addHidden('search_course', 1);
$formSearch->addText('search_term', get_lang('Search'), false,['value'=>$term, 'icon' => 'search'])->setButton(true);
$formSearch->addText('search_term', get_lang('Search'), false, ['value' => $term, 'icon' => 'search'])->setButton(true);
//$formSearch->defaultRenderer()->setElementTemplate($formSearch->getDefaultElementTemplate(),'search_term');
$search = $formSearch->returnForm();
$webAction = api_get_path(WEB_CODE_PATH).'auth/courses.php';
$formSelect = new FormValidator('select_category', 'get',$webAction,null,[]);
$formSelect->addHidden('action',$action);
$formSelect->addHidden('pageCurrent',$pageCurrent);
$formSelect = new FormValidator('select_category', 'get', $webAction, null, []);
$formSelect->addHidden('action', $action);
$formSelect->addHidden('pageCurrent', $pageCurrent);
$formSelect->addHidden('pageLength', $pageLength);
$options = [];
foreach ($browse_course_categories[0] as $category){
foreach ($browse_course_categories[0] as $category) {
$categoryCode = $category['code'];
$countCourse = $category['count_courses'];
if (empty($countCourse)) {
@ -101,96 +99,91 @@ $message = null;
}
$options[$categoryCode] = $category['name'].' ('.$countCourse.')';
}
if(empty($codeType)){
if (empty($codeType)) {
$codeType = 'ALL';
}
$formSelect->addSelect('category_code',get_lang('Categories'),$options,['onchange' =>'submit();'])->setSelected($codeType);
$formSelect->addSelect('category_code', get_lang('Categories'), $options, ['onchange' => 'submit();'])->setSelected($codeType);
$select = $formSelect->returnForm();
}
if ($showCourses && $action != 'display_sessions') {
if (!empty($message)) {
$message = Display::return_message($message, 'confirmation', false);
}
if (!empty($error)) {
$message = Display::return_message($error, 'error', false);
}
if (!empty($message)) {
$message = Display::return_message($message, 'confirmation', false);
}
if (!empty($error)) {
$message = Display::return_message($error, 'error', false);
}
if (!empty($content)) {
$message = $content;
}
if (!empty($content)) {
$message = $content;
}
if (!empty($searchTerm)) {
$message = "<p><strong>".get_lang('SearchResultsFor')." ".$searchTerm."</strong><br />";
}
if (!empty($searchTerm)) {
$message = "<p><strong>".get_lang('SearchResultsFor')." ".$searchTerm."</strong><br />";
}
$showTeacher = api_get_setting('display_teacher_in_courselist') === 'true';
$ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote';
$user_id = api_get_user_id();
$categoryListFromDatabase = CourseCategory::getCategories();
$showTeacher = api_get_setting('display_teacher_in_courselist') === 'true';
$ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote';
$user_id = api_get_user_id();
$categoryListFromDatabase = CourseCategory::getCategories();
$courseList = [];
$categoryList = [];
if (!empty($categoryListFromDatabase)) {
foreach ($categoryListFromDatabase as $categoryItem) {
$categoryList[$categoryItem['code']] = $categoryItem['name'];
}
$courseList = [];
$categoryList = [];
if (!empty($categoryListFromDatabase)) {
foreach ($categoryListFromDatabase as $categoryItem) {
$categoryList[$categoryItem['code']] = $categoryItem['name'];
}
}
if (!empty($browse_courses_in_category)) {
foreach ($browse_courses_in_category as $course) {
$course_hidden = $course['visibility'] == COURSE_VISIBILITY_HIDDEN;
if ($course_hidden) {
continue;
}
if (!empty($browse_courses_in_category)) {
foreach ($browse_courses_in_category as $course) {
$course_hidden = $course['visibility'] == COURSE_VISIBILITY_HIDDEN;
$userRegisteredInCourse = CourseManager::is_user_subscribed_in_course($user_id, $course['code']);
$userRegisteredInCourseAsTeacher = CourseManager::is_course_teacher($user_id, $course['code']);
$userRegistered = $userRegisteredInCourse && $userRegisteredInCourseAsTeacher;
if ($course_hidden) {
continue;
}
$course_public = $course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD;
$course_open = $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM;
$course_private = $course['visibility'] == COURSE_VISIBILITY_REGISTERED;
$course_closed = $course['visibility'] == COURSE_VISIBILITY_CLOSED;
$userRegisteredInCourse = CourseManager::is_user_subscribed_in_course($user_id, $course['code']);
$userRegisteredInCourseAsTeacher = CourseManager::is_course_teacher($user_id, $course['code']);
$userRegistered = $userRegisteredInCourse && $userRegisteredInCourseAsTeacher;
$course_subscribe_allowed = $course['subscribe'] == 1;
$course_unsubscribe_allowed = $course['unsubscribe'] == 1;
$count_connections = $course['count_connections'];
$creation_date = substr($course['creation_date'], 0, 10);
$course_public = $course['visibility'] == COURSE_VISIBILITY_OPEN_WORLD;
$course_open = $course['visibility'] == COURSE_VISIBILITY_OPEN_PLATFORM;
$course_private = $course['visibility'] == COURSE_VISIBILITY_REGISTERED;
$course_closed = $course['visibility'] == COURSE_VISIBILITY_CLOSED;
// display the course bloc
$course_subscribe_allowed = $course['subscribe'] == 1;
$course_unsubscribe_allowed = $course['unsubscribe'] == 1;
$count_connections = $course['count_connections'];
$creation_date = substr($course['creation_date'], 0, 10);
// display the course bloc
$course['category_title'] = '';
if (isset($course['category'])) {
$course['category_title'] = isset($categoryList[$course['category']]) ? $categoryList[$course['category']] : '';
}
$course['category_title'] = '';
if (isset($course['category'])) {
$course['category_title'] = isset($categoryList[$course['category']]) ? $categoryList[$course['category']] : '';
}
if (api_get_configuration_value('hide_course_rating') === false) {
$ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote';
$rating = Display::return_rating_system(
if (api_get_configuration_value('hide_course_rating') === false) {
$ajax_url = api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=add_course_vote';
$rating = Display::return_rating_system(
'star_'.$course['real_id'],
$ajax_url.'&course_id='.$course['real_id'],
$course['point_info']
);
}
}
//course return image
//course return image
$course_path = api_get_path(SYS_COURSE_PATH).$course['directory'];
$course_path = api_get_path(SYS_COURSE_PATH).$course['directory'];
if (file_exists($course_path.'/course-pic.png')) {
$courseMediumImage = api_get_path(WEB_COURSE_PATH).$course['directory'].'/course-pic.png';
} else {
// without picture
$courseMediumImage = Display::return_icon(
if (file_exists($course_path.'/course-pic.png')) {
$courseMediumImage = api_get_path(WEB_COURSE_PATH).$course['directory'].'/course-pic.png';
} else {
// without picture
$courseMediumImage = Display::return_icon(
'session_default.png',
null,
null,
@ -198,61 +191,61 @@ if ($showCourses && $action != 'display_sessions') {
null,
true
);
}
}
if ($showTeacher) {
$teachers = CourseManager::getTeachersFromCourse($course['real_id']);
}
if ($showTeacher) {
$teachers = CourseManager::getTeachersFromCourse($course['real_id']);
}
$separator = null;
$subscribeBuy = return_register_button($course, $stok, $code, $searchTerm);
// Start buy course validation
$separator = null;
$subscribeBuy = return_register_button($course, $stok, $code, $searchTerm);
// Start buy course validation
// display the course price and buy button if the buycourses plugin is enabled and this course is configured
$plugin = BuyCoursesPlugin::create();
$isThisCourseInSale = $plugin->buyCoursesForGridCatalogValidator(
// display the course price and buy button if the buycourses plugin is enabled and this course is configured
$plugin = BuyCoursesPlugin::create();
$isThisCourseInSale = $plugin->buyCoursesForGridCatalogValidator(
$course['real_id'],
BuyCoursesPlugin::PRODUCT_TYPE_COURSE
);
if ($isThisCourseInSale) {
// set the Price label
$separator = $isThisCourseInSale['html'];
// set the Buy button instead register.
if ($isThisCourseInSale['verificator']) {
$subscribeBuy = $plugin->returnBuyCourseButton(
if ($isThisCourseInSale) {
// set the Price label
$separator = $isThisCourseInSale['html'];
// set the Buy button instead register.
if ($isThisCourseInSale['verificator']) {
$subscribeBuy = $plugin->returnBuyCourseButton(
$course['real_id'],
BuyCoursesPlugin::PRODUCT_TYPE_COURSE
);
}
}
// end buy course validation
// if user registered as student
if ($userRegisteredInCourse) {
$subscribeButton = return_already_registered_label('student');
if (!$course_closed) {
if ($course_unsubscribe_allowed) {
$subscribeButton = return_unregister_button($course, $stok, $searchTerm, $code);
}
}
} elseif ($userRegisteredInCourseAsTeacher) {
// if user registered as teacher
}
// end buy course validation
// if user registered as student
if ($userRegisteredInCourse) {
$subscribeButton = return_already_registered_label('student');
if (!$course_closed) {
if ($course_unsubscribe_allowed) {
$subscribeButton = return_unregister_button($course, $stok, $searchTerm, $code);
}
} else {
// if user not registered in the course
if (!$course_closed) {
if (!$course_private) {
if ($course_subscribe_allowed) {
$subscribeButton = $subscribeBuy;
}
}
} elseif ($userRegisteredInCourseAsTeacher) {
// if user registered as teacher
if ($course_unsubscribe_allowed) {
$subscribeButton = return_unregister_button($course, $stok, $searchTerm, $code);
}
} else {
// if user not registered in the course
if (!$course_closed) {
if (!$course_private) {
if ($course_subscribe_allowed) {
$subscribeButton = $subscribeBuy;
}
}
}
}
$courseList[] = [
$courseList[] = [
'id' => $course['real_id'],
'title' => $course['title'],
'category' => $course['category_title'],
@ -261,23 +254,20 @@ if ($showCourses && $action != 'display_sessions') {
'teachers' => $teachers,
'ranking' => $rating,
'description_ajax' => CourseManager::returnDescriptionButton($course),
'subscribe' => $subscribeButton
'subscribe' => $subscribeButton,
];
}
} else {
if (!isset($_REQUEST['subscribe_user_with_password']) &&
}
} else {
if (!isset($_REQUEST['subscribe_user_with_password']) &&
!isset($_REQUEST['subscribe_course'])
) {
$message = Display::return_message(
$message = Display::return_message(
get_lang('ThereAreNoCoursesInThisCategory'),
'warning'
);
}
}
}
}
$template = new Template(get_lang('Course Catalog'));
$template->assign('search', $search);
@ -290,10 +280,6 @@ $content = $template->fetch($layout);
echo $content;
/**
* Display the goto course button of a course in the course catalog.
*

@ -24,8 +24,8 @@ if ($action != 'createcoursecategory') {
echo '</div>';
if (!empty($message)) {
echo Display::return_message($message, 'confirm', false);
}
echo Display::return_message($message, 'confirm', false);
}
$allowCollapsable = api_get_configuration_value('allow_user_course_category_collapsable');

@ -124,7 +124,6 @@ class CourseDescriptionController
$content = $tpl->fetch($templateName);
$tpl->assign('content', $content);
$tpl->display_one_col_template();
}

@ -139,8 +139,6 @@ if ($checker) {
);
}
$courseItem = [
'code' => $course->getCode(),
'title' => $course->getTitle(),

@ -1,8 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
/**
* This is a plugin for the documents tool. It looks for .jpg, .jpeg, .gif, .png
* files (since these are the files that can be viewed in a browser) and creates

@ -862,7 +862,7 @@ function removeMoreIfMailing($file_id)
* @param array $file
* @param Dropbox_SentWork $work
*
* @return array|null|string
* @return array|string|null
*/
function store_add_dropbox($file = [], $work = null)
{

@ -317,21 +317,19 @@ if ($action != 'add') {
<?php
$activeSend = $activeReceived = '';
if (!$view || $view == 'sent') {
$activeSend = 'active';
}
?>
$activeSend = 'active';
} ?>
<li class="nav-item">
<a class="nav-link <?php echo $activeSend ?>" href="<?php echo api_get_path(WEB_CODE_PATH).'dropbox/'; ?>index.php?<?php echo api_get_cidreq(); ?>&view=sent" >
<a class="nav-link <?php echo $activeSend; ?>" href="<?php echo api_get_path(WEB_CODE_PATH).'dropbox/'; ?>index.php?<?php echo api_get_cidreq(); ?>&view=sent" >
<?php echo get_lang('SentFiles'); ?>
</a>
</li>
<?php
if ($view == 'received') {
$activeReceived = 'active';
}
?>
} ?>
<li class="nav-item">
<a class="nav-link <?php echo $activeReceived ?>" href="<?php echo api_get_path(WEB_CODE_PATH).'dropbox/'; ?>index.php?<?php echo api_get_cidreq(); ?>&view=received" >
<a class="nav-link <?php echo $activeReceived; ?>" href="<?php echo api_get_path(WEB_CODE_PATH).'dropbox/'; ?>index.php?<?php echo api_get_cidreq(); ?>&view=received" >
<?php echo get_lang('ReceivedFiles'); ?>
</a>
</li>

@ -304,7 +304,7 @@ class MultipleAnswerTrueFalseDegreeCertainty extends Question
* @param int $counter
* @param float $score
*
* @return null|string
* @return string|null
*/
public function return_header($exercise, $counter = null, $score = null)
{

@ -53,7 +53,7 @@ class ReadingComprehension extends UniqueAnswer
/**
* Indicates how show the question list.
* 1 = all in one page; 2 = one per page (default)
* 1 = all in one page; 2 = one per page (default).
*
* @var int
*/
@ -197,6 +197,18 @@ class ReadingComprehension extends UniqueAnswer
return $select_level;
}
/**
* @param int $type
*
* @return ReadingComprehension
*/
public function setExerciseType($type)
{
$this->exerciseType = (int) $type;
return $this;
}
/**
* @param $wordsCount
* @param $turns
@ -216,16 +228,4 @@ class ReadingComprehension extends UniqueAnswer
$view->assign('exercise_type', $this->exerciseType);
$view->display($template);
}
/**
* @param int $type
*
* @return ReadingComprehension
*/
public function setExerciseType($type)
{
$this->exerciseType = (int) $type;
return $this;
}
}

@ -648,7 +648,7 @@ class TestCategory
* @param int $questionId
* @param int $in_display_category_name
*
* @return null|string
* @return string|null
*/
public static function returnCategoryAndTitle($questionId, $in_display_category_name = 1)
{

@ -2309,6 +2309,28 @@ abstract class Question
return '<br />'.Display::return_message($this->feedback, 'normal', false);
}
/**
* Check if this question exists in another exercise.
*
* @throws \Doctrine\ORM\Query\QueryException
*
* @return mixed
*/
public function existsInAnotherExercises()
{
$em = Database::getManager();
$count = $em
->createQuery('
SELECT COUNT(qq.iid) FROM ChamiloCourseBundle:CQuizRelQuestion qq
WHERE qq.questionId = :id
')
->setParameters(['id' => (int) $this->id])
->getSingleScalarResult();
return $count > 1;
}
/**
* Resizes a picture || Warning!: can only be called after uploadPicture,
* or if picture is already available in object.
@ -2373,26 +2395,4 @@ abstract class Question
return false;
}
/**
* Check if this question exists in another exercise.
*
* @throws \Doctrine\ORM\Query\QueryException
*
* @return mixed
*/
public function existsInAnotherExercises()
{
$em = Database::getManager();
$count = $em
->createQuery('
SELECT COUNT(qq.iid) FROM ChamiloCourseBundle:CQuizRelQuestion qq
WHERE qq.questionId = :id
')
->setParameters(['id' => (int) $this->id])
->getSingleScalarResult();
return $count > 1;
}
}

@ -298,7 +298,7 @@ class Category implements GradebookItem
}
/**
* @return null|int
* @return int|null
*/
public function get_grade_model_id()
{
@ -2709,7 +2709,7 @@ class Category implements GradebookItem
* Internal function used by get_tree().
*
* @param int $level
* @param null|int $visible
* @param int|null $visible
*
* @return array
*/

@ -334,7 +334,7 @@ class ExerciseLink extends AbstractLink
$result = [0, $weight];
if ($cacheAvailable) {
$cacheDriver->save($key, $result);
}
}
return $result;
}

@ -1164,7 +1164,7 @@ class GradebookTable extends SortableTable
/**
* @param AbstractLink $item
*
* @return null|string
* @return string|null
*/
private function build_edit_column($item)
{

@ -140,9 +140,9 @@ class LinkForm extends FormValidator
/**
* @param int $link
* @param null|string $courseCode
* @param string|null $courseCode
*
* @return AttendanceLink|DropboxLink|ExerciseLink|ForumThreadLink|LearnpathLink|null|StudentPublicationLink|SurveyLink
* @return AttendanceLink|DropboxLink|ExerciseLink|ForumThreadLink|LearnpathLink|StudentPublicationLink|SurveyLink|null
*/
private function createLink($link, $courseCode)
{

@ -22,7 +22,7 @@ class ResultTable extends SortableTable
*
* @param string $evaluation
* @param array $results
* @param null|string $iscourse
* @param string|null $iscourse
* @param array $addparams
* @param bool $forprint
*/

@ -448,7 +448,7 @@ class GradebookDataGenerator
* @param GradebookItem $item
* @param bool $ignore_score_color
*
* @return null|string
* @return string|null
*/
private function build_result_column(
$userId,

@ -469,8 +469,9 @@ class CoursesAndSessionsCatalog
* @param string $date (optional) The date of sessions
* @param array $limit
*
* @return array The session list
* @throws Exception
*
* @return array The session list
*/
public static function browseSessions($date = null, $limit = [])
{

@ -497,7 +497,7 @@ class MoodleImport
/**
* Search the current file resource in main Files XML.
*
* @param resource $filesXml XML file
* @param resource $filesXml XML file
* @param int $contextId
*
* @return mixed | array if is a valid xml file, false otherwise

@ -1738,7 +1738,7 @@ function api_get_user_entity($userId)
}
/**
* @return null|User
* @return User|null
*/
function api_get_current_user()
{
@ -7997,7 +7997,7 @@ function api_get_user_info_from_official_code($officialCode)
* @param string $usernameInputId
* @param string $passwordInputId
*
* @return null|string
* @return string|null
*/
function api_get_password_checker_js($usernameInputId, $passwordInputId)
{

@ -2879,7 +2879,7 @@ class Blog
'blog_admin.php?action=add'
);
$form->addElement('header', get_lang('AddBlog'));
$form->addText('blog_name',get_lang('Title'));
$form->addText('blog_name', get_lang('Title'));
$form->addHtmlEditor(
'blog_subtitle',
get_lang('SubTitle'),
@ -2888,7 +2888,7 @@ class Blog
[
'ToolbarSet' => 'Profile',
'Width' => '100%',
'Height' => '130'
'Height' => '130',
]
);
$form->addElement('hidden', 'new_blog_submit', 'true');
@ -3222,7 +3222,7 @@ class Blog
* @param string $fullText
* @param int $length
*
* @return null|string
* @return string|null
*/
private static function getPostExtract($fullText, $length = BLOG_MAX_PREVIEW_CHARS)
{

@ -655,7 +655,7 @@ class CourseManager
*
* @param int $userId
* @param string $courseCode
* @param int $status (STUDENT, COURSEMANAGER, COURSE_ADMIN, NORMAL_COURSE_MEMBER)
* @param int $status (STUDENT, COURSEMANAGER, COURSE_ADMIN, NORMAL_COURSE_MEMBER)
* @param int $sessionId
* @param int $userCourseCategoryId
* @param bool $checkTeacherPermission
@ -702,7 +702,7 @@ class CourseManager
$sessionId = empty($sessionId) ? api_get_session_id() : (int) $sessionId;
$status = $status === STUDENT || $status === COURSEMANAGER ? $status : STUDENT;
$courseUserTable = Database::get_main_table(TABLE_MAIN_COURSE_USER);
// The user has been already subscribed to the course.
// The user has been already subscribed to the course.
if (!empty($sessionId)) {
SessionManager::subscribe_users_to_session_course(
[$userId],
@ -819,8 +819,8 @@ class CourseManager
);
}
// Add event to the system log
Event::addEvent(
// Add event to the system log
Event::addEvent(
LOG_SUBSCRIBE_USER_TO_COURSE,
LOG_COURSE_CODE,
$courseCode,
@ -829,7 +829,7 @@ class CourseManager
$courseId
);
Event::addEvent(
Event::addEvent(
LOG_SUBSCRIBE_USER_TO_COURSE,
LOG_USER_OBJECT,
$userInfo,
@ -838,7 +838,7 @@ class CourseManager
$courseId
);
return true;
return true;
}
return false;
@ -3272,11 +3272,10 @@ class CourseManager
$data['extrafield'] = $fieldValues;
if (isset($descriptions) && count($descriptions) > 0) {
foreach ($descriptions as $description) {
if($description->description_type === '1'){
if ($description->description_type === '1') {
$data['description'] = [
'title' => Security::remove_XSS($description->title),
'content' => Security::remove_XSS($description->content)
'content' => Security::remove_XSS($description->content),
];
}
}
@ -6752,7 +6751,7 @@ class CourseManager
* @param Course $course
* @param bool $fullSize
*
* @return null|string
* @return string|null
*/
public static function getPicturePath(Course $course, $fullSize = false)
{

@ -409,7 +409,7 @@ class CourseCategory
/**
* @param string $categoryCode
*
* @return null|string
* @return string|null
*/
public static function getParentsToString($categoryCode)
{

@ -1244,7 +1244,7 @@ class Display
[
'id' => $id.'-'.$i,
'href' => $item['url'],
'class' => 'nav-link '.$class
'class' => 'nav-link '.$class,
]
);
$lis .= self::tag('li', $item, ['class' => 'nav-item']);
@ -1904,7 +1904,7 @@ class Display
/**
* @param array $list
*
* @return null|string
* @return string|null
*/
public static function description($list)
{
@ -1956,7 +1956,7 @@ class Display
* @param string $count
* @param string $type
*
* @return null|string
* @return string|null
*/
public static function badge($count, $type = "warning")
{
@ -2047,7 +2047,7 @@ class Display
* @param array $items
* @param string $class
*
* @return null|string
* @return string|null
*/
public static function actions($items, $class = 'new_actions')
{
@ -2141,7 +2141,7 @@ class Display
* @param string $file
* @param array $params
*
* @return null|string
* @return string|null
*/
public static function getMediaPlayer($file, $params = [])
{
@ -2453,7 +2453,7 @@ class Display
}
$cardBody = $title.' '.self::contentPanel($content).' '.$footer;
$panel = Display::tag('div',$cardBody,['id' => 'card-'.$id ,'class'=>'card-body']);
$panel = Display::tag('div', $cardBody, ['id' => 'card-'.$id, 'class' => 'card-body']);
return '
<div '.$id.' class="card">
@ -2497,7 +2497,7 @@ class Display
$includeText = true
) {
$buttonClass = "btn btn-outline-secondary";
if(!empty($type)){
if (!empty($type)) {
$buttonClass = "btn btn-$type";
}
$icon = self::tag('i', null, ['class' => "fa fa-$icon fa-fw", 'aria-hidden' => 'true']);
@ -2607,7 +2607,7 @@ class Display
* @param bool|true $open
* @param bool|false $fullClickable
*
* @return null|string
* @return string|null
*
* @todo rework function to easy use
*/
@ -2725,20 +2725,6 @@ HTML;
return $html;
}
/**
* Displays the reduced page header (without banner).
*/
private static function set_header()
{
global $show_learnpath, $tool_name;
self::$global_template = new Template(
$tool_name,
false,
false,
$show_learnpath
);
}
public static function randomColor($id)
{
static $colors = [];
@ -2758,13 +2744,26 @@ HTML;
}
$result = [
'color' => '#' . $color,
'luminosity' => $type
'color' => '#'.$color,
'luminosity' => $type,
];
$colors[$id] = $result;
return $result; // example: #fc443a
}
}
/**
* Displays the reduced page header (without banner).
*/
private static function set_header()
{
global $show_learnpath, $tool_name;
self::$global_template = new Template(
$tool_name,
false,
false,
$show_learnpath
);
}
}

@ -427,7 +427,7 @@ class DocumentManager
* @param string $path
* @param int $sessionId
*
* @return null|string
* @return string|null
*/
public static function getSessionFolderFilters($path, $sessionId)
{
@ -6676,7 +6676,7 @@ class DocumentManager
* @param string $target
* @param string $overwrite_url
*
* @return null|string
* @return string|null
*/
private static function parseFile(
$userInfo,
@ -6777,7 +6777,7 @@ class DocumentManager
* @param array $resource
* @param int $lp_id
*
* @return null|string
* @return string|null
*/
private static function parseFolder($folderId, $resource, $lp_id)
{
@ -6980,7 +6980,7 @@ class DocumentManager
* @param bool $isCertificateMode
* @param int $parentId
*
* @return null|string
* @return string|null
*/
private static function getButtonVisibility(
$isReadOnly,

@ -721,7 +721,7 @@ class ExtraFieldOption extends Model
/**
* @param $priority
*
* @return null|string
* @return string|null
*/
public function getPriorityMessageType($priority)
{

@ -1187,7 +1187,7 @@ class Link extends Model
'pencil-alt',
null,
[
'title' => get_lang('Modify')
'title' => get_lang('Modify'),
]);
// DISPLAY MOVE UP COMMAND only if it is not the top link.
@ -1199,10 +1199,9 @@ class Link extends Model
'level-up-alt',
'outline-secondary',
[
'title' => get_lang("Up")
'title' => get_lang("Up"),
]
);
} else {
$tools .= Display::toolbarButton(
null,
@ -1211,7 +1210,7 @@ class Link extends Model
'outline-secondary',
[
'title' => get_lang("Up"),
'class' => 'disabled'
'class' => 'disabled',
]
);
}
@ -1225,10 +1224,9 @@ class Link extends Model
'level-down-alt',
'outline-secondary',
[
'title' => get_lang("Down")
'title' => get_lang("Down"),
]
);
} else {
$tools .= Display::toolbarButton(
null,
@ -1237,7 +1235,7 @@ class Link extends Model
'outline-secondary',
[
'title' => get_lang("Down"),
'class' => 'disabled'
'class' => 'disabled',
]
);
}
@ -1249,12 +1247,10 @@ class Link extends Model
'outline-secondary',
[
'title' => get_lang("Delete"),
'onclick' => "javascript: if(!confirm('".get_lang('CategoryDelconfirm')."')) return false;"
'onclick' => "javascript: if(!confirm('".get_lang('CategoryDelconfirm')."')) return false;",
]
);
return $tools;
}
@ -1690,7 +1686,6 @@ class Link extends Model
echo '</div>';
$linksPerCategory = self::showLinksPerCategory(0, $course_id, $session_id);
if (empty($countCategories)) {
echo $linksPerCategory;
} else {
@ -1701,7 +1696,7 @@ class Link extends Model
$counter = 0;
$category = [];
$list=[];
$list = [];
foreach ($categories as $myrow) {
// Student don't see invisible categories.
if (!api_is_allowed_to_edit(null, true)) {
@ -1719,16 +1714,14 @@ class Link extends Model
$visibilityClass = null;
if ($myrow['visibility'] == '1') {
$url = 'link.php?'.api_get_cidreq().'&sec_token='.$token.'&action=invisible&id='.$myrow['id'].'&scope='.TOOL_LINK_CATEGORY;
$title = get_lang('Hide');
$strVisibility = Display::toolbarButton(null,$url,'eye',null,['title'=>$title]);
$strVisibility = Display::toolbarButton(null, $url, 'eye', null, ['title' => $title]);
} elseif ($myrow['visibility'] == '0') {
$visibilityClass = 'text-muted';
$url = 'link.php?'.api_get_cidreq().'&sec_token='.$token.'&action=visible&id='.$myrow['id'].'&scope='.TOOL_LINK_CATEGORY;
$title = get_lang('Show');
$strVisibility = Display::toolbarButton(null,$url,'eye-slash',null,['title'=>$title]);
$strVisibility = Display::toolbarButton(null, $url, 'eye-slash', null, ['title' => $title]);
}
$iconTree = '';
@ -1766,7 +1759,6 @@ class Link extends Model
}
$category['children'] = $childrenContent;
$list[] = $category;
}
$tpl = new Template(null);
$tpl->assign('data', $list);
@ -1774,7 +1766,6 @@ class Link extends Model
$content = $tpl->fetch($courseInfoLayout);
echo $content;
}
/**
@ -1928,7 +1919,7 @@ class Link extends Model
}
$form->addHidden('id', $id);
$form->addText('category_title', get_lang('CategoryName'));
$form->addHtmlEditor('description', get_lang('Description'),true,false, ['ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130']);
$form->addHtmlEditor('description', get_lang('Description'), true, false, ['ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130']);
$form->addButtonSave($my_cat_title, 'submitCategory');
$form->setDefaults($defaults);

@ -259,7 +259,7 @@ class AppPlugin
* @param Twig_Environment $template
* @param bool $forced
*
* @return null|string
* @return string|null
*/
public function loadRegion($pluginName, $region, $template, $forced = false)
{

@ -821,7 +821,7 @@ class SocialManager extends UserManager
'complete_name' => $userInfo['complete_name'],
'username' => $userInfo['username'],
'email' => $userInfo['email'],
'status' => $userInfo['status']
'status' => $userInfo['status'],
];
$show_groups = [
@ -856,13 +856,12 @@ class SocialManager extends UserManager
$groupInfo['picture'],
128,
GROUP_IMAGE_SIZE_MEDIUM
)
),
];
$template->assign('show_group', true);
$template->assign('group', $groupInfo);
$template->assign('avatar', $userGroupImage);
} else {
$template->assign('show_group', false);
$template->assign('show_user', true);
@ -1869,7 +1868,6 @@ class SocialManager extends UserManager
$userInfo = api_get_user_info($userId, true, false, true, true);
$userGroup = new UserGroup();
$groupInfo = $userGroup->get($groupId);

@ -307,7 +307,6 @@ class SystemAnnouncementManager
return $result ? $result : false;
}
/**
* @param int $start
* @param string $user_id
@ -1026,17 +1025,20 @@ class SystemAnnouncementManager
* get announcement picture.
*
* @param int $announcementId
* @return null|string
*
* @return string|null
*/
private static function getPictureAnnouncement($announcementId)
{
$store_path = api_get_path(SYS_UPLOAD_PATH) . 'announcements';
$announcementPicture = $store_path . '/announcement_' . $announcementId . '.png';
$store_path = api_get_path(SYS_UPLOAD_PATH).'announcements';
$announcementPicture = $store_path.'/announcement_'.$announcementId.'.png';
if (file_exists($announcementPicture)) {
$web_path = api_get_path(WEB_UPLOAD_PATH) . 'announcements';
$urlPicture = $web_path . '/announcement_' . $announcementId . '.png';
$web_path = api_get_path(WEB_UPLOAD_PATH).'announcements';
$urlPicture = $web_path.'/announcement_'.$announcementId.'.png';
return $urlPicture;
}
return null;
}
}

@ -1322,10 +1322,10 @@ class UserGroup extends Model
}
/**
* @param int $groupId
* @param int $groupId
* @param string $picture
*
* @param string $cropParameters
*
* @return bool|string
*/
public function manageFileUpload($groupId, $picture, $cropParameters)
@ -1357,18 +1357,17 @@ class UserGroup extends Model
* Note: This method relies on configuration setting from main/inc/conf/profile.conf.php.
*
* @param $group_id
* @param string $file The common file name for the newly created photos.
* It will be checked and modified for compatibility with the file system.
* If full name is provided, path component is ignored.
* If an empty name is provided, then old user photos are deleted only,
*
* @param string $source_file the full system name of the image from which user photos will be created
*
* @param string $file The common file name for the newly created photos.
* It will be checked and modified for compatibility with the file system.
* If full name is provided, path component is ignored.
* If an empty name is provided, then old user photos are deleted only,
* @param string $source_file the full system name of the image from which user photos will be created
* @param string $cropParameters
*
* @return mixed Returns the resulting common file name of created images which usually should be stored in database.
* When an image is removed the function returns an empty string. In case of internal error or negative validation it returns FALSE.
* @see UserManager::delete_user_picture() as the prefered way for deletion.
*
* @see UserManager::delete_user_picture() as the prefered way for deletion.
*/
public function update_group_picture($group_id, $file = null, $source_file = null, $cropParameters = null)
{
@ -1390,7 +1389,6 @@ class UserGroup extends Model
@mkdir($path, api_get_permissions_for_new_directories(), true);
}
// Exit if only deletion has been requested. Return an empty picture name.
if ($delete) {
return '';
@ -1427,7 +1425,6 @@ class UserGroup extends Model
$normal->resize(450);
$normal->send_image($groupImageBig, -1, 'jpg');
return $filename;
}
@ -1611,7 +1608,6 @@ class UserGroup extends Model
// Picture
//$allowed_picture_types = $this->getAllowedPictureExtensions();
// Picture
$form->addFile(
'picture',
@ -2117,8 +2113,8 @@ class UserGroup extends Model
$num = intval($num);
}
// only show admins and readers
$where_relation_condition = " WHERE g.group_type = " . self::SOCIAL_CLASS . " AND
gu.relation_type IN ('" . GROUP_USER_PERMISSION_ADMIN . "' , '" . GROUP_USER_PERMISSION_READER . "', '" . GROUP_USER_PERMISSION_HRM . "') ";
$where_relation_condition = " WHERE g.group_type = ".self::SOCIAL_CLASS." AND
gu.relation_type IN ('".GROUP_USER_PERMISSION_ADMIN."' , '".GROUP_USER_PERMISSION_READER."', '".GROUP_USER_PERMISSION_HRM."') ";
$sql = "SELECT DISTINCT count(user_id) as count, g.picture, g.name, g.description, g.id
FROM $tbl_group g
INNER JOIN $table_group_rel_user gu
@ -2133,7 +2129,7 @@ class UserGroup extends Model
$description = Security::remove_XSS($row['description'], STUDENT, true);
$row['description'] = cut($description, 250, true);
$row['name'] = Security::remove_XSS($row['name'], STUDENT, true);
$row['url'] = "group_view.php?id=" . $row['id'];
$row['url'] = "group_view.php?id=".$row['id'];
if ($with_image) {
$picture = self::get_picture_group(
$row['id'],
@ -2172,12 +2168,12 @@ class UserGroup extends Model
}
$where = " WHERE
g.group_type = " . self::SOCIAL_CLASS . " AND
g.group_type = ".self::SOCIAL_CLASS." AND
gu.relation_type IN
('" . GROUP_USER_PERMISSION_ADMIN . "' ,
'" . GROUP_USER_PERMISSION_READER . "',
'" . GROUP_USER_PERMISSION_MODERATOR . "',
'" . GROUP_USER_PERMISSION_HRM . "')
('".GROUP_USER_PERMISSION_ADMIN."' ,
'".GROUP_USER_PERMISSION_READER."',
'".GROUP_USER_PERMISSION_MODERATOR."',
'".GROUP_USER_PERMISSION_HRM."')
";
$sql = "SELECT DISTINCT
count(user_id) as count,
@ -2196,11 +2192,10 @@ class UserGroup extends Model
$result = Database::query($sql);
$array = [];
while ($row = Database::fetch_array($result, 'ASSOC')) {
$description = Security::remove_XSS($row['description'], STUDENT, true);
$row['description'] = cut($description, 250, true);
$row['name'] = Security::remove_XSS($row['name'], STUDENT, true);
$row['url'] = "group_view.php?id=" . $row['id'];
$row['url'] = "group_view.php?id=".$row['id'];
if ($with_image) {
$picture = self::get_picture_group(
$row['id'],

@ -1095,7 +1095,6 @@ class IndexManager
$useUserLanguageFilterIfAvailable
);
// Display courses.
$courses = CourseManager::returnCourses(
$user_id,
@ -1103,7 +1102,6 @@ class IndexManager
$useUserLanguageFilterIfAvailable
);
// Course option (show student progress)
// This code will add new variables (Progress, Score, Certificate)
if ($studentInfoProgress || $studentInfoScore || $studentInfoCertificate) {
@ -1218,7 +1216,6 @@ class IndexManager
$courseCount = count($courseCompleteList);
}
$listSessions = null;
/*$collapsable = api_get_configuration_value('allow_user_session_collapsable');
@ -1244,117 +1241,117 @@ class IndexManager
if (is_array($sessionCategories)) {
foreach ($sessionCategories as $session_category) {
// Independent sessions
foreach ($session_category['sessions'] as $session) {
$session_id = $session['session_id'];
// Don't show empty sessions.
if (count($session['courses']) < 1) {
continue;
}
// Independent sessions
foreach ($session_category['sessions'] as $session) {
$session_id = $session['session_id'];
// Courses inside the current session.
$date_session_start = $session['access_start_date'];
$date_session_end = $session['access_end_date'];
$coachAccessStartDate = $session['coach_access_start_date'];
$coachAccessEndDate = $session['coach_access_end_date'];
$count_courses_session = 0;
// Loop course content
$list_courses_session = [];
$atLeastOneCourseIsVisible = false;
$markAsOld = false;
$markAsFuture = false;
foreach ($session['courses'] as $course) {
$is_coach_course = api_is_coach($session_id, $course['real_id']);
$allowed_time = 0;
$allowedEndTime = true;
// Don't show empty sessions.
if (count($session['courses']) < 1) {
continue;
}
if (!empty($date_session_start)) {
if ($is_coach_course) {
$allowed_time = api_strtotime($coachAccessStartDate);
} else {
$allowed_time = api_strtotime($date_session_start);
}
// Courses inside the current session.
$date_session_start = $session['access_start_date'];
$date_session_end = $session['access_end_date'];
$coachAccessStartDate = $session['coach_access_start_date'];
$coachAccessEndDate = $session['coach_access_end_date'];
$count_courses_session = 0;
// Loop course content
$list_courses_session = [];
$atLeastOneCourseIsVisible = false;
$markAsOld = false;
$markAsFuture = false;
foreach ($session['courses'] as $course) {
$is_coach_course = api_is_coach($session_id, $course['real_id']);
$allowed_time = 0;
$allowedEndTime = true;
if (!empty($date_session_start)) {
if ($is_coach_course) {
$allowed_time = api_strtotime($coachAccessStartDate);
} else {
$allowed_time = api_strtotime($date_session_start);
}
$endSessionToTms = null;
if (!isset($_GET['history'])) {
if (!empty($date_session_end)) {
if ($is_coach_course) {
// if coach end date is empty we use the default end date
if (empty($coachAccessEndDate)) {
$endSessionToTms = api_strtotime($date_session_end);
if ($session_now > $endSessionToTms) {
$allowedEndTime = false;
}
} else {
$endSessionToTms = api_strtotime($coachAccessEndDate);
if ($session_now > $endSessionToTms) {
$allowedEndTime = false;
}
$endSessionToTms = null;
if (!isset($_GET['history'])) {
if (!empty($date_session_end)) {
if ($is_coach_course) {
// if coach end date is empty we use the default end date
if (empty($coachAccessEndDate)) {
$endSessionToTms = api_strtotime($date_session_end);
if ($session_now > $endSessionToTms) {
$allowedEndTime = false;
}
} else {
$endSessionToTms = api_strtotime($date_session_end);
$endSessionToTms = api_strtotime($coachAccessEndDate);
if ($session_now > $endSessionToTms) {
$allowedEndTime = false;
}
}
} else {
$endSessionToTms = api_strtotime($date_session_end);
if ($session_now > $endSessionToTms) {
$allowedEndTime = false;
}
}
}
}
}
if ($showAllSessions) {
if ($allowed_time < $session_now && $allowedEndTime === false) {
$markAsOld = true;
}
if ($allowed_time > $session_now && $endSessionToTms > $session_now) {
$markAsFuture = true;
}
$allowedEndTime = true;
$allowed_time = 0;
if ($showAllSessions) {
if ($allowed_time < $session_now && $allowedEndTime === false) {
$markAsOld = true;
}
if ($allowed_time > $session_now && $endSessionToTms > $session_now) {
$markAsFuture = true;
}
$allowedEndTime = true;
$allowed_time = 0;
}
if ($session_now >= $allowed_time && $allowedEndTime) {
// Read only and accessible.
$atLeastOneCourseIsVisible = true;
if (api_get_setting('hide_courses_in_sessions') === 'false') {
$courseUserHtml = CourseManager::get_logged_user_course_html(
if ($session_now >= $allowed_time && $allowedEndTime) {
// Read only and accessible.
$atLeastOneCourseIsVisible = true;
if (api_get_setting('hide_courses_in_sessions') === 'false') {
$courseUserHtml = CourseManager::get_logged_user_course_html(
$course,
$session_id,
'session_course_item',
true,
$this->load_directories_preview
);
if (isset($courseUserHtml[1])) {
$course_session = $courseUserHtml[1];
$course_session['skill'] = isset($courseUserHtml['skill']) ? $courseUserHtml['skill'] : '';
// Course option (show student progress)
// This code will add new variables (Progress, Score, Certificate)
if ($studentInfoProgress || $studentInfoScore || $studentInfoCertificate) {
if ($studentInfoProgress) {
$progress = Tracking::get_avg_student_progress(
if (isset($courseUserHtml[1])) {
$course_session = $courseUserHtml[1];
$course_session['skill'] = isset($courseUserHtml['skill']) ? $courseUserHtml['skill'] : '';
// Course option (show student progress)
// This code will add new variables (Progress, Score, Certificate)
if ($studentInfoProgress || $studentInfoScore || $studentInfoCertificate) {
if ($studentInfoProgress) {
$progress = Tracking::get_avg_student_progress(
$user_id,
$course['course_code'],
[],
$session_id
);
$course_session['student_info']['progress'] = $progress === false ? null : $progress;
}
$course_session['student_info']['progress'] = $progress === false ? null : $progress;
}
if ($studentInfoScore) {
$percentage_score = Tracking::get_avg_student_score(
if ($studentInfoScore) {
$percentage_score = Tracking::get_avg_student_score(
$user_id,
$course['course_code'],
[],
$session_id
);
$course_session['student_info']['score'] = $percentage_score;
}
$course_session['student_info']['score'] = $percentage_score;
}
if ($studentInfoCertificate) {
$category = Category::load(
if ($studentInfoCertificate) {
$category = Category::load(
null,
null,
$course['course_code'],
@ -1362,111 +1359,109 @@ class IndexManager
null,
$session_id
);
$course_session['student_info']['certificate'] = null;
if (isset($category[0])) {
if ($category[0]->is_certificate_available($user_id)) {
$course_session['student_info']['certificate'] = Display::label(
$course_session['student_info']['certificate'] = null;
if (isset($category[0])) {
if ($category[0]->is_certificate_available($user_id)) {
$course_session['student_info']['certificate'] = Display::label(
get_lang('Yes'),
'success'
);
} else {
$course_session['student_info']['certificate'] = Display::label(
} else {
$course_session['student_info']['certificate'] = Display::label(
get_lang('No')
);
}
}
}
}
$list_courses_session[] = $course_session;
}
$list_courses_session[] = $course_session;
}
$count_courses_session++;
}
$count_courses_session++;
}
}
// No courses to show.
if ($atLeastOneCourseIsVisible === false) {
if (empty($list_courses_session)) {
continue;
}
// No courses to show.
if ($atLeastOneCourseIsVisible === false) {
if (empty($list_courses_session)) {
continue;
}
}
if ($count_courses_session > 0) {
$params = [
if ($count_courses_session > 0) {
$params = [
'id' => $session_id,
];
$session_box = Display::getSessionTitleBox($session_id);
$coachId = $session_box['coach_id'];
$session_box = Display::getSessionTitleBox($session_id);
$coachId = $session_box['coach_id'];
$params['title'] = $session_box['title'];
$params['id_coach'] = $coachId;
$params['coach_url'] = api_get_path(WEB_AJAX_PATH).
$params['title'] = $session_box['title'];
$params['id_coach'] = $coachId;
$params['coach_url'] = api_get_path(WEB_AJAX_PATH).
'user_manager.ajax.php?a=get_user_popup&user_id='.$coachId;
$params['coach_name'] = !empty($session_box['coach']) ? $session_box['coach'] : null;
$params['coach_avatar'] = UserManager::getUserPicture(
$params['coach_name'] = !empty($session_box['coach']) ? $session_box['coach'] : null;
$params['coach_avatar'] = UserManager::getUserPicture(
$coachId,
USER_IMAGE_SIZE_SMALL
);
$params['date'] = $session_box['dates'];
$params['duration'] = isset($session_box['duration']) ? ' '.$session_box['duration'] : null;
$params['show_actions'] = SessionManager::cantEditSession($session_id);
/*
if ($collapsable) {
$collapsableData = Sessionmanager::getCollapsableData(
$user_id,
$session_id,
$extraFieldValue,
$collapsableLink
);
$params['collapsed'] = $collapsableData['collapsed'];
$params['collapsable_link'] = $collapsableData['collapsable_link'];
}*/
$params['image'] = $session_box['image'];
$params['url'] = $session_box['url'];
$params['show_description'] = $session_box['show_description'] == 1 && $portalShowDescription;
$params['description'] = $session_box['description'];
$params['visibility'] = $session_box['visibility'];
$params['show_simple_session_info'] = $showSimpleSessionInfo;
$params['course_list_session_style'] = $coursesListSessionStyle;
$params['num_users'] = $session_box['num_users'];
$params['num_courses'] = $session_box['num_courses'];
$params['course_categories'] = CourseManager::getCourseCategoriesFromCourseList(
$params['date'] = $session_box['dates'];
$params['duration'] = isset($session_box['duration']) ? ' '.$session_box['duration'] : null;
$params['show_actions'] = SessionManager::cantEditSession($session_id);
/*
if ($collapsable) {
$collapsableData = Sessionmanager::getCollapsableData(
$user_id,
$session_id,
$extraFieldValue,
$collapsableLink
);
$params['collapsed'] = $collapsableData['collapsed'];
$params['collapsable_link'] = $collapsableData['collapsable_link'];
}*/
$params['image'] = $session_box['image'];
$params['url'] = $session_box['url'];
$params['show_description'] = $session_box['show_description'] == 1 && $portalShowDescription;
$params['description'] = $session_box['description'];
$params['visibility'] = $session_box['visibility'];
$params['show_simple_session_info'] = $showSimpleSessionInfo;
$params['course_list_session_style'] = $coursesListSessionStyle;
$params['num_users'] = $session_box['num_users'];
$params['num_courses'] = $session_box['num_courses'];
$params['course_categories'] = CourseManager::getCourseCategoriesFromCourseList(
$list_courses_session
);
$params['courses'] = $list_courses_session;
$params['is_old'] = $markAsOld;
$params['is_future'] = $markAsFuture;
$params['category'] = $session_box['category'];
$params['color'] = Display::randomColor($session_box['category']['id']);
if ($showSimpleSessionInfo) {
$params['subtitle'] = self::getSimpleSessionDetails(
$params['courses'] = $list_courses_session;
$params['is_old'] = $markAsOld;
$params['is_future'] = $markAsFuture;
$params['category'] = $session_box['category'];
$params['color'] = Display::randomColor($session_box['category']['id']);
if ($showSimpleSessionInfo) {
$params['subtitle'] = self::getSimpleSessionDetails(
$session_box['coach_name'],
$session_box['dates'],
isset($session_box['duration']) ? $session_box['duration'] : null
);
}
}
if ($gameModeIsActive) {
$params['stars'] = GamificationUtils::getSessionStars(
if ($gameModeIsActive) {
$params['stars'] = GamificationUtils::getSessionStars(
$params['id'],
$this->user_id
);
$params['progress'] = GamificationUtils::getSessionProgress(
$params['progress'] = GamificationUtils::getSessionProgress(
$params['id'],
$this->user_id
);
$params['points'] = GamificationUtils::getSessionPoints(
$params['points'] = GamificationUtils::getSessionPoints(
$params['id'],
$this->user_id
);
}
$listSession[] = $params;
$sessionCount++;
}
$listSession[] = $params;
$sessionCount++;
}
}
}
$allCoursesInSessions = [];

@ -5,7 +5,6 @@ use Chamilo\CoreBundle\Repository\CourseRepository;
use Chamilo\CourseBundle\Component\CourseCopy\CourseArchiver;
use Chamilo\CourseBundle\Component\CourseCopy\CourseBuilder;
use Chamilo\CourseBundle\Component\CourseCopy\CourseRestorer;
use Chamilo\CourseBundle\Entity\CDocument;
use Chamilo\CourseBundle\Entity\CItemProperty;
use Chamilo\CourseBundle\Entity\CLp;
use Chamilo\CourseBundle\Entity\CLpCategory;
@ -10020,7 +10019,6 @@ class learnpath
if (in_array($item_type, [TOOL_DOCUMENT, TOOL_LP_FINAL_ITEM, TOOL_HOTPOTATOES])) {
$documentData = DocumentManager::get_document_data_by_id($row['path'], $course_code);
if (empty($documentData)) {
$table = Database::get_course_table(TABLE_DOCUMENT);
$sql = "SELECT path FROM $table
WHERE

@ -89,7 +89,7 @@ class learnpathItem
* @param int $id Learning path item ID
* @param int $user_id User ID
* @param int $course_id Course int id
* @param null|array $item_content An array with the contents of the item
* @param array|null $item_content An array with the contents of the item
*/
public function __construct(
$id,
@ -4276,7 +4276,7 @@ class learnpathItem
/**
* Adds an audio file attached to the current item (store on disk and in db).
*
* @return bool|null|string
* @return bool|string|null
*/
public function add_audio()
{

@ -38,7 +38,7 @@ require_once __DIR__.'/../inc/global.inc.php';
* @param int $userNavigatesAway Whether the user is moving to another item
* @param int $statusSignalReceived Whether the SCO called SetValue(lesson_status)
*
* @return bool|null|string The resulting JS string
* @return bool|string|null The resulting JS string
*/
function save_item(
$lp_id,

@ -268,7 +268,7 @@ if (api_is_drh()) {
'#'
);
$actions .= Display::url(
Display::return_icon('skills.png', get_lang('Skills'), array(), ICON_SIZE_MEDIUM),
Display::return_icon('skills.png', get_lang('Skills'), [], ICON_SIZE_MEDIUM),
$webCodePath.'social/my_skills_report.php'
);
$actionsLeft .= Display::url(

@ -242,7 +242,7 @@ if (api_is_drh()) {
'#'
);
$actions .= Display::url(
Display::return_icon('skills.png', get_lang('Skills'), array(), ICON_SIZE_MEDIUM),
Display::return_icon('skills.png', get_lang('Skills'), [], ICON_SIZE_MEDIUM),
$webCodePath.'social/my_skills_report.php'
);
$actionsLeft .= Display::url(

@ -298,7 +298,6 @@ if ($is_group_member || $groupInfo['visibility'] == GROUP_PERMISSION_OPEN) {
$listTopic = $content;
$listMembers = $member_content;
} else {
// if I already sent an invitation message
if (!in_array(

@ -182,7 +182,7 @@ foreach ($results as $result) {
$grid_item_2 = $html;
$grid_newest_groups[] = [$grid_item_2];
}
$html.= '</ul>';
$html .= '</ul>';
// Pop groups
$results = $usergroup->get_groups_by_popularity(4, false);
@ -220,7 +220,6 @@ if (is_array($results) && count($results) > 0) {
$picture = $usergroup->get_picture_group($result['id'], $result['picture'], 80);
$result['picture'] = '<img class="mr-3" src="'.$picture.'" />';
$html .= '<li class="media item-3">';
$html .= $result['picture'];
$html .= '<div class="media-body">';
@ -375,7 +374,6 @@ if (isset($_GET['view']) && $_GET['view'] == 'mygroups') {
$show_menu = $_GET['view'];
}
$tpl->setHelp('Groups');
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('social/groups.html.twig');

@ -67,8 +67,8 @@ $userGroup = new UserGroup();
)) {
$table_user = Database::get_main_table(TABLE_MAIN_USER);
$sql = "UPDATE $table_user
SET
picture_uri = '$new_picture'
SET
picture_uri = '$new_picture'
WHERE user_id = ".api_get_user_id();
$result = Database::query($sql);
@ -77,7 +77,6 @@ $userGroup = new UserGroup();
}
}*/
$socialSearch = UserManager::getSearchForm('');
// Top Last
@ -104,7 +103,6 @@ $tpl = new Template(get_lang('SocialNetwork'));
SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'home');
$tpl->assign('social_friend_block', $friend_html);
$tpl->assign('session_list', $social_session_block);
$tpl->assign('social_search', $socialSearch);

@ -354,7 +354,6 @@ if ($ticket['ticket']['status_id'] == TicketManager::STATUS_CLOSE) {
}
$senderData = get_lang('AddedBy').' '.$ticket['usuario']['complete_name_with_message_link'];
echo '<table width="100%" >
<tr>
<td colspan="3">

@ -592,7 +592,7 @@ $server->register(
/**
* @param array $params
*
* @return null|soap_fault
* @return soap_fault|null
*/
function WSCreateLp($params)
{

@ -19,7 +19,7 @@ define('DEFAULT_ADMIN_USER_ID', 1);
/**
* @param string $code
*
* @return null|soap_fault
* @return soap_fault|null
*/
function returnError($code)
{
@ -1119,7 +1119,7 @@ $server->register(
*
* @param array $params - WSFunction parameters (include VerifyKey)
*
* @return bool|null|soap_fault A simple boolean (true if teacher successful subscribed, false otherwise)
* @return bool|soap_fault|null A simple boolean (true if teacher successful subscribed, false otherwise)
*/
function WSSubscribeTeacherToSessionCourse($params)
{
@ -1178,7 +1178,7 @@ $server->register(
*
* @param array $params - WSFunction parameters (include VerifyKey)
*
* @return bool|null|soap_fault A simple boolean (true if teacher successful unsubscribed, false otherwise)
* @return bool|soap_fault|null A simple boolean (true if teacher successful unsubscribed, false otherwise)
*/
function WSUnsubscribeTeacherFromSessionCourse($params)
{
@ -1609,7 +1609,7 @@ $server->register(
*
* @throws \Doctrine\DBAL\DBALException
*
* @return bool|int|null|soap_fault
* @return bool|int|soap_fault|null
*/
function WSEditUserCredentials($params)
{
@ -4720,7 +4720,7 @@ $server->register(
*
* @param array $params
*
* @return array|int|null|soap_fault|string
* @return array|int|soap_fault|string|null
*/
function WSSubscribeUserToCourseSimple($params)
{
@ -5241,7 +5241,7 @@ $server->register(
/**
* @param array $params
*
* @return array|null|soap_fault
* @return array|soap_fault|null
*/
function WSUnSubscribeUserFromCourseSimple($params)
{
@ -5540,7 +5540,7 @@ $server->register(
/**
* @param array $params
*
* @return int|null|soap_fault|string
* @return int|soap_fault|string|null
*/
function WSSubscribeUserToSessionSimple($params)
{
@ -6298,7 +6298,7 @@ $server->register(
/**
* @param array $params
*
* @return int|null|soap_fault
* @return int|soap_fault|null
*/
function WSUpdateUserApiKey($params)
{
@ -6481,7 +6481,7 @@ $server->register(
*
* @param array $params Array of parameters (course and user_id)
*
* @return bool|null|soap_fault A simple boolean (true if user is subscribed, false otherwise)
* @return bool|soap_fault|null A simple boolean (true if user is subscribed, false otherwise)
*/
function WSUserSubscribedInCourse($params)
{

@ -3819,7 +3819,7 @@ function checkExistingWorkFileName($filename, $workId)
* @param bool $checkDuplicated
* @param bool $showFlashMessage
*
* @return null|string
* @return string|null
*/
function processWorkForm(
$workInfo,

@ -405,7 +405,7 @@ class HookAdvancedSubscription extends HookObserver implements HookAdminBlockObs
/**
* @param $params
*
* @return null|soap_fault
* @return soap_fault|null
*/
public static function WSSessionListInCategory($params)
{
@ -456,7 +456,7 @@ class HookAdvancedSubscription extends HookObserver implements HookAdminBlockObs
/**
* @param $params
*
* @return null|soap_fault
* @return soap_fault|null
*/
public static function WSSessionGetDetailsByUser($params)
{

@ -35,7 +35,7 @@ class CourseResolver implements ContainerAwareInterface
* @param Course $course
* @param Argument $args
*
* @return null|string
* @return string|null
*/
public function getPicture(Course $course, Argument $args)
{

@ -61,10 +61,7 @@ class BreadcrumbBlockService extends BaseBreadcrumbMenuBlockService
// Add course
/** @var Course $course */
if ($course = $blockContext->getBlock()->getSetting('course')) {
if(is_array($course)){
if (is_array($course)) {
$title = $course['title'];
$code = $course['code'];
} else {

@ -87,8 +87,8 @@ class TestMatching extends Basic
'Subscript',
'Superscript',
'ShowBlocks',
],['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
['Source']
], ['JustifyLeft', 'JustifyCenter', 'JustifyRight'],
['Source'],
];
}

@ -59,7 +59,7 @@ class EditorController extends BaseController
{
\Chat::setDisableChat();
$params = [
'course_condition' => '?'.$this->getCourseUrlQuery()
'course_condition' => '?'.$this->getCourseUrlQuery(),
];
return $this->render('@ChamiloTheme/Editor/elfinder.html.twig', $params);

@ -153,7 +153,7 @@ class ResourceController extends BaseController implements CourseControllerInter
* @param Request $request
* @param string $fileType
*
* @return null|\Symfony\Component\HttpFoundation\RedirectResponse|Response
* @return \Symfony\Component\HttpFoundation\RedirectResponse|Response|null
*/
public function createResource(Request $request, $fileType = 'file')
{

@ -45,7 +45,7 @@ class LoginSuccessHandler
* @param Request $request
* @param TokenInterface $token
*
* @return null|RedirectResponse|Response
* @return RedirectResponse|Response|null
*/
public function onSecurityInteractiveLogin(InteractiveLoginEvent $event)
{

@ -38,7 +38,7 @@ class LogoutSuccessHandler implements LogoutSuccessHandlerInterface
/**
* @param Request $request
*
* @return null|RedirectResponse
* @return RedirectResponse|null
*/
public function onLogoutSuccess(Request $request)
{

@ -882,7 +882,7 @@ class PageController
* @param string $filter current|history
* @param int $page
*
* @return bool|null|string
* @return bool|string|null
*/
public function returnSessions($user_id, $filter, $page)
{

@ -3,18 +3,18 @@
namespace Chamilo\CoreBundle\Settings;
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface;
use Sylius\Bundle\SettingsBundle\Schema\AbstractSettingsBuilder;
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface;
/**
* Class AbstractSettingsSchema
* Class AbstractSettingsSchema.
*
* @package Chamilo\CoreBundle\Settings
*/
abstract class AbstractSettingsSchema implements SchemaInterface
{
/**
* @param array $allowedTypes
* @param array $allowedTypes
* @param AbstractSettingsBuilder $builder
*/
public function setMultipleAllowedTypes($allowedTypes, $builder)

@ -155,7 +155,7 @@ class HomeController extends ToolBaseController
*
* @param $iconId
*
* @return null|string
* @return string|null
*/
public function showIconAction($iconId)
{
@ -177,7 +177,7 @@ class HomeController extends ToolBaseController
*
* @param $iconId
*
* @return null|string
* @return string|null
*/
public function hideIconAction($iconId)
{
@ -203,7 +203,7 @@ class HomeController extends ToolBaseController
*
* @param $iconId
*
* @return null|string
* @return string|null
*/
public function deleteIcon($iconId)
{

@ -68,7 +68,7 @@ class ExternalTool
*/
private $activeDeepLinking = false;
/**
* @var null|string
* @var string|null
*
* @ORM\Column(name="privacy", type="text", nullable=true, options={"default": null})
*/
@ -164,7 +164,7 @@ class ExternalTool
}
/**
* @return null|string
* @return string|null
*/
public function getDescription()
{
@ -172,7 +172,7 @@ class ExternalTool
}
/**
* @param null|string $description
* @param string|null $description
*
* @return ExternalTool
*/
@ -244,7 +244,7 @@ class ExternalTool
}
/**
* @return null|string
* @return string|null
*/
public function getCustomParams()
{
@ -252,7 +252,7 @@ class ExternalTool
}
/**
* @param null|string $customParams
* @param string|null $customParams
*
* @return ExternalTool
*/
@ -274,7 +274,7 @@ class ExternalTool
/**
* @param array $params
*
* @return null|string
* @return string|null
*/
public function encodeCustomParams(array $params)
{
@ -387,7 +387,7 @@ class ExternalTool
/**
* Get privacy.
*
* @return null|string
* @return string|null
*/
public function getPrivacy()
{

@ -1980,6 +1980,7 @@ class User extends BaseUser implements ThemeUser, EquatableInterface //implement
if ($uri) {
return 'users/'.substr((string) $id, 0, 1).'/'.$id.'/'.'small_'.$uri;
}
return '';
}

@ -1349,7 +1349,7 @@ class UserRepository extends EntityRepository
*
* @throws \Exception
*
* @return null|TrackELogin
* @return TrackELogin|null
*/
public function getLastLogin(User $user)
{

@ -64,7 +64,7 @@ class LoginFormAuthenticator extends AbstractFormLoginAuthenticator
* @param array $credentials
* @param UserProviderInterface $userProvider
*
* @return null|UserInterface
* @return UserInterface|null
*/
public function getUser($credentials, UserProviderInterface $userProvider)
{

@ -131,7 +131,6 @@ $myCourseListAsCategory = api_get_configuration_value('my_courses_list_as_catego
$controller = new IndexManager(get_lang('MyCourses'));
if (!$myCourseListAsCategory) {
// Main courses and session list
if (isset($_COOKIE['defaultMyCourseView'.$userId]) &&
$_COOKIE['defaultMyCourseView'.$userId] == IndexManager::VIEW_BY_SESSION &&
@ -183,7 +182,7 @@ if (!$myCourseListAsCategory) {
true,
$loadHistory
);
$getCategory = CourseCategory::getCategory($categoryCode);
$controller->tpl->assign('category', $getCategory);
}
@ -244,7 +243,6 @@ if (empty($courseAndSessions['html_courses']) && !isset($_GET['history'])) {
$showWelcomeCourse = true;
}
$controller->tpl->assign('show_welcome_course', $showWelcomeCourse);
$controller->tpl->assign('html_sessions', $courseAndSessions['html_sessions']);
$controller->tpl->assign('html_courses', $courseAndSessions['html_courses']);

Loading…
Cancel
Save