@@ -95,7 +95,7 @@ |
||
95 | 95 | |
96 | 96 | /** |
97 | 97 | * Get the progress of this learnpath. Only the last attempt are taken into account. |
98 | - * @param $stud_id student id (default: all students who have results - then the average is returned) |
|
98 | + * @param integer $stud_id student id (default: all students who have results - then the average is returned) |
|
99 | 99 | * @return array (score, max) if student is given |
100 | 100 | * array (sum of scores, number of scores) otherwise |
101 | 101 | * or null if no scores available |
@@ -29,8 +29,9 @@ discard block |
||
29 | 29 | public function get_not_created_links() |
30 | 30 | { |
31 | 31 | return false; |
32 | - if (empty($this->course_code)) |
|
33 | - die('Error in get_not_created_links() : course code not set'); |
|
32 | + if (empty($this->course_code)) { |
|
33 | + die('Error in get_not_created_links() : course code not set'); |
|
34 | + } |
|
34 | 35 | |
35 | 36 | $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
36 | 37 | |
@@ -57,8 +58,9 @@ discard block |
||
57 | 58 | */ |
58 | 59 | public function get_all_links() |
59 | 60 | { |
60 | - if (empty($this->course_code)) |
|
61 | - die('Error in get_not_created_links() : course code not set'); |
|
61 | + if (empty($this->course_code)) { |
|
62 | + die('Error in get_not_created_links() : course code not set'); |
|
63 | + } |
|
62 | 64 | |
63 | 65 | $session_id = api_get_session_id(); |
64 | 66 | if (empty($session_id)) { |
@@ -111,8 +113,9 @@ discard block |
||
111 | 113 | lp_id = ".$this->get_ref_id()." AND |
112 | 114 | session_id = $session_id "; |
113 | 115 | |
114 | - if (isset($stud_id)) |
|
115 | - $sql .= ' AND user_id = '.intval($stud_id); |
|
116 | + if (isset($stud_id)) { |
|
117 | + $sql .= ' AND user_id = '.intval($stud_id); |
|
118 | + } |
|
116 | 119 | |
117 | 120 | // order by id, that way the student's first attempt is accessed first |
118 | 121 | $sql .= ' ORDER BY view_count DESC'; |
@@ -122,8 +125,9 @@ discard block |
||
122 | 125 | if (isset($stud_id)) { |
123 | 126 | if ($data = Database::fetch_array($scores)) { |
124 | 127 | return array ($data['progress'], 100); |
125 | - } else |
|
126 | - return null; |
|
128 | + } else { |
|
129 | + return null; |
|
130 | + } |
|
127 | 131 | } else { |
128 | 132 | // all students -> get average |
129 | 133 | $students = array(); // user list, needed to make sure we only |
@@ -9,261 +9,261 @@ |
||
9 | 9 | */ |
10 | 10 | class LearnpathLink extends AbstractLink |
11 | 11 | { |
12 | - private $course_info = null; |
|
13 | - private $learnpath_table = null; |
|
14 | - private $learnpath_data = null; |
|
15 | - |
|
16 | - /** |
|
17 | - * Constructor |
|
18 | - */ |
|
19 | - public function __construct() |
|
20 | - { |
|
21 | - parent::__construct(); |
|
22 | - $this->set_type(LINK_LEARNPATH); |
|
23 | - } |
|
24 | - |
|
25 | - /** |
|
26 | - * Generate an array of learnpaths that a teacher hasn't created a link for. |
|
27 | - * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
28 | - */ |
|
29 | - public function get_not_created_links() |
|
30 | - { |
|
31 | - return false; |
|
32 | - if (empty($this->course_code)) |
|
33 | - die('Error in get_not_created_links() : course code not set'); |
|
34 | - |
|
35 | - $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
|
36 | - |
|
37 | - $sql = 'SELECT id, name from '.$this->get_learnpath_table().' lp |
|
12 | + private $course_info = null; |
|
13 | + private $learnpath_table = null; |
|
14 | + private $learnpath_data = null; |
|
15 | + |
|
16 | + /** |
|
17 | + * Constructor |
|
18 | + */ |
|
19 | + public function __construct() |
|
20 | + { |
|
21 | + parent::__construct(); |
|
22 | + $this->set_type(LINK_LEARNPATH); |
|
23 | + } |
|
24 | + |
|
25 | + /** |
|
26 | + * Generate an array of learnpaths that a teacher hasn't created a link for. |
|
27 | + * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
28 | + */ |
|
29 | + public function get_not_created_links() |
|
30 | + { |
|
31 | + return false; |
|
32 | + if (empty($this->course_code)) |
|
33 | + die('Error in get_not_created_links() : course code not set'); |
|
34 | + |
|
35 | + $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
|
36 | + |
|
37 | + $sql = 'SELECT id, name from '.$this->get_learnpath_table().' lp |
|
38 | 38 | WHERE c_id = '.$this->course_id.' AND id NOT IN ' |
39 | - .' (SELECT ref_id FROM '.$tbl_grade_links |
|
40 | - .' WHERE type = '.LINK_LEARNPATH |
|
41 | - ." AND course_code = '".$this->get_course_code()."'" |
|
42 | - .') AND lp.session_id='.api_get_session_id().''; |
|
43 | - |
|
44 | - $result = Database::query($sql); |
|
45 | - |
|
46 | - $cats=array(); |
|
47 | - while ($data=Database::fetch_array($result)) { |
|
48 | - $cats[] = array ($data['id'], $data['name']); |
|
49 | - } |
|
50 | - |
|
51 | - return $cats; |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * Generate an array of all learnpaths available. |
|
56 | - * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
57 | - */ |
|
58 | - public function get_all_links() |
|
59 | - { |
|
60 | - if (empty($this->course_code)) |
|
61 | - die('Error in get_not_created_links() : course code not set'); |
|
62 | - |
|
63 | - $session_id = api_get_session_id(); |
|
64 | - if (empty($session_id)) { |
|
65 | - $session_condition = api_get_session_condition(0, true); |
|
66 | - } else { |
|
67 | - $session_condition = api_get_session_condition($session_id, true, true); |
|
68 | - } |
|
69 | - |
|
70 | - $sql = 'SELECT id, name FROM '.$this->get_learnpath_table().' |
|
39 | + .' (SELECT ref_id FROM '.$tbl_grade_links |
|
40 | + .' WHERE type = '.LINK_LEARNPATH |
|
41 | + ." AND course_code = '".$this->get_course_code()."'" |
|
42 | + .') AND lp.session_id='.api_get_session_id().''; |
|
43 | + |
|
44 | + $result = Database::query($sql); |
|
45 | + |
|
46 | + $cats=array(); |
|
47 | + while ($data=Database::fetch_array($result)) { |
|
48 | + $cats[] = array ($data['id'], $data['name']); |
|
49 | + } |
|
50 | + |
|
51 | + return $cats; |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * Generate an array of all learnpaths available. |
|
56 | + * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
57 | + */ |
|
58 | + public function get_all_links() |
|
59 | + { |
|
60 | + if (empty($this->course_code)) |
|
61 | + die('Error in get_not_created_links() : course code not set'); |
|
62 | + |
|
63 | + $session_id = api_get_session_id(); |
|
64 | + if (empty($session_id)) { |
|
65 | + $session_condition = api_get_session_condition(0, true); |
|
66 | + } else { |
|
67 | + $session_condition = api_get_session_condition($session_id, true, true); |
|
68 | + } |
|
69 | + |
|
70 | + $sql = 'SELECT id, name FROM '.$this->get_learnpath_table().' |
|
71 | 71 | WHERE c_id = '.$this->course_id.' '.$session_condition.' '; |
72 | - $result = Database::query($sql); |
|
72 | + $result = Database::query($sql); |
|
73 | 73 | |
74 | - $cats = array(); |
|
75 | - while ($data=Database::fetch_array($result)) { |
|
76 | - $cats[] = array ($data['id'], $data['name']); |
|
77 | - } |
|
74 | + $cats = array(); |
|
75 | + while ($data=Database::fetch_array($result)) { |
|
76 | + $cats[] = array ($data['id'], $data['name']); |
|
77 | + } |
|
78 | 78 | |
79 | - return $cats; |
|
80 | - } |
|
79 | + return $cats; |
|
80 | + } |
|
81 | 81 | |
82 | 82 | |
83 | - /** |
|
84 | - * Has anyone used this learnpath yet ? |
|
85 | - */ |
|
86 | - public function has_results() |
|
87 | - { |
|
88 | - $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); |
|
89 | - $sql = "SELECT count(id) AS number FROM $tbl_stats |
|
83 | + /** |
|
84 | + * Has anyone used this learnpath yet ? |
|
85 | + */ |
|
86 | + public function has_results() |
|
87 | + { |
|
88 | + $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); |
|
89 | + $sql = "SELECT count(id) AS number FROM $tbl_stats |
|
90 | 90 | WHERE c_id = ".$this->course_id." AND lp_id = ".$this->get_ref_id(); |
91 | - $result = Database::query($sql); |
|
92 | - $number = Database::fetch_array($result,'NUM'); |
|
93 | - return ($number[0] != 0); |
|
94 | - } |
|
95 | - |
|
96 | - /** |
|
97 | - * Get the progress of this learnpath. Only the last attempt are taken into account. |
|
98 | - * @param $stud_id student id (default: all students who have results - then the average is returned) |
|
99 | - * @return array (score, max) if student is given |
|
100 | - * array (sum of scores, number of scores) otherwise |
|
101 | - * or null if no scores available |
|
102 | - */ |
|
103 | - public function calc_score($stud_id = null, $type = null) |
|
104 | - { |
|
105 | - $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); |
|
106 | - $session_id = api_get_session_id(); |
|
107 | - |
|
108 | - $sql = "SELECT * FROM $tbl_stats |
|
91 | + $result = Database::query($sql); |
|
92 | + $number = Database::fetch_array($result,'NUM'); |
|
93 | + return ($number[0] != 0); |
|
94 | + } |
|
95 | + |
|
96 | + /** |
|
97 | + * Get the progress of this learnpath. Only the last attempt are taken into account. |
|
98 | + * @param $stud_id student id (default: all students who have results - then the average is returned) |
|
99 | + * @return array (score, max) if student is given |
|
100 | + * array (sum of scores, number of scores) otherwise |
|
101 | + * or null if no scores available |
|
102 | + */ |
|
103 | + public function calc_score($stud_id = null, $type = null) |
|
104 | + { |
|
105 | + $tbl_stats = Database::get_course_table(TABLE_LP_VIEW); |
|
106 | + $session_id = api_get_session_id(); |
|
107 | + |
|
108 | + $sql = "SELECT * FROM $tbl_stats |
|
109 | 109 | WHERE |
110 | 110 | c_id = ".$this->course_id." AND |
111 | 111 | lp_id = ".$this->get_ref_id()." AND |
112 | 112 | session_id = $session_id "; |
113 | 113 | |
114 | - if (isset($stud_id)) |
|
115 | - $sql .= ' AND user_id = '.intval($stud_id); |
|
116 | - |
|
117 | - // order by id, that way the student's first attempt is accessed first |
|
118 | - $sql .= ' ORDER BY view_count DESC'; |
|
119 | - |
|
120 | - $scores = Database::query($sql); |
|
121 | - // for 1 student |
|
122 | - if (isset($stud_id)) { |
|
123 | - if ($data = Database::fetch_assoc($scores)) { |
|
124 | - return array ($data['progress'], 100); |
|
125 | - } else |
|
126 | - return null; |
|
127 | - } else { |
|
128 | - // all students -> get average |
|
129 | - $students = array(); // user list, needed to make sure we only |
|
130 | - // take first attempts into account |
|
131 | - $rescount = 0; |
|
132 | - $sum = 0; |
|
133 | - $bestResult = 0; |
|
134 | - $sumResult = 0; |
|
135 | - while ($data = Database::fetch_array($scores)) { |
|
136 | - if (!(array_key_exists($data['user_id'], $students))) { |
|
137 | - $students[$data['user_id']] = $data['progress']; |
|
138 | - $rescount++; |
|
139 | - $sum += $data['progress'] / 100; |
|
140 | - $sumResult += $data['progress']; |
|
141 | - |
|
142 | - if ($data['progress'] > $bestResult) { |
|
143 | - $bestResult = $data['progress']; |
|
144 | - } |
|
145 | - } |
|
146 | - } |
|
147 | - |
|
148 | - if ($rescount == 0) { |
|
149 | - return null; |
|
150 | - } else { |
|
151 | - |
|
152 | - switch ($type) { |
|
153 | - case 'best': |
|
154 | - return array($bestResult, 100); |
|
155 | - break; |
|
156 | - case 'average': |
|
157 | - return array($sumResult/$rescount, 100); |
|
158 | - break; |
|
159 | - case 'ranking': |
|
160 | - return AbstractLink::getCurrentUserRanking($stud_id, $students); |
|
161 | - break; |
|
162 | - default: |
|
163 | - return array($sum, $rescount); |
|
164 | - break; |
|
165 | - } |
|
166 | - } |
|
167 | - } |
|
168 | - } |
|
169 | - |
|
170 | - /** |
|
171 | - * Get URL where to go to if the user clicks on the link. |
|
172 | - */ |
|
173 | - public function get_link() |
|
174 | - { |
|
175 | - $session_id = api_get_session_id(); |
|
176 | - $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq_params($this->get_course_code(), $session_id).'&gradebook=view'; |
|
177 | - |
|
178 | - if (!api_is_allowed_to_edit() || $this->calc_score(api_get_user_id()) == null) { |
|
179 | - $url .= '&action=view&lp_id='.$this->get_ref_id(); |
|
180 | - } else { |
|
181 | - $url .= '&action=build&lp_id='.$this->get_ref_id(); |
|
182 | - } |
|
183 | - return $url; |
|
184 | - } |
|
185 | - |
|
186 | - /** |
|
187 | - * Get name to display: same as learnpath title |
|
188 | - */ |
|
189 | - public function get_name() |
|
190 | - { |
|
191 | - $data = $this->get_learnpath_data(); |
|
192 | - return $data['name']; |
|
193 | - } |
|
194 | - |
|
195 | - /** |
|
196 | - * Get description to display: same as learnpath description |
|
197 | - */ |
|
198 | - public function get_description() |
|
199 | - { |
|
200 | - $data = $this->get_learnpath_data(); |
|
201 | - return $data['description']; |
|
202 | - } |
|
203 | - |
|
204 | - /** |
|
205 | - * Check if this still links to a learnpath |
|
206 | - */ |
|
207 | - public function is_valid_link() { |
|
208 | - $sql = 'SELECT count(id) FROM '.$this->get_learnpath_table().' |
|
114 | + if (isset($stud_id)) |
|
115 | + $sql .= ' AND user_id = '.intval($stud_id); |
|
116 | + |
|
117 | + // order by id, that way the student's first attempt is accessed first |
|
118 | + $sql .= ' ORDER BY view_count DESC'; |
|
119 | + |
|
120 | + $scores = Database::query($sql); |
|
121 | + // for 1 student |
|
122 | + if (isset($stud_id)) { |
|
123 | + if ($data = Database::fetch_assoc($scores)) { |
|
124 | + return array ($data['progress'], 100); |
|
125 | + } else |
|
126 | + return null; |
|
127 | + } else { |
|
128 | + // all students -> get average |
|
129 | + $students = array(); // user list, needed to make sure we only |
|
130 | + // take first attempts into account |
|
131 | + $rescount = 0; |
|
132 | + $sum = 0; |
|
133 | + $bestResult = 0; |
|
134 | + $sumResult = 0; |
|
135 | + while ($data = Database::fetch_array($scores)) { |
|
136 | + if (!(array_key_exists($data['user_id'], $students))) { |
|
137 | + $students[$data['user_id']] = $data['progress']; |
|
138 | + $rescount++; |
|
139 | + $sum += $data['progress'] / 100; |
|
140 | + $sumResult += $data['progress']; |
|
141 | + |
|
142 | + if ($data['progress'] > $bestResult) { |
|
143 | + $bestResult = $data['progress']; |
|
144 | + } |
|
145 | + } |
|
146 | + } |
|
147 | + |
|
148 | + if ($rescount == 0) { |
|
149 | + return null; |
|
150 | + } else { |
|
151 | + |
|
152 | + switch ($type) { |
|
153 | + case 'best': |
|
154 | + return array($bestResult, 100); |
|
155 | + break; |
|
156 | + case 'average': |
|
157 | + return array($sumResult/$rescount, 100); |
|
158 | + break; |
|
159 | + case 'ranking': |
|
160 | + return AbstractLink::getCurrentUserRanking($stud_id, $students); |
|
161 | + break; |
|
162 | + default: |
|
163 | + return array($sum, $rescount); |
|
164 | + break; |
|
165 | + } |
|
166 | + } |
|
167 | + } |
|
168 | + } |
|
169 | + |
|
170 | + /** |
|
171 | + * Get URL where to go to if the user clicks on the link. |
|
172 | + */ |
|
173 | + public function get_link() |
|
174 | + { |
|
175 | + $session_id = api_get_session_id(); |
|
176 | + $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq_params($this->get_course_code(), $session_id).'&gradebook=view'; |
|
177 | + |
|
178 | + if (!api_is_allowed_to_edit() || $this->calc_score(api_get_user_id()) == null) { |
|
179 | + $url .= '&action=view&lp_id='.$this->get_ref_id(); |
|
180 | + } else { |
|
181 | + $url .= '&action=build&lp_id='.$this->get_ref_id(); |
|
182 | + } |
|
183 | + return $url; |
|
184 | + } |
|
185 | + |
|
186 | + /** |
|
187 | + * Get name to display: same as learnpath title |
|
188 | + */ |
|
189 | + public function get_name() |
|
190 | + { |
|
191 | + $data = $this->get_learnpath_data(); |
|
192 | + return $data['name']; |
|
193 | + } |
|
194 | + |
|
195 | + /** |
|
196 | + * Get description to display: same as learnpath description |
|
197 | + */ |
|
198 | + public function get_description() |
|
199 | + { |
|
200 | + $data = $this->get_learnpath_data(); |
|
201 | + return $data['description']; |
|
202 | + } |
|
203 | + |
|
204 | + /** |
|
205 | + * Check if this still links to a learnpath |
|
206 | + */ |
|
207 | + public function is_valid_link() { |
|
208 | + $sql = 'SELECT count(id) FROM '.$this->get_learnpath_table().' |
|
209 | 209 | WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' '; |
210 | - $result = Database::query($sql); |
|
211 | - $number = Database::fetch_row($result,'NUM'); |
|
212 | - return ($number[0] != 0); |
|
213 | - } |
|
214 | - |
|
215 | - public function get_type_name() |
|
216 | - { |
|
217 | - return get_lang('LearningPaths'); |
|
218 | - } |
|
219 | - |
|
220 | - public function needs_name_and_description() |
|
221 | - { |
|
222 | - return false; |
|
223 | - } |
|
224 | - |
|
225 | - public function needs_max() |
|
226 | - { |
|
227 | - return false; |
|
228 | - } |
|
229 | - |
|
230 | - public function needs_results() |
|
231 | - { |
|
232 | - return false; |
|
233 | - } |
|
234 | - |
|
235 | - public function is_allowed_to_change_name() |
|
236 | - { |
|
237 | - return false; |
|
238 | - } |
|
239 | - |
|
240 | - // INTERNAL FUNCTIONS |
|
241 | - |
|
242 | - /** |
|
243 | - * Lazy load function to get the database table of the learnpath |
|
244 | - */ |
|
245 | - private function get_learnpath_table() |
|
246 | - { |
|
247 | - $this->learnpath_table = Database :: get_course_table(TABLE_LP_MAIN); |
|
248 | - return $this->learnpath_table; |
|
249 | - } |
|
250 | - |
|
251 | - /** |
|
252 | - * Lazy load function to get the database contents of this learnpath |
|
253 | - */ |
|
254 | - private function get_learnpath_data() |
|
255 | - { |
|
256 | - if (!isset($this->learnpath_data)) { |
|
257 | - $sql = 'SELECT * FROM '.$this->get_learnpath_table().' |
|
210 | + $result = Database::query($sql); |
|
211 | + $number = Database::fetch_row($result,'NUM'); |
|
212 | + return ($number[0] != 0); |
|
213 | + } |
|
214 | + |
|
215 | + public function get_type_name() |
|
216 | + { |
|
217 | + return get_lang('LearningPaths'); |
|
218 | + } |
|
219 | + |
|
220 | + public function needs_name_and_description() |
|
221 | + { |
|
222 | + return false; |
|
223 | + } |
|
224 | + |
|
225 | + public function needs_max() |
|
226 | + { |
|
227 | + return false; |
|
228 | + } |
|
229 | + |
|
230 | + public function needs_results() |
|
231 | + { |
|
232 | + return false; |
|
233 | + } |
|
234 | + |
|
235 | + public function is_allowed_to_change_name() |
|
236 | + { |
|
237 | + return false; |
|
238 | + } |
|
239 | + |
|
240 | + // INTERNAL FUNCTIONS |
|
241 | + |
|
242 | + /** |
|
243 | + * Lazy load function to get the database table of the learnpath |
|
244 | + */ |
|
245 | + private function get_learnpath_table() |
|
246 | + { |
|
247 | + $this->learnpath_table = Database :: get_course_table(TABLE_LP_MAIN); |
|
248 | + return $this->learnpath_table; |
|
249 | + } |
|
250 | + |
|
251 | + /** |
|
252 | + * Lazy load function to get the database contents of this learnpath |
|
253 | + */ |
|
254 | + private function get_learnpath_data() |
|
255 | + { |
|
256 | + if (!isset($this->learnpath_data)) { |
|
257 | + $sql = 'SELECT * FROM '.$this->get_learnpath_table().' |
|
258 | 258 | WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' '; |
259 | - $result = Database::query($sql); |
|
260 | - $this->learnpath_data = Database::fetch_array($result); |
|
261 | - } |
|
262 | - return $this->learnpath_data; |
|
263 | - } |
|
264 | - |
|
265 | - public function get_icon_name() |
|
266 | - { |
|
267 | - return 'learnpath'; |
|
268 | - } |
|
259 | + $result = Database::query($sql); |
|
260 | + $this->learnpath_data = Database::fetch_array($result); |
|
261 | + } |
|
262 | + return $this->learnpath_data; |
|
263 | + } |
|
264 | + |
|
265 | + public function get_icon_name() |
|
266 | + { |
|
267 | + return 'learnpath'; |
|
268 | + } |
|
269 | 269 | } |
@@ -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_assoc($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); |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | public function get_link() |
174 | 174 | { |
175 | 175 | $session_id = api_get_session_id(); |
176 | - $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq_params($this->get_course_code(), $session_id).'&gradebook=view'; |
|
176 | + $url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq_params($this->get_course_code(), $session_id).'&gradebook=view'; |
|
177 | 177 | |
178 | 178 | if (!api_is_allowed_to_edit() || $this->calc_score(api_get_user_id()) == null) { |
179 | 179 | $url .= '&action=view&lp_id='.$this->get_ref_id(); |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $sql = 'SELECT count(id) FROM '.$this->get_learnpath_table().' |
209 | 209 | WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' '; |
210 | 210 | $result = Database::query($sql); |
211 | - $number = Database::fetch_row($result,'NUM'); |
|
211 | + $number = Database::fetch_row($result, 'NUM'); |
|
212 | 212 | return ($number[0] != 0); |
213 | 213 | } |
214 | 214 |
@@ -32,6 +32,8 @@ discard block |
||
32 | 32 | * @param array $evals |
33 | 33 | * @param array $links |
34 | 34 | * @param null $addparams |
35 | + * @param boolean $showTeacherView |
|
36 | + * @param integer $userId |
|
35 | 37 | */ |
36 | 38 | public function __construct( |
37 | 39 | $currentcat, |
@@ -895,7 +897,7 @@ discard block |
||
895 | 897 | |
896 | 898 | /** |
897 | 899 | * @param $item |
898 | - * @return mixed |
|
900 | + * @return string|null |
|
899 | 901 | */ |
900 | 902 | private function build_course_code($item) |
901 | 903 | { |
@@ -256,10 +256,11 @@ |
||
256 | 256 | } |
257 | 257 | |
258 | 258 | // Categories. |
259 | - if (!empty($data_array)) |
|
260 | - foreach ($data_array as $data) { |
|
259 | + if (!empty($data_array)) { |
|
260 | + foreach ($data_array as $data) { |
|
261 | 261 | // list of items inside the gradebook (exercises, lps, forums, etc) |
262 | 262 | $row = array(); |
263 | + } |
|
263 | 264 | /** @var AbstractLink $item */ |
264 | 265 | $item = $mainCategory = $data[0]; |
265 | 266 |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $this->set_additional_parameters($addparams); |
72 | 72 | } |
73 | 73 | |
74 | - $column= 0; |
|
74 | + $column = 0; |
|
75 | 75 | if ($this->teacherView) { |
76 | 76 | if ($this->exportToPdf == false) { |
77 | 77 | $this->set_header($column++, '', '', 'width="25px"'); |
@@ -284,13 +284,13 @@ discard block |
||
284 | 284 | $main_categories[$item->get_id()]['name'] = $item->get_name(); |
285 | 285 | } else { |
286 | 286 | $name = $this->build_name_link($item, $type); |
287 | - $row[] = $invisibility_span_open.$name. $invisibility_span_close; |
|
287 | + $row[] = $invisibility_span_open.$name.$invisibility_span_close; |
|
288 | 288 | $main_categories[$item->get_id()]['name'] = $name; |
289 | 289 | } |
290 | 290 | |
291 | 291 | $this->dataForGraph['categories'][] = $item->get_name(); |
292 | 292 | |
293 | - $main_categories[$item->get_id()]['weight']= $item->get_weight(); |
|
293 | + $main_categories[$item->get_id()]['weight'] = $item->get_weight(); |
|
294 | 294 | $total_categories_weight += $item->get_weight(); |
295 | 295 | |
296 | 296 | // Description. |
@@ -310,9 +310,9 @@ discard block |
||
310 | 310 | ); |
311 | 311 | |
312 | 312 | if ($this->teacherView) { |
313 | - $row[] = $invisibility_span_open .Display::tag('p', $weight, array('class' => 'score')).$invisibility_span_close; |
|
313 | + $row[] = $invisibility_span_open.Display::tag('p', $weight, array('class' => 'score')).$invisibility_span_close; |
|
314 | 314 | } else { |
315 | - $row[] = $invisibility_span_open .$weight.$invisibility_span_close; |
|
315 | + $row[] = $invisibility_span_open.$weight.$invisibility_span_close; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | $category_weight = $item->get_weight(); |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | |
339 | 339 | if (!empty($score[1])) { |
340 | 340 | $completeScore = $scoredisplay->display_score($score, SCORE_DIV_PERCENT); |
341 | - $score = $score[0]/$score[1]*$item->get_weight(); |
|
341 | + $score = $score[0] / $score[1] * $item->get_weight(); |
|
342 | 342 | $score = $scoredisplay->display_score(array($score, null), SCORE_SIMPLE); |
343 | 343 | $scoreToDisplay = Display::tip($score, $completeScore); |
344 | 344 | } else { |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | $totalResultAverageValue = strip_tags($scoredisplay->display_score($totalResult, SCORE_AVERAGE)); |
375 | 375 | $this->dataForGraph['my_result'][] = str_replace('%', '', $totalResultAverageValue); |
376 | 376 | $totalAverageValue = strip_tags($scoredisplay->display_score($totalAverage, SCORE_AVERAGE)); |
377 | - $this->dataForGraph['average'][] = str_replace('%', '', $totalAverageValue); |
|
377 | + $this->dataForGraph['average'][] = str_replace('%', '', $totalAverageValue); |
|
378 | 378 | // Ranking |
379 | 379 | $row[] = $ranking; |
380 | 380 | // Best |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | $row[] = $this->build_type_column($item, array('style' => 'padding-left:5px')); |
457 | 457 | |
458 | 458 | // Name. |
459 | - $row[] = $invisibility_span_open." ".$this->build_name_link($item, $type) . $invisibility_span_close; |
|
459 | + $row[] = $invisibility_span_open." ".$this->build_name_link($item, $type).$invisibility_span_close; |
|
460 | 460 | |
461 | 461 | // Description. |
462 | 462 | if ($this->exportToPdf == false) { |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | // Students get the results and certificates columns |
495 | 495 | $eval_n_links = array_merge($alleval, $alllink); |
496 | 496 | |
497 | - if (count($eval_n_links)> 0) { |
|
497 | + if (count($eval_n_links) > 0) { |
|
498 | 498 | $value_data = isset($data[4]) ? $data[4] : null; |
499 | 499 | |
500 | 500 | if (!is_null($value_data)) { |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | $row = array( |
593 | 593 | null, |
594 | 594 | null, |
595 | - '<strong>' . get_lang('Total') . '</strong>', |
|
595 | + '<strong>'.get_lang('Total').'</strong>', |
|
596 | 596 | null, |
597 | 597 | $total |
598 | 598 | ); |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | if ($this->exportToPdf) { |
663 | 663 | $row = array( |
664 | 664 | null, |
665 | - '<h3>' . get_lang('Total') . '</h3>', |
|
665 | + '<h3>'.get_lang('Total').'</h3>', |
|
666 | 666 | $main_weight, |
667 | 667 | $totalResult, |
668 | 668 | $totalRanking, |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | } else { |
673 | 673 | $row = array( |
674 | 674 | null, |
675 | - '<h3>' . get_lang('Total') . '</h3>', |
|
675 | + '<h3>'.get_lang('Total').'</h3>', |
|
676 | 676 | null, |
677 | 677 | $main_weight, |
678 | 678 | $totalResult, |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | } |
688 | 688 | |
689 | 689 | // Warning messages |
690 | - $view = isset($_GET['view']) ? $_GET['view']: null; |
|
690 | + $view = isset($_GET['view']) ? $_GET['view'] : null; |
|
691 | 691 | |
692 | 692 | if ($this->teacherView) { |
693 | 693 | if (isset($_GET['selectcat']) && |
@@ -698,14 +698,14 @@ discard block |
||
698 | 698 | $category = Category::load($id_cat); |
699 | 699 | $weight_category = intval($this->build_weight($category[0])); |
700 | 700 | $course_code = $this->build_course_code($category[0]); |
701 | - $weight_total_links = round($weight_total_links); |
|
701 | + $weight_total_links = round($weight_total_links); |
|
702 | 702 | |
703 | 703 | if ($weight_total_links > $weight_category || |
704 | 704 | $weight_total_links < $weight_category || |
705 | 705 | $weight_total_links > $weight_category |
706 | 706 | ) { |
707 | 707 | $warning_message = sprintf(get_lang('TotalWeightMustBeX'), $weight_category); |
708 | - $modify_icons = '<a href="gradebook_edit_cat.php?editcat='.$id_cat.'&cidReq='.$course_code.'&id_session='.api_get_session_id().'">'. |
|
708 | + $modify_icons = '<a href="gradebook_edit_cat.php?editcat='.$id_cat.'&cidReq='.$course_code.'&id_session='.api_get_session_id().'">'. |
|
709 | 709 | Display::return_icon('edit.png', $warning_message, array(), ICON_SIZE_SMALL).'</a>'; |
710 | 710 | $warning_message .= $modify_icons; |
711 | 711 | Display::display_warning_message($warning_message, false); |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | ); |
719 | 719 | |
720 | 720 | if (!empty($content_html)) { |
721 | - $new_content = explode('</head>',$content_html['content']); |
|
721 | + $new_content = explode('</head>', $content_html['content']); |
|
722 | 722 | } |
723 | 723 | |
724 | 724 | if (empty($new_content[0])) { |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | if (empty($certificate_min_score) || |
761 | 761 | ($certificate_min_score > $weight_category) |
762 | 762 | ) { |
763 | - $warning_message .= $course_code .' - '.get_lang('CertificateMinimunScoreIsRequiredAndMustNotBeMoreThan').' '.$weight_category.'<br />'; |
|
763 | + $warning_message .= $course_code.' - '.get_lang('CertificateMinimunScoreIsRequiredAndMustNotBeMoreThan').' '.$weight_category.'<br />'; |
|
764 | 764 | } |
765 | 765 | } |
766 | 766 | |
@@ -809,12 +809,12 @@ discard block |
||
809 | 809 | $pChart->Antialias = false; |
810 | 810 | |
811 | 811 | /* Add a border to the picture */ |
812 | - $pChart->drawRectangle(0,0,$xSize-10,$ySize-10,array("R"=>0,"G"=>0,"B"=>0)); |
|
813 | - $pChart->drawText(10,16,get_lang('Results'),array("FontSize"=>11,"Align"=> TEXT_ALIGN_BOTTOMMIDDLE)); |
|
814 | - $pChart->setGraphArea(50, 30, $xSize-50, $ySize-50); |
|
812 | + $pChart->drawRectangle(0, 0, $xSize - 10, $ySize - 10, array("R"=>0, "G"=>0, "B"=>0)); |
|
813 | + $pChart->drawText(10, 16, get_lang('Results'), array("FontSize"=>11, "Align"=> TEXT_ALIGN_BOTTOMMIDDLE)); |
|
814 | + $pChart->setGraphArea(50, 30, $xSize - 50, $ySize - 50); |
|
815 | 815 | $pChart->setFontProperties( |
816 | 816 | array( |
817 | - 'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', |
|
817 | + 'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf', |
|
818 | 818 | 'FontSize' => 10, |
819 | 819 | ) |
820 | 820 | ); |
@@ -862,13 +862,13 @@ discard block |
||
862 | 862 | $chartHash = $myCache->getHash($dataSet); |
863 | 863 | |
864 | 864 | $myCache->writeToCache($chartHash, $pChart); |
865 | - $imgSysPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash; |
|
865 | + $imgSysPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash; |
|
866 | 866 | $myCache->saveFromCache($chartHash, $imgSysPath); |
867 | - $imgWebPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash; |
|
867 | + $imgWebPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash; |
|
868 | 868 | |
869 | 869 | if (file_exists($imgSysPath)) { |
870 | 870 | $result = '<div id="contentArea" style="text-align: center;" >'; |
871 | - $result .= '<img src="' . $imgWebPath.'" >'; |
|
871 | + $result .= '<img src="'.$imgWebPath.'" >'; |
|
872 | 872 | $result .= '</div>'; |
873 | 873 | return $result; |
874 | 874 | } |
@@ -913,13 +913,13 @@ discard block |
||
913 | 913 | switch ($item->get_item_type()) { |
914 | 914 | // category |
915 | 915 | case 'C': |
916 | - return 'CATE' . $item->get_id(); |
|
916 | + return 'CATE'.$item->get_id(); |
|
917 | 917 | // evaluation |
918 | 918 | case 'E': |
919 | - return 'EVAL' . $item->get_id(); |
|
919 | + return 'EVAL'.$item->get_id(); |
|
920 | 920 | // link |
921 | 921 | case 'L': |
922 | - return 'LINK' . $item->get_id(); |
|
922 | + return 'LINK'.$item->get_id(); |
|
923 | 923 | } |
924 | 924 | } |
925 | 925 | |
@@ -947,20 +947,20 @@ discard block |
||
947 | 947 | switch ($item->get_item_type()) { |
948 | 948 | // category |
949 | 949 | case 'C': |
950 | - $prms_uri='?selectcat=' . $item->get_id() . '&view='.$view; |
|
950 | + $prms_uri = '?selectcat='.$item->get_id().'&view='.$view; |
|
951 | 951 | |
952 | 952 | if (isset($_GET['isStudentView'])) { |
953 | - if ( isset($is_student) || ( isset($_SESSION['studentview']) && $_SESSION['studentview']=='studentview') ) { |
|
954 | - $prms_uri=$prms_uri.'&isStudentView='.Security::remove_XSS($_GET['isStudentView']); |
|
953 | + if (isset($is_student) || (isset($_SESSION['studentview']) && $_SESSION['studentview'] == 'studentview')) { |
|
954 | + $prms_uri = $prms_uri.'&isStudentView='.Security::remove_XSS($_GET['isStudentView']); |
|
955 | 955 | } |
956 | 956 | } |
957 | 957 | |
958 | 958 | $cat = new Category(); |
959 | - $show_message=$cat->show_message_resource_delete($item->get_course_code()); |
|
959 | + $show_message = $cat->show_message_resource_delete($item->get_course_code()); |
|
960 | 960 | return ' <a href="'.Security::remove_XSS($_SESSION['gradebook_dest']).$prms_uri.'">' |
961 | 961 | . $item->get_name() |
962 | 962 | . '</a>' |
963 | - . ($item->is_course() ? ' [' . $item->get_course_code() . ']'.$show_message : ''); |
|
963 | + . ($item->is_course() ? ' ['.$item->get_course_code().']'.$show_message : ''); |
|
964 | 964 | // evaluation |
965 | 965 | case 'E': |
966 | 966 | $cat = new Category(); |
@@ -968,10 +968,10 @@ discard block |
||
968 | 968 | $show_message = $cat->show_message_resource_delete($course_id); |
969 | 969 | |
970 | 970 | // course/platform admin can go to the view_results page |
971 | - if (api_is_allowed_to_edit() && $show_message===false) { |
|
971 | + if (api_is_allowed_to_edit() && $show_message === false) { |
|
972 | 972 | if ($item->get_type() == 'presence') { |
973 | 973 | return ' ' |
974 | - . '<a href="gradebook_view_result.php?cidReq='.$course_id.'&selecteval=' . $item->get_id() . '">' |
|
974 | + . '<a href="gradebook_view_result.php?cidReq='.$course_id.'&selecteval='.$item->get_id().'">' |
|
975 | 975 | . $item->get_name() |
976 | 976 | . '</a>'; |
977 | 977 | } else { |
@@ -980,20 +980,20 @@ discard block |
||
980 | 980 | $extra = ''; |
981 | 981 | } |
982 | 982 | return ' ' |
983 | - . '<a href="gradebook_view_result.php?' . api_get_cidreq() . '&selecteval=' . $item->get_id() . '">' |
|
983 | + . '<a href="gradebook_view_result.php?'.api_get_cidreq().'&selecteval='.$item->get_id().'">' |
|
984 | 984 | . $item->get_name() |
985 | 985 | . '</a> '.$extra; |
986 | 986 | } |
987 | - } elseif (ScoreDisplay :: instance()->is_custom() && $show_message===false) { |
|
987 | + } elseif (ScoreDisplay :: instance()->is_custom() && $show_message === false) { |
|
988 | 988 | // students can go to the statistics page (if custom display enabled) |
989 | 989 | return ' ' |
990 | - . '<a href="gradebook_statistics.php?' . api_get_cidreq() . '&selecteval=' . $item->get_id() . '">' |
|
990 | + . '<a href="gradebook_statistics.php?'.api_get_cidreq().'&selecteval='.$item->get_id().'">' |
|
991 | 991 | . $item->get_name() |
992 | 992 | . '</a>'; |
993 | 993 | |
994 | 994 | } elseif ($show_message === false && !api_is_allowed_to_edit() && !ScoreDisplay :: instance()->is_custom()) { |
995 | 995 | return ' ' |
996 | - . '<a href="gradebook_statistics.php?' . api_get_cidreq() . '&selecteval=' . $item->get_id() . '">' |
|
996 | + . '<a href="gradebook_statistics.php?'.api_get_cidreq().'&selecteval='.$item->get_id().'">' |
|
997 | 997 | . $item->get_name() |
998 | 998 | . '</a>'; |
999 | 999 | } else { |
@@ -1008,7 +1008,7 @@ discard block |
||
1008 | 1008 | $url = $item->get_link(); |
1009 | 1009 | |
1010 | 1010 | if (isset($url) && $show_message === false) { |
1011 | - $text = ' <a href="' . $item->get_link() . '">' |
|
1011 | + $text = ' <a href="'.$item->get_link().'">' |
|
1012 | 1012 | . $item->get_name() |
1013 | 1013 | . '</a>'; |
1014 | 1014 | } else { |
@@ -351,6 +351,12 @@ |
||
351 | 351 | |
352 | 352 | /** |
353 | 353 | * Additional functions needed for fast integration |
354 | + * @param integer $status |
|
355 | + * @param string $section |
|
356 | + * @param string $title |
|
357 | + * @param string $url |
|
358 | + * @param string|null $formatter |
|
359 | + * @param string $comment |
|
354 | 360 | */ |
355 | 361 | public function build_setting($status, $section, $title, $url, $current_value, $expected_value, $formatter, $comment, $img_path = null) { |
356 | 362 | switch ($status) { |
@@ -401,19 +401,19 @@ |
||
401 | 401 | |
402 | 402 | public function format_yes_no_optional($value) |
403 | 403 | { |
404 | - $return = ''; |
|
405 | - switch($value) { |
|
406 | - case 0: |
|
407 | - $return = get_lang('No'); |
|
408 | - break; |
|
409 | - case 1: |
|
410 | - $return = get_lang('Yes'); |
|
411 | - break; |
|
412 | - case 2: |
|
413 | - $return = get_lang('Optional'); |
|
414 | - break; |
|
415 | - } |
|
416 | - return $return; |
|
404 | + $return = ''; |
|
405 | + switch($value) { |
|
406 | + case 0: |
|
407 | + $return = get_lang('No'); |
|
408 | + break; |
|
409 | + case 1: |
|
410 | + $return = get_lang('Yes'); |
|
411 | + break; |
|
412 | + case 2: |
|
413 | + $return = get_lang('Optional'); |
|
414 | + break; |
|
415 | + } |
|
416 | + return $return; |
|
417 | 417 | |
418 | 418 | } |
419 | 419 |
@@ -158,8 +158,9 @@ discard block |
||
158 | 158 | $array[] = $this->build_setting($status, '[INI]', 'display_errors', 'http://www.php.net/manual/en/ini.core.php#ini.display_errors', $setting, $req_setting, 'on_off', get_lang('DisplayErrorsInfo')); |
159 | 159 | |
160 | 160 | $setting = ini_get('default_charset'); |
161 | - if ($setting == '') |
|
162 | - $setting = null; |
|
161 | + if ($setting == '') { |
|
162 | + $setting = null; |
|
163 | + } |
|
163 | 164 | $req_setting = null; |
164 | 165 | $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_ERROR; |
165 | 166 | $array[] = $this->build_setting($status, '[INI]', 'default_charset', 'http://www.php.net/manual/en/ini.core.php#ini.default-charset', $setting, $req_setting, null, get_lang('DefaultCharsetInfo')); |
@@ -177,22 +178,25 @@ discard block |
||
177 | 178 | $setting = ini_get('memory_limit'); |
178 | 179 | $req_setting = '>= '.REQUIRED_MIN_MEMORY_LIMIT.'M'; |
179 | 180 | $status = self :: STATUS_ERROR; |
180 | - if ((float)$setting >= REQUIRED_MIN_MEMORY_LIMIT) |
|
181 | - $status = self :: STATUS_OK; |
|
181 | + if ((float)$setting >= REQUIRED_MIN_MEMORY_LIMIT) { |
|
182 | + $status = self :: STATUS_OK; |
|
183 | + } |
|
182 | 184 | $array[] = $this->build_setting($status, '[INI]', 'memory_limit', 'http://www.php.net/manual/en/ini.core.php#ini.memory-limit', $setting, $req_setting, null, get_lang('MemoryLimitInfo')); |
183 | 185 | |
184 | 186 | $setting = ini_get('post_max_size'); |
185 | 187 | $req_setting = '>= '.REQUIRED_MIN_POST_MAX_SIZE.'M'; |
186 | 188 | $status = self :: STATUS_ERROR; |
187 | - if ((float)$setting >= REQUIRED_MIN_POST_MAX_SIZE) |
|
188 | - $status = self :: STATUS_OK; |
|
189 | + if ((float)$setting >= REQUIRED_MIN_POST_MAX_SIZE) { |
|
190 | + $status = self :: STATUS_OK; |
|
191 | + } |
|
189 | 192 | $array[] = $this->build_setting($status, '[INI]', 'post_max_size', 'http://www.php.net/manual/en/ini.core.php#ini.post-max-size', $setting, $req_setting, null, get_lang('PostMaxSizeInfo')); |
190 | 193 | |
191 | 194 | $setting = ini_get('upload_max_filesize'); |
192 | 195 | $req_setting = '>= '.REQUIRED_MIN_UPLOAD_MAX_FILESIZE.'M'; |
193 | 196 | $status = self :: STATUS_ERROR; |
194 | - if ((float)$setting >= REQUIRED_MIN_UPLOAD_MAX_FILESIZE) |
|
195 | - $status = self :: STATUS_OK; |
|
197 | + if ((float)$setting >= REQUIRED_MIN_UPLOAD_MAX_FILESIZE) { |
|
198 | + $status = self :: STATUS_OK; |
|
199 | + } |
|
196 | 200 | $array[] = $this->build_setting($status, '[INI]', 'upload_max_filesize', 'http://www.php.net/manual/en/ini.core.php#ini.upload_max_filesize', $setting, $req_setting, null, get_lang('UploadMaxFilesizeInfo')); |
197 | 201 | |
198 | 202 | $setting = ini_get('variables_order'); |
@@ -205,7 +209,7 @@ discard block |
||
205 | 209 | $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_WARNING; |
206 | 210 | $array[] = $this->build_setting($status, '[SESSION]', 'session.gc_maxlifetime', 'http://www.php.net/manual/en/ini.core.php#session.gc-maxlifetime', $setting, $req_setting, null, get_lang('SessionGCMaxLifetimeInfo')); |
207 | 211 | |
208 | - if (api_check_browscap()){$setting = true;}else{$setting=false;} |
|
212 | + if (api_check_browscap()){$setting = true;} else{$setting=false;} |
|
209 | 213 | $req_setting = true; |
210 | 214 | $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_WARNING; |
211 | 215 | $array[] = $this->build_setting($status, '[INI]', 'browscap', 'http://www.php.net/manual/en/misc.configuration.php#ini.browscap', $setting, $req_setting, 'on_off', get_lang('BrowscapInfo')); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | { |
16 | 16 | const STATUS_OK = 1; |
17 | 17 | const STATUS_WARNING = 2; |
18 | - const STATUS_ERROR = 3; |
|
18 | + const STATUS_ERROR = 3; |
|
19 | 19 | const STATUS_INFORMATION = 4; |
20 | 20 | |
21 | 21 | /** |
@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | $html .= '<li>'; |
43 | 43 | } |
44 | 44 | $params['section'] = $section; |
45 | - $html .='<a href="system_status.php?section='.$section.'">'.get_lang($section).'</a></li>'; |
|
45 | + $html .= '<a href="system_status.php?section='.$section.'">'.get_lang($section).'</a></li>'; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | $html .= '</ul><div class="tab-pane">'; |
49 | 49 | |
50 | - $data = call_user_func(array($this, 'get_' . $currentSection . '_data')); |
|
50 | + $data = call_user_func(array($this, 'get_'.$currentSection.'_data')); |
|
51 | 51 | echo $html; |
52 | 52 | |
53 | 53 | if ($currentSection != 'paths') { |
@@ -114,11 +114,11 @@ discard block |
||
114 | 114 | { |
115 | 115 | $array = array(); |
116 | 116 | $writable_folders = array( |
117 | - api_get_path(SYS_APP_PATH) .'cache', |
|
117 | + api_get_path(SYS_APP_PATH).'cache', |
|
118 | 118 | api_get_path(SYS_COURSE_PATH), |
119 | - api_get_path(SYS_APP_PATH) .'home', |
|
120 | - api_get_path(SYS_APP_PATH) .'upload/users/', |
|
121 | - api_get_path(SYS_PATH) .'main/default_course_document/images/', |
|
119 | + api_get_path(SYS_APP_PATH).'home', |
|
120 | + api_get_path(SYS_APP_PATH).'upload/users/', |
|
121 | + api_get_path(SYS_PATH).'main/default_course_document/images/', |
|
122 | 122 | ); |
123 | 123 | foreach ($writable_folders as $index => $folder) { |
124 | 124 | $writable = is_writable($folder); |
@@ -137,10 +137,10 @@ discard block |
||
137 | 137 | |
138 | 138 | $exists = file_exists(api_get_path(SYS_CODE_PATH).'install'); |
139 | 139 | $status = $exists ? self :: STATUS_WARNING : self :: STATUS_OK; |
140 | - $array[] = $this->build_setting($status, '[FILES]', get_lang('DirectoryExists') . ': /install', 'http://be2.php.net/file_exists', $exists, 0, 'yes_no', get_lang('DirectoryShouldBeRemoved')); |
|
140 | + $array[] = $this->build_setting($status, '[FILES]', get_lang('DirectoryExists').': /install', 'http://be2.php.net/file_exists', $exists, 0, 'yes_no', get_lang('DirectoryShouldBeRemoved')); |
|
141 | 141 | |
142 | 142 | $app_version = api_get_setting('chamilo_database_version'); |
143 | - $array[] = $this->build_setting(self :: STATUS_INFORMATION, '[DB]', 'chamilo_database_version', '#', $app_version, 0, null, 'Chamilo DB version'); |
|
143 | + $array[] = $this->build_setting(self :: STATUS_INFORMATION, '[DB]', 'chamilo_database_version', '#', $app_version, 0, null, 'Chamilo DB version'); |
|
144 | 144 | |
145 | 145 | $access_url_id = api_get_current_access_url_id(); |
146 | 146 | |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $message2 .= get_lang('SpaceUsedOnSystemCannotBeMeasuredOnWindows'); |
153 | 153 | } else { |
154 | 154 | $dir = api_get_path(SYS_PATH); |
155 | - $du = exec('du -sh ' . $dir, $err); |
|
155 | + $du = exec('du -sh '.$dir, $err); |
|
156 | 156 | list($size, $none) = explode("\t", $du); |
157 | 157 | $limit = $_configuration[$access_url_id]['hosting_limit_disk_space']; |
158 | 158 | $message2 .= sprintf(get_lang('TotalSpaceUsedByPortalXLimitIsYMB'), $size, $limit); |
@@ -236,33 +236,33 @@ discard block |
||
236 | 236 | $array[] = $this->build_setting($status, '[INI]', 'default_charset', 'http://www.php.net/manual/en/ini.core.php#ini.default-charset', $setting, $req_setting, null, get_lang('DefaultCharsetInfo')); |
237 | 237 | |
238 | 238 | $setting = ini_get('max_execution_time'); |
239 | - $req_setting = '300 (' . get_lang('Minimum') . ')'; |
|
239 | + $req_setting = '300 ('.get_lang('Minimum').')'; |
|
240 | 240 | $status = $setting >= 300 ? self :: STATUS_OK : self :: STATUS_WARNING; |
241 | 241 | $array[] = $this->build_setting($status, '[INI]', 'max_execution_time', 'http://www.php.net/manual/en/ini.core.php#ini.max-execution-time', $setting, $req_setting, null, get_lang('MaxExecutionTimeInfo')); |
242 | 242 | |
243 | 243 | $setting = ini_get('max_input_time'); |
244 | - $req_setting = '300 (' . get_lang('Minimum') . ')'; |
|
244 | + $req_setting = '300 ('.get_lang('Minimum').')'; |
|
245 | 245 | $status = $setting >= 300 ? self :: STATUS_OK : self :: STATUS_WARNING; |
246 | 246 | $array[] = $this->build_setting($status, '[INI]', 'max_input_time', 'http://www.php.net/manual/en/ini.core.php#ini.max-input-time', $setting, $req_setting, null, get_lang('MaxInputTimeInfo')); |
247 | 247 | |
248 | 248 | $setting = ini_get('memory_limit'); |
249 | 249 | $req_setting = '>= '.REQUIRED_MIN_MEMORY_LIMIT.'M'; |
250 | 250 | $status = self :: STATUS_ERROR; |
251 | - if ((float)$setting >= REQUIRED_MIN_MEMORY_LIMIT) |
|
251 | + if ((float) $setting >= REQUIRED_MIN_MEMORY_LIMIT) |
|
252 | 252 | $status = self :: STATUS_OK; |
253 | 253 | $array[] = $this->build_setting($status, '[INI]', 'memory_limit', 'http://www.php.net/manual/en/ini.core.php#ini.memory-limit', $setting, $req_setting, null, get_lang('MemoryLimitInfo')); |
254 | 254 | |
255 | 255 | $setting = ini_get('post_max_size'); |
256 | 256 | $req_setting = '>= '.REQUIRED_MIN_POST_MAX_SIZE.'M'; |
257 | 257 | $status = self :: STATUS_ERROR; |
258 | - if ((float)$setting >= REQUIRED_MIN_POST_MAX_SIZE) |
|
258 | + if ((float) $setting >= REQUIRED_MIN_POST_MAX_SIZE) |
|
259 | 259 | $status = self :: STATUS_OK; |
260 | 260 | $array[] = $this->build_setting($status, '[INI]', 'post_max_size', 'http://www.php.net/manual/en/ini.core.php#ini.post-max-size', $setting, $req_setting, null, get_lang('PostMaxSizeInfo')); |
261 | 261 | |
262 | 262 | $setting = ini_get('upload_max_filesize'); |
263 | 263 | $req_setting = '>= '.REQUIRED_MIN_UPLOAD_MAX_FILESIZE.'M'; |
264 | 264 | $status = self :: STATUS_ERROR; |
265 | - if ((float)$setting >= REQUIRED_MIN_UPLOAD_MAX_FILESIZE) |
|
265 | + if ((float) $setting >= REQUIRED_MIN_UPLOAD_MAX_FILESIZE) |
|
266 | 266 | $status = self :: STATUS_OK; |
267 | 267 | $array[] = $this->build_setting($status, '[INI]', 'upload_max_filesize', 'http://www.php.net/manual/en/ini.core.php#ini.upload_max_filesize', $setting, $req_setting, null, get_lang('UploadMaxFilesizeInfo')); |
268 | 268 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_WARNING; |
277 | 277 | $array[] = $this->build_setting($status, '[SESSION]', 'session.gc_maxlifetime', 'http://www.php.net/manual/en/ini.core.php#session.gc-maxlifetime', $setting, $req_setting, null, get_lang('SessionGCMaxLifetimeInfo')); |
278 | 278 | |
279 | - if (api_check_browscap()){$setting = true;}else{$setting=false;} |
|
279 | + if (api_check_browscap()) {$setting = true; } else {$setting = false; } |
|
280 | 280 | $req_setting = true; |
281 | 281 | $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_WARNING; |
282 | 282 | $array[] = $this->build_setting($status, '[INI]', 'browscap', 'http://www.php.net/manual/en/misc.configuration.php#ini.browscap', $setting, $req_setting, 'on_off', get_lang('BrowscapInfo')); |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | |
333 | 333 | $loaded = extension_loaded($extension); |
334 | 334 | $status = $loaded ? self :: STATUS_OK : self :: STATUS_ERROR; |
335 | - $array[] = $this->build_setting($status, '[EXTENSION]', get_lang('LoadedExtension') . ': ' . $extension, $url, $loaded, $expected_value, 'yes_no_optional', $comment); |
|
335 | + $array[] = $this->build_setting($status, '[EXTENSION]', get_lang('LoadedExtension').': '.$extension, $url, $loaded, $expected_value, 'yes_no_optional', $comment); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | return $array; |
@@ -455,9 +455,9 @@ discard block |
||
455 | 455 | $formatted_expected_value = $expected_value; |
456 | 456 | |
457 | 457 | if ($formatter) { |
458 | - if (method_exists($this, 'format_' . $formatter)) { |
|
459 | - $formatted_current_value = call_user_func(array($this, 'format_' . $formatter), $current_value); |
|
460 | - $formatted_expected_value = call_user_func(array($this, 'format_' . $formatter), $expected_value); |
|
458 | + if (method_exists($this, 'format_'.$formatter)) { |
|
459 | + $formatted_current_value = call_user_func(array($this, 'format_'.$formatter), $current_value); |
|
460 | + $formatted_expected_value = call_user_func(array($this, 'format_'.$formatter), $expected_value); |
|
461 | 461 | } |
462 | 462 | } |
463 | 463 | |
@@ -472,13 +472,13 @@ discard block |
||
472 | 472 | */ |
473 | 473 | public function get_link($title, $url) |
474 | 474 | { |
475 | - return '<a href="' . $url . '" target="about:bank">' . $title . '</a>'; |
|
475 | + return '<a href="'.$url.'" target="about:bank">'.$title.'</a>'; |
|
476 | 476 | } |
477 | 477 | |
478 | 478 | public function format_yes_no_optional($value) |
479 | 479 | { |
480 | 480 | $return = ''; |
481 | - switch($value) { |
|
481 | + switch ($value) { |
|
482 | 482 | case 0: |
483 | 483 | $return = get_lang('No'); |
484 | 484 | break; |
@@ -1255,6 +1255,7 @@ discard block |
||
1255 | 1255 | |
1256 | 1256 | /** |
1257 | 1257 | * Validates the time control key |
1258 | + * @param integer $exercise_id |
|
1258 | 1259 | */ |
1259 | 1260 | public static function exercise_time_control_is_valid( |
1260 | 1261 | $exercise_id, |
@@ -1388,7 +1389,7 @@ discard block |
||
1388 | 1389 | * @param int $in_direction |
1389 | 1390 | * @param string $in_hotpot_path |
1390 | 1391 | * @param bool $in_get_count |
1391 | - * @param null $where_condition |
|
1392 | + * @param string $where_condition |
|
1392 | 1393 | * @return array|int |
1393 | 1394 | */ |
1394 | 1395 | public static function get_exam_results_hotpotatoes_data( |
@@ -2179,7 +2180,7 @@ discard block |
||
2179 | 2180 | /** |
2180 | 2181 | * Return true if pass_pourcentage activated (we use the pass pourcentage feature |
2181 | 2182 | * return false if pass_percentage = 0 (we don't use the pass pourcentage feature |
2182 | - * @param $in_pass_pourcentage |
|
2183 | + * @param string $in_pass_pourcentage |
|
2183 | 2184 | * @return boolean |
2184 | 2185 | * In this version, pass_percentage and show_success_message are disabled if |
2185 | 2186 | * pass_percentage is set to 0 |
@@ -2192,7 +2193,7 @@ discard block |
||
2192 | 2193 | /** |
2193 | 2194 | * Converts a numeric value in a percentage example 0.66666 to 66.67 % |
2194 | 2195 | * @param $value |
2195 | - * @return float Converted number |
|
2196 | + * @return string Converted number |
|
2196 | 2197 | */ |
2197 | 2198 | public static function convert_to_percentage($value) |
2198 | 2199 | { |
@@ -2208,7 +2209,7 @@ discard block |
||
2208 | 2209 | * @param float $score |
2209 | 2210 | * @param float $weight |
2210 | 2211 | * @deprecated seem not to be used |
2211 | - * @return float the score rounded converted to the new range |
|
2212 | + * @return string|null the score rounded converted to the new range |
|
2212 | 2213 | */ |
2213 | 2214 | public static function convert_score($score, $weight) |
2214 | 2215 | { |
@@ -2759,6 +2760,7 @@ discard block |
||
2759 | 2760 | * @param int exercise id |
2760 | 2761 | * @param int $courseId |
2761 | 2762 | * @param int session id |
2763 | + * @param integer $user_count |
|
2762 | 2764 | * @return float Best average score |
2763 | 2765 | */ |
2764 | 2766 | public static function get_best_average_score_by_exercise( |
@@ -3198,8 +3200,9 @@ discard block |
||
3198 | 3200 | } |
3199 | 3201 | |
3200 | 3202 | /** |
3201 | - * @param array $answer |
|
3203 | + * @param string|null $answer |
|
3202 | 3204 | * @param string $user_answer |
3205 | + * @param string|null $current_answer |
|
3203 | 3206 | * @return array |
3204 | 3207 | */ |
3205 | 3208 | public static function check_fill_in_blanks($answer, $user_answer, $current_answer) |
@@ -3805,7 +3808,7 @@ discard block |
||
3805 | 3808 | |
3806 | 3809 | /** |
3807 | 3810 | * @param int $countLetter |
3808 | - * @return mixed |
|
3811 | + * @return string |
|
3809 | 3812 | */ |
3810 | 3813 | public static function detectInputAppropriateClass($countLetter) |
3811 | 3814 | { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | if ($show_title) { |
68 | 68 | TestCategory::displayCategoryAndTitle($objQuestionTmp->id); |
69 | 69 | echo Display::div( |
70 | - $current_item . '. ' . $objQuestionTmp->selectTitle(), |
|
70 | + $current_item.'. '.$objQuestionTmp->selectTitle(), |
|
71 | 71 | array('class' => 'question_title') |
72 | 72 | ); |
73 | 73 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | <div class="clearfix"> |
112 | 112 | <ul class="exercise-draggable-answer ui-helper-reset ui-helper-clearfix list-inline">'; |
113 | 113 | } else { |
114 | - $s .= '<div id="drag' . $questionId . '_question" class="drag_question"> |
|
114 | + $s .= '<div id="drag'.$questionId.'_question" class="drag_question"> |
|
115 | 115 | <table class="data_table">'; |
116 | 116 | } |
117 | 117 | |
@@ -158,12 +158,12 @@ discard block |
||
158 | 158 | } elseif ($answerType == FREE_ANSWER) { |
159 | 159 | $fck_content = isset($user_choice[0]) && !empty($user_choice[0]['answer']) ? $user_choice[0]['answer'] : null; |
160 | 160 | |
161 | - $form = new FormValidator('free_choice_' . $questionId); |
|
161 | + $form = new FormValidator('free_choice_'.$questionId); |
|
162 | 162 | $config = array( |
163 | 163 | 'ToolbarSet' => 'TestFreeAnswer' |
164 | 164 | ); |
165 | - $form->addHtmlEditor("choice[" . $questionId . "]", null, false, false, $config); |
|
166 | - $form->setDefaults(array("choice[" . $questionId . "]" => $fck_content)); |
|
165 | + $form->addHtmlEditor("choice[".$questionId."]", null, false, false, $config); |
|
166 | + $form->setDefaults(array("choice[".$questionId."]" => $fck_content)); |
|
167 | 167 | $s .= $form->returnForm(); |
168 | 168 | } elseif ($answerType == ORAL_EXPRESSION) { |
169 | 169 | // Add nanog |
@@ -190,11 +190,11 @@ discard block |
||
190 | 190 | echo $objQuestionTmp->returnRecorder(); |
191 | 191 | } |
192 | 192 | |
193 | - $form = new FormValidator('free_choice_' . $questionId); |
|
193 | + $form = new FormValidator('free_choice_'.$questionId); |
|
194 | 194 | $config = array( |
195 | 195 | 'ToolbarSet' => 'TestFreeAnswer' |
196 | 196 | ); |
197 | - $form->addHtmlEditor("choice[" . $questionId . "]", null, false, false, $config); |
|
197 | + $form->addHtmlEditor("choice[".$questionId."]", null, false, false, $config); |
|
198 | 198 | //$form->setDefaults(array("choice[" . $questionId . "]" => $fck_content)); |
199 | 199 | $s .= $form->returnForm(); |
200 | 200 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | case UNIQUE_ANSWER_NO_OPTION: |
280 | 280 | //no break |
281 | 281 | case UNIQUE_ANSWER_IMAGE: |
282 | - $input_id = 'choice-' . $questionId . '-' . $answerId; |
|
282 | + $input_id = 'choice-'.$questionId.'-'.$answerId; |
|
283 | 283 | |
284 | 284 | if (isset($user_choice[0]['answer']) && $user_choice[0]['answer'] == $numAnswer) { |
285 | 285 | $attributes = array( |
@@ -305,14 +305,14 @@ discard block |
||
305 | 305 | if ($answerType == UNIQUE_ANSWER_IMAGE) { |
306 | 306 | if ($show_comment) { |
307 | 307 | if (empty($comment)) { |
308 | - $s .= '<div id="answer' . $questionId . $numAnswer . '" ' |
|
308 | + $s .= '<div id="answer'.$questionId.$numAnswer.'" ' |
|
309 | 309 | . 'class="exercise-unique-answer-image" style="text-align: center">'; |
310 | 310 | } else { |
311 | - $s .= '<div id="answer' . $questionId . $numAnswer . '" ' |
|
311 | + $s .= '<div id="answer'.$questionId.$numAnswer.'" ' |
|
312 | 312 | . 'class="exercise-unique-answer-image col-xs-6 col-sm-12" style="text-align: center">'; |
313 | 313 | } |
314 | 314 | } else { |
315 | - $s .= '<div id="answer' . $questionId . $numAnswer . '" ' |
|
315 | + $s .= '<div id="answer'.$questionId.$numAnswer.'" ' |
|
316 | 316 | . 'class="exercise-unique-answer-image col-xs-6 col-md-3" style="text-align: center">'; |
317 | 317 | } |
318 | 318 | } |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | |
322 | 322 | $s .= Display::input( |
323 | 323 | 'hidden', |
324 | - 'choice2[' . $questionId . ']', |
|
324 | + 'choice2['.$questionId.']', |
|
325 | 325 | '0' |
326 | 326 | ); |
327 | 327 | |
@@ -329,13 +329,13 @@ discard block |
||
329 | 329 | |
330 | 330 | if ($answerType == UNIQUE_ANSWER_IMAGE) { |
331 | 331 | $attributes['style'] = 'display: none;'; |
332 | - $answer = '<div class="thumbnail">' . $answer . '</div>'; |
|
332 | + $answer = '<div class="thumbnail">'.$answer.'</div>'; |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | $answer_input .= '<label class="radio">'; |
336 | 336 | $answer_input .= Display::input( |
337 | 337 | 'radio', |
338 | - 'choice[' . $questionId . ']', |
|
338 | + 'choice['.$questionId.']', |
|
339 | 339 | $numAnswer, |
340 | 340 | $attributes |
341 | 341 | ); |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | case MULTIPLE_ANSWER_TRUE_FALSE: |
363 | 363 | //no break |
364 | 364 | case GLOBAL_MULTIPLE_ANSWER: |
365 | - $input_id = 'choice-' . $questionId . '-' . $answerId; |
|
365 | + $input_id = 'choice-'.$questionId.'-'.$answerId; |
|
366 | 366 | $answer = Security::remove_XSS($answer, STUDENT); |
367 | 367 | |
368 | 368 | if (in_array($numAnswer, $user_choice_array)) { |
@@ -383,12 +383,12 @@ discard block |
||
383 | 383 | } |
384 | 384 | |
385 | 385 | if ($answerType == MULTIPLE_ANSWER || $answerType == GLOBAL_MULTIPLE_ANSWER) { |
386 | - $s .= '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />'; |
|
386 | + $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'; |
|
387 | 387 | |
388 | 388 | $answer_input = '<label class="checkbox">'; |
389 | 389 | $answer_input .= Display::input( |
390 | 390 | 'checkbox', |
391 | - 'choice[' . $questionId . '][' . $numAnswer . ']', |
|
391 | + 'choice['.$questionId.']['.$numAnswer.']', |
|
392 | 392 | $numAnswer, |
393 | 393 | $attributes |
394 | 394 | ); |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | 'td', |
442 | 442 | Display::input( |
443 | 443 | 'radio', |
444 | - 'choice[' . $questionId . '][' . $numAnswer . ']', |
|
444 | + 'choice['.$questionId.']['.$numAnswer.']', |
|
445 | 445 | $id, |
446 | 446 | $attributes |
447 | 447 | ), |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | break; |
461 | 461 | case MULTIPLE_ANSWER_COMBINATION: |
462 | 462 | // multiple answers |
463 | - $input_id = 'choice-' . $questionId . '-' . $answerId; |
|
463 | + $input_id = 'choice-'.$questionId.'-'.$answerId; |
|
464 | 464 | |
465 | 465 | if (in_array($numAnswer, $user_choice_array)) { |
466 | 466 | $attributes = array( |
@@ -480,11 +480,11 @@ discard block |
||
480 | 480 | } |
481 | 481 | |
482 | 482 | $answer = Security::remove_XSS($answer, STUDENT); |
483 | - $answer_input = '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />'; |
|
483 | + $answer_input = '<input type="hidden" name="choice2['.$questionId.']" value="0" />'; |
|
484 | 484 | $answer_input .= '<label class="checkbox">'; |
485 | 485 | $answer_input .= Display::input( |
486 | 486 | 'checkbox', |
487 | - 'choice[' . $questionId . '][' . $numAnswer . ']', |
|
487 | + 'choice['.$questionId.']['.$numAnswer.']', |
|
488 | 488 | 1, |
489 | 489 | $attributes |
490 | 490 | ); |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | } |
506 | 506 | break; |
507 | 507 | case MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE: |
508 | - $s .= '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />'; |
|
508 | + $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />'; |
|
509 | 509 | |
510 | 510 | $my_choice = array(); |
511 | 511 | if (!empty($user_choice_array)) { |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | 'td', |
541 | 541 | Display::input( |
542 | 542 | 'radio', |
543 | - 'choice[' . $questionId . '][' . $numAnswer . ']', |
|
543 | + 'choice['.$questionId.']['.$numAnswer.']', |
|
544 | 544 | $key, |
545 | 545 | $attributes |
546 | 546 | ) |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | // may be "" if student viewed the question, but did not fill the blanks |
598 | 598 | $correctItem = $studentAnswerList[$i]; |
599 | 599 | } |
600 | - $attributes["style"] = "width:" . $listAnswerInformations["tabinputsize"][$i] . "px"; |
|
600 | + $attributes["style"] = "width:".$listAnswerInformations["tabinputsize"][$i]."px"; |
|
601 | 601 | $answer .= FillBlanks::getFillTheBlankHtml($separatorStartRegexp, $separatorEndRegexp, $correctItemRegexp, $questionId, $correctItem, $attributes, $answer, $listAnswerInformations, $displayForStudent, $i); |
602 | 602 | } |
603 | 603 | // display the last common word |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | // display the common words |
612 | 612 | $answer .= $listAnswerInformations["commonwords"][$i]; |
613 | 613 | // display the blank word |
614 | - $attributes["style"] = "width:" . $listAnswerInformations["tabinputsize"][$i] . "px"; |
|
614 | + $attributes["style"] = "width:".$listAnswerInformations["tabinputsize"][$i]."px"; |
|
615 | 615 | $correctItem = $listAnswerInformations["tabwords"][$i]; |
616 | 616 | $correctItemRegexp = $correctItem; |
617 | 617 | // replace / with \/ to allow the preg_replace bellow and all the regexp char |
@@ -637,8 +637,8 @@ discard block |
||
637 | 637 | $trackAttempts = Database::get_main_table( |
638 | 638 | TABLE_STATISTIC_TRACK_E_ATTEMPT |
639 | 639 | ); |
640 | - $sql = 'SELECT answer FROM ' . $trackAttempts . ' |
|
641 | - WHERE exe_id=' . $exe_id . ' AND question_id=' . $questionId; |
|
640 | + $sql = 'SELECT answer FROM '.$trackAttempts.' |
|
641 | + WHERE exe_id=' . $exe_id.' AND question_id='.$questionId; |
|
642 | 642 | $rsLastAttempt = Database::query($sql); |
643 | 643 | $rowLastAttempt = Database::fetch_array($rsLastAttempt); |
644 | 644 | $answer = $rowLastAttempt['answer']; |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | '', |
696 | 696 | $answerCorrected |
697 | 697 | ); |
698 | - $answerCorrected = '[' . $answerCorrected . ']'; |
|
698 | + $answerCorrected = '['.$answerCorrected.']'; |
|
699 | 699 | $studentAnswerList[] = $answerCorrected; |
700 | 700 | } |
701 | 701 | } |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | */ |
717 | 717 | $tabComments = api_preg_split( |
718 | 718 | '/\[[^]]+\]/', |
719 | - ' ' . $answer . ' ' |
|
719 | + ' '.$answer.' ' |
|
720 | 720 | ); |
721 | 721 | if (!empty($correctAnswerList) && !empty($studentAnswerList)) { |
722 | 722 | $answer = ""; |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | $size |
734 | 734 | ); |
735 | 735 | |
736 | - $answer .= $tabComments[$i] . |
|
736 | + $answer .= $tabComments[$i]. |
|
737 | 737 | Display::input( |
738 | 738 | 'text', |
739 | 739 | "choice[$questionId][]", |
@@ -780,12 +780,12 @@ discard block |
||
780 | 780 | $s .= '<tr><td width="45%" valign="top">'; |
781 | 781 | $parsed_answer = $answer; |
782 | 782 | //left part questions |
783 | - $s .= '<p class="indent">' . $lines_count . '. ' . $parsed_answer . '</p></td>'; |
|
783 | + $s .= '<p class="indent">'.$lines_count.'. '.$parsed_answer.'</p></td>'; |
|
784 | 784 | //middle part (matches selects) |
785 | 785 | |
786 | 786 | $s .= '<td width="10%" valign="top" align="center" > |
787 | 787 | <div class="select-matching"> |
788 | - <select name="choice[' . $questionId . '][' . $numAnswer . ']">'; |
|
788 | + <select name="choice[' . $questionId.']['.$numAnswer.']">'; |
|
789 | 789 | |
790 | 790 | // fills the list-box |
791 | 791 | foreach ($select_items as $key => $val) { |
@@ -801,14 +801,14 @@ discard block |
||
801 | 801 | if (isset($user_choice_array_position[$numAnswer]) && $val['id'] == $user_choice_array_position[$numAnswer]) { |
802 | 802 | $selected = 'selected="selected"'; |
803 | 803 | } |
804 | - $s .= '<option value="' . $val['id'] . '" ' . $selected . '>' . $val['letter'] . '</option>'; |
|
804 | + $s .= '<option value="'.$val['id'].'" '.$selected.'>'.$val['letter'].'</option>'; |
|
805 | 805 | |
806 | 806 | } // end foreach() |
807 | 807 | |
808 | 808 | $s .= '</select></div></td><td width="5%" class="separate"> </td>'; |
809 | 809 | $s .= '<td width="40%" valign="top" >'; |
810 | 810 | if (isset($select_items[$lines_count])) { |
811 | - $s .= '<div class="text-right"><p class="indent">' . $select_items[$lines_count]['letter'] . '. ' . $select_items[$lines_count]['answer'] . '</p></div>'; |
|
811 | + $s .= '<div class="text-right"><p class="indent">'.$select_items[$lines_count]['letter'].'. '.$select_items[$lines_count]['answer'].'</p></div>'; |
|
812 | 812 | } else { |
813 | 813 | $s .= ' '; |
814 | 814 | } |
@@ -823,7 +823,7 @@ discard block |
||
823 | 823 | $s .= '<tr> |
824 | 824 | <td colspan="2"></td> |
825 | 825 | <td valign="top">'; |
826 | - $s .= '<b>' . $select_items[$lines_count]['letter'] . '.</b> ' . $select_items[$lines_count]['answer']; |
|
826 | + $s .= '<b>'.$select_items[$lines_count]['letter'].'.</b> '.$select_items[$lines_count]['answer']; |
|
827 | 827 | $s .= "</td> |
828 | 828 | </tr>"; |
829 | 829 | $lines_count++; |
@@ -840,9 +840,9 @@ discard block |
||
840 | 840 | $data = $objAnswerTmp->getAnswerByAutoId($data['correct']); |
841 | 841 | $lines_count = $data['answer'];*/ |
842 | 842 | |
843 | - $windowId = $questionId . '_' . $lines_count; |
|
843 | + $windowId = $questionId.'_'.$lines_count; |
|
844 | 844 | |
845 | - $s .= '<li class="touch-items" id="' . $windowId . '">'; |
|
845 | + $s .= '<li class="touch-items" id="'.$windowId.'">'; |
|
846 | 846 | $s .= Display::div( |
847 | 847 | $parsed_answer, |
848 | 848 | [ |
@@ -900,7 +900,7 @@ discard block |
||
900 | 900 | Display::tag( |
901 | 901 | 'b', |
902 | 902 | $select_items[$lines_count]['letter'] |
903 | - ) . $select_items[$lines_count]['answer'], |
|
903 | + ).$select_items[$lines_count]['answer'], |
|
904 | 904 | [ |
905 | 905 | 'id' => "window_{$windowId}_answer", |
906 | 906 | 'style' => 'display: none;' |
@@ -1071,7 +1071,7 @@ discard block |
||
1071 | 1071 | |
1072 | 1072 | for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) { |
1073 | 1073 | $answerCorrect = $objAnswerTmp->isCorrect($answerId); |
1074 | - $windowId = $questionId . '_' . $counterAnswer; |
|
1074 | + $windowId = $questionId.'_'.$counterAnswer; |
|
1075 | 1075 | |
1076 | 1076 | if ($answerCorrect) { |
1077 | 1077 | $s .= Display::div( |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | $course = api_get_course_info(); |
1121 | 1121 | $doc_id = DocumentManager::get_document_id( |
1122 | 1122 | $course, |
1123 | - '/images/' . $pictureName |
|
1123 | + '/images/'.$pictureName |
|
1124 | 1124 | ); |
1125 | 1125 | if (is_numeric($doc_id)) { |
1126 | 1126 | $images_folder_visibility = api_get_item_visibility( |
@@ -1145,7 +1145,7 @@ discard block |
||
1145 | 1145 | echo " |
1146 | 1146 | <script> |
1147 | 1147 | $(document).on('ready', function () { |
1148 | - new " . ($answerType == HOT_SPOT ? "HotspotQuestion" : "DelineationQuestion") . "({ |
|
1148 | + new " . ($answerType == HOT_SPOT ? "HotspotQuestion" : "DelineationQuestion")."({ |
|
1149 | 1149 | questionId: $questionId, |
1150 | 1150 | exerciseId: $exerciseId, |
1151 | 1151 | selector: '#hotspot-preview-$questionId', |
@@ -1179,7 +1179,7 @@ discard block |
||
1179 | 1179 | if ($answerType != HOT_SPOT_DELINEATION) { |
1180 | 1180 | $answerList = ' |
1181 | 1181 | <div class="well well-sm"> |
1182 | - <h5 class="page-header">' . get_lang('HotspotZones') . '</h5> |
|
1182 | + <h5 class="page-header">' . get_lang('HotspotZones').'</h5> |
|
1183 | 1183 | <ol> |
1184 | 1184 | '; |
1185 | 1185 | |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | if (!$only_questions) { |
1205 | 1205 | if ($show_title) { |
1206 | 1206 | TestCategory::displayCategoryAndTitle($objQuestionTmp->id); |
1207 | - echo '<div class="question_title">' . $current_item . '. ' . $questionName . '</div>'; |
|
1207 | + echo '<div class="question_title">'.$current_item.'. '.$questionName.'</div>'; |
|
1208 | 1208 | } |
1209 | 1209 | //@todo I need to the get the feedback type |
1210 | 1210 | echo <<<HOTSPOT |
@@ -1221,7 +1221,7 @@ discard block |
||
1221 | 1221 | <div class=\"hotspot-image\"></div> |
1222 | 1222 | <script> |
1223 | 1223 | $(document).on('ready', function () { |
1224 | - new " . ($answerType == HOT_SPOT_DELINEATION ? 'DelineationQuestion' : 'HotspotQuestion') . "({ |
|
1224 | + new " . ($answerType == HOT_SPOT_DELINEATION ? 'DelineationQuestion' : 'HotspotQuestion')."({ |
|
1225 | 1225 | questionId: $questionId, |
1226 | 1226 | exerciseId: $exe_id, |
1227 | 1227 | selector: '#question_div_' + $questionId + ' .hotspot-image', |
@@ -1342,11 +1342,11 @@ discard block |
||
1342 | 1342 | $lp_id = intval($lp_id); |
1343 | 1343 | $lp_item_id = intval($lp_item_id); |
1344 | 1344 | return |
1345 | - api_get_course_int_id() . '_' . |
|
1346 | - api_get_session_id() . '_' . |
|
1347 | - $exercise_id . '_' . |
|
1348 | - api_get_user_id() . '_' . |
|
1349 | - $lp_id . '_' . |
|
1345 | + api_get_course_int_id().'_'. |
|
1346 | + api_get_session_id().'_'. |
|
1347 | + $exercise_id.'_'. |
|
1348 | + api_get_user_id().'_'. |
|
1349 | + $lp_id.'_'. |
|
1350 | 1350 | $lp_item_id; |
1351 | 1351 | } |
1352 | 1352 | |
@@ -1460,14 +1460,14 @@ discard block |
||
1460 | 1460 | $res = Database::query($sql); |
1461 | 1461 | $result = array(); |
1462 | 1462 | $apiIsAllowedToEdit = api_is_allowed_to_edit(); |
1463 | - $urlBase = api_get_path(WEB_CODE_PATH) . |
|
1464 | - 'exercise/hotpotatoes_exercise_report.php?action=delete&' . |
|
1465 | - api_get_cidreq() . '&id='; |
|
1463 | + $urlBase = api_get_path(WEB_CODE_PATH). |
|
1464 | + 'exercise/hotpotatoes_exercise_report.php?action=delete&'. |
|
1465 | + api_get_cidreq().'&id='; |
|
1466 | 1466 | while ($data = Database::fetch_array($res)) { |
1467 | 1467 | $actions = null; |
1468 | 1468 | |
1469 | 1469 | if ($apiIsAllowedToEdit) { |
1470 | - $url = $urlBase . $data['id'] . '&path=' . $data['exe_name']; |
|
1470 | + $url = $urlBase.$data['id'].'&path='.$data['exe_name']; |
|
1471 | 1471 | $actions = Display::url( |
1472 | 1472 | Display::return_icon('delete.png', get_lang('Delete')), |
1473 | 1473 | $url |
@@ -1483,7 +1483,7 @@ discard block |
||
1483 | 1483 | GroupManager::get_user_group_name($data['user_id']) |
1484 | 1484 | ), |
1485 | 1485 | 'exe_date' => $data['exe_date'], |
1486 | - 'score' => $data['exe_result'] . ' / ' . $data['exe_weighting'], |
|
1486 | + 'score' => $data['exe_result'].' / '.$data['exe_weighting'], |
|
1487 | 1487 | 'actions' => $actions, |
1488 | 1488 | ); |
1489 | 1489 | } |
@@ -1568,18 +1568,18 @@ discard block |
||
1568 | 1568 | $TBL_TRACK_HOTPOTATOES = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES); |
1569 | 1569 | $TBL_TRACK_ATTEMPT_RECORDING = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING); |
1570 | 1570 | |
1571 | - $session_id_and = ' AND te.session_id = ' . $sessionId . ' '; |
|
1571 | + $session_id_and = ' AND te.session_id = '.$sessionId.' '; |
|
1572 | 1572 | $exercise_id = intval($exercise_id); |
1573 | 1573 | |
1574 | 1574 | $exercise_where = ''; |
1575 | 1575 | if (!empty($exercise_id)) { |
1576 | - $exercise_where .= ' AND te.exe_exo_id = ' . $exercise_id . ' '; |
|
1576 | + $exercise_where .= ' AND te.exe_exo_id = '.$exercise_id.' '; |
|
1577 | 1577 | } |
1578 | 1578 | |
1579 | 1579 | $hotpotatoe_where = ''; |
1580 | 1580 | if (!empty($_GET['path'])) { |
1581 | 1581 | $hotpotatoe_path = Database::escape_string($_GET['path']); |
1582 | - $hotpotatoe_where .= ' AND exe_name = "' . $hotpotatoe_path . '" '; |
|
1582 | + $hotpotatoe_where .= ' AND exe_name = "'.$hotpotatoe_path.'" '; |
|
1583 | 1583 | } |
1584 | 1584 | |
1585 | 1585 | // sql for chamilo-type tests for teacher / tutor view |
@@ -1591,7 +1591,7 @@ discard block |
||
1591 | 1591 | WHERE |
1592 | 1592 | c_id = $course_id AND |
1593 | 1593 | exe_exo_id = $exercise_id AND |
1594 | - ttte.session_id = " . $sessionId . " |
|
1594 | + ttte.session_id = ".$sessionId." |
|
1595 | 1595 | )"; |
1596 | 1596 | |
1597 | 1597 | if ($is_allowedToEdit) { |
@@ -1614,9 +1614,9 @@ discard block |
||
1614 | 1614 | g.id as group_id |
1615 | 1615 | FROM $TBL_USER u |
1616 | 1616 | INNER JOIN $TBL_GROUP_REL_USER gru |
1617 | - ON (gru.user_id = u.user_id AND gru.c_id=" . $course_id . ") |
|
1617 | + ON (gru.user_id = u.user_id AND gru.c_id=".$course_id.") |
|
1618 | 1618 | INNER JOIN $TBL_GROUP g |
1619 | - ON (gru.group_id = g.id AND g.c_id=" . $course_id . ") |
|
1619 | + ON (gru.group_id = g.id AND g.c_id=".$course_id.") |
|
1620 | 1620 | )"; |
1621 | 1621 | } |
1622 | 1622 | |
@@ -1678,9 +1678,9 @@ discard block |
||
1678 | 1678 | g.id as group_id |
1679 | 1679 | FROM $TBL_USER u |
1680 | 1680 | LEFT OUTER JOIN $TBL_GROUP_REL_USER gru |
1681 | - ON ( gru.user_id = u.user_id AND gru.c_id=" . $course_id . " ) |
|
1681 | + ON ( gru.user_id = u.user_id AND gru.c_id=".$course_id." ) |
|
1682 | 1682 | LEFT OUTER JOIN $TBL_GROUP g |
1683 | - ON (gru.group_id = g.id AND g.c_id = " . $course_id . ") |
|
1683 | + ON (gru.group_id = g.id AND g.c_id = ".$course_id.") |
|
1684 | 1684 | )"; |
1685 | 1685 | } |
1686 | 1686 | |
@@ -1693,12 +1693,12 @@ discard block |
||
1693 | 1693 | ( |
1694 | 1694 | SELECT u.user_id, firstname, lastname, email, username, ' ' as group_name, '' as group_id, official_code |
1695 | 1695 | FROM $TBL_USER u |
1696 | - WHERE u.status NOT IN(" . api_get_users_status_ignored_in_reports('string') . ") |
|
1696 | + WHERE u.status NOT IN(".api_get_users_status_ignored_in_reports('string').") |
|
1697 | 1697 | )"; |
1698 | 1698 | } |
1699 | 1699 | |
1700 | 1700 | $sqlFromOption = " , $TBL_GROUP_REL_USER AS gru "; |
1701 | - $sqlWhereOption = " AND gru.c_id = " . $course_id . " AND gru.user_id = user.user_id "; |
|
1701 | + $sqlWhereOption = " AND gru.c_id = ".$course_id." AND gru.user_id = user.user_id "; |
|
1702 | 1702 | $first_and_last_name = api_is_western_name_order() ? "firstname, lastname" : "lastname, firstname"; |
1703 | 1703 | |
1704 | 1704 | if ($get_count) { |
@@ -1735,8 +1735,8 @@ discard block |
||
1735 | 1735 | ON (user.user_id = exe_user_id) |
1736 | 1736 | WHERE |
1737 | 1737 | te.status != 'incomplete' AND |
1738 | - te.c_id = " . $course_id . " $session_id_and AND |
|
1739 | - ce.active <>-1 AND ce.c_id = " . $course_id . " |
|
1738 | + te.c_id = ".$course_id." $session_id_and AND |
|
1739 | + ce.active <>-1 AND ce.c_id = ".$course_id." |
|
1740 | 1740 | $exercise_where |
1741 | 1741 | $extra_where_conditions |
1742 | 1742 | "; |
@@ -1763,12 +1763,12 @@ discard block |
||
1763 | 1763 | $sqlFromOption |
1764 | 1764 | WHERE |
1765 | 1765 | user.user_id=tth.exe_user_id |
1766 | - AND tth.c_id = " . $course_id . " |
|
1766 | + AND tth.c_id = ".$course_id." |
|
1767 | 1767 | $hotpotatoe_where |
1768 | 1768 | $sqlWhereOption |
1769 | - AND user.status NOT IN(" . api_get_users_status_ignored_in_reports( |
|
1769 | + AND user.status NOT IN(".api_get_users_status_ignored_in_reports( |
|
1770 | 1770 | 'string' |
1771 | - ) . ") |
|
1771 | + ).") |
|
1772 | 1772 | ORDER BY |
1773 | 1773 | tth.c_id ASC, |
1774 | 1774 | tth.exe_date DESC"; |
@@ -1841,12 +1841,12 @@ discard block |
||
1841 | 1841 | |
1842 | 1842 | if ($from_gradebook && ($is_allowedToEdit)) { |
1843 | 1843 | if (in_array( |
1844 | - $results[$i]['username'] . $results[$i]['firstname'] . $results[$i]['lastname'], |
|
1844 | + $results[$i]['username'].$results[$i]['firstname'].$results[$i]['lastname'], |
|
1845 | 1845 | $users_array_id |
1846 | 1846 | )) { |
1847 | 1847 | continue; |
1848 | 1848 | } |
1849 | - $users_array_id[] = $results[$i]['username'] . $results[$i]['firstname'] . $results[$i]['lastname']; |
|
1849 | + $users_array_id[] = $results[$i]['username'].$results[$i]['firstname'].$results[$i]['lastname']; |
|
1850 | 1850 | } |
1851 | 1851 | |
1852 | 1852 | $lp_obj = isset($results[$i]['orig_lp_id']) && isset($lp_list[$results[$i]['orig_lp_id']]) ? $lp_list[$results[$i]['orig_lp_id']] : null; |
@@ -1855,7 +1855,7 @@ discard block |
||
1855 | 1855 | if ($lp_obj) { |
1856 | 1856 | $url = api_get_path( |
1857 | 1857 | WEB_CODE_PATH |
1858 | - ) . 'lp/lp_controller.php?' . api_get_cidreq() . '&action=view&lp_id=' . $results[$i]['orig_lp_id']; |
|
1858 | + ).'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$results[$i]['orig_lp_id']; |
|
1859 | 1859 | $lp_name = Display::url( |
1860 | 1860 | $lp_obj['lp_name'], |
1861 | 1861 | $url, |
@@ -1873,7 +1873,7 @@ discard block |
||
1873 | 1873 | ); |
1874 | 1874 | |
1875 | 1875 | foreach ($group_list as $id) { |
1876 | - $group_name_list .= $clean_group_list[$id] . '<br/>'; |
|
1876 | + $group_name_list .= $clean_group_list[$id].'<br/>'; |
|
1877 | 1877 | } |
1878 | 1878 | $results[$i]['group_name'] = $group_name_list; |
1879 | 1879 | } |
@@ -1929,7 +1929,7 @@ discard block |
||
1929 | 1929 | } |
1930 | 1930 | } |
1931 | 1931 | if ($revised) { |
1932 | - $actions .= "<a href='exercise_show.php?" . api_get_cidreq() . "&action=edit&id=$id'>" . |
|
1932 | + $actions .= "<a href='exercise_show.php?".api_get_cidreq()."&action=edit&id=$id'>". |
|
1933 | 1933 | Display:: return_icon( |
1934 | 1934 | 'edit.png', |
1935 | 1935 | get_lang('Edit'), |
@@ -1938,7 +1938,7 @@ discard block |
||
1938 | 1938 | ); |
1939 | 1939 | $actions .= ' '; |
1940 | 1940 | } else { |
1941 | - $actions .= "<a href='exercise_show.php?" . api_get_cidreq() . "&action=qualify&id=$id'>" . |
|
1941 | + $actions .= "<a href='exercise_show.php?".api_get_cidreq()."&action=qualify&id=$id'>". |
|
1942 | 1942 | Display:: return_icon( |
1943 | 1943 | 'quiz.gif', |
1944 | 1944 | get_lang('Qualify') |
@@ -1948,11 +1948,11 @@ discard block |
||
1948 | 1948 | $actions .= "</a>"; |
1949 | 1949 | |
1950 | 1950 | if ($filter == 2) { |
1951 | - $actions .= ' <a href="exercise_history.php?' . api_get_cidreq() . '&exe_id=' . $id . '">' . |
|
1951 | + $actions .= ' <a href="exercise_history.php?'.api_get_cidreq().'&exe_id='.$id.'">'. |
|
1952 | 1952 | Display:: return_icon( |
1953 | 1953 | 'history.gif', |
1954 | 1954 | get_lang('ViewHistoryChange') |
1955 | - ) . '</a>'; |
|
1955 | + ).'</a>'; |
|
1956 | 1956 | } |
1957 | 1957 | |
1958 | 1958 | //Admin can always delete the attempt |
@@ -1962,13 +1962,13 @@ discard block |
||
1962 | 1962 | date('Y-m-d h:i:s'), |
1963 | 1963 | false |
1964 | 1964 | ); |
1965 | - $actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip=' . $ip . '" target="_blank"> |
|
1966 | - ' . Display::return_icon('info.png', $ip) . ' |
|
1965 | + $actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip='.$ip.'" target="_blank"> |
|
1966 | + ' . Display::return_icon('info.png', $ip).' |
|
1967 | 1967 | </a>'; |
1968 | 1968 | |
1969 | 1969 | |
1970 | - $recalculateUrl = api_get_path(WEB_CODE_PATH) . 'exercise/recalculate.php?' . |
|
1971 | - api_get_cidreq() . '&' . |
|
1970 | + $recalculateUrl = api_get_path(WEB_CODE_PATH).'exercise/recalculate.php?'. |
|
1971 | + api_get_cidreq().'&'. |
|
1972 | 1972 | http_build_query([ |
1973 | 1973 | 'id' => $id, |
1974 | 1974 | 'exercise' => $exercise_id, |
@@ -1985,27 +1985,27 @@ discard block |
||
1985 | 1985 | ] |
1986 | 1986 | ); |
1987 | 1987 | |
1988 | - $delete_link = '<a href="exercise_report.php?' . api_get_cidreq() . '&filter_by_user=' . intval($_GET['filter_by_user']) . '&filter=' . $filter . '&exerciseId=' . $exercise_id . '&delete=delete&did=' . $id . '" |
|
1988 | + $delete_link = '<a href="exercise_report.php?'.api_get_cidreq().'&filter_by_user='.intval($_GET['filter_by_user']).'&filter='.$filter.'&exerciseId='.$exercise_id.'&delete=delete&did='.$id.'" |
|
1989 | 1989 | onclick="javascript:if(!confirm(\'' . sprintf( |
1990 | 1990 | get_lang('DeleteAttempt'), |
1991 | 1991 | $results[$i]['username'], |
1992 | 1992 | $dt |
1993 | - ) . '\')) return false;">' . Display:: return_icon( |
|
1993 | + ).'\')) return false;">'.Display:: return_icon( |
|
1994 | 1994 | 'delete.png', |
1995 | 1995 | get_lang('Delete') |
1996 | - ) . '</a>'; |
|
1996 | + ).'</a>'; |
|
1997 | 1997 | $delete_link = utf8_encode($delete_link); |
1998 | 1998 | |
1999 | 1999 | if (api_is_drh() && !api_is_platform_admin()) { |
2000 | 2000 | $delete_link = null; |
2001 | 2001 | } |
2002 | - $actions .= $delete_link . ' '; |
|
2002 | + $actions .= $delete_link.' '; |
|
2003 | 2003 | } |
2004 | 2004 | |
2005 | 2005 | } else { |
2006 | 2006 | $attempt_url = api_get_path( |
2007 | 2007 | WEB_CODE_PATH |
2008 | - ) . 'exercise/result.php?' . api_get_cidreq() . '&id=' . $results[$i]['exe_id'] . '&id_session=' . $sessionId; |
|
2008 | + ).'exercise/result.php?'.api_get_cidreq().'&id='.$results[$i]['exe_id'].'&id_session='.$sessionId; |
|
2009 | 2009 | $attempt_link = Display::url( |
2010 | 2010 | get_lang('Show'), |
2011 | 2011 | $attempt_url, |
@@ -2064,7 +2064,7 @@ discard block |
||
2064 | 2064 | $hp_result = round( |
2065 | 2065 | ($hpresults[$i][4] / ($hpresults[$i][5] != 0 ? $hpresults[$i][5] : 1)) * 100, |
2066 | 2066 | 2 |
2067 | - ) . '% (' . $hpresults[$i][4] . ' / ' . $hpresults[$i][5] . ')'; |
|
2067 | + ).'% ('.$hpresults[$i][4].' / '.$hpresults[$i][5].')'; |
|
2068 | 2068 | if ($is_allowedToEdit) { |
2069 | 2069 | $list_info[] = array( |
2070 | 2070 | $hpresults[$i][0], |
@@ -2138,13 +2138,13 @@ discard block |
||
2138 | 2138 | |
2139 | 2139 | $html = null; |
2140 | 2140 | if ($show_percentage) { |
2141 | - $parent = '(' . $score . ' / ' . $weight . ')'; |
|
2142 | - $html = $percentage . "% $parent"; |
|
2141 | + $parent = '('.$score.' / '.$weight.')'; |
|
2142 | + $html = $percentage."% $parent"; |
|
2143 | 2143 | if ($show_only_percentage) { |
2144 | - $html = $percentage . "% "; |
|
2144 | + $html = $percentage."% "; |
|
2145 | 2145 | } |
2146 | 2146 | } else { |
2147 | - $html = $score . ' / ' . $weight; |
|
2147 | + $html = $score.' / '.$weight; |
|
2148 | 2148 | } |
2149 | 2149 | $html = Display::span($html, array('class' => 'score_exercise')); |
2150 | 2150 | |
@@ -2238,7 +2238,7 @@ discard block |
||
2238 | 2238 | { |
2239 | 2239 | $return = '-'; |
2240 | 2240 | if ($value != '') { |
2241 | - $return = float_format($value * 100, 1) . ' %'; |
|
2241 | + $return = float_format($value * 100, 1).' %'; |
|
2242 | 2242 | } |
2243 | 2243 | return $return; |
2244 | 2244 | } |
@@ -2317,7 +2317,7 @@ discard block |
||
2317 | 2317 | } |
2318 | 2318 | |
2319 | 2319 | $needle_where = !empty($search) ? " AND title LIKE '?' " : ''; |
2320 | - $needle = !empty($search) ? "%" . $search . "%" : ''; |
|
2320 | + $needle = !empty($search) ? "%".$search."%" : ''; |
|
2321 | 2321 | |
2322 | 2322 | // Show courses by active status |
2323 | 2323 | $active_sql = ''; |
@@ -2332,7 +2332,7 @@ discard block |
||
2332 | 2332 | if ($search_all_sessions == true) { |
2333 | 2333 | $conditions = array( |
2334 | 2334 | 'where' => array( |
2335 | - $active_sql . ' c_id = ? ' . $needle_where . $time_conditions => array( |
|
2335 | + $active_sql.' c_id = ? '.$needle_where.$time_conditions => array( |
|
2336 | 2336 | $course_id, |
2337 | 2337 | $needle |
2338 | 2338 | ) |
@@ -2343,7 +2343,7 @@ discard block |
||
2343 | 2343 | if ($session_id == 0) { |
2344 | 2344 | $conditions = array( |
2345 | 2345 | 'where' => array( |
2346 | - $active_sql . ' session_id = ? AND c_id = ? ' . $needle_where . $time_conditions => array( |
|
2346 | + $active_sql.' session_id = ? AND c_id = ? '.$needle_where.$time_conditions => array( |
|
2347 | 2347 | $session_id, |
2348 | 2348 | $course_id, |
2349 | 2349 | $needle |
@@ -2354,7 +2354,7 @@ discard block |
||
2354 | 2354 | } else { |
2355 | 2355 | $conditions = array( |
2356 | 2356 | 'where' => array( |
2357 | - $active_sql . ' (session_id = 0 OR session_id = ? ) AND c_id = ? ' . $needle_where . $time_conditions => array( |
|
2357 | + $active_sql.' (session_id = 0 OR session_id = ? ) AND c_id = ? '.$needle_where.$time_conditions => array( |
|
2358 | 2358 | $session_id, |
2359 | 2359 | $course_id, |
2360 | 2360 | $needle |
@@ -2535,7 +2535,7 @@ discard block |
||
2535 | 2535 | |
2536 | 2536 | if ($return_string) { |
2537 | 2537 | if (!empty($position) && !empty($my_ranking)) { |
2538 | - $return_value = $position . '/' . count($my_ranking); |
|
2538 | + $return_value = $position.'/'.count($my_ranking); |
|
2539 | 2539 | } else { |
2540 | 2540 | $return_value = '-'; |
2541 | 2541 | } |
@@ -2616,7 +2616,7 @@ discard block |
||
2616 | 2616 | |
2617 | 2617 | if ($return_string) { |
2618 | 2618 | if (!empty($position) && !empty($my_ranking)) { |
2619 | - return $position . '/' . count($my_ranking); |
|
2619 | + return $position.'/'.count($my_ranking); |
|
2620 | 2620 | } |
2621 | 2621 | } |
2622 | 2622 | return $return_value; |
@@ -3021,7 +3021,7 @@ discard block |
||
3021 | 3021 | $courseCondition = " |
3022 | 3022 | INNER JOIN $courseUser cu |
3023 | 3023 | ON cu.c_id = c.id AND cu.user_id = exe_user_id"; |
3024 | - $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT; |
|
3024 | + $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT; |
|
3025 | 3025 | } else { |
3026 | 3026 | $courseCondition = " |
3027 | 3027 | INNER JOIN $courseUserSession cu |
@@ -3097,7 +3097,7 @@ discard block |
||
3097 | 3097 | $courseCondition = " |
3098 | 3098 | INNER JOIN $courseUser cu |
3099 | 3099 | ON cu.c_id = c.id AND cu.user_id = exe_user_id"; |
3100 | - $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT; |
|
3100 | + $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT; |
|
3101 | 3101 | } else { |
3102 | 3102 | $courseCondition = " |
3103 | 3103 | INNER JOIN $courseUserSession cu |
@@ -3190,7 +3190,7 @@ discard block |
||
3190 | 3190 | $courseCondition = " |
3191 | 3191 | INNER JOIN $courseUser cu |
3192 | 3192 | ON cu.c_id = c.id AND cu.user_id = exe_user_id"; |
3193 | - $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT; |
|
3193 | + $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT; |
|
3194 | 3194 | } else { |
3195 | 3195 | $courseCondition = " |
3196 | 3196 | INNER JOIN $courseUserSession cu |
@@ -3372,7 +3372,7 @@ discard block |
||
3372 | 3372 | } |
3373 | 3373 | } |
3374 | 3374 | // adds the correct word, followed by ] to close the blank |
3375 | - $answer .= ' / <font color="green"><b>' . $real_correct_tags[$i] . '</b></font>]'; |
|
3375 | + $answer .= ' / <font color="green"><b>'.$real_correct_tags[$i].'</b></font>]'; |
|
3376 | 3376 | if (isset ($real_text[$i + 1])) { |
3377 | 3377 | $answer .= $real_text[$i + 1]; |
3378 | 3378 | } |
@@ -3432,13 +3432,13 @@ discard block |
||
3432 | 3432 | // check the default value of option |
3433 | 3433 | $tabSelected = array($in_default => " selected='selected' "); |
3434 | 3434 | $res = ""; |
3435 | - $res .= "<select name='$in_name' id='$in_name' onchange='" . $in_onchange . "' >"; |
|
3436 | - $res .= "<option value='-1'" . $tabSelected["-1"] . ">-- " . get_lang( |
|
3435 | + $res .= "<select name='$in_name' id='$in_name' onchange='".$in_onchange."' >"; |
|
3436 | + $res .= "<option value='-1'".$tabSelected["-1"].">-- ".get_lang( |
|
3437 | 3437 | 'AllGroups' |
3438 | - ) . " --</option>"; |
|
3439 | - $res .= "<option value='0'" . $tabSelected["0"] . ">- " . get_lang( |
|
3438 | + )." --</option>"; |
|
3439 | + $res .= "<option value='0'".$tabSelected["0"].">- ".get_lang( |
|
3440 | 3440 | 'NotInAGroup' |
3441 | - ) . " -</option>"; |
|
3441 | + )." -</option>"; |
|
3442 | 3442 | $tabGroups = GroupManager::get_group_list(); |
3443 | 3443 | $currentCatId = 0; |
3444 | 3444 | for ($i = 0; $i < count($tabGroups); $i++) { |
@@ -3446,10 +3446,10 @@ discard block |
||
3446 | 3446 | $tabGroups[$i]["id"] |
3447 | 3447 | ); |
3448 | 3448 | if ($tabCategory["id"] != $currentCatId) { |
3449 | - $res .= "<option value='-1' disabled='disabled'>" . $tabCategory["title"] . "</option>"; |
|
3449 | + $res .= "<option value='-1' disabled='disabled'>".$tabCategory["title"]."</option>"; |
|
3450 | 3450 | $currentCatId = $tabCategory["id"]; |
3451 | 3451 | } |
3452 | - $res .= "<option " . $tabSelected[$tabGroups[$i]["id"]] . "style='margin-left:40px' value='" . $tabGroups[$i]["id"] . "'>" . $tabGroups[$i]["name"] . "</option>"; |
|
3452 | + $res .= "<option ".$tabSelected[$tabGroups[$i]["id"]]."style='margin-left:40px' value='".$tabGroups[$i]["id"]."'>".$tabGroups[$i]["name"]."</option>"; |
|
3453 | 3453 | } |
3454 | 3454 | $res .= "</select>"; |
3455 | 3455 | return $res; |
@@ -3684,14 +3684,14 @@ discard block |
||
3684 | 3684 | if ($show_results) { |
3685 | 3685 | $comnt = Event::get_comments($exe_id, $questionId); |
3686 | 3686 | if (!empty($comnt)) { |
3687 | - echo '<b>' . get_lang('Feedback') . '</b>'; |
|
3688 | - echo '<div id="question_feedback">' . $comnt . '</div>'; |
|
3687 | + echo '<b>'.get_lang('Feedback').'</b>'; |
|
3688 | + echo '<div id="question_feedback">'.$comnt.'</div>'; |
|
3689 | 3689 | } |
3690 | 3690 | } |
3691 | 3691 | |
3692 | 3692 | if ($show_results) { |
3693 | 3693 | $score = array( |
3694 | - 'result' => get_lang('Score') . " : " . self::show_score( |
|
3694 | + 'result' => get_lang('Score')." : ".self::show_score( |
|
3695 | 3695 | $my_total_score, |
3696 | 3696 | $my_total_weight, |
3697 | 3697 | false, |
@@ -3759,9 +3759,9 @@ discard block |
||
3759 | 3759 | } |
3760 | 3760 | |
3761 | 3761 | if ($show_all_but_expected_answer) { |
3762 | - $exercise_content .= "<div class='normal-message'>" . get_lang( |
|
3762 | + $exercise_content .= "<div class='normal-message'>".get_lang( |
|
3763 | 3763 | "ExerciseWithFeedbackWithoutCorrectionComment" |
3764 | - ) . "</div>"; |
|
3764 | + )."</div>"; |
|
3765 | 3765 | } |
3766 | 3766 | // Remove audio auto play from questions on results page - refs BT#7939 |
3767 | 3767 | $exercise_content = preg_replace( |
@@ -3861,11 +3861,11 @@ discard block |
||
3861 | 3861 | $ribbon_total_success_or_error = ' ribbon-total-error'; |
3862 | 3862 | } |
3863 | 3863 | } |
3864 | - $ribbon .= '<div class="total ' . $ribbon_total_success_or_error . '">'; |
|
3864 | + $ribbon .= '<div class="total '.$ribbon_total_success_or_error.'">'; |
|
3865 | 3865 | } else { |
3866 | 3866 | $ribbon .= '<div class="total">'; |
3867 | 3867 | } |
3868 | - $ribbon .= '<h3>' . get_lang('YourTotalScore') . ": "; |
|
3868 | + $ribbon .= '<h3>'.get_lang('YourTotalScore').": "; |
|
3869 | 3869 | $ribbon .= self::show_score($score, $weight, false, true); |
3870 | 3870 | $ribbon .= '</h3>'; |
3871 | 3871 | $ribbon .= '</div>'; |
@@ -9,7 +9,6 @@ |
||
9 | 9 | { |
10 | 10 | /** |
11 | 11 | * @param $value array Uploaded file info (from $_FILES) |
12 | - * @param null $options |
|
13 | 12 | * @return bool |
14 | 13 | */ |
15 | 14 | public function validate($elementValue, $maxSize) |
@@ -7,22 +7,22 @@ |
||
7 | 7 | */ |
8 | 8 | class HTML_QuickForm_Rule_MaxFileSize extends HTML_QuickForm_Rule |
9 | 9 | { |
10 | - /** |
|
11 | - * @param $value array Uploaded file info (from $_FILES) |
|
12 | - * @param null $options |
|
13 | - * @return bool |
|
14 | - */ |
|
15 | - public function validate($elementValue, $maxSize) |
|
16 | - { |
|
17 | - if (!empty($elementValue['error']) && |
|
18 | - (UPLOAD_ERR_FORM_SIZE == $elementValue['error'] || UPLOAD_ERR_INI_SIZE == $elementValue['error']) |
|
19 | - ) { |
|
20 | - return false; |
|
21 | - } |
|
22 | - if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) { |
|
23 | - return true; |
|
24 | - } |
|
10 | + /** |
|
11 | + * @param $value array Uploaded file info (from $_FILES) |
|
12 | + * @param null $options |
|
13 | + * @return bool |
|
14 | + */ |
|
15 | + public function validate($elementValue, $maxSize) |
|
16 | + { |
|
17 | + if (!empty($elementValue['error']) && |
|
18 | + (UPLOAD_ERR_FORM_SIZE == $elementValue['error'] || UPLOAD_ERR_INI_SIZE == $elementValue['error']) |
|
19 | + ) { |
|
20 | + return false; |
|
21 | + } |
|
22 | + if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) { |
|
23 | + return true; |
|
24 | + } |
|
25 | 25 | |
26 | - return ($maxSize >= @filesize($elementValue['tmp_name'])); |
|
27 | - } |
|
26 | + return ($maxSize >= @filesize($elementValue['tmp_name'])); |
|
27 | + } |
|
28 | 28 | } |
@@ -16,7 +16,7 @@ |
||
16 | 16 | * |
17 | 17 | * @param string Mobile phone number to be validated |
18 | 18 | * @param string Not using it. Just to respect the declaration |
19 | - * @return boolean Returns true if valid, false otherwise. |
|
19 | + * @return integer Returns true if valid, false otherwise. |
|
20 | 20 | */ |
21 | 21 | function validate($mobilePhoneNumber, $options = null) |
22 | 22 | { |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | * @author Christophe Gesche <[email protected]> |
370 | 370 | * @author Hugues Peeters <[email protected]> |
371 | 371 | * @author Bart Mollet |
372 | - * @param mixed $groupIdList - group(s) to delete. It can be a single id |
|
372 | + * @param mixed $group_ids - group(s) to delete. It can be a single id |
|
373 | 373 | * (int) or a list of id (array). |
374 | 374 | * @param string $course_code Default is current course |
375 | 375 | * @return integer - number of groups deleted. |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | * @param bool Whether self registration is allowed or not |
574 | 574 | * @param bool Whether self unregistration is allowed or not |
575 | 575 | * @param int $categoryId |
576 | - * @return bool TRUE if properties are successfully changed, false otherwise |
|
576 | + * @return Statement|null TRUE if properties are successfully changed, false otherwise |
|
577 | 577 | */ |
578 | 578 | public static function set_group_properties( |
579 | 579 | $group_id, |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | * @param int $group_id The id of the group |
725 | 725 | * @param string $course_code The course in which the group is (default = |
726 | 726 | * current course) |
727 | - * @return array The category |
|
727 | + * @return integer The category |
|
728 | 728 | */ |
729 | 729 | public static function get_category_from_group($group_id, $course_code = null) |
730 | 730 | { |
@@ -786,9 +786,9 @@ discard block |
||
786 | 786 | * Create group category |
787 | 787 | * @param string $title The title of the new category |
788 | 788 | * @param string $description The description of the new category |
789 | - * @param bool $self_registration_allowed |
|
790 | - * @param bool $self_unregistration_allowed |
|
791 | - * @param int $max_number_of_students |
|
789 | + * @param integer $self_registration_allowed |
|
790 | + * @param integer $self_unregistration_allowed |
|
791 | + * @param int $maximum_number_of_students |
|
792 | 792 | * @param int $groups_per_user |
793 | 793 | */ |
794 | 794 | public static function create_category( |
@@ -994,6 +994,8 @@ discard block |
||
994 | 994 | * @param int $limit |
995 | 995 | * @param bool $getCount |
996 | 996 | * @param int $courseId |
997 | + * @param string $column |
|
998 | + * @param string $direction |
|
997 | 999 | * @return array list of user id |
998 | 1000 | */ |
999 | 1001 | public static function get_users( |
@@ -1172,7 +1174,7 @@ discard block |
||
1172 | 1174 | * Hugues Peeters <[email protected]> - original version |
1173 | 1175 | * @author Roan Embrechts - virtual course support, code cleaning |
1174 | 1176 | * @author Bart Mollet - code cleaning, use other GroupManager-functions |
1175 | - * @return void |
|
1177 | + * @return false|null |
|
1176 | 1178 | */ |
1177 | 1179 | public static function fill_groups($group_ids) |
1178 | 1180 | { |
@@ -1625,7 +1627,7 @@ discard block |
||
1625 | 1627 | * Unsubscribe user(s) from a specified group in current course |
1626 | 1628 | * @param mixed $user_ids Can be an array with user-id's or a single user-id |
1627 | 1629 | * @param int $group_id |
1628 | - * @return bool TRUE if successful |
|
1630 | + * @return boolean|null TRUE if successful |
|
1629 | 1631 | */ |
1630 | 1632 | public static function unsubscribe_users($user_ids, $group_id) |
1631 | 1633 | { |
@@ -1644,7 +1646,7 @@ discard block |
||
1644 | 1646 | |
1645 | 1647 | /** |
1646 | 1648 | * Unsubscribe all users from one or more groups |
1647 | - * @param mixed $group_id Can be an array with group-id's or a single group-id |
|
1649 | + * @param mixed $group_ids Can be an array with group-id's or a single group-id |
|
1648 | 1650 | * @return bool TRUE if successful |
1649 | 1651 | */ |
1650 | 1652 | public static function unsubscribe_all_users($group_ids) |
@@ -1676,7 +1678,7 @@ discard block |
||
1676 | 1678 | |
1677 | 1679 | /** |
1678 | 1680 | * Unsubscribe all tutors from one or more groups |
1679 | - * @param mixed $group_id Can be an array with group-id's or a single group-id |
|
1681 | + * @param mixed $group_ids Can be an array with group-id's or a single group-id |
|
1680 | 1682 | * @see unsubscribe_all_users. This function is almost an exact copy of that function. |
1681 | 1683 | * @return bool TRUE if successful |
1682 | 1684 | * @author Patrick Cool <[email protected]>, Ghent University |
@@ -1861,6 +1863,7 @@ discard block |
||
1861 | 1863 | * |
1862 | 1864 | * @param $user_array_in list of users (must be sorted). |
1863 | 1865 | * @param string $compare_field, the field to be compared |
1866 | + * @param string $compare_field |
|
1864 | 1867 | */ |
1865 | 1868 | public static function filter_duplicates($user_array_in, $compare_field) |
1866 | 1869 | { |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | $sql = "UPDATE $table_group SET id = iid WHERE iid = $lastId"; |
212 | 212 | Database::query($sql); |
213 | 213 | |
214 | - $desired_dir_name= '/'.api_replace_dangerous_char($name).'_groupdocs'; |
|
215 | - $my_path = api_get_path(SYS_COURSE_PATH) . $currentCourseRepository . '/document'; |
|
214 | + $desired_dir_name = '/'.api_replace_dangerous_char($name).'_groupdocs'; |
|
215 | + $my_path = api_get_path(SYS_COURSE_PATH).$currentCourseRepository.'/document'; |
|
216 | 216 | |
217 | 217 | $newFolderData = create_unexisting_directory( |
218 | 218 | $_course, |
@@ -275,11 +275,11 @@ discard block |
||
275 | 275 | $values['default_view_type_group']['default_view_type'] = api_get_setting('default_forum_view'); |
276 | 276 | $values['group_forum'] = $lastId; |
277 | 277 | if ($forumState == '1') { |
278 | - $values['public_private_group_forum_group']['public_private_group_forum']='public'; |
|
278 | + $values['public_private_group_forum_group']['public_private_group_forum'] = 'public'; |
|
279 | 279 | } elseif ($forumState == '2') { |
280 | - $values['public_private_group_forum_group']['public_private_group_forum']='private'; |
|
280 | + $values['public_private_group_forum_group']['public_private_group_forum'] = 'private'; |
|
281 | 281 | } elseif ($forumState == '0') { |
282 | - $values['public_private_group_forum_group']['public_private_group_forum']='unavailable'; |
|
282 | + $values['public_private_group_forum_group']['public_private_group_forum'] = 'unavailable'; |
|
283 | 283 | } |
284 | 284 | store_forum($values); |
285 | 285 | } |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | 1 |
312 | 312 | ); |
313 | 313 | $users = self::get_users($group_id); |
314 | - $group_ids = array (); |
|
314 | + $group_ids = array(); |
|
315 | 315 | |
316 | - for ($group_nr = 1; $group_nr <= $number_of_groups; $group_nr ++) { |
|
316 | + for ($group_nr = 1; $group_nr <= $number_of_groups; $group_nr++) { |
|
317 | 317 | $group_ids[] = self::create_group( |
318 | 318 | get_lang('Subgroup').' '.$group_nr, |
319 | 319 | $category_id, |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | $group_table = Database:: get_course_table(TABLE_GROUP); |
383 | 383 | $forum_table = Database:: get_course_table(TABLE_FORUM); |
384 | 384 | |
385 | - $group_ids = is_array($group_ids) ? $group_ids : array ($group_ids); |
|
385 | + $group_ids = is_array($group_ids) ? $group_ids : array($group_ids); |
|
386 | 386 | $group_ids = array_map('intval', $group_ids); |
387 | 387 | |
388 | 388 | if (api_is_course_coach()) { |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | } elseif ($forum_state === 0) { |
626 | 626 | $sql2 .= " forum_group_public_private='unavailable' "; |
627 | 627 | } |
628 | - $sql2 .=" WHERE c_id = $course_id AND forum_of_group=".$group_id; |
|
628 | + $sql2 .= " WHERE c_id = $course_id AND forum_of_group=".$group_id; |
|
629 | 629 | Database::query($sql2); |
630 | 630 | return $result; |
631 | 631 | } |
@@ -655,13 +655,13 @@ discard block |
||
655 | 655 | public static function get_categories($course_code = null) |
656 | 656 | { |
657 | 657 | $course_info = api_get_course_info($course_code); |
658 | - $course_id = $course_info['real_id']; |
|
658 | + $course_id = $course_info['real_id']; |
|
659 | 659 | $table_group_cat = Database :: get_course_table(TABLE_GROUP_CATEGORY); |
660 | 660 | $sql = "SELECT * FROM $table_group_cat |
661 | 661 | WHERE c_id = $course_id |
662 | 662 | ORDER BY display_order"; |
663 | 663 | $res = Database::query($sql); |
664 | - $cats = array (); |
|
664 | + $cats = array(); |
|
665 | 665 | while ($cat = Database::fetch_array($res)) { |
666 | 666 | $cats[] = $cat; |
667 | 667 | } |
@@ -941,7 +941,7 @@ discard block |
||
941 | 941 | */ |
942 | 942 | public static function get_current_max_groups_per_user($category_id = null, $course_code = null) |
943 | 943 | { |
944 | - $course_info = api_get_course_info ($course_code); |
|
944 | + $course_info = api_get_course_info($course_code); |
|
945 | 945 | $group_table = Database :: get_course_table(TABLE_GROUP); |
946 | 946 | $group_user_table = Database :: get_course_table(TABLE_GROUP_USER); |
947 | 947 | $sql = 'SELECT COUNT(gu.group_id) AS current_max |
@@ -1184,17 +1184,17 @@ discard block |
||
1184 | 1184 | { |
1185 | 1185 | $_course = api_get_course_info(); |
1186 | 1186 | |
1187 | - $group_ids = is_array($group_ids) ? $group_ids : array ($group_ids); |
|
1187 | + $group_ids = is_array($group_ids) ? $group_ids : array($group_ids); |
|
1188 | 1188 | $group_ids = array_map('intval', $group_ids); |
1189 | 1189 | |
1190 | 1190 | if (api_is_course_coach()) { |
1191 | - for ($i=0 ; $i < count($group_ids) ; $i++) { |
|
1192 | - if (!api_is_element_in_the_session(TOOL_GROUP, $group_ids[$i])){ |
|
1193 | - array_splice($group_ids,$i,1); |
|
1191 | + for ($i = 0; $i < count($group_ids); $i++) { |
|
1192 | + if (!api_is_element_in_the_session(TOOL_GROUP, $group_ids[$i])) { |
|
1193 | + array_splice($group_ids, $i, 1); |
|
1194 | 1194 | $i--; |
1195 | 1195 | } |
1196 | 1196 | } |
1197 | - if (count($group_ids)==0) { |
|
1197 | + if (count($group_ids) == 0) { |
|
1198 | 1198 | return false; |
1199 | 1199 | } |
1200 | 1200 | } |
@@ -1233,9 +1233,9 @@ discard block |
||
1233 | 1233 | * Retrieve course users (reverse) ordered by the number |
1234 | 1234 | * of group they are already enrolled |
1235 | 1235 | */ |
1236 | - for ($i = 0; $i < count($complete_user_list); $i ++) { |
|
1236 | + for ($i = 0; $i < count($complete_user_list); $i++) { |
|
1237 | 1237 | //find # of groups the user is enrolled in |
1238 | - $number_of_groups = self :: user_in_number_of_groups($complete_user_list[$i]["user_id"], (isset($category['id'])?$category['id']:null)); |
|
1238 | + $number_of_groups = self :: user_in_number_of_groups($complete_user_list[$i]["user_id"], (isset($category['id']) ? $category['id'] : null)); |
|
1239 | 1239 | //add # of groups to user list |
1240 | 1240 | $complete_user_list[$i]['number_groups_left'] = $number_groups_per_user - $number_of_groups; |
1241 | 1241 | } |
@@ -1247,7 +1247,7 @@ discard block |
||
1247 | 1247 | |
1248 | 1248 | //now sort by # of group left |
1249 | 1249 | $complete_user_list = TableSort :: sort_table($complete_user_list, 'number_groups_left', SORT_DESC); |
1250 | - $userToken = array (); |
|
1250 | + $userToken = array(); |
|
1251 | 1251 | foreach ($complete_user_list as $this_user) { |
1252 | 1252 | if ($this_user['number_groups_left'] > 0) { |
1253 | 1253 | $userToken[$this_user['user_id']] = $this_user['number_groups_left']; |
@@ -1443,7 +1443,7 @@ discard block |
||
1443 | 1443 | if ($category['groups_per_user'] == self::GROUP_PER_MEMBER_NO_LIMIT) { |
1444 | 1444 | $category['groups_per_user'] = self::INFINITE; |
1445 | 1445 | } |
1446 | - $result = self:: user_in_number_of_groups($user_id, $category['id'] ) < $category['groups_per_user']; |
|
1446 | + $result = self:: user_in_number_of_groups($user_id, $category['id']) < $category['groups_per_user']; |
|
1447 | 1447 | if ($result == false) { |
1448 | 1448 | return false; |
1449 | 1449 | } |
@@ -1554,7 +1554,7 @@ discard block |
||
1554 | 1554 | tg.group_id='".$group_id."' AND |
1555 | 1555 | tg.user_id=u.user_id".$order_clause; |
1556 | 1556 | $db_result = Database::query($sql); |
1557 | - $users = array (); |
|
1557 | + $users = array(); |
|
1558 | 1558 | while ($user = Database::fetch_object($db_result)) { |
1559 | 1559 | if (!$id_only) { |
1560 | 1560 | $member['user_id'] = $user->user_id; |
@@ -1619,8 +1619,8 @@ discard block |
||
1619 | 1619 | foreach ($user_ids as $user_id) { |
1620 | 1620 | $user_id = intval($user_id); |
1621 | 1621 | if (self::can_user_subscribe($user_id, $group_id, false)) { |
1622 | - $sql = "INSERT INTO " . $table_group_tutor . " (c_id, user_id, group_id) |
|
1623 | - VALUES ('$course_id', '" . $user_id . "', '" . $group_id . "')"; |
|
1622 | + $sql = "INSERT INTO ".$table_group_tutor." (c_id, user_id, group_id) |
|
1623 | + VALUES ('$course_id', '".$user_id."', '".$group_id."')"; |
|
1624 | 1624 | $result &= Database::query($sql); |
1625 | 1625 | } |
1626 | 1626 | } |
@@ -1636,7 +1636,7 @@ discard block |
||
1636 | 1636 | */ |
1637 | 1637 | public static function unsubscribe_users($user_ids, $group_id) |
1638 | 1638 | { |
1639 | - $user_ids = is_array($user_ids) ? $user_ids : array ($user_ids); |
|
1639 | + $user_ids = is_array($user_ids) ? $user_ids : array($user_ids); |
|
1640 | 1640 | $table_group_user = Database :: get_course_table(TABLE_GROUP_USER); |
1641 | 1641 | $group_id = intval($group_id); |
1642 | 1642 | $course_id = api_get_course_int_id(); |
@@ -2183,7 +2183,7 @@ discard block |
||
2183 | 2183 | * Retrieve course users (reverse) ordered by the number |
2184 | 2184 | * of group they are already enrolled |
2185 | 2185 | */ |
2186 | - for ($i = 0; $i < count($complete_user_list); $i ++) { |
|
2186 | + for ($i = 0; $i < count($complete_user_list); $i++) { |
|
2187 | 2187 | // find # of groups the user is enrolled in |
2188 | 2188 | $number_of_groups = self:: user_in_number_of_groups( |
2189 | 2189 | $complete_user_list[$i]["user_id"], |
@@ -2316,14 +2316,14 @@ discard block |
||
2316 | 2316 | !(api_is_course_coach() && intval($this_group['session_id']) != $session_id) |
2317 | 2317 | ) { |
2318 | 2318 | $edit_actions = '<a href="'.$url.'settings.php?'.api_get_cidreq(true, false).'&gidReq='.$this_group['id'].'" title="'.get_lang('Edit').'">'. |
2319 | - Display::return_icon('edit.png', get_lang('EditGroup'),'',ICON_SIZE_SMALL).'</a> '; |
|
2319 | + Display::return_icon('edit.png', get_lang('EditGroup'), '', ICON_SIZE_SMALL).'</a> '; |
|
2320 | 2320 | |
2321 | 2321 | if ($this_group['status'] == 1) { |
2322 | - $edit_actions .= '<a href="' . api_get_self() . '?' . api_get_cidreq(true,false) . '&category=' . $category_id . '&action=set_invisible&id=' . $this_group['id'] . '" title="' . get_lang('Hide') . '">' . |
|
2323 | - Display::return_icon('visible.png', get_lang('Hide'), '', ICON_SIZE_SMALL) . '</a> '; |
|
2322 | + $edit_actions .= '<a href="'.api_get_self().'?'.api_get_cidreq(true, false).'&category='.$category_id.'&action=set_invisible&id='.$this_group['id'].'" title="'.get_lang('Hide').'">'. |
|
2323 | + Display::return_icon('visible.png', get_lang('Hide'), '', ICON_SIZE_SMALL).'</a> '; |
|
2324 | 2324 | } else { |
2325 | - $edit_actions .= '<a href="' . api_get_self() . '?' . api_get_cidreq(true, false) . '&category=' . $category_id . '&action=set_visible&id=' . $this_group['id'] . '" title="' . get_lang('Show') . '">' . |
|
2326 | - Display::return_icon('invisible.png', get_lang('Show'), '', ICON_SIZE_SMALL) . '</a> '; |
|
2325 | + $edit_actions .= '<a href="'.api_get_self().'?'.api_get_cidreq(true, false).'&category='.$category_id.'&action=set_visible&id='.$this_group['id'].'" title="'.get_lang('Show').'">'. |
|
2326 | + Display::return_icon('invisible.png', get_lang('Show'), '', ICON_SIZE_SMALL).'</a> '; |
|
2327 | 2327 | } |
2328 | 2328 | |
2329 | 2329 | $edit_actions .= '<a href="'.$url.'member_settings.php?'.api_get_cidreq(true, false).'&gidReq='.$this_group['id'].'" title="'.get_lang('GroupMembers').'">'. |
@@ -2336,10 +2336,10 @@ discard block |
||
2336 | 2336 | Display::return_icon('clean.png',get_lang('EmptyGroup'),'',ICON_SIZE_SMALL).'</a> ';*/ |
2337 | 2337 | |
2338 | 2338 | $edit_actions .= '<a href="'.api_get_self().'?'.api_get_cidreq(true, false).'&category='.$category_id.'&action=fill_one&id='.$this_group['id'].'" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('FillGroup').'">'. |
2339 | - Display::return_icon('fill.png',get_lang('FillGroup'),'',ICON_SIZE_SMALL).'</a> '; |
|
2339 | + Display::return_icon('fill.png', get_lang('FillGroup'), '', ICON_SIZE_SMALL).'</a> '; |
|
2340 | 2340 | |
2341 | 2341 | $edit_actions .= '<a href="'.api_get_self().'?'.api_get_cidreq(true, false).'&category='.$category_id.'&action=delete_one&id='.$this_group['id'].'" onclick="javascript: if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'">'. |
2342 | - Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a> '; |
|
2342 | + Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a> '; |
|
2343 | 2343 | |
2344 | 2344 | $row[] = $edit_actions; |
2345 | 2345 | } |
@@ -2711,7 +2711,7 @@ discard block |
||
2711 | 2711 | $activeTutor = null; |
2712 | 2712 | $activeMember = null; |
2713 | 2713 | |
2714 | - switch($default) { |
|
2714 | + switch ($default) { |
|
2715 | 2715 | case 'settings': |
2716 | 2716 | $activeSettings = 'active'; |
2717 | 2717 | break; |
@@ -138,7 +138,7 @@ |
||
138 | 138 | |
139 | 139 | /** |
140 | 140 | * Return a list an associative array where keys are the active hook observer class name |
141 | - * @param $eventName |
|
141 | + * @param string $eventName |
|
142 | 142 | * |
143 | 143 | * @return array |
144 | 144 | */ |
@@ -145,10 +145,10 @@ discard block |
||
145 | 145 | public function listHookObservers($eventName) |
146 | 146 | { |
147 | 147 | $array = array(); |
148 | - $joinTable = $this->tables[TABLE_HOOK_CALL] . ' hc' . |
|
149 | - ' INNER JOIN ' . $this->tables[TABLE_HOOK_EVENT] . ' he' . |
|
150 | - ' ON hc.hook_event_id = he.id ' . |
|
151 | - ' INNER JOIN ' . $this->tables[TABLE_HOOK_OBSERVER] . ' ho ' . |
|
148 | + $joinTable = $this->tables[TABLE_HOOK_CALL].' hc'. |
|
149 | + ' INNER JOIN '.$this->tables[TABLE_HOOK_EVENT].' he'. |
|
150 | + ' ON hc.hook_event_id = he.id '. |
|
151 | + ' INNER JOIN '.$this->tables[TABLE_HOOK_OBSERVER].' ho '. |
|
152 | 152 | ' ON hc.hook_observer_id = ho.id '; |
153 | 153 | $columns = 'ho.class_name, ho.path, ho.plugin_name, hc.enabled'; |
154 | 154 | $where = array('where' => array('he.class_name = ? ' => $eventName, 'AND hc.enabled = ? ' => 1)); |
@@ -202,10 +202,10 @@ discard block |
||
202 | 202 | public function listAllHookCalls() |
203 | 203 | { |
204 | 204 | $array = array(); |
205 | - $joinTable = $this->tables[TABLE_HOOK_CALL] . ' hc' . |
|
206 | - ' INNER JOIN ' . $this->tables[TABLE_HOOK_EVENT] . ' he' . |
|
207 | - ' ON hc.hook_event_id = he.id ' . |
|
208 | - ' INNER JOIN ' . $this->tables[TABLE_HOOK_OBSERVER] . ' ho ' . |
|
205 | + $joinTable = $this->tables[TABLE_HOOK_CALL].' hc'. |
|
206 | + ' INNER JOIN '.$this->tables[TABLE_HOOK_EVENT].' he'. |
|
207 | + ' ON hc.hook_event_id = he.id '. |
|
208 | + ' INNER JOIN '.$this->tables[TABLE_HOOK_OBSERVER].' ho '. |
|
209 | 209 | ' ON hc.hook_observer_id = ho.id '; |
210 | 210 | $columns = 'he.class_name AS event_class_name, ho.class_name AS observer_class_name, hc.id AS id, hc.type AS type'; |
211 | 211 | $rows = Database::select($columns, $joinTable); |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | if (isset($eventName) && !isset($this->hookEvents[$eventName])) { |
232 | 232 | $attributes = array( |
233 | 233 | 'class_name' => $eventName, |
234 | - 'description' => get_lang('HookDescription' . $eventName), |
|
234 | + 'description' => get_lang('HookDescription'.$eventName), |
|
235 | 235 | ); |
236 | 236 | $id = Database::insert($this->tables[TABLE_HOOK_EVENT], $attributes); |
237 | 237 | $this->hookEvents[$eventName] = $id; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | // Check if exists hook observer |
241 | 241 | if (isset($observerClassName) && |
242 | 242 | !isset($this->hookObservers[$observerClassName]) |
243 | - ){ |
|
243 | + ) { |
|
244 | 244 | $object = $observerClassName::create(); |
245 | 245 | $attributes = array( |
246 | 246 | 'class_name' => $observerClassName, |
@@ -338,10 +338,10 @@ discard block |
||
338 | 338 | $eventName = Database::escape_string($eventName); |
339 | 339 | $observerClassName($observerClassName); |
340 | 340 | $type = Database::escape_string($type); |
341 | - $joinTable = $this->tables[TABLE_HOOK_CALL] . ' hc' . |
|
342 | - ' INNER JOIN ' . $this->tables[TABLE_HOOK_EVENT] . ' he' . |
|
343 | - ' ON hc.hook_event_id = he.id ' . |
|
344 | - ' INNER JOIN ' . $this->tables[TABLE_HOOK_OBSERVER] . ' ho ' . |
|
341 | + $joinTable = $this->tables[TABLE_HOOK_CALL].' hc'. |
|
342 | + ' INNER JOIN '.$this->tables[TABLE_HOOK_EVENT].' he'. |
|
343 | + ' ON hc.hook_event_id = he.id '. |
|
344 | + ' INNER JOIN '.$this->tables[TABLE_HOOK_OBSERVER].' ho '. |
|
345 | 345 | ' ON hc.hook_observer_id = ho.id '; |
346 | 346 | $row = Database::select( |
347 | 347 | 'id', |
@@ -266,6 +266,7 @@ discard block |
||
266 | 266 | * @global bool $is_platformAdmin |
267 | 267 | * @global bool $is_allowedCreateCourse |
268 | 268 | * @global object $_user |
269 | + * @param boolean $reset |
|
269 | 270 | */ |
270 | 271 | public static function init_user($user_id, $reset) |
271 | 272 | { |
@@ -355,7 +356,7 @@ discard block |
||
355 | 356 | * @global type $is_allowed_in_course |
356 | 357 | * |
357 | 358 | * @param type $course_id |
358 | - * @param type $reset |
|
359 | + * @param boolean $reset |
|
359 | 360 | */ |
360 | 361 | static function init_course($course_id, $reset) |
361 | 362 | { |
@@ -37,24 +37,24 @@ discard block |
||
37 | 37 | if ($by_username) { |
38 | 38 | $secret_word = self::get_secret_word($user['email']); |
39 | 39 | if ($reset) { |
40 | - $reset_link = $portal_url . "main/auth/lostPassword.php?reset=" . $secret_word . "&id=" . $user['uid']; |
|
40 | + $reset_link = $portal_url."main/auth/lostPassword.php?reset=".$secret_word."&id=".$user['uid']; |
|
41 | 41 | } else { |
42 | - $reset_link = get_lang('Pass') . " : $user[password]"; |
|
42 | + $reset_link = get_lang('Pass')." : $user[password]"; |
|
43 | 43 | } |
44 | - $user_account_list = get_lang('YourRegistrationData') . " : \n" . get_lang('UserName') . ' : ' . $user['loginName'] . "\n" . get_lang('ResetLink') . ' : ' . $reset_link . ''; |
|
44 | + $user_account_list = get_lang('YourRegistrationData')." : \n".get_lang('UserName').' : '.$user['loginName']."\n".get_lang('ResetLink').' : '.$reset_link.''; |
|
45 | 45 | |
46 | 46 | if ($user_account_list) { |
47 | - $user_account_list = "\n-----------------------------------------------\n" . $user_account_list; |
|
47 | + $user_account_list = "\n-----------------------------------------------\n".$user_account_list; |
|
48 | 48 | } |
49 | 49 | } else { |
50 | 50 | foreach ($user as $this_user) { |
51 | 51 | $secret_word = self::get_secret_word($this_user['email']); |
52 | 52 | if ($reset) { |
53 | - $reset_link = $portal_url . "main/auth/lostPassword.php?reset=" . $secret_word . "&id=" . $this_user['uid']; |
|
53 | + $reset_link = $portal_url."main/auth/lostPassword.php?reset=".$secret_word."&id=".$this_user['uid']; |
|
54 | 54 | } else { |
55 | - $reset_link = get_lang('Pass') . " : $this_user[password]"; |
|
55 | + $reset_link = get_lang('Pass')." : $this_user[password]"; |
|
56 | 56 | } |
57 | - $user_account_list[] = get_lang('YourRegistrationData') . " : \n" . get_lang('UserName') . ' : ' . $this_user['loginName'] . "\n" . get_lang('ResetLink') . ' : ' . $reset_link . ''; |
|
57 | + $user_account_list[] = get_lang('YourRegistrationData')." : \n".get_lang('UserName').' : '.$this_user['loginName']."\n".get_lang('ResetLink').' : '.$reset_link.''; |
|
58 | 58 | } |
59 | 59 | if ($user_account_list) { |
60 | 60 | $user_account_list = implode("\n-----------------------------------------------\n", $user_account_list); |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | if (!$by_username) { |
65 | 65 | $user = $user[0]; |
66 | 66 | } |
67 | - $reset_link = get_lang('Pass') . " : $user[password]"; |
|
68 | - $user_account_list = get_lang('YourRegistrationData') . " : \n" . get_lang('UserName') . ' : ' . $user['loginName'] . "\n" . $reset_link . ''; |
|
67 | + $reset_link = get_lang('Pass')." : $user[password]"; |
|
68 | + $user_account_list = get_lang('YourRegistrationData')." : \n".get_lang('UserName').' : '.$user['loginName']."\n".$reset_link.''; |
|
69 | 69 | } |
70 | 70 | return $user_account_list; |
71 | 71 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public static function send_password_to_user($user, $by_username = false) |
80 | 80 | { |
81 | - $email_subject = "[" . api_get_setting('siteName') . "] " . get_lang('LoginRequest'); // SUBJECT |
|
81 | + $email_subject = "[".api_get_setting('siteName')."] ".get_lang('LoginRequest'); // SUBJECT |
|
82 | 82 | |
83 | 83 | if ($by_username) { // Show only for lost password |
84 | 84 | $user_account_list = self::get_user_account_list($user, false, $by_username); // BODY |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | } |
99 | 99 | |
100 | - $email_body = get_lang('YourAccountParam') . " " . $portal_url . "\n\n$user_account_list"; |
|
100 | + $email_body = get_lang('YourAccountParam')." ".$portal_url."\n\n$user_account_list"; |
|
101 | 101 | // SEND MESSAGE |
102 | 102 | $sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS); |
103 | 103 | $email_admin = api_get_setting('emailAdministrator'); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public static function handle_encrypted_password($user, $by_username = false) |
133 | 133 | { |
134 | - $email_subject = "[" . api_get_setting('siteName') . "] " . get_lang('LoginRequest'); // SUBJECT |
|
134 | + $email_subject = "[".api_get_setting('siteName')."] ".get_lang('LoginRequest'); // SUBJECT |
|
135 | 135 | |
136 | 136 | if ($by_username) { |
137 | 137 | // Show only for lost password |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | $user_account_list = self::get_user_account_list($user, true); // BODY |
142 | 142 | $email_to = $user[0]['email']; |
143 | 143 | } |
144 | - $email_body = get_lang('DearUser') . " :\n" . get_lang('password_request') . "\n"; |
|
145 | - $email_body .= $user_account_list . "\n-----------------------------------------------\n\n"; |
|
144 | + $email_body = get_lang('DearUser')." :\n".get_lang('password_request')."\n"; |
|
145 | + $email_body .= $user_account_list."\n-----------------------------------------------\n\n"; |
|
146 | 146 | $email_body .= get_lang('PasswordEncryptedForSecurity'); |
147 | 147 | |
148 | - $email_body .= "\n\n" . get_lang('SignatureFormula') . ",\n" . api_get_setting('administratorName') . " " . api_get_setting('administratorSurname') . "\n" . get_lang('PlataformAdmin') . " - " . api_get_setting('siteName'); |
|
148 | + $email_body .= "\n\n".get_lang('SignatureFormula').",\n".api_get_setting('administratorName')." ".api_get_setting('administratorSurname')."\n".get_lang('PlataformAdmin')." - ".api_get_setting('siteName'); |
|
149 | 149 | |
150 | 150 | $sender_name = api_get_person_name( |
151 | 151 | api_get_setting('administratorName'), |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | username AS loginName, |
239 | 239 | password, |
240 | 240 | |
241 | - FROM " . $tbl_user . " |
|
241 | + FROM " . $tbl_user." |
|
242 | 242 | WHERE user_id = $id"; |
243 | 243 | $result = Database::query($sql); |
244 | 244 | $num_rows = Database::num_rows($result); |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | ON user.user_id = a.user_id |
292 | 292 | LEFT JOIN $track_e_login login |
293 | 293 | ON user.user_id = login.login_user_id |
294 | - WHERE user.user_id = '" . $_user['user_id'] . "' |
|
294 | + WHERE user.user_id = '".$_user['user_id']."' |
|
295 | 295 | ORDER BY login.login_date DESC LIMIT 1"; |
296 | 296 | |
297 | 297 | $result = Database::query($sql); |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | Session::write('is_platformAdmin', $is_platformAdmin); |
322 | 322 | Session::write('is_allowedCreateCourse', $is_allowedCreateCourse); |
323 | 323 | } else { |
324 | - header('location:' . api_get_path(WEB_PATH)); |
|
324 | + header('location:'.api_get_path(WEB_PATH)); |
|
325 | 325 | //exit("WARNING UNDEFINED UID !! "); |
326 | 326 | } |
327 | 327 | } else { // no uid => logout or Anonymous |
@@ -368,9 +368,9 @@ discard block |
||
368 | 368 | global $_course; |
369 | 369 | global $_real_cid; |
370 | 370 | |
371 | - global $is_courseAdmin; //course teacher |
|
372 | - global $is_courseTutor; //course teacher - some rights |
|
373 | - global $is_courseCoach; //course coach |
|
371 | + global $is_courseAdmin; //course teacher |
|
372 | + global $is_courseTutor; //course teacher - some rights |
|
373 | + global $is_courseCoach; //course coach |
|
374 | 374 | global $is_courseMember; //course student |
375 | 375 | global $is_sessionAdmin; |
376 | 376 | global $is_allowed_in_course; |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | |
428 | 428 | if (!empty($_GET['id_session'])) { |
429 | 429 | $_SESSION['id_session'] = intval($_GET['id_session']); |
430 | - $sql = 'SELECT name FROM ' . $tbl_session . ' WHERE id="' . intval($_SESSION['id_session']) . '"'; |
|
430 | + $sql = 'SELECT name FROM '.$tbl_session.' WHERE id="'.intval($_SESSION['id_session']).'"'; |
|
431 | 431 | $rs = Database::query($sql); |
432 | 432 | list($_SESSION['session_name']) = Database::fetch_array($rs); |
433 | 433 | } else { |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | } |
444 | 444 | } else { |
445 | 445 | //exit("WARNING UNDEFINED CID !! "); |
446 | - header('location:' . api_get_path(WEB_PATH)); |
|
446 | + header('location:'.api_get_path(WEB_PATH)); |
|
447 | 447 | } |
448 | 448 | } else { |
449 | 449 | Session::erase('_cid'); |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | } else { |
471 | 471 | // Continue with the previous values |
472 | 472 | if (empty($_SESSION['_course']) OR empty($_SESSION['_cid'])) { //no previous values... |
473 | - $_cid = -1; //set default values that will be caracteristic of being unset |
|
473 | + $_cid = -1; //set default values that will be caracteristic of being unset |
|
474 | 474 | $_course = -1; |
475 | 475 | } else { |
476 | 476 | $_cid = $_SESSION['_cid']; |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | // Moreover, if we want to track a course with another session it can be usefull |
481 | 481 | if (!empty($_GET['id_session'])) { |
482 | 482 | $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); |
483 | - $sql = 'SELECT name FROM ' . $tbl_session . ' WHERE id="' . intval($_SESSION['id_session']) . '"'; |
|
483 | + $sql = 'SELECT name FROM '.$tbl_session.' WHERE id="'.intval($_SESSION['id_session']).'"'; |
|
484 | 484 | $rs = Database::query($sql); |
485 | 485 | list($_SESSION['session_name']) = Database::fetch_array($rs); |
486 | 486 | $_SESSION['id_session'] = intval($_GET['id_session']); |
@@ -520,9 +520,9 @@ discard block |
||
520 | 520 | //But only if the login date is < than now + max_life_time |
521 | 521 | $sql = "SELECT course_access_id FROM $course_tracking_table |
522 | 522 | WHERE |
523 | - user_id = " . intval($_user ['user_id']) . " AND |
|
523 | + user_id = ".intval($_user ['user_id'])." AND |
|
524 | 524 | c_id = '".api_get_course_int_id()."' AND |
525 | - session_id = " . api_get_session_id() . " AND |
|
525 | + session_id = " . api_get_session_id()." AND |
|
526 | 526 | login_course_date > now() - INTERVAL $session_lifetime SECOND |
527 | 527 | ORDER BY login_course_date DESC LIMIT 0,1"; |
528 | 528 | $result = Database::query($sql); |
@@ -532,11 +532,11 @@ discard block |
||
532 | 532 | //We update the course tracking table |
533 | 533 | $sql = "UPDATE $course_tracking_table |
534 | 534 | SET logout_course_date = '$time', counter = counter+1 |
535 | - WHERE course_access_id = " . intval($i_course_access_id) . " AND session_id = " . api_get_session_id(); |
|
535 | + WHERE course_access_id = ".intval($i_course_access_id)." AND session_id = ".api_get_session_id(); |
|
536 | 536 | Database::query($sql); |
537 | 537 | } else { |
538 | - $sql = "INSERT INTO $course_tracking_table (c_id, user_id, login_course_date, logout_course_date, counter, session_id)" . |
|
539 | - "VALUES('" . api_get_course_int_id() . "', '" . $_user['user_id'] . "', '$time', '$time', '1','" . api_get_session_id() . "')"; |
|
538 | + $sql = "INSERT INTO $course_tracking_table (c_id, user_id, login_course_date, logout_course_date, counter, session_id)". |
|
539 | + "VALUES('".api_get_course_int_id()."', '".$_user['user_id']."', '$time', '$time', '1','".api_get_session_id()."')"; |
|
540 | 540 | Database::query($sql); |
541 | 541 | } |
542 | 542 | } |
@@ -564,8 +564,8 @@ discard block |
||
564 | 564 | $course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER); |
565 | 565 | $sql = "SELECT * FROM $course_user_table |
566 | 566 | WHERE |
567 | - user_id = '" . $user_id . "' AND |
|
568 | - relation_type <> " . COURSE_RELATION_TYPE_RRHH . " AND |
|
567 | + user_id = '".$user_id."' AND |
|
568 | + relation_type <> " . COURSE_RELATION_TYPE_RRHH." AND |
|
569 | 569 | course_code = '$course_id'"; |
570 | 570 | $result = Database::query($sql); |
571 | 571 | |
@@ -585,8 +585,8 @@ discard block |
||
585 | 585 | $session_id |
586 | 586 | ); |
587 | 587 | if (!$user_is_subscribed) { |
588 | - $url = api_get_path(WEB_CODE_PATH) . 'course_info/legal.php?course_code=' . $_course['code'] . '&session_id=' . $session_id; |
|
589 | - header('Location: ' . $url); |
|
588 | + $url = api_get_path(WEB_CODE_PATH).'course_info/legal.php?course_code='.$_course['code'].'&session_id='.$session_id; |
|
589 | + header('Location: '.$url); |
|
590 | 590 | exit; |
591 | 591 | } |
592 | 592 | } |
@@ -627,11 +627,11 @@ discard block |
||
627 | 627 | } else { |
628 | 628 | //Im a coach or a student? |
629 | 629 | $sql = "SELECT user_id, status |
630 | - FROM " . $tbl_session_course_user . " |
|
630 | + FROM " . $tbl_session_course_user." |
|
631 | 631 | WHERE |
632 | 632 | c_id = '$_cid' AND |
633 | - user_id = '" . $user_id . "' AND |
|
634 | - session_id = '" . $session_id . "' |
|
633 | + user_id = '".$user_id."' AND |
|
634 | + session_id = '" . $session_id."' |
|
635 | 635 | LIMIT 1"; |
636 | 636 | $result = Database::query($sql); |
637 | 637 | |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | if ($reset) { // session data refresh requested |
778 | 778 | if ($group_id && $_cid && !empty($_course['real_id'])) { // have keys to search data |
779 | 779 | $group_table = Database::get_course_table(TABLE_GROUP); |
780 | - $sql = "SELECT * FROM $group_table WHERE c_id = " . $_course['real_id'] . " AND id = '$group_id'"; |
|
780 | + $sql = "SELECT * FROM $group_table WHERE c_id = ".$_course['real_id']." AND id = '$group_id'"; |
|
781 | 781 | $result = Database::query($sql); |
782 | 782 | if (Database::num_rows($result) > 0) { // This group has recorded status related to this course |
783 | 783 | $gpData = Database::fetch_array($result); |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | */ |
831 | 831 | public static function get_user_accounts_by_username($username) |
832 | 832 | { |
833 | - if (strpos($username,'@')){ |
|
833 | + if (strpos($username, '@')) { |
|
834 | 834 | $username = api_strtolower($username); |
835 | 835 | $email = true; |
836 | 836 | } else { |
@@ -852,14 +852,14 @@ discard block |
||
852 | 852 | $email = false; |
853 | 853 | } |
854 | 854 | |
855 | - if ($email) { |
|
856 | - $condition = "LOWER(email) = '".Database::escape_string($username)."' "; |
|
857 | - } else { |
|
855 | + if ($email) { |
|
856 | + $condition = "LOWER(email) = '".Database::escape_string($username)."' "; |
|
857 | + } else { |
|
858 | 858 | $condition = "LOWER(username) = '".Database::escape_string($username)."'"; |
859 | 859 | } |
860 | 860 | |
861 | - $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
862 | - $query = "SELECT |
|
861 | + $tbl_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
862 | + $query = "SELECT |
|
863 | 863 | user_id AS uid, |
864 | 864 | lastname AS lastName, |
865 | 865 | firstname AS firstName, |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | auth_source |
875 | 875 | FROM $tbl_user |
876 | 876 | WHERE ( $condition AND active = 1) "; |
877 | - $result = Database::query($query); |
|
877 | + $result = Database::query($query); |
|
878 | 878 | $num_rows = Database::num_rows($result); |
879 | 879 | if ($result && $num_rows > 0) { |
880 | 880 | return Database::fetch_assoc($result); |