diff --git a/main/gradebook/lib/be/attendancelink.class.php b/main/gradebook/lib/be/attendancelink.class.php index 36380f9168..879e67491f 100755 --- a/main/gradebook/lib/be/attendancelink.class.php +++ b/main/gradebook/lib/be/attendancelink.class.php @@ -8,59 +8,59 @@ */ class AttendanceLink extends AbstractLink { - private $attendance_table = null; - private $itemprop_table = null; + private $attendance_table = null; + private $itemprop_table = null; - /** - * Constructor - */ - public function __construct() - { - parent::__construct(); - $this->set_type(LINK_ATTENDANCE); - } + /** + * Constructor + */ + public function __construct() + { + parent::__construct(); + $this->set_type(LINK_ATTENDANCE); + } - /** - * @return string - */ - public function get_type_name() - { - return get_lang('Attendance'); - } + /** + * @return string + */ + public function get_type_name() + { + return get_lang('Attendance'); + } - /** - * @return bool - */ - public function is_allowed_to_change_name() - { - return false; - } + /** + * @return bool + */ + public function is_allowed_to_change_name() + { + return false; + } - /** - * Generate an array of attendances that a teacher hasn't created a link for. - * @return array 2-dimensional array - every element contains 2 subelements (id, name) - * @todo seems to be depracated - */ - public function get_not_created_links() - { - return false; - if (empty($this->course_code)) { - die('Error in get_not_created_links() : course code not set'); - } - $tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK); + /** + * Generate an array of attendances that a teacher hasn't created a link for. + * @return array 2-dimensional array - every element contains 2 subelements (id, name) + * @todo seems to be depracated + */ + public function get_not_created_links() + { + return false; + if (empty($this->course_code)) { + die('Error in get_not_created_links() : course code not set'); + } + $tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK); - $sql = 'SELECT att.id, att.name, att.attendance_qualify_title - FROM '.$this->get_attendance_table().' att - WHERE - att.c_id = '.$this->course_id.' AND - att.id NOT IN ( - SELECT ref_id FROM '.$tbl_grade_links.' - WHERE - type = '.LINK_ATTENDANCE.' AND - course_code = "'.Database::escape_string($this->get_course_code()).'" - ) - AND att.session_id='.api_get_session_id().''; - $result = Database::query($sql); + $sql = 'SELECT att.id, att.name, att.attendance_qualify_title + FROM '.$this->get_attendance_table().' att + WHERE + att.c_id = '.$this->course_id.' AND + att.id NOT IN ( + SELECT ref_id FROM '.$tbl_grade_links.' + WHERE + type = '.LINK_ATTENDANCE.' AND + course_code = "'.Database::escape_string($this->get_course_code()).'" + ) + AND att.session_id='.api_get_session_id().''; + $result = Database::query($sql); $cats = array(); while ($data = Database::fetch_array($result)) { @@ -71,13 +71,13 @@ class AttendanceLink extends AbstractLink } } - return $cats; - } + return $cats; + } - /** - * Generate an array of all attendances available. - * @return array 2-dimensional array - every element contains 2 subelements (id, name) - */ + /** + * Generate an array of all attendances available. + * @return array 2-dimensional array - every element contains 2 subelements (id, name) + */ public function get_all_links() { if (empty($this->course_code)) { @@ -104,55 +104,55 @@ class AttendanceLink extends AbstractLink $my_cats = isset($cats) ? $cats : null; return $my_cats; - } + } - /** - * Has anyone done this exercise yet ? - */ - public function has_results() - { - $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT); - $session_id = api_get_session_id(); - $sql = 'SELECT count(*) AS number FROM '.$tbl_attendance_result." - WHERE - session_id = $session_id AND - c_id = '.$this->course_id.' AND - attendance_id = '".intval($this->get_ref_id())."'"; - $result = Database::query($sql); - $number = Database::fetch_row($result); + /** + * Has anyone done this exercise yet ? + */ + public function has_results() + { + $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT); + $session_id = api_get_session_id(); + $sql = 'SELECT count(*) AS number FROM '.$tbl_attendance_result." + WHERE + session_id = $session_id AND + c_id = '.$this->course_id.' AND + attendance_id = '".intval($this->get_ref_id())."'"; + $result = Database::query($sql); + $number = Database::fetch_row($result); - return $number[0] != 0; - } + return $number[0] != 0; + } - /** - * @param int $stud_id - * @return array|null - */ - public function calc_score($stud_id = null, $type = null) - { - $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT); - $session_id = api_get_session_id(); + /** + * @param int $stud_id + * @return array|null + */ + public function calc_score($stud_id = null, $type = null) + { + $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT); + $session_id = api_get_session_id(); - // get attendance qualify max - $sql = 'SELECT att.attendance_qualify_max - FROM '.$this->get_attendance_table().' att - WHERE - att.c_id = '.$this->course_id.' AND - att.id = '.intval($this->get_ref_id()).' AND - att.session_id='.intval($session_id).''; - $query = Database::query($sql); - $attendance = Database::fetch_array($query, 'ASSOC'); + // get attendance qualify max + $sql = 'SELECT att.attendance_qualify_max + FROM '.$this->get_attendance_table().' att + WHERE + att.c_id = '.$this->course_id.' AND + att.id = '.intval($this->get_ref_id()).' AND + att.session_id='.intval($session_id).''; + $query = Database::query($sql); + $attendance = Database::fetch_array($query, 'ASSOC'); - // Get results - $sql = 'SELECT * - FROM '.$tbl_attendance_result.' - WHERE c_id = '.$this->course_id.' AND attendance_id = '.intval($this->get_ref_id()); - if (isset($stud_id)) { - $sql .= ' AND user_id = '.intval($stud_id); - } - $scores = Database::query($sql); - // for 1 student - if (isset($stud_id)) { + // Get results + $sql = 'SELECT * + FROM '.$tbl_attendance_result.' + WHERE c_id = '.$this->course_id.' AND attendance_id = '.intval($this->get_ref_id()); + if (isset($stud_id)) { + $sql .= ' AND user_id = '.intval($stud_id); + } + $scores = Database::query($sql); + // for 1 student + if (isset($stud_id)) { if ($data = Database::fetch_array($scores, 'ASSOC')) { return array( $data['score'], @@ -162,7 +162,7 @@ class AttendanceLink extends AbstractLink //We sent the 0/attendance_qualify_max instead of null for correct calculations return array(0, $attendance['attendance_qualify_max']); } - } else { + } else { // all students -> get average $students = array(); // user list, needed to make sure we only // take first attempts into account @@ -171,144 +171,144 @@ class AttendanceLink extends AbstractLink $sumResult = 0; $bestResult = 0; - while ($data = Database::fetch_array($scores)) { - if (!(array_key_exists($data['user_id'], $students))) { - if ($attendance['attendance_qualify_max'] != 0) { - $students[$data['user_id']] = $data['score']; - $rescount++; - $sum += $data['score'] / $attendance['attendance_qualify_max']; - $sumResult += $data['score']; - if ($data['score'] > $bestResult) { - $bestResult = $data['score']; - } - $weight = $attendance['attendance_qualify_max']; - } - } - } + while ($data = Database::fetch_array($scores)) { + if (!(array_key_exists($data['user_id'], $students))) { + if ($attendance['attendance_qualify_max'] != 0) { + $students[$data['user_id']] = $data['score']; + $rescount++; + $sum += $data['score'] / $attendance['attendance_qualify_max']; + $sumResult += $data['score']; + if ($data['score'] > $bestResult) { + $bestResult = $data['score']; + } + $weight = $attendance['attendance_qualify_max']; + } + } + } - if ($rescount == 0) { - return null; - } else { - switch ($type) { - case 'best': - return array($bestResult, $weight); - break; - case 'average': - return array($sumResult / $rescount, $weight); - break; - case 'ranking': - return AbstractLink::getCurrentUserRanking($stud_id, $students); - break; - default: - return array($sum, $rescount); - break; - } - } - } - } + if ($rescount == 0) { + return null; + } else { + switch ($type) { + case 'best': + return array($bestResult, $weight); + break; + case 'average': + return array($sumResult / $rescount, $weight); + break; + case 'ranking': + return AbstractLink::getCurrentUserRanking($stud_id, $students); + break; + default: + return array($sum, $rescount); + break; + } + } + } + } - /** - * Lazy load function to get the database table of the student publications - */ - private function get_attendance_table() - { - $this->attendance_table = Database::get_course_table(TABLE_ATTENDANCE); - return $this->attendance_table; - } + /** + * Lazy load function to get the database table of the student publications + */ + private function get_attendance_table() + { + $this->attendance_table = Database::get_course_table(TABLE_ATTENDANCE); + return $this->attendance_table; + } - public function needs_name_and_description() - { - return false; - } + public function needs_name_and_description() + { + return false; + } - public function needs_max() - { - return false; - } + public function needs_max() + { + return false; + } - public function needs_results() - { - return false; - } + public function needs_results() + { + return false; + } - /** - * @return string - */ - public function get_name() - { - $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 != '') { - return $this->attendance_data['attendance_qualify_title']; - } else { - return $attendance_title; - } - } + /** + * @return string + */ + public function get_name() + { + $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 != '') { + return $this->attendance_data['attendance_qualify_title']; + } else { + return $attendance_title; + } + } - /** - * @return string - */ - public function get_description() - { - return ''; - } + /** + * @return string + */ + public function get_description() + { + return ''; + } - /** - * Check if this still links to an exercise - */ - public function is_valid_link() - { - $session_id = api_get_session_id(); - $sql = 'SELECT count(att.id) FROM '.$this->get_attendance_table().' att - WHERE att.c_id = '.$this->course_id.' AND att.id = '.intval($this->get_ref_id()).' '; - $result = Database::query($sql); - $number = Database::fetch_row($result); - return ($number[0] != 0); - } + /** + * Check if this still links to an exercise + */ + public function is_valid_link() + { + $session_id = api_get_session_id(); + $sql = 'SELECT count(att.id) FROM '.$this->get_attendance_table().' att + WHERE att.c_id = '.$this->course_id.' AND att.id = '.intval($this->get_ref_id()).' '; + $result = Database::query($sql); + $number = Database::fetch_row($result); + return ($number[0] != 0); + } - public function get_test_id() - { - return 'DEBUG:ID'; - } + public function get_test_id() + { + return 'DEBUG:ID'; + } - public function get_link() - { - //it was extracts the attendance id - $session_id = api_get_session_id(); - $sql = 'SELECT * FROM '.$this->get_attendance_table().' att - WHERE att.c_id = '.$this->course_id.' AND att.id = '.intval($this->get_ref_id()).' '; - $result = Database::query($sql); - $row = Database::fetch_array($result,'ASSOC'); - $attendance_id = $row['id']; - $url = api_get_path(WEB_PATH).'main/attendance/index.php?action=attendance_sheet_list&gradebook=view&attendance_id='.$attendance_id.'&'.api_get_cidreq_params($this->get_course_code(), $session_id); + public function get_link() + { + //it was extracts the attendance id + $session_id = api_get_session_id(); + $sql = 'SELECT * FROM '.$this->get_attendance_table().' att + WHERE att.c_id = '.$this->course_id.' AND att.id = '.intval($this->get_ref_id()).' '; + $result = Database::query($sql); + $row = Database::fetch_array($result,'ASSOC'); + $attendance_id = $row['id']; + $url = api_get_path(WEB_PATH).'main/attendance/index.php?action=attendance_sheet_list&gradebook=view&attendance_id='.$attendance_id.'&'.api_get_cidreq_params($this->get_course_code(), $session_id); - return $url; - } + return $url; + } - /** - * @return array|bool - */ - private function get_attendance_data() - { - $tbl_name = $this->get_attendance_table(); - $session_id = api_get_session_id(); - if ($tbl_name == '') { - return false; - } elseif (!isset($this->attendance_data)) { - $sql = 'SELECT * FROM '.$this->get_attendance_table().' att - WHERE att.c_id = '.$this->course_id.' AND att.id = '.intval($this->get_ref_id()).' '; - $query = Database::query($sql); - $this->attendance_data = Database::fetch_array($query); - } - return $this->attendance_data; - } + /** + * @return array|bool + */ + private function get_attendance_data() + { + $tbl_name = $this->get_attendance_table(); + $session_id = api_get_session_id(); + if ($tbl_name == '') { + return false; + } elseif (!isset($this->attendance_data)) { + $sql = 'SELECT * FROM '.$this->get_attendance_table().' att + WHERE att.c_id = '.$this->course_id.' AND att.id = '.intval($this->get_ref_id()).' '; + $query = Database::query($sql); + $this->attendance_data = Database::fetch_array($query); + } + return $this->attendance_data; + } - /** - * @return string - */ - public function get_icon_name() - { - return 'attendance'; - } + /** + * @return string + */ + public function get_icon_name() + { + return 'attendance'; + } } diff --git a/main/gradebook/lib/be/category.class.php b/main/gradebook/lib/be/category.class.php index 52b1da113e..cf715ca29f 100755 --- a/main/gradebook/lib/be/category.class.php +++ b/main/gradebook/lib/be/category.class.php @@ -365,6 +365,8 @@ class Category implements GradebookItem * @param int $session_id (in case we are in a session) * @param bool $order_by Whether to show all "session" * categories (true) or hide them (false) in case there is no session id + * + * @return array */ public static function load( $id = null, @@ -707,7 +709,7 @@ class Category implements GradebookItem if (!empty($links)) { foreach ($links as $link_item) { if (isset($link_item)) { - $new_item_weight = $new_weight * $link_item->get_weight() / $old_weight; + $new_item_weight = $new_weight * $link_item->get_weight() / $old_weight; $link_item->set_weight($new_item_weight); $link_item->save(); } @@ -730,8 +732,8 @@ class Category implements GradebookItem */ public function update_category_delete($course_id) { - $tbl_grade_categories = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY); - $sql = 'UPDATE '.$tbl_grade_categories.' SET + $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY); + $sql = 'UPDATE '.$table.' SET visible = 3 WHERE course_code ="'.Database::escape_string($course_id).'"'; Database::query($sql); @@ -778,8 +780,10 @@ class Category implements GradebookItem /** * Check if a category name (with the same parent category) already exists - * @param $name name to check (if not given, the name property of this object will be checked) - * @param $parent parent category + * @param string $name name to check (if not given, the name property of this object will be checked) + * @param int $parent parent category + * + * @return bool */ public function does_name_exist($name, $parent) { @@ -788,9 +792,9 @@ class Category implements GradebookItem $parent = $this->parent; } $tbl_grade_categories = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY); - $sql = 'SELECT count(id) AS number' - .' FROM '.$tbl_grade_categories - ." WHERE name = '".Database::escape_string($name)."'"; + $sql = "SELECT count(id) AS number + FROM $tbl_grade_categories + WHERE name = '".Database::escape_string($name)."'"; if (api_is_allowed_to_edit()) { $parent = self::load($parent); @@ -818,7 +822,8 @@ class Category implements GradebookItem $result = Database::query($sql); $number = Database::fetch_row($result); - return ($number[0] != 0); + + return $number[0] != 0; } /** @@ -1107,9 +1112,23 @@ class Category implements GradebookItem */ public function delete_all() { - $cats = self::load(null, null, $this->course_code, $this->id, null); - $evals = Evaluation::load(null, null, $this->course_code, $this->id, null); - $links = LinkFactory::load(null, null, null, null, $this->course_code, $this->id, null); + $cats = self::load(null, null, $this->course_code, $this->id, null); + $evals = Evaluation::load( + null, + null, + $this->course_code, + $this->id, + null + ); + $links = LinkFactory::load( + null, + null, + null, + null, + $this->course_code, + $this->id, + null + ); if (!empty($cats)) { foreach ($cats as $cat) { $cat->delete_all(); @@ -1131,12 +1150,11 @@ class Category implements GradebookItem /** * Return array of Category objects where a student is subscribed to. - * @param int student id - * @param string Course code - * @param int Session id + * * @param integer $stud_id * @param string $course_code * @param integer $session_id + * @return array */ public function get_root_categories_for_student($stud_id, $course_code = null, $session_id = null) { @@ -1218,17 +1236,16 @@ class Category implements GradebookItem /** * Return array of Category objects where a teacher is admin for. - * @param int user id (to return everything, use 'null' here) - * @param string course code (optional) - * @param int session id (optional) - * @param integer $user_id - * @param string $course_code - * @param integer $session_id + * + * @param integer $user_id (to return everything, use 'null' here) + * @param string $course_code (optional) + * @param integer $session_id (optional) + * @return array */ public function get_root_categories_for_teacher($user_id, $course_code = null, $session_id = null) { if ($user_id == null) { - return self::load(null,null,$course_code,0,null,$session_id); + return self::load(null, null, $course_code, 0, null, $session_id); } $courseTable = Database::get_main_table(TABLE_MAIN_COURSE); @@ -1236,7 +1253,7 @@ class Category implements GradebookItem $tbl_grade_categories = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY); $sql = 'SELECT * FROM '.$tbl_grade_categories.' - WHERE parent_id = 0'; + WHERE parent_id = 0 '; if (!empty($course_code)) { $sql .= " AND course_code = '".Database::escape_string($course_code)."' "; if (!empty($session_id)) { @@ -1273,10 +1290,11 @@ class Category implements GradebookItem /** * Can this category be moved to somewhere else ? * The root and courses cannot be moved. + * @return bool */ public function is_movable() { - return (!(!isset ($this->id) || $this->id == 0 || $this->is_course())); + return !(!isset($this->id) || $this->id == 0 || $this->is_course()); } /** @@ -1291,7 +1309,6 @@ class Category implements GradebookItem if (!$this->is_movable()) { return null; } else { - // otherwise: // - course independent category // -> movable to root or other independent categories @@ -1306,7 +1323,7 @@ class Category implements GradebookItem $targets[] = $root; if (isset($this->course_code) && !empty($this->course_code)) { - $crscats = self::load(null,null,$this->course_code,0); + $crscats = self::load(null, null, $this->course_code, 0); foreach ($crscats as $cat) { if ($this->can_be_moved_to_cat($cat)) { $targets[] = array ($cat->get_id(), $cat->get_name(), $level+1); @@ -1315,7 +1332,7 @@ class Category implements GradebookItem } } - $indcats = self::load(null,$user,0,0); + $indcats = self::load(null, $user, 0, 0); foreach ($indcats as $cat) { if ($this->can_be_moved_to_cat($cat)) { $targets[] = array ($cat->get_id(), $cat->get_name(), $level+1); @@ -1329,11 +1346,15 @@ class Category implements GradebookItem /** * Internal function used by get_target_categories() + * @param array $targets * @param integer $level + * @param int $catid + * + * @return array */ private function add_target_subcategories($targets, $level, $catid) { - $subcats = self::load(null,null,null,$catid); + $subcats = self::load(null, null, null, $catid); foreach ($subcats as $cat) { if ($this->can_be_moved_to_cat($cat)) { $targets[] = array ($cat->get_id(), $cat->get_name(), $level+1); @@ -1350,7 +1371,7 @@ class Category implements GradebookItem * Impossible when origin and target are the same... children won't be processed * either. (a category can't be moved to one of its own children) */ - private function can_be_moved_to_cat ($cat) + private function can_be_moved_to_cat($cat) { return $cat->get_id() != $this->get_id(); } @@ -1432,7 +1453,7 @@ class Category implements GradebookItem * @param integer $level * @param null|integer $visible */ - private function add_subtree ($targets, $level, $catid, $visible) + private function add_subtree($targets, $level, $catid, $visible) { $subcats = self::load(null,null,null,$catid,$visible); @@ -1458,9 +1479,10 @@ class Category implements GradebookItem $tbl_grade_categories = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY); $sql = 'SELECT DISTINCT(code), title - FROM '.$tbl_main_courses.' cc, '.$tbl_main_course_user.' cu' - .' WHERE cc.id = cu.c_id ' - .' AND cu.status = '.COURSEMANAGER; + FROM '.$tbl_main_courses.' cc, '.$tbl_main_course_user.' cu + WHERE + cc.id = cu.c_id AND + cu.status = '.COURSEMANAGER; if (!api_is_platform_admin()) { $sql .= ' AND cu.user_id = '.$user_id; } @@ -1473,9 +1495,9 @@ class Category implements GradebookItem )'; $result = Database::query($sql); - $cats=array(); - while ($data=Database::fetch_array($result)) { - $cats[] = array ($data['code'], $data['title']); + $cats = array(); + while ($data = Database::fetch_array($result)) { + $cats[] = array($data['code'], $data['title']); } return $cats; @@ -1566,7 +1588,8 @@ class Category implements GradebookItem * that should be visible to a student. * @param integer $cat_id parent category * @param $stud_id student id - * @param $cats optional: if defined, the categories will be added to this array + * @param array $cats optional: if defined, the categories will be added to this array + * @return array */ public function get_independent_categories_with_result_for_student($cat_id, $stud_id, $cats = array()) { @@ -1587,6 +1610,7 @@ class Category implements GradebookItem } } } + return $cats; } @@ -1868,16 +1892,16 @@ class Category implements GradebookItem * @param string $name_mask search string * @return array category objects matching the search criterium */ - public function find_category($name_mask,$allcat) + public function find_category($name_mask, $allcat) { - $foundcats = array(); + $categories = array(); foreach ($allcat as $search_cat) { if (!(strpos(strtolower($search_cat->get_name()), strtolower($name_mask)) === false)) { - $foundcats[] = $search_cat; + $categories[] = $search_cat; } } - return $foundcats; + return $categories; } /** @@ -1902,9 +1926,7 @@ class Category implements GradebookItem { if (api_get_setting('gradebook_locking_enabled') == 'true') { $this->lock($locked); - $evals_to_lock = $this->get_evaluations(); - if (!empty($evals_to_lock)) { foreach ($evals_to_lock as $item) { $item->lock($locked); @@ -2158,8 +2180,11 @@ class Category implements GradebookItem { $certificate_list = GradebookUtils::get_list_users_certificates($catId); if (!empty($certificate_list)) { - foreach ($certificate_list as $index=>$value) { - $list_certificate = GradebookUtils::get_list_gradebook_certificates_by_user_id($value['user_id'], $catId); + foreach ($certificate_list as $index => $value) { + $list_certificate = GradebookUtils::get_list_gradebook_certificates_by_user_id( + $value['user_id'], + $catId + ); foreach ($list_certificate as $value_certificate) { $certificate_obj = new Certificate($value_certificate['id']); $certificate_obj->delete(true); @@ -2287,7 +2312,6 @@ class Category implements GradebookItem } $category = $cats_course[0]; - $courseEvaluations = $category->get_evaluations($userId, true); $courseLinks = $category->get_links($userId, true); $evaluationsAndLinks = array_merge($courseEvaluations, $courseLinks); diff --git a/main/gradebook/lib/fe/gradebooktable.class.php b/main/gradebook/lib/fe/gradebooktable.class.php index dfc139b079..d91a5f1e1d 100755 --- a/main/gradebook/lib/fe/gradebooktable.class.php +++ b/main/gradebook/lib/fe/gradebooktable.class.php @@ -18,20 +18,24 @@ class GradebookTable extends SortableTable private $currentcat; private $datagen; private $evals_links; - public $cats; private $dataForGraph; + public $cats; public $exportToPdf; public $teacherView; public $userId; public $studentList; /** - * Constructor + * GradebookTable constructor. * @param Category $currentcat * @param array $cats * @param array $evals * @param array $links * @param null $addparams + * @param bool $exportToPdf + * @param null $showTeacherView + * @param int $userId + * @param array $studentList */ public function __construct( $currentcat, @@ -370,8 +374,12 @@ class GradebookTable extends SortableTable // Student result $row[] = $value_data; - $totalResultAverageValue = strip_tags($scoredisplay->display_score($totalResult, - SCORE_AVERAGE)); + $totalResultAverageValue = strip_tags( + $scoredisplay->display_score( + $totalResult, + SCORE_AVERAGE + ) + ); $this->dataForGraph['my_result'][] = floatval($totalResultAverageValue); $totalAverageValue = strip_tags($scoredisplay->display_score($totalAverage, SCORE_AVERAGE)); $this->dataForGraph['average'][] = floatval($totalAverageValue); @@ -456,8 +464,8 @@ class GradebookTable extends SortableTable $row[] = $this->build_type_column($item, array('style' => 'padding-left:5px')); // Name. - $row[] = $invisibility_span_open."    ".$this->build_name_link($item, - $type).$invisibility_span_close; + $row[] = $invisibility_span_open."    ". + $this->build_name_link($item, $type).$invisibility_span_close; // Description. if ($this->exportToPdf == false) { @@ -1045,7 +1053,7 @@ class GradebookTable extends SortableTable } /** - * @param $item + * @param AbstractLink $item * @return null|string */ private function build_edit_column($item) diff --git a/main/work/edit.php b/main/work/edit.php index 5655142ec4..1e549e3fbe 100755 --- a/main/work/edit.php +++ b/main/work/edit.php @@ -13,7 +13,7 @@ $this_section = SECTION_COURSES; $work_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : null; $item_id = isset($_REQUEST['item_id']) ? intval($_REQUEST['item_id']) : null; -$work_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION); +$work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION); $is_allowed_to_edit = api_is_allowed_to_edit(); $course_id = api_get_course_int_id(); diff --git a/main/work/upload_corrections.php b/main/work/upload_corrections.php index 65a7679934..0a8ea02878 100644 --- a/main/work/upload_corrections.php +++ b/main/work/upload_corrections.php @@ -138,7 +138,7 @@ if ($form->validate()) { $finder = new Finder(); $finder->files()->in($destinationDir); - $table = Database:: get_course_table(TABLE_STUDENT_PUBLICATION); + $table = Database::get_course_table(TABLE_STUDENT_PUBLICATION); //var_dump($finalResult); /** @var SplFileInfo $file */ foreach ($finder as $file) { diff --git a/main/work/view.php b/main/work/view.php index fc4658bd69..50d8ac5d6b 100755 --- a/main/work/view.php +++ b/main/work/view.php @@ -86,7 +86,7 @@ if ((user_is_author($id) || $isDrhOfCourse || (api_is_allowed_to_edit() || api_i ); if (api_is_allowed_to_edit()) { - $work_table = Database:: get_course_table(TABLE_STUDENT_PUBLICATION); + $work_table = Database::get_course_table(TABLE_STUDENT_PUBLICATION); $sql = "UPDATE $work_table SET qualificator_id = '".api_get_user_id()."', @@ -104,7 +104,7 @@ if ((user_is_author($id) || $isDrhOfCourse || (api_is_allowed_to_edit() || api_i $work ); if ($resultUpload) { - $work_table = Database:: get_course_table( + $work_table = Database::get_course_table( TABLE_STUDENT_PUBLICATION );