Minor - flint fixes

pull/3924/head
Julio Montoya 4 years ago
parent 028435b3e1
commit f68d481383
  1. 2
      ecs.php
  2. 4
      public/main/admin/access_url_edit.php
  3. 1
      public/main/admin/access_url_edit_users_to_url.php
  4. 1
      public/main/admin/add_sessions_to_usergroup.php
  5. 1
      public/main/admin/course_list.php
  6. 2
      public/main/admin/course_user_import_by_email.php
  7. 1
      public/main/admin/skills_wheel.php
  8. 1
      public/main/admin/user_information.php
  9. 1
      public/main/admin/user_update_import.php
  10. 1
      public/main/blog/blog.php
  11. 2
      public/main/course_info/infocours.php
  12. 1
      public/main/cron/add_gradebook_certificates.php
  13. 8
      public/main/cron/check_lp_total_time.php
  14. 2
      public/main/exercise/answer.class.php
  15. 6
      public/main/exercise/exercise.class.php
  16. 1
      public/main/exercise/export/aiken/aiken_import.inc.php
  17. 16
      public/main/exercise/hotspot_actionscript.as.php
  18. 7
      public/main/exercise/question.class.php
  19. 1
      public/main/exercise/question_admin.inc.php
  20. 16
      public/main/forum/forumfunction.inc.php
  21. 1
      public/main/forum/viewforum.php
  22. 2
      public/main/forum/viewthread.php
  23. 2
      public/main/glossary/glossary_ajax_request.php
  24. 8
      public/main/gradebook/lib/be/category.class.php
  25. 4
      public/main/inc/ajax/course.ajax.php
  26. 7
      public/main/inc/ajax/exercise.ajax.php
  27. 2
      public/main/inc/ajax/lp.ajax.php
  28. 8
      public/main/inc/ajax/model.ajax.php
  29. 1
      public/main/inc/ajax/work.ajax.php
  30. 2
      public/main/inc/global.inc.php
  31. 9
      public/main/inc/lib/SkillModel.php
  32. 1
      public/main/inc/lib/TicketManager.php
  33. 2
      public/main/inc/lib/add_course.lib.inc.php
  34. 58
      public/main/inc/lib/agenda.lib.php
  35. 10
      public/main/inc/lib/api.lib.php
  36. 114
      public/main/inc/lib/course.lib.php
  37. 12
      public/main/inc/lib/course_category.lib.php
  38. 6
      public/main/inc/lib/database.lib.php
  39. 7
      public/main/inc/lib/display.lib.php
  40. 7
      public/main/inc/lib/document.lib.php
  41. 15
      public/main/inc/lib/events.lib.php
  42. 25
      public/main/inc/lib/exercise.lib.php
  43. 2
      public/main/inc/lib/formvalidator/Element/HtmlEditor.php
  44. 8
      public/main/inc/lib/formvalidator/FormValidator.class.php
  45. 2
      public/main/inc/lib/grade_model.lib.php
  46. 13
      public/main/inc/lib/groupmanager.lib.php
  47. 95
      public/main/inc/lib/internationalization.lib.php
  48. 2
      public/main/inc/lib/myspace.lib.php
  49. 12
      public/main/inc/lib/system_announcements.lib.php
  50. 40
      public/main/inc/lib/tracking.lib.php
  51. 1
      public/main/inc/lib/urlmanager.lib.php
  52. 15
      public/main/inc/lib/usermanager.lib.php
  53. 4
      public/main/inc/lib/webservices/Rest.php
  54. 9
      public/main/install/install.lib.php
  55. 1
      public/main/lp/lp_add_audio.php
  56. 1
      public/main/lp/lp_add_item.php
  57. 3
      public/main/lp/lp_ajax_initialize.php
  58. 1
      public/main/lp/lp_ajax_switch_item.php
  59. 2
      public/main/lp/lp_ajax_switch_item_toc.php
  60. 2
      public/main/lp/lp_controller.php
  61. 2
      public/main/lp/lp_edit_item.php
  62. 1
      public/main/lp/lp_edit_item_prereq.php
  63. 1
      public/main/lp/lp_upload.php
  64. 2
      public/main/lp/lp_view_item.php
  65. 1
      public/main/lp/openoffice_presentation.class.php
  66. 2
      public/main/lp/scorm.class.php
  67. 1
      public/main/messages/view_message.php
  68. 2
      public/main/mySpace/index.php
  69. 3
      public/main/mySpace/myStudents.php
  70. 8
      public/main/session/add_users_to_session_course.php
  71. 4
      public/main/session/session_category_list.php
  72. 1
      public/main/session/session_course_edit.php
  73. 2
      public/main/session/session_import.php
  74. 1
      public/main/social/group_add.php
  75. 1
      public/main/survey/fillsurvey.php
  76. 2
      public/main/survey/link.php
  77. 1
      public/main/survey/question.php
  78. 2
      public/main/survey/survey.lib.php
  79. 26
      public/main/survey/surveyUtil.class.php
  80. 126
      public/main/ticket/ticket_details.php
  81. 2
      public/main/ticket/tickets.php
  82. 28
      public/main/tracking/exams.php
  83. 2
      public/main/user/career_diagram.php
  84. 2
      public/main/user/user.php
  85. 1
      public/main/work/edit.php
  86. 63
      public/main/work/work.lib.php
  87. 1
      public/main/work/work_list.php
  88. 2
      public/plugin/azure_active_directory/lang/dutch.php
  89. 2
      public/plugin/azure_active_directory/lang/english.php
  90. 2
      public/plugin/azure_active_directory/lang/french.php
  91. 2
      public/plugin/azure_active_directory/lang/spanish.php
  92. 2
      public/plugin/azure_active_directory/src/AzureActiveDirectory.php
  93. 4
      public/plugin/azure_active_directory/src/callback.php
  94. 2
      public/plugin/buycourses/src/buycourses.ajax.php
  95. 1
      public/plugin/buycourses/src/service_process.php
  96. 1
      public/plugin/customcertificate/src/index.php
  97. 31
      public/plugin/whispeakauth/Controller/AuthenticationController.php
  98. 5
      public/plugin/whispeakauth/Controller/BaseController.php
  99. 29
      public/plugin/whispeakauth/Controller/EnrollmentController.php
  100. 13
      public/plugin/whispeakauth/Request/ApiRequest.php
  101. Some files were not shown because too many files have changed in this diff Show More

@ -118,7 +118,7 @@ return static function (ContainerConfigurator $containerConfigurator): void {
\PhpCsFixer\Fixer\FunctionNotation\FopenFlagsFixer::class,
\Symplify\CodingStandard\Fixer\ArrayNotation\ArrayOpenerAndCloserNewlineFixer::class,
\Symplify\CodingStandard\Fixer\ArrayNotation\ArrayListItemNewlineFixer::class,
\Symplify\CodingStandard\Fixer\ArrayNotation\StandaloneLineInMultilineArrayFixer::class
\Symplify\CodingStandard\Fixer\ArrayNotation\StandaloneLineInMultilineArrayFixer::class,
//UnusedVariableSniff::class . '.ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach' => true,
//UnusedVariableSniff::class => 'ignoreUnusedValuesWhenOnlyKeysAreUsedInForeach',
]

@ -21,10 +21,10 @@ $form = new FormValidator('add_url');
$form->addUrl('url', 'URL');
$form->addRule('url', get_lang('Required field'), 'required');
$form->addRule('url', '', 'maxlength', 254);
$form->addTextarea( 'description', get_lang('Description'));
$form->addTextarea('description', get_lang('Description'));
// URL Images
$form->addFile( 'url_image_1', get_lang('Image'));
$form->addFile('url_image_1', get_lang('Image'));
//$form->addElement('file', 'url_image_2', 'URL Image 2 (PNG)');
//$form->addElement('file', 'url_image_3', 'URL Image 3 (PNG)');

@ -5,7 +5,6 @@
/**
* @author Julio Montoya <gugli100@gmail.com>
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';

@ -159,7 +159,6 @@ if ('multiple' === $add_type) {
Display::return_icon('multiple.gif').get_lang('Multiple registration').'</a>';
}
$actions = '<a href="usergroups.php">'.
Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';

@ -6,7 +6,6 @@
* This script shows a list of courses and allows searching for courses codes
* and names.
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;

@ -227,6 +227,4 @@ example2@example.org;course01;'.STUDENT.'
echo Display::prose($content);
Display::display_footer();

@ -26,7 +26,6 @@ $skill_condition = '';
$skillId = isset($_REQUEST['skill_id']) ? (int) $_REQUEST['skill_id'] : 0;
if (!empty($skillId)) {
$skill_condition = '&skill_id='.$skillId;
}
$tpl->assign('skill_id_to_load', $skillId);

@ -9,7 +9,6 @@ use Chamilo\CoreBundle\Framework\Container;
*
* @author Bart Mollet
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
$this_section = SECTION_PLATFORM_ADMIN;

@ -387,7 +387,6 @@ if ($count_fields > 0) {
}
}
$content = '<p>'.get_lang('CSVMustLookLike').' ('.get_lang('MandatoryFields').') :</p>
<blockquote>
<pre>

@ -30,7 +30,6 @@ $MonthsLong = api_get_months_long();
$action = isset($_GET['action']) ? $_GET['action'] : null;
$safe_post_file_comment = isset($_POST['post_file_comment']) ? Security::remove_XSS($_POST['post_file_comment']) : null;
$safe_comment_text = isset($_POST['comment_text']) ? Security::remove_XSS($_POST['comment_text']) : null;
$safe_comment_title = isset($_POST['comment_title']) ? Security::remove_XSS($_POST['comment_title']) : null;

@ -187,10 +187,8 @@ if (!empty($scoreModels)) {
}
*/
$form->addButtonSave(get_lang('Save settings'), 'submit_save');
CourseManager::addVisibilityOptions($form);
$url = api_get_path(WEB_CODE_PATH)."auth/inscription.php?c=$course_code&e=1";

@ -10,7 +10,6 @@ use Chamilo\CoreBundle\Framework\Container;
*
* @author Imanol Losada <imanol.losada@beeznest.com>
*/
require_once __DIR__.'/../inc/global.inc.php';
/**

@ -10,7 +10,6 @@ use Chamilo\CoreBundle\Entity\Course;
*/
exit;
require_once __DIR__.'/../../main/inc/global.inc.php';
api_protect_admin_script();
@ -53,7 +52,7 @@ foreach ($sessions as $session) {
foreach ($users as $user) {
$result = compareLpTimeAndCourseTime($user, $course, $sessionId);
if ($result) {
++$counter;
$counter++;
}
if ($counter > $max) {
@ -76,9 +75,8 @@ foreach($courses as $courseInfo) {
}*/
/**
* @param array $user
* @param Course $course
* @param int $sessionId
* @param array $user
* @param int $sessionId
*
* @return bool
*/

@ -469,7 +469,9 @@ class Answer
* Returns the question type.
*
* @author Yannick Warnier <ywarnier@beeznest.org>
*
* @todo remove this function use CQuizQuestion
*
* @return int The type of the question this answer is bound to
*/
public function getQuestionType()

@ -216,7 +216,7 @@ class Exercise
//$this->pageResultConfiguration = $object->page_result_configuration;
}
$this->hideQuestionNumber = $object->hide_question_number == 1;
$this->hideQuestionNumber = 1 == $object->hide_question_number;
if (isset($object->show_previous_button)) {
$this->showPreviousButton = 1 == $object->show_previous_button ? true : false;
@ -3369,7 +3369,7 @@ class Exercise
/**
* So the time control will work.
*
* @param int $timeLeft
* @param int $timeLeft
* @param string $redirectToUrl
*
* @return string
@ -3389,6 +3389,7 @@ class Exercise
if (!empty($redirectToUrl)) {
$exerciseSubmitRedirect = "window.location = '$redirectToUrl'";
}
return "<script>
function openClockWarning() {
$('#clock_warning').dialog({
@ -10402,7 +10403,6 @@ class Exercise
";
}
/**
* Returns true if the exercise is locked by percentage. an exercise attempt must be passed.
*/

@ -121,7 +121,6 @@ function aiken_import_exercise($file)
mkdir($baseWorkDir.$uploadPath, api_get_permissions_for_new_directories(), true);
}
// set some default values for the new exercise
$exercise_info = [];
$exercise_info['name'] = preg_replace('/.(zip|txt)$/i', '', $file);

@ -46,17 +46,17 @@ $answers = $objQuestion->getAnswers();
// Query db for answers
/*if (HOT_SPOT_DELINEATION == $answer_type) {
$sql = "SELECT iid, answer, hotspot_coordinates, hotspot_type, ponderation
FROM $TBL_ANSWERS
WHERE
c_id = $course_id AND
question_id = $questionId AND
hotspot_type = 'delineation'
FROM $TBL_ANSWERS
WHERE
c_id = $course_id AND
question_id = $questionId AND
hotspot_type = 'delineation'
ORDER BY iid";
} else {
$sql = "SELECT iid, answer, hotspot_coordinates, hotspot_type, ponderation
FROM $TBL_ANSWERS
WHERE c_id = $course_id AND question_id = $questionId
ORDER BY position";
FROM $TBL_ANSWERS
WHERE c_id = $course_id AND question_id = $questionId
ORDER BY position";
}
$result = Database::query($sql);*/

@ -1546,11 +1546,10 @@ abstract class Question
}
/**
* @param CQuizQuestion $question
* @param string $name
* @param int $position
* @param string $name
* @param int $position
*
* @return null|CQuizQuestion
* @return CQuizQuestion|null
*/
public static function saveQuestionOption(CQuizQuestion $question, $name, $position = 0)
{

@ -8,7 +8,6 @@
*
* @author Olivier Brouckaert
*/
$type = isset($_REQUEST['answerType']) ? (int) $_REQUEST['answerType'] : 0;
if (isset($_GET['editQuestion'])) {

@ -6,9 +6,9 @@ use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\GradebookLink;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CForum;
use Chamilo\CourseBundle\Entity\CForumAttachment;
use Chamilo\CourseBundle\Entity\CForumCategory;
use Chamilo\CourseBundle\Entity\CForum;
use Chamilo\CourseBundle\Entity\CForumNotification;
use Chamilo\CourseBundle\Entity\CForumPost;
use Chamilo\CourseBundle\Entity\CForumThread;
@ -286,7 +286,7 @@ function forumForm(CForum $forum = null, $lp_id)
// We have a hidden field if we are editing.
if ($forum) {
$form->addHidden( 'forum_id', $id);
$form->addHidden('forum_id', $id);
}
$lp_id = (int) $lp_id;
@ -3496,7 +3496,7 @@ function store_reply(CForum $forum, CForumThread $thread, $values, $courseId = 0
*
* @param CForumPost $post contains all the information about the current post
* @param CForumThread $thread contains all the information about the current thread
* @param CForum $forum contains all info about the current forum (to check if attachments are allowed)
* @param CForum $forum contains all info about the current forum (to check if attachments are allowed)
* @param array $form_values contains the default values to fill the form
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
@ -3834,7 +3834,9 @@ function updateThreadInfo($threadId, $lastPostId, $post_date)
* This function is used to find all the information about what's new in the forum tool.
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
*
* @deprecated
*
* @version february 2006, dokeos 1.8
*/
function get_whats_new()
@ -6175,8 +6177,8 @@ function getPostStatus(CForum $forum, array $row, bool $addWrapper = true): stri
/**
* @param CForum $forum
* @param int $threadId
* @param int $status
* @param int $threadId
* @param int $status
*/
function getCountPostsWithStatus($status, $forum, $threadId = null)
{
@ -6200,8 +6202,8 @@ function getCountPostsWithStatus($status, $forum, $threadId = null)
}
/**
* @param CForum $forum
* @param CForumPost $post
* @param CForum $forum
* @param CForumPost $post
*
* @return bool
*/

@ -541,4 +541,3 @@ $tpl->assign('is_allowed_to_edit', $isTeacher);
$layout = $tpl->get_template('forum/forum.tpl');
$tpl->display($layout);

@ -3,8 +3,8 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CForumAttachment;
use Chamilo\CourseBundle\Entity\CForum;
use Chamilo\CourseBundle\Entity\CForumAttachment;
use Chamilo\CourseBundle\Entity\CForumPost;
use Chamilo\CourseBundle\Entity\CForumThread;

@ -24,7 +24,7 @@ $description = get_lang('No results found');
if (!empty($glossaryId)) {
$description = GlossaryManager::get_glossary_term_by_glossary_id($glossaryId);
//$description = str_replace($path_image_search, $path_image, $description);
//$description = str_replace($path_image_search, $path_image, $description);
} elseif (isset($_REQUEST['glossary_data']) && 'true' === $_REQUEST['glossary_data']) {
// get_glossary_terms
$glossary_data = GlossaryManager::get_glossary_terms();

@ -2,8 +2,8 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\GradebookCategory;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\GradebookCategory;
use ChamiloSession as Session;
/**
@ -2263,9 +2263,8 @@ class Category implements GradebookItem
/**
* Get the current score (as percentage) on a gradebook category for a user.
*
* @param int $userId The user id
* @param GradebookCategory $category
* @param bool $recalculate
* @param int $userId The user id
* @param bool $recalculate
*
* @return float The score
*/
@ -2681,6 +2680,7 @@ class Category implements GradebookItem
/**
* Calculate the current score on a gradebook category for a user.
*
* @return float The score
*/
private static function calculateCurrentScore(int $userId, GradebookCategory $category)

@ -2,10 +2,6 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Component\Utils\ChamiloApi;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CQuiz;
/**
* Responses to AJAX calls.
*/

@ -138,7 +138,6 @@ switch ($action) {
->setExeDate($nowObject);
$em->persist($attempt);
$em->flush();
}
} else {
if ($debug) {
@ -479,7 +478,7 @@ switch ($action) {
}
if (WhispeakAuthPlugin::questionRequireAuthentify($question_id)) {
if ($objExercise->type == ONE_PER_PAGE) {
if (ONE_PER_PAGE == $objExercise->type) {
echo json_encode(['type' => 'one_per_page']);
break;
}
@ -565,7 +564,7 @@ switch ($action) {
}
if (!$atLeastOneAnswer) {
// Check if time is over.
if ($objExercise->expired_time != 0) {
if (0 != $objExercise->expired_time) {
$clockExpiredTime = ExerciseLib::get_session_time_control_key(
$objExercise->id,
$learnpath_id,
@ -840,7 +839,7 @@ switch ($action) {
);
}
if ($type === 'all') {
if ('all' === $type) {
if ($debug) {
error_log("result: ok - all");
error_log(" ------ end ajax call ------- ");

@ -5,7 +5,6 @@
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CDocument;
use Chamilo\CourseBundle\Entity\CLp;
use Chamilo\CourseBundle\Entity\CLpItem;
use ChamiloSession as Session;
require_once __DIR__.'/../global.inc.php';
@ -295,7 +294,6 @@ switch ($action) {
exit;
$lp = Session::read('oLP');
break;
case 'check_item_position':
// loaded in lp_nav.php

@ -115,13 +115,13 @@ function getWhereClause($col, $oper, $val)
return '';
}
if ($oper == 'bw' || $oper == 'bn') {
if ('bw' == $oper || 'bn' == $oper) {
$val .= '%';
}
if ($oper == 'ew' || $oper == 'en') {
if ('ew' == $oper || 'en' == $oper) {
$val = '%'.$val;
}
if ($oper == 'cn' || $oper == 'nc' || $oper == 'in' || $oper == 'ni') {
if ('cn' == $oper || 'nc' == $oper || 'in' == $oper || 'ni' == $oper) {
$val = '%'.$val.'%';
}
$val = Database::escape_string($val);
@ -1594,7 +1594,7 @@ switch ($action) {
'actions',
];
$officialCodeInList = api_get_setting('show_official_code_exercise_result_list');
if ($officialCodeInList === 'true') {
if ('true' === $officialCodeInList) {
$columns = array_merge(['official_code'], $columns);
}

@ -7,7 +7,6 @@ use Chamilo\CoreBundle\Framework\Container;
/**
* Responses to AJAX calls.
*/
require_once __DIR__.'/../global.inc.php';
$action = $_REQUEST['a'] ?? null;

@ -3,7 +3,6 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Controller\ExceptionController;
use Symfony\Component\ErrorHandler\Exception\FlattenException;
use Chamilo\CoreBundle\Framework\Container;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\ErrorHandler\Debug;
@ -14,7 +13,6 @@ use Symfony\Component\HttpKernel\HttpKernelInterface;
/**
* All legacy Chamilo scripts should include this important file.
*/
require_once __DIR__.'/../../../vendor/autoload.php';
// Get settings from .env.local file created.

@ -511,10 +511,9 @@ class SkillModel extends Model
}
/**
* @param int $userId
* @param GradebookCategory $category
* @param int $courseId
* @param int $sessionId
* @param int $userId
* @param int $courseId
* @param int $sessionId
*
* @return bool
*/
@ -2309,7 +2308,6 @@ class SkillModel extends Model
public static function getWebIconPath(Skill $skill, $getSmall = false)
{
throw new Exception('fix WEB_UPLOAD_PATH');
if ($getSmall) {
if (empty($skill->getIcon())) {
return \Display::return_icon('badges-default.png', null, null, ICON_SIZE_BIG, null, true);
@ -2333,7 +2331,6 @@ class SkillModel extends Model
* @param int $authorId
*
* @return \Chamilo\CoreBundle\Entity\SkillRelUser|bool
*
*/
public function addSkillToUserBadge($user, $skill, $levelId, $argumentation, $authorId)
{

@ -742,7 +742,6 @@ class TicketManager
);
} else {
throw new Exception('@todo file upload ticket_attachment');
//$result = api_upload_file('ticket_attachment', $file_attach, $ticketId);
if ($result) {
$safe_file_name = Database::escape_string($new_file_name);

@ -637,8 +637,6 @@ class AddCourse
* @param array $params Course details (see code for details).
* @param int $accessUrlId Optional.
*
* @return Course|null
*
* @todo use an array called $params instead of lots of params
* @assert (null) === false
*/

@ -2,13 +2,13 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\PersonalAgenda;
use Chamilo\CoreBundle\Entity\SysCalendar;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CCalendarEvent;
use Chamilo\CourseBundle\Entity\CCalendarEventAttachment;
use Chamilo\CourseBundle\Entity\CGroup;
use Chamilo\CoreBundle\Entity\Course;
use Symfony\Component\HttpFoundation\File\UploadedFile;
/**
@ -1413,7 +1413,6 @@ class Agenda
/**
* @param int $start
* @param int $end
* @param Course $course
* @param int $groupId
* @param int $sessionId
* @param int $user_id
@ -2845,7 +2844,6 @@ class Agenda
$items = [];
$my_list = [];
throw new Exception('@todo get_myagendaitems');
/*
// get agenda-items for every course
foreach ($courses_dbs as $key => $array_course_info) {
@ -2867,15 +2865,15 @@ class Agenda
if ('1' == $course_user_status) {
//echo "course admin";
$sqlquery = "SELECT DISTINCT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref
FROM ".$TABLEAGENDA." agenda,
".$TABLE_ITEMPROPERTY." ip
WHERE agenda.id = ip.ref
AND MONTH(agenda.start_date)='".$month."'
AND YEAR(agenda.start_date)='".$year."'
AND ip.tool='".TOOL_CALENDAR_EVENT."'
AND ip.visibility='1'
GROUP BY agenda.id
ORDER BY start_date ";
FROM ".$TABLEAGENDA." agenda,
".$TABLE_ITEMPROPERTY." ip
WHERE agenda.id = ip.ref
AND MONTH(agenda.start_date)='".$month."'
AND YEAR(agenda.start_date)='".$year."'
AND ip.tool='".TOOL_CALENDAR_EVENT."'
AND ip.visibility='1'
GROUP BY agenda.id
ORDER BY start_date ";
} else {
// if the user is not an administrator of that course
if (is_array($group_memberships) && count(
@ -2883,29 +2881,29 @@ class Agenda
) > 0
) {
$sqlquery = "SELECT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref
FROM ".$TABLEAGENDA." agenda,
".$TABLE_ITEMPROPERTY." ip
WHERE agenda.id = ip.ref
AND MONTH(agenda.start_date)='".$month."'
AND YEAR(agenda.start_date)='".$year."'
AND ip.tool='".TOOL_CALENDAR_EVENT."'
AND ( ip.to_user_id='".$user_id."' OR (ip.to_group_id IS NULL OR ip.to_group_id IN (0, ".implode(
FROM ".$TABLEAGENDA." agenda,
".$TABLE_ITEMPROPERTY." ip
WHERE agenda.id = ip.ref
AND MONTH(agenda.start_date)='".$month."'
AND YEAR(agenda.start_date)='".$year."'
AND ip.tool='".TOOL_CALENDAR_EVENT."'
AND ( ip.to_user_id='".$user_id."' OR (ip.to_group_id IS NULL OR ip.to_group_id IN (0, ".implode(
", ",
$group_memberships
).")) )
AND ip.visibility='1'
ORDER BY start_date ";
AND ip.visibility='1'
ORDER BY start_date ";
} else {
$sqlquery = "SELECT agenda.*, ip.visibility, ip.to_group_id, ip.insert_user_id, ip.ref
FROM ".$TABLEAGENDA." agenda,
".$TABLE_ITEMPROPERTY." ip
WHERE agenda.id = ip.ref
AND MONTH(agenda.start_date)='".$month."'
AND YEAR(agenda.start_date)='".$year."'
AND ip.tool='".TOOL_CALENDAR_EVENT."'
AND ( ip.to_user_id='".$user_id."' OR ip.to_group_id='0' OR ip.to_group_id IS NULL)
AND ip.visibility='1'
ORDER BY start_date ";
FROM ".$TABLEAGENDA." agenda,
".$TABLE_ITEMPROPERTY." ip
WHERE agenda.id = ip.ref
AND MONTH(agenda.start_date)='".$month."'
AND YEAR(agenda.start_date)='".$year."'
AND ip.tool='".TOOL_CALENDAR_EVENT."'
AND ( ip.to_user_id='".$user_id."' OR ip.to_group_id='0' OR ip.to_group_id IS NULL)
AND ip.visibility='1'
ORDER BY start_date ";
}
}
$result = Database::query($sqlquery);

@ -6399,9 +6399,9 @@ function api_get_jquery_libraries_js($libraries)
*
* This function relies on api_get_course_info()
*
* @param int $courseId The course code - optional (takes it from context if not given)
* @param int $sessionId The session ID - optional (takes it from context if not given)
* @param int $groupId The group ID - optional (takes it from context if not given)
* @param int $courseId The course code - optional (takes it from context if not given)
* @param int $sessionId The session ID - optional (takes it from context if not given)
* @param int $groupId The group ID - optional (takes it from context if not given)
*
* @return string The URL to a course, a session, or empty string if nothing works
* e.g. https://localhost/courses/ABC/index.php?session_id=3&gidReq=1
@ -6796,7 +6796,7 @@ function api_get_roles()
{
$hierarchy = Container::$container->getParameter('security.role_hierarchy.roles');
$roles = [];
array_walk_recursive($hierarchy, function($role) use (&$roles) {
array_walk_recursive($hierarchy, function ($role) use (&$roles) {
$roles[$role] = $role;
});
//echo '<pre>'; var_dump($roles);
@ -7704,7 +7704,7 @@ function api_mail_html(
}
/**
* @param int $tool Possible values: GroupManager::GROUP_TOOL_*
* @param int $tool Possible values: GroupManager::GROUP_TOOL_*
* @param bool $showHeader
*/
function api_protect_course_group($tool, $showHeader = true)

@ -170,7 +170,6 @@ class CourseManager
$sql .= " INNER JOIN $table url ON (url.c_id = course.id) ";
}
$visibility = (int) $visibility;
if (!empty($startwith)) {
@ -241,7 +240,7 @@ class CourseManager
if (!in_array($orderdirection, ['ASC', 'DESC'])) {
$sql .= 'ASC';
} else {
$sql .= $orderdirection === 'ASC' ? 'ASC' : 'DESC';
$sql .= 'ASC' === $orderdirection ? 'ASC' : 'DESC';
}
$howmany = (int) $howmany;
@ -710,12 +709,12 @@ class CourseManager
* Subscribe a user to a course. No checks are performed here to see if
* course subscription is allowed.
*
* @param int $userId
* @param int $courseId
* @param int $status (STUDENT, COURSEMANAGER, COURSE_ADMIN, NORMAL_COURSE_MEMBER)
* @param int $sessionId
* @param int $userCourseCategoryId
* @param bool $checkTeacherPermission
* @param int $userId
* @param int $courseId
* @param int $status (STUDENT, COURSEMANAGER, COURSE_ADMIN, NORMAL_COURSE_MEMBER)
* @param int $sessionId
* @param int $userCourseCategoryId
* @param bool $checkTeacherPermission
*
* @return bool True on success, false on failure
*
@ -5893,7 +5892,7 @@ class CourseManager
$result[$content['value']] = $content['content'];
}
return $form->addMultiSelect( 'users', get_lang('Users'), $result);
return $form->addMultiSelect('users', get_lang('Users'), $result);
}
/**
@ -6634,14 +6633,8 @@ class CourseManager
}
/**
* @param User $user
* @param Course $course
* @param array $relationInfo
*
* @throws \Doctrine\ORM\ORMException
* @throws \Doctrine\ORM\OptimisticLockException
*
* @return int|null
*/
public static function insertUserInCourse(User $user, Course $course, array $relationInfo = []): ?int
{
@ -6669,6 +6662,51 @@ class CourseManager
return $insertId;
}
public static function addVisibilityOptions(FormValidator $form): void
{
$group = [];
$group[] = $form->createElement(
'radio',
'visibility',
get_lang('Course access'),
get_lang('Public - access allowed for the whole world'),
Course::OPEN_WORLD
);
$group[] = $form->createElement(
'radio',
'visibility',
null,
get_lang(' Open - access allowed for users registered on the platform'),
Course::OPEN_PLATFORM
);
$group[] = $form->createElement(
'radio',
'visibility',
null,
get_lang('Private access (access authorized to group members only)'),
Course::REGISTERED
);
$group[] = $form->createElement(
'radio',
'visibility',
null,
get_lang('Closed - the course is only accessible to the teachers'),
Course::CLOSED
);
// The "hidden" visibility is only available to portal admins
if (api_is_platform_admin()) {
$group[] = $form->createElement(
'radio',
'visibility',
null,
get_lang('Hidden - Completely hidden to all users except the administrators'),
Course::HIDDEN
);
}
$form->addGroup($group, '', get_lang('Course access'));
}
/**
* Check if a specific access-url-related setting is a problem or not.
*
@ -6709,7 +6747,7 @@ class CourseManager
/**
* Fill course with all necessary items.
*
* @param array $params Parameters from the course creation form
* @param array $params Parameters from the course creation form
* @param int $authorId
*/
private static function fillCourse(Course $course, $params, $authorId = 0)
@ -6743,48 +6781,4 @@ class CourseManager
$courseFieldValue = new ExtraFieldValue('course');
//$courseFieldValue->saveFieldValues($params);
}
public static function addVisibilityOptions(FormValidator $form): void
{
$group = [];
$group[] = $form->createElement(
'radio',
'visibility',
get_lang('Course access'),
get_lang('Public - access allowed for the whole world'),
Course::OPEN_WORLD
);
$group[] = $form->createElement(
'radio',
'visibility',
null,
get_lang(' Open - access allowed for users registered on the platform'),
Course::OPEN_PLATFORM
);
$group[] = $form->createElement(
'radio',
'visibility',
null,
get_lang('Private access (access authorized to group members only)'),
Course::REGISTERED
);
$group[] = $form->createElement(
'radio',
'visibility',
null,
get_lang('Closed - the course is only accessible to the teachers'),
Course::CLOSED
);
// The "hidden" visibility is only available to portal admins
if (api_is_platform_admin()) {
$group[] = $form->createElement(
'radio',
'visibility',
null,
get_lang('Hidden - Completely hidden to all users except the administrators'),
Course::HIDDEN
);
}
$form->addGroup($group, '', get_lang('Course access'));
}
}

@ -3,9 +3,9 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\Asset;
use Chamilo\CoreBundle\Entity\CourseCategory as CourseCategoryEntity;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CoreBundle\Entity\CourseCategory as CourseCategoryEntity;
use Doctrine\Common\Collections\Criteria;
class CourseCategory
@ -125,10 +125,10 @@ class CourseCategory
}
/**
* @param string $code
* @param string $name
* @param string $canHaveCourses
* @param null|int $parentId
* @param string $code
* @param string $name
* @param string $canHaveCourses
* @param int|null $parentId
*/
public static function add($code, $name, $canHaveCourses, $description = '', $parentId = null): ?CourseCategoryEntity
{
@ -471,7 +471,7 @@ class CourseCategory
$actions[] = Display::url(
$deleteIcon,
$deleteUrl,
['onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('Please confirm your choice')), ENT_QUOTES)).'\')) return false;',]
['onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('Please confirm your choice')), ENT_QUOTES)).'\')) return false;']
);
}

@ -519,7 +519,7 @@ class Database
$option = 'ASSOC',
$debug = false
) {
if ($type_result === 'count') {
if ('count' === $type_result) {
$conditions['LIMIT'] = null;
$conditions['limit'] = null;
}
@ -536,7 +536,7 @@ class Database
}
}
if ($type_result === 'count') {
if ('count' === $type_result) {
$clean_columns = ' count(*) count ';
}
$sql = "SELECT $clean_columns FROM $table_name $conditions";
@ -544,7 +544,7 @@ class Database
var_dump($sql);
}
$result = self::query($sql);
if ($type_result === 'count') {
if ('count' === $type_result) {
$row = self::fetch_array($result, $option);
if ($row) {
return (int) $row['count'];

@ -27,6 +27,7 @@ class Display
public static $global_template;
public static $preview_style = null;
public static $legacyTemplate;
public function __construct()
{
}
@ -1984,8 +1985,8 @@ class Display
tabindex="-1"
>
<div class="py-1" role="none">';
foreach ($elements as $item) {
$html .= self::url(
foreach ($elements as $item) {
$html .= self::url(
$item['title'],
$item['href'],
[
@ -1995,7 +1996,7 @@ class Display
'data-action' => $item['data-action'] ?? '',
]
);
}
}
$html .= '
</div>
</div>

@ -2,15 +2,12 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\ResourceFile;
use Chamilo\CoreBundle\Entity\ResourceLink;
use Chamilo\CoreBundle\Entity\ResourceNode;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CDocument;
use Chamilo\CourseBundle\Entity\CGroup;
use ChamiloSession as Session;
use Symfony\Component\HttpFoundation\File\UploadedFile;
/**
* Class DocumentManager
@ -2906,8 +2903,8 @@ class DocumentManager
'rootOpen' => '<ul id="doc_list" class="list-group lp_resource">',
'rootClose' => '</ul>',
//'childOpen' => '<li class="doc_resource lp_resource_element ">',
'childOpen' => function($child) {
$id = $child['id'];
'childOpen' => function ($child) {
$id = $child['id'];
$disableDrag = '';
if (!$child['resourceFile']) {
$disableDrag = ' disable_drag ';

@ -680,13 +680,12 @@ class Event
/**
* Record an hotspot spot for this attempt at answering an hotspot question.
*
* @param Exercise $exercise
* @param int $exeId
* @param int $questionId Question ID
* @param int $answerId Answer ID
* @param int $correct
* @param string $coords Coordinates of this point (e.g. 123;324)
* @param bool $updateResults
* @param int $exeId
* @param int $questionId Question ID
* @param int $answerId Answer ID
* @param int $correct
* @param string $coords Coordinates of this point (e.g. 123;324)
* @param bool $updateResults
*
* @return bool Result of the insert query
*
@ -706,7 +705,7 @@ class Event
) {
$debug = false;
if ($updateResults == false) {
if (false == $updateResults) {
// Validation in case of fraud with activated control time
if (!ExerciseLib::exercise_time_control_is_valid($exercise, $lpId, $lpItemId)) {
if ($debug) {

@ -1751,9 +1751,8 @@ HOTSPOT;
/**
* Validates the time control key.
*
* @param Exercise $exercise
* @param int $lp_id
* @param int $lp_item_id
* @param int $lp_id
* @param int $lp_item_id
*
* @return bool
*/
@ -1865,10 +1864,10 @@ HOTSPOT;
/**
* Gets count of exam results.
*
* @param int $exerciseId
* @param array $conditions
* @param int $courseId
* @param bool $showSession
* @param int $exerciseId
* @param array $conditions
* @param int $courseId
* @param bool $showSession
*
* @return array
*/
@ -2154,7 +2153,7 @@ HOTSPOT;
$column = !empty($column) ? Database::escape_string($column) : null;
$from = (int) $from;
$number_of_items = (int) $number_of_items;
$direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
$direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
if (!empty($column)) {
$sql .= " ORDER BY `$column` $direction ";
@ -5366,11 +5365,11 @@ EOT;
* Generate a certificate linked to current quiz and.
* Return the HTML block with links to download and view the certificate.
*
* @param float $totalScore
* @param float $totalWeight
* @param int $studentId
* @param int $courseId
* @param int $sessionId
* @param float $totalScore
* @param float $totalWeight
* @param int $studentId
* @param int $courseId
* @param int $sessionId
*
* @return string
*/

@ -2,8 +2,8 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CoreBundle\Component\Editor\Editor;
use Chamilo\CoreBundle\Framework\Container;
/**
* A html editor field to use with QuickForm.

@ -24,7 +24,6 @@ class FormValidator extends HTML_QuickForm
* @param string $action (optional) Action (default is $PHP_SELF)
* @param string|null $target (optional) Form's target defaults to '_self'
* @param mixed $attributes (optional) Extra attributes for <form> tag
* @param string $layout
* @param bool $trackSubmit Whether to track if the form was submitted by adding a special hidden field
*/
public function __construct(
@ -885,10 +884,7 @@ EOT;
}
/**
* @param string $name
* @param string|array $label
* @param array $options
* @param array $attributes
*
* @return HTML_QuickForm_select
*/
@ -970,9 +966,9 @@ EOT;
}
/**
* @param string $name
* @param string $name
* @param string|array $label
* @param array $attributes
* @param array $attributes
*
* @throws Exception if the file doesn't have an id
*

@ -282,7 +282,7 @@ class GradeModel extends Model
$grade_model_options[$item['id']] = $item['name'];
}
}
$form->addSelect( $name, get_lang('Grading model'), $grade_model_options);
$form->addSelect($name, get_lang('Grading model'), $grade_model_options);
$default_platform_setting = api_get_setting('gradebook_default_grade_model_id');
$default = -1;

@ -95,13 +95,13 @@ class GroupManager
/**
* Get list of groups for current course.
*
* @param int $categoryId The id of the category from which the groups are
* requested
* @param Course $course Default is current course
* @param int $status group status
* @param int $categoryId The id of the category from which the groups are
* requested
* @param Course $course Default is current course
* @param int $status group status
* @param int $sessionId
* @param bool $getCount
* @param bool $notInGroup Get groups not in a category
* @param bool $notInGroup Get groups not in a category
* @param bool $returnEntityList
*
* @return array|CGroup[] an array with all information about the groups
@ -1634,7 +1634,7 @@ class GroupManager
public static function get_subscribed_users(CGroup $group)
{
//$order = api_sort_by_first_name() ? ' ORDER BY u.firstname, u.lastname' : ' ORDER BY u.lastname, u.firstname';
$order = ['lastname'=> Criteria::DESC, 'firstname'=> Criteria::ASC];
$order = ['lastname' => Criteria::DESC, 'firstname' => Criteria::ASC];
if (api_sort_by_first_name()) {
$order = ['firstname' => Criteria::ASC, 'lastname' => Criteria::ASC];
}
@ -2816,7 +2816,6 @@ class GroupManager
}
/**
* @param Course $course
* @param string $keyword
*
* @return string

@ -356,7 +356,7 @@ function api_strtotime($time, $timezone = null)
* The given date should be in the timezone chosen by the administrator
* and/or user. Use api_get_local_time to get it.
*
* @param mixed $time Timestamp or datetime string
* @param mixed $time Timestamp or datetime string
* @param string|int Date format (see date formats in the Chamilo system:
* TIME_NO_SEC_FORMAT,
* DATE_FORMAT_SHORT,
@ -401,49 +401,41 @@ function api_format_date($time, $format = null, $language = null)
if (is_int($format)) {
switch ($format) {
case DATE_FORMAT_ONLY_DAYNAME:
$datetype = IntlDateFormatter::SHORT;
$timetype = IntlDateFormatter::NONE;
break;
case DATE_FORMAT_NUMBER_NO_YEAR:
$datetype = IntlDateFormatter::SHORT;
$timetype = IntlDateFormatter::NONE;
break;
case DATE_FORMAT_NUMBER:
$datetype = IntlDateFormatter::SHORT;
$timetype = IntlDateFormatter::NONE;
break;
case TIME_NO_SEC_FORMAT:
$datetype = IntlDateFormatter::NONE;
$timetype = IntlDateFormatter::SHORT;
break;
case DATE_FORMAT_SHORT:
$datetype = IntlDateFormatter::LONG;
$timetype = IntlDateFormatter::NONE;
break;
case DATE_FORMAT_LONG:
$datetype = IntlDateFormatter::FULL;
$timetype = IntlDateFormatter::NONE;
break;
case DATE_TIME_FORMAT_LONG:
$datetype = IntlDateFormatter::FULL;
$timetype = IntlDateFormatter::SHORT;
break;
case DATE_FORMAT_LONG_NO_DAY:
$datetype = IntlDateFormatter::FULL;
$timetype = IntlDateFormatter::SHORT;
@ -454,7 +446,6 @@ function api_format_date($time, $format = null, $language = null)
break;
case DATE_TIME_FORMAT_SHORT_TIME_FIRST:
$datetype = IntlDateFormatter::FULL;
$timetype = IntlDateFormatter::SHORT;
@ -488,7 +479,7 @@ function api_format_date($time, $format = null, $language = null)
* You can use it like this:
* Display::dateToStringAgoAndLongDate($dateInUtc);.
*
* @param string|DateTime $date Result of a date function in this format -> date('Y-m-d H:i:s', time());
* @param string|DateTime $date Result of a date function in this format -> date('Y-m-d H:i:s', time());
* @param string $timeZone
* @param bool $returnDateDifference
*
@ -1426,21 +1417,21 @@ function api_ucwords($string, $encoding = null)
/**
* Performs a regular expression match, UTF-8 aware when it is applicable.
*
* @param string $pattern the pattern to search for, as a string
* @param string $subject the input string
* @param array &$matches (optional) If matches is provided,
* then it is filled with the results of search (as an array).
* $matches[0] will contain the text that matched the full pattern, $matches[1] will have the
* text that matched the first captured parenthesized subpattern, and so on.
* @param int $flags (optional) Could be PREG_OFFSET_CAPTURE. If this flag is passed, for every occurring match
* the appendant string offset will also be returned. Note that this changes the return value
* in an array where every element is an array consisting of the matched string at index 0 and
* its string offset into subject at index 1.
* @param int $offset (optional) Normally, the search starts from the beginning of the subject string. The
* optional parameter offset can be used to specify the alternate place from which to start
* the search.
* @param string $encoding (optional) The used internally by this function character encoding. If it is omitted,
* the platform character set will be used by default.
* @param string $pattern the pattern to search for, as a string
* @param string $subject the input string
* @param array &$matches (optional) If matches is provided,
* then it is filled with the results of search (as an array).
* $matches[0] will contain the text that matched the full pattern, $matches[1] will have the
* text that matched the first captured parenthesized subpattern, and so on.
* @param int $flags (optional) Could be PREG_OFFSET_CAPTURE. If this flag is passed, for every occurring match
* the appendant string offset will also be returned. Note that this changes the return value
* in an array where every element is an array consisting of the matched string at index 0 and
* its string offset into subject at index 1.
* @param int $offset (optional) Normally, the search starts from the beginning of the subject string. The
* optional parameter offset can be used to specify the alternate place from which to start
* the search.
* @param string $encoding (optional) The used internally by this function character encoding. If it is omitted,
* the platform character set will be used by default.
*
* @return int|bool returns the number of times pattern matches or FALSE if an error occurred
*
@ -1464,24 +1455,24 @@ function api_preg_match(
/**
* Performs a global regular expression match, UTF-8 aware when it is applicable.
*
* @param string $pattern the pattern to search for, as a string
* @param string $subject the input string
* @param array &$matches (optional) Array of all matches in multi-dimensional array ordered according to $flags
* @param int $flags (optional) Can be a combination of the following flags (note that it doesn't
* make sense to use PREG_PATTERN_ORDER together with PREG_SET_ORDER): PREG_PATTERN_ORDER -
* orders results so that $matches[0] is an array of full pattern matches, $matches[1] is an
* array of strings matched by the first parenthesized subpattern, and so on; PREG_SET_ORDER -
* orders results so that $matches[0] is an array of first set of matches, $matches[1] is an
* array of second set of matches, and so on; PREG_OFFSET_CAPTURE - If this flag is passed,
* for every occurring match the appendant string offset will also be returned. Note that this
* changes the value of matches in an array where every element is an array consisting of the
* matched string at offset 0 and its string offset into subject at offset 1. If no order flag
* is given, PREG_PATTERN_ORDER is assumed.
* @param int $offset (optional) Normally, the search starts from the beginning of the subject string. The
* optional parameter offset can be used to specify the alternate place from which to start
* the search.
* @param string $encoding (optional) The used internally by this function character encoding. If it is omitted,
* the platform character set will be used by default.
* @param string $pattern the pattern to search for, as a string
* @param string $subject the input string
* @param array &$matches (optional) Array of all matches in multi-dimensional array ordered according to $flags
* @param int $flags (optional) Can be a combination of the following flags (note that it doesn't
* make sense to use PREG_PATTERN_ORDER together with PREG_SET_ORDER): PREG_PATTERN_ORDER -
* orders results so that $matches[0] is an array of full pattern matches, $matches[1] is an
* array of strings matched by the first parenthesized subpattern, and so on; PREG_SET_ORDER -
* orders results so that $matches[0] is an array of first set of matches, $matches[1] is an
* array of second set of matches, and so on; PREG_OFFSET_CAPTURE - If this flag is passed,
* for every occurring match the appendant string offset will also be returned. Note that this
* changes the value of matches in an array where every element is an array consisting of the
* matched string at offset 0 and its string offset into subject at offset 1. If no order flag
* is given, PREG_PATTERN_ORDER is assumed.
* @param int $offset (optional) Normally, the search starts from the beginning of the subject string. The
* optional parameter offset can be used to specify the alternate place from which to start
* the search.
* @param string $encoding (optional) The used internally by this function character encoding. If it is omitted,
* the platform character set will be used by default.
*
* @return int|bool returns the number of full pattern matches (which might be zero), or FALSE if an error occurred
*
@ -1502,14 +1493,14 @@ function api_preg_match_all($pattern, $subject, &$matches, $flags = PREG_PATTERN
/**
* Performs a regular expression search and replace, UTF-8 aware when it is applicable.
*
* @param string|array $pattern The pattern to search for. It can be either a string or an array with strings.
* @param string|array $replacement the string or an array with strings to replace
* @param string|array $subject the string or an array with strings to search and replace
* @param int $limit The maximum possible replacements for each pattern in each subject string.
* Defaults to -1 (no limit).
* @param int &$count If specified, this variable will be filled with the number of replacements done
* @param string $encoding (optional) The used internally by this function character encoding.
* If it is omitted, the platform character set will be used by default.
* @param string|array $pattern The pattern to search for. It can be either a string or an array with strings.
* @param string|array $replacement the string or an array with strings to replace
* @param string|array $subject the string or an array with strings to search and replace
* @param int $limit The maximum possible replacements for each pattern in each subject string.
* Defaults to -1 (no limit).
* @param int &$count If specified, this variable will be filled with the number of replacements done
* @param string $encoding (optional) The used internally by this function character encoding.
* If it is omitted, the platform character set will be used by default.
*
* @return array|string|null returns an array if the subject parameter is an array, or a string otherwise.
* If matches are found, the new subject will be returned, otherwise subject will be returned

@ -1544,7 +1544,6 @@ class MySpace
$tpl = new Template('', false, false, false, false, false, false);
$data = null;
$time_spent = 0;
$progress = 0;
$nb_progress_lp = 0;
@ -1732,7 +1731,6 @@ class MySpace
$csv_row = [];
$csv_row[] = $course_title;
$time_spent = 0;
$progress = 0;
$nb_progress_lp = 0;

@ -247,7 +247,7 @@ class SystemAnnouncementManager
* Makes the announcement id visible only for groups in groups_array.
*
* @param int $announcement_id
* @param array $group_array array of group id
* @param array $group_array array of group id
*
* @return bool
*/
@ -308,11 +308,11 @@ class SystemAnnouncementManager
/**
* Updates an announcement to the database.
*
* @param int $id of the announcement
* @param string $title title of the announcement
* @param string $content content of the announcement
* @param array $date_start start date (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute)
* @param array $date_end end date of (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute)
* @param int $id of the announcement
* @param string $title title of the announcement
* @param string $content content of the announcement
* @param array $date_start start date (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute)
* @param array $date_end end date of (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute)
* @param array $visibility
* @param array $lang
* @param int $send_mail

@ -2275,8 +2275,8 @@ class Tracking
* @param string code
* @param int id (optional), filtered by exercise
* @param int id (optional), if param $sessionId is null
* it'll return results including sessions, 0 = session is not
* filtered
* it'll return results including sessions, 0 = session is not
* filtered
*
* @return string value (number %) Which represents a round integer about the score average
*/
@ -2582,7 +2582,6 @@ class Tracking
* course, it will take into account the progress that were not started.
*
* @param int|array $studentId
* @param Course $course
* @param array $lpIdList Limit average to listed lp ids
* @param SessionEntity $session Session id (optional),
* if parameter $sessionId is null(default) it'll return results including
@ -2752,7 +2751,6 @@ class Tracking
* 3. And finally it will return the average between 1. and 2.
*
* @param mixed $student_id Array of user ids or an user id
* @param Course $course
* @param array $lp_ids List of LP ids
* @param SessionEntity $session
* if param $sessionId is null(default) it'll return results
@ -2763,9 +2761,9 @@ class Tracking
* @param bool $getOnlyBestAttempt
*
* @return string value (number %) Which represents a round integer explain in got in 3
*
* @todo improve performance, when loading 1500 users with 20 lps the script dies
* This function does not take the results of a Test out of a LP
*
*/
public static function get_avg_student_score(
$student_id,
@ -3146,7 +3144,7 @@ class Tracking
* @param int|array $student_id Array of user ids or an user id
* @param string $course_code Course code
* @param array $lp_ids List of LP ids
* @param int $sessionId Session id (optional), if param $sessionId is 0(default)
* @param int $sessionId Session id (optional), if param $sessionId is 0(default)
* it'll return results including sessions, 0 = session is not filtered
*
* @return string value (number %) Which represents a round integer explain in got in 3
@ -3222,11 +3220,11 @@ class Tracking
/**
* This function gets time spent in learning path for a student inside a course.
*
* @param int|array $student_id Student id(s)
* @param Course $course Course code
* @param array $lp_ids Limit average to listed lp ids
* @param int|array $student_id Student id(s)
* @param Course $course Course code
* @param array $lp_ids Limit average to listed lp ids
* @param int $sessionId Session id (optional), if param $sessionId is null(default)
* it'll return results including sessions, 0 = session is not filtered
* it'll return results including sessions, 0 = session is not filtered
*
* @return int Total time in seconds
*/
@ -4006,7 +4004,7 @@ class Tracking
* This function counts the number of post by course.
*
* @param string $course_code
* @param int $sessionId (optional), if is null(default) it'll return results including sessions,
* @param int $sessionId (optional), if is null(default) it'll return results including sessions,
* 0 = session is not filtered
* @param int $groupId
*
@ -4333,7 +4331,7 @@ class Tracking
/**
* Get course list inside a session from a student.
*
* @param int $user_id Student id
* @param int $user_id Student id
* @param int $sessionId Session id (optional)
*
* @return array Courses list
@ -5419,10 +5417,10 @@ class Tracking
/**
* Shows the user detail progress (when clicking in the details link).
*
* @param int $userId
* @param int $courseId
* @param int $sessionId
* @param bool $showDiagram
* @param int $userId
* @param int $courseId
* @param int $sessionId
* @param bool $showDiagram
*
* @return string html code
*/
@ -7703,13 +7701,13 @@ class Tracking
['cidReq' => $courseInfo['code'], 'id_session' => $sessionId, 'exerciseId' => $exercices['id']]
);
if ($visibleReturn['value'] == true) {
if (true == $visibleReturn['value']) {
$exercices['title'] = Display::url(
$exercices['title'],
$url,
['target' => SESSION_LINK_TARGET]
);
} elseif ($exercices['active'] == -1) {
} elseif (-1 == $exercices['active']) {
$exercices['title'] = sprintf(get_lang('XParenthesisDeleted'), $exercices['title']);
}
@ -7785,7 +7783,7 @@ class Tracking
$latestAttemptUrl
);
$myScore = !empty($weighting) && intval($weighting) != 0 ? $score / $weighting : 0;
$myScore = !empty($weighting) && 0 != intval($weighting) ? $score / $weighting : 0;
//@todo this function slows the page
if (is_int($userList)) {
@ -7837,7 +7835,7 @@ class Tracking
$columnHeaders,
function ($columHeader, $key) use ($trackingColumns) {
if (!isset($trackingColumns['my_progress_lp'][$key])
|| $trackingColumns['my_progress_lp'][$key] == false
|| false == $trackingColumns['my_progress_lp'][$key]
) {
return false;
}
@ -7901,7 +7899,7 @@ class Tracking
);
if (in_array('lp', $columnHeadersKeys)) {
if ($learnpath['lp_visibility'] == 0) {
if (0 == $learnpath['lp_visibility']) {
$learningpathData[] = $learnpath['lp_name'];
} else {
$learningpathData[] = Display::url(

@ -123,6 +123,7 @@ class UrlManager
$sql = "SELECT id FROM $table
WHERE url = '".Database::escape_string($url)."' ";
$res = Database::query($sql);
return (int) Database::num_rows($res);
}

@ -3,7 +3,6 @@
use Chamilo\CoreBundle\Entity\ExtraField as EntityExtraField;
use Chamilo\CoreBundle\Entity\ExtraFieldSavedSearch;
use Chamilo\CoreBundle\Entity\ResourceNode;
use Chamilo\CoreBundle\Entity\SkillRelUser;
use Chamilo\CoreBundle\Entity\SkillRelUserComment;
use Chamilo\CoreBundle\Entity\User;
@ -147,6 +146,7 @@ class UserManager
Display::addFlash(
Display::return_message(get_lang('A user creator is needed'))
);
return false;
}
@ -249,7 +249,7 @@ class UserManager
if (empty($expirationDate) || '0000-00-00 00:00:00' === $expirationDate) {
$expirationDate = null;
// Default expiration date
// Default expiration date
// if there is a default duration of a valid account then
// we have to change the expiration_date accordingly
// Accept 0000-00-00 00:00:00 as a null value to avoid issues with
@ -2105,7 +2105,7 @@ class UserManager
$sqlf .= " AND filter = $field_filter ";
}
$sqlf .= " ORDER BY `".$columns[$column]."` $sort_direction ";
if ($number_of_items != 0) {
if (0 != $number_of_items) {
$sqlf .= " LIMIT ".intval($from).','.intval($number_of_items);
}
$resf = Database::query($sqlf);
@ -4383,7 +4383,7 @@ class UserManager
* Get users followed by human resource manager.
*
* @param int $userId
* @param int $userStatus Filter users by status (STUDENT, COURSEMANAGER, etc)
* @param int $userStatus Filter users by status (STUDENT, COURSEMANAGER, etc)
* @param bool $getOnlyUserId
* @param bool $getSql
* @param bool $getCount
@ -4393,7 +4393,7 @@ class UserManager
* @param string $direction
* @param int $active
* @param string $lastConnectionDate
* @param int $status the function is called by who? COURSEMANAGER, DRH?
* @param int $status the function is called by who? COURSEMANAGER, DRH?
* @param string $keyword
* @param bool $checkSessionVisibility
*
@ -5065,8 +5065,8 @@ class UserManager
/**
* Subscribe boss to students.
*
* @param int $bossId The boss id
* @param array $usersId The users array
* @param int $bossId The boss id
* @param array $usersId The users array
* @param bool $deleteOtherAssignedUsers
*
* @return int Affected rows
@ -5358,6 +5358,7 @@ class UserManager
if ($userId > 0) {
$userRelTable = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
return Database::select(
'DISTINCT friend_user_id AS boss_id',
$userRelTable,

@ -1046,6 +1046,7 @@ class Rest extends WebService
return $userList;
}
/**
* @param string $subject
* @param string $text
@ -1174,7 +1175,6 @@ class Rest extends WebService
$idCampus, //$urlId
true //AlsoSearchCode
);
}
/**
@ -1260,7 +1260,7 @@ class Rest extends WebService
$params['course_language'] = $language;
foreach ($courseParam as $key => $value) {
if (substr($key, 0, 6) === 'extra_') { //an extra field
if ('extra_' === substr($key, 0, 6)) { //an extra field
$params[$key] = $value;
}
}

@ -4,16 +4,10 @@
use Chamilo\CoreBundle\DataFixtures\LanguageFixtures;
use Chamilo\CoreBundle\Entity\AccessUrl;
use Chamilo\CoreBundle\Entity\BranchSync;
use Chamilo\CoreBundle\Entity\Group;
use Chamilo\CoreBundle\Entity\TicketCategory;
use Chamilo\CoreBundle\Entity\TicketPriority;
use Chamilo\CoreBundle\Entity\TicketProject;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CoreBundle\Repository\GroupRepository;
use Chamilo\CoreBundle\Repository\Node\AccessUrlRepository;
use Chamilo\CoreBundle\Repository\Node\UserRepository;
use Chamilo\CoreBundle\ToolChain;
use Doctrine\Migrations\Configuration\Connection\ExistingConnection;
use Doctrine\Migrations\Configuration\Migration\PhpFile;
@ -21,7 +15,6 @@ use Doctrine\Migrations\DependencyFactory;
use Doctrine\Migrations\Query\Query;
use Doctrine\ORM\EntityManager;
use Symfony\Component\DependencyInjection\Container as SymfonyContainer;
use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
/*
* Chamilo LMS
@ -423,7 +416,7 @@ function display_language_selection_box($name = 'language_list', $default_langua
// Displaying the box.
return Display::select(
'language_list',
array_column(LanguageFixtures::getLanguages(),'english_name', 'isocode'),
array_column(LanguageFixtures::getLanguages(), 'english_name', 'isocode'),
$default_language,
['class' => 'form-control'],
false

@ -3,7 +3,6 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CLp;
use ChamiloSession as Session;
/**

@ -173,4 +173,3 @@ switch ($type) {
case 'step':
break;
}*/

@ -2,9 +2,6 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CLp;
/**
* This script contains the server part of the xajax interaction process.
* This script, in particular, enables the process of SCO's initialization. It

@ -2,7 +2,6 @@
/* For licensing terms, see /license.txt */
/**
* This script contains the server part of the xajax interaction process. The client part is located
* in lp_api.php or other api's.

@ -1,8 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CLp;
use ChamiloSession as Session;
/**

@ -695,7 +695,7 @@ switch ($action) {
if (!$lp_found) {
require 'lp_list.php';
} else {
$result = ScormExport::exportToPdf($lpId, api_get_course_info());;
$result = ScormExport::exportToPdf($lpId, api_get_course_info());
if (!$result) {
require 'lp_list.php';
}

@ -2,7 +2,6 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Framework\Container;
use ChamiloSession as Session;
/**
@ -97,7 +96,6 @@ if (isset($is_success) && true === $is_success) {
Session::erase('finalItem');
}
$tpl = new Template();
$tpl->assign('actions', $learnPath->build_action_menu(true));
$tpl->assign('left', $learnPath->showBuildSideBar());

@ -69,4 +69,3 @@ $tpl->assign('actions', $lp->build_action_menu(true));
$tpl->assign('left', $lp->showBuildSideBar());
$tpl->assign('right', $right);
$tpl->displayTwoColTemplate();

@ -4,7 +4,6 @@
use Chamilo\CourseBundle\Component\CourseCopy\CourseArchiver;
use Chamilo\CourseBundle\Component\CourseCopy\CourseRestorer;
use Chamilo\CourseBundle\Entity\CLp;
/**
* Script managing the learnpath upload. To best treat the uploaded file, make sure we can identify it.

@ -120,7 +120,7 @@ if (is_object($lp)) {
echo $lp->build_action_menu();
echo '<div class="row">';
echo '<div class="col-md-3">';
echo $lp->return_new_tree();exit;
echo $lp->return_new_tree(); exit;
echo '</div>';
echo '<div class="col-md-9">';
echo $lp->display_item($lpItem);

@ -9,7 +9,6 @@
* @author Eric Marguin <eric.marguin@dokeos.com>
* @license GNU/GPL
*/
class OpenofficePresentation extends OpenofficeDocument
{
public $take_slide_name;

@ -1001,6 +1001,4 @@ class scorm extends learnpath
return api_detect_encoding($test_string);
}
}

@ -28,7 +28,6 @@ if ($allowSocial) {
}
$interbreadcrumb[] = ['url' => 'inbox.php', 'name' => get_lang('Messages')];
$actions = '';
if ($allowMessage) {
$actions .= '<a href="'.api_get_path(WEB_PATH).'main/messages/new_message.php">'.

@ -1,8 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Framework\Container;
/**
* Homepage for the MySpace directory.
*/

@ -2,10 +2,10 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\Usergroup;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CLpCategory;
use Chamilo\CourseBundle\Entity\CQuiz;
use Chamilo\CoreBundle\Entity\Usergroup;
use Chamilo\CourseBundle\Entity\CStudentPublication;
use ChamiloSession as Session;
@ -2132,7 +2132,6 @@ if (empty($details)) {
echo '<td class="text-center">'.
api_convert_and_format_date($result->getSentDate()).' </td>';
echo '<td class="text-center">';
if ($assignment && !empty($assignment->getExpiresOn())) {
echo api_convert_and_format_date($assignment->getExpiresOn());

@ -650,10 +650,10 @@ echo Display::page_header($tool_name.' ('.$session_info['name'].') - '.$courseIn
?>
<form name="formulaire" method="post"
action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&course_id=<?php echo $courseId; ?>&id_session=<?php echo $id_session; ?><?php if (!empty($addProcess)) {
echo '&add=true';
} ?>" <?php if ($ajax_search) {
echo ' onsubmit="valide();"';
} ?>>
echo '&add=true';
} ?>" <?php if ($ajax_search) {
echo ' onsubmit="valide();"';
} ?>>
<?php
if ('multiple' === $add_type) {
if (is_array($extra_field_list)) {

@ -115,9 +115,7 @@ if (isset($_GET['search']) && 'advanced' === $_GET['search']) {
</div>
</form>';
echo Display::toolbarAction('category', [$actionsLeft, $actionsRight]);
?>
echo Display::toolbarAction('category', [$actionsLeft, $actionsRight]); ?>
<form method="post" action="<?php echo api_get_self(); ?>?action=delete&sort=<?php echo $sort; ?>"
onsubmit="if(!confirm('<?php echo get_lang('Please confirm your choice'); ?>')) return false;">
<?php

@ -166,4 +166,3 @@ $form->setDefaults(['id_coach' => $selected]);
$form->display();
Display::display_footer();

@ -457,7 +457,7 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
}
Display::display_header($tool_name);
$actions = '<a href="../session/session_list.php">'.
$actions = '<a href="../session/session_list.php">'.
Display::return_icon('back.png', get_lang('Back to').' '.get_lang('Administration'), '', ICON_SIZE_MEDIUM).
'</a>';
echo Display::toolbarAction('session_import', [$actions]);

@ -7,7 +7,6 @@ use Chamilo\CoreBundle\Entity\Usergroup;
/**
* @author Julio Montoya <gugli100@gmail.com>
*/
$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';

@ -1256,7 +1256,6 @@ if (isset($questions) && is_array($questions)) {
}
foreach ($questions as $key => &$question) {
$ch_type = 'ch_'.$question['type'];
$questionNumber = $questionCounter;
$display = new $ch_type();

@ -41,7 +41,7 @@ if ($hashIsValid && $course) {
api_get_session_entity()
);
if ($invitation) {
$link = SurveyUtil::generateFillSurveyLink($survey,$invitationCode, $course, $sessionId);
$link = SurveyUtil::generateFillSurveyLink($survey, $invitationCode, $course, $sessionId);
header('Location: '.$link);
exit;
}

@ -9,7 +9,6 @@ use Chamilo\CoreBundle\Framework\Container;
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University: cleanup,
* refactoring and rewriting large parts of the code
*/
require_once __DIR__.'/../inc/global.inc.php';
$htmlHeadXtra[] = '<script>'.api_get_language_translate_html().'</script>';

@ -1215,7 +1215,7 @@ class SurveyManager
$survey_id = (int) $survey_id;
/*$sql = "DELETE FROM $table_survey_question
WHERE $course_condition survey_id = '".$survey_id."'";
WHERE $course_condition survey_id = '".$survey_id."'";
// Deleting the survey questions
Database::query($sql);*/

@ -2,9 +2,9 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\Session as SessionEntity;
use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CourseBundle\Entity\CGroup;
use Chamilo\CourseBundle\Entity\CSurvey;
use Chamilo\CourseBundle\Entity\CSurveyAnswer;
@ -595,7 +595,7 @@ class SurveyUtil
// Getting the question information
/*$sql = "SELECT * FROM $table_survey_question
WHERE
WHERE
survey_id = $surveyId AND
survey_question NOT LIKE '%{{%' AND
type <>'pagebreak'
@ -928,10 +928,10 @@ class SurveyUtil
/**
* This functions displays the complete reporting.
*
* @param int $userId
* @param bool $addActionBar
* @param bool $addFilters
* @param bool $addExtraFields
* @param int $userId
* @param bool $addActionBar
* @param bool $addFilters
* @param bool $addExtraFields
*
* @return string
*/
@ -2508,10 +2508,10 @@ class SurveyUtil
}
/**
* @param int $courseId
* @param int $sessionId
* @param int $groupId
* @param int $surveyId
* @param int $courseId
* @param int $sessionId
* @param int $groupId
* @param int $surveyId
*
* @return int
*/
@ -2736,6 +2736,7 @@ class SurveyUtil
* @param int $surveyId
*
* @return array Database rows matching the survey code
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
*
* @version September 2007
@ -3219,7 +3220,7 @@ class SurveyUtil
$search_restriction = "WHERE c_id = $course_id";
}
$sql = "SELECT count(iid) AS total_number_of_items
FROM $table_survey $search_restriction";
FROM $table_survey $search_restriction";
$res = Database::query($sql);
$obj = Database::fetch_object($res);
@ -4019,8 +4020,7 @@ class SurveyUtil
}
/**
* @param string $code invitation code
* @param Course $course
* @param string $code invitation code
* @param int $sessionId
*
* @return string

@ -127,7 +127,7 @@ $ticket_id = (int) $_REQUEST['ticket_id'];
$ticket = TicketManager::get_ticket_detail_by_id($ticket_id);
if (empty($ticket)) {
api_not_allowed(true);
}
}
$projectId = $ticket['ticket']['project_id'];
$userIsAllowInProject = TicketManager::userIsAllowInProject($userInfo, $projectId);
$allowEdition = $ticket['ticket']['assigned_last_user'] == $user_id ||
@ -202,49 +202,49 @@ foreach ($messages as $message) {
$subject = get_lang('Re:').': '.Security::remove_XSS($ticket['ticket']['subject']);
if ($allowEdition &&
$ticket['ticket']['status_id'] != TicketManager::STATUS_FORWARDED &&
$ticket['ticket']['status_id'] != TicketManager::STATUS_CLOSE
TicketManager::STATUS_FORWARDED != $ticket['ticket']['status_id'] &&
TicketManager::STATUS_CLOSE != $ticket['ticket']['status_id']
) {
$form = getForm($ticket['ticket']);
$formToShow = $form->returnForm();
if ($form->validate()) {
$ticket_id = (int) $_POST['ticket_id'];
$messageToSend = '';
$message = isset($_POST['confirmation']) ? true : false;
$file_attachments = $_FILES;
if ($isAdmin) {
$oldUserId = $ticket['ticket']['assigned_last_user'];
if (isset($_POST['assigned_last_user']) && !empty($_POST['assigned_last_user']) &&
$form = getForm($ticket['ticket']);
$formToShow = $form->returnForm();
if ($form->validate()) {
$ticket_id = (int) $_POST['ticket_id'];
$messageToSend = '';
$message = isset($_POST['confirmation']) ? true : false;
$file_attachments = $_FILES;
if ($isAdmin) {
$oldUserId = $ticket['ticket']['assigned_last_user'];
if (isset($_POST['assigned_last_user']) && !empty($_POST['assigned_last_user']) &&
$_POST['assigned_last_user'] != $oldUserId
) {
TicketManager::assignTicketToUser(
TicketManager::assignTicketToUser(
$ticket_id,
$_POST['assigned_last_user']
);
$oldUserName = '-';
if (!empty($oldUserId)) {
$oldUserInfo = api_get_user_info($oldUserId);
$oldUserName = $oldUserInfo['complete_name_with_message_link'];
}
$userCompleteName = '-';
if (!empty($_POST['assigned_last_user'])) {
$userInfo = api_get_user_info(
$oldUserName = '-';
if (!empty($oldUserId)) {
$oldUserInfo = api_get_user_info($oldUserId);
$oldUserName = $oldUserInfo['complete_name_with_message_link'];
}
$userCompleteName = '-';
if (!empty($_POST['assigned_last_user'])) {
$userInfo = api_get_user_info(
$_POST['assigned_last_user']
);
$userCompleteName = $userInfo['complete_name_with_message_link'];
}
$userCompleteName = $userInfo['complete_name_with_message_link'];
}
$messageToSend .= sprintf(
$messageToSend .= sprintf(
get_lang('Assignee changed from %s to %s'),
$oldUserName,
$userCompleteName
).'<br />';
}
}
TicketManager::updateTicket(
TicketManager::updateTicket(
[
'priority_id' => (int) $_POST['priority_id'],
'status_id' => (int) $_POST['status_id'],
@ -253,55 +253,55 @@ if ($allowEdition &&
api_get_user_id()
);
if ($_POST['priority_id'] != $ticket['ticket']['priority_id']) {
$newPriority = TicketManager::getPriority(
if ($_POST['priority_id'] != $ticket['ticket']['priority_id']) {
$newPriority = TicketManager::getPriority(
$_POST['priority_id']
);
$newPriorityTitle = '-';
if ($newPriority) {
$newPriorityTitle = $newPriority->getName();
}
$oldPriority = TicketManager::getPriority(
$newPriorityTitle = '-';
if ($newPriority) {
$newPriorityTitle = $newPriority->getName();
}
$oldPriority = TicketManager::getPriority(
$ticket['ticket']['priority_id']
);
$oldPriorityTitle = '-';
if ($oldPriority) {
$oldPriorityTitle = $oldPriority->getName();
}
$messageToSend .= sprintf(
$oldPriorityTitle = '-';
if ($oldPriority) {
$oldPriorityTitle = $oldPriority->getName();
}
$messageToSend .= sprintf(
get_lang('Priority changed from %s to %s'),
$oldPriorityTitle,
$newPriorityTitle
).'<br />';
}
}
if ($_POST['status_id'] != $ticket['ticket']['status_id']) {
$newStatus = TicketManager::getStatus(
if ($_POST['status_id'] != $ticket['ticket']['status_id']) {
$newStatus = TicketManager::getStatus(
$_POST['status_id']
);
$newTitle = '-';
if ($newStatus) {
$newTitle = $newStatus->getName();
}
$oldStatus = TicketManager::getStatus(
$newTitle = '-';
if ($newStatus) {
$newTitle = $newStatus->getName();
}
$oldStatus = TicketManager::getStatus(
$ticket['ticket']['status_id']
);
$oldStatusTitle = '-';
if ($oldStatus) {
$oldStatusTitle = $oldStatus->getName();
}
$oldStatusTitle = '-';
if ($oldStatus) {
$oldStatusTitle = $oldStatus->getName();
}
$messageToSend .= sprintf(
$messageToSend .= sprintf(
get_lang('Status changed from %s to %s'),
$oldStatusTitle,
$newTitle
).'<br />';
}
}
}
$messageToSend .= $_POST['content'];
$messageToSend .= $_POST['content'];
TicketManager::insertMessage(
TicketManager::insertMessage(
$ticket_id,
$_POST['subject'],
$messageToSend,
@ -311,17 +311,17 @@ if ($allowEdition &&
$message
);
TicketManager::sendNotification(
TicketManager::sendNotification(
$ticket_id,
get_lang('TicketUpdate successful'),
$messageToSend
);
Display::addFlash(Display::return_message(get_lang('Saved.')));
header('Location:'.api_get_self().'?ticket_id='.$ticket_id);
exit;
}
Display::addFlash(Display::return_message(get_lang('Saved.')));
header('Location:'.api_get_self().'?ticket_id='.$ticket_id);
exit;
}
}
Display::display_header();
echo '<div class="actions">';

@ -309,7 +309,7 @@ if (!empty($projectId)) {
);
if ($isAllow) {
echo Display::toolbarAction('toolbar-options', [$options,]);
echo Display::toolbarAction('toolbar-options', [$options]);
}
$advancedSearchForm = new FormValidator(

@ -234,25 +234,25 @@ if (!empty($courseList)) {
if ($global) {
$qb = $quizRepo->getResourcesByCourse($course);
$exercises = $qb->getQuery()->getResult();
/*$sql = "SELECT quiz.title, iid, session_id
FROM $quizTable AS quiz
WHERE c_id = $courseId AND active = 1
ORDER BY session_id, quiz.title ASC";*/
/*$sql = "SELECT quiz.title, iid, session_id
FROM $quizTable AS quiz
WHERE c_id = $courseId AND active = 1
ORDER BY session_id, quiz.title ASC";*/
} else {
//$sessionCondition = api_get_session_condition($sessionId, true, false);
if (!empty($exerciseId)) {
$exercises = [];
$exercises[] = $quizRepo->find($exerciseId);
/*
$sql = "SELECT quiz.title, iid, session_id
FROM $quizTable AS quiz
WHERE
c_id = $courseId AND
active = 1 AND
id = $exerciseId
$sessionCondition
ORDER BY session_id, quiz.title ASC";
*/
/*
$sql = "SELECT quiz.title, iid, session_id
FROM $quizTable AS quiz
WHERE
c_id = $courseId AND
active = 1 AND
id = $exerciseId
$sessionCondition
ORDER BY session_id, quiz.title ASC";
*/
} else {
$qb = $quizRepo->getResourcesByCourse($course, api_get_session_entity());
$exercises = $qb->getQuery()->getResult();

@ -34,7 +34,7 @@ if (empty($careerInfo)) {
}
$allow = UserManager::userHasCareer($userId, $careerId) || api_is_platform_admin() || api_is_drh();
if ($allow === false) {
if (false === $allow) {
api_not_allowed(true);
}

@ -13,7 +13,6 @@ use Chamilo\CoreBundle\Framework\Container;
* @author Roan Embrechts
* @author Julio Montoya, Several fixes
*/
$use_anonymous = true;
require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_USER;
@ -627,7 +626,6 @@ if ($canRead) {
Display::return_icon('pdf.png', get_lang('Export to PDF'), [], ICON_SIZE_MEDIUM).'</a> ';
}
// Build search-form
$form = new FormValidator(
'search_user',

@ -110,7 +110,6 @@ if (!empty($my_folder_data)) {
}
}
$interbreadcrumb[] = [
'url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(),
'name' => get_lang('Assignments'),

@ -282,17 +282,17 @@ function getWorkList($id, $my_folder_data, $add_in_where_query = null, $course_i
if ($is_allowed_to_edit) {
$qb->andWhere($qb->expr()->in('resource.active', [1, 0]));
$qb->andWhere($qb->expr()->isNull('resource.publicationParent'));
/*$active_condition = ' active IN (0, 1)';
$sql = "SELECT * FROM $work_table
WHERE
c_id = $course_id
$add_in_where_query
$condition_session AND
$active_condition AND
(parent_id = 0)
$contains_file_query AND
post_group_id = $groupIid
ORDER BY sent_date DESC";*/
/*$active_condition = ' active IN (0, 1)';
$sql = "SELECT * FROM $work_table
WHERE
c_id = $course_id
$add_in_where_query
$condition_session AND
$active_condition AND
(parent_id = 0)
$contains_file_query AND
post_group_id = $groupIid
ORDER BY sent_date DESC";*/
} else {
if (!empty($group_id)) {
// set to select only messages posted by the user's group
@ -1236,7 +1236,6 @@ function getWorkListStudent(
->setMaxResults($limit)
;
/*$sql = "$select
FROM $workTable w
LEFT JOIN $workTableAssignment a
@ -2266,7 +2265,7 @@ function get_work_user_list(
}
$feedback = '';
$count = count($studentPublication->getComments());// getWorkCommentCount($item_id, $course_info);
$count = count($studentPublication->getComments()); // getWorkCommentCount($item_id, $course_info);
if (null !== $count && !empty($count)) {
if ($qualification_exists) {
$feedback .= ' ';
@ -3787,8 +3786,8 @@ function getWorkDescriptionToolbar()
function getWorkComments(CStudentPublication $work)
{
$comments = $work->getComments();
$commentList = [];
$comments = $work->getComments();
$commentList = [];
if (!empty($comments)) {
foreach ($comments as $comment) {
//$userInfo = api_get_user_info($comment['user_id']);
@ -5190,23 +5189,23 @@ function updatePublicationAssignment($workId, $params, $courseInfo, $groupId)
;
$em->persist($publication);
/*$sql = "INSERT INTO $table SET
c_id = $course_id ,
$expiryDateCondition
$endOnCondition
add_to_calendar = $agendaId,
enable_qualification = '$qualification',
publication_id = '$workId'";
Database::query($sql);
$my_last_id = Database::insert_id();
/*$sql = "INSERT INTO $table SET
c_id = $course_id ,
$expiryDateCondition
$endOnCondition
add_to_calendar = $agendaId,
enable_qualification = '$qualification',
publication_id = '$workId'";
Database::query($sql);
$my_last_id = Database::insert_id();
if ($my_last_id) {
$sql = "UPDATE $workTable SET
has_properties = $my_last_id,
view_properties = 1
WHERE iid = $workId";
Database::query($sql);
}*/
if ($my_last_id) {
$sql = "UPDATE $workTable SET
has_properties = $my_last_id,
view_properties = 1
WHERE iid = $workId";
Database::query($sql);
}*/
} else {
$assignment = $em->getRepository(CStudentPublicationAssignment::class)->find($data['iid']);
/*$sql = "UPDATE $table SET
@ -5306,7 +5305,7 @@ function deleteAllWorkPerUser(User $user, Course $course)
/**
* @param int $item_id
* @param Course $course course info
* @param Course $course course info
*
* @return bool
*/

@ -18,7 +18,6 @@ if (empty($workId) || empty($courseInfo)) {
}
$course = api_get_course_entity();
// Student publications are saved with the iid in a LP
$origin = api_get_origin();
if ('learnpath' === $origin) {

@ -4,8 +4,6 @@
* Strings to Dutch L10n.
*
* @author Yannick Warnier <yannick.warnier@beeznest.com>
*
* @package chamilo.plugin.azure_active_directory
*/
$strings['plugin_title'] = 'Azure Active Directory';
$strings['plugin_comment'] = 'Sta authenticatie met Microsoft\'s Azure Active Directory toe';

@ -4,8 +4,6 @@
* Strings to English L10n.
*
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
*
* @package chamilo.plugin.azure_active_directory
*/
$strings['plugin_title'] = 'Azure Active Directory';
$strings['plugin_comment'] = 'Allow authentication with Microsoft\'s Azure Active Directory';

@ -4,8 +4,6 @@
* Strings to French L10n.
*
* @author Yannick Warnier <yannick.warnier@beeznest.com>
*
* @package chamilo.plugin.azure_active_directory
*/
$strings['plugin_title'] = 'Azure Active Directory';
$strings['plugin_comment'] = 'Permet l\'authentification des utilisateurs via Azure Active Directory de Microsoft';

@ -4,8 +4,6 @@
* Strings to Spanish L10n.
*
* @author Yannick Warnier <yannick.warnier@beeznest.com>
*
* @package chamilo.plugin.azure_active_directory
*/
$strings['plugin_title'] = 'Azure Active Directory';
$strings['plugin_comment'] = 'Permite la autenticación de usuarios por Azure Active Directory de Microsoft';

@ -7,8 +7,6 @@ use TheNetworg\OAuth2\Client\Provider\Azure;
* AzureActiveDirectory plugin class.
*
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
*
* @package chamilo.plugin.azure_active_directory
*/
class AzureActiveDirectory extends Plugin
{

@ -76,7 +76,7 @@ try {
if (empty($userId)) {
// If we didn't find the user
if ($plugin->get(AzureActiveDirectory::SETTING_PROVISION_USERS) === 'true') {
if ('true' === $plugin->get(AzureActiveDirectory::SETTING_PROVISION_USERS)) {
// If the option is set to create users, create it
$userId = UserManager::create_user(
$me['givenName'],
@ -112,7 +112,7 @@ try {
throw new Exception('User '.$userId.' not found.');
}
if ($userInfo['active'] != '1') {
if ('1' != $userInfo['active']) {
throw new Exception(get_lang('AccountInactive'));
}
} catch (Exception $exception) {

@ -2,9 +2,7 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CourseBundle\Entity\CLp;
use Chamilo\UserBundle\Entity\User;
/**
* Responses to AJAX calls.

@ -2,7 +2,6 @@
/* For license terms, see /license.txt */
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Entity\SessionRelCourseRelUser;
use Chamilo\CourseBundle\Entity\CLp;
use Chamilo\UserBundle\Entity\User;

@ -173,7 +173,6 @@ if ($form->validate()) {
}
throw new Exception('@todo custom certificate upload');
if ($_FILES[$field]['size']) {
$newPicture = api_upload_file(
'certificates',

@ -8,7 +8,12 @@ use Chamilo\PluginBundle\WhispeakAuth\Request\ApiRequest;
use Chamilo\UserBundle\Entity\User;
use ChamiloSession;
use Display;
use Exception;
use Exercise;
use learnpath;
use Login;
use Template;
use UserManager;
use WhispeakAuthPlugin;
/**
@ -17,12 +22,12 @@ use WhispeakAuthPlugin;
class AuthenticationController extends BaseController
{
/**
* @throws \Exception
* @throws Exception
*/
public function index()
{
if (!$this->plugin->toolIsEnabled()) {
throw new \Exception(get_lang('NotAllowed'));
throw new Exception(get_lang('NotAllowed'));
}
/** @var array $lpQuestionInfo */
@ -46,9 +51,9 @@ class AuthenticationController extends BaseController
/** @var array $lpItemInfo */
$lpItemInfo = ChamiloSession::read(WhispeakAuthPlugin::SESSION_LP_ITEM, []);
/** @var \learnpath $oLp */
/** @var learnpath $oLp */
$oLp = ChamiloSession::read('oLP', null);
/** @var \Exercise $objExercise */
/** @var Exercise $objExercise */
$objExercise = ChamiloSession::read('objExercise', null);
$isAuthOnLp = !empty($lpItemInfo) && !empty($oLp);
@ -93,7 +98,7 @@ class AuthenticationController extends BaseController
ChamiloSession::write(WhispeakAuthPlugin::SESSION_SENTENCE_TEXT, $response['token']);
if (!empty($lpQuestionInfo) && empty($lpItemInfo)) {
$template = new \Template('', $showFullPage, $showFullPage, false, true, false);
$template = new Template('', $showFullPage, $showFullPage, false, true, false);
$template->assign('show_form', $showForm);
$template->assign('sample_text', $response['text']);
@ -111,7 +116,7 @@ class AuthenticationController extends BaseController
}
/**
* @throws \Exception
* @throws Exception
*/
public function ajax()
{
@ -125,7 +130,7 @@ class AuthenticationController extends BaseController
}
if (!$isAllowed || !$this->plugin->toolIsEnabled()) {
throw new \Exception(get_lang('NotAllowed'));
throw new Exception(get_lang('NotAllowed'));
}
if (!empty($user2fa)) {
@ -134,11 +139,11 @@ class AuthenticationController extends BaseController
$user = api_get_user_entity($userId);
} else {
/** @var User|null $user */
$user = \UserManager::getRepository()->findOneBy(['username' => $_POST['username']]);
$user = UserManager::getRepository()->findOneBy(['username' => $_POST['username']]);
}
if (!$user) {
throw new \Exception(get_lang('NotFound'));
throw new Exception(get_lang('NotFound'));
}
$audioFilePath = $this->uploadAudioFile($user);
@ -147,15 +152,15 @@ class AuthenticationController extends BaseController
$maxAttempts = $this->plugin->getMaxAttempts();
if ($maxAttempts && $failedLogins >= $maxAttempts) {
throw new \Exception($this->plugin->get_lang('MaxAttemptsReached'));
throw new Exception($this->plugin->get_lang('MaxAttemptsReached'));
}
$token = \ChamiloSession::read(\WhispeakAuthPlugin::SESSION_SENTENCE_TEXT);
$token = ChamiloSession::read(WhispeakAuthPlugin::SESSION_SENTENCE_TEXT);
$request = new ApiRequest();
$success = $request->performAuthentication($token, $user, $audioFilePath);
\ChamiloSession::erase(\WhispeakAuthPlugin::SESSION_SENTENCE_TEXT);
ChamiloSession::erase(WhispeakAuthPlugin::SESSION_SENTENCE_TEXT);
/** @var array $lpItemInfo */
$lpItemInfo = ChamiloSession::read(WhispeakAuthPlugin::SESSION_LP_ITEM, []);
@ -322,7 +327,7 @@ class AuthenticationController extends BaseController
$pageTitle = $this->plugin->get_title();
$template = new \Template($pageTitle, $isFullPage, $isFullPage);
$template = new Template($pageTitle, $isFullPage, $isFullPage);
foreach ($variables as $key => $value) {
$template->assign($key, $value);

@ -6,6 +6,7 @@ namespace Chamilo\PluginBundle\WhispeakAuth\Controller;
use Chamilo\UserBundle\Entity\User;
use FFMpeg\FFMpeg;
use FFMpeg\Format\Audio\Wav;
use WhispeakAuthPlugin;
/**
* Class BaseController.
@ -13,7 +14,7 @@ use FFMpeg\Format\Audio\Wav;
abstract class BaseController
{
/**
* @var \WhispeakAuthPlugin
* @var WhispeakAuthPlugin
*/
protected $plugin;
@ -22,7 +23,7 @@ abstract class BaseController
*/
public function __construct()
{
$this->plugin = \WhispeakAuthPlugin::create();
$this->plugin = WhispeakAuthPlugin::create();
}
/**

@ -4,6 +4,11 @@
namespace Chamilo\PluginBundle\WhispeakAuth\Controller;
use Chamilo\PluginBundle\WhispeakAuth\Request\ApiRequest;
use ChamiloSession;
use Display;
use Exception;
use Template;
use WhispeakAuthPlugin;
/**
* Class EnrollmentController.
@ -11,26 +16,26 @@ use Chamilo\PluginBundle\WhispeakAuth\Request\ApiRequest;
class EnrollmentController extends BaseController
{
/**
* @throws \Exception
* @throws Exception
*/
public function index()
{
if (!$this->plugin->toolIsEnabled()) {
throw new \Exception(get_lang('NotAllowed'));
throw new Exception(get_lang('NotAllowed'));
}
$user = api_get_user_entity(api_get_user_id());
$userIsEnrolled = \WhispeakAuthPlugin::checkUserIsEnrolled($user->getId());
$userIsEnrolled = WhispeakAuthPlugin::checkUserIsEnrolled($user->getId());
if ($userIsEnrolled) {
throw new \Exception($this->plugin->get_lang('SpeechAuthAlreadyEnrolled'));
throw new Exception($this->plugin->get_lang('SpeechAuthAlreadyEnrolled'));
}
$request = new ApiRequest();
$response = $request->createEnrollmentSessionToken($user);
\ChamiloSession::write(\WhispeakAuthPlugin::SESSION_SENTENCE_TEXT, $response['token']);
ChamiloSession::write(WhispeakAuthPlugin::SESSION_SENTENCE_TEXT, $response['token']);
$this->displayPage(
true,
@ -42,32 +47,32 @@ class EnrollmentController extends BaseController
}
/**
* @throws \Exception
* @throws Exception
*/
public function ajax()
{
if (!$this->plugin->toolIsEnabled() || empty($_FILES['audio'])) {
throw new \Exception(get_lang('NotAllowed'));
throw new Exception(get_lang('NotAllowed'));
}
$user = api_get_user_entity(api_get_user_id());
$audioFilePath = $this->uploadAudioFile($user);
$token = \ChamiloSession::read(\WhispeakAuthPlugin::SESSION_SENTENCE_TEXT);
$token = ChamiloSession::read(WhispeakAuthPlugin::SESSION_SENTENCE_TEXT);
if (empty($token)) {
throw new \Exception($this->plugin->get_lang('EnrollmentFailed'));
throw new Exception($this->plugin->get_lang('EnrollmentFailed'));
}
$request = new ApiRequest();
$response = $request->createEnrollment($token, $audioFilePath, $user);
\ChamiloSession::erase(\WhispeakAuthPlugin::SESSION_SENTENCE_TEXT);
ChamiloSession::erase(WhispeakAuthPlugin::SESSION_SENTENCE_TEXT);
$this->plugin->saveEnrollment($user, $response['speaker']);
echo \Display::return_message($this->plugin->get_lang('EnrollmentSuccess'), 'success');
echo Display::return_message($this->plugin->get_lang('EnrollmentSuccess'), 'success');
}
/**
@ -82,7 +87,7 @@ class EnrollmentController extends BaseController
$pageTitle = $this->plugin->get_lang('EnrollmentTitle');
$template = new \Template($pageTitle);
$template = new Template($pageTitle);
foreach ($variables as $key => $value) {
$template->assign($key, $value);

@ -6,6 +6,7 @@ namespace Chamilo\PluginBundle\WhispeakAuth\Request;
use Chamilo\UserBundle\Entity\User;
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use WhispeakAuthPlugin;
/**
* Class ApiRequest.
@ -13,7 +14,7 @@ use GuzzleHttp\Exception\RequestException;
class ApiRequest
{
/**
* @var \WhispeakAuthPlugin
* @var WhispeakAuthPlugin
*/
protected $plugin;
/**
@ -26,8 +27,8 @@ class ApiRequest
*/
public function __construct()
{
$this->plugin = \WhispeakAuthPlugin::create();
$this->apiKey = $this->plugin->get(\WhispeakAuthPlugin::SETTING_TOKEN);
$this->plugin = WhispeakAuthPlugin::create();
$this->apiKey = $this->plugin->get(WhispeakAuthPlugin::SETTING_TOKEN);
}
/**
@ -39,7 +40,7 @@ class ApiRequest
*/
public function createEnrollmentSessionToken(User $user)
{
$apiKey = $this->plugin->get(\WhispeakAuthPlugin::SETTING_TOKEN);
$apiKey = $this->plugin->get(WhispeakAuthPlugin::SETTING_TOKEN);
$langIso = api_get_language_isocode($user->getLanguage());
return $this->sendRequest(
@ -84,7 +85,7 @@ class ApiRequest
*/
public function createAuthenticationSessionToken(User $user = null)
{
$apiKey = $this->plugin->get(\WhispeakAuthPlugin::SETTING_TOKEN);
$apiKey = $this->plugin->get(WhispeakAuthPlugin::SETTING_TOKEN);
$langIso = api_get_language_isocode($user ? $user->getLanguage() : null);
@ -106,7 +107,7 @@ class ApiRequest
*/
public function performAuthentication($token, User $user, $audioFilePath)
{
$wsid = \WhispeakAuthPlugin::getAuthUidValue($user->getId());
$wsid = WhispeakAuthPlugin::getAuthUidValue($user->getId());
if (empty($wsid)) {
throw new \Exception($this->plugin->get_lang('SpeechAuthNotEnrolled'));

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save