Internal - Fix php warnings, add psalm checks

pull/3543/head
Julio Montoya 4 years ago
parent c35fdc8fa9
commit 4f7f5a7e2a
  1. 14
      psalm.xml
  2. 7
      public/main/gradebook/gradebook_display_summary.php
  3. 14
      public/main/inc/lib/document.lib.php
  4. 31
      public/main/inc/lib/online.inc.php
  5. 2
      public/main/inc/lib/pdf.lib.php
  6. 3
      public/main/inc/lib/plugin.class.php
  7. 3
      public/main/inc/lib/promotion.lib.php
  8. 1
      src/CourseBundle/Entity/CNotebook.php

@ -90,11 +90,18 @@
<file name="public/main/inc/lib/notebook.lib.php"/>
<file name="public/main/inc/lib/notification.lib.php"/>
<file name="public/main/inc/lib/NotificationEvent.php"/>
<file name="public/main/inc/lib/online.inc.php"/>
<!-- <file name="public/main/inc/lib/pdf.lib.php"/>-->
<!-- <file name="public/main/inc/lib/plugin.class.php"/>-->
<!-- <file name="public/main/inc/lib/plugin.lib.php"/>-->
<file name="public/main/inc/lib/redirect.class.php"/>
<file name="public/main/inc/lib/ScheduledAnnouncement.php"/>
<!-- <file name="public/main/inc/lib/security.lib.php"/>-->
<file name="public/main/inc/lib/sessionmanager.lib.php"/>
<!-- <file name="public/main/inc/lib/skill.lib.php"/>-->
<file name="public/main/inc/lib/link.lib.php"/>
<file name="public/main/inc/lib/legal.lib.php"/>
<!-- <file name="public/main/inc/lib/skill.lib.php"/>-->
<file name="public/main/inc/lib/skill.visualizer.lib.php"/>
<file name="public/main/inc/lib/social.lib.php"/>
<file name="public/main/inc/lib/sortable_table.class.php"/>
@ -104,7 +111,6 @@
<file name="public/main/inc/lib/statistics.lib.php"/>
<file name="public/main/inc/lib/SurveyTree.php"/>
<file name="public/main/inc/lib/system_announcements.lib.php"/>
<file name="public/main/inc/lib/table_sort.class.php"/>
<file name="public/main/inc/lib/tablesort.lib.php"/>
<file name="public/main/inc/lib/TeacherTimeReport.php"/>

@ -154,13 +154,13 @@ $interbreadcrumb[] = [
];
$interbreadcrumb[] = [
'url' => '#',
'name' => get_lang('AssessmentsListOfLearnersReports'),
'name' => get_lang('Students list report'),
];
$this_section = SECTION_COURSES;
Display::display_header('');
$token = Security::get_token();
echo Display::page_header(get_lang('AssessmentsListOfLearnersReports'));
echo Display::page_header(get_lang('Students list report'));
echo '<div class="btn-group">';
if (count($userList) > 0) {
@ -188,7 +188,8 @@ if (0 == count($userList)) {
echo '<td>';
$link = '';
if ($allowSkillRelItem) {
$url = api_get_path(WEB_CODE_PATH).'gradebook/skill_rel_user.php?'.api_get_cidreq().'&user_id='.$value['user_id'].'&selectcat='.$cat_id;
$url = api_get_path(WEB_CODE_PATH).
'gradebook/skill_rel_user.php?'.api_get_cidreq().'&user_id='.$value['user_id'].'&selectcat='.$cat_id;
$link = Display::url(
get_lang('Skills'),
$url,

@ -1602,18 +1602,12 @@ class DocumentManager
$my_content_html = null;
if ($document_id) {
$sql = "SELECT path FROM $tbl_document
WHERE iid = $document_id";
$rs = Database::query($sql);
$repo = Container::getDocumentRepository();
$doc = Container::getDocumentRepository()->find($document_id);
$new_content = '';
$all_user_info = [];
if (Database::num_rows($rs)) {
$row = Database::fetch_array($rs);
/*$filepath = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$row['path'];
if (is_file($filepath)) {
$my_content_html = file_get_contents($filepath);
}*/
$my_content_html = '';
if ($doc) {
$my_content_html = $repo->getResourceFileContent($doc);
$all_user_info = self::get_all_info_to_certificate(
$user_id,
$courseInfo,

@ -84,7 +84,7 @@ function preventMultipleLogin($userId)
$isFirstLogin = Session::read('first_user_login');
if (empty($isFirstLogin)) {
$sql = "SELECT login_id FROM $table
WHERE login_user_id = $userId
WHERE login_user_id = $userId
LIMIT 1";
$result = Database::query($sql);
@ -197,7 +197,6 @@ function online_logout($user_id = null, $logout_redirect = false)
}
}
api_delete_firstpage_parameter();
Session::erase('last_id');
CourseChatUtils::exitChat($user_id);
session_regenerate_id();
@ -235,7 +234,7 @@ function user_is_online($user_id)
$query = " SELECT login_user_id, login_date
FROM $track_online_table track
INNER JOIN $table_user u
INNER JOIN $table_user u
ON (u.id=track.login_user_id)
WHERE
track.access_url_id = $access_url_id AND
@ -485,13 +484,13 @@ function who_is_online_in_this_course($from, $number_of_items, $uid, $time_limit
}
$query = "SELECT o.login_user_id, o.login_date
FROM $track_online_table o
FROM $track_online_table o
INNER JOIN $tableUser u
ON (o.login_user_id = u.id)
$urlJoin
WHERE
u.status <> '".ANONYMOUS."' AND
o.c_id = $courseId AND
u.status <> '".ANONYMOUS."' AND
o.c_id = $courseId AND
o.login_date >= '$current_date'
$urlCondition
LIMIT $from, $number_of_items ";
@ -542,13 +541,13 @@ function who_is_online_in_this_course_count(
}
$query = "SELECT count(login_user_id) as count
FROM $track_online_table o
INNER JOIN $tableUser u
FROM $track_online_table o
INNER JOIN $tableUser u
ON (login_user_id = u.id)
$urlJoin
WHERE
WHERE
u.status <> '".ANONYMOUS."' AND
c_id = $courseId AND
c_id = $courseId AND
login_date >= '$current_date'
$urlCondition
";
@ -591,14 +590,14 @@ function whoIsOnlineInThisSessionCount($timeLimit, $sessionId)
}
$query = "SELECT count(login_user_id) as count
FROM $tblTrackOnline o
INNER JOIN $tableUser u
FROM $tblTrackOnline o
INNER JOIN $tableUser u
ON (login_user_id = u.id)
$urlJoin
WHERE
u.status <> '".ANONYMOUS."' AND
session_id = $sessionId AND
login_date >= '$current_date'
WHERE
u.status <> '".ANONYMOUS."' AND
session_id = $sessionId AND
login_date >= '$current_date'
$urlCondition
";
$result = Database::query($query);

@ -259,7 +259,7 @@ class PDF
}
if ($printTitle) {
$this->pdf->WriteHTML(
'<html><body><h3>'.$html_title.'</h3></body></html>'.$page_break
'<html><body><h3>'.$htmlTitle.'</h3></body></html>'.$pageBreak
);
}
continue;

@ -1035,7 +1035,7 @@ class Plugin
/** @var CTool $tool */
$tool = $em
->getRepository('ChamiloCourseBundle:CTool')
->getRepository(CTool::class)
->findOneBy([
'name' => $name,
'course' => $courseId,
@ -1048,7 +1048,6 @@ class Plugin
$tool = new CTool();
$tool
->setId($cToolId)
->setCourse(api_get_course_entity($courseId))
->setName($name.$visibilityPerStatus)
->setLink($link ?: "$pluginName/start.php")

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
@ -297,7 +298,7 @@ class Promotion extends Model
$promotion = new \Chamilo\CoreBundle\Entity\Promotion();
$em = Database::getManager();
$repo = $em->getRepository('ChamiloCoreBundle:Career');
$repo = $em->getRepository(\Chamilo\CoreBundle\Entity\Career::class);
$promotion
->setName($params['name'])
->setStatus($params['status'])

@ -105,7 +105,6 @@ class CNotebook extends AbstractResource implements ResourceInterface
return $this->getTitle();
}
/**
* Set userId.
*

Loading…
Cancel
Save