@@ -80,7 +80,7 @@ |
||
| 80 | 80 | |
| 81 | 81 | /** |
| 82 | 82 | * Validates the received active connection data with the database |
| 83 | - * @return bool Return the loginFailed variable value to local.inc.php |
|
| 83 | + * @return null|false Return the loginFailed variable value to local.inc.php |
|
| 84 | 84 | */ |
| 85 | 85 | public function check_user() |
| 86 | 86 | { |
@@ -47,6 +47,9 @@ |
||
| 47 | 47 | |
| 48 | 48 | /* FUNCTIONS */ |
| 49 | 49 | |
| 50 | +/** |
|
| 51 | + * @param string $name |
|
| 52 | + */ |
|
| 50 | 53 | function make_select_session_list($name, $sessions, $attr = array()) |
| 51 | 54 | { |
| 52 | 55 | $attributes = ''; |
@@ -327,7 +327,7 @@ |
||
| 327 | 327 | * @param array $arr1 first array |
| 328 | 328 | * @param array $arr2 second array |
| 329 | 329 | * |
| 330 | - * @return array difference between the two arrays |
|
| 330 | + * @return string difference between the two arrays |
|
| 331 | 331 | */ |
| 332 | 332 | function diff($arr1, $arr2) |
| 333 | 333 | { |
@@ -95,7 +95,7 @@ |
||
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | 97 | * Get the progress of this learnpath. Only the last attempt are taken into account. |
| 98 | - * @param $stud_id student id (default: all students who have results - then the average is returned) |
|
| 98 | + * @param integer $stud_id student id (default: all students who have results - then the average is returned) |
|
| 99 | 99 | * @return array (score, max) if student is given |
| 100 | 100 | * array (sum of scores, number of scores) otherwise |
| 101 | 101 | * or null if no scores available |
@@ -9,261 +9,261 @@ |
||
| 9 | 9 | */ |
| 10 | 10 | class LearnpathLink extends AbstractLink |
| 11 | 11 | { |
| 12 | - private $course_info = null; |
|
| 13 | - private $learnpath_table = null; |
|
| 14 | - private $learnpath_data = null; |
|
| 15 | - |
|
| 16 | - /** |
|
| 17 | - * Constructor |
|
| 18 | - */ |
|
| 19 | - public function __construct() |
|
| 20 | - { |
|
| 21 | - parent::__construct(); |
|
| 22 | - $this->set_type(LINK_LEARNPATH); |
|
| 23 | - } |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * Generate an array of learnpaths that a teacher hasn't created a link for. |
|
| 27 | - * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
| 28 | - */ |
|
| 29 | - public function get_not_created_links() |
|
| 30 | - { |
|
| 31 | - return false; |
|
| 32 | - if (empty($this->course_code)) |
|
| 33 | - die('Error in get_not_created_links() : course code not set'); |
|
| 34 | - |
|
| 35 | - $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
|
| 36 | - |
|
| 37 | - $sql = 'SELECT id, name from '.$this->get_learnpath_table().' lp |
|
| 12 | + private $course_info = null; |
|
| 13 | + private $learnpath_table = null; |
|
| 14 | + private $learnpath_data = null; |
|
| 15 | + |
|
| 16 | + /** |
|
| 17 | + * Constructor |
|
| 18 | + */ |
|
| 19 | + public function __construct() |
|
| 20 | + { |
|
| 21 | + parent::__construct(); |
|
| 22 | + $this->set_type(LINK_LEARNPATH); |
|
| 23 | + } |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * Generate an array of learnpaths that a teacher hasn't created a link for. |
|
| 27 | + * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
| 28 | + */ |
|
| 29 | + public function get_not_created_links() |
|
| 30 | + { |
|
| 31 | + return false; |
|
| 32 | + if (empty($this->course_code)) |
|
| 33 | + die('Error in get_not_created_links() : course code not set'); |
|
| 34 | + |
|
| 35 | + $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
|
| 36 | + |
|
| 37 | + $sql = 'SELECT id, name from '.$this->get_learnpath_table().' lp |
|
| 38 | 38 | WHERE c_id = '.$this->course_id.' AND id NOT IN ' |
| 39 | - .' (SELECT ref_id FROM '.$tbl_grade_links |
|
| 40 | - .' WHERE type = '.LINK_LEARNPATH |
|
| 41 | - ." AND course_code = '".$this->get_course_code()."'" |
|
| 42 | - .') AND lp.session_id='.api_get_session_id().''; |
|
| 43 | - |
|
| 44 | - $result = Database::query($sql); |
|
| 45 | - |
|
| 46 | - $cats=array(); |
|
| 47 | - while ($data=Database::fetch_array($result)) { |
|
| 48 | - $cats[] = array ($data['id'], $data['name']); |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - return $cats; |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - /** |
|
| 55 | - * Generate an array of all learnpaths available. |
|
| 56 | - * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
| 57 | - */ |
|
| 58 | - public function get_all_links() |
|
| 59 | - { |
|
| 60 | - if (empty($this->course_code)) |
|
| 61 | - die('Error in get_not_created_links() : course code not set'); |
|
| 62 | - |
|
| 63 | - $session_id = api_get_session_id(); |
|
| 64 | - if (empty($session_id)) { |
|
| 65 | - $session_condition = api_get_session_condition(0, true); |
|
| 66 | - } else { |
|
| 67 | - $session_condition = api_get_session_condition($session_id, true, true); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - $sql = 'SELECT id, name FROM '.$this->get_learnpath_table().' |
|
| 39 | + .' (SELECT ref_id FROM '.$tbl_grade_links |
|
| 40 | + .' WHERE type = '.LINK_LEARNPATH |
|
| 41 | + ." AND course_code = '".$this->get_course_code()."'" |
|
| 42 | + .') AND lp.session_id='.api_get_session_id().''; |
|
| 43 | + |
|
| 44 | + $result = Database::query($sql); |
|
| 45 | + |
|
| 46 | + $cats=array(); |
|
| 47 | + while ($data=Database::fetch_array($result)) { |
|
| 48 | + $cats[] = array ($data['id'], $data['name']); |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + return $cats; |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + /** |
|
| 55 | + * Generate an array of all learnpaths available. |
|
| 56 | + * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
| 57 | + */ |
|
| 58 | + public function get_all_links() |
|
| 59 | + { |
|
| 60 | + if (empty($this->course_code)) |
|
| 61 | + die('Error in get_not_created_links() : course code not set'); |
|
| 62 | + |
|
| 63 | + $session_id = api_get_session_id(); |
|
| 64 | + if (empty($session_id)) { |
|
| 65 | + $session_condition = api_get_session_condition(0, true); |
|
| 66 | + } else { |
|
| 67 | + $session_condition = api_get_session_condition($session_id, true, true); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + $sql = 'SELECT id, name FROM '.$this->get_learnpath_table().' |
|
| 71 | 71 | WHERE c_id = '.$this->course_id.' '.$session_condition.' '; |
| 72 | - $result = Database::query($sql); |
|
| 72 | + $result = Database::query($sql); |
|
| 73 | 73 | |
| 74 | - $cats = array(); |
|
| 75 | - while ($data=Database::fetch_array($result)) { |
|
| 76 | - $cats[] = array ($data['id'], $data['name']); |
|
| 77 | - } |
|
| 74 | + $cats = array(); |
|
| 75 | + while ($data=Database::fetch_array($result)) { |
|
| 76 | + $cats[] = array ($data['id'], $data['name']); |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - return $cats; |
|
| 80 | - } |
|
| 79 | + return $cats; |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * Has anyone used this learnpath yet ? |
|
| 85 | - */ |
|
| 86 | - public function has_results() |
|
| 87 | - { |
|
| 88 | - $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); |
|
| 89 | - $sql = "SELECT count(id) AS number FROM $tbl_stats |
|
| 83 | + /** |
|
| 84 | + * Has anyone used this learnpath yet ? |
|
| 85 | + */ |
|
| 86 | + public function has_results() |
|
| 87 | + { |
|
| 88 | + $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); |
|
| 89 | + $sql = "SELECT count(id) AS number FROM $tbl_stats |
|
| 90 | 90 | WHERE c_id = ".$this->course_id." AND lp_id = ".$this->get_ref_id(); |
| 91 | - $result = Database::query($sql); |
|
| 92 | - $number = Database::fetch_array($result,'NUM'); |
|
| 93 | - return ($number[0] != 0); |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - /** |
|
| 97 | - * Get the progress of this learnpath. Only the last attempt are taken into account. |
|
| 98 | - * @param $stud_id student id (default: all students who have results - then the average is returned) |
|
| 99 | - * @return array (score, max) if student is given |
|
| 100 | - * array (sum of scores, number of scores) otherwise |
|
| 101 | - * or null if no scores available |
|
| 102 | - */ |
|
| 103 | - public function calc_score($stud_id = null, $type = null) |
|
| 104 | - { |
|
| 105 | - $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); |
|
| 106 | - $session_id = api_get_session_id(); |
|
| 107 | - |
|
| 108 | - $sql = "SELECT * FROM $tbl_stats |
|
| 91 | + $result = Database::query($sql); |
|
| 92 | + $number = Database::fetch_array($result,'NUM'); |
|
| 93 | + return ($number[0] != 0); |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + /** |
|
| 97 | + * Get the progress of this learnpath. Only the last attempt are taken into account. |
|
| 98 | + * @param $stud_id student id (default: all students who have results - then the average is returned) |
|
| 99 | + * @return array (score, max) if student is given |
|
| 100 | + * array (sum of scores, number of scores) otherwise |
|
| 101 | + * or null if no scores available |
|
| 102 | + */ |
|
| 103 | + public function calc_score($stud_id = null, $type = null) |
|
| 104 | + { |
|
| 105 | + $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); |
|
| 106 | + $session_id = api_get_session_id(); |
|
| 107 | + |
|
| 108 | + $sql = "SELECT * FROM $tbl_stats |
|
| 109 | 109 | WHERE |
| 110 | 110 | c_id = ".$this->course_id." AND |
| 111 | 111 | lp_id = ".$this->get_ref_id()." AND |
| 112 | 112 | session_id = $session_id "; |
| 113 | 113 | |
| 114 | - if (isset($stud_id)) |
|
| 115 | - $sql .= ' AND user_id = '.intval($stud_id); |
|
| 116 | - |
|
| 117 | - // order by id, that way the student's first attempt is accessed first |
|
| 118 | - $sql .= ' ORDER BY view_count DESC'; |
|
| 119 | - |
|
| 120 | - $scores = Database::query($sql); |
|
| 121 | - // for 1 student |
|
| 122 | - if (isset($stud_id)) { |
|
| 123 | - if ($data = Database::fetch_assoc($scores)) { |
|
| 124 | - return array ($data['progress'], 100); |
|
| 125 | - } else |
|
| 126 | - return null; |
|
| 127 | - } else { |
|
| 128 | - // all students -> get average |
|
| 129 | - $students = array(); // user list, needed to make sure we only |
|
| 130 | - // take first attempts into account |
|
| 131 | - $rescount = 0; |
|
| 132 | - $sum = 0; |
|
| 133 | - $bestResult = 0; |
|
| 134 | - $sumResult = 0; |
|
| 135 | - while ($data = Database::fetch_array($scores)) { |
|
| 136 | - if (!(array_key_exists($data['user_id'], $students))) { |
|
| 137 | - $students[$data['user_id']] = $data['progress']; |
|
| 138 | - $rescount++; |
|
| 139 | - $sum += $data['progress'] / 100; |
|
| 140 | - $sumResult += $data['progress']; |
|
| 141 | - |
|
| 142 | - if ($data['progress'] > $bestResult) { |
|
| 143 | - $bestResult = $data['progress']; |
|
| 144 | - } |
|
| 145 | - } |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - if ($rescount == 0) { |
|
| 149 | - return null; |
|
| 150 | - } else { |
|
| 151 | - |
|
| 152 | - switch ($type) { |
|
| 153 | - case 'best': |
|
| 154 | - return array($bestResult, 100); |
|
| 155 | - break; |
|
| 156 | - case 'average': |
|
| 157 | - return array($sumResult/$rescount, 100); |
|
| 158 | - break; |
|
| 159 | - case 'ranking': |
|
| 160 | - return AbstractLink::getCurrentUserRanking($stud_id, $students); |
|
| 161 | - break; |
|
| 162 | - default: |
|
| 163 | - return array($sum, $rescount); |
|
| 164 | - break; |
|
| 165 | - } |
|
| 166 | - } |
|
| 167 | - } |
|
| 168 | - } |
|
| 169 | - |
|
| 170 | - /** |
|
| 171 | - * Get URL where to go to if the user clicks on the link. |
|
| 172 | - */ |
|
| 173 | - public function get_link() |
|
| 174 | - { |
|
| 175 | - $session_id = api_get_session_id(); |
|
| 176 | - $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq_params($this->get_course_code(), $session_id).'&gradebook=view'; |
|
| 177 | - |
|
| 178 | - if (!api_is_allowed_to_edit() || $this->calc_score(api_get_user_id()) == null) { |
|
| 179 | - $url .= '&action=view&lp_id='.$this->get_ref_id(); |
|
| 180 | - } else { |
|
| 181 | - $url .= '&action=build&lp_id='.$this->get_ref_id(); |
|
| 182 | - } |
|
| 183 | - return $url; |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - /** |
|
| 187 | - * Get name to display: same as learnpath title |
|
| 188 | - */ |
|
| 189 | - public function get_name() |
|
| 190 | - { |
|
| 191 | - $data = $this->get_learnpath_data(); |
|
| 192 | - return $data['name']; |
|
| 193 | - } |
|
| 194 | - |
|
| 195 | - /** |
|
| 196 | - * Get description to display: same as learnpath description |
|
| 197 | - */ |
|
| 198 | - public function get_description() |
|
| 199 | - { |
|
| 200 | - $data = $this->get_learnpath_data(); |
|
| 201 | - return $data['description']; |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - /** |
|
| 205 | - * Check if this still links to a learnpath |
|
| 206 | - */ |
|
| 207 | - public function is_valid_link() { |
|
| 208 | - $sql = 'SELECT count(id) FROM '.$this->get_learnpath_table().' |
|
| 114 | + if (isset($stud_id)) |
|
| 115 | + $sql .= ' AND user_id = '.intval($stud_id); |
|
| 116 | + |
|
| 117 | + // order by id, that way the student's first attempt is accessed first |
|
| 118 | + $sql .= ' ORDER BY view_count DESC'; |
|
| 119 | + |
|
| 120 | + $scores = Database::query($sql); |
|
| 121 | + // for 1 student |
|
| 122 | + if (isset($stud_id)) { |
|
| 123 | + if ($data = Database::fetch_assoc($scores)) { |
|
| 124 | + return array ($data['progress'], 100); |
|
| 125 | + } else |
|
| 126 | + return null; |
|
| 127 | + } else { |
|
| 128 | + // all students -> get average |
|
| 129 | + $students = array(); // user list, needed to make sure we only |
|
| 130 | + // take first attempts into account |
|
| 131 | + $rescount = 0; |
|
| 132 | + $sum = 0; |
|
| 133 | + $bestResult = 0; |
|
| 134 | + $sumResult = 0; |
|
| 135 | + while ($data = Database::fetch_array($scores)) { |
|
| 136 | + if (!(array_key_exists($data['user_id'], $students))) { |
|
| 137 | + $students[$data['user_id']] = $data['progress']; |
|
| 138 | + $rescount++; |
|
| 139 | + $sum += $data['progress'] / 100; |
|
| 140 | + $sumResult += $data['progress']; |
|
| 141 | + |
|
| 142 | + if ($data['progress'] > $bestResult) { |
|
| 143 | + $bestResult = $data['progress']; |
|
| 144 | + } |
|
| 145 | + } |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + if ($rescount == 0) { |
|
| 149 | + return null; |
|
| 150 | + } else { |
|
| 151 | + |
|
| 152 | + switch ($type) { |
|
| 153 | + case 'best': |
|
| 154 | + return array($bestResult, 100); |
|
| 155 | + break; |
|
| 156 | + case 'average': |
|
| 157 | + return array($sumResult/$rescount, 100); |
|
| 158 | + break; |
|
| 159 | + case 'ranking': |
|
| 160 | + return AbstractLink::getCurrentUserRanking($stud_id, $students); |
|
| 161 | + break; |
|
| 162 | + default: |
|
| 163 | + return array($sum, $rescount); |
|
| 164 | + break; |
|
| 165 | + } |
|
| 166 | + } |
|
| 167 | + } |
|
| 168 | + } |
|
| 169 | + |
|
| 170 | + /** |
|
| 171 | + * Get URL where to go to if the user clicks on the link. |
|
| 172 | + */ |
|
| 173 | + public function get_link() |
|
| 174 | + { |
|
| 175 | + $session_id = api_get_session_id(); |
|
| 176 | + $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq_params($this->get_course_code(), $session_id).'&gradebook=view'; |
|
| 177 | + |
|
| 178 | + if (!api_is_allowed_to_edit() || $this->calc_score(api_get_user_id()) == null) { |
|
| 179 | + $url .= '&action=view&lp_id='.$this->get_ref_id(); |
|
| 180 | + } else { |
|
| 181 | + $url .= '&action=build&lp_id='.$this->get_ref_id(); |
|
| 182 | + } |
|
| 183 | + return $url; |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * Get name to display: same as learnpath title |
|
| 188 | + */ |
|
| 189 | + public function get_name() |
|
| 190 | + { |
|
| 191 | + $data = $this->get_learnpath_data(); |
|
| 192 | + return $data['name']; |
|
| 193 | + } |
|
| 194 | + |
|
| 195 | + /** |
|
| 196 | + * Get description to display: same as learnpath description |
|
| 197 | + */ |
|
| 198 | + public function get_description() |
|
| 199 | + { |
|
| 200 | + $data = $this->get_learnpath_data(); |
|
| 201 | + return $data['description']; |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + /** |
|
| 205 | + * Check if this still links to a learnpath |
|
| 206 | + */ |
|
| 207 | + public function is_valid_link() { |
|
| 208 | + $sql = 'SELECT count(id) FROM '.$this->get_learnpath_table().' |
|
| 209 | 209 | WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' '; |
| 210 | - $result = Database::query($sql); |
|
| 211 | - $number = Database::fetch_row($result,'NUM'); |
|
| 212 | - return ($number[0] != 0); |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - public function get_type_name() |
|
| 216 | - { |
|
| 217 | - return get_lang('LearningPaths'); |
|
| 218 | - } |
|
| 219 | - |
|
| 220 | - public function needs_name_and_description() |
|
| 221 | - { |
|
| 222 | - return false; |
|
| 223 | - } |
|
| 224 | - |
|
| 225 | - public function needs_max() |
|
| 226 | - { |
|
| 227 | - return false; |
|
| 228 | - } |
|
| 229 | - |
|
| 230 | - public function needs_results() |
|
| 231 | - { |
|
| 232 | - return false; |
|
| 233 | - } |
|
| 234 | - |
|
| 235 | - public function is_allowed_to_change_name() |
|
| 236 | - { |
|
| 237 | - return false; |
|
| 238 | - } |
|
| 239 | - |
|
| 240 | - // INTERNAL FUNCTIONS |
|
| 241 | - |
|
| 242 | - /** |
|
| 243 | - * Lazy load function to get the database table of the learnpath |
|
| 244 | - */ |
|
| 245 | - private function get_learnpath_table() |
|
| 246 | - { |
|
| 247 | - $this->learnpath_table = Database :: get_course_table(TABLE_LP_MAIN); |
|
| 248 | - return $this->learnpath_table; |
|
| 249 | - } |
|
| 250 | - |
|
| 251 | - /** |
|
| 252 | - * Lazy load function to get the database contents of this learnpath |
|
| 253 | - */ |
|
| 254 | - private function get_learnpath_data() |
|
| 255 | - { |
|
| 256 | - if (!isset($this->learnpath_data)) { |
|
| 257 | - $sql = 'SELECT * FROM '.$this->get_learnpath_table().' |
|
| 210 | + $result = Database::query($sql); |
|
| 211 | + $number = Database::fetch_row($result,'NUM'); |
|
| 212 | + return ($number[0] != 0); |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + public function get_type_name() |
|
| 216 | + { |
|
| 217 | + return get_lang('LearningPaths'); |
|
| 218 | + } |
|
| 219 | + |
|
| 220 | + public function needs_name_and_description() |
|
| 221 | + { |
|
| 222 | + return false; |
|
| 223 | + } |
|
| 224 | + |
|
| 225 | + public function needs_max() |
|
| 226 | + { |
|
| 227 | + return false; |
|
| 228 | + } |
|
| 229 | + |
|
| 230 | + public function needs_results() |
|
| 231 | + { |
|
| 232 | + return false; |
|
| 233 | + } |
|
| 234 | + |
|
| 235 | + public function is_allowed_to_change_name() |
|
| 236 | + { |
|
| 237 | + return false; |
|
| 238 | + } |
|
| 239 | + |
|
| 240 | + // INTERNAL FUNCTIONS |
|
| 241 | + |
|
| 242 | + /** |
|
| 243 | + * Lazy load function to get the database table of the learnpath |
|
| 244 | + */ |
|
| 245 | + private function get_learnpath_table() |
|
| 246 | + { |
|
| 247 | + $this->learnpath_table = Database :: get_course_table(TABLE_LP_MAIN); |
|
| 248 | + return $this->learnpath_table; |
|
| 249 | + } |
|
| 250 | + |
|
| 251 | + /** |
|
| 252 | + * Lazy load function to get the database contents of this learnpath |
|
| 253 | + */ |
|
| 254 | + private function get_learnpath_data() |
|
| 255 | + { |
|
| 256 | + if (!isset($this->learnpath_data)) { |
|
| 257 | + $sql = 'SELECT * FROM '.$this->get_learnpath_table().' |
|
| 258 | 258 | WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' '; |
| 259 | - $result = Database::query($sql); |
|
| 260 | - $this->learnpath_data = Database::fetch_array($result); |
|
| 261 | - } |
|
| 262 | - return $this->learnpath_data; |
|
| 263 | - } |
|
| 264 | - |
|
| 265 | - public function get_icon_name() |
|
| 266 | - { |
|
| 267 | - return 'learnpath'; |
|
| 268 | - } |
|
| 259 | + $result = Database::query($sql); |
|
| 260 | + $this->learnpath_data = Database::fetch_array($result); |
|
| 261 | + } |
|
| 262 | + return $this->learnpath_data; |
|
| 263 | + } |
|
| 264 | + |
|
| 265 | + public function get_icon_name() |
|
| 266 | + { |
|
| 267 | + return 'learnpath'; |
|
| 268 | + } |
|
| 269 | 269 | } |
@@ -32,6 +32,8 @@ discard block |
||
| 32 | 32 | * @param array $evals |
| 33 | 33 | * @param array $links |
| 34 | 34 | * @param null $addparams |
| 35 | + * @param boolean $showTeacherView |
|
| 36 | + * @param integer $userId |
|
| 35 | 37 | */ |
| 36 | 38 | public function __construct( |
| 37 | 39 | $currentcat, |
@@ -895,7 +897,7 @@ discard block |
||
| 895 | 897 | |
| 896 | 898 | /** |
| 897 | 899 | * @param $item |
| 898 | - * @return mixed |
|
| 900 | + * @return string|null |
|
| 899 | 901 | */ |
| 900 | 902 | private function build_course_code($item) |
| 901 | 903 | { |
@@ -9,7 +9,6 @@ |
||
| 9 | 9 | { |
| 10 | 10 | /** |
| 11 | 11 | * @param $value array Uploaded file info (from $_FILES) |
| 12 | - * @param null $options |
|
| 13 | 12 | * @return bool |
| 14 | 13 | */ |
| 15 | 14 | public function validate($elementValue, $maxSize) |
@@ -7,22 +7,22 @@ |
||
| 7 | 7 | */ |
| 8 | 8 | class HTML_QuickForm_Rule_MaxFileSize extends HTML_QuickForm_Rule |
| 9 | 9 | { |
| 10 | - /** |
|
| 11 | - * @param $value array Uploaded file info (from $_FILES) |
|
| 12 | - * @param null $options |
|
| 13 | - * @return bool |
|
| 14 | - */ |
|
| 15 | - public function validate($elementValue, $maxSize) |
|
| 16 | - { |
|
| 17 | - if (!empty($elementValue['error']) && |
|
| 18 | - (UPLOAD_ERR_FORM_SIZE == $elementValue['error'] || UPLOAD_ERR_INI_SIZE == $elementValue['error']) |
|
| 19 | - ) { |
|
| 20 | - return false; |
|
| 21 | - } |
|
| 22 | - if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) { |
|
| 23 | - return true; |
|
| 24 | - } |
|
| 10 | + /** |
|
| 11 | + * @param $value array Uploaded file info (from $_FILES) |
|
| 12 | + * @param null $options |
|
| 13 | + * @return bool |
|
| 14 | + */ |
|
| 15 | + public function validate($elementValue, $maxSize) |
|
| 16 | + { |
|
| 17 | + if (!empty($elementValue['error']) && |
|
| 18 | + (UPLOAD_ERR_FORM_SIZE == $elementValue['error'] || UPLOAD_ERR_INI_SIZE == $elementValue['error']) |
|
| 19 | + ) { |
|
| 20 | + return false; |
|
| 21 | + } |
|
| 22 | + if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) { |
|
| 23 | + return true; |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - return ($maxSize >= @filesize($elementValue['tmp_name'])); |
|
| 27 | - } |
|
| 26 | + return ($maxSize >= @filesize($elementValue['tmp_name'])); |
|
| 27 | + } |
|
| 28 | 28 | } |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | * |
| 17 | 17 | * @param string Mobile phone number to be validated |
| 18 | 18 | * @param string Not using it. Just to respect the declaration |
| 19 | - * @return boolean Returns true if valid, false otherwise. |
|
| 19 | + * @return integer Returns true if valid, false otherwise. |
|
| 20 | 20 | */ |
| 21 | 21 | function validate($mobilePhoneNumber, $options = null) |
| 22 | 22 | { |
@@ -138,7 +138,7 @@ |
||
| 138 | 138 | |
| 139 | 139 | /** |
| 140 | 140 | * Return a list an associative array where keys are the active hook observer class name |
| 141 | - * @param $eventName |
|
| 141 | + * @param string $eventName |
|
| 142 | 142 | * |
| 143 | 143 | * @return array |
| 144 | 144 | */ |
@@ -266,6 +266,7 @@ discard block |
||
| 266 | 266 | * @global bool $is_platformAdmin |
| 267 | 267 | * @global bool $is_allowedCreateCourse |
| 268 | 268 | * @global object $_user |
| 269 | + * @param boolean $reset |
|
| 269 | 270 | */ |
| 270 | 271 | public static function init_user($user_id, $reset) |
| 271 | 272 | { |
@@ -355,7 +356,7 @@ discard block |
||
| 355 | 356 | * @global type $is_allowed_in_course |
| 356 | 357 | * |
| 357 | 358 | * @param type $course_id |
| 358 | - * @param type $reset |
|
| 359 | + * @param boolean $reset |
|
| 359 | 360 | */ |
| 360 | 361 | static function init_course($course_id, $reset) |
| 361 | 362 | { |
@@ -852,14 +852,14 @@ discard block |
||
| 852 | 852 | $email = false; |
| 853 | 853 | } |
| 854 | 854 | |
| 855 | - if ($email) { |
|
| 856 | - $condition = "LOWER(email) = '".Database::escape_string($username)."' "; |
|
| 857 | - } else { |
|
| 855 | + if ($email) { |
|
| 856 | + $condition = "LOWER(email) = '".Database::escape_string($username)."' "; |
|
| 857 | + } else { |
|
| 858 | 858 | $condition = "LOWER(username) = '".Database::escape_string($username)."'"; |
| 859 | 859 | } |
| 860 | 860 | |
| 861 | - $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
| 862 | - $query = "SELECT |
|
| 861 | + $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
| 862 | + $query = "SELECT |
|
| 863 | 863 | user_id AS uid, |
| 864 | 864 | lastname AS lastName, |
| 865 | 865 | firstname AS firstName, |
@@ -874,7 +874,7 @@ discard block |
||
| 874 | 874 | auth_source |
| 875 | 875 | FROM $tbl_user |
| 876 | 876 | WHERE ( $condition AND active = 1) "; |
| 877 | - $result = Database::query($query); |
|
| 877 | + $result = Database::query($query); |
|
| 878 | 878 | $num_rows = Database::num_rows($result); |
| 879 | 879 | if ($result && $num_rows > 0) { |
| 880 | 880 | return Database::fetch_assoc($result); |