Update from master (format code)

pull/3240/head
Julio Montoya 5 years ago
parent ea0b58d513
commit cadf9894d9
  1. 18
      main/inc/lib/exercise.lib.php
  2. 14
      main/inc/lib/exercise_show_functions.lib.php
  3. 3
      main/inc/lib/extra_field.lib.php
  4. 8
      main/inc/lib/extra_field_option.lib.php
  5. 11
      main/inc/lib/extra_field_value.lib.php
  6. 5
      main/inc/lib/fileDisplay.lib.php
  7. 2
      main/inc/lib/fileManage.lib.php
  8. 4
      main/inc/lib/glossary.lib.php
  9. 4
      main/inc/lib/grade_model.lib.php
  10. 8
      main/inc/lib/gradebook.lib.php
  11. 26
      main/inc/lib/groupmanager.lib.php
  12. 16
      main/inc/lib/image.lib.php
  13. 2
      main/inc/lib/import.lib.php
  14. 2
      main/inc/lib/legal.lib.php
  15. 2
      main/inc/lib/link.lib.php
  16. 16
      main/inc/lib/message.lib.php
  17. 6
      main/inc/lib/model.lib.php
  18. 10
      main/inc/lib/myspace.lib.php
  19. 2
      main/inc/lib/notebook.lib.php
  20. 2
      main/inc/lib/notification.lib.php
  21. 39
      main/inc/lib/sessionmanager.lib.php
  22. 8
      main/inc/lib/skill.lib.php
  23. 4
      main/inc/lib/social.lib.php
  24. 16
      main/inc/lib/sortable_table.class.php
  25. 4
      main/inc/lib/specific_fields_manager.lib.php
  26. 22
      main/inc/lib/table_sort.class.php
  27. 2
      main/inc/lib/text.lib.php
  28. 2
      main/inc/lib/thematic.lib.php
  29. 38
      main/inc/lib/tracking.lib.php
  30. 20
      main/inc/lib/urlmanager.lib.php
  31. 18
      main/inc/lib/usergroup.lib.php
  32. 6
      main/lp/aicc.class.php
  33. 4
      main/lp/aiccBlock.class.php
  34. 4
      main/lp/aiccItem.class.php
  35. 4
      main/lp/aiccObjective.class.php

@ -923,7 +923,7 @@ class ExerciseLib
* the text to find mustn't contains HTML tags
* the text to find mustn't contains char "
*/
if ($origin !== null) {
if (null !== $origin) {
global $exe_id;
$exe_id = (int) $exe_id;
$trackAttempts = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
@ -1042,7 +1042,7 @@ class ExerciseLib
foreach ($correctAnswerList[0] as $item) {
$size = strlen($item);
$attributes['class'] = self::detectInputAppropriateClass($size);
if ($exercise->getFeedbackType() == EXERCISE_FEEDBACK_TYPE_POPUP) {
if (EXERCISE_FEEDBACK_TYPE_POPUP == $exercise->getFeedbackType()) {
$attributes['id'] = "question_$questionId";
$attributes['class'] .= ' checkCalculatedQuestionOnEnter ';
}
@ -1059,7 +1059,7 @@ class ExerciseLib
);
}
}
if ($origin !== null) {
if (null !== $origin) {
$s = $answer;
break;
} else {
@ -1391,7 +1391,7 @@ HTML;
unset($objAnswerTmp);
// destruction of the Question object
unset($objQuestionTmp);
if ($origin == 'export') {
if ('export' == $origin) {
return $s;
}
echo $s;
@ -2885,7 +2885,6 @@ HOTSPOT;
if ($hidePercentageSign) {
$percentageSign = '';
}
$html = $percentage."$percentageSign ($score / $weight)";
if ($show_only_percentage) {
$html = $percentage.$percentageSign;
@ -2903,7 +2902,6 @@ HOTSPOT;
// Ignore other formats and use the configuration['exercise_score_format'] value
// But also keep the round values settings.
$format = api_get_configuration_value('exercise_score_format');
if (!empty($format)) {
$html = ScoreDisplay::instance()->display_score([$score, $weight], $format);
}
@ -2964,7 +2962,7 @@ HOTSPOT;
$courseInfo = api_get_course_info();
if (!empty($courseInfo)) {
$scoreModelId = api_get_course_setting('score_model_id');
if ($scoreModelId != -1) {
if (-1 != $scoreModelId) {
$modelIdList = array_column($modelList['models'], 'id');
if (in_array($scoreModelId, $modelIdList)) {
foreach ($modelList['models'] as $item) {
@ -2997,7 +2995,7 @@ HOTSPOT;
public static function isSuccessExerciseResult($score, $weight, $pass_percentage)
{
$percentage = float_format(
($score / ($weight != 0 ? $weight : 1)) * 100,
($score / (0 != $weight ? $weight : 1)) * 100,
1
);
if (isset($pass_percentage) && !empty($pass_percentage)) {
@ -4693,7 +4691,7 @@ EOT;
'comments' => Event::get_comments($exeId, $questionId),
];
$check = $objQuestionTmp->isQuestionWaitingReview($reviewScore);
if ($check === false) {
if (false === $check) {
$countPendingQuestions++;
}
}
@ -4702,7 +4700,7 @@ EOT;
$question_content = '';
if ($show_results) {
$question_content = '<div class="question_row_answer">';
if ($showQuestionScore == false) {
if (false == $showQuestionScore) {
$score = [];
}

@ -1,4 +1,5 @@
<?php
/* See license terms in /license.txt */
/**
* EVENTS LIBRARY.
@ -8,15 +9,8 @@
* of event occur. Each event has his own types of informations then each event
* use its own function.
*
* @package chamilo.library
*
* @todo convert queries to use Database API
*/
/**
* Class.
*
* @package chamilo.library
*/
class ExerciseShowFunctions
{
/**
@ -140,7 +134,7 @@ class ExerciseShowFunctions
echo '</td></tr>';
}
if ($feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
if (EXERCISE_FEEDBACK_TYPE_EXAM != $feedback_type) {
if ($questionScore > 0 || !empty($comments)) {
} else {
echo '<tr>';
@ -182,7 +176,7 @@ class ExerciseShowFunctions
echo Display::tag('td', Security::remove_XSS($answer), ['width' => '55%']);
}
echo '</tr>';
if (!$questionScore && $feedback_type != EXERCISE_FEEDBACK_TYPE_EXAM) {
if (!$questionScore && EXERCISE_FEEDBACK_TYPE_EXAM != $feedback_type) {
echo '<tr>';
echo Display::tag('td', ExerciseLib::getNotCorrectedYetText(), ['width' => '45%']);
echo '</tr>';
@ -225,7 +219,7 @@ class ExerciseShowFunctions
$hide_expected_answer = false;
switch ($resultsDisabled) {
case RESULT_DISABLE_SHOW_SCORE_ONLY:
if ($feedback_type == 0) {
if (0 == $feedback_type) {
$hide_expected_answer = true;
}
break;

@ -1260,7 +1260,6 @@ class ExtraField extends Model
'select',
'extra_'.$field_details['variable'].'['.$i.']',
$customLabelsExtraMultipleSelect[$field_details['variable']][$i],
//$field_details['display_text'],
null,
['id' => 'extra_'.$field_details['variable'].'_'.$i]
);
@ -2041,8 +2040,6 @@ class ExtraField extends Model
}
}
//@todo move this in the display_class or somewhere else
/**
* Displays the title + grid.
*/

@ -132,7 +132,7 @@ class ExtraFieldOption extends Model
$params['option_value']
);
if ($optionInfo == false) {
if (false == $optionInfo) {
$optionValue = api_replace_dangerous_char($params['option_value']);
$order = $this->get_max_order($params['field_id']);
$newParams = [
@ -332,7 +332,7 @@ class ExtraFieldOption extends Model
$optionValue = api_replace_dangerous_char($option);
$option = trim($option);
if ($option_info != false) {
if (false != $option_info) {
continue;
}
@ -389,7 +389,7 @@ class ExtraFieldOption extends Model
$field_id,
$params['option_value']
);
if ($check == false) {
if (false == $check) {
parent::save($params, $show_query);
}
}
@ -751,7 +751,7 @@ class ExtraFieldOption extends Model
$form->addElement('hidden', 'type', $this->type);
$form->addElement('hidden', 'field_id', $this->fieldId);
if ($action === 'edit') {
if ('edit' == $action) {
$translateUrl = api_get_path(WEB_CODE_PATH).'extrafield/translate.php?'.http_build_query([
'extra_field_option' => $id,
]);

@ -98,7 +98,7 @@ class ExtraFieldValue extends Model
foreach ($params as $key => $value) {
$found = strpos($key, '__persist__');
if ($found === false) {
if (false === $found) {
continue;
}
@ -121,7 +121,8 @@ class ExtraFieldValue extends Model
foreach ($extraFields as $fieldDetails) {
if ($forceSave === false) {
// if the field is not visible to the user in the end, we need to apply special rules
if ($fieldDetails['visible_to_self'] != 1) {
// if the field is not visible to the user in the end, we need to apply special rules
if (1 != $fieldDetails['visible_to_self']) {
//only admins should be able to add those values
if (!api_is_platform_admin(true, true)) {
// although if not admin but sent through a CLI script, we should accept it as well
@ -181,7 +182,7 @@ class ExtraFieldValue extends Model
}
break;
case ExtraField::FIELD_TYPE_TAG:
if ($type == EntityExtraField::USER_FIELD_TYPE) {
if (EntityExtraField::USER_FIELD_TYPE == $type) {
UserManager::delete_user_tags(
$params['item_id'],
$extraFieldInfo['id']
@ -344,7 +345,7 @@ class ExtraFieldValue extends Model
'value' => $fileDirStored.$fileName,
];
if ($this->type !== 'session' && $this->type !== 'course') {
if ('session' !== $this->type && 'course' !== $this->type) {
$new_params['comment'] = $comment;
}
@ -486,7 +487,7 @@ class ExtraFieldValue extends Model
break;
}
if ($extraFieldInfo['field_type'] == ExtraField::FIELD_TYPE_TAG) {
if (ExtraField::FIELD_TYPE_TAG == $extraFieldInfo['field_type']) {
$field_values = self::getAllValuesByItemAndFieldAndValue(
$params['item_id'],
$params['field_id'],

@ -6,11 +6,6 @@
*
* @todo move this file to DocumentManager
*
* @package chamilo.library
*/
/* FILE DISPLAY FUNCTIONS */
/**
* Define the image to display for each file extension.
* This needs an existing image repository to work.
*

@ -6,8 +6,6 @@ use Symfony\Component\Filesystem\Filesystem;
/**
* This is the file manage library for Chamilo.
* Include/require it in your code to use its functionality.
*
* @package chamilo.library
*/
/**

@ -11,8 +11,6 @@ use ChamiloSession as Session;
* @author Julio Montoya
* @author Christian Fasanando
* @author Patrick Cool <patrick.cool@ugent.be>, Ghent University, Belgium januari 2009, dokeos 1.8.6
*
* @package chamilo.library
*/
class GlossaryManager
{
@ -214,7 +212,7 @@ class GlossaryManager
c_id = $course_id AND
glossary_id = ".intval($values['glossary_id']);
$result = Database::query($sql);
if ($result === false) {
if (false === $result) {
return false;
}

@ -3,8 +3,6 @@
/**
* Class GradeModel.
*
* @package chamilo.library
*/
class GradeModel extends Model
{
@ -113,7 +111,7 @@ class GradeModel extends Model
$components = $this->get_components($defaults['id']);
}
if ($action == 'edit') {
if ('edit' == $action) {
if (!empty($components)) {
$nr_items = count($components);
}

@ -2,11 +2,9 @@
/* For licensing terms, see /license.txt */
/**
* Class Gradebook
* Class Gradebook.
* This class provides methods for the notebook management.
* Include/require it in your code to use its features.
*
* @package chamilo.library
*/
class Gradebook extends Model
{
@ -52,7 +50,7 @@ class Gradebook extends Model
$setting = Database::store_result($result);
$setting = isset($setting[0]) ? $setting[0] : null;
$setting = $setting ? $setting : [];
$inactive = isset($setting['selected_value']) && $setting['selected_value'] == 'true';
$inactive = isset($setting['selected_value']) && 'true' == $setting['selected_value'];
if ($inactive) {
return false;
@ -70,7 +68,7 @@ class Gradebook extends Model
return true;
}
return $item['visibility'] == '1';
return '1' == $item['visibility'];
}
/**

@ -8,8 +8,6 @@ use Chamilo\CourseBundle\Entity\CGroupRelUser;
*
* @author Bart Mollet
*
* @package chamilo.library
*
* @todo Add $course_code parameter to all functions. So this GroupManager can
* be used outside a session.
*/
@ -740,11 +738,11 @@ class GroupManager
duplicates the table group_info.forum_state cvargas*/
$forum_state = (int) $forum_state;
$sql2 = "UPDATE ".$table_forum." SET ";
if ($forum_state === 1) {
if (1 === $forum_state) {
$sql2 .= " forum_group_public_private='public' ";
} elseif ($forum_state === 2) {
} elseif (2 === $forum_state) {
$sql2 .= " forum_group_public_private='private' ";
} elseif ($forum_state === 0) {
} elseif (0 === $forum_state) {
$sql2 .= " forum_group_public_private='unavailable' ";
}
$sql2 .= " WHERE c_id = $courseId AND forum_of_group=".$group_id;
@ -867,7 +865,7 @@ class GroupManager
$table_group = Database::get_course_table(TABLE_GROUP);
$table_group_cat = Database::get_course_table(TABLE_GROUP_CATEGORY);
$group_id = intval($group_id);
$group_id = (int) $group_id;
if (empty($group_id)) {
return [];
@ -1132,7 +1130,7 @@ class GroupManager
WHERE g.c_id = '.$course_info['real_id'].'
AND gu.c_id = g.c_id
AND gu.group_id = g.iid ';
if ($category_id != null) {
if (null != $category_id) {
$category_id = intval($category_id);
$sql .= ' AND g.category_id = '.$category_id;
}
@ -1223,7 +1221,7 @@ class GroupManager
if (!empty($column) && !empty($direction)) {
$column = Database::escape_string($column, null, false);
$direction = ($direction == 'ASC' ? 'ASC' : 'DESC');
$direction = ('ASC' == $direction ? 'ASC' : 'DESC');
$sql .= " ORDER BY $column $direction";
}
@ -1498,7 +1496,7 @@ class GroupManager
WHERE c_id = $course_id AND iid = $group_id";
$db_result = Database::query($sql);
$db_object = Database::fetch_object($db_result);
if ($db_object->max_student == 0) {
if (0 == $db_object->max_student) {
return self::INFINITE;
}
@ -2315,7 +2313,7 @@ class GroupManager
if (self::userHasAccessToBrowse($user_id, $this_group, $session_id)) {
// Group name
$groupNameClass = null;
if ($this_group['status'] == 0) {
if (0 == $this_group['status']) {
$groupNameClass = 'muted';
}
@ -2340,7 +2338,7 @@ class GroupManager
$group_name .= $session_img;
$row[] = $group_name.$group_name2.'<br />'.stripslashes(trim($this_group['description']));
} else {
if ($hideGroup === 'true') {
if ('true' === $hideGroup) {
continue;
}
$row[] = $this_group['name'].'<br />'.stripslashes(trim($this_group['description']));
@ -2355,7 +2353,7 @@ class GroupManager
sprintf(get_lang('LoginX'), $tutor['username']),
ENT_QUOTES
);
if (api_get_setting('show_email_addresses') === 'true') {
if ('true' === api_get_setting('show_email_addresses')) {
$tutor_info .= Display::tag(
'span',
Display::encrypted_mailto_link(
@ -2775,7 +2773,7 @@ class GroupManager
$data[0][] = 'tutors';
}
if ($loadUsers == false) {
if (false == $loadUsers) {
$categories = self::get_categories();
foreach ($categories as $categoryInfo) {
@ -2920,7 +2918,7 @@ class GroupManager
$categories = self::get_categories();
if (!empty($categories)) {
foreach ($categories as $category) {
if (api_get_setting('allow_group_categories') == 'true') {
if ('true' == api_get_setting('allow_group_categories')) {
$content .= '<h2>'.$category['title'].'</h2>';
}
if (!empty($keyword)) {

@ -7,8 +7,6 @@
*
* @author Julio Montoya <gugli100@gmail.com>
*
* @package chamilo.include.image
*
* @todo move in a DB configuration setting
*/
class Image
@ -192,8 +190,6 @@ abstract class ImageWrapper
* Imagick Chamilo wrapper.
*
* @author jmontoya
*
* @package chamilo.include.image
*/
class ImagickWrapper extends ImageWrapper
{
@ -357,8 +353,6 @@ class ImagickWrapper extends ImageWrapper
/**
* php-gd wrapper.
*
* @package chamilo.include.image
*/
class GDWrapper extends ImageWrapper
{
@ -436,7 +430,7 @@ class GDWrapper extends ImageWrapper
if (!$this->image_validated) {
return false;
}
if ($border == 1) {
if (1 == $border) {
if ($specific_size) {
$width = $thumbw;
$height = $thumbh;
@ -456,7 +450,7 @@ class GDWrapper extends ImageWrapper
}
$this->width = $thumbw;
$this->height = $thumbh;
} elseif ($border == 0) {
} elseif (0 == $border) {
if ($specific_size) {
$width = $thumbw;
$height = $thumbh;
@ -559,7 +553,7 @@ class GDWrapper extends ImageWrapper
if (!$file) {
header("Content-type: image/jpeg");
}
if ($compress == -1) {
if (-1 == $compress) {
$compress = 100;
}
@ -569,7 +563,7 @@ class GDWrapper extends ImageWrapper
if (!$file) {
header("Content-type: image/png");
}
if ($compress != -1) {
if (-1 != $compress) {
@imagetruecolortopalette($this->bg, true, $compress);
}
@ -579,7 +573,7 @@ class GDWrapper extends ImageWrapper
if (!$file) {
header("Content-type: image/gif");
}
if ($compress != -1) {
if (-1 != $compress) {
@imagetruecolortopalette($this->bg, true, $compress);
}

@ -8,8 +8,6 @@ use League\Csv\Reader;
* Class Import
* This class provides some functions which can be used when importing data from
* external files into Chamilo.
*
* @package chamilo.library
*/
class Import
{

@ -389,7 +389,7 @@ class LegalManager
$extraFieldValue = new ExtraFieldValue('user');
$value = $extraFieldValue->get_values_by_handler_and_field_variable($userId, 'termactivated');
if ($value === false) {
if (false === $value) {
$extraFieldInfo = $extraFieldValue->getExtraField()->get_handler_field_info_by_field_variable('termactivated');
if ($extraFieldInfo) {
$newParams = [

@ -18,8 +18,6 @@ use Chamilo\CourseBundle\Entity\CLink;
*
* @author Patrick Cool, complete remake (December 2003 - January 2004)
* @author René Haentjens, CSV file import (October 2004)
*
* @package chamilo.link
*/
class Link extends Model
{

@ -214,7 +214,7 @@ class MessageManager
$title = cut($title, 80, true);
$class = 'class = "read"';
if ($status == 1) {
if (1 == $status) {
$class = 'class = "unread"';
}
@ -487,7 +487,7 @@ class MessageManager
$receiverUserInfo = api_get_user_info($receiver_user_id);
// Disabling messages for inactive users.
if ($receiverUserInfo['active'] == 0) {
if (0 == $receiverUserInfo['active']) {
return false;
}
}
@ -609,7 +609,7 @@ class MessageManager
// Save attachment file for inbox messages
if (is_array($attachmentList)) {
foreach ($attachmentList as $attachment) {
if ($attachment['error'] == 0) {
if (0 == $attachment['error']) {
$comment = $attachment['comment'];
self::saveMessageAttachmentFile(
$attachment,
@ -624,7 +624,7 @@ class MessageManager
}
// Save message in the outbox for user friend or group.
if (empty($group_id) && $status == MESSAGE_STATUS_UNREAD) {
if (empty($group_id) && MESSAGE_STATUS_UNREAD == $status) {
$params = [
'user_sender_id' => $user_sender_id,
'user_receiver_id' => $receiver_user_id,
@ -641,7 +641,7 @@ class MessageManager
// save attachment file for outbox messages
if (is_array($attachmentList)) {
foreach ($attachmentList as $attachment) {
if ($attachment['error'] == 0) {
if (0 == $attachment['error']) {
$comment = $attachment['comment'];
self::saveMessageAttachmentFile(
$attachment,
@ -750,7 +750,7 @@ class MessageManager
$attachmentList = []
) {
$files = $_FILES ? $_FILES : [];
if ($uploadFiles === false) {
if (false === $uploadFiles) {
$files = [];
}
// $attachmentList must have: tmp_name, name, size keys
@ -1400,7 +1400,7 @@ class MessageManager
}
$message_content .= '<tr>';
if (api_get_setting('allow_social_tool') === 'true') {
if ('true' === api_get_setting('allow_social_tool')) {
$message_content .= '<div class="row">';
$message_content .= '<div class="col-md-12">';
$message_content .= '<ul class="list-message">';
@ -1925,7 +1925,7 @@ class MessageManager
$base_padding = 20;
if ($topic['indent_cnt'] == 0) {
if (0 == $topic['indent_cnt']) {
$indent = $base_padding;
} else {
$indent = (int) $topic['indent_cnt'] * $base_padding + $base_padding;

@ -2,12 +2,10 @@
/* For licensing terms, see /license.txt */
/**
* Class Model
* Class Model.
* This class provides basic methods to implement a CRUD for a new table in the
* database see examples in: career.lib.php and promotion.lib.php
* Include/require it in your code to use its features.
*
* @package chamilo.library
*/
class Model
{
@ -65,7 +63,7 @@ class Model
// Database table definition
$result = Database::delete($this->table, $params);
if ($result != 1) {
if (1 != $result) {
return false;
}

@ -490,7 +490,7 @@ class MySpace
if (api_is_multiple_url_enabled()) {
$tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
if (-1 != $access_url_id) {
$sqlCoachs = "SELECT DISTINCT
scu.user_id as id_coach,
u.id as user_id,
@ -885,7 +885,7 @@ class MySpace
$message = '';
$defaults = [];
// include the user manager and formvalidator library
if (isset($_GET['export']) && $_GET['export'] == 'options') {
if (isset($_GET['export']) && 'options' == $_GET['export']) {
// get all the defined extra fields
$extrafields = UserManager::get_extra_fields(
0,
@ -2359,7 +2359,7 @@ class MySpace
$user['create'] = '1';
} else {
$is_session_avail = self::user_available_in_session($user['UserName'], $course_list, $id_session);
if ($is_session_avail == 0) {
if (0 == $is_session_avail) {
$user_name = $user['UserName'];
$sql_select = "SELECT user_id FROM $table_user WHERE username ='$user_name' ";
$rs = Database::query($sql_select);
@ -3109,7 +3109,7 @@ class MySpace
if (empty($end_date)) {
$end_date = '';
}
if ($type == '') {
if ('' == $type) {
$type = 'day';
}
$main_year = $main_month_year = $main_day = [];
@ -3164,7 +3164,7 @@ class MySpace
}
$labels = array_keys($main_date);
if (count($main_date) == 1) {
if (1 == count($main_date)) {
$labels = $labels[0];
$main_date = $main_date[$labels];
}

@ -8,8 +8,6 @@ use ChamiloSession as Session;
* Include/require it in your code to use its features.
*
* @author Carlos Vargas <litox84@gmail.com>, move code of main/notebook up here
*
* @package chamilo.library
*/
class NotebookManager
{

@ -5,8 +5,6 @@
* Notification class
* This class provides methods for the Notification management.
* Include/require it in your code to use its features.
*
* @package chamilo.library
*/
class Notification extends Model
{

@ -502,7 +502,7 @@ class SessionManager
if (!api_is_platform_admin()) {
if (api_is_session_admin() &&
api_get_setting('allow_session_admins_to_manage_all_sessions') === 'false'
'false' === api_get_setting('allow_session_admins_to_manage_all_sessions')
) {
$where .= " AND s.session_admin_id = $userId ";
}
@ -510,7 +510,7 @@ class SessionManager
if (!api_is_platform_admin() &&
api_is_teacher() &&
api_get_setting('allow_teachers_to_create_sessions') === 'true'
'true' === api_get_setting('allow_teachers_to_create_sessions')
) {
$where .= " AND s.id_coach = $userId ";
}
@ -528,12 +528,12 @@ class SessionManager
$isMakingOrder = false;
$showCountUsers = false;
if ($getCount === true) {
if (true === $getCount) {
$select = ' SELECT count(DISTINCT s.id) as total_rows ';
} else {
if (!empty($columns['column_model'])) {
foreach ($columns['column_model'] as $column) {
if ($column['name'] === 'users') {
if ('users' == $column['name']) {
$showCountUsers = true;
}
}
@ -561,7 +561,7 @@ class SessionManager
}
if (isset($options['order'])) {
$isMakingOrder = strpos($options['order'], 'category_name') === 0;
$isMakingOrder = 0 === strpos($options['order'], 'category_name');
}
}
@ -693,7 +693,6 @@ class SessionManager
}
$userId = api_get_user_id();
$sessions = self::getSessionsForAdmin($userId, $options, $getCount, $columns, $listType);
if ($getCount) {
return (int) $sessions;
@ -2105,7 +2104,7 @@ class SessionManager
}
// Delete users from the session
if ($empty_users === true) {
if (true === $empty_users) {
$sql = "DELETE FROM $tbl_session_rel_user
WHERE
session_id = $sessionId AND
@ -7095,7 +7094,7 @@ class SessionManager
$result = Database::query($sql);
if ($result !== false) {
if (false !== $result) {
$data = Database::fetch_assoc($result);
if ($data['qty'] > 0) {
@ -7137,7 +7136,7 @@ class SessionManager
'first'
);
if ($trackResult != false) {
if (false != $trackResult) {
return $trackResult['total_time'] ? $trackResult['total_time'] : '00:00:00';
}
@ -7698,7 +7697,7 @@ class SessionManager
$sessionAccessUrlTable = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$accessUrlId = api_get_current_access_url_id();
if ($accessUrlId != -1) {
if (-1 != $accessUrlId) {
$sql = "SELECT DISTINCT s.*
FROM $sessionTable s
INNER JOIN $sessionUserTable sru ON s.id = sru.id_session
@ -8100,7 +8099,7 @@ class SessionManager
$user_id = api_get_user_id();
if (api_is_session_admin() &&
api_get_setting('allow_session_admins_to_see_all_sessions') == 'false'
'false' == api_get_setting('allow_session_admins_to_see_all_sessions')
) {
$where .= " WHERE s.session_admin_id = $user_id ";
}
@ -8161,7 +8160,7 @@ class SessionManager
if (api_is_multiple_url_enabled()) {
$table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
if (-1 != $access_url_id) {
$where .= " AND ar.access_url_id = $access_url_id ";
$query_rows = "SELECT count(*) as total_rows
FROM $tbl_session s
@ -8666,7 +8665,7 @@ class SessionManager
if (!api_is_platform_admin()) {
if (api_is_session_admin() &&
api_get_setting('allow_session_admins_to_manage_all_sessions') == 'false'
'false' == api_get_setting('allow_session_admins_to_manage_all_sessions')
) {
$where .= " AND s.session_admin_id = $user_id ";
}
@ -8698,7 +8697,7 @@ class SessionManager
$extra_fields_info[$extra['id']] = $info;
}
if ($info['field_type'] == ExtraFieldModel::FIELD_TYPE_DOUBLE_SELECT) {
if (ExtraFieldModel::FIELD_TYPE_DOUBLE_SELECT == $info['field_type']) {
$double_fields[$info['id']] = $info;
}
}
@ -8791,7 +8790,7 @@ class SessionManager
if (api_is_multiple_url_enabled()) {
$table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
if (-1 != $access_url_id) {
$query = "$select
FROM $tbl_session s
LEFT JOIN $tbl_session_field_values fv
@ -8843,7 +8842,7 @@ class SessionManager
$session_id = $session['id'];
$session['name'] = Display::url($session['name'], "resume_session.php?id_session=".$session['id']);
$session['coach_name'] = Display::url($session['coach_name'], "user_information.php?user_id=".$session['user_id']);
if ($session['session_active'] == 1) {
if (1 == $session['session_active']) {
$session['session_active'] = $acceptIcon;
} else {
$session['session_active'] = $errorIcon;
@ -9340,7 +9339,7 @@ class SessionManager
$userRelSession = self::getUserSession($userId, $sessionId);
if ($userRelSession) {
if (isset($userRelSession['collapsed']) && $userRelSession['collapsed'] != '') {
if (isset($userRelSession['collapsed']) && '' != $userRelSession['collapsed']) {
$collapsed = $userRelSession['collapsed'];
}
} else {
@ -9349,7 +9348,7 @@ class SessionManager
$link = $collapsableLink.'&session_id='.$sessionId.'&value=1';
$image = '<i class="fa fa-folder-open"></i>';
if ($collapsed == 1) {
if (1 == $collapsed) {
$link = $collapsableLink.'&session_id='.$sessionId.'&value=0';
$image = '<i class="fa fa-folder"></i>';
}
@ -9586,9 +9585,9 @@ class SessionManager
*/
private static function compareBySessionName($listA, $listB)
{
if ($listB['catSessionName'] == '') {
if ('' == $listB['catSessionName']) {
return -1;
} elseif ($listA['catSessionName'] == '') {
} elseif ('' == $listA['catSessionName']) {
return 1;
} elseif ($listA['catSessionName'] == $listB['catSessionName']) {
return 0;

@ -14,8 +14,6 @@ use Fhaculty\Graph\Vertex;
* Class SkillProfile.
*
* @todo break the file in different classes
*
* @package chamilo.library
*/
class SkillProfile extends Model
{
@ -2480,8 +2478,8 @@ class Skill extends Model
}
/**
* @param \Chamilo\SkillBundle\Entity\SkillRelItem $skillRelItem
* @param \Chamilo\SkillBundle\Entity\SkillRelItemRelUser $skillRelItemRelUser
* @param SkillRelItem $skillRelItem
* @param SkillRelItemRelUser $skillRelItemRelUser
* @param bool $addHeader
*
* @return string
@ -2981,7 +2979,7 @@ class Skill extends Model
*/
public function addSkillToUserBadge($user, $skill, $levelId, $argumentation, $authorId)
{
$showLevels = api_get_configuration_value('hide_skill_levels') === false;
$showLevels = false === api_get_configuration_value('hide_skill_levels');
$entityManager = Database::getManager();

@ -12,8 +12,6 @@ use Zend\Feed\Reader\Reader;
*
* This class provides methods for the social network management.
* Include/require it in your code to use its features.
*
* @package chamilo.social
*/
class SocialManager extends UserManager
{
@ -570,7 +568,7 @@ class SocialManager extends UserManager
return '';
}
$feeds = explode(';', $feed['rssfeeds']);
if (count($feeds) == 0) {
if (0 == count($feeds)) {
return '';
}
$res = '';

@ -161,7 +161,7 @@ class SortableTable extends HTML_Table
}
$cleanSessionData = Session::read('clean_sortable_table');
if ($cleanSessionData === true) {
if (true === $cleanSessionData) {
$this->cleanUrlSessionParams();
}
@ -204,9 +204,9 @@ class SortableTable extends HTML_Table
if (!in_array($my_session_direction, ['ASC', 'DESC'])) {
$this->direction = 'ASC';
} else {
if ($my_session_direction === 'ASC') {
if ('ASC' === $my_session_direction) {
$this->direction = 'ASC';
} elseif ($my_session_direction === 'DESC') {
} elseif ('DESC' === $my_session_direction) {
$this->direction = 'DESC';
}
}
@ -217,7 +217,7 @@ class SortableTable extends HTML_Table
if (!in_array($my_get_direction, ['ASC', 'DESC'])) {
$this->direction = 'ASC';
} else {
if ($my_get_direction === 'ASC') {
if ('ASC' === $my_get_direction) {
$this->direction = 'ASC';
} elseif ($my_get_direction === 'DESC') {
$this->direction = 'DESC';
@ -729,7 +729,7 @@ class SortableTable extends HTML_Table
}
}
if ($this->odd_even_rows_enabled == true) {
if (true == $this->odd_even_rows_enabled) {
$this->altRowAttributes(
0,
['class' => 'row_odd'],
@ -783,7 +783,7 @@ class SortableTable extends HTML_Table
return '';
}
if ($this->hideItemSelector === true) {
if (true === $this->hideItemSelector) {
return '';
}
@ -869,7 +869,7 @@ class SortableTable extends HTML_Table
$column = $counter;
$param['direction'] = 'ASC';
if ($this->column == $column && $this->direction == 'ASC') {
if ($this->column == $column && 'ASC' == $this->direction) {
$param['direction'] = 'DESC';
}
@ -885,7 +885,7 @@ class SortableTable extends HTML_Table
$link .= $this->get_additional_url_paramstring();
$link .= '">'.$label.'</a>';
if ($this->column == $column) {
$link .= $this->direction == 'ASC' ? ' &#8595;' : ' &#8593;';
$link .= 'ASC' == $this->direction ? ' &#8595;' : ' &#8593;';
}
}
$this->setHeaderContents(0, $column, $link);

@ -3,8 +3,6 @@
* Manage specific tools.
*
* @todo convert into a class
*
* @package chamilo.library
*/
// Database table definitions
@ -27,7 +25,7 @@ function add_specific_field($name)
$_safe_name = Database::escape_string($name);
$_safe_code = substr($_safe_name, 0, 1);
$_safe_code = get_specific_field_code_from_name($_safe_code);
if ($_safe_code === false) {
if (false === $_safe_code) {
return false;
}
$sql = sprintf($sql, $table_sf, $_safe_code, $_safe_name);

@ -3,8 +3,6 @@
/**
* This is a library with some functions to sort tabular data.
*
* @package chamilo.library
*/
define('SORT_DATE', 3);
define('SORT_IMAGE', 4);
@ -43,7 +41,7 @@ class TableSort
return $data;
}
if ($type == SORT_REGULAR) {
if (SORT_REGULAR == $type) {
$type = SORT_STRING;
if (self::is_image_column($data, $column)) {
$type = SORT_IMAGE;
@ -70,13 +68,13 @@ class TableSort
*/
public static function getSortFunction($type, $direction, $column)
{
$compareOperator = $direction == SORT_ASC ? '>' : '<=';
$compareOperator = SORT_ASC == $direction ? '>' : '<=';
switch ($type) {
case SORT_NUMERIC:
$function = function ($a, $b) use ($column, $compareOperator) {
$result = strip_tags($a[$column]) <= strip_tags($b[$column]);
if ($compareOperator === '>') {
if ('>' === $compareOperator) {
$result = strip_tags($a[$column]) > strip_tags($b[$column]);
}
@ -89,7 +87,7 @@ class TableSort
api_strtolower(strip_tags($a[$column], "<img>")),
api_strtolower(strip_tags($b[$column], "<img>"))
) <= 0;
if ($compareOperator === '>') {
if ('>' === $compareOperator) {
$result = api_strnatcmp(
api_strtolower(strip_tags($a[$column], "<img>")),
api_strtolower(strip_tags($b[$column], "<img>"))
@ -103,7 +101,7 @@ class TableSort
case SORT_DATE:
$function = function ($a, $b) use ($column, $compareOperator) {
$result = strtotime(strip_tags($a[$column])) <= strtotime(strip_tags($b[$column]));
if ($compareOperator === '>') {
if ('>' === $compareOperator) {
$result = strtotime(strip_tags($a[$column])) > strtotime(strip_tags($b[$column]));
}
@ -117,7 +115,7 @@ class TableSort
api_strtolower(strip_tags($a[$column])),
api_strtolower(strip_tags($b[$column]))
) <= 0;
if ($compareOperator === '>') {
if ('>' === $compareOperator) {
$result = api_strnatcmp(
api_strtolower(strip_tags($a[$column])),
api_strtolower(strip_tags($b[$column]))
@ -175,7 +173,7 @@ class TableSort
$column = isset($column_order[$column]) ? $column_order[$column] : $column;
}
if ($type == SORT_REGULAR) {
if (SORT_REGULAR == $type) {
if (self::is_image_column($data, $column)) {
$type = SORT_IMAGE;
} elseif (self::is_date_column($data, $column)) {
@ -193,7 +191,7 @@ class TableSort
$new_data = [];
if (!empty($data)) {
foreach ($data as $document) {
if ($document['type'] === 'folder') {
if ('folder' === $document['type']) {
$docs_to_sort[$document['id']] = api_strtolower($document['name']);
} else {
$folder_to_sort[$document['id']] = api_strtolower($document['name']);
@ -201,7 +199,7 @@ class TableSort
$new_data[$document['id']] = $document;
}
if ($direction == SORT_ASC) {
if (SORT_ASC == $direction) {
if (!empty($docs_to_sort)) {
api_natsort($docs_to_sort);
}
@ -336,7 +334,7 @@ class TableSort
// at least one img-tag
$is_image &= strlen(trim(strip_tags($row[$column], '<img>'))) > 0;
// and no text outside attribute-values
$is_image &= strlen(trim(strip_tags($row[$column]))) == 0;
$is_image &= 0 == strlen(trim(strip_tags($row[$column])));
}
if (!$is_image) {
break;

@ -5,8 +5,6 @@
* This is the text library for Chamilo.
* It is loaded during the global initialization,
* so the functions below are available everywhere.
*
* @package chamilo.library
*/
define('EXERCISE_NUMBER_OF_DECIMALS', 2);

@ -8,8 +8,6 @@
*
* @author Christian Fasanando <christian1827@gmail.com>
* @author Julio Montoya <gugli100@gmail.com> SQL fixes
*
* @package chamilo.course_progress
*/
class Thematic
{

@ -52,7 +52,7 @@ class Tracking
return null;
}
$courseInfo = api_get_course_info_by_id($course_id);
if ($type == 'count') {
if ('count' == $type) {
return GroupManager::get_group_list(null, $courseInfo, null, $sessionId, true);
}
@ -225,7 +225,7 @@ class Tracking
$output .= $extra;
$url_suffix = '&lp_id='.$lp_id;
if ($origin === 'tracking') {
if ('tracking' === $origin) {
$url_suffix = '&session_id='.$session_id.'&course='.$courseCode.'&student_id='.$user_id.'&lp_id='.$lp_id.'&origin='.$origin;
}
@ -396,7 +396,7 @@ class Tracking
if (($extend_this || $extend_all) && $num > 0) {
$row = Database::fetch_array($result);
$result_disabled_ext_all = false;
if ($row['item_type'] === 'quiz') {
if ('quiz' === $row['item_type']) {
// Check results_disabled in quiz table.
$my_path = Database::escape_string($row['path']);
$sql = "SELECT results_disabled
@ -408,7 +408,7 @@ class Tracking
$row_result_disabled = Database::fetch_row($res_result_disabled);
if (Database::num_rows($res_result_disabled) > 0 &&
(int) $row_result_disabled[0] === 1
1 === (int) $row_result_disabled[0]
) {
$result_disabled_ext_all = true;
}
@ -443,7 +443,7 @@ class Tracking
$counter++;
$action = null;
if ($type === 'classic') {
if ('classic' === $type) {
$action = '<td></td>';
}
@ -1091,7 +1091,7 @@ class Tracking
// Get attempts of a exercise.
if (!empty($lp_id) &&
!empty($lp_item_id) &&
$row['item_type'] === 'quiz'
'quiz' === $row['item_type']
) {
$sql = "SELECT path FROM $TBL_LP_ITEM
WHERE
@ -1271,7 +1271,7 @@ class Tracking
}
$action = null;
if ($type === 'classic') {
if ('classic' === $type) {
$action = '<td></td>';
}
@ -1796,14 +1796,14 @@ class Tracking
$extraFieldValue = new ExtraFieldValue('session');
$value = $extraFieldValue->get_values_by_handler_and_field_variable($sessionId, 'new_tracking_system');
if ($value && isset($value['value']) && $value['value'] == 1) {
if ($value && isset($value['value']) && 1 == $value['value']) {
return true;
}
} else {
if ($courseId) {
$extraFieldValue = new ExtraFieldValue('course');
$value = $extraFieldValue->get_values_by_handler_and_field_variable($courseId, 'new_tracking_system');
if ($value && isset($value['value']) && $value['value'] == 1) {
if ($value && isset($value['value']) && 1 == $value['value']) {
return true;
}
}
@ -1858,7 +1858,7 @@ class Tracking
UNIX_TIMESTAMP(logout_course_date) > UNIX_TIMESTAMP(login_course_date) AND
c_id = '$courseId' ";
if ($session_id != -1) {
if (-1 != $session_id) {
$sql .= "AND session_id = '$session_id' ";
}
@ -2031,7 +2031,7 @@ class Tracking
// Show the last date on which the user acceed the session when it was active
$where_condition = '';
$userInfo = api_get_user_info($student_id);
if ($userInfo['status'] == STUDENT && !empty($session_id)) {
if (STUDENT == $userInfo['status'] && !empty($session_id)) {
// fin de acceso a la sesión
$sessionInfo = SessionManager::fetch($session_id);
$last_access = $sessionInfo['access_end_date'];
@ -3440,7 +3440,7 @@ class Tracking
if (api_is_multiple_url_enabled()) {
$tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
if (-1 != $access_url_id) {
$sql = 'SELECT scu.session_id, scu.c_id
FROM '.$tbl_session_course_user.' scu
INNER JOIN '.$tbl_session_rel_access_url.' sru
@ -3487,7 +3487,7 @@ class Tracking
if (api_is_multiple_url_enabled()) {
$tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
if (-1 != $access_url_id) {
$sql = 'SELECT session_course_user.user_id
FROM '.$tbl_session_course_user.' as session_course_user
INNER JOIN '.$tbl_session_user.' sru
@ -3585,7 +3585,7 @@ class Tracking
if (api_is_multiple_url_enabled()) {
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
if (-1 != $access_url_id) {
$sql = 'SELECT DISTINCT c.code
FROM '.$tbl_session_course_user.' scu
INNER JOIN '.$tbl_course.' c
@ -3621,7 +3621,7 @@ class Tracking
if (api_is_multiple_url_enabled()) {
$tbl_course_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
$access_url_id = api_get_current_access_url_id();
if ($access_url_id != -1) {
if (-1 != $access_url_id) {
$sql = 'SELECT DISTINCT c.code
FROM '.$tbl_session_course.' as session_course
INNER JOIN '.$tbl_course.' c
@ -6985,8 +6985,6 @@ class Tracking
/**
* @todo move into a proper file
*
* @package chamilo.tracking
*/
class TrackingCourseLog
{
@ -7551,8 +7549,6 @@ class TrackingCourseLog
$conditions['get_count'] = true;
return self::get_user_data(null, null, null, null, $conditions);
//return count($user_ids);
}
/**
@ -7784,14 +7780,14 @@ class TrackingCourseLog
$user['user_id'],
$courseId,
$session_id,
$export_csv === false
false === $export_csv
);
$user['last_connection'] = Tracking::get_last_connection_date_on_the_course(
$user['user_id'],
$courseInfo,
$session_id,
$export_csv === false
false === $export_csv
);
if ($export_csv) {

@ -5,8 +5,6 @@
* Class UrlManager
* This library provides functions for the access_url management.
* Include/require it in your code to use its functionality.
*
* @package chamilo.library
*/
class UrlManager
{
@ -123,7 +121,7 @@ class UrlManager
}
/**
* @param string $urlId
* @param int $urlId
*
* @return int
*/
@ -409,13 +407,13 @@ class UrlManager
public static function set_url_status($status, $urlId)
{
$url_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL);
if ($status == 'lock') {
if ('lock' == $status) {
$status_db = '0';
}
if ($status == 'unlock') {
if ('unlock' == $status) {
$status_db = '1';
}
if (($status_db == '1' || $status_db == '0') && is_numeric($urlId)) {
if (('1' == $status_db || '0' == $status_db) && is_numeric($urlId)) {
$sql = "UPDATE $url_table SET active='".intval($status_db)."'
WHERE id='".intval($urlId)."'";
Database::query($sql);
@ -534,7 +532,7 @@ class UrlManager
foreach ($url_list as $urlId) {
foreach ($user_list as $user_id) {
$count = self::relation_url_user_exist($user_id, $urlId);
if ($count == 0) {
if (0 == $count) {
$sql = "INSERT INTO $table
SET
user_id = ".intval($user_id).",
@ -575,7 +573,7 @@ class UrlManager
$courseId = $courseInfo['real_id'];
$count = self::relation_url_course_exist($courseId, $urlId);
if ($count == 0) {
if (0 == $count) {
$sql = "INSERT INTO $table
SET c_id = '".$courseId."', access_url_id = ".intval($urlId);
$result = Database::query($sql);
@ -612,7 +610,7 @@ class UrlManager
$userGroupId,
$urlId
);
if ($count == 0) {
if (0 == $count) {
$result = self::addUserGroupToUrl($userGroupId, $urlId);
if ($result) {
$resultArray[$urlId][$userGroupId] = 1;
@ -644,7 +642,7 @@ class UrlManager
foreach ($urlList as $urlId) {
foreach ($courseCategoryList as $categoryCourseId) {
$count = self::relationUrlCourseCategoryExist($categoryCourseId, $urlId);
if ($count == 0) {
if (0 == $count) {
$result = self::addCourseCategoryToUrl($categoryCourseId, $urlId);
if ($result) {
$resultArray[$urlId][$categoryCourseId] = 1;
@ -745,7 +743,7 @@ class UrlManager
foreach ($session_list as $session_id) {
$count = self::relation_url_session_exist($session_id, $urlId);
if ($count == 0) {
if (0 == $count) {
$sql = "INSERT INTO $table
SET
session_id = ".intval($session_id).",

@ -6,8 +6,6 @@
*
* This class provides methods for the UserGroup management.
* Include/require it in your code to use its features.
*
* @package chamilo.library
*/
class UserGroup extends Model
{
@ -139,7 +137,7 @@ class UserGroup extends Model
return 0;
} else {
$list = [];
$showCalendar = api_get_plugin_setting('learning_calendar', 'enabled') === 'true';
$showCalendar = 'true' === api_get_plugin_setting('learning_calendar', 'enabled');
$calendarPlugin = null;
if ($showCalendar) {
$calendarPlugin = LearningCalendarPlugin::create();
@ -464,7 +462,7 @@ class UserGroup extends Model
";
}
if ($type != -1) {
if (-1 != $type) {
$type = (int) $type;
$options['where']['AND group_type = ? '] = $type;
}
@ -531,7 +529,7 @@ class UserGroup extends Model
";
}
if ($type != -1) {
if (-1 != $type) {
$type = (int) $type;
$options['where']['AND group_type = ? '] = $type;
}
@ -756,7 +754,7 @@ class UserGroup extends Model
$where = ['where' => ['user_id = ?' => $userId]];
}
if ($filterByType !== null) {
if (null !== $filterByType) {
$where['where'][' AND g.group_type = ?'] = (int) $filterByType;
}
@ -1098,7 +1096,7 @@ class UserGroup extends Model
$res = Database::query($sql);
return Database::num_rows($res) != 0;
return 0 != Database::num_rows($res);
}
/**
@ -1106,7 +1104,7 @@ class UserGroup extends Model
*/
public function allowTeachers()
{
return api_get_configuration_value('allow_teachers_to_classes') === true;
return true === api_get_configuration_value('allow_teachers_to_classes');
}
/**
@ -1322,7 +1320,7 @@ class UserGroup extends Model
$params['allow_members_leave_group'] = isset($params['allow_members_leave_group']) ? 1 : 0;
$groupExists = $this->usergroup_exists(trim($params['name']));
if ($groupExists == false) {
if (false == $groupExists) {
if ($this->allowTeachers()) {
$params['author_id'] = api_get_user_id();
}
@ -1332,7 +1330,7 @@ class UserGroup extends Model
$this->subscribeToUrl($id, api_get_current_access_url_id());
}
if ($params['group_type'] == self::SOCIAL_CLASS) {
if (self::SOCIAL_CLASS == $params['group_type']) {
$this->add_user_to_group(
api_get_user_id(),
$id,

@ -5,12 +5,8 @@
* Class aicc
* Defines the AICC class, which is meant to contain the aicc items (nuclear elements).
*
* @package chamilo.learnpath
*
* @author Yannick Warnier <ywarnier@beeznest.org>
* @license GNU/GPL
*
* @package chamilo.learnpath
*/
class aicc extends learnpath
{
@ -341,7 +337,7 @@ class aicc extends learnpath
}
// Now update previous item to change next_item_id.
if ($previous != 0) {
if (0 != $previous) {
$upd = "UPDATE $new_lp_item SET next_item_id = $item_id WHERE c_id = $course_id AND id = $previous";
Database::query($upd);
// Update the previous item id.

@ -7,8 +7,6 @@
*
* Container for the aiccResource class that deals with elemens from AICC Course Structure file
*
* @package chamilo.learnpath
*
* @author Yannick Warnier <ywarnier@beeznest.org>
* @license GNU/GPL
*/
@ -39,7 +37,7 @@ class aiccBlock extends learnpathItem
$this->identifier = strtolower($value);
break;
case 'member':
if (strstr($value, ',') !== false) {
if (false !== strstr($value, ',')) {
$temp = explode(',', $value);
foreach ($temp as $val) {
if (!empty($val)) {

@ -6,12 +6,8 @@
* This class handles the elements from an AICC Descriptor file.
* Container for the aiccItem class that deals with AICC Assignable Units (AUs).
*
* @package chamilo.learnpath
*
* @author Yannick Warnier <ywarnier@beeznest.org>
* @license GNU/GPL
*
* @package chamilo.learnpath
*/
class aiccItem extends learnpathItem
{

@ -6,8 +6,6 @@
* Class defining the Block elements in an AICC Course Structure file.
* Container for the aiccResource class that deals with elemens from AICC Objectives file.
*
* @package chamilo.learnpath
*
* @author Yannick Warnier <ywarnier@beeznest.org>
* @license GNU/GPL
*/
@ -38,7 +36,7 @@ class aiccObjective extends learnpathItem
$this->identifier = strtolower($value);
break;
case 'member':
if (strstr($value, ',') !== false) {
if (false !== strstr($value, ',')) {
$temp = explode(',', $value);
foreach ($temp as $val) {
if (!empty($val)) {

Loading…
Cancel
Save