Minor - flint fixes

pull/3924/head
Julio Montoya 4 years ago
parent 028435b3e1
commit f68d481383
  1. 2
      ecs.php
  2. 1
      public/main/admin/access_url_edit_users_to_url.php
  3. 1
      public/main/admin/add_sessions_to_usergroup.php
  4. 1
      public/main/admin/course_list.php
  5. 2
      public/main/admin/course_user_import_by_email.php
  6. 1
      public/main/admin/skills_wheel.php
  7. 1
      public/main/admin/user_information.php
  8. 1
      public/main/admin/user_update_import.php
  9. 1
      public/main/blog/blog.php
  10. 2
      public/main/course_info/infocours.php
  11. 1
      public/main/cron/add_gradebook_certificates.php
  12. 4
      public/main/cron/check_lp_total_time.php
  13. 2
      public/main/exercise/answer.class.php
  14. 4
      public/main/exercise/exercise.class.php
  15. 1
      public/main/exercise/export/aiken/aiken_import.inc.php
  16. 3
      public/main/exercise/question.class.php
  17. 1
      public/main/exercise/question_admin.inc.php
  18. 4
      public/main/forum/forumfunction.inc.php
  19. 1
      public/main/forum/viewforum.php
  20. 2
      public/main/forum/viewthread.php
  21. 4
      public/main/gradebook/lib/be/category.class.php
  22. 4
      public/main/inc/ajax/course.ajax.php
  23. 7
      public/main/inc/ajax/exercise.ajax.php
  24. 2
      public/main/inc/ajax/lp.ajax.php
  25. 8
      public/main/inc/ajax/model.ajax.php
  26. 1
      public/main/inc/ajax/work.ajax.php
  27. 2
      public/main/inc/global.inc.php
  28. 3
      public/main/inc/lib/SkillModel.php
  29. 1
      public/main/inc/lib/TicketManager.php
  30. 2
      public/main/inc/lib/add_course.lib.inc.php
  31. 4
      public/main/inc/lib/agenda.lib.php
  32. 98
      public/main/inc/lib/course.lib.php
  33. 6
      public/main/inc/lib/course_category.lib.php
  34. 6
      public/main/inc/lib/database.lib.php
  35. 1
      public/main/inc/lib/display.lib.php
  36. 3
      public/main/inc/lib/document.lib.php
  37. 3
      public/main/inc/lib/events.lib.php
  38. 1
      public/main/inc/lib/exercise.lib.php
  39. 2
      public/main/inc/lib/formvalidator/Element/HtmlEditor.php
  40. 4
      public/main/inc/lib/formvalidator/FormValidator.class.php
  41. 1
      public/main/inc/lib/groupmanager.lib.php
  42. 9
      public/main/inc/lib/internationalization.lib.php
  43. 2
      public/main/inc/lib/myspace.lib.php
  44. 14
      public/main/inc/lib/tracking.lib.php
  45. 1
      public/main/inc/lib/urlmanager.lib.php
  46. 5
      public/main/inc/lib/usermanager.lib.php
  47. 4
      public/main/inc/lib/webservices/Rest.php
  48. 7
      public/main/install/install.lib.php
  49. 1
      public/main/lp/lp_add_audio.php
  50. 1
      public/main/lp/lp_add_item.php
  51. 3
      public/main/lp/lp_ajax_initialize.php
  52. 1
      public/main/lp/lp_ajax_switch_item.php
  53. 2
      public/main/lp/lp_ajax_switch_item_toc.php
  54. 2
      public/main/lp/lp_controller.php
  55. 2
      public/main/lp/lp_edit_item.php
  56. 1
      public/main/lp/lp_edit_item_prereq.php
  57. 1
      public/main/lp/lp_upload.php
  58. 1
      public/main/lp/openoffice_presentation.class.php
  59. 2
      public/main/lp/scorm.class.php
  60. 1
      public/main/messages/view_message.php
  61. 2
      public/main/mySpace/index.php
  62. 3
      public/main/mySpace/myStudents.php
  63. 4
      public/main/session/session_category_list.php
  64. 1
      public/main/session/session_course_edit.php
  65. 1
      public/main/social/group_add.php
  66. 1
      public/main/survey/fillsurvey.php
  67. 1
      public/main/survey/question.php
  68. 4
      public/main/survey/surveyUtil.class.php
  69. 4
      public/main/ticket/ticket_details.php
  70. 2
      public/main/ticket/tickets.php
  71. 2
      public/main/user/career_diagram.php
  72. 2
      public/main/user/user.php
  73. 1
      public/main/work/edit.php
  74. 1
      public/main/work/work.lib.php
  75. 1
      public/main/work/work_list.php
  76. 2
      public/plugin/azure_active_directory/lang/dutch.php
  77. 2
      public/plugin/azure_active_directory/lang/english.php
  78. 2
      public/plugin/azure_active_directory/lang/french.php
  79. 2
      public/plugin/azure_active_directory/lang/spanish.php
  80. 2
      public/plugin/azure_active_directory/src/AzureActiveDirectory.php
  81. 4
      public/plugin/azure_active_directory/src/callback.php
  82. 2
      public/plugin/buycourses/src/buycourses.ajax.php
  83. 1
      public/plugin/buycourses/src/service_process.php
  84. 1
      public/plugin/customcertificate/src/index.php
  85. 31
      public/plugin/whispeakauth/Controller/AuthenticationController.php
  86. 5
      public/plugin/whispeakauth/Controller/BaseController.php
  87. 29
      public/plugin/whispeakauth/Controller/EnrollmentController.php
  88. 13
      public/plugin/whispeakauth/Request/ApiRequest.php
  89. 5
      public/plugin/zoom/Entity/Meeting.php
  90. 4
      public/plugin/zoom/Entity/MeetingActivity.php
  91. 4
      src/CoreBundle/Controller/CourseHomeController.php
  92. 3
      src/CoreBundle/Hook/HookAdminBlock.php
  93. 3
      src/CoreBundle/Hook/HookEvent.php
  94. 5
      src/CoreBundle/Hook/HookFactory.php
  95. 3
      src/CoreBundle/Hook/HookResubscribe.php
  96. 4
      src/CoreBundle/Repository/ResetPasswordRequestRepository.php
  97. 2
      src/CoreBundle/Repository/SequenceRepository.php
  98. 3
      src/CourseBundle/Component/CourseCopy/Course.php
  99. 11
      src/CourseBundle/Component/CourseCopy/CourseArchiver.php
  100. 8
      src/CourseBundle/Component/CourseCopy/CourseBuilder.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',
]

@ -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) {
@ -77,7 +76,6 @@ foreach($courses as $courseInfo) {
/**
* @param array $user
* @param Course $course
* @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;
@ -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);

@ -1546,11 +1546,10 @@ abstract class Question
}
/**
* @param CQuizQuestion $question
* @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;
@ -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()

@ -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;

@ -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;
/**
@ -2264,7 +2264,6 @@ 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
*
* @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.

@ -512,7 +512,6 @@ class SkillModel extends Model
/**
* @param int $userId
* @param GradebookCategory $category
* @param int $courseId
* @param int $sessionId
*
@ -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) {

@ -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;
@ -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.
*
@ -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
@ -128,7 +128,7 @@ class CourseCategory
* @param string $code
* @param string $name
* @param string $canHaveCourses
* @param null|int $parentId
* @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()
{
}

@ -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

@ -680,7 +680,6 @@ 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
@ -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,7 +1751,6 @@ HOTSPOT;
/**
* Validates the time control key.
*
* @param Exercise $exercise
* @param int $lp_id
* @param int $lp_item_id
*

@ -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
*/

@ -2816,7 +2816,6 @@ class GroupManager
}
/**
* @param Course $course
* @param string $keyword
*
* @return string

@ -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;

@ -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;

@ -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,
@ -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;
}
@ -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);
@ -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

@ -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.

@ -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());

@ -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();

@ -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();

@ -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>';

@ -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;
@ -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
@ -4020,7 +4021,6 @@ class SurveyUtil
/**
* @param string $code invitation code
* @param Course $course
* @param int $sessionId
*
* @return string

@ -202,8 +202,8 @@ 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();

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

@ -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'),

@ -1236,7 +1236,6 @@ function getWorkListStudent(
->setMaxResults($limit)
;
/*$sql = "$select
FROM $workTable w
LEFT JOIN $workTableAssignment a

@ -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'));

@ -20,6 +20,7 @@ use DateTimeZone;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Exception;
use ZoomPlugin;
/**
* Class Meeting.
@ -497,7 +498,7 @@ class Meeting
*/
public function hasCloudAutoRecordingEnabled()
{
return \ZoomPlugin::RECORDING_TYPE_NONE !== $this->meetingInfoGet->settings->auto_recording;
return ZoomPlugin::RECORDING_TYPE_NONE !== $this->meetingInfoGet->settings->auto_recording;
}
/**
@ -568,7 +569,7 @@ class Meeting
*/
private function initializeDisplayableProperties()
{
$zoomPlugin = new \ZoomPlugin();
$zoomPlugin = new ZoomPlugin();
$typeList = [
API\Meeting::TYPE_INSTANT => $zoomPlugin->get_lang('InstantMeeting'),

@ -62,7 +62,7 @@ class MeetingActivity
protected $event;
/**
* @var \DateTime
* @var DateTime
*
* @ORM\Column(name="created_at", type="datetime", nullable=false)
*/
@ -70,7 +70,7 @@ class MeetingActivity
public function __construct()
{
$this->createdAt = new \DateTime();
$this->createdAt = new DateTime();
}
/**

@ -234,7 +234,7 @@ class CourseHomeController extends ToolBaseController
*/
public function redirectTool(string $toolName, CToolRepository $repo, ToolChain $toolChain)
{
/** @var null|CTool $tool */
/** @var CTool|null $tool */
$tool = $repo->findOneBy([
'name' => $toolName,
]);
@ -258,7 +258,7 @@ class CourseHomeController extends ToolBaseController
public function redirectToShortCut(string $toolName, CToolRepository $repo, ToolChain $toolChain)
{
/** @var null|CTool $tool */
/** @var CTool|null $tool */
$tool = $repo->findOneBy([
'name' => $toolName,
]);

@ -7,6 +7,7 @@ namespace Chamilo\CoreBundle\Hook;
use Chamilo\CoreBundle\Hook\Interfaces\HookAdminBlockEventInterface;
use Chamilo\CoreBundle\Hook\Interfaces\HookAdminBlockObserverInterface;
use Doctrine\ORM\EntityManager;
use Exception;
/**
* Class HookAdminBlock
@ -18,7 +19,7 @@ class HookAdminBlock extends HookEvent implements HookAdminBlockEventInterface
/**
* Constructor.
*
* @throws \Exception
* @throws Exception
*/
protected function __construct(EntityManager $entityManager)
{

@ -12,6 +12,7 @@ namespace Chamilo\CoreBundle\Hook;
use Chamilo\CoreBundle\Hook\Interfaces\HookEventInterface;
use Chamilo\CoreBundle\Hook\Interfaces\HookObserverInterface;
use Doctrine\ORM\EntityManager;
use SplObjectStorage;
/**
* Class HookEvent.
@ -37,7 +38,7 @@ abstract class HookEvent implements HookEventInterface
{
$this->entityManager = $entityManager;
$this->observers = new \SplObjectStorage();
$this->observers = new SplObjectStorage();
$this->eventName = $eventName;
$this->eventData = [];
$this->manager = HookManagement::create($this->entityManager);

@ -6,6 +6,7 @@ namespace Chamilo\CoreBundle\Hook;
use Chamilo\CoreBundle\Hook\Interfaces\HookEventInterface;
use Doctrine\ORM\EntityManager;
use Exception;
/**
* Class HookFactory.
@ -26,14 +27,14 @@ class HookFactory
}
/**
* @throws \Exception
* @throws Exception
*
* @return HookEventInterface
*/
public function build(string $type)
{
if (!class_exists($type)) {
throw new \Exception('Class "'.$type.'" fot found');
throw new Exception('Class "'.$type.'" fot found');
}
return $type::create($this->entityManager);

@ -7,11 +7,12 @@ namespace Chamilo\CoreBundle\Hook;
use Chamilo\CoreBundle\Hook\Interfaces\HookResubscribeEventInterface;
use Chamilo\CoreBundle\Hook\Interfaces\HookResubscribeObserverInterface;
use Doctrine\ORM\EntityManager;
use SplObjectStorage;
/**
* Class HookResubscribe.
*
* @var \SplObjectStorage
* @var SplObjectStorage
*/
class HookResubscribe extends HookEvent implements HookResubscribeEventInterface
{

@ -13,8 +13,8 @@ use SymfonyCasts\Bundle\ResetPassword\Persistence\Repository\ResetPasswordReques
use SymfonyCasts\Bundle\ResetPassword\Persistence\ResetPasswordRequestRepositoryInterface;
/**
* @method null|ResetPasswordRequest find($id, $lockMode = null, $lockVersion = null)
* @method null|ResetPasswordRequest findOneBy(array $criteria, array $orderBy = null)
* @method ResetPasswordRequest|null find($id, $lockMode = null, $lockVersion = null)
* @method ResetPasswordRequest|null findOneBy(array $criteria, array $orderBy = null)
* @method ResetPasswordRequest[] findAll()
* @method ResetPasswordRequest[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/

@ -57,7 +57,7 @@ class SequenceRepository extends ServiceEntityRepository
}
/**
* @return null|Course|Session
* @return Course|Session|null
*/
public function getItem(int $itemId, int $type)
{

@ -5,6 +5,7 @@
namespace Chamilo\CourseBundle\Component\CourseCopy;
use Chamilo\CourseBundle\Component\CourseCopy\Resources\Resource;
use UnserializeApi;
/**
* A course-object to use in Export/Import/Backup/Copy.
@ -354,7 +355,7 @@ class Course
if (extension_loaded('igbinary')) {
$unserialized = igbinary_unserialize($course);
} else {
$unserialized = \UnserializeApi::unserialize(
$unserialized = UnserializeApi::unserialize(
'course',
$course
);

@ -6,7 +6,10 @@ namespace Chamilo\CourseBundle\Component\CourseCopy;
use Chamilo\CourseBundle\Component\CourseCopy\Resources\Asset;
use Chamilo\CourseBundle\Component\CourseCopy\Resources\Document;
use DateTime;
use PclZip;
use Symfony\Component\Filesystem\Filesystem;
use UnserializeApi;
/**
* Some functions to write a course-object to a zip-file and to read a course-
@ -80,7 +83,7 @@ class CourseArchiver
$course_info_file = $backup_dir.'course_info.dat';
$user = api_get_user_info();
$date = new \DateTime(api_get_local_time());
$date = new DateTime(api_get_local_time());
$zipFileName = $user['user_id'].'_'.$course->code.'_'.$date->format('Ymd-His').'.zip';
$zipFilePath = $backupDirectory.$zipFileName;
@ -194,7 +197,7 @@ class CourseArchiver
}
// Zip the course-contents
$zip = new \PclZip($zipFilePath);
$zip = new PclZip($zipFilePath);
$zip->create($backup_dir, PCLZIP_OPT_REMOVE_PATH, $backup_dir);
// Remove the temp-dir.
@ -292,7 +295,7 @@ class CourseArchiver
);
// unzip the archive
$zip = new \PclZip($unzip_dir.'/backup.zip');
$zip = new PclZip($unzip_dir.'/backup.zip');
@chdir($unzip_dir);
$zip->extract(
@ -345,7 +348,7 @@ class CourseArchiver
class_alias('Chamilo\CourseBundle\Component\CourseCopy\Resources\Work', 'Work');
/** @var Course $course */
$course = \UnserializeApi::unserialize('course', base64_decode($contents));
$course = UnserializeApi::unserialize('course', base64_decode($contents));
if (!in_array(
get_class($course),

@ -36,6 +36,8 @@ use Chamilo\CourseBundle\Component\CourseCopy\Resources\Work;
use Chamilo\CourseBundle\Entity\CLpCategory;
use CourseManager;
use Database;
use DocumentManager;
use learnpath;
use Link as LinkManager;
use TestCategory;
@ -143,7 +145,7 @@ class CourseBuilder
*/
public function findAndSetDocumentsInText($text)
{
$documentList = \DocumentManager::get_resources_from_source_html($text);
$documentList = DocumentManager::get_resources_from_source_html($text);
$this->addDocumentList($documentList);
}
@ -169,7 +171,7 @@ class CourseBuilder
$documentFile = strstr($realOrigPath, 'document');
if (false !== strpos($realOrigPath, $documentFile)) {
$documentFile = str_replace('document', '', $documentFile);
$itemDocumentId = \DocumentManager::get_document_id($courseInfo, $documentFile);
$itemDocumentId = DocumentManager::get_document_id($courseInfo, $documentFile);
// Document found! Add it to the list
if ($itemDocumentId) {
$list[] = $itemDocumentId;
@ -1391,7 +1393,7 @@ class CourseBuilder
*/
public function build_learnpath_category($session_id = 0, $courseId = 0, $withBaseContent = false, $idList = [])
{
$categories = \learnpath::getCategories($courseId);
$categories = learnpath::getCategories($courseId);
/** @var CLpCategory $item */
foreach ($categories as $item) {

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

Loading…
Cancel
Save