Update from 1.11.x

pull/3288/head
Julio Montoya 6 years ago
parent 9eaa1daffa
commit 6895562b36
  1. 3
      main/exercise/Annotation.php
  2. 2
      main/exercise/export/scorm/ScormAnswerMultipleChoice.php
  3. 30
      main/exercise/export/scorm/ScormAssessmentItem.php
  4. 3
      main/exercise/export/scorm/ScormExercise.php
  5. 2
      main/exercise/export/scorm/ScormQuestion.php
  6. 30
      main/forum/forumfunction.inc.php
  7. 3
      main/forum/forumqualify.php
  8. 7
      main/forum/forumsearch.php
  9. 2
      main/forum/iframe_thread.php
  10. 14
      main/forum/index.php
  11. 2
      main/gradebook/certificate_report.php
  12. 2
      main/gradebook/exercise_jump.php
  13. 4
      main/gradebook/get_badges.php
  14. 6
      main/gradebook/gradebook.php
  15. 5
      main/gradebook/gradebook_add_cat.php
  16. 11
      main/gradebook/gradebook_add_eval.php
  17. 15
      main/gradebook/gradebook_add_link.php
  18. 5
      main/gradebook/gradebook_add_link_select_course.php
  19. 5
      main/gradebook/gradebook_add_result.php
  20. 6
      main/gradebook/index.php
  21. 7
      main/gradebook/lib/GradebookUtils.php
  22. 16
      main/gradebook/lib/be/abstractlink.class.php
  23. 16
      main/gradebook/lib/be/attendancelink.class.php
  24. 62
      main/gradebook/lib/be/category.class.php
  25. 2
      main/gradebook/lib/be/dropboxlink.class.php
  26. 3
      main/gradebook/lib/be/evallink.class.php
  27. 14
      main/gradebook/lib/be/evaluation.class.php
  28. 8
      main/gradebook/lib/be/exerciselink.class.php
  29. 16
      main/gradebook/lib/be/forumthreadlink.class.php
  30. 2
      main/gradebook/lib/be/gradebookitem.class.php
  31. 10
      main/gradebook/lib/be/learnpathlink.class.php
  32. 2
      main/gradebook/lib/be/linkfactory.class.php
  33. 10
      main/gradebook/lib/be/result.class.php
  34. 10
      main/gradebook/lib/be/studentpublicationlink.class.php
  35. 12
      main/gradebook/lib/be/surveylink.class.php
  36. 10
      main/gradebook/lib/fe/catform.class.php
  37. 2
      main/gradebook/lib/fe/dataform.class.php
  38. 8
      main/gradebook/lib/fe/displaygradebook.php
  39. 10
      main/gradebook/lib/fe/evalform.class.php
  40. 4
      main/gradebook/lib/fe/exportgradebook.php
  41. 4
      main/gradebook/lib/fe/flatviewtable.class.php
  42. 32
      main/gradebook/lib/fe/gradebooktable.class.php
  43. 10
      main/gradebook/lib/fe/linkaddeditform.class.php
  44. 6
      main/gradebook/lib/fe/linkform.class.php
  45. 6
      main/gradebook/lib/fe/resulttable.class.php
  46. 4
      main/gradebook/lib/fe/scoredisplayform.class.php
  47. 6
      main/gradebook/lib/fe/userform.class.php
  48. 6
      main/gradebook/lib/fe/usertable.class.php
  49. 42
      main/gradebook/lib/flatview_data_generator.class.php
  50. 23
      main/gradebook/lib/gradebook_data_generator.class.php
  51. 2
      main/gradebook/lib/gradebook_result.class.php
  52. 8
      main/gradebook/lib/results_data_generator.class.php
  53. 3
      main/gradebook/lib/scoredisplay.class.php
  54. 8
      main/gradebook/lib/user_data_generator.class.php
  55. 2
      main/gradebook/my_certificates.php
  56. 2
      main/gradebook/search.php
  57. 5
      main/gradebook/user_stats.php
  58. 2
      main/template/default/forum/list.tpl
  59. 2
      main/tracking/course_log_groups.php
  60. 2
      main/tracking/lp_results_by_user.php

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
@ -6,8 +7,6 @@
* Allow instanciate an object of type HotSpot extending the class question.
*
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
*
* @package chamilo.
*/
class Annotation extends Question
{

@ -43,7 +43,7 @@ class ScormAnswerMultipleChoice extends Answer
if ($this->correct[$i]) {
$jstmpc .= $i.',';
}
$jstmpw .= 'questions_answers_ponderation['.$questionId.']['.$i.'] = '.$this->weighting[$i].";";
$jstmpw .= 'questions_answers_ponderation['.$questionId.']['.$i.'] = '.$this->weighting[$i].';';
$jstmpw .= 'questions_answers_correct['.$questionId.']['.$i.'] = '.$this->correct[$i].';';
$id++;
}

@ -36,14 +36,7 @@ class ScormAssessmentItem
*/
public function start_page()
{
$head = '';
/*if ($this->standalone) {
$charset = 'UTF-8';
$head = '<?xml version="1.0" encoding="'.$charset.'" standalone="no"?>';
$head .= '<html>';
}*/
return $head;
return '';
}
/**
@ -75,19 +68,7 @@ class ScormAssessmentItem
*/
public function css()
{
$css = '';
// if ($this->standalone) {
// $css = '<style type="text/css" media="screen, projection">';
// $css .= '/*<![CDATA[*/'."\n";
// $css .= '/*]]>*/'."\n";
// $css .= '</style>'."\n";
// $css .= '<style type="text/css" media="print">';
// $css .= '/*<![CDATA[*/'."\n";
// $css .= '/*]]>*/'."\n";
// $css .= '</style>';
// }
return $css;
return '';
}
/**
@ -107,12 +88,7 @@ class ScormAssessmentItem
*/
public function start_js()
{
$js = '<script type="text/javascript" src="assets/api_wrapper.js"></script>';
// if ($this->standalone) {
// return '<script>';
// }
return $js;
return '<script type="text/javascript" src="assets/api_wrapper.js"></script>';
}
/**

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CourseBundle\Entity\CQuiz;
@ -89,7 +90,7 @@ class ScormExercise
public function start_body()
{
return '<body>'.
'<h1>'.$this->exercise->selectTitle().'</h1><p>'.$this->exercise->selectDescription()."</p>".
'<h1>'.$this->exercise->selectTitle().'</h1><p>'.$this->exercise->selectDescription().'</p>'.
'<form id="chamilo_scorm_form" method="post" action="">'.
'<table width="100%">';
}

@ -213,7 +213,7 @@ class ScormQuestion extends Question
$weight = 0;
break;
}
$js .= 'questions_score_max['.$this->js_id.'] = '.$weight.";";
$js .= 'questions_score_max['.$this->js_id.'] = '.$weight.';';
return $js;
}

@ -49,8 +49,8 @@ function setFocus() {
$htmlHeadXtra[] = api_get_jquery_libraries_js(['jquery-ui', 'jquery-upload']);
// Recover Thread ID, will be used to generate delete attachment URL to do ajax
$threadId = isset($_REQUEST['thread']) ? intval($_REQUEST['thread']) : 0;
$forumId = isset($_REQUEST['forum']) ? intval($_REQUEST['forum']) : 0;
$threadId = isset($_REQUEST['thread']) ? (int) ($_REQUEST['thread']) : 0;
$forumId = isset($_REQUEST['forum']) ? (int) ($_REQUEST['forum']) : 0;
$ajaxUrl = api_get_path(WEB_AJAX_PATH).'forum.ajax.php?'.api_get_cidreq();
// The next javascript script is to delete file by ajax
@ -492,13 +492,13 @@ function delete_forum_image($forum_id)
{
$table_forums = Database::get_course_table(TABLE_FORUM);
$course_id = api_get_course_int_id();
$forum_id = intval($forum_id);
$forum_id = (int) $forum_id;
$sql = "SELECT forum_image FROM $table_forums
WHERE forum_id = $forum_id AND c_id = $course_id";
$result = Database::query($sql);
$row = Database::fetch_array($result);
if ($row['forum_image'] != '') {
if ('' != $row['forum_image']) {
$file = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/forum/images/'.$row['forum_image'];
if (file_exists($file)) {
unlink($file);
@ -1256,9 +1256,9 @@ function return_visible_invisible_icon(
function return_lock_unlock_icon($content, $id, $current_lock_status, $additional_url_parameters = '')
{
$html = '';
$id = intval($id);
$id = (int) $id;
//check if the forum is blocked due
if ($content == 'thread') {
if ('thread' == $content) {
if (api_resource_is_locked_by_gradebook($id, LINK_FORUM_THREAD)) {
$html .= Display::return_icon(
'lock_na.png',
@ -1270,7 +1270,7 @@ function return_lock_unlock_icon($content, $id, $current_lock_status, $additiona
return $html;
}
}
if ($current_lock_status == '1') {
if ('1' == $current_lock_status) {
$html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&';
if (is_array($additional_url_parameters)) {
foreach ($additional_url_parameters as $key => $value) {
@ -1280,7 +1280,7 @@ function return_lock_unlock_icon($content, $id, $current_lock_status, $additiona
$html .= 'action=unlock&content='.$content.'&id='.$id.'">'.
Display::return_icon('lock.png', get_lang('Unlock'), [], ICON_SIZE_SMALL).'</a>';
}
if ($current_lock_status == '0') {
if ('0' == $current_lock_status) {
$html .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&';
if (is_array($additional_url_parameters)) {
foreach ($additional_url_parameters as $key => $value) {
@ -1460,22 +1460,22 @@ function move_up_down($content, $direction, $id)
$table_forums = Database::get_course_table(TABLE_FORUM);
$table_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
$course_id = api_get_course_int_id();
$id = intval($id);
$id = (int) $id;
// Determine which field holds the sort order.
if ($content == 'forumcategory') {
if ('forumcategory' == $content) {
$table = $table_categories;
$sort_column = 'cat_order';
$id_column = 'cat_id';
$sort_column = 'cat_order';
} elseif ($content == 'forum') {
} elseif ('forum' == $content) {
$table = $table_forums;
$sort_column = 'forum_order';
$id_column = 'forum_id';
$sort_column = 'forum_order';
// We also need the forum_category of this forum.
$sql = "SELECT forum_category FROM $table_forums
WHERE c_id = $course_id AND forum_id = ".intval($id);
WHERE c_id = $course_id AND forum_id = ".$id;
$result = Database::query($sql);
$row = Database::fetch_array($result);
$forum_category = $row['forum_category'];
@ -1915,9 +1915,9 @@ function get_last_post_by_thread($course_id, $thread_id, $forum_id, $show_visibl
return false;
}
$thread_id = intval($thread_id);
$forum_id = intval($forum_id);
$course_id = intval($course_id);
$thread_id = (int) $thread_id;
$forum_id = (int) $forum_id;
$course_id = (int) $course_id;
$table_posts = Database::get_course_table(TABLE_FORUM_POST);
$sql = "SELECT * FROM $table_posts

@ -1,9 +1,8 @@
<?php
/* For licensing terms, see /license.txt */
/**
* @package chamilo.forum
*
* @todo fix all this qualify files avoid including files, use classes POO jmontoya
*/
require_once __DIR__.'/../inc/global.inc.php';

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
@ -17,8 +18,6 @@
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @copyright Ghent University
*
* @package chamilo.forum
*/
require_once __DIR__.'/../inc/global.inc.php';
@ -73,7 +72,7 @@ if ($origin == 'group') {
}
// Display the header.
if ($origin == 'learnpath') {
if ('learnpath' == $origin) {
Display::display_reduced_header();
} else {
Display::display_header($nameTools);
@ -89,6 +88,6 @@ Event::event_access_tool(TOOL_FORUM);
forum_search();
// Footer
if ($origin != 'learnpath') {
if ('learnpath' != $origin) {
Display :: display_footer();
}

@ -17,8 +17,6 @@
*
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @copyright Ghent University
*
* @package chamilo.forum
*/
require_once __DIR__.'/../inc/global.inc.php';

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
use Chamilo\CourseBundle\Entity\CForumPost;
@ -21,8 +22,6 @@ use ChamiloSession as Session;
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @copyright Ghent University
* @copyright Patrick Cool
*
* @package chamilo.forum
*/
require_once __DIR__.'/../inc/global.inc.php';
@ -59,11 +58,9 @@ if (api_is_in_gradebook()) {
}
$search_forum = isset($_GET['search']) ? Security::remove_XSS($_GET['search']) : '';
/* ACTIONS */
$action = isset($_GET['action']) ? $_GET['action'] : '';
if ($action === 'add') {
if ('add' === $action) {
switch ($_GET['content']) {
case 'forum':
$interbreadcrumb[] = [
@ -164,7 +161,7 @@ if (!api_is_anonymous()) {
$actionLeft = null;
//if is called from learning path
if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])) {
$url = "../lp/lp_controller.php?".api_get_cidreq()
$url = '../lp/lp_controller.php?'.api_get_cidreq()
."&gradebook=&action=add_item&type=step&lp_id='.$lp_id.'#resource_tab-5";
$actionLeft .= Display::url(
Display::return_icon(
@ -221,7 +218,6 @@ if ($value && isset($value['value']) && !empty($value['value'])) {
// Create a search-box
$searchFilter = '';
$translate = api_get_configuration_value('translate_html');
if ($translate) {
$form = new FormValidator('search_simple', 'get', api_get_self().'?'.api_get_cidreq(), null, null, 'inline');
@ -456,7 +452,7 @@ if (is_array($forumCategories)) {
$toolActions = null;
$forumInfo['alert'] = null;
// The number of topics and posts.
if ($hideNotifications == false) {
if (false == $hideNotifications) {
// The number of topics and posts.
if ($forum['forum_of_group'] !== '0') {
if (is_array($mywhatsnew_post_info) && !empty($mywhatsnew_post_info)) {
@ -587,7 +583,7 @@ $tpl->assign('default_user_language', $defaultUserLanguage);
$tpl->assign('languages', $languages);
$extraFieldValue = new ExtraFieldValue('course');
$value = $extraFieldValue->get_values_by_handler_and_field_variable(api_get_course_int_id(), 'global_forum');
if ($value && isset($value['value']) && $value['value'] == 1) {
if ($value && isset($value['value']) && 1 == $value['value']) {
$layout = $tpl->get_template('forum/global_list.tpl');
} else {
$layout = $tpl->get_template('forum/list.tpl');

@ -5,8 +5,6 @@
* List all certificates filtered by session/course and month/year.
*
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
*
* @package chamilo.gradebook
*/
$cidReset = true;

@ -9,8 +9,6 @@
* Most code here is ripped from /main/course_home/course_home.php.
*
* @author Bert Steppé
*
* @package chamilo.gradebook
*/
require_once __DIR__.'/../inc/global.inc.php';
api_block_anonymous_users();

@ -5,8 +5,6 @@
* Show the achieved badges by an user.
*
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
*
* @package chamilo.badge
*/
require_once __DIR__.'/../inc/global.inc.php';
@ -45,7 +43,7 @@ foreach ($userSkills as $skill) {
$backpack = 'https://backpack.openbadges.org/';
$configBackpack = api_get_setting('openbadges_backpack');
if (strcmp($backpack, $configBackpack) !== 0) {
if (0 !== strcmp($backpack, $configBackpack)) {
$backpack = $configBackpack;
if (substr($backpack, -1) !== '/') {
$backpack .= '/';

@ -1,12 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script.
*
* @package chamilo.gradebook
*/
// $cidReset : This is the main difference with gradebook.php, here we say,
// basically, that we are inside a course, and many things depend from that
$cidReset = true;

@ -1,11 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script.
*
* @package chamilo.gradebook
*/
require_once __DIR__.'/../inc/global.inc.php';
$_in_course = true;
$course_code = api_get_course_id();

@ -1,11 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script.
*
* @package chamilo.gradebook
*/
require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_GRADEBOOK;
@ -75,8 +70,8 @@ if ($form->validate()) {
];
Event::registerLog($logInfo);
if ($eval->get_course_code() == null) {
if ($values['adduser'] == 1) {
if (null == $eval->get_course_code()) {
if (1 == $values['adduser']) {
//Disabling code when course code is null see issue #2705
//header('Location: gradebook_add_user.php?selecteval=' . $eval->get_id());
exit;
@ -86,7 +81,7 @@ if ($form->validate()) {
}
} else {
$val_addresult = isset($values['addresult']) ? $values['addresult'] : null;
if ($val_addresult == 1) {
if (1 == $val_addresult) {
header('Location: gradebook_add_result.php?selecteval='.$eval->get_id().'&'.api_get_cidreq());
exit;
} else {

@ -1,11 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script.
*
* @package chamilo.gradebook
*/
require_once __DIR__.'/../inc/global.inc.php';
require_once '../forum/forumfunction.inc.php';
$current_course_tool = TOOL_GRADEBOOK;
@ -24,7 +19,7 @@ $tbl_link = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$session_id = api_get_session_id();
$typeSelected = isset($_GET['typeselected']) ? intval($_GET['typeselected']) : null;
if ($session_id == 0) {
if (0 == $session_id) {
$all_categories = Category::load(
null,
null,
@ -60,7 +55,7 @@ if ($typeform->validate() && isset($_GET['newtypeselected'])) {
}
// link type selected, show 2nd form to retrieve the link data
if (isset($typeSelected) && $typeSelected != '0') {
if (isset($typeSelected) && '0' != $typeSelected) {
$url = api_get_self().'?selectcat='.$selectCat.'&typeselected='.$typeSelected.'&course_code='.$courseCode.'&'.api_get_cidreq();
$addform = new LinkAddEditForm(
@ -101,7 +96,7 @@ if (isset($typeSelected) && $typeSelected != '0') {
// Update view_properties
if (isset($typeSelected) &&
5 == $typeSelected &&
(isset($addvalues['select_link']) && $addvalues['select_link'] != "")
(isset($addvalues['select_link']) && "" != $addvalues['select_link'])
) {
$sql1 = 'SELECT thread_title from '.$tbl_forum_thread.'
WHERE
@ -117,7 +112,7 @@ if (isset($typeSelected) && $typeSelected != '0') {
type = 5;';
$res_l = Database::query($sql_l);
$row = Database::fetch_row($res_l);
if ($row[0] == 0) {
if (0 == $row[0]) {
$link->add();
$sql = 'UPDATE '.$tbl_forum_thread.' SET
thread_qualify_max= "'.api_float_val($addvalues['weight']).'",
@ -142,7 +137,7 @@ if (isset($typeSelected) && $typeSelected != '0') {
Event::registerLog($logInfo);
$addvalue_result = !empty($addvalues['addresult']) ? $addvalues['addresult'] : [];
if ($addvalue_result == 1) {
if (1 == $addvalue_result) {
header('Location: gradebook_add_result.php?selecteval='.$link->get_ref_id().'&'.api_get_cidreq());
exit;
} else {

@ -1,11 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script.
*
* @package chamilo.gradebook
*/
require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_GRADEBOOK;

@ -1,11 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script.
*
* @package chamilo.gradebook
*/
//$cidReset = true;
require_once __DIR__.'/../inc/global.inc.php';
$current_course_tool = TOOL_GRADEBOOK;

@ -3,8 +3,6 @@
/**
* Gradebook controller.
*
* @package chamilo.gradebook
*/
// $cidReset : This is the main difference with gradebook.php, here we say,
@ -231,7 +229,7 @@ if ($selectCat > 0 && $isStudentView) {
if (isset($_GET['createallcategories'])) {
GradebookUtils::block_students();
$coursecat = Category::get_not_created_course_categories($stud_id);
if (!count($coursecat) == 0) {
if (0 == !count($coursecat)) {
foreach ($coursecat as $row) {
$cat = new Category();
$cat->set_name($row[1]);
@ -814,7 +812,7 @@ if (!empty($selectCat)) {
$cat = new Category();
$course_id = CourseManager::get_course_by_category($selectCat);
$show_message = $cat->show_message_resource_delete($course_id);
if ($show_message == '') {
if ('' == $show_message) {
// Student
if (!api_is_allowed_to_edit() && !api_is_excluded_user_type()) {
$certificate = Category::generateUserCertificate(

@ -128,7 +128,7 @@ class GradebookUtils
}
} else {
$isCoach = api_is_coach(api_get_session_id(), api_get_course_int_id());
if ($isCoach === false) {
if (false === $isCoach) {
if (!api_is_allowed_to_edit()) {
api_not_allowed();
}
@ -555,9 +555,8 @@ class GradebookUtils
if (Database::num_rows($res) < 1) {
return false;
}
$row = Database::fetch_array($res, 'ASSOC');
return $row;
return Database::fetch_array($res, 'ASSOC');
}
/**
@ -691,7 +690,7 @@ class GradebookUtils
WHERE gc.cat_id = $cat_id AND user_id = $user_id ";
$rs_exist = Database::query($sql);
$row = Database::fetch_array($rs_exist);
if ($row['count'] == 0) {
if (0 == $row['count']) {
$params = [
'cat_id' => $cat_id,
'user_id' => $user_id,

@ -12,8 +12,6 @@ use Chamilo\CoreBundle\Entity\GradebookLink;
*
* @author Bert Steppé
* @author Julio Montoya <gugli100@gmail.com> security improvements
*
* @package chamilo.gradebook
*/
abstract class AbstractLink implements GradebookItem
{
@ -176,7 +174,7 @@ abstract class AbstractLink implements GradebookItem
public function is_locked()
{
return isset($this->locked) && $this->locked == 1 ? true : false;
return isset($this->locked) && 1 == $this->locked ? true : false;
}
public function is_visible()
@ -306,7 +304,7 @@ abstract class AbstractLink implements GradebookItem
$paramcount++;
}
if (isset($type)) {
if ($paramcount != 0) {
if (0 != $paramcount) {
$sql .= ' AND';
} else {
$sql .= ' WHERE';
@ -315,7 +313,7 @@ abstract class AbstractLink implements GradebookItem
$paramcount++;
}
if (isset($ref_id)) {
if ($paramcount != 0) {
if (0 != $paramcount) {
$sql .= ' AND';
} else {
$sql .= ' WHERE';
@ -324,7 +322,7 @@ abstract class AbstractLink implements GradebookItem
$paramcount++;
}
if (isset($user_id)) {
if ($paramcount != 0) {
if (0 != $paramcount) {
$sql .= ' AND';
} else {
$sql .= ' WHERE';
@ -333,7 +331,7 @@ abstract class AbstractLink implements GradebookItem
$paramcount++;
}
if (isset($course_code)) {
if ($paramcount != 0) {
if (0 != $paramcount) {
$sql .= ' AND';
} else {
$sql .= ' WHERE';
@ -342,7 +340,7 @@ abstract class AbstractLink implements GradebookItem
$paramcount++;
}
if (isset($category_id)) {
if ($paramcount != 0) {
if (0 != $paramcount) {
$sql .= ' AND';
} else {
$sql .= ' WHERE';
@ -351,7 +349,7 @@ abstract class AbstractLink implements GradebookItem
$paramcount++;
}
if (isset($visible)) {
if ($paramcount != 0) {
if (0 != $paramcount) {
$sql .= ' AND';
} else {
$sql .= ' WHERE';

@ -5,8 +5,6 @@
* Gradebook link to attendance item.
*
* @author Christian Fasanando (christian1827@gmail.com)
*
* @package chamilo.gradebook
*/
class AttendanceLink extends AbstractLink
{
@ -61,7 +59,7 @@ class AttendanceLink extends AbstractLink
$result = Database::query($sql);
while ($data = Database::fetch_array($result)) {
if (isset($data['attendance_qualify_title']) && $data['attendance_qualify_title'] != '') {
if (isset($data['attendance_qualify_title']) && '' != $data['attendance_qualify_title']) {
$cats[] = [$data['id'], $data['attendance_qualify_title']];
} else {
$cats[] = [$data['id'], $data['name']];
@ -88,7 +86,7 @@ class AttendanceLink extends AbstractLink
$result = Database::query($sql);
$number = Database::fetch_row($result);
return $number[0] != 0;
return 0 != $number[0];
}
/**
@ -141,7 +139,7 @@ class AttendanceLink extends AbstractLink
while ($data = Database::fetch_array($scores)) {
if (!(array_key_exists($data['user_id'], $students))) {
if ($attendance['attendance_qualify_max'] != 0) {
if (0 != $attendance['attendance_qualify_max']) {
$students[$data['user_id']] = $data['score'];
$rescount++;
$sum += $data['score'] / $attendance['attendance_qualify_max'];
@ -154,7 +152,7 @@ class AttendanceLink extends AbstractLink
}
}
if ($rescount == 0) {
if (0 == $rescount) {
return [null, null];
} else {
switch ($type) {
@ -198,7 +196,7 @@ class AttendanceLink extends AbstractLink
$this->get_attendance_data();
$attendance_title = isset($this->attendance_data['name']) ? $this->attendance_data['name'] : '';
$attendance_qualify_title = isset($this->attendance_data['attendance_qualify_title']) ? $this->attendance_data['attendance_qualify_title'] : '';
if (isset($attendance_qualify_title) && $attendance_qualify_title != '') {
if (isset($attendance_qualify_title) && '' != $attendance_qualify_title) {
return $this->attendance_data['attendance_qualify_title'];
} else {
return $attendance_title;
@ -223,7 +221,7 @@ class AttendanceLink extends AbstractLink
$result = Database::query($sql);
$number = Database::fetch_row($result);
return $number[0] != 0;
return 0 != $number[0];
}
public function get_link()
@ -264,7 +262,7 @@ class AttendanceLink extends AbstractLink
private function get_attendance_data()
{
$tbl_name = $this->get_attendance_table();
if ($tbl_name == '') {
if ('' == $tbl_name) {
return false;
} elseif (!isset($this->attendance_data)) {
$sql = 'SELECT * FROM '.$this->get_attendance_table().' att

@ -7,8 +7,6 @@ use ChamiloSession as Session;
/**
* Class Category
* Defines a gradebook Category object.
*
* @package chamilo.gradebook
*/
class Category implements GradebookItem
{
@ -496,7 +494,7 @@ class Category implements GradebookItem
}
if (isset($parent_id)) {
if ($paramcount != 0) {
if (0 != $paramcount) {
$sql .= ' AND ';
} else {
$sql .= ' WHERE ';
@ -506,7 +504,7 @@ class Category implements GradebookItem
}
if (isset($visible)) {
if ($paramcount != 0) {
if (0 != $paramcount) {
$sql .= ' AND';
} else {
$sql .= ' WHERE';
@ -892,7 +890,7 @@ class Category implements GradebookItem
}
}
// Classic
if (!empty($stud_id) && $type == '') {
if (!empty($stud_id) && '' == $type) {
if (!empty($course_code)) {
$cats = $this->get_subcategories(
$stud_id,
@ -926,7 +924,7 @@ class Category implements GradebookItem
);
$catweight = 0;
if ($cat->get_weight() != 0) {
if (0 != $cat->get_weight()) {
$catweight = $cat->get_weight();
$weightsum += $catweight;
}
@ -942,14 +940,14 @@ class Category implements GradebookItem
foreach ($evals as $eval) {
$eval->setStudentList($this->getStudentList());
$evalres = $eval->calc_score($stud_id);
if (isset($evalres) && $eval->get_weight() != 0) {
if (isset($evalres) && 0 != $eval->get_weight()) {
$evalweight = $eval->get_weight();
$weightsum += $evalweight;
if (!empty($evalres[1])) {
$ressum += $evalres[0] / $evalres[1] * $evalweight;
}
} else {
if ($eval->get_weight() != 0) {
if (0 != $eval->get_weight()) {
$evalweight = $eval->get_weight();
$weightsum += $evalweight;
}
@ -967,14 +965,14 @@ class Category implements GradebookItem
}
$linkres = $link->calc_score($stud_id, null);
if (!empty($linkres) && $link->get_weight() != 0) {
if (!empty($linkres) && 0 != $link->get_weight()) {
$linkweight = $link->get_weight();
$link_res_denom = $linkres[1] == 0 ? 1 : $linkres[1];
$link_res_denom = 0 == $linkres[1] ? 1 : $linkres[1];
$weightsum += $linkweight;
$ressum += $linkres[0] / $link_res_denom * $linkweight;
} else {
// Adding if result does not exists
if ($link->get_weight() != 0) {
if (0 != $link->get_weight()) {
$linkweight = $link->get_weight();
$weightsum += $linkweight;
}
@ -1014,7 +1012,7 @@ class Category implements GradebookItem
);
$catweight = 0;
if ($cat->get_weight() != 0) {
if (0 != $cat->get_weight()) {
$catweight = $cat->get_weight();
$weightsum += $catweight;
}
@ -1030,14 +1028,14 @@ class Category implements GradebookItem
}
if (!empty($evals)) {
if ($type === 'best') {
if ('best' === $type) {
$studentList = $this->getStudentList();
foreach ($studentList as $student) {
$studentId = $student['user_id'];
foreach ($evals as $eval) {
$linkres = $eval->calc_score($studentId, null);
$linkweight = $eval->get_weight();
$link_res_denom = $linkres[1] == 0 ? 1 : $linkres[1];
$link_res_denom = 0 == $linkres[1] ? 1 : $linkres[1];
$ressum = $linkres[0] / $link_res_denom * $linkweight;
if (!isset($totalScorePerStudent[$studentId])) {
@ -1052,7 +1050,7 @@ class Category implements GradebookItem
$evalres = $eval->calc_score(null, $type);
$eval->setStudentList($this->getStudentList());
if (isset($evalres) && $eval->get_weight() != 0) {
if (isset($evalres) && 0 != $eval->get_weight()) {
$evalweight = $eval->get_weight();
$weightsum += $evalweight;
if (!empty($evalres[1])) {
@ -1063,7 +1061,7 @@ class Category implements GradebookItem
$bestResult = $ressum;
}
} else {
if ($eval->get_weight() != 0) {
if (0 != $eval->get_weight()) {
$evalweight = $eval->get_weight();
$weightsum += $evalweight;
}
@ -1074,13 +1072,13 @@ class Category implements GradebookItem
if (!empty($links)) {
$studentList = $this->getStudentList();
if ($type === 'best') {
if ('best' === $type) {
foreach ($studentList as $student) {
$studentId = $student['user_id'];
foreach ($links as $link) {
$linkres = $link->calc_score($studentId, null);
$linkweight = $link->get_weight();
$link_res_denom = $linkres[1] == 0 ? 1 : $linkres[1];
$link_res_denom = 0 == $linkres[1] ? 1 : $linkres[1];
$ressum = $linkres[0] / $link_res_denom * $linkweight;
if (!isset($totalScorePerStudent[$studentId])) {
@ -1100,9 +1098,9 @@ class Category implements GradebookItem
$linkres = $link->calc_score($stud_id, $type);
if (!empty($linkres) && $link->get_weight() != 0) {
if (!empty($linkres) && 0 != $link->get_weight()) {
$linkweight = $link->get_weight();
$link_res_denom = $linkres[1] == 0 ? 1 : $linkres[1];
$link_res_denom = 0 == $linkres[1] ? 1 : $linkres[1];
$weightsum += $linkweight;
$ressum += $linkres[0] / $link_res_denom * $linkweight;
@ -1111,7 +1109,7 @@ class Category implements GradebookItem
}
} else {
// Adding if result does not exists
if ($link->get_weight() != 0) {
if (0 != $link->get_weight()) {
$linkweight = $link->get_weight();
$weightsum += $linkweight;
}
@ -1281,7 +1279,7 @@ class Category implements GradebookItem
)';
}
} elseif (api_is_platform_admin()) {
if (isset($session_id) && $session_id != 0) {
if (isset($session_id) && 0 != $session_id) {
$sql .= ' AND session_id='.$session_id;
} else {
$sql .= ' AND coalesce(session_id,0)=0';
@ -1316,7 +1314,7 @@ class Category implements GradebookItem
$course_code = null,
$session_id = null
) {
if ($user_id == null) {
if (null == $user_id) {
return self::load(null, null, $course_code, 0, null, $session_id);
}
@ -1367,7 +1365,7 @@ class Category implements GradebookItem
*/
public function is_movable()
{
return !(!isset($this->id) || $this->id == 0 || $this->is_course());
return !(!isset($this->id) || 0 == $this->id || $this->is_course());
}
/**
@ -1612,7 +1610,7 @@ class Category implements GradebookItem
$this->id,
$studentId
);
if (count($evals) != 0) {
if (0 != count($evals)) {
return true;
} else {
$cats = self::load(
@ -1700,7 +1698,7 @@ class Category implements GradebookItem
// 1 student
if (isset($studentId)) {
// Special case: this is the root
if ($this->id == 0) {
if (0 == $this->id) {
return $this->get_root_categories_for_student($studentId, $course_code, $session_id);
} else {
return self::load(
@ -1718,7 +1716,7 @@ class Category implements GradebookItem
// Course admin
if (api_is_allowed_to_edit() && !api_is_platform_admin()) {
// root
if ($this->id == 0) {
if (0 == $this->id) {
// inside a course
return $this->get_root_categories_for_teacher(
api_get_user_id(),
@ -1797,7 +1795,7 @@ class Category implements GradebookItem
// 1 student
if (isset($studentId) && !empty($studentId)) {
// Special case: this is the root
if ($this->id == 0) {
if (0 == $this->id) {
$evals = Evaluation::get_evaluations_with_result_for_student(
0,
$studentId
@ -1818,7 +1816,7 @@ class Category implements GradebookItem
!api_is_platform_admin()
) {
// root
if ($this->id == 0) {
if (0 == $this->id) {
$evals = Evaluation::load(
null,
api_get_user_id(),
@ -1901,7 +1899,7 @@ class Category implements GradebookItem
$sessionId = empty($sessionId) ? $this->get_session_id() : $sessionId;
// no links in root or course independent categories
if ($this->id == 0) {
if (0 == $this->id) {
} elseif (isset($studentId)) {
// 1 student $studentId
$links = LinkFactory::load(
@ -2041,7 +2039,7 @@ class Category implements GradebookItem
*/
public function lockAllItems($locked)
{
if (api_get_setting('gradebook_locking_enabled') == 'true') {
if ('true' == api_get_setting('gradebook_locking_enabled')) {
$this->lock($locked);
$evals_to_lock = $this->get_evaluations();
if (!empty($evals_to_lock)) {
@ -2058,7 +2056,7 @@ class Category implements GradebookItem
}
$event_type = LOG_GRADEBOOK_UNLOCKED;
if ($locked == 1) {
if (1 == $locked) {
$event_type = LOG_GRADEBOOK_LOCKED;
}
Event::addEvent($event_type, LOG_GRADEBOOK_ID, $this->id);

@ -5,8 +5,6 @@
* Gradebook link to dropbox item.
*
* @author Bert Steppé
*
* @package chamilo.gradebook
*/
class DropboxLink extends EvalLink
{

@ -5,9 +5,6 @@
* Class to be used as basis for links referring to Evaluation objects.
*
* @author Bert Steppé
*
* @package chamilo.gradebook
* @package chamilo.gradebook
*/
abstract class EvalLink extends AbstractLink
{

@ -6,8 +6,6 @@ use ChamiloSession as Session;
/**
* Class Evaluation.
*
* @package chamilo.gradebook
*/
class Evaluation implements GradebookItem
{
@ -151,7 +149,7 @@ class Evaluation implements GradebookItem
public function is_locked()
{
return isset($this->locked) && $this->locked == 1 ? true : false;
return isset($this->locked) && 1 == $this->locked ? true : false;
}
public function set_id($id)
@ -238,7 +236,7 @@ class Evaluation implements GradebookItem
}
if (isset($user_id)) {
if ($paramcount != 0) {
if (0 != $paramcount) {
$sql .= ' AND';
} else {
$sql .= ' WHERE';
@ -494,7 +492,7 @@ class Evaluation implements GradebookItem
$result = Database::query($sql);
$number = Database::fetch_row($result);
return $number[0] != 0;
return 0 != $number[0];
}
/**
@ -595,7 +593,7 @@ class Evaluation implements GradebookItem
$data = Session::read('calc_score');
$results = isset($data[$key]) ? $data[$key] : null;
if ($useSession == false) {
if (false == $useSession) {
$results = null;
}
$results = null;
@ -621,7 +619,7 @@ class Evaluation implements GradebookItem
$key = 'result_score_student_list_'.api_get_course_int_id().'_'.api_get_session_id().'_'.$this->id;
$data = Session::read('calc_score');
$allResults = isset($data[$key]) ? $data[$key] : null;
if ($useSession == false) {
if (false == $useSession) {
$allResults = null;
}
@ -634,7 +632,7 @@ class Evaluation implements GradebookItem
/** @var Result $res */
foreach ($allResults as $res) {
$score = $res->get_score();
if (!empty($score) || $score == '0') {
if (!empty($score) || '0' == $score) {
$count++;
$sum += $score / $this->get_max();
$sumResult += $score;

@ -6,8 +6,6 @@
* Defines a gradebook ExerciseLink object.
*
* @author Bert Steppé
*
* @package chamilo.gradebook
*/
class ExerciseLink extends AbstractLink
{
@ -24,7 +22,7 @@ class ExerciseLink extends AbstractLink
parent::__construct();
$this->set_type(LINK_EXERCISE);
$this->is_hp = $hp;
if ($this->is_hp == 1) {
if (1 == $this->is_hp) {
$this->set_type(LINK_HOTPOTATOES);
}
}
@ -261,7 +259,7 @@ class ExerciseLink extends AbstractLink
$exercise->read($exerciseId);
if (!$this->is_hp) {
if ($exercise->exercise_was_added_in_lp == false) {
if (false == $exercise->exercise_was_added_in_lp) {
$sql = "SELECT * FROM $tblStats
WHERE
exe_exo_id = $exerciseId AND
@ -288,7 +286,7 @@ class ExerciseLink extends AbstractLink
c_id = $courseId ";
}
if (!empty($stud_id) && $type != 'ranking') {
if (!empty($stud_id) && 'ranking' != $type) {
$sql .= " AND exe_user_id = $stud_id ";
}
$sql .= ' ORDER BY exe_id DESC';

@ -5,8 +5,6 @@
* Class ForumThreadLink.
*
* @author Bert Steppé
*
* @package chamilo.gradebook
*/
class ForumThreadLink extends AbstractLink
{
@ -72,7 +70,7 @@ class ForumThreadLink extends AbstractLink
$result = Database::query($sql);
while ($data = Database::fetch_array($result)) {
if (isset($data['thread_title_qualify']) && $data['thread_title_qualify'] != '') {
if (isset($data['thread_title_qualify']) && '' != $data['thread_title_qualify']) {
$cats[] = [$data['thread_id'], $data['thread_title_qualify']];
} else {
$cats[] = [$data['thread_id'], $data['thread_title']];
@ -100,7 +98,7 @@ class ForumThreadLink extends AbstractLink
$result = Database::query($sql);
$number = Database::fetch_row($result);
return $number[0] != 0;
return 0 != $number[0];
}
/**
@ -148,7 +146,7 @@ class ForumThreadLink extends AbstractLink
// for 1 student
if (isset($stud_id)) {
if ($threadInfo['thread_peer_qualify'] == 0) {
if (0 == $threadInfo['thread_peer_qualify']) {
// Classic way of calculate score
if ($data = Database::fetch_array($scores)) {
return [
@ -188,7 +186,7 @@ class ForumThreadLink extends AbstractLink
while ($data = Database::fetch_array($scores)) {
if (!(array_key_exists($data['user_id'], $students))) {
if ($assignment['thread_qualify_max'] != 0) {
if (0 != $assignment['thread_qualify_max']) {
$students[$data['user_id']] = $data['qualify'];
$counter++;
$sum += $data['qualify'] / $assignment['thread_qualify_max'];
@ -201,7 +199,7 @@ class ForumThreadLink extends AbstractLink
}
}
if ($counter == 0) {
if (0 == $counter) {
return [null, null];
} else {
switch ($type) {
@ -245,7 +243,7 @@ class ForumThreadLink extends AbstractLink
$this->get_exercise_data();
$thread_title = isset($this->exercise_data['thread_title']) ? $this->exercise_data['thread_title'] : '';
$thread_title_qualify = isset($this->exercise_data['thread_title_qualify']) ? $this->exercise_data['thread_title_qualify'] : '';
if (isset($thread_title_qualify) && $thread_title_qualify != '') {
if (isset($thread_title_qualify) && '' != $thread_title_qualify) {
return $this->exercise_data['thread_title_qualify'];
}
@ -274,7 +272,7 @@ class ForumThreadLink extends AbstractLink
$result = Database::query($sql);
$number = Database::fetch_row($result);
return $number[0] != 0;
return 0 != $number[0];
}
public function get_link()

@ -5,8 +5,6 @@
* Interface for all displayable items in the gradebook.
*
* @author Bert Steppé
*
* @package chamilo.gradebook
*/
interface GradebookItem
{

@ -6,8 +6,6 @@
*
* @author Yannick Warnier <yannick.warnier@beeznest.com>
* @author Bert Steppé
*
* @package chamilo.gradebook
*/
class LearnpathLink extends AbstractLink
{
@ -65,7 +63,7 @@ class LearnpathLink extends AbstractLink
$result = Database::query($sql);
$number = Database::fetch_array($result, 'NUM');
return $number[0] != 0;
return 0 != $number[0];
}
/**
@ -128,7 +126,7 @@ class LearnpathLink extends AbstractLink
}
}
if ($rescount == 0) {
if (0 == $rescount) {
return [null, null];
} else {
switch ($type) {
@ -160,7 +158,7 @@ class LearnpathLink extends AbstractLink
$session_id
).'&gradebook=view';
if (!api_is_allowed_to_edit() || $this->calc_score(api_get_user_id()) == null) {
if (!api_is_allowed_to_edit() || null == $this->calc_score(api_get_user_id())) {
$url .= '&action=view&lp_id='.$this->get_ref_id();
} else {
$url .= '&action=build&lp_id='.$this->get_ref_id();
@ -199,7 +197,7 @@ class LearnpathLink extends AbstractLink
$result = Database::query($sql);
$number = Database::fetch_row($result, 'NUM');
return $number[0] != 0;
return 0 != $number[0];
}
public function get_type_name()

@ -6,8 +6,6 @@
* Factory for link objects.
*
* @author Bert Steppé
*
* @package chamilo.gradebook
*/
class LinkFactory
{

@ -5,8 +5,6 @@
* Defines a gradebook Result object.
*
* @author Bert Steppé, Stijn Konings
*
* @package chamilo.gradebook
*/
class Result
{
@ -107,7 +105,7 @@ class Result
$result = Database::query($sql);
$existEvaluation = Database::result($result, 0, 0);
if ($existEvaluation != 0) {
if (0 != $existEvaluation) {
if ($sessionId) {
$sql = 'SELECT c_id, user_id as user_id, status
FROM '.$tbl_session_rel_course_user.'
@ -134,7 +132,7 @@ class Result
evaluation_id="'.intval($evaluation_id).'";';
$res_verified = Database::query($sql_verified);
$info_verified = Database::result($res_verified, 0, 0);
if ($info_verified == 0) {
if (0 == $info_verified) {
$sql_insert = 'INSERT INTO '.$tbl_grade_results.'(user_id,evaluation_id,created_at,score)
VALUES ("'.intval($list_user_course_list[$i]['user_id']).'","'.intval($evaluation_id).'","'.$current_date.'",0);';
Database::query($sql_insert);
@ -164,7 +162,7 @@ class Result
$paramcount++;
}
if (!empty($user_id)) {
if ($paramcount != 0) {
if (0 != $paramcount) {
$sql .= ' AND';
} else {
$sql .= ' WHERE';
@ -173,7 +171,7 @@ class Result
$paramcount++;
}
if (!empty($evaluation_id)) {
if ($paramcount != 0) {
if (0 != $paramcount) {
$sql .= ' AND';
} else {
$sql .= ' WHERE';

@ -5,8 +5,6 @@
* Gradebook link to student publication item.
*
* @author Bert Steppé
*
* @package chamilo.gradebook
*/
class StudentPublicationLink extends AbstractLink
{
@ -139,7 +137,7 @@ class StudentPublicationLink extends AbstractLink
'session' => $session,
]);
return count($results) != 0;
return 0 != count($results);
}
/**
@ -250,7 +248,7 @@ class StudentPublicationLink extends AbstractLink
foreach ($scores as $data) {
if (!(array_key_exists($data->getUserId(), $students))) {
if ($assignment->getQualification() != 0) {
if (0 != $assignment->getQualification()) {
$students[$data->getUserId()] = $data->getQualification();
$rescount++;
$sum += $data->getQualification() / $assignment->getQualification();
@ -264,7 +262,7 @@ class StudentPublicationLink extends AbstractLink
}
}
if ($rescount == 0) {
if (0 == $rescount) {
return [null, null];
}
@ -337,7 +335,7 @@ class StudentPublicationLink extends AbstractLink
$result = Database::query($sql);
$number = Database::fetch_row($result);
return $number[0] != 0;
return 0 != $number[0];
}
public function get_icon_name()

@ -5,8 +5,6 @@
* Gradebook link to a survey item.
*
* @author Ivan Tcholakov <ivantcholakov@gmail.com>, 2010
*
* @package chamilo.gradebook
*/
class SurveyLink extends AbstractLink
{
@ -125,7 +123,7 @@ class SurveyLink extends AbstractLink
$sql_result = Database::query($sql);
$data = Database::fetch_array($sql_result);
return $data[0] != 0;
return 0 != $data[0];
}
/**
@ -186,7 +184,7 @@ class SurveyLink extends AbstractLink
}
$sum = $sum / $max_score;
if ($rescount == 0) {
if (0 == $rescount) {
return [null, null];
}
@ -223,7 +221,7 @@ class SurveyLink extends AbstractLink
$result = Database::query($sql);
$number = Database::fetch_row($result);
return $number[0] != 0;
return 0 != $number[0];
}
public function get_link()
@ -238,7 +236,7 @@ class SurveyLink extends AbstractLink
$sessionId = $this->get_session_id();
$courseId = $this->getCourseId();
if ($tbl_name != '') {
if ('' != $tbl_name) {
$sql = 'SELECT survey_id
FROM '.$this->get_survey_table().'
WHERE
@ -285,7 +283,7 @@ class SurveyLink extends AbstractLink
{
$tbl_name = $this->get_survey_table();
if ($tbl_name == '') {
if ('' == $tbl_name) {
return false;
} elseif (empty($this->survey_data)) {
$courseId = $this->getCourseId();

@ -5,8 +5,6 @@
* Class CatForm.
*
* @author Stijn Konings
*
* @package chamilo.gradebook
*/
class CatForm extends FormValidator
{
@ -97,7 +95,7 @@ class CatForm extends FormValidator
{
// check if we are a root category
// if so, you can only choose between courses
if ($this->category_object->get_parent_id() == '0') {
if ('0' == $this->category_object->get_parent_id()) {
$this->setDefaults(
[
'select_course' => $this->category_object->get_course_code(),
@ -154,7 +152,7 @@ class CatForm extends FormValidator
$category_name = $this->category_object->get_name();
// The main course category:
if (isset($this->category_object) && $this->category_object->get_parent_id() == 0) {
if (isset($this->category_object) && 0 == $this->category_object->get_parent_id()) {
if (empty($category_name)) {
$category_name = $course_code;
}
@ -284,7 +282,7 @@ class CatForm extends FormValidator
}
if (isset($this->category_object) &&
$this->category_object->get_parent_id() == 0
0 == $this->category_object->get_parent_id()
) {
$model = ExerciseLib::getCourseScoreModel();
if (empty($model)) {
@ -373,7 +371,7 @@ class CatForm extends FormValidator
}
if (count($test_cats) > 1 || !empty($links)) {
if (api_get_setting('gradebook_enable_grade_model') == 'true') {
if ('true' == api_get_setting('gradebook_enable_grade_model')) {
$this->freeze('grade_model_id');
}
}

@ -5,8 +5,6 @@
* Extends FormValidator with import and export forms.
*
* @author Stijn Konings
*
* @package chamilo.gradebook
*/
class DataForm extends FormValidator
{

@ -3,8 +3,6 @@
/**
* Class DisplayGradebook.
*
* @package chamilo.gradebook
*/
class DisplayGradebook
{
@ -21,7 +19,7 @@ class DisplayGradebook
$header = null;
if (api_is_allowed_to_edit(null, true)) {
$header = '<div class="actions">';
if ($page !== 'statistics') {
if ('statistics' !== $page) {
$header .= '<a href="'.Category::getUrl().'selectcat='.$selectcat.'">'.
Display::return_icon('back.png', get_lang('FolderView'), '', ICON_SIZE_MEDIUM)
.'</a>';
@ -61,7 +59,7 @@ class DisplayGradebook
if ($evalobj->has_results()) {
// TODO this check needed ?
$score = $evalobj->calc_score();
if ($score != null) {
if (null != $score) {
$model = ExerciseLib::getCourseScoreModel();
if (empty($model)) {
$average = get_lang('Average').' :<b> '.$scoredisplay->display_score($score, SCORE_AVERAGE).'</b>';
@ -86,7 +84,7 @@ class DisplayGradebook
}
$description = '';
if (!$evalobj->get_description() == '') {
if ('' == !$evalobj->get_description()) {
$description = get_lang('Description').' :<b> '.$evalobj->get_description().'</b><br>';
}

@ -7,8 +7,6 @@
* Extends FormValidator with add&edit forms for evaluations
*
* @author Stijn Konings
*
* @package chamilo.gradebook
*/
class EvalForm extends FormValidator
{
@ -98,12 +96,12 @@ class EvalForm extends FormValidator
$user2 = $item2['user'];
if (api_sort_by_first_name()) {
$result = api_strcmp($user1['firstname'], $user2['firstname']);
if ($result == 0) {
if (0 == $result) {
return api_strcmp($user1['lastname'], $user2['lastname']);
}
} else {
$result = api_strcmp($user1['lastname'], $user2['lastname']);
if ($result == 0) {
if (0 == $result) {
return api_strcmp($user1['firstname'], $user2['firstname']);
}
}
@ -554,7 +552,7 @@ class EvalForm extends FormValidator
false
);
if (count($all_categories) == 1) {
if (1 == count($all_categories)) {
$this->addElement('hidden', 'hid_category_id', $cat_id);
} else {
$select_gradebook = $this->addElement(
@ -719,7 +717,7 @@ class EvalForm extends FormValidator
if ($this->evaluation_object->get_category_id() < 0) {
$link = LinkFactory::get_evaluation_link($this->evaluation_object->get_id());
$doc_url = $link->get_view_url($id);
if ($doc_url != null) {
if (null != $doc_url) {
$opendocurl_start .= '<a href="'.$doc_url.'" target="_blank">';
$opendocurl_end = '</a>';
}

@ -2,8 +2,6 @@
/* For licensing terms, see /license.txt */
/**
* Script.
*
* @package chamilo.gradebook
*/
/**
@ -205,7 +203,7 @@ function export_pdf($pdf, $newarray, $header_names, $format)
$pdf->ezSetCmMargins(0, 0, 0, 0);
$pdf->ezSetY(($format == 'portrait') ? '820' : '570');
$pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
if ($format == 'portrait') {
if ('portrait' == $format) {
$pdf->line(40, 790, 540, 790);
$pdf->line(40, 40, 540, 40);
} else {

@ -14,8 +14,6 @@ use CpChart\Image as pImage;
* @author Stijn Konings
* @author Bert Steppé - (refactored, optimised)
* @author Julio Montoya Armas - Gradebook Graphics
*
* @package chamilo.gradebook
*/
class FlatViewTable extends SortableTable
{
@ -415,7 +413,7 @@ class FlatViewTable extends SortableTable
$users_sorting = ($this->column == 0 ? FlatViewDataGenerator::FVDG_SORT_LASTNAME : FlatViewDataGenerator::FVDG_SORT_FIRSTNAME);
}
if ($this->direction == 'DESC') {
if ('DESC' == $this->direction) {
$users_sorting |= FlatViewDataGenerator::FVDG_SORT_DESC;
} else {
$users_sorting |= FlatViewDataGenerator::FVDG_SORT_ASC;

@ -12,8 +12,6 @@ use CpChart\Image as pImage;
*
* @author Stijn Konings
* @author Bert Steppé (refactored, optimised)
*
* @package chamilo.gradebook
*/
class GradebookTable extends SortableTable
{
@ -93,7 +91,7 @@ class GradebookTable extends SortableTable
$column = 0;
if ($this->teacherView) {
if ($this->exportToPdf == false) {
if (false == $this->exportToPdf) {
$this->set_header($column++, '', '', 'width="25px"');
}
}
@ -101,7 +99,7 @@ class GradebookTable extends SortableTable
$this->set_header($column++, get_lang('Type'), '', 'width="35px"');
$this->set_header($column++, get_lang('Name'), false);
if ($this->exportToPdf == false) {
if (false == $this->exportToPdf) {
$this->set_header($column++, get_lang('Description'), false);
}
@ -323,7 +321,7 @@ class GradebookTable extends SortableTable
break;
}
if ($this->direction == 'DESC') {
if ('DESC' == $this->direction) {
$sorting |= GradebookDataGenerator::GDG_SORT_DESC;
} else {
$sorting |= GradebookDataGenerator::GDG_SORT_ASC;
@ -408,7 +406,7 @@ class GradebookTable extends SortableTable
// Id
if ($this->teacherView) {
if ($this->exportToPdf == false) {
if (false == $this->exportToPdf) {
$row[] = $this->build_id_column($item);
}
}
@ -431,7 +429,7 @@ class GradebookTable extends SortableTable
$total_categories_weight += $item->get_weight();
// Description.
if ($this->exportToPdf == false) {
if (false == $this->exportToPdf) {
$row[] = $invisibility_span_open.$data[2].$invisibility_span_close;
}
@ -552,8 +550,8 @@ class GradebookTable extends SortableTable
}
}
if (get_class($item) === 'Category') {
if ($this->exportToPdf == false) {
if ('Category' === get_class($item)) {
if (false == $this->exportToPdf) {
$row[] = $this->build_edit_column($item);
}
}
@ -563,7 +561,7 @@ class GradebookTable extends SortableTable
$sortable_data[] = $row;
// Loading children
if (get_class($item) === 'Category') {
if ('Category' === get_class($item)) {
$parent_id = $item->get_id();
$cats = Category::load(
$parent_id,
@ -608,7 +606,7 @@ class GradebookTable extends SortableTable
}
if ($this->teacherView) {
if ($this->exportToPdf == false) {
if (false == $this->exportToPdf) {
$row[] = $this->build_id_column($item);
}
}
@ -621,7 +619,7 @@ class GradebookTable extends SortableTable
$this->build_name_link($item, $type).$invisibility_span_close;
// Description.
if ($this->exportToPdf == false) {
if (false == $this->exportToPdf) {
$row[] = $invisibility_span_open.$data[2].$invisibility_span_close;
}
@ -677,13 +675,13 @@ class GradebookTable extends SortableTable
}
if (!empty($cats)) {
if ($this->exportToPdf == false) {
if (false == $this->exportToPdf) {
$row[] = null;
}
}
}
if ($this->exportToPdf == false) {
if (false == $this->exportToPdf) {
$row['child_of'] = $parent_id;
}
$sortable_data[] = $row;
@ -729,7 +727,7 @@ class GradebookTable extends SortableTable
/** @var Category $myCat */
foreach ($main_cat as $myCat) {
$myParentId = $myCat->get_parent_id();
if ($myParentId == 0) {
if (0 == $myParentId) {
$main_weight = (int) $myCat->get_weight();
}
}
@ -1228,14 +1226,14 @@ class GradebookTable extends SortableTable
$url = $item->get_link();
$text = $item->get_name();
if (isset($url) && $show_message === false) {
if (isset($url) && false === $show_message) {
$text = '&nbsp;<a href="'.$item->get_link().'">'
.$item->get_name()
.'</a>';
}
$extra = Display::label($item->get_type_name(), 'info');
if ($type == 'simple') {
if ('simple' == $type) {
$extra = '';
}
$extra .= $item->getSkillsFromItem();

@ -6,8 +6,6 @@
*
* @author Stijn Konings
* @author Bert Steppé
*
* @package chamilo.gradebook
*/
class LinkAddEditForm extends FormValidator
{
@ -72,7 +70,7 @@ class LinkAddEditForm extends FormValidator
);
}
if (count($category_object) == 1) {
if (1 == count($category_object)) {
$this->addElement('hidden', 'select_gradebook', $category_object[0]->get_id());
} else {
$select_gradebook = $this->addElement(
@ -89,7 +87,7 @@ class LinkAddEditForm extends FormValidator
if ($my_cat->get_course_code() == api_get_course_id()) {
$grade_model_id = $my_cat->get_grade_model_id();
if (empty($grade_model_id)) {
if ($my_cat->get_parent_id() == 0) {
if (0 == $my_cat->get_parent_id()) {
$default_weight = $my_cat->get_weight();
$select_gradebook->addoption(get_lang('Default'), $my_cat->get_id());
} else {
@ -123,9 +121,9 @@ class LinkAddEditForm extends FormValidator
$this->addElement('hidden', 'weight');
if ($form_type == self::TYPE_EDIT) {
if (self::TYPE_EDIT == $form_type) {
$parent_cat = Category::load($link->get_category_id());
if ($parent_cat[0]->get_parent_id() == 0) {
if (0 == $parent_cat[0]->get_parent_id()) {
$values['weight'] = $link->get_weight();
} else {
$cat = Category::load($parent_cat[0]->get_parent_id());

@ -7,8 +7,6 @@
*
* @author Stijn Konings
* @author Bert Steppé (made more generic)
*
* @package chamilo.gradebook
*/
class LinkForm extends FormValidator
{
@ -50,9 +48,9 @@ class LinkForm extends FormValidator
if (isset($extra)) {
$this->extra = $extra;
}
if ($form_type == self::TYPE_CREATE) {
if (self::TYPE_CREATE == $form_type) {
$this->build_create();
} elseif ($form_type == self::TYPE_MOVE) {
} elseif (self::TYPE_MOVE == $form_type) {
$this->build_move();
}
}

@ -7,8 +7,6 @@
*
* @author Stijn Konings
* @author Bert Steppé
*
* @package chamilo.gradebook
*/
class ResultTable extends SortableTable
{
@ -51,7 +49,7 @@ class ResultTable extends SortableTable
}
$scoredisplay = ScoreDisplay::instance();
$column = 0;
if ($this->iscourse == '1') {
if ('1' == $this->iscourse) {
$this->set_header($column++, '', false);
$this->set_form_actions([
'delete' => get_lang('Delete'),
@ -142,7 +140,7 @@ class ResultTable extends SortableTable
$sortable_data = [];
foreach ($data_array as $item) {
$row = [];
if ($this->iscourse == '1') {
if ('1' == $this->iscourse) {
$row[] = $item['result_id'];
}
if ($isWesternNameOrder) {

@ -7,8 +7,6 @@
*
* @author Stijn Konings
* @author Bert Steppé
*
* @package chamilo.gradebook
*/
class ScoreDisplayForm extends FormValidator
{
@ -22,7 +20,7 @@ class ScoreDisplayForm extends FormValidator
$displayscore = ScoreDisplay::instance();
$customdisplays = $displayscore->get_custom_score_display_settings();
$nr_items = (count($customdisplays) != '0') ? count($customdisplays) : '1';
$nr_items = ('0' != count($customdisplays)) ? count($customdisplays) : '1';
$this->setDefaults(
[
'scorecolpercent' => $displayscore->get_color_split_value(),

@ -6,8 +6,6 @@
* Extends formvalidator with import and export forms.
*
* @author Stijn Konings
*
* @package chamilo.gradebook
*/
class UserForm extends FormValidator
{
@ -33,9 +31,9 @@ class UserForm extends FormValidator
if (isset($result_object)) {
$this->result_object = $result_object;
}
if ($this->form_type == self::TYPE_USER_INFO) {
if (self::TYPE_USER_INFO == $this->form_type) {
$this->build_user_info_form();
} elseif ($this->form_type == self::TYPE_SIMPLE_SEARCH) {
} elseif (self::TYPE_SIMPLE_SEARCH == $this->form_type) {
$this->build_simple_search();
}
$this->setDefaults();

@ -7,8 +7,6 @@
*
* @author Stijn Konings
* @author Bert Steppé (refactored, optimised, use of caching, datagenerator class)
*
* @package chamilo.gradebook
*/
class UserTable extends SortableTable
{
@ -80,7 +78,7 @@ class UserTable extends SortableTable
$sorting = UserDataGenerator::UDG_SORT_MASK;
break;
}
if ($this->direction === 'DESC') {
if ('DESC' === $this->direction) {
$sorting |= UserDataGenerator::UDG_SORT_DESC;
} else {
$sorting |= UserDataGenerator::UDG_SORT_ASC;
@ -89,7 +87,7 @@ class UserTable extends SortableTable
// generate the data to display
$sortable_data = [];
foreach ($data_array as $data) {
if ($data[2] != '') {
if ('' != $data[2]) {
// filter by course removed
$row = [];
$row[] = $this->build_type_column($data[0]);

@ -7,8 +7,6 @@
* used for the teacher's flat view.
*
* @author Bert Steppé
*
* @package chamilo.gradebook
*/
class FlatViewDataGenerator
{
@ -118,7 +116,7 @@ class FlatViewDataGenerator
}
$parent_id = $this->category->get_parent_id();
if ($parent_id == 0 ||
if (0 == $parent_id ||
isset($this->params['only_subcat']) &&
$this->params['only_subcat'] == $this->category->get_id()
) {
@ -150,7 +148,7 @@ class FlatViewDataGenerator
);
$evaluationsAdded = [];
if ($parent_id == 0 && !empty($allcat)) {
if (0 == $parent_id && !empty($allcat)) {
// Means there are any subcategory
/** @var Category $sub_cat */
foreach ($allcat as $sub_cat) {
@ -162,7 +160,7 @@ class FlatViewDataGenerator
api_get_self().'?selectcat='.$sub_cat->get_id().'&'.api_get_cidreq()
).$add_weight;
if (api_get_setting('gradebook_detailed_admin_view') === 'true') {
if ('true' === api_get_setting('gradebook_detailed_admin_view')) {
$links = $sub_cat->get_links();
$evaluations = $sub_cat->get_evaluations();
@ -194,7 +192,7 @@ class FlatViewDataGenerator
} else {
if (!isset($this->params['only_total_category']) ||
(isset($this->params['only_total_category']) &&
$this->params['only_total_category'] == false)
false == $this->params['only_total_category'])
) {
for ($count = 0; ($count < $items_count) && ($items_start + $count < count($this->evals_links)); $count++) {
/** @var AbstractLink $item */
@ -359,7 +357,7 @@ class FlatViewDataGenerator
$parent_id = $this->category->get_parent_id();
if ($parent_id == 0 ||
if (0 == $parent_id ||
(isset($this->params['only_subcat']) && $this->params['only_subcat'] == $this->category->get_id())
) {
$main_weight = $this->category->get_weight();
@ -441,12 +439,12 @@ class FlatViewDataGenerator
);
$evaluationsAdded = [];
if ($parent_id == 0 && !empty($allcat)) {
if (0 == $parent_id && !empty($allcat)) {
/** @var Category $sub_cat */
foreach ($allcat as $sub_cat) {
$score = $sub_cat->calc_score($user_id);
if (api_get_setting('gradebook_detailed_admin_view') === 'true') {
if ('true' === api_get_setting('gradebook_detailed_admin_view')) {
$links = $sub_cat->get_links();
/** @var ExerciseLink $link */
$linkScoreList = [];
@ -471,7 +469,7 @@ class FlatViewDataGenerator
}
$real_score = $score;
$divide = $score[1] == 0 ? 1 : $score[1];
$divide = 0 == $score[1] ? 1 : $score[1];
$sub_cat_percentage = $sum_categories_weight_array[$sub_cat->get_id()];
$item_value = $score[0] / $divide * $main_weight;
@ -486,7 +484,7 @@ class FlatViewDataGenerator
$defaultStyle = (int) $style;
}
if (api_get_setting('gradebook_show_percentage_in_reports') === 'false') {
if ('false' === api_get_setting('gradebook_show_percentage_in_reports')) {
$defaultShowPercentageValue = SCORE_SIMPLE;
if (!empty($style)) {
$defaultShowPercentageValue = $style;
@ -518,10 +516,10 @@ class FlatViewDataGenerator
if (!isset($this->params['only_total_category']) ||
(isset($this->params['only_total_category']) &&
$this->params['only_total_category'] == false)
false == $this->params['only_total_category'])
) {
if (!$show_all) {
if (api_get_setting('gradebook_detailed_admin_view') === 'true') {
if ('true' === api_get_setting('gradebook_detailed_admin_view')) {
$finalList = array_merge($linkScoreList, $evalScoreList);
if (empty($finalList)) {
$average = 0;
@ -660,7 +658,7 @@ class FlatViewDataGenerator
// Fixing total when using one or multiple gradebooks.
if (empty($parentCategoryIdFilter)) {
if ($this->category->get_parent_id() == 0) {
if (0 == $this->category->get_parent_id()) {
if (isset($score[0])) {
$item_value = $score[0] / $divide * $item->get_weight();
} else {
@ -686,7 +684,7 @@ class FlatViewDataGenerator
SCORE_ONLY_SCORE
);
if (api_get_setting('gradebook_show_percentage_in_reports') == 'false') {
if ('false' == api_get_setting('gradebook_show_percentage_in_reports')) {
$defaultShowPercentageValue = SCORE_SIMPLE;
if (!empty($style)) {
$defaultShowPercentageValue = $style;
@ -716,7 +714,7 @@ class FlatViewDataGenerator
}
if (!isset($this->params['only_total_category']) ||
(isset($this->params['only_total_category']) && $this->params['only_total_category'] == false)
(isset($this->params['only_total_category']) && false == $this->params['only_total_category'])
) {
if (!$show_all) {
if (in_array(
@ -847,11 +845,11 @@ class FlatViewDataGenerator
$item = $this->evals_links[$count];
$score = $item->calc_score($user[0]);
$divide = (($score[1]) == 0) ? 1 : $score[1];
$divide = (0 == ($score[1])) ? 1 : $score[1];
$item_value += $score[0] / $divide * $item->get_weight();
$item_total += $item->get_weight();
$score_denom = ($score[1] == 0) ? 1 : $score[1];
$score_denom = (0 == $score[1]) ? 1 : $score[1];
$score_final = ($score[0] / $score_denom) * 100;
$row[] = $score_final;
}
@ -901,12 +899,12 @@ class FlatViewDataGenerator
'ORDER BY id'
);
$parent_id = $this->category->get_parent_id();
if ($parent_id == 0 && !empty($allcat)) {
if (0 == $parent_id && !empty($allcat)) {
foreach ($allcat as $sub_cat) {
$score = $sub_cat->calc_score($user[0]);
$real_score = $score;
$main_weight = $this->category->get_weight();
$divide = $score[1] == 0 ? 1 : $score[1];
$divide = 0 == $score[1] ? 1 : $score[1];
//$sub_cat_percentage = $sum_categories_weight_array[$sub_cat->get_id()];
$item_value = $score[0] / $divide * $main_weight;
@ -943,10 +941,10 @@ class FlatViewDataGenerator
for ($count = 0; $count < count($this->evals_links); $count++) {
$item = $this->evals_links[$count];
$score = $item->calc_score($user[0]);
$divide = $score[1] == 0 ? 1 : $score[1];
$divide = 0 == $score[1] ? 1 : $score[1];
$item_value += $score[0] / $divide * $item->get_weight();
$item_total += $item->get_weight();
$score_denom = ($score[1] == 0) ? 1 : $score[1];
$score_denom = (0 == $score[1]) ? 1 : $score[1];
$score_final = ($score[0] / $score_denom) * 100;
$row[] = [
$score_final,

@ -9,8 +9,6 @@ use ChamiloSession as Session;
* used for the general gradebook view.
*
* @author Bert Steppé
*
* @package chamilo.gradebook
*/
class GradebookDataGenerator
{
@ -243,7 +241,6 @@ class GradebookDataGenerator
} else {
if (!empty($studentList)) {
$session_id = api_get_session_id();
//$cats = $item->get_subcategories(null);
$evals = [];
$links = [];
if ('C' === $item->get_item_type()) {
@ -260,7 +257,7 @@ class GradebookDataGenerator
$evalres = $eval->calc_score($user['user_id'], null);
$eval->setStudentList($studentList);
if (isset($evalres) && $eval->get_weight() != 0) {
if (isset($evalres) && 0 != $eval->get_weight()) {
$evalweight = $eval->get_weight();
$weightsum += $evalweight;
if (!empty($evalres[1])) {
@ -271,7 +268,7 @@ class GradebookDataGenerator
$bestResult = $ressum;
}
} else {
if ($eval->get_weight() != 0) {
if (0 != $eval->get_weight()) {
$evalweight = $eval->get_weight();
$weightsum += $evalweight;
}
@ -288,9 +285,9 @@ class GradebookDataGenerator
}
$linkres = $link->calc_score($user['user_id'], null);
if (!empty($linkres) && $link->get_weight() != 0) {
if (!empty($linkres) && 0 != $link->get_weight()) {
$linkweight = $link->get_weight();
$link_res_denom = $linkres[1] == 0 ? 1 : $linkres[1];
$link_res_denom = 0 == $linkres[1] ? 1 : $linkres[1];
$weightsum += $linkweight;
$ressum += $linkres[0] / $link_res_denom * $linkweight;
@ -299,7 +296,7 @@ class GradebookDataGenerator
}
} else {
// Adding if result does not exists
if ($link->get_weight() != 0) {
if (0 != $link->get_weight()) {
$linkweight = $link->get_weight();
$weightsum += $linkweight;
}
@ -476,7 +473,7 @@ class GradebookDataGenerator
public function sort_by_description($item1, $item2)
{
$result = api_strcmp($item1->get_description(), $item2->get_description());
if ($result == 0) {
if (0 == $result) {
return $this->sort_by_name($item1, $item2);
}
@ -557,7 +554,7 @@ class GradebookDataGenerator
true
);
$type = $item->get_item_type();
if ($type == 'L' && get_class($item) === 'ExerciseLink') {
if ('L' == $type && 'ExerciseLink' === get_class($item)) {
$display = ExerciseLib::show_score($score[0], $score[1], false);
}
@ -589,7 +586,7 @@ class GradebookDataGenerator
);
$type = $item->get_item_type();
if ($type === 'L' && get_class($item) === 'ExerciseLink') {
if ('L' === $type && 'ExerciseLink' === get_class($item)) {
$display = ExerciseLib::show_score($score[0], $score[1], false);
$result = ExerciseLib::convertScoreToPlatformSetting($score[0], $score[1]);
$score[0] = $result['score'];
@ -651,7 +648,7 @@ class GradebookDataGenerator
switch ($item->get_item_type()) {
// category
case 'C':
if ($score != null) {
if (null != $score) {
if (empty($model)) {
return [
'display' => $scoreDisplay->display_score(
@ -696,7 +693,7 @@ class GradebookDataGenerator
);
$type = $item->get_item_type();
if ($type == 'L' && get_class($item) == 'ExerciseLink') {
if ('L' == $type && 'ExerciseLink' == get_class($item)) {
$display = ExerciseLib::show_score(
$score[0],
$score[1],

@ -5,8 +5,6 @@
* Gradebook results class.
*
* @author Yannick Warnier
*
* @package chamilo.gradebook
*/
class GradeBookResult
{

@ -7,8 +7,6 @@
* used for the teacher's evaluation results view.
*
* @author Bert Steppé
*
* @package chamilo.gradebook
*/
class ResultsDataGenerator
{
@ -106,7 +104,7 @@ class ResultsDataGenerator
true
);
if ($pdf && $number_decimals == null) {
if ($pdf && null == $number_decimals) {
$user['scoreletter'] = $result->get_score();
}
if ($scoreDisplay->is_custom()) {
@ -213,10 +211,10 @@ class ResultsDataGenerator
$realscore,
$ignore_score_color = false
) {
if ($score != null) {
if (null != $score) {
$scoreDisplay = ScoreDisplay::instance();
$type = SCORE_CUSTOM;
if ($realscore === true) {
if (true === $realscore) {
$type = SCORE_DIV_PERCENT;
}

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
@ -7,8 +8,6 @@
* This class works as a singleton: call instance() to retrieve an object.
*
* @author Bert Steppé
*
* @package chamilo.gradebook
*/
class ScoreDisplay
{

@ -7,8 +7,6 @@
* used for a student's general view.
*
* @author Bert Steppé
*
* @package chamilo.gradebook
*/
class UserDataGenerator
{
@ -48,7 +46,7 @@ class UserDataGenerator
$coursecode = $eval->get_course_code();
if (isset($coursecode)) {
$result = Result::load(null, $userid, $eval->get_id());
if (count($result) == 0) {
if (0 == count($result)) {
$toadd = false;
}
}
@ -56,7 +54,7 @@ class UserDataGenerator
$evals_filtered_copy = $evals;
}
}
if (count($result) == 0) {
if (0 == count($result)) {
$evals_filtered = $evals;
} else {
$evals_filtered = $evals_filtered_copy;
@ -440,7 +438,7 @@ class UserDataGenerator
private function get_category_name_to_display($cat)
{
if (isset($cat)) {
if ($cat->get_parent_id() == '0' || $cat->get_parent_id() == null) {
if ('0' == $cat->get_parent_id() || null == $cat->get_parent_id()) {
return '';
} else {
return $cat->get_name();

@ -47,7 +47,7 @@ $template->assign('allow_export', $allowExport);
$templateName = $template->get_template('gradebook/my_certificates.tpl');
$content = $template->fetch($templateName);
if (api_get_setting('allow_public_certificates') === 'true') {
if ('true' === api_get_setting('allow_public_certificates')) {
$template->assign(
'actions',
Display::toolbarButton(

@ -5,8 +5,6 @@
* Search user certificates if them are publics.
*
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
*
* @package chamilo.gradebook
*/
$cidReset = true;

@ -1,11 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Script.
*
* @package chamilo.gradebook
*/
require_once __DIR__.'/../inc/global.inc.php';
api_block_anonymous_users();

@ -4,7 +4,7 @@
{% block content %}
{% if 'translate_html'|api_get_configuration_value %}
<script>
$(document).ready(function () {
$(function () {
// default
$('.category-forum ').hide();

@ -11,7 +11,7 @@ $course_code = api_get_course_id();
$sessionId = api_get_session_id();
$this_section = SECTION_COURSES;
if ($from == 'myspace') {
if ('myspace' == $from) {
$from_myspace = true;
$this_section = "session_my_space";
}

@ -5,8 +5,6 @@
* Exercise results from Learning paths.
*
* @todo implement pagination
*
* @package chamilo.tracking
*/
require_once __DIR__.'/../inc/global.inc.php';

Loading…
Cancel
Save