Minor - Flint fixes

pull/3939/head
Angel Fernando Quiroz Campos 4 years ago
parent 65581fb243
commit 8861ba8279
  1. 24
      public/load_search.php
  2. 1
      public/main/inc/lib/AnnouncementManager.php

@ -54,7 +54,7 @@ $(function() {
api_block_anonymous_users();
$allowToSee = api_is_drh() || api_is_student_boss() || api_is_platform_admin();
if ($allowToSee === false) {
if (false === $allowToSee) {
api_not_allowed(true);
}
$userId = api_get_user_id();
@ -160,7 +160,7 @@ if (!empty($items)) {
/** @var ExtraFieldSavedSearch $item */
foreach ($items as $item) {
$variable = 'extra_'.$item->getField()->getVariable();
if ($item->getField()->getFieldType() == ExtraField::FIELD_TYPE_TAG) {
if (ExtraField::FIELD_TYPE_TAG == $item->getField()->getFieldType()) {
$tagsData[$variable] = $item->getValue();
}
$defaults[$variable] = $item->getValue();
@ -333,13 +333,13 @@ if (isset($_POST) && !empty($_POST)) {
Session::write('search_using_3', $searchChecked3);
} else {
$searchChecked1 = Session::read('search_using_1');
$searchChecked1 = $searchChecked1 === null ? 'checked' : $searchChecked1;
$searchChecked1 = null === $searchChecked1 ? 'checked' : $searchChecked1;
$searchChecked2 = Session::read('search_using_2');
$searchChecked2 = $searchChecked2 === null ? 'checked' : $searchChecked2;
$searchChecked2 = null === $searchChecked2 ? 'checked' : $searchChecked2;
$searchChecked3 = Session::read('search_using_3');
$searchChecked3 = $searchChecked3 === null ? 'checked' : $searchChecked3;
$searchChecked3 = null === $searchChecked3 ? 'checked' : $searchChecked3;
}
$form->addHtml('<div class="panel panel-default">');
@ -610,7 +610,7 @@ if ($formSearch->validate()) {
// Search filter
$filters = [];
foreach ($defaults as $key => $value) {
if (substr($key, 0, 6) != 'extra_' && substr($key, 0, 7) != '_extra_') {
if ('extra_' != substr($key, 0, 6) && '_extra_' != substr($key, 0, 7)) {
continue;
}
if (!empty($value)) {
@ -671,7 +671,7 @@ if ($form->validate()) {
if ($search) {
// Parse params.
foreach ($params as $key => $value) {
if (substr($key, 0, 6) != 'extra_' && substr($key, 0, 7) != '_extra_') {
if ('extra_' != substr($key, 0, 6) && '_extra_' != substr($key, 0, 7)) {
continue;
}
if (!empty($value)) {
@ -746,7 +746,7 @@ if ($form->validate()) {
foreach ($userData as $key => $value) {
$found = strpos($key, '__persist__');
if ($found === false) {
if (false === $found) {
continue;
}
}
@ -756,7 +756,7 @@ if ($form->validate()) {
) {
$wantStage = $userData['extra_filiere_want_stage']['extra_filiere_want_stage'];
if ($wantStage === 'yes') {
if ('yes' === $wantStage) {
if (isset($userData['extra_filiere_user'])) {
$userData['extra_filiere'] = [];
$userData['extra_filiere']['extra_filiere'] = $userData['extra_filiere_user']['extra_filiere_user'];
@ -766,7 +766,7 @@ if ($form->validate()) {
// save in ExtraFieldSavedSearch.
foreach ($userData as $key => $value) {
if (substr($key, 0, 6) != 'extra_' && substr($key, 0, 7) != '_extra_') {
if ('extra_' != substr($key, 0, 6) && '_extra_' != substr($key, 0, 7)) {
continue;
}
@ -859,7 +859,7 @@ if (!empty($filterToSend)) {
$userEndDatePlus = api_get_utc_datetime(substr($userEndDatePlus, 0, 11).'23:59:59');
// Special OFAJ date logic
if ($userEndDate == '') {
if ('' == $userEndDate) {
$sql = " AND (
(s.access_start_date >= '$userStartDateMinus') OR
((s.access_start_date = '' OR s.access_start_date IS NULL) AND (s.access_end_date = '' OR s.access_end_date IS NULL))
@ -983,7 +983,7 @@ if (!empty($filterToSend)) {
if ($deleteFiliere) {
foreach ($filterToSend['rules'] as &$filterItem) {
if (isset($filterItem['field']) && $filterItem['field'] == 'extra_filiere') {
if (isset($filterItem['field']) && 'extra_filiere' == $filterItem['field']) {
$filterItem = [];
}
}

@ -9,7 +9,6 @@ use Chamilo\CoreBundle\Framework\Container;
use Chamilo\CoreBundle\Security\Authorization\Voter\ResourceNodeVoter;
use Chamilo\CourseBundle\Entity\CAnnouncement;
use Chamilo\CourseBundle\Entity\CAnnouncementAttachment;
use Chamilo\CourseBundle\Entity\CCalendarEvent;
/**
* Include file with functions for the announcements module.

Loading…
Cancel
Save