Fix PHP errors

pull/3844/head
Julio Montoya 5 years ago
parent a63c7ffb4c
commit 5dfc374254
  1. 1
      public/main/announcements/announcements.php
  2. 36
      public/main/gradebook/lib/be/category.class.php
  3. 2
      public/main/gradebook/lib/be/evaluation.class.php
  4. 4
      public/main/inc/lib/AnnouncementManager.php
  5. 5
      public/main/inc/lib/agenda.lib.php
  6. 17
      public/main/inc/lib/api.lib.php
  7. 7
      public/main/inc/lib/array.lib.php
  8. 6
      public/main/inc/lib/formvalidator/FormValidator.class.php
  9. 2
      public/main/inc/lib/message.lib.php
  10. 10
      public/main/inc/lib/pear/HTML/Common.php
  11. 2
      public/main/inc/lib/usermanager.lib.php
  12. 40
      src/CoreBundle/Entity/Message.php

@ -91,6 +91,7 @@ $logInfo = [
Event::registerLog($logInfo);
$announcementAttachmentIsDisabled = api_get_configuration_value('disable_announcement_attachment');
$thisAnnouncementId = null;
switch ($action) {
case 'move':

@ -3,6 +3,7 @@
/* For licensing terms, see /license.txt */
use Chamilo\CoreBundle\Entity\GradebookCategory;
use Chamilo\CoreBundle\Entity\Course;
use ChamiloSession as Session;
/**
@ -763,41 +764,6 @@ class Category implements GradebookItem
Database::query($sql);
}
/**
* Delete the gradebook categories from a course, including course sessions.
*
* @param \Chamilo\CoreBundle\Entity\Course $course
*/
public static function deleteFromCourse($course)
{
$em = Database::getManager();
$categories = $em
->createQuery(
'SELECT DISTINCT gc.sessionId
FROM ChamiloCoreBundle:GradebookCategory gc WHERE gc.course = :course'
)
->setParameter('course', $course)
->getResult();
foreach ($categories as $category) {
$cats = self::load(
null,
null,
$course->getCode(),
null,
null,
(int) $category['sessionId']
);
if (!empty($cats)) {
/** @var self $cat */
foreach ($cats as $cat) {
$cat->delete_all();
}
}
}
}
/**
* @param int $course_id
*

@ -333,7 +333,7 @@ class Evaluation implements GradebookItem
->setCategory($category)
->setUser(api_get_user_entity($this->get_user_id()))
->setWeight(api_float_val($this->get_weight()))
->setMax($this->get_max())
->setMax(api_float_val($this->get_max()))
->setVisible($this->is_visible())
->setType($this->type)
;

@ -625,7 +625,7 @@ class AnnouncementManager
* @param bool $sendToUsersInSession Send announcements to users inside a session.
* @param int $authorId
*
* @return int false on failure, ID of the announcement on success
* @return int|bool false on failure, ID of the announcement on success
*/
public static function add_announcement(
$courseInfo,
@ -723,7 +723,7 @@ class AnnouncementManager
* @param string $file_comment
* @param bool $sendToUsersInSession
*
* @return bool|int
* @return bool|CAnnouncement
*/
public static function addGroupAnnouncement(
$title,

@ -34,6 +34,11 @@ class Agenda
/** @var bool */
private $isAllowedToEdit;
private $tbl_global_agenda;
private $tbl_personal_agenda;
private $tbl_course_agenda;
private $table_repeat;
/**
* Constructor.
*

@ -5931,13 +5931,16 @@ function api_get_tool_information_by_name($name)
WHERE name = '".Database::escape_string($name)."' ";
$rs = Database::query($sql);
$data = Database::fetch_array($rs);
$tool = $data['id'];
if ($data) {
$tool = $data['id'];
$sql = "SELECT * FROM $t_tool
WHERE c_id = $course_id AND tool_id = '".$tool."' ";
$rs = Database::query($sql);
$sql = "SELECT * FROM $t_tool
WHERE c_id = $course_id AND tool_id = '".$tool."' ";
$rs = Database::query($sql);
return Database::fetch_array($rs, 'ASSOC');
}
return Database::fetch_array($rs, 'ASSOC');
return [];
}
/**
@ -7936,8 +7939,8 @@ function api_mail_html(
}
/**
* @param string $tool Possible values: GroupManager::GROUP_TOOL_*
* @param bool $showHeader
* @param int $tool Possible values: GroupManager::GROUP_TOOL_*
* @param bool $showHeader
*/
function api_protect_course_group($tool, $showHeader = true)
{

@ -1,11 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
/**
* This is the array library for Chamilo.
* Include/require it in your code to use its functionality.
*/
/**
* Removes duplicate values from a dimensional array.
*
* @param array $array dimensional array
@ -51,7 +50,7 @@ function msort($array, $id = 'id', $order = 'desc')
$lowest_id = 0;
$index = 0;
foreach ($array as $item) {
if ('desc' == $order) {
if ('desc' === $order) {
if (strip_tags($item[$id]) < strip_tags($array[$lowest_id][$id])) {
$lowest_id = $index;
}

@ -1145,12 +1145,12 @@ EOT;
}
/**
* @param string $name
* @param string $label
* @param string $name
* @param string|array $label
*
* @return mixed
*/
public function addButtonAdvancedSettings($name, $label = '')
public function addButtonAdvancedSettings($name, $label = null)
{
$label = !empty($label) ? $label : get_lang('Advanced settings');

@ -788,7 +788,7 @@ class MessageManager
/**
* @param int $receiverUserId
* @param int $subject
* @param string $subject
* @param string $message
* @param int $sender_id
* @param bool $sendCopyToDrhUsers send copy to related DRH users

@ -141,11 +141,13 @@ class HTML_Common
$strAttr = '';
if (is_array($attributes)) {
$charset = HTML_Common::charset();
$charset = $this->charset();
foreach ($attributes as $key => $value) {
// Modified by Ivan Tcholakov, 16-MAR-2010
$value = @htmlspecialchars($value, ENT_COMPAT, $charset);
$strAttr .= ' ' . $key . '="' . $value. '"';
if (!is_array($value)) {
// Modified by Ivan Tcholakov, 16-MAR-2010
$value = @htmlspecialchars($value, ENT_COMPAT, $charset);
$strAttr .= ' '.$key.'="'.$value.'"';
}
}
}

@ -1544,7 +1544,7 @@ class UserManager
* Get the users by ID.
*
* @param array $ids student ids
* @param string $active
* @param bool $active
* @param string $order
* @param string $limit
*

@ -167,10 +167,8 @@ class Message
* Set sendDate.
*
* @param DateTime $sendDate
*
* @return Message
*/
public function setSendDate($sendDate)
public function setSendDate($sendDate): self
{
$this->sendDate = $sendDate;
@ -187,24 +185,14 @@ class Message
return $this->sendDate;
}
/**
* Set title.
*
* @param string $title
*/
public function setTitle($title): self
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
/**
* Get title.
*
* @return string
*/
public function getTitle()
public function getTitle(): string
{
return $this->title;
}
@ -235,10 +223,8 @@ class Message
* Set groupId.
*
* @param int $groupId
*
* @return Message
*/
public function setGroupId($groupId)
public function setGroupId($groupId): self
{
$this->groupId = $groupId;
@ -259,10 +245,8 @@ class Message
* Set updateDate.
*
* @param DateTime $updateDate
*
* @return Message
*/
public function setUpdateDate($updateDate)
public function setUpdateDate($updateDate): self
{
$this->updateDate = $updateDate;
@ -289,24 +273,14 @@ class Message
return $this->id;
}
/**
* Set votes.
*
* @param int $votes
*/
public function setVotes($votes): self
public function setVotes(int $votes): self
{
$this->votes = $votes;
return $this;
}
/**
* Get votes.
*
* @return int
*/
public function getVotes()
public function getVotes(): int
{
return $this->votes;
}

Loading…
Cancel
Save