Fix PHP deprecations

pull/3844/head
Julio Montoya 4 years ago
parent 74531ae5bf
commit b119e2443f
  1. 8
      public/main/exercise/exercise.class.php
  2. 2
      public/main/inc/lib/CourseChatUtils.php
  3. 18
      public/main/inc/lib/agenda.lib.php
  4. 2
      public/main/inc/lib/career.lib.php
  5. 2
      public/main/inc/lib/formvalidator/FormValidator.class.php
  6. 12
      public/main/inc/lib/sessionmanager.lib.php
  7. 15
      public/main/lp/learnpath.class.php
  8. 16
      src/CourseBundle/Repository/CForumPostRepository.php

@ -6125,12 +6125,12 @@ class Exercise
* @return bool
*/
public function send_mail_notification_for_exam(
$type = 'end',
$type,
$question_list_answers,
$origin,
$exe_id,
$score = null,
$weight = null
$score,
$weight
) {
$setting = api_get_course_setting('email_alert_manager_on_new_quiz');
@ -7682,7 +7682,7 @@ class Exercise
$current_question,
$questions_in_media = [],
$last_question_in_media = false,
$realQuestionList,
$realQuestionList = [],
$generateJS = true
) {
// With this option on the question is loaded via AJAX

@ -37,7 +37,7 @@ class CourseChatUtils
* @param int $sessionId
* @param int $groupId
*/
public function __construct($courseId, $userId, $sessionId = 0, $groupId = 0, ResourceNode $resourceNode, ResourceRepository $repository)
public function __construct($courseId, $userId, $sessionId, $groupId, ResourceNode $resourceNode, ResourceRepository $repository)
{
$this->courseId = (int) $courseId;
$this->userId = (int) $userId;

@ -2980,10 +2980,10 @@ class Agenda
*/
public static function get_global_agenda_items(
$agendaitems,
$day = "",
$month = "",
$year = "",
$week = "",
$day,
$month,
$year,
$week,
$type
) {
$tbl_global_agenda = Database::get_main_table(
@ -3109,10 +3109,10 @@ class Agenda
public static function get_personal_agenda_items(
$user_id,
$agendaitems,
$day = "",
$month = "",
$year = "",
$week = "",
$day,
$month,
$year,
$week,
$type
) {
$tbl_personal_agenda = Database::get_main_table(TABLE_PERSONAL_AGENDA);
@ -3235,7 +3235,7 @@ class Agenda
$agendaitems,
$month,
$year,
$weekdaynames = [],
$weekdaynames,
$monthName,
$show_content = true
) {

@ -863,7 +863,7 @@ class Career extends Model
*
* @return string
*/
public static function parseVertexList($groupCourseList, $vertexList, $addRow = 0, &$graph, $group, &$connections, $userResult)
public static function parseVertexList($groupCourseList, $vertexList, $addRow, &$graph, $group, &$connections, $userResult)
{
if (empty($vertexList)) {
return '';

@ -1012,7 +1012,7 @@ EOT;
* @param string $title visible title
* @param array $groupList list of group or elements
*/
public function addPanelOption($name, $title, $groupList, $icon, $open = false, $parent)
public function addPanelOption($name, $title, $groupList, $icon, $open, $parent)
{
$html = '<div class="card">';
$html .= '<div class="card-header" id="card_'.$name.'">';

@ -814,8 +814,8 @@ class SessionManager
* @return array table with user name, lp name, progress
*/
public static function get_session_lp_progress(
$sessionId = 0,
$courseId = 0,
$sessionId,
$courseId,
$date_from,
$date_to,
$options
@ -935,9 +935,9 @@ class SessionManager
* @return array table with user name, lp name, progress
*/
public static function get_survey_overview(
$sessionId = 0,
$courseId = 0,
$surveyId = 0,
$sessionId,
$courseId,
$surveyId,
$date_from,
$date_to,
$options
@ -1408,7 +1408,7 @@ class SessionManager
$profile = '',
$date_from = '',
$date_to = '',
$options
$options = []
) {
$sessionId = intval($sessionId);
$courseId = intval($courseId);

@ -6906,7 +6906,7 @@ class learnpath
*
* @return string HTML form
*/
public function display_link_form($action = 'add', $lpItem, $link)
public function display_link_form($action, $lpItem, $link)
{
$item_url = '';
if ($link) {
@ -6941,7 +6941,7 @@ class learnpath
*
* @return string HTML form
*/
public function display_quiz_form($action = 'add', $lpItem, $exercise)
public function display_quiz_form($action, $lpItem, $exercise)
{
$form = new FormValidator(
'quiz_form',
@ -6965,7 +6965,7 @@ class learnpath
*
* @return string HTML form
*/
public function display_forum_form($action = 'add', $lpItem, $resource)
public function display_forum_form($action, $lpItem, $resource)
{
$form = new FormValidator(
'forum_form',
@ -6994,7 +6994,7 @@ class learnpath
*
* @return string HTML form
*/
public function display_thread_form($action = 'add', $lpItem, $resource)
public function display_thread_form($action, $lpItem, $resource)
{
$form = new FormValidator(
'thread_form',
@ -7046,11 +7046,8 @@ class learnpath
*
* @return string HTML form
*/
public function display_student_publication_form(
$action = 'add',
CLpItem $lpItem,
$resource
) {
public function display_student_publication_form($action, CLpItem $lpItem, $resource)
{
$form = new FormValidator('frm_student_publication', 'post', '#');
LearnPathItemForm::setForm($form, 'edit', $this, $lpItem);

@ -23,12 +23,12 @@ class CForumPostRepository extends ResourceRepository
}
/**
* @param bool $onlyVisibles
* @param bool $onlyVisible
* @param bool $isAllowedToEdit
* @param string $orderDirection
*/
public function findAllInCourseByThread(
$onlyVisibles,
$onlyVisible,
$isAllowedToEdit,
CForumThread $thread,
Course $course,
@ -36,24 +36,24 @@ class CForumPostRepository extends ResourceRepository
CGroup $group = null,
$orderDirection = 'ASC'
): array {
$conditionVisibility = $onlyVisibles ? 'p.visible = 1' : 'p.visible != 2';
$conditionModetared = '';
$conditionVisibility = $onlyVisible ? 'p.visible = 1' : 'p.visible != 2';
$conditionModerated = '';
$filterModerated = true;
if (
(empty($group) && $isAllowedToEdit) ||
(
(null !== $group ? $group->userIsTutor($currentUser) : false) ||
!$onlyVisibles
!$onlyVisible
)
) {
$filterModerated = false;
}
if ($filterModerated && $onlyVisibles && $thread->getForum()->isModerated()) {
if ($filterModerated && $onlyVisible && $thread->getForum()->isModerated()) {
$userId = null !== $currentUser ? $currentUser->getId() : 0;
$conditionModetared = 'AND p.status = 1 OR
$conditionModerated = 'AND p.status = 1 OR
(p.status = '.CForumPost::STATUS_WAITING_MODERATION." AND p.posterId = {$userId}) OR
(p.status = ".CForumPost::STATUS_REJECTED." AND p.poster = {$userId}) OR
(p.status IS NULL AND p.posterId = {$userId})";
@ -65,7 +65,7 @@ class CForumPostRepository extends ResourceRepository
p.thread = :thread AND
p.cId = :course AND
{$conditionVisibility}
{$conditionModetared}
{$conditionModerated}
ORDER BY p.iid {$orderDirection}";
return $this

Loading…
Cancel
Save