@@ -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); |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | api_protect_admin_script(); |
20 | 20 | |
21 | 21 | // Setting breadcrumbs. |
22 | -$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
23 | -$interbreadcrumb[] = array ('url' => 'class_list.php', 'name' => get_lang('AdminClasses')); |
|
22 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
23 | +$interbreadcrumb[] = array('url' => 'class_list.php', 'name' => get_lang('AdminClasses')); |
|
24 | 24 | |
25 | 25 | |
26 | 26 | // Setting the name of the tool. |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | $class_id = intval($_GET['idclass']); |
31 | 31 | $class = ClassManager :: get_class_info($class_id); |
32 | 32 | $form = new FormValidator('edit_class', 'post', 'class_edit.php?idclass='.$class_id); |
33 | -$form->addText('name',get_lang('ClassName')); |
|
33 | +$form->addText('name', get_lang('ClassName')); |
|
34 | 34 | $form->addButtonUpdate(get_lang('Ok')); |
35 | 35 | $form->setDefaults(array('name'=>$class['name'])); |
36 | -if($form->validate()) |
|
36 | +if ($form->validate()) |
|
37 | 37 | { |
38 | 38 | $values = $form->exportValues(); |
39 | 39 | ClassManager :: set_name($values['name'], $class_id); |
@@ -87,7 +87,7 @@ |
||
87 | 87 | $from = intval($from); |
88 | 88 | $number_of_items = intval($number_of_items); |
89 | 89 | $column = intval($column); |
90 | - $direction = !in_array(strtolower(trim($direction)), ['asc','desc']) ? 'asc' : $direction; |
|
90 | + $direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction; |
|
91 | 91 | |
92 | 92 | $sql = "SELECT |
93 | 93 | id AS col0, |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * Code |
10 | 10 | */ |
11 | 11 | // resetting the course id |
12 | -$cidReset=true; |
|
12 | +$cidReset = true; |
|
13 | 13 | require_once('../inc/global.inc.php'); |
14 | 14 | // setting the section (for the tabs) |
15 | 15 | $this_section = SECTION_PLATFORM_ADMIN; |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | api_protect_admin_script(); |
19 | 19 | require('../auth/ldap/authldap.php'); |
20 | 20 | |
21 | -$annee_base=date('Y'); |
|
21 | +$annee_base = date('Y'); |
|
22 | 22 | |
23 | 23 | $tool_name = get_lang('LDAPImport'); |
24 | 24 | // setting breadcrumbs |
25 | -$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin')); |
|
25 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
26 | 26 | |
27 | 27 | $htmlHeadXtra[] = '<script language="JavaScript" type="text/javascript"> |
28 | 28 | var buttoncheck = 1; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | $annee = $_GET['annee']; |
50 | 50 | $composante = $_GET['composante']; |
51 | -$etape = $_GET['etape']; |
|
51 | +$etape = $_GET['etape']; |
|
52 | 52 | $course = $_POST['course']; |
53 | 53 | |
54 | 54 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | echo '</div>'; |
199 | 199 | } |
200 | 200 | */ |
201 | -elseif(!empty($annee) && empty($course)) |
|
201 | +elseif (!empty($annee) && empty($course)) |
|
202 | 202 | { |
203 | 203 | Display::display_header($tool_name); |
204 | 204 | echo '<div style="align:center">'; |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />'; |
207 | 207 | echo '<select name="course">'; |
208 | 208 | $courses = CourseManager::get_courses_list(); |
209 | - foreach($courses as $row) |
|
209 | + foreach ($courses as $row) |
|
210 | 210 | { |
211 | 211 | echo '<option value="'.$row['code'].'">'.api_htmlentities($row['title']).'</option>'; |
212 | 212 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | |
240 | 240 | $info = ldap_get_entries($ds, $sr); |
241 | 241 | |
242 | - for ($key = 0; $key < $info["count"]; $key ++) { |
|
242 | + for ($key = 0; $key < $info["count"]; $key++) { |
|
243 | 243 | $nom_form[] = $info[$key]["sn"][0]; |
244 | 244 | $prenom_form[] = $info[$key]["givenname"][0]; |
245 | 245 | $email_form[] = $info[$key]["mail"][0]; |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | asort($nom_form); |
260 | 260 | reset($nom_form); |
261 | 261 | |
262 | - $statut=5; |
|
262 | + $statut = 5; |
|
263 | 263 | include ('ldap_form_add_users_group.php'); |
264 | 264 | } else { |
265 | 265 | echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>'; |
@@ -270,25 +270,25 @@ discard block |
||
270 | 270 | echo '</div>'; |
271 | 271 | |
272 | 272 | } |
273 | -elseif (!empty($annee) && !empty($course) && ($_POST['confirmed']=='yes')) |
|
273 | +elseif (!empty($annee) && !empty($course) && ($_POST['confirmed'] == 'yes')) |
|
274 | 274 | { |
275 | - $id=$_POST['username_form']; |
|
276 | - $UserList=array(); |
|
275 | + $id = $_POST['username_form']; |
|
276 | + $UserList = array(); |
|
277 | 277 | $userid_match_login = array(); |
278 | 278 | foreach ($id as $form_index=>$user_id) |
279 | 279 | { |
280 | - if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes']))) |
|
280 | + if (is_array($_POST['checkboxes']) && in_array($form_index, array_values($_POST['checkboxes']))) |
|
281 | 281 | { |
282 | 282 | $tmp = ldap_add_user($user_id); |
283 | - $UserList[]= $tmp; |
|
283 | + $UserList[] = $tmp; |
|
284 | 284 | $userid_match_login[$tmp] = $user_id; |
285 | 285 | } |
286 | 286 | } |
287 | 287 | if (!empty($_POST['course'])) |
288 | 288 | { |
289 | - foreach($UserList as $user_id) |
|
289 | + foreach ($UserList as $user_id) |
|
290 | 290 | { |
291 | - CourseManager::add_user_to_course($user_id,$_POST['course']); |
|
291 | + CourseManager::add_user_to_course($user_id, $_POST['course']); |
|
292 | 292 | } |
293 | 293 | header('Location: course_information.php?code='.Security::remove_XSS($_POST['course'])); |
294 | 294 | } |
@@ -314,8 +314,8 @@ discard block |
||
314 | 314 | else |
315 | 315 | { |
316 | 316 | Display::display_header($tool_name); |
317 | - $message=get_lang('NoUserAdded'); |
|
318 | - Display :: display_normal_message($message,false); |
|
317 | + $message = get_lang('NoUserAdded'); |
|
318 | + Display :: display_normal_message($message, false); |
|
319 | 319 | } |
320 | 320 | echo '<br /><br />'; |
321 | 321 | echo '<a href="ldap_import_students.php?annee=&composante=&etape=">'.get_lang('BackToNewSearch').'</a>'; |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | $tbl_course = Database:: get_main_table(TABLE_MAIN_COURSE); |
31 | 31 | |
32 | 32 | $tool_name = get_lang('AddUserGroupToURL'); |
33 | -$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
34 | -$interbreadcrumb[] = array ('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')); |
|
33 | +$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
34 | +$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs')); |
|
35 | 35 | |
36 | 36 | Display::display_header($tool_name); |
37 | 37 | |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | |
47 | 47 | if (isset($_POST['form_sent']) && $_POST['form_sent']) { |
48 | 48 | $form_sent = $_POST['form_sent']; |
49 | - $userGroups = is_array($_POST['user_group_list']) ? $_POST['user_group_list'] : array() ; |
|
50 | - $urlList = is_array($_POST['url_list']) ? $_POST['url_list'] : array() ; |
|
49 | + $userGroups = is_array($_POST['user_group_list']) ? $_POST['user_group_list'] : array(); |
|
50 | + $urlList = is_array($_POST['url_list']) ? $_POST['url_list'] : array(); |
|
51 | 51 | $firstLetterUserGroup = $_POST['first_letter_user_group']; |
52 | 52 | |
53 | 53 | if ($form_sent == 1) { |
@@ -25,13 +25,13 @@ discard block |
||
25 | 25 | if ($form->validate()) { |
26 | 26 | $check = Security::check_token('post'); |
27 | 27 | if ($check) { |
28 | - $values = $form->getSubmitValues(); |
|
29 | - $lang = $values['language']; |
|
28 | + $values = $form->getSubmitValues(); |
|
29 | + $lang = $values['language']; |
|
30 | 30 | //language id |
31 | 31 | $lang = api_get_language_id($lang); |
32 | 32 | |
33 | 33 | if (isset($values['type'])) { |
34 | - $type = $values['type']; |
|
34 | + $type = $values['type']; |
|
35 | 35 | } else { |
36 | 36 | $type = 0; |
37 | 37 | } |
@@ -47,13 +47,13 @@ discard block |
||
47 | 47 | } |
48 | 48 | $navigator_info = api_get_navigator(); |
49 | 49 | |
50 | - if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') { |
|
50 | + if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') { |
|
51 | 51 | if (isset($values['preview'])) { |
52 | - $submit ='preview'; |
|
52 | + $submit = 'preview'; |
|
53 | 53 | } elseif (isset($values['save'])) { |
54 | - $submit ='save'; |
|
54 | + $submit = 'save'; |
|
55 | 55 | } elseif (isset($values['back'])) { |
56 | - $submit ='back'; |
|
56 | + $submit = 'back'; |
|
57 | 57 | } |
58 | 58 | } else { |
59 | 59 | $submit = $values['send']; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | exit; |
67 | 67 | } elseif ($submit == 'save') { |
68 | 68 | $insert_result = LegalManager::add($lang, $content, $type, $changes); |
69 | - if ($insert_result ) { |
|
69 | + if ($insert_result) { |
|
70 | 70 | $message = get_lang('TermAndConditionSaved'); |
71 | 71 | } else { |
72 | 72 | $message = get_lang('TermAndConditionNotSaved'); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $tok = Security::get_token(); |
76 | 76 | header('Location: legal_list.php?action=show_message&message='.urlencode($message).'&sec_token='.$tok); |
77 | 77 | exit(); |
78 | - } elseif ($submit=='preview') { |
|
78 | + } elseif ($submit == 'preview') { |
|
79 | 79 | $defaults['type'] = $type; |
80 | 80 | $defaults['content'] = $content; |
81 | 81 | $defaults['changes'] = $changes; |
@@ -83,16 +83,16 @@ discard block |
||
83 | 83 | $term_preview['type'] = intval($_POST['type']); |
84 | 84 | } else { |
85 | 85 | $my_lang = $_POST['language']; |
86 | - if (isset($_POST['language'])){ |
|
86 | + if (isset($_POST['language'])) { |
|
87 | 87 | $all_langs = api_get_languages(); |
88 | - if (in_array($my_lang, $all_langs['folder'])){ |
|
88 | + if (in_array($my_lang, $all_langs['folder'])) { |
|
89 | 89 | $language = api_get_language_id($my_lang); |
90 | 90 | $term_preview = LegalManager::get_last_condition($language); |
91 | 91 | $defaults = $term_preview; |
92 | 92 | if (!$term_preview) { |
93 | 93 | // there are not terms and conditions |
94 | - $term_preview['type']=-1; |
|
95 | - $defaults['type']=0; |
|
94 | + $term_preview['type'] = -1; |
|
95 | + $defaults['type'] = 0; |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | } |
109 | 109 | $token = Security::get_token(); |
110 | 110 | |
111 | -$form->addElement('hidden','sec_token'); |
|
111 | +$form->addElement('hidden', 'sec_token'); |
|
112 | 112 | //$form->setConstants(array('sec_token' => $token)); |
113 | 113 | $defaults['sec_token'] = $token; |
114 | 114 | $form->addElement('header', get_lang('DisplayTermsConditions')); |
@@ -116,24 +116,24 @@ discard block |
||
116 | 116 | if (isset($_POST['language'])) { |
117 | 117 | |
118 | 118 | $form->addElement('static', Security::remove_XSS($_POST['language'])); |
119 | - $form->addElement('hidden', 'language',Security::remove_XSS($_POST['language'])); |
|
119 | + $form->addElement('hidden', 'language', Security::remove_XSS($_POST['language'])); |
|
120 | 120 | $form->addHtmlEditor('content', get_lang('Content'), true, false, array('ToolbarSet' => 'terms_and_conditions', 'Width' => '100%', 'Height' => '250')); |
121 | 121 | |
122 | - $form->addElement('radio', 'type', '', get_lang('HTMLText') ,'0'); |
|
123 | - $form->addElement('radio', 'type', '', get_lang('PageLink') ,'1'); |
|
124 | - $form->addElement('textarea', 'changes', get_lang('ExplainChanges'),array('width'=>'20')); |
|
122 | + $form->addElement('radio', 'type', '', get_lang('HTMLText'), '0'); |
|
123 | + $form->addElement('radio', 'type', '', get_lang('PageLink'), '1'); |
|
124 | + $form->addElement('textarea', 'changes', get_lang('ExplainChanges'), array('width'=>'20')); |
|
125 | 125 | |
126 | 126 | $preview = LegalManager::show_last_condition($term_preview); |
127 | 127 | |
128 | - if ($term_preview['type']!=-1) { |
|
129 | - $form->addElement('label', get_lang('Preview'), $preview); |
|
128 | + if ($term_preview['type'] != -1) { |
|
129 | + $form->addElement('label', get_lang('Preview'), $preview); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | // Submit & preview button |
133 | 133 | $navigator_info = api_get_navigator(); |
134 | 134 | |
135 | 135 | //ie6 fix |
136 | - if ($navigator_info['name']=='Internet Explorer' && $navigator_info['version']=='6') { |
|
136 | + if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') { |
|
137 | 137 | $buttons = '<div class="row" align="center"> |
138 | 138 | <div class="formw"> |
139 | 139 | <input type="submit" name="back" value="'.get_lang('Back').'"/> |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | <input type="submit" name="save" value="'.get_lang('Save').'"/> |
142 | 142 | </div> |
143 | 143 | </div>'; |
144 | - $form->addElement('html',$buttons); |
|
144 | + $form->addElement('html', $buttons); |
|
145 | 145 | } else { |
146 | 146 | $buttons = '<div class="row" align="center"> |
147 | 147 | <div class="formw"> |
@@ -150,16 +150,16 @@ discard block |
||
150 | 150 | <button type="submit" class="save" name="send" value="save">'.get_lang('Save').'</button> |
151 | 151 | </div> |
152 | 152 | </div>'; |
153 | - $form->addElement('html',$buttons); |
|
153 | + $form->addElement('html', $buttons); |
|
154 | 154 | } |
155 | 155 | } else { |
156 | - $form->addElement('select_language', 'language', get_lang('Language'),null,array()); |
|
156 | + $form->addElement('select_language', 'language', get_lang('Language'), null, array()); |
|
157 | 157 | $form->addElement('button', 'send', get_lang('Load')); |
158 | 158 | |
159 | 159 | } |
160 | 160 | |
161 | 161 | $tool_name = get_lang('AddTermsAndConditions'); |
162 | -$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
162 | +$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
163 | 163 | Display :: display_header($tool_name); |
164 | 164 | |
165 | 165 | echo '<script> |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | |
173 | 173 | // action menu |
174 | 174 | echo '<div class="actions">'; |
175 | -echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/legal_list.php">'.Display::return_icon('search.gif',get_lang('EditTermsAndConditions'),'').get_lang('AllVersions').'</a>'; |
|
175 | +echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/legal_list.php">'.Display::return_icon('search.gif', get_lang('EditTermsAndConditions'), '').get_lang('AllVersions').'</a>'; |
|
176 | 176 | echo '</div>'; |
177 | 177 | |
178 | 178 | if (isset ($_GET['action'])) { |