@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | |
44 | 44 | $result = Database::query($sql); |
45 | 45 | |
46 | - $cats=array(); |
|
47 | - while ($data=Database::fetch_array($result)) { |
|
48 | - $cats[] = array ($data['id'], $data['name']); |
|
46 | + $cats = array(); |
|
47 | + while ($data = Database::fetch_array($result)) { |
|
48 | + $cats[] = array($data['id'], $data['name']); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $cats; |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | $result = Database::query($sql); |
73 | 73 | |
74 | 74 | $cats = array(); |
75 | - while ($data=Database::fetch_array($result)) { |
|
76 | - $cats[] = array ($data['id'], $data['name']); |
|
75 | + while ($data = Database::fetch_array($result)) { |
|
76 | + $cats[] = array($data['id'], $data['name']); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | return $cats; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 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 | 91 | $result = Database::query($sql); |
92 | - $number = Database::fetch_array($result,'NUM'); |
|
92 | + $number = Database::fetch_array($result, 'NUM'); |
|
93 | 93 | return ($number[0] != 0); |
94 | 94 | } |
95 | 95 | |
@@ -121,12 +121,12 @@ discard block |
||
121 | 121 | // for 1 student |
122 | 122 | if (isset($stud_id)) { |
123 | 123 | if ($data = Database::fetch_array($scores)) { |
124 | - return array ($data['progress'], 100); |
|
124 | + return array($data['progress'], 100); |
|
125 | 125 | } else |
126 | 126 | return null; |
127 | 127 | } else { |
128 | 128 | // all students -> get average |
129 | - $students = array(); // user list, needed to make sure we only |
|
129 | + $students = array(); // user list, needed to make sure we only |
|
130 | 130 | // take first attempts into account |
131 | 131 | $rescount = 0; |
132 | 132 | $sum = 0; |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | return array($bestResult, 100); |
155 | 155 | break; |
156 | 156 | case 'average': |
157 | - return array($sumResult/$rescount, 100); |
|
157 | + return array($sumResult / $rescount, 100); |
|
158 | 158 | break; |
159 | 159 | case 'ranking': |
160 | 160 | return AbstractLink::getCurrentUserRanking($stud_id, $students); |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $sql = 'SELECT count(id) FROM '.$this->get_learnpath_table().' |
208 | 208 | WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' '; |
209 | 209 | $result = Database::query($sql); |
210 | - $number = Database::fetch_row($result,'NUM'); |
|
210 | + $number = Database::fetch_row($result, 'NUM'); |
|
211 | 211 | return ($number[0] != 0); |
212 | 212 | } |
213 | 213 |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | * @param string $name_mask search string |
59 | 59 | * @return array link objects matching the search criterium |
60 | 60 | */ |
61 | - public function find_links($name_mask,$selectcat) |
|
61 | + public function find_links($name_mask, $selectcat) |
|
62 | 62 | { |
63 | 63 | return AbstractLink::find_links($name_mask, $selectcat); |
64 | 64 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | public static function get_all_types() |
99 | 99 | { |
100 | 100 | //LINK_DROPBOX, |
101 | - return array ( |
|
101 | + return array( |
|
102 | 102 | LINK_EXERCISE, |
103 | 103 | //LINK_DROPBOX, |
104 | 104 | LINK_HOTPOTATOES, |
@@ -84,8 +84,8 @@ discard block |
||
84 | 84 | die('Error in get_not_created_links() : course code not set'); |
85 | 85 | } |
86 | 86 | |
87 | - $tbl_grade_links = Database :: get_course_table(TABLE_FORUM_THREAD); |
|
88 | - $tbl_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
87 | + $tbl_grade_links = Database :: get_course_table(TABLE_FORUM_THREAD); |
|
88 | + $tbl_item_property = Database :: get_course_table(TABLE_ITEM_PROPERTY); |
|
89 | 89 | $session_id = api_get_session_id(); |
90 | 90 | |
91 | 91 | if ($session_id) { |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | $result = Database::query($sql); |
109 | 109 | |
110 | 110 | while ($data = Database::fetch_array($result)) { |
111 | - if ( isset($data['thread_title_qualify']) and $data['thread_title_qualify']!=""){ |
|
112 | - $cats[] = array ($data['thread_id'], $data['thread_title_qualify']); |
|
111 | + if (isset($data['thread_title_qualify']) and $data['thread_title_qualify'] != "") { |
|
112 | + $cats[] = array($data['thread_id'], $data['thread_title_qualify']); |
|
113 | 113 | } else { |
114 | - $cats[] = array ($data['thread_id'], $data['thread_title']); |
|
114 | + $cats[] = array($data['thread_id'], $data['thread_title']); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | $my_cats = isset($cats) ? $cats : null; |
@@ -193,11 +193,11 @@ discard block |
||
193 | 193 | if (empty($counter) || $counter <= 2) { |
194 | 194 | return array(0, $assignment['thread_qualify_max']); |
195 | 195 | } |
196 | - return [$score/$counter, $assignment['thread_qualify_max']]; |
|
196 | + return [$score / $counter, $assignment['thread_qualify_max']]; |
|
197 | 197 | } |
198 | 198 | } else { |
199 | 199 | // All students -> get average |
200 | - $students = array(); // user list, needed to make sure we only |
|
200 | + $students = array(); // user list, needed to make sure we only |
|
201 | 201 | // take first attempts into account |
202 | 202 | $counter = 0; |
203 | 203 | $sum = 0; |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | return array($bestResult, $weight); |
229 | 229 | break; |
230 | 230 | case 'average': |
231 | - return array($sumResult/$counter, $weight); |
|
231 | + return array($sumResult / $counter, $weight); |
|
232 | 232 | break; |
233 | 233 | case 'ranking': |
234 | 234 | return AbstractLink::getCurrentUserRanking($stud_id, $students); |
@@ -270,9 +270,9 @@ discard block |
||
270 | 270 | public function get_name() |
271 | 271 | { |
272 | 272 | $this->get_exercise_data(); |
273 | - $thread_title=isset($this->exercise_data['thread_title']) ? $this->exercise_data['thread_title'] : ''; |
|
274 | - $thread_title_qualify=isset($this->exercise_data['thread_title_qualify']) ? $this->exercise_data['thread_title_qualify'] : ''; |
|
275 | - if ( isset($thread_title_qualify) && $thread_title_qualify!="") { |
|
273 | + $thread_title = isset($this->exercise_data['thread_title']) ? $this->exercise_data['thread_title'] : ''; |
|
274 | + $thread_title_qualify = isset($this->exercise_data['thread_title_qualify']) ? $this->exercise_data['thread_title_qualify'] : ''; |
|
275 | + if (isset($thread_title_qualify) && $thread_title_qualify != "") { |
|
276 | 276 | return $this->exercise_data['thread_title_qualify']; |
277 | 277 | } else { |
278 | 278 | return $thread_title; |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | */ |
285 | 285 | public function get_description() |
286 | 286 | { |
287 | - return '';//$this->exercise_data['description']; |
|
287 | + return ''; //$this->exercise_data['description']; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | /** |
@@ -310,8 +310,8 @@ discard block |
||
310 | 310 | $sql = 'SELECT * FROM '.$this->get_forum_thread_table()." |
311 | 311 | WHERE c_id = '.$this->course_id.' AND thread_id = '".$this->get_ref_id()."' AND session_id = ".api_get_session_id().""; |
312 | 312 | $result = Database::query($sql); |
313 | - $row = Database::fetch_array($result,'ASSOC'); |
|
314 | - $forum_id=$row['forum_id']; |
|
313 | + $row = Database::fetch_array($result, 'ASSOC'); |
|
314 | + $forum_id = $row['forum_id']; |
|
315 | 315 | |
316 | 316 | $url = api_get_path(WEB_PATH).'main/forum/viewthread.php?cidReq='.$this->get_course_code().'&thread='.$this->get_ref_id().'&gradebook=view&forum='.$forum_id; |
317 | 317 | return $url; |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | |
343 | 343 | function save_linked_data() |
344 | 344 | { |
345 | - $weight = (float)$this->get_weight(); |
|
345 | + $weight = (float) $this->get_weight(); |
|
346 | 346 | $ref_id = $this->get_ref_id(); |
347 | 347 | |
348 | 348 | if (!empty($ref_id)) { |
@@ -90,23 +90,23 @@ discard block |
||
90 | 90 | if (is_null($id) && is_null($user_id) && !is_null($evaluation_id)) { |
91 | 91 | // Verified_if_exist_evaluation |
92 | 92 | $sql = 'SELECT COUNT(*) AS count |
93 | - FROM ' . $tbl_grade_results . ' |
|
94 | - WHERE evaluation_id="' . Database::escape_string($evaluation_id) . '";'; |
|
93 | + FROM ' . $tbl_grade_results.' |
|
94 | + WHERE evaluation_id="' . Database::escape_string($evaluation_id).'";'; |
|
95 | 95 | $result = Database::query($sql); |
96 | 96 | $existEvaluation = Database::result($result, 0, 0); |
97 | 97 | |
98 | 98 | if ($existEvaluation != 0) { |
99 | 99 | if ($sessionId) { |
100 | 100 | $sql = 'SELECT c_id, user_id as user_id, status |
101 | - FROM ' . $tbl_session_rel_course_user . ' |
|
101 | + FROM ' . $tbl_session_rel_course_user.' |
|
102 | 102 | WHERE |
103 | 103 | status= 0 AND |
104 | - c_id = "' . api_get_course_int_id() . '" AND |
|
104 | + c_id = "' . api_get_course_int_id().'" AND |
|
105 | 105 | session_id = ' . $sessionId; |
106 | 106 | } else { |
107 | 107 | $sql = 'SELECT c_id, user_id, status |
108 | - FROM ' . $tbl_course_rel_course . ' |
|
109 | - WHERE status ="' . STUDENT . '" AND c_id = "' . api_get_course_int_id() . '" '; |
|
108 | + FROM ' . $tbl_course_rel_course.' |
|
109 | + WHERE status ="' . STUDENT.'" AND c_id = "'.api_get_course_int_id().'" '; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | $res_course_rel_user = Database::query($sql); |
@@ -116,15 +116,15 @@ discard block |
||
116 | 116 | $current_date = api_get_utc_datetime(); |
117 | 117 | for ($i = 0; $i < count($list_user_course_list); $i++) { |
118 | 118 | $sql_verified = 'SELECT COUNT(*) AS count |
119 | - FROM ' . $tbl_grade_results . ' |
|
119 | + FROM ' . $tbl_grade_results.' |
|
120 | 120 | WHERE |
121 | - user_id="' . intval($list_user_course_list[$i]['user_id']) . '" AND |
|
122 | - evaluation_id="' . intval($evaluation_id) . '";'; |
|
121 | + user_id="' . intval($list_user_course_list[$i]['user_id']).'" AND |
|
122 | + evaluation_id="' . intval($evaluation_id).'";'; |
|
123 | 123 | $res_verified = Database::query($sql_verified); |
124 | 124 | $info_verified = Database::result($res_verified, 0, 0); |
125 | 125 | if ($info_verified == 0) { |
126 | - $sql_insert = 'INSERT INTO ' . $tbl_grade_results . '(user_id,evaluation_id,created_at,score) |
|
127 | - VALUES ("' . intval($list_user_course_list[$i]['user_id']) . '","' . intval($evaluation_id) . '","' . $current_date . '",0);'; |
|
126 | + $sql_insert = 'INSERT INTO '.$tbl_grade_results.'(user_id,evaluation_id,created_at,score) |
|
127 | + VALUES ("' . intval($list_user_course_list[$i]['user_id']).'","'.intval($evaluation_id).'","'.$current_date.'",0);'; |
|
128 | 128 | Database::query($sql_insert); |
129 | 129 | } |
130 | 130 | } |
@@ -148,16 +148,16 @@ discard block |
||
148 | 148 | |
149 | 149 | $paramcount = 0; |
150 | 150 | if (!empty($id)) { |
151 | - $sql.= ' WHERE gr.id = ' . intval($id); |
|
152 | - $paramcount ++; |
|
151 | + $sql .= ' WHERE gr.id = '.intval($id); |
|
152 | + $paramcount++; |
|
153 | 153 | } |
154 | 154 | if (!empty($user_id)) { |
155 | 155 | if ($paramcount != 0) |
156 | 156 | $sql .= ' AND'; |
157 | 157 | else |
158 | 158 | $sql .= ' WHERE'; |
159 | - $sql .= ' gr.user_id = ' . intval($user_id); |
|
160 | - $paramcount ++; |
|
159 | + $sql .= ' gr.user_id = '.intval($user_id); |
|
160 | + $paramcount++; |
|
161 | 161 | } |
162 | 162 | if (!empty($evaluation_id)) { |
163 | 163 | if ($paramcount != 0) { |
@@ -165,8 +165,8 @@ discard block |
||
165 | 165 | } else { |
166 | 166 | $sql .= ' WHERE'; |
167 | 167 | } |
168 | - $sql .= ' gr.evaluation_id = ' . intval($evaluation_id); |
|
169 | - $paramcount ++; |
|
168 | + $sql .= ' gr.evaluation_id = '.intval($evaluation_id); |
|
169 | + $paramcount++; |
|
170 | 170 | } |
171 | 171 | $sql .= ' ORDER BY u.lastname, u.firstname'; |
172 | 172 | $result = Database::query($sql); |
@@ -191,17 +191,17 @@ discard block |
||
191 | 191 | { |
192 | 192 | if (isset($this->user_id) && isset($this->evaluation)) { |
193 | 193 | $tbl_grade_results = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_RESULT); |
194 | - $sql = "INSERT INTO " . $tbl_grade_results |
|
194 | + $sql = "INSERT INTO ".$tbl_grade_results |
|
195 | 195 | . " (user_id, evaluation_id, |
196 | 196 | created_at"; |
197 | 197 | if (isset($this->score)) { |
198 | 198 | $sql .= ",score"; |
199 | 199 | } |
200 | 200 | $sql .= ") VALUES |
201 | - (" . (int) $this->get_user_id() . ", " . (int) $this->get_evaluation_id() |
|
202 | - . ", '" . $this->get_date() . "' "; |
|
201 | + (" . (int) $this->get_user_id().", ".(int) $this->get_evaluation_id() |
|
202 | + . ", '".$this->get_date()."' "; |
|
203 | 203 | if (isset($this->score)) { |
204 | - $sql .= ", " . $this->get_score(); |
|
204 | + $sql .= ", ".$this->get_score(); |
|
205 | 205 | } |
206 | 206 | $sql .= ")"; |
207 | 207 | Database::query($sql); |
@@ -222,16 +222,16 @@ discard block |
||
222 | 222 | $arr_result = $result->load(null, $userid, $evaluationid); |
223 | 223 | $arr = get_object_vars($arr_result[0]); |
224 | 224 | |
225 | - $sql = 'INSERT INTO ' . $tbl_grade_results_log |
|
225 | + $sql = 'INSERT INTO '.$tbl_grade_results_log |
|
226 | 226 | . ' (id_result,user_id, evaluation_id,created_at'; |
227 | 227 | if (isset($arr['score'])) { |
228 | 228 | $sql .= ',score'; |
229 | 229 | } |
230 | 230 | $sql .= ') VALUES |
231 | - (' . (int) $arr['id'] . ',' . (int) $arr['user_id'] . ', ' . (int) $arr['evaluation'] |
|
232 | - . ", '" . api_get_utc_datetime() . "'"; |
|
231 | + (' . (int) $arr['id'].','.(int) $arr['user_id'].', '.(int) $arr['evaluation'] |
|
232 | + . ", '".api_get_utc_datetime()."'"; |
|
233 | 233 | if (isset($arr['score'])) { |
234 | - $sql .= ', ' . $arr['score']; |
|
234 | + $sql .= ', '.$arr['score']; |
|
235 | 235 | } |
236 | 236 | $sql .= ')'; |
237 | 237 | |
@@ -247,16 +247,16 @@ discard block |
||
247 | 247 | public function save() |
248 | 248 | { |
249 | 249 | $tbl_grade_results = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_RESULT); |
250 | - $sql = 'UPDATE ' . $tbl_grade_results . ' |
|
250 | + $sql = 'UPDATE '.$tbl_grade_results.' |
|
251 | 251 | SET user_id = ' . $this->get_user_id() |
252 | - . ', evaluation_id = ' . $this->get_evaluation_id() |
|
252 | + . ', evaluation_id = '.$this->get_evaluation_id() |
|
253 | 253 | . ', score = '; |
254 | 254 | if (isset($this->score)) { |
255 | 255 | $sql .= $this->get_score(); |
256 | 256 | } else { |
257 | 257 | $sql .= 'null'; |
258 | 258 | } |
259 | - $sql .= ' WHERE id = ' . $this->id; |
|
259 | + $sql .= ' WHERE id = '.$this->id; |
|
260 | 260 | // no need to update creation date |
261 | 261 | Database::query($sql); |
262 | 262 | } |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | public function delete() |
268 | 268 | { |
269 | 269 | $tbl_grade_results = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_RESULT); |
270 | - $sql = 'DELETE FROM ' . $tbl_grade_results . ' WHERE id = ' . $this->id; |
|
270 | + $sql = 'DELETE FROM '.$tbl_grade_results.' WHERE id = '.$this->id; |
|
271 | 271 | Database::query($sql); |
272 | 272 | } |
273 | 273 | } |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | |
85 | 85 | $result = Database::query($sql); |
86 | 86 | |
87 | - $cats=array(); |
|
88 | - while ($data=Database::fetch_array($result)) { |
|
89 | - $cats[] = array ($data['id'], $data['url']); |
|
87 | + $cats = array(); |
|
88 | + while ($data = Database::fetch_array($result)) { |
|
89 | + $cats[] = array($data['id'], $data['url']); |
|
90 | 90 | } |
91 | 91 | return $cats; |
92 | 92 | } |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | if (empty($work_name)) { |
128 | 128 | $work_name = basename($data['url']); |
129 | 129 | } |
130 | - $cats[] = array ($data['id'], $work_name); |
|
130 | + $cats[] = array($data['id'], $work_name); |
|
131 | 131 | } |
132 | - $cats=isset($cats) ? $cats : array(); |
|
132 | + $cats = isset($cats) ? $cats : array(); |
|
133 | 133 | return $cats; |
134 | 134 | } |
135 | 135 | |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | c_id = '.$this->course_id.' AND |
179 | 179 | active = 1 AND |
180 | 180 | parent_id = "'.$parentId.'" AND |
181 | - session_id = '.api_get_session_id() .' AND |
|
181 | + session_id = '.api_get_session_id().' AND |
|
182 | 182 | qualificator_id <> 0 |
183 | 183 | '; |
184 | 184 | if (!empty($stud_id)) { |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | return ''; |
213 | 213 | } |
214 | 214 | } else { |
215 | - $students = array(); // user list, needed to make sure we only |
|
215 | + $students = array(); // user list, needed to make sure we only |
|
216 | 216 | // take first attempts into account |
217 | 217 | $rescount = 0; |
218 | 218 | $sum = 0; |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | return array($bestResult, $weight); |
246 | 246 | break; |
247 | 247 | case 'average': |
248 | - return array($sumResult/$rescount, $weight); |
|
248 | + return array($sumResult / $rescount, $weight); |
|
249 | 249 | break; |
250 | 250 | case 'ranking': |
251 | 251 | return AbstractLink::getCurrentUserRanking($stud_id, $students); |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | { |
308 | 308 | $tbl_name = $this->get_studpub_table(); |
309 | 309 | $course_info = api_get_course_info($this->get_course_code()); |
310 | - if ($tbl_name=='') { |
|
310 | + if ($tbl_name == '') { |
|
311 | 311 | return false; |
312 | 312 | } elseif (!isset($this->exercise_data)) { |
313 | 313 | $sql = 'SELECT * FROM '.$this->get_studpub_table()." |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | |
347 | 347 | public function save_linked_data() |
348 | 348 | { |
349 | - $weight = (float)$this->get_weight(); |
|
349 | + $weight = (float) $this->get_weight(); |
|
350 | 350 | $ref_id = $this->get_ref_id(); |
351 | 351 | |
352 | 352 | if (!empty($ref_id)) { |
@@ -223,36 +223,36 @@ discard block |
||
223 | 223 | $paramcount = 0; |
224 | 224 | |
225 | 225 | if (isset ($id)) { |
226 | - $sql.= ' WHERE id = '.intval($id); |
|
227 | - $paramcount ++; |
|
226 | + $sql .= ' WHERE id = '.intval($id); |
|
227 | + $paramcount++; |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | if (isset ($user_id)) { |
231 | 231 | if ($paramcount != 0) $sql .= ' AND'; |
232 | 232 | else $sql .= ' WHERE'; |
233 | 233 | $sql .= ' user_id = '.intval($user_id); |
234 | - $paramcount ++; |
|
234 | + $paramcount++; |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | if (isset ($course_code) && $course_code <> '-1') { |
238 | 238 | if ($paramcount != 0) $sql .= ' AND'; |
239 | 239 | else $sql .= ' WHERE'; |
240 | 240 | $sql .= " course_code = '".Database::escape_string($course_code)."'"; |
241 | - $paramcount ++; |
|
241 | + $paramcount++; |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | if (isset ($category_id)) { |
245 | 245 | if ($paramcount != 0) $sql .= ' AND'; |
246 | 246 | else $sql .= ' WHERE'; |
247 | 247 | $sql .= ' category_id = '.intval($category_id); |
248 | - $paramcount ++; |
|
248 | + $paramcount++; |
|
249 | 249 | } |
250 | 250 | |
251 | 251 | if (isset ($visible)) { |
252 | 252 | if ($paramcount != 0) $sql .= ' AND'; |
253 | 253 | else $sql .= ' WHERE'; |
254 | 254 | $sql .= ' visible = '.intval($visible); |
255 | - $paramcount ++; |
|
255 | + $paramcount++; |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | if (isset ($locked)) { |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $alleval = array(); |
279 | 279 | if (Database::num_rows($result)) { |
280 | 280 | while ($data = Database::fetch_array($result)) { |
281 | - $eval= new Evaluation(); |
|
281 | + $eval = new Evaluation(); |
|
282 | 282 | $eval->set_id($data['id']); |
283 | 283 | $eval->set_name($data['name']); |
284 | 284 | $eval->set_description($data['description']); |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | $tbl_grade_evaluations = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION); |
364 | 364 | $tbl_grade_linkeval_log = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG); |
365 | 365 | $eval = new Evaluation(); |
366 | - $dateobject = $eval->load($idevaluation,null,null,null,null); |
|
366 | + $dateobject = $eval->load($idevaluation, null, null, null, null); |
|
367 | 367 | $arreval = get_object_vars($dateobject[0]); |
368 | 368 | if (!empty($arreval['id'])) { |
369 | 369 | $sql = 'SELECT weight from '.$tbl_grade_evaluations.' |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | .', description = '; |
398 | 398 | if (isset($this->description)) { |
399 | 399 | $sql .= "'".Database::escape_string($this->get_description())."'"; |
400 | - }else { |
|
400 | + } else { |
|
401 | 401 | $sql .= 'null'; |
402 | 402 | } |
403 | 403 | $sql .= ', user_id = '.intval($this->get_user_id()) |
@@ -468,17 +468,17 @@ discard block |
||
468 | 468 | $sql .= ' AND user_id = '.api_get_user_id(); |
469 | 469 | } |
470 | 470 | |
471 | - }else { |
|
471 | + } else { |
|
472 | 472 | $sql .= ' AND user_id = '.api_get_user_id(); |
473 | 473 | } |
474 | 474 | |
475 | 475 | if (!isset ($parent)) { |
476 | - $sql.= ' AND category_id is null'; |
|
476 | + $sql .= ' AND category_id is null'; |
|
477 | 477 | } else { |
478 | - $sql.= ' AND category_id = '.intval($parent); |
|
478 | + $sql .= ' AND category_id = '.intval($parent); |
|
479 | 479 | } |
480 | 480 | $result = Database::query($sql); |
481 | - $number=Database::fetch_row($result); |
|
481 | + $number = Database::fetch_row($result); |
|
482 | 482 | |
483 | 483 | return $number[0] != 0; |
484 | 484 | } |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | FROM '.$tbl_grade_results.' |
495 | 495 | WHERE evaluation_id = '.intval($this->id); |
496 | 496 | $result = Database::query($sql); |
497 | - $number=Database::fetch_row($result); |
|
497 | + $number = Database::fetch_row($result); |
|
498 | 498 | |
499 | 499 | return ($number[0] != 0); |
500 | 500 | } |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | $results = isset($data[$key]) ? $data[$key] : null; |
545 | 545 | |
546 | 546 | if ($useSession == false) { |
547 | - $results = null; |
|
547 | + $results = null; |
|
548 | 548 | } |
549 | 549 | if (empty($results)) { |
550 | 550 | $results = Result::load(null, $stud_id, $this->id); |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | $data = Session::read('calc_score'); |
571 | 571 | $allResults = isset($data[$key]) ? $data[$key] : null; |
572 | 572 | if ($useSession == false) { |
573 | - $allResults = null; |
|
573 | + $allResults = null; |
|
574 | 574 | } |
575 | 575 | if (empty($allResults)) { |
576 | 576 | $allResults = Result::load(null, null, $this->id); |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | return array($bestResult, $weight); |
603 | 603 | break; |
604 | 604 | case 'average': |
605 | - return array($sumResult/$count, $weight); |
|
605 | + return array($sumResult / $count, $weight); |
|
606 | 606 | break; |
607 | 607 | case 'ranking': |
608 | 608 | $students = array(); |
@@ -640,17 +640,17 @@ discard block |
||
640 | 640 | $targets[] = $root; |
641 | 641 | |
642 | 642 | if (isset($this->course_code) && !empty($this->course_code)) { |
643 | - $crscats = Category::load(null,null,$this->course_code,0); |
|
643 | + $crscats = Category::load(null, null, $this->course_code, 0); |
|
644 | 644 | foreach ($crscats as $cat) { |
645 | - $targets[] = array ($cat->get_id(), $cat->get_name(), $level+1); |
|
646 | - $targets = $this->add_target_subcategories($targets, $level+1, $cat->get_id()); |
|
645 | + $targets[] = array($cat->get_id(), $cat->get_name(), $level + 1); |
|
646 | + $targets = $this->add_target_subcategories($targets, $level + 1, $cat->get_id()); |
|
647 | 647 | } |
648 | 648 | } |
649 | 649 | |
650 | - $indcats = Category::load(null,$user,0,0); |
|
650 | + $indcats = Category::load(null, $user, 0, 0); |
|
651 | 651 | foreach ($indcats as $cat) { |
652 | - $targets[] = array ($cat->get_id(), $cat->get_name(), $level+1); |
|
653 | - $targets = $this->add_target_subcategories($targets, $level+1, $cat->get_id()); |
|
652 | + $targets[] = array($cat->get_id(), $cat->get_name(), $level + 1); |
|
653 | + $targets = $this->add_target_subcategories($targets, $level + 1, $cat->get_id()); |
|
654 | 654 | } |
655 | 655 | |
656 | 656 | return $targets; |
@@ -661,10 +661,10 @@ discard block |
||
661 | 661 | */ |
662 | 662 | private function add_target_subcategories($targets, $level, $catid) |
663 | 663 | { |
664 | - $subcats = Category::load(null,null,null,$catid); |
|
664 | + $subcats = Category::load(null, null, null, $catid); |
|
665 | 665 | foreach ($subcats as $cat) { |
666 | - $targets[] = array ($cat->get_id(), $cat->get_name(), $level+1); |
|
667 | - $targets = $this->add_target_subcategories($targets, $level+1, $cat->get_id()); |
|
666 | + $targets[] = array($cat->get_id(), $cat->get_name(), $level + 1); |
|
667 | + $targets = $this->add_target_subcategories($targets, $level + 1, $cat->get_id()); |
|
668 | 668 | } |
669 | 669 | return $targets; |
670 | 670 | } |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | * @return array evaluation objects matching the search criterium |
744 | 744 | * @todo can be written more efficiently using a new (but very complex) sql query |
745 | 745 | */ |
746 | - public function find_evaluations($name_mask,$selectcat) |
|
746 | + public function find_evaluations($name_mask, $selectcat) |
|
747 | 747 | { |
748 | 748 | $rootcat = Category::load($selectcat); |
749 | 749 | $evals = $rootcat[0]->get_evaluations((api_is_allowed_to_create_course() ? null : api_get_user_id()), true); |
@@ -77,9 +77,9 @@ discard block |
||
77 | 77 | $course_code = Database::escape_string($course_code); |
78 | 78 | if (!empty($link_id)) { |
79 | 79 | $link_id = intval($link_id); |
80 | - $sql = 'UPDATE ' . Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK) . ' |
|
81 | - SET weight = ' . "'" . Database::escape_string((float) $weight) . "'" . ' |
|
82 | - WHERE course_code = "' . $course_code . '" AND id = ' . $link_id; |
|
80 | + $sql = 'UPDATE '.Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK).' |
|
81 | + SET weight = ' . "'".Database::escape_string((float) $weight)."'".' |
|
82 | + WHERE course_code = "' . $course_code.'" AND id = '.$link_id; |
|
83 | 83 | Database::query($sql); |
84 | 84 | } |
85 | 85 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | |
100 | 100 | // TODO find the corresponding category (the first one for this course, ordered by ID) |
101 | 101 | $l = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
102 | - $sql = "DELETE FROM $l WHERE id = ".(int)$link_id; |
|
102 | + $sql = "DELETE FROM $l WHERE id = ".(int) $link_id; |
|
103 | 103 | Database::query($sql); |
104 | 104 | |
105 | 105 | return true; |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | $visibility_icon = ($cat->is_visible() == 0) ? 'invisible' : 'visible'; |
196 | 196 | $visibility_command = ($cat->is_visible() == 0) ? 'set_visible' : 'set_invisible'; |
197 | 197 | |
198 | - $modify_icons .= '<a class="view_children" data-cat-id="' . $cat->get_id() . '" href="javascript:void(0);">' . |
|
199 | - Display::return_icon('view_more_stats.gif', get_lang('Show'), '', ICON_SIZE_SMALL) . '</a>'; |
|
198 | + $modify_icons .= '<a class="view_children" data-cat-id="'.$cat->get_id().'" href="javascript:void(0);">'. |
|
199 | + Display::return_icon('view_more_stats.gif', get_lang('Show'), '', ICON_SIZE_SMALL).'</a>'; |
|
200 | 200 | |
201 | 201 | if (!api_is_allowed_to_edit(null, true)) { |
202 | 202 | $modify_icons .= Display::url( |
@@ -206,9 +206,9 @@ discard block |
||
206 | 206 | '', |
207 | 207 | ICON_SIZE_SMALL |
208 | 208 | ), |
209 | - 'personal_stats.php?' . http_build_query([ |
|
209 | + 'personal_stats.php?'.http_build_query([ |
|
210 | 210 | 'selectcat' => $cat->get_id() |
211 | - ]) . '&' . api_get_cidreq(), |
|
211 | + ]).'&'.api_get_cidreq(), |
|
212 | 212 | [ |
213 | 213 | 'class' => 'ajax', |
214 | 214 | 'data-title' => get_lang('FlatView') |
@@ -222,16 +222,16 @@ discard block |
||
222 | 222 | if (api_get_setting('gradebook_locking_enabled') == 'true') { |
223 | 223 | if ($cat->is_locked()) { |
224 | 224 | if (api_is_platform_admin()) { |
225 | - $modify_icons .= ' <a onclick="javascript:if (!confirm(\'' . addslashes(get_lang('ConfirmToUnlockElement')) . '\')) return false;" href="' . api_get_self() . '?' . api_get_cidreq() . '&category_id=' . $cat->get_id() . '&action=unlock">' . |
|
226 | - Display::return_icon('lock.png', get_lang('UnLockEvaluation'), '', ICON_SIZE_SMALL) . '</a>'; |
|
225 | + $modify_icons .= ' <a onclick="javascript:if (!confirm(\''.addslashes(get_lang('ConfirmToUnlockElement')).'\')) return false;" href="'.api_get_self().'?'.api_get_cidreq().'&category_id='.$cat->get_id().'&action=unlock">'. |
|
226 | + Display::return_icon('lock.png', get_lang('UnLockEvaluation'), '', ICON_SIZE_SMALL).'</a>'; |
|
227 | 227 | } else { |
228 | - $modify_icons .= ' <a href="#">' . Display::return_icon('lock_na.png', get_lang('GradebookLockedAlert'), '', ICON_SIZE_SMALL) . '</a>'; |
|
228 | + $modify_icons .= ' <a href="#">'.Display::return_icon('lock_na.png', get_lang('GradebookLockedAlert'), '', ICON_SIZE_SMALL).'</a>'; |
|
229 | 229 | } |
230 | - $modify_icons .= ' <a href="gradebook_flatview.php?export_pdf=category&selectcat=' . $cat->get_id() . '" >' . Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL) . '</a>'; |
|
230 | + $modify_icons .= ' <a href="gradebook_flatview.php?export_pdf=category&selectcat='.$cat->get_id().'" >'.Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL).'</a>'; |
|
231 | 231 | } else { |
232 | - $modify_icons .= ' <a onclick="javascript:if (!confirm(\'' . addslashes(get_lang('ConfirmToLockElement')) . '\')) return false;" href="' . api_get_self() . '?' . api_get_cidreq() . '&category_id=' . $cat->get_id() . '&action=lock">' . |
|
233 | - Display::return_icon('unlock.png', get_lang('LockEvaluation'), '', ICON_SIZE_SMALL) . '</a>'; |
|
234 | - $modify_icons .= ' <a href="#" >' . Display::return_icon('pdf_na.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL) . '</a>'; |
|
232 | + $modify_icons .= ' <a onclick="javascript:if (!confirm(\''.addslashes(get_lang('ConfirmToLockElement')).'\')) return false;" href="'.api_get_self().'?'.api_get_cidreq().'&category_id='.$cat->get_id().'&action=lock">'. |
|
233 | + Display::return_icon('unlock.png', get_lang('LockEvaluation'), '', ICON_SIZE_SMALL).'</a>'; |
|
234 | + $modify_icons .= ' <a href="#" >'.Display::return_icon('pdf_na.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL).'</a>'; |
|
235 | 235 | } |
236 | 236 | } |
237 | 237 | |
@@ -239,38 +239,38 @@ discard block |
||
239 | 239 | if ($cat->is_locked() && !api_is_platform_admin()) { |
240 | 240 | $modify_icons .= Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL); |
241 | 241 | } else { |
242 | - $modify_icons .= '<a href="gradebook_edit_cat.php?' .'editcat=' . $cat->get_id() . '&cidReq=' .$cat->get_course_code() . '&id_session='.$cat->get_session_id().'">' . |
|
242 | + $modify_icons .= '<a href="gradebook_edit_cat.php?'.'editcat='.$cat->get_id().'&cidReq='.$cat->get_course_code().'&id_session='.$cat->get_session_id().'">'. |
|
243 | 243 | Display::return_icon( |
244 | 244 | 'edit.png', |
245 | 245 | get_lang('Modify'), |
246 | 246 | '', |
247 | 247 | ICON_SIZE_SMALL |
248 | - ) . '</a>'; |
|
248 | + ).'</a>'; |
|
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
252 | - $modify_icons .= '<a href="gradebook_edit_all.php?selectcat=' .$cat->get_id() . '&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id().'">' . |
|
252 | + $modify_icons .= '<a href="gradebook_edit_all.php?selectcat='.$cat->get_id().'&cidReq='.$cat->get_course_code().'&id_session='.$cat->get_session_id().'">'. |
|
253 | 253 | Display::return_icon( |
254 | 254 | 'percentage.png', |
255 | 255 | get_lang('EditAllWeights'), |
256 | 256 | '', |
257 | 257 | ICON_SIZE_SMALL |
258 | - ) . '</a>'; |
|
258 | + ).'</a>'; |
|
259 | 259 | |
260 | - $modify_icons .= '<a href="gradebook_flatview.php?selectcat=' .$cat->get_id() . '&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id(). '">' . |
|
260 | + $modify_icons .= '<a href="gradebook_flatview.php?selectcat='.$cat->get_id().'&cidReq='.$cat->get_course_code().'&id_session='.$cat->get_session_id().'">'. |
|
261 | 261 | Display::return_icon( |
262 | 262 | 'stats.png', |
263 | 263 | get_lang('FlatView'), |
264 | 264 | '', |
265 | 265 | ICON_SIZE_SMALL |
266 | - ) . '</a>'; |
|
267 | - $modify_icons .= ' <a href="' . api_get_self() .'?visiblecat=' . $cat->get_id() . '&' .$visibility_command . '=&selectcat=' . $selectcat .'&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id(). '">' . |
|
266 | + ).'</a>'; |
|
267 | + $modify_icons .= ' <a href="'.api_get_self().'?visiblecat='.$cat->get_id().'&'.$visibility_command.'=&selectcat='.$selectcat.'&cidReq='.$cat->get_course_code().'&id_session='.$cat->get_session_id().'">'. |
|
268 | 268 | Display::return_icon( |
269 | - $visibility_icon . '.png', |
|
269 | + $visibility_icon.'.png', |
|
270 | 270 | get_lang('Visible'), |
271 | 271 | '', |
272 | 272 | ICON_SIZE_SMALL |
273 | - ) . '</a>'; |
|
273 | + ).'</a>'; |
|
274 | 274 | //no move ability for root categories |
275 | 275 | if ($cat->is_movable()) { |
276 | 276 | /* $modify_icons .= ' <a href="' . api_get_self() . '?movecat=' . $cat->get_id() . '&selectcat=' . $selectcat . ' &cidReq='.$cat->get_course_code().'"> |
@@ -282,8 +282,8 @@ discard block |
||
282 | 282 | if ($cat->is_locked() && !api_is_platform_admin()) { |
283 | 283 | $modify_icons .= Display::return_icon('delete_na.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL); |
284 | 284 | } else { |
285 | - $modify_icons .= ' <a href="' . api_get_self() . '?deletecat=' . $cat->get_id() . '&selectcat=' . $selectcat . '&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id(). '" onclick="return confirmation();">' . |
|
286 | - Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL) . '</a>'; |
|
285 | + $modify_icons .= ' <a href="'.api_get_self().'?deletecat='.$cat->get_id().'&selectcat='.$selectcat.'&cidReq='.$cat->get_course_code().'&id_session='.$cat->get_session_id().'" onclick="return confirmation();">'. |
|
286 | + Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL).'</a>'; |
|
287 | 287 | } |
288 | 288 | } |
289 | 289 | |
@@ -310,21 +310,21 @@ discard block |
||
310 | 310 | if ($is_locked && !api_is_platform_admin()) { |
311 | 311 | $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL); |
312 | 312 | } else { |
313 | - $modify_icons = '<a href="gradebook_edit_eval.php?editeval=' . $eval->get_id() . '&cidReq=' . $eval->get_course_code() . '&id_session='.$eval->getSessionId(). '">' . |
|
314 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
313 | + $modify_icons = '<a href="gradebook_edit_eval.php?editeval='.$eval->get_id().'&cidReq='.$eval->get_course_code().'&id_session='.$eval->getSessionId().'">'. |
|
314 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
315 | 315 | } |
316 | 316 | |
317 | - $modify_icons .= ' <a href="' . api_get_self() . '?visibleeval=' . $eval->get_id() . '&' . $visibility_command . '=&selectcat=' . $selectcat . '&id_session='.$eval->getSessionId(). ' ">' . |
|
318 | - Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>'; |
|
317 | + $modify_icons .= ' <a href="'.api_get_self().'?visibleeval='.$eval->get_id().'&'.$visibility_command.'=&selectcat='.$selectcat.'&id_session='.$eval->getSessionId().' ">'. |
|
318 | + Display::return_icon($visibility_icon.'.png', get_lang('Visible'), '', ICON_SIZE_SMALL).'</a>'; |
|
319 | 319 | if (api_is_allowed_to_edit(null, true)) { |
320 | - $modify_icons .= ' <a href="gradebook_showlog_eval.php?visiblelog=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &cidReq=' . $eval->get_course_code() . '&id_session='.$eval->getSessionId(). '">' . |
|
321 | - Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . '</a>'; |
|
320 | + $modify_icons .= ' <a href="gradebook_showlog_eval.php?visiblelog='.$eval->get_id().'&selectcat='.$selectcat.' &cidReq='.$eval->get_course_code().'&id_session='.$eval->getSessionId().'">'. |
|
321 | + Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL).'</a>'; |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | if ($is_locked && !api_is_platform_admin()) { |
325 | - $modify_icons .= ' ' . Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL); |
|
325 | + $modify_icons .= ' '.Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL); |
|
326 | 326 | } else { |
327 | - $modify_icons .= ' <a href="' . api_get_self() . '?deleteeval=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &cidReq=' . $eval->get_course_code() . '&id_session='.$eval->getSessionId(). '" onclick="return confirmation();">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>'; |
|
327 | + $modify_icons .= ' <a href="'.api_get_self().'?deleteeval='.$eval->get_id().'&selectcat='.$selectcat.' &cidReq='.$eval->get_course_code().'&id_session='.$eval->getSessionId().'" onclick="return confirmation();">'.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'; |
|
328 | 328 | } |
329 | 329 | return $modify_icons; |
330 | 330 | } |
@@ -354,23 +354,23 @@ discard block |
||
354 | 354 | if ($is_locked && !api_is_platform_admin()) { |
355 | 355 | $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL); |
356 | 356 | } else { |
357 | - $modify_icons = '<a href="gradebook_edit_link.php?editlink=' . $link->get_id() . '&cidReq=' . $link->get_course_code() . '&id_session='.$link->get_session_id().'">' . |
|
358 | - Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>'; |
|
357 | + $modify_icons = '<a href="gradebook_edit_link.php?editlink='.$link->get_id().'&cidReq='.$link->get_course_code().'&id_session='.$link->get_session_id().'">'. |
|
358 | + Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>'; |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | //$modify_icons .= ' <a href="' . api_get_self() . '?movelink=' . $link->get_id() . '&selectcat=' . $selectcat . '"><img src="../img/deplacer_fichier.gif" border="0" title="' . get_lang('Move') . '" alt="" /></a>'; |
362 | - $modify_icons .= ' <a href="' . api_get_self() . '?visiblelink=' . $link->get_id() . '&' . $visibility_command . '=&selectcat=' . $selectcat . '&id_session='.$link->get_session_id(). ' ">' . |
|
363 | - Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>'; |
|
364 | - $modify_icons .= ' <a href="gradebook_showlog_link.php?visiblelink=' . $link->get_id() . '&selectcat=' . $selectcat . '&cidReq=' . $link->get_course_code() . '&id_session='.$link->get_session_id(). '">' . |
|
365 | - Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . '</a>'; |
|
362 | + $modify_icons .= ' <a href="'.api_get_self().'?visiblelink='.$link->get_id().'&'.$visibility_command.'=&selectcat='.$selectcat.'&id_session='.$link->get_session_id().' ">'. |
|
363 | + Display::return_icon($visibility_icon.'.png', get_lang('Visible'), '', ICON_SIZE_SMALL).'</a>'; |
|
364 | + $modify_icons .= ' <a href="gradebook_showlog_link.php?visiblelink='.$link->get_id().'&selectcat='.$selectcat.'&cidReq='.$link->get_course_code().'&id_session='.$link->get_session_id().'">'. |
|
365 | + Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL).'</a>'; |
|
366 | 366 | |
367 | 367 | //If a work is added in a gradebook you can only delete the link in the work tool |
368 | 368 | |
369 | 369 | if ($is_locked && !api_is_platform_admin()) { |
370 | - $modify_icons .= ' ' . Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL); |
|
370 | + $modify_icons .= ' '.Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL); |
|
371 | 371 | } else { |
372 | - $modify_icons .= ' <a href="' . api_get_self() . '?deletelink=' . $link->get_id() . '&selectcat=' . $selectcat . ' &cidReq=' . $link->get_course_code() . '&id_session='.$link->get_session_id(). '" onclick="return confirmation();">' . |
|
373 | - Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>'; |
|
372 | + $modify_icons .= ' <a href="'.api_get_self().'?deletelink='.$link->get_id().'&selectcat='.$selectcat.' &cidReq='.$link->get_course_code().'&id_session='.$link->get_session_id().'" onclick="return confirmation();">'. |
|
373 | + Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'; |
|
374 | 374 | } |
375 | 375 | return $modify_icons; |
376 | 376 | } |
@@ -391,8 +391,8 @@ discard block |
||
391 | 391 | $sql = "SELECT * FROM $table l |
392 | 392 | WHERE |
393 | 393 | course_code = '$course_code' AND |
394 | - type = ".(int)$resource_type . " AND |
|
395 | - ref_id = " . (int)$resource_id; |
|
394 | + type = ".(int) $resource_type." AND |
|
395 | + ref_id = " . (int) $resource_id; |
|
396 | 396 | $res = Database::query($sql); |
397 | 397 | |
398 | 398 | if (Database::num_rows($res) < 1) { |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | } |
415 | 415 | // TODO find the corresponding category (the first one for this course, ordered by ID) |
416 | 416 | $l = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
417 | - $sql = "SELECT * FROM $l WHERE id = " . (int) $link_id; |
|
417 | + $sql = "SELECT * FROM $l WHERE id = ".(int) $link_id; |
|
418 | 418 | $res = Database::query($sql); |
419 | 419 | $row = array(); |
420 | 420 | if (Database::num_rows($res) > 0) { |
@@ -432,10 +432,10 @@ discard block |
||
432 | 432 | { |
433 | 433 | $course_table = Database::get_main_table(TABLE_MAIN_COURSE); |
434 | 434 | $tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
435 | - $sql = 'SELECT c.id FROM ' . $course_table . ' c |
|
436 | - INNER JOIN ' . $tbl_grade_links . ' l |
|
435 | + $sql = 'SELECT c.id FROM '.$course_table.' c |
|
436 | + INNER JOIN ' . $tbl_grade_links.' l |
|
437 | 437 | ON c.code = l.course_code |
438 | - WHERE l.id=' . intval($id_link) . ' OR l.category_id=' . intval($id_link); |
|
438 | + WHERE l.id=' . intval($id_link).' OR l.category_id='.intval($id_link); |
|
439 | 439 | $res = Database::query($sql); |
440 | 440 | $array = Database::fetch_array($res, 'ASSOC'); |
441 | 441 | return $array['id']; |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | { |
545 | 545 | $result = Result :: load($resid); |
546 | 546 | if ($importscore > $eval_max) { |
547 | - header('Location: gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']) . '&overwritemax='); |
|
547 | + header('Location: gradebook_view_result.php?selecteval='.Security::remove_XSS($_GET['selecteval']).'&overwritemax='); |
|
548 | 548 | exit; |
549 | 549 | } |
550 | 550 | $result[0]->set_score($importscore); |
@@ -585,8 +585,8 @@ discard block |
||
585 | 585 | { |
586 | 586 | $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE); |
587 | 587 | $sql = 'SELECT COUNT(*) as count |
588 | - FROM ' . $table . ' gc |
|
589 | - WHERE gc.cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '" '; |
|
588 | + FROM ' . $table.' gc |
|
589 | + WHERE gc.cat_id="' . intval($cat_id).'" AND user_id="'.intval($user_id).'" '; |
|
590 | 590 | $rs_exist = Database::query($sql); |
591 | 591 | $row = Database::fetch_array($rs_exist); |
592 | 592 | if ($row['count'] == 0) { |
@@ -609,8 +609,8 @@ discard block |
||
609 | 609 | public static function get_certificate_by_user_id($cat_id, $user_id) |
610 | 610 | { |
611 | 611 | $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE); |
612 | - $sql = 'SELECT * FROM ' . $table_certificate . ' |
|
613 | - WHERE cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '"'; |
|
612 | + $sql = 'SELECT * FROM '.$table_certificate.' |
|
613 | + WHERE cat_id="' . intval($cat_id).'" AND user_id="'.intval($user_id).'"'; |
|
614 | 614 | |
615 | 615 | $result = Database::query($sql); |
616 | 616 | $row = Database::fetch_array($result, 'ASSOC'); |
@@ -629,18 +629,18 @@ discard block |
||
629 | 629 | $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE); |
630 | 630 | $table_user = Database::get_main_table(TABLE_MAIN_USER); |
631 | 631 | $sql = 'SELECT DISTINCT u.user_id, u.lastname, u.firstname, u.username |
632 | - FROM ' . $table_user . ' u |
|
633 | - INNER JOIN ' . $table_certificate . ' gc |
|
632 | + FROM ' . $table_user.' u |
|
633 | + INNER JOIN ' . $table_certificate.' gc |
|
634 | 634 | ON u.user_id=gc.user_id '; |
635 | 635 | if (!is_null($cat_id) && $cat_id > 0) { |
636 | - $sql.=' WHERE cat_id=' . intval($cat_id); |
|
636 | + $sql .= ' WHERE cat_id='.intval($cat_id); |
|
637 | 637 | } |
638 | 638 | if (!empty($userList)) { |
639 | 639 | $userList = array_map('intval', $userList); |
640 | 640 | $userListCondition = implode("','", $userList); |
641 | 641 | $sql .= " AND u.user_id IN ('$userListCondition')"; |
642 | 642 | } |
643 | - $sql.=' ORDER BY u.firstname'; |
|
643 | + $sql .= ' ORDER BY u.firstname'; |
|
644 | 644 | $rs = Database::query($sql); |
645 | 645 | |
646 | 646 | $list_users = array(); |
@@ -661,10 +661,10 @@ discard block |
||
661 | 661 | { |
662 | 662 | $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE); |
663 | 663 | $sql = 'SELECT gc.score_certificate, gc.created_at, gc.path_certificate, gc.cat_id, gc.user_id, gc.id |
664 | - FROM ' . $table_certificate . ' gc |
|
665 | - WHERE gc.user_id="' . intval($user_id) . '" '; |
|
664 | + FROM ' . $table_certificate.' gc |
|
665 | + WHERE gc.user_id="' . intval($user_id).'" '; |
|
666 | 666 | if (!is_null($cat_id) && $cat_id > 0) { |
667 | - $sql.=' AND cat_id=' . intval($cat_id); |
|
667 | + $sql .= ' AND cat_id='.intval($cat_id); |
|
668 | 668 | } |
669 | 669 | |
670 | 670 | $rs = Database::query($sql); |
@@ -702,21 +702,21 @@ discard block |
||
702 | 702 | $variables = $content_html['variables']; |
703 | 703 | } |
704 | 704 | |
705 | - $path_image = api_get_path(WEB_COURSE_PATH) . api_get_course_path($course_code) . '/document/images/gallery'; |
|
705 | + $path_image = api_get_path(WEB_COURSE_PATH).api_get_course_path($course_code).'/document/images/gallery'; |
|
706 | 706 | $new_content_html = str_replace('../images/gallery', $path_image, $new_content_html); |
707 | 707 | |
708 | - $path_image_in_default_course = api_get_path(WEB_CODE_PATH) . 'default_course_document'; |
|
708 | + $path_image_in_default_course = api_get_path(WEB_CODE_PATH).'default_course_document'; |
|
709 | 709 | $new_content_html = str_replace('/main/default_course_document', $path_image_in_default_course, $new_content_html); |
710 | - $new_content_html = str_replace(SYS_CODE_PATH . 'img/', api_get_path(WEB_IMG_PATH), $new_content_html); |
|
710 | + $new_content_html = str_replace(SYS_CODE_PATH.'img/', api_get_path(WEB_IMG_PATH), $new_content_html); |
|
711 | 711 | |
712 | 712 | //add print header |
713 | 713 | if ($hide_print_button == false) { |
714 | 714 | $print = '<style media="print" type="text/css">#print_div {visibility:hidden;}</style>'; |
715 | - $print .= '<a href="javascript:window.print();" style="float:right; padding:4px;" id="print_div"><img src="' . api_get_path(WEB_CODE_PATH) . 'img/printmgr.gif" alt="' . get_lang('Print') . '" /> ' . get_lang('Print') . '</a>'; |
|
715 | + $print .= '<a href="javascript:window.print();" style="float:right; padding:4px;" id="print_div"><img src="'.api_get_path(WEB_CODE_PATH).'img/printmgr.gif" alt="'.get_lang('Print').'" /> '.get_lang('Print').'</a>'; |
|
716 | 716 | } |
717 | 717 | |
718 | 718 | // Add header |
719 | - $new_content_html = $contentHead. $print . '</head>' . $new_content_html; |
|
719 | + $new_content_html = $contentHead.$print.'</head>'.$new_content_html; |
|
720 | 720 | |
721 | 721 | return array( |
722 | 722 | 'content' => $new_content_html, |
@@ -738,9 +738,9 @@ discard block |
||
738 | 738 | $session_id = api_get_session_id(); |
739 | 739 | |
740 | 740 | $t = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY); |
741 | - $sql = "SELECT * FROM $t WHERE course_code = '" . Database::escape_string($course_code) . "' "; |
|
741 | + $sql = "SELECT * FROM $t WHERE course_code = '".Database::escape_string($course_code)."' "; |
|
742 | 742 | if (!empty($session_id)) { |
743 | - $sql .= " AND session_id = " . (int) $session_id; |
|
743 | + $sql .= " AND session_id = ".(int) $session_id; |
|
744 | 744 | } else { |
745 | 745 | $sql .= " AND (session_id IS NULL OR session_id = 0) "; |
746 | 746 | } |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | if (!empty($session_id)) { |
753 | 753 | $my_session_id = api_get_session_id(); |
754 | 754 | $s_name = api_get_session_name($my_session_id); |
755 | - $cat->set_name($course_code . ' - ' . get_lang('Session') . ' ' . $s_name); |
|
755 | + $cat->set_name($course_code.' - '.get_lang('Session').' '.$s_name); |
|
756 | 756 | $cat->set_session_id($session_id); |
757 | 757 | } else { |
758 | 758 | $cat->set_name($course_code); |
@@ -874,13 +874,13 @@ discard block |
||
874 | 874 | |
875 | 875 | if ($use_grade_model) { |
876 | 876 | if ($parent_id == 0) { |
877 | - $title = api_strtoupper(get_lang('Average')) . '<br />' . get_lang('Detailed'); |
|
877 | + $title = api_strtoupper(get_lang('Average')).'<br />'.get_lang('Detailed'); |
|
878 | 878 | } else { |
879 | - $title = api_strtoupper(get_lang('Average')) . '<br />' . $cat[0]->get_description() . ' - (' . $cat[0]->get_name() . ')'; |
|
879 | + $title = api_strtoupper(get_lang('Average')).'<br />'.$cat[0]->get_description().' - ('.$cat[0]->get_name().')'; |
|
880 | 880 | } |
881 | 881 | } else { |
882 | 882 | if ($parent_id == 0) { |
883 | - $title = api_strtoupper(get_lang('Average')) . '<br />' . get_lang('Detailed'); |
|
883 | + $title = api_strtoupper(get_lang('Average')).'<br />'.get_lang('Detailed'); |
|
884 | 884 | } else { |
885 | 885 | $title = api_strtoupper(get_lang('Average')); |
886 | 886 | } |
@@ -934,11 +934,11 @@ discard block |
||
934 | 934 | } else { |
935 | 935 | $column = 0; |
936 | 936 | $table->setCellContents($row, $column, get_lang('NoResults')); |
937 | - $table->updateCellAttributes($row, $column, 'colspan="' . $columns . '" align="center" class="row_odd"'); |
|
937 | + $table->updateCellAttributes($row, $column, 'colspan="'.$columns.'" align="center" class="row_odd"'); |
|
938 | 938 | } |
939 | 939 | |
940 | 940 | $pdfParams = array( |
941 | - 'filename' => get_lang('FlatView') . '_' . api_get_utc_datetime(), |
|
941 | + 'filename' => get_lang('FlatView').'_'.api_get_utc_datetime(), |
|
942 | 942 | 'pdf_title' => $title, |
943 | 943 | 'course_code' => $course_code, |
944 | 944 | 'add_signatures' => true |
@@ -1023,7 +1023,7 @@ discard block |
||
1023 | 1023 | $a_students = array(); |
1024 | 1024 | while ($user = Database::fetch_array($result)) { |
1025 | 1025 | if (!array_key_exists($user['user_id'], $a_students)) { |
1026 | - $a_current_student = array (); |
|
1026 | + $a_current_student = array(); |
|
1027 | 1027 | $a_current_student[] = $user['user_id']; |
1028 | 1028 | $a_current_student[] = $user['username']; |
1029 | 1029 | $a_current_student[] = $user['lastname']; |
@@ -1081,7 +1081,7 @@ discard block |
||
1081 | 1081 | foreach ($links as $link) { |
1082 | 1082 | // links are always in a course |
1083 | 1083 | $coursecode = $link->get_course_code(); |
1084 | - if (!array_key_exists($coursecode,$coursecodes)) { |
|
1084 | + if (!array_key_exists($coursecode, $coursecodes)) { |
|
1085 | 1085 | $coursecodes[$coursecode] = '1'; |
1086 | 1086 | $users = array_merge($users, GradebookUtils::get_users_in_course($coursecode)); |
1087 | 1087 | } |
@@ -1094,7 +1094,7 @@ discard block |
||
1094 | 1094 | * Search students matching a given last name and/or first name |
1095 | 1095 | * @author Bert Steppé |
1096 | 1096 | */ |
1097 | - public static function find_students($mask= '') |
|
1097 | + public static function find_students($mask = '') |
|
1098 | 1098 | { |
1099 | 1099 | // students shouldn't be here // don't search if mask empty |
1100 | 1100 | if (!api_is_allowed_to_edit() || empty ($mask)) { |
@@ -1105,23 +1105,23 @@ discard block |
||
1105 | 1105 | $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
1106 | 1106 | $tbl_cru = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
1107 | 1107 | $sql = 'SELECT DISTINCT user.user_id, user.lastname, user.firstname, user.email, user.official_code |
1108 | - FROM ' . $tbl_user . ' user'; |
|
1108 | + FROM ' . $tbl_user.' user'; |
|
1109 | 1109 | if (!api_is_platform_admin()) { |
1110 | - $sql .= ', ' . $tbl_cru . ' cru'; |
|
1110 | + $sql .= ', '.$tbl_cru.' cru'; |
|
1111 | 1111 | } |
1112 | 1112 | |
1113 | - $sql .= ' WHERE user.status = ' . STUDENT; |
|
1114 | - $sql .= ' AND (user.lastname LIKE '."'%" . $mask . "%'"; |
|
1115 | - $sql .= ' OR user.firstname LIKE '."'%" . $mask . "%')"; |
|
1113 | + $sql .= ' WHERE user.status = '.STUDENT; |
|
1114 | + $sql .= ' AND (user.lastname LIKE '."'%".$mask."%'"; |
|
1115 | + $sql .= ' OR user.firstname LIKE '."'%".$mask."%')"; |
|
1116 | 1116 | |
1117 | 1117 | if (!api_is_platform_admin()) { |
1118 | 1118 | $sql .= ' AND user.user_id = cru.user_id AND |
1119 | 1119 | cru.relation_type <> '.COURSE_RELATION_TYPE_RRHH.' AND |
1120 | 1120 | cru.c_id in ( |
1121 | - SELECT c_id FROM '.$tbl_cru . ' |
|
1121 | + SELECT c_id FROM '.$tbl_cru.' |
|
1122 | 1122 | WHERE |
1123 | - user_id = ' . api_get_user_id() . ' AND |
|
1124 | - status = ' . COURSEMANAGER . ' |
|
1123 | + user_id = ' . api_get_user_id().' AND |
|
1124 | + status = ' . COURSEMANAGER.' |
|
1125 | 1125 | ) |
1126 | 1126 | '; |
1127 | 1127 | } |
@@ -1164,7 +1164,7 @@ discard block |
||
1164 | 1164 | $sql = 'SELECT ref_id FROM '.$table_link.' |
1165 | 1165 | WHERE id = '.$linkId.' AND type='.LINK_ATTENDANCE; |
1166 | 1166 | |
1167 | - $rs_attendance = Database::query($sql); |
|
1167 | + $rs_attendance = Database::query($sql); |
|
1168 | 1168 | if (Database::num_rows($rs_attendance) > 0) { |
1169 | 1169 | $row_attendance = Database::fetch_array($rs_attendance); |
1170 | 1170 | $sql = 'UPDATE '.$tbl_attendance.' SET attendance_weight ='.$weight.' |
@@ -1250,7 +1250,7 @@ discard block |
||
1250 | 1250 | 'course' => $courseInfo['title'], |
1251 | 1251 | 'score' => $certificateInfo['score_certificate'], |
1252 | 1252 | 'date' => api_format_date($certificateInfo['created_at'], DATE_FORMAT_SHORT), |
1253 | - 'link' => api_get_path(WEB_PATH) . "certificates/index.php?id={$certificateInfo['id']}" |
|
1253 | + 'link' => api_get_path(WEB_PATH)."certificates/index.php?id={$certificateInfo['id']}" |
|
1254 | 1254 | ]; |
1255 | 1255 | } |
1256 | 1256 | |
@@ -1314,7 +1314,7 @@ discard block |
||
1314 | 1314 | 'course' => $course['title'], |
1315 | 1315 | 'score' => $certificateInfo['score_certificate'], |
1316 | 1316 | 'date' => api_format_date($certificateInfo['created_at'], DATE_FORMAT_SHORT), |
1317 | - 'link' => api_get_path(WEB_PATH) . "certificates/index.php?id={$certificateInfo['id']}" |
|
1317 | + 'link' => api_get_path(WEB_PATH)."certificates/index.php?id={$certificateInfo['id']}" |
|
1318 | 1318 | ]; |
1319 | 1319 | } |
1320 | 1320 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | /** |
39 | 39 | * Get total number of results (rows) |
40 | 40 | */ |
41 | - public function get_total_results_count () |
|
41 | + public function get_total_results_count() |
|
42 | 42 | { |
43 | 43 | return count($this->results); |
44 | 44 | } |
@@ -53,12 +53,12 @@ discard block |
||
53 | 53 | * 4 ['score'] : student's score |
54 | 54 | * 5 ['display'] : custom score display (only if custom scoring enabled) |
55 | 55 | */ |
56 | - public function get_data ($sorting = 0, $start = 0, $count = null, $ignore_score_color = false, $pdf=false) |
|
56 | + public function get_data($sorting = 0, $start = 0, $count = null, $ignore_score_color = false, $pdf = false) |
|
57 | 57 | { |
58 | 58 | // do some checks on count, redefine if invalid value |
59 | 59 | $number_decimals = api_get_setting('gradebook_number_decimals'); |
60 | 60 | if (!isset($count)) { |
61 | - $count = count ($this->results) - $start; |
|
61 | + $count = count($this->results) - $start; |
|
62 | 62 | } |
63 | 63 | if ($count < 0) { |
64 | 64 | $count = 0; |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | $scoredisplay = ScoreDisplay :: instance(); |
67 | 67 | // generate actual data array |
68 | 68 | $table = array(); |
69 | - foreach($this->results as $result) { |
|
69 | + foreach ($this->results as $result) { |
|
70 | 70 | $user = array(); |
71 | 71 | $info = api_get_user_info($result->get_user_id()); |
72 | 72 | $user['id'] = $result->get_user_id(); |
73 | - if ($pdf){ |
|
73 | + if ($pdf) { |
|
74 | 74 | $user['username'] = $info['username']; |
75 | 75 | } |
76 | 76 | $user['result_id'] = $result->get_id(); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | true |
93 | 93 | ) |
94 | 94 | ); |
95 | - if ($pdf && $number_decimals == null){ |
|
95 | + if ($pdf && $number_decimals == null) { |
|
96 | 96 | $user['scoreletter'] = $result->get_score(); |
97 | 97 | } |
98 | 98 | if ($scoredisplay->is_custom()) { |
@@ -132,13 +132,13 @@ discard block |
||
132 | 132 | * @param bool Whether we want to ignore the score color |
133 | 133 | * @result string The score as we want to show it |
134 | 134 | */ |
135 | - private function get_score_display ($score, $realscore, $ignore_score_color = false) |
|
135 | + private function get_score_display($score, $realscore, $ignore_score_color = false) |
|
136 | 136 | { |
137 | 137 | if ($score != null) { |
138 | 138 | $scoredisplay = ScoreDisplay :: instance(); |
139 | 139 | $type = SCORE_CUSTOM; |
140 | 140 | if ($realscore === true) { |
141 | - $type = SCORE_DIV_PERCENT ; |
|
141 | + $type = SCORE_DIV_PERCENT; |
|
142 | 142 | } |
143 | 143 | |
144 | 144 | return $scoredisplay->display_score( |
@@ -172,10 +172,10 @@ discard block |
||
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
175 | - function sort_by_mask ($item1, $item2) |
|
175 | + function sort_by_mask($item1, $item2) |
|
176 | 176 | { |
177 | - $score1 = (isset($item1['score']) ? array($item1['score'],$this->evaluation->get_max()) : null); |
|
178 | - $score2 = (isset($item2['score']) ? array($item2['score'],$this->evaluation->get_max()) : null); |
|
177 | + $score1 = (isset($item1['score']) ? array($item1['score'], $this->evaluation->get_max()) : null); |
|
178 | + $score2 = (isset($item2['score']) ? array($item2['score'], $this->evaluation->get_max()) : null); |
|
179 | 179 | return ScoreDisplay :: compare_scores_by_custom_display($score1, $score2); |
180 | 180 | } |
181 | 181 | } |
@@ -114,10 +114,10 @@ discard block |
||
114 | 114 | isset($this->params['only_subcat']) && |
115 | 115 | $this->params['only_subcat'] == $this->category->get_id() |
116 | 116 | ) { |
117 | - $main_weight = $this->category->get_weight(); |
|
117 | + $main_weight = $this->category->get_weight(); |
|
118 | 118 | $grade_model_id = $this->category->get_grade_model_id(); |
119 | 119 | } else { |
120 | - $main_cat = Category::load($parent_id, null, null); |
|
120 | + $main_cat = Category::load($parent_id, null, null); |
|
121 | 121 | $main_weight = $main_cat[0]->get_weight(); |
122 | 122 | $grade_model_id = $main_cat[0]->get_grade_model_id(); |
123 | 123 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $list = []; |
200 | 200 | $list['items'] = $finalList; |
201 | 201 | $list['header'] = '<center>'.$mainHeader.'</center>'; |
202 | - $headers[]= $list; |
|
202 | + $headers[] = $list; |
|
203 | 203 | } else { |
204 | 204 | $headers[] = '<center>'.$mainHeader.'</center>'; |
205 | 205 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | (isset($this->params['only_total_category']) && |
210 | 210 | $this->params['only_total_category'] == false) |
211 | 211 | ) { |
212 | - for ($count=0; ($count < $items_count ) && ($items_start + $count < count($this->evals_links)); $count++) { |
|
212 | + for ($count = 0; ($count < $items_count) && ($items_start + $count < count($this->evals_links)); $count++) { |
|
213 | 213 | /** @var AbstractLink $item */ |
214 | 214 | $item = $this->evals_links[$count + $items_start]; |
215 | 215 | $weight = round(100 * $item->get_weight() / $main_weight, 1); |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | !in_array($item->get_id(), $evaluationsAdded) |
228 | 228 | ) { |
229 | 229 | $weight = round(100 * $item->get_weight() / $main_weight, 1); |
230 | - $headers[] = $item->get_name() . ' ' . $weight . ' % '; |
|
230 | + $headers[] = $item->get_name().' '.$weight.' % '; |
|
231 | 231 | } |
232 | 232 | } |
233 | 233 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | if (!isset($items_count)) { |
267 | 267 | $items_count = count($this->evals_links) - $items_start; |
268 | 268 | } |
269 | - for ($count=0; ($count < $items_count ) && ($items_start + $count < count($this->evals_links)); $count++) { |
|
269 | + for ($count = 0; ($count < $items_count) && ($items_start + $count < count($this->evals_links)); $count++) { |
|
270 | 270 | $item = $this->evals_links [$count + $items_start]; |
271 | 271 | $headers[] = $item->get_name(); |
272 | 272 | } |
@@ -293,13 +293,13 @@ discard block |
||
293 | 293 | ) { |
294 | 294 | // Do some checks on users/items counts, redefine if invalid values |
295 | 295 | if (!isset($users_count)) { |
296 | - $users_count = count ($this->users) - $users_start; |
|
296 | + $users_count = count($this->users) - $users_start; |
|
297 | 297 | } |
298 | 298 | if ($users_count < 0) { |
299 | 299 | $users_count = 0; |
300 | 300 | } |
301 | 301 | if (!isset($items_count)) { |
302 | - $items_count = count ($this->evals) + count ($this->links) - $items_start; |
|
302 | + $items_count = count($this->evals) + count($this->links) - $items_start; |
|
303 | 303 | } |
304 | 304 | if ($items_count < 0) { |
305 | 305 | $items_count = 0; |
@@ -312,10 +312,10 @@ discard block |
||
312 | 312 | |
313 | 313 | // sort users array |
314 | 314 | if ($users_sorting & self :: FVDG_SORT_LASTNAME) { |
315 | - usort($userTable, array('FlatViewDataGenerator','sort_by_last_name')); |
|
315 | + usort($userTable, array('FlatViewDataGenerator', 'sort_by_last_name')); |
|
316 | 316 | |
317 | 317 | } elseif ($users_sorting & self :: FVDG_SORT_FIRSTNAME) { |
318 | - usort($userTable, array('FlatViewDataGenerator','sort_by_first_name')); |
|
318 | + usort($userTable, array('FlatViewDataGenerator', 'sort_by_first_name')); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | if ($users_sorting & self :: FVDG_SORT_DESC) { |
@@ -356,10 +356,10 @@ discard block |
||
356 | 356 | $parent_id = $this->category->get_parent_id(); |
357 | 357 | |
358 | 358 | if ($parent_id == 0 or $this->params['only_subcat'] == $this->category->get_id()) { |
359 | - $main_weight = $this->category->get_weight(); |
|
359 | + $main_weight = $this->category->get_weight(); |
|
360 | 360 | $grade_model_id = $this->category->get_grade_model_id(); |
361 | 361 | } else { |
362 | - $main_cat = Category::load($parent_id, null, null); |
|
362 | + $main_cat = Category::load($parent_id, null, null); |
|
363 | 363 | $main_weight = $main_cat[0]->get_weight(); |
364 | 364 | $grade_model_id = $main_cat[0]->get_grade_model_id(); |
365 | 365 | } |
@@ -471,11 +471,11 @@ discard block |
||
471 | 471 | $divide = $score[1] == 0 ? 1 : $score[1]; |
472 | 472 | |
473 | 473 | $sub_cat_percentage = $sum_categories_weight_array[$sub_cat->get_id()]; |
474 | - $item_value = $score[0]/$divide*$main_weight; |
|
474 | + $item_value = $score[0] / $divide * $main_weight; |
|
475 | 475 | |
476 | 476 | // Fixing total when using one or multiple gradebooks |
477 | - $percentage = $sub_cat->get_weight()/($sub_cat_percentage) * $sub_cat_percentage/$this->category->get_weight(); |
|
478 | - $item_value = $percentage*$item_value; |
|
477 | + $percentage = $sub_cat->get_weight() / ($sub_cat_percentage) * $sub_cat_percentage / $this->category->get_weight(); |
|
478 | + $item_value = $percentage * $item_value; |
|
479 | 479 | $item_total += $sub_cat->get_weight(); |
480 | 480 | /* |
481 | 481 | if ($convert_using_the_global_weight) { |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | if ($convert_using_the_global_weight) { |
522 | 522 | //$item_total = $main_weight; |
523 | 523 | } |
524 | - } else { |
|
524 | + } else { |
|
525 | 525 | // All evaluations |
526 | 526 | $result = $this->parseEvaluations( |
527 | 527 | $user_id, |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | // Sub cat weight |
629 | 629 | //$sub_cat_percentage = $sum_categories_weight_array[$item->get_category_id()]; |
630 | 630 | |
631 | - $item_value = isset($score[0]) ? $score[0]/$divide : 0; |
|
631 | + $item_value = isset($score[0]) ? $score[0] / $divide : 0; |
|
632 | 632 | |
633 | 633 | // Fixing total when using one or multiple gradebooks. |
634 | 634 | if (empty($parentCategoryIdFilter)) { |
@@ -710,11 +710,11 @@ discard block |
||
710 | 710 | $data = array(); |
711 | 711 | |
712 | 712 | foreach ($selected_users as $user) { |
713 | - $row = array (); |
|
714 | - for ($count=0;$count < count($this->evals_links); $count++) { |
|
713 | + $row = array(); |
|
714 | + for ($count = 0; $count < count($this->evals_links); $count++) { |
|
715 | 715 | $item = $this->evals_links [$count]; |
716 | 716 | $score = $item->calc_score($user[0]); |
717 | - $porcent_score = isset($score[1]) && $score[1] > 0 ? ($score[0]*100)/$score[1] :0; |
|
717 | + $porcent_score = isset($score[1]) && $score[1] > 0 ? ($score[0] * 100) / $score[1] : 0; |
|
718 | 718 | $row[$item->get_name()] = $porcent_score; |
719 | 719 | } |
720 | 720 | $data[$user[0]] = $row; |
@@ -726,7 +726,7 @@ discard block |
||
726 | 726 | $tmp = array(); |
727 | 727 | foreach ($items as $item => $value) { |
728 | 728 | $tmp[] = $item; |
729 | - if (in_array($item,$tmp)) { |
|
729 | + if (in_array($item, $tmp)) { |
|
730 | 730 | $data_by_item[$item][$uid] = $value; |
731 | 731 | } |
732 | 732 | } |
@@ -737,7 +737,7 @@ discard block |
||
737 | 737 | */ |
738 | 738 | $result = array(); |
739 | 739 | foreach ($data_by_item as $k => $v) { |
740 | - $average = round(array_sum($v)/count($v)); |
|
740 | + $average = round(array_sum($v) / count($v)); |
|
741 | 741 | arsort($v); |
742 | 742 | $maximum = array_shift($v); |
743 | 743 | $minimum = array_pop($v); |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | $minimum = 0; |
747 | 747 | } |
748 | 748 | |
749 | - $summary= array( |
|
749 | + $summary = array( |
|
750 | 750 | 'max' => $maximum, |
751 | 751 | 'min' => $minimum, |
752 | 752 | 'avg' => $average |
@@ -763,32 +763,32 @@ discard block |
||
763 | 763 | public function get_data_to_graph() |
764 | 764 | { |
765 | 765 | // do some checks on users/items counts, redefine if invalid values |
766 | - $usertable = array (); |
|
766 | + $usertable = array(); |
|
767 | 767 | foreach ($this->users as $user) { |
768 | 768 | $usertable[] = $user; |
769 | 769 | } |
770 | 770 | // sort users array |
771 | - usort($usertable, array ('FlatViewDataGenerator','sort_by_first_name')); |
|
771 | + usort($usertable, array('FlatViewDataGenerator', 'sort_by_first_name')); |
|
772 | 772 | |
773 | - $data = array (); |
|
773 | + $data = array(); |
|
774 | 774 | |
775 | 775 | $selected_users = $usertable; |
776 | 776 | foreach ($selected_users as $user) { |
777 | - $row = array (); |
|
778 | - $row[] = $user[0]; // user id |
|
777 | + $row = array(); |
|
778 | + $row[] = $user[0]; // user id |
|
779 | 779 | $item_value = 0; |
780 | 780 | $item_total = 0; |
781 | 781 | |
782 | - for ($count=0;$count < count($this->evals_links); $count++) { |
|
782 | + for ($count = 0; $count < count($this->evals_links); $count++) { |
|
783 | 783 | $item = $this->evals_links[$count]; |
784 | 784 | $score = $item->calc_score($user[0]); |
785 | 785 | |
786 | - $divide =( ($score[1])==0 ) ? 1 : $score[1]; |
|
787 | - $item_value += $score[0]/$divide*$item->get_weight(); |
|
786 | + $divide = (($score[1]) == 0) ? 1 : $score[1]; |
|
787 | + $item_value += $score[0] / $divide * $item->get_weight(); |
|
788 | 788 | $item_total += $item->get_weight(); |
789 | 789 | |
790 | 790 | |
791 | - $score_denom = ($score[1]==0) ? 1 : $score[1]; |
|
791 | + $score_denom = ($score[1] == 0) ? 1 : $score[1]; |
|
792 | 792 | $score_final = ($score[0] / $score_denom) * 100; |
793 | 793 | $row[] = $score_final; |
794 | 794 | } |
@@ -814,15 +814,15 @@ discard block |
||
814 | 814 | $usertable[] = $user; |
815 | 815 | } |
816 | 816 | // sort users array |
817 | - usort($usertable, array ('FlatViewDataGenerator','sort_by_first_name')); |
|
817 | + usort($usertable, array('FlatViewDataGenerator', 'sort_by_first_name')); |
|
818 | 818 | |
819 | 819 | // generate actual data array |
820 | 820 | $scoredisplay = ScoreDisplay :: instance(); |
821 | 821 | $data = array(); |
822 | 822 | $selected_users = $usertable; |
823 | 823 | foreach ($selected_users as $user) { |
824 | - $row = array (); |
|
825 | - $row[] = $user[0]; // user id |
|
824 | + $row = array(); |
|
825 | + $row[] = $user[0]; // user id |
|
826 | 826 | $item_value = 0; |
827 | 827 | $item_total = 0; |
828 | 828 | $final_score = 0; |
@@ -843,8 +843,8 @@ discard block |
||
843 | 843 | $divide = $score[1] == 0 ? 1 : $score[1]; |
844 | 844 | |
845 | 845 | //$sub_cat_percentage = $sum_categories_weight_array[$sub_cat->get_id()]; |
846 | - $item_value = $score[0]/$divide*$main_weight; |
|
847 | - $item_total += $sub_cat->get_weight(); |
|
846 | + $item_value = $score[0] / $divide * $main_weight; |
|
847 | + $item_total += $sub_cat->get_weight(); |
|
848 | 848 | |
849 | 849 | $row[] = array( |
850 | 850 | $item_value, |
@@ -861,23 +861,23 @@ discard block |
||
861 | 861 | trim($scoredisplay->display_score($total_score, SCORE_CUSTOM, null, true)) |
862 | 862 | ); |
863 | 863 | } else { |
864 | - for ($count=0;$count < count($this->evals_links); $count++) { |
|
864 | + for ($count = 0; $count < count($this->evals_links); $count++) { |
|
865 | 865 | $item = $this->evals_links [$count]; |
866 | 866 | $score = $item->calc_score($user[0]); |
867 | 867 | $divide = ($score[1]) == 0 ? 1 : $score[1]; |
868 | 868 | $item_value += $score[0] / $divide * $item->get_weight(); |
869 | - $item_total+=$item->get_weight(); |
|
870 | - $score_denom=($score[1]==0) ? 1 : $score[1]; |
|
869 | + $item_total += $item->get_weight(); |
|
870 | + $score_denom = ($score[1] == 0) ? 1 : $score[1]; |
|
871 | 871 | $score_final = ($score[0] / $score_denom) * 100; |
872 | - $row[] = array ($score_final, trim($scoredisplay->display_score($score, SCORE_CUSTOM,null, true))); |
|
872 | + $row[] = array($score_final, trim($scoredisplay->display_score($score, SCORE_CUSTOM, null, true))); |
|
873 | 873 | |
874 | 874 | } |
875 | - $total_score=array($item_value,$item_total); |
|
875 | + $total_score = array($item_value, $item_total); |
|
876 | 876 | $score_final = ($item_value / $item_total) * 100; |
877 | 877 | if ($displayWarning) { |
878 | - Display::display_warning_message( Display::display_warning_message($total_score[1])); |
|
878 | + Display::display_warning_message(Display::display_warning_message($total_score[1])); |
|
879 | 879 | } |
880 | - $row[] =array ($score_final, trim($scoredisplay->display_score($total_score, SCORE_CUSTOM, null, true))); |
|
880 | + $row[] = array($score_final, trim($scoredisplay->display_score($total_score, SCORE_CUSTOM, null, true))); |
|
881 | 881 | } |
882 | 882 | |
883 | 883 | $data[] = $row; |