Completed
Push — 1.11.x ( 60645e...aacf46 )
by José
76:05 queued 37:57
created
main/inc/lib/formvalidator/Rule/UsernameAvailable.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -6,24 +6,24 @@
 block discarded – undo
6 6
  */
7 7
 class HTML_QuickForm_Rule_UsernameAvailable extends HTML_QuickForm_Rule
8 8
 {
9
-	/**
10
-	 * Function to check if a username is available
11
-	 * @see HTML_QuickForm_Rule
12
-	 * @param string $username Wanted username
13
-	 * @param string $current_username
14
-	 * @return boolean True if username is available
15
-	 */
16
-	function validate($username, $current_username = null) {
17
-		$user_table = Database::get_main_table(TABLE_MAIN_USER);
9
+    /**
10
+     * Function to check if a username is available
11
+     * @see HTML_QuickForm_Rule
12
+     * @param string $username Wanted username
13
+     * @param string $current_username
14
+     * @return boolean True if username is available
15
+     */
16
+    function validate($username, $current_username = null) {
17
+        $user_table = Database::get_main_table(TABLE_MAIN_USER);
18 18
         $username = Database::escape_string($username);
19 19
         $current_username = Database::escape_string($current_username);
20 20
 
21
-		$sql = "SELECT * FROM $user_table WHERE username = '$username'";
22
-		if (!is_null($current_username)) {
23
-			$sql .= " AND username != '$current_username'";
24
-		}
25
-		$res = Database::query($sql);
26
-		$number = Database::num_rows($res);
27
-		return $number == 0;
28
-	}
21
+        $sql = "SELECT * FROM $user_table WHERE username = '$username'";
22
+        if (!is_null($current_username)) {
23
+            $sql .= " AND username != '$current_username'";
24
+        }
25
+        $res = Database::query($sql);
26
+        $number = Database::num_rows($res);
27
+        return $number == 0;
28
+    }
29 29
 }
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Rule/CompareDateTimeText.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
      * @return boolean True if the 2 given dates match the operator
13 13
      */
14 14
     function validate($values, $operator = null) {
15
-    	$datetime1 = api_strtotime($values[0]);
15
+        $datetime1 = api_strtotime($values[0]);
16 16
         $datetime2 = api_strtotime($values[1]);
17 17
 
18 18
         if (strpos($operator, 'allow_empty') !== false) {
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
                 return true;
22 22
             }
23 23
         }
24
-		$result =  parent::validate(array($datetime1, $datetime2), $operator);
24
+        $result =  parent::validate(array($datetime1, $datetime2), $operator);
25 25
         return $result;
26 26
     }
27 27
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
                 return true;
22 22
             }
23 23
         }
24
-		$result =  parent::validate(array($datetime1, $datetime2), $operator);
24
+		$result = parent::validate(array($datetime1, $datetime2), $operator);
25 25
         return $result;
26 26
     }
27 27
 }
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Rule/HTML.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
      */
17 17
     function validate($html, $mode = NO_HTML)
18 18
     {
19
-        $allowed_tags = self::get_allowed_tags ($mode, $fullpage);
19
+        $allowed_tags = self::get_allowed_tags($mode, $fullpage);
20 20
         $cleaned_html = kses($html, $allowed_tags);
21 21
         return $html == $cleaned_html;
22 22
     }
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
         // Include the allowed tags.
34 34
         //include(dirname(__FILE__).'/allowed_tags.inc.php');
35 35
         global $allowed_tags_student, $allowed_tags_student_full_page, $allowed_tags_teacher, $allowed_tags_teacher_full_page;
36
-        switch($mode)
36
+        switch ($mode)
37 37
         {
38 38
             case NO_HTML:
39 39
                 return array();
Please login to merge, or discard this patch.
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -25,8 +25,6 @@
 block discarded – undo
25 25
      * Get allowed tags
26 26
      * @param int $mode NO_HTML, STUDENT_HTML, TEACHER_HTML,
27 27
      * STUDENT_HTML_FULLPAGE or TEACHER_HTML_FULLPAGE
28
-     * @param boolean $fullpage If true, the allowed tags for full-page editing
29
-     * are returned.
30 28
      */
31 29
     static function get_allowed_tags($mode)
32 30
     {
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Rule/MultipleRequired.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,10 +27,10 @@
 block discarded – undo
27 27
      */
28 28
     function validate($value, $options = null)
29 29
     {
30
-    	if(is_array($value))
31
-    	{
32
-    		$value = implode(null,$value);
33
-    	}
30
+        if(is_array($value))
31
+        {
32
+            $value = implode(null,$value);
33
+        }
34 34
         if ((string)$value == '') {
35 35
             return false;
36 36
         }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -27,11 +27,11 @@
 block discarded – undo
27 27
      */
28 28
     function validate($value, $options = null)
29 29
     {
30
-    	if(is_array($value))
30
+    	if (is_array($value))
31 31
     	{
32
-    		$value = implode(null,$value);
32
+    		$value = implode(null, $value);
33 33
     	}
34
-        if ((string)$value == '') {
34
+        if ((string) $value == '') {
35 35
             return false;
36 36
         }
37 37
         return true;
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Rule/FileName.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -9,18 +9,18 @@
 block discarded – undo
9 9
 class HTML_QuickForm_Rule_FileName extends HTML_QuickForm_Rule
10 10
 {
11 11
 
12
-	/**
13
-	 * @param $value array     Uploaded file info (from $_FILES)
14
-	 * @param null $options
15
-	 * @return bool
16
-	 */
17
-	public function validate($value, $options = null)
18
-	{
19
-		if ((isset($elementValue['error']) && $elementValue['error'] == 0) ||
20
-			(!empty($elementValue['tmp_name']) && $elementValue['tmp_name'] != 'none')) {
21
-			return is_uploaded_file($elementValue['tmp_name']);
22
-		} else {
23
-			return false;
24
-		}
25
-	}
12
+    /**
13
+     * @param $value array     Uploaded file info (from $_FILES)
14
+     * @param null $options
15
+     * @return bool
16
+     */
17
+    public function validate($value, $options = null)
18
+    {
19
+        if ((isset($elementValue['error']) && $elementValue['error'] == 0) ||
20
+            (!empty($elementValue['tmp_name']) && $elementValue['tmp_name'] != 'none')) {
21
+            return is_uploaded_file($elementValue['tmp_name']);
22
+        } else {
23
+            return false;
24
+        }
25
+    }
26 26
 }
Please login to merge, or discard this patch.
main/inc/lib/chamilo_session.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@
 block discarded – undo
109 109
         }*/
110 110
         // If the session time has expired, refresh the starttime value,
111 111
         //  so we're starting to count down from a later time
112
-        if ( $session->has('starttime') && $session->is_expired()) {
112
+        if ($session->has('starttime') && $session->is_expired()) {
113 113
             $session->destroy();
114 114
         } else {
115 115
             //error_log('Time not expired, extend session for a bit more');
Please login to merge, or discard this patch.
main/inc/lib/events_email.class.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 
125 125
                 // If the mail only need to be send once (we know that thanks to the events.conf), we log it in the table
126 126
                 if ($event_config[$event_name]["sending_mail_once"]) {
127
-                    $sql = 'INSERT INTO ' . Database::get_main_table(TABLE_EVENT_SENT) . ' (user_from, user_to, event_type_name)
127
+                    $sql = 'INSERT INTO '.Database::get_main_table(TABLE_EVENT_SENT).' (user_from, user_to, event_type_name)
128 128
                             VALUES ('.$event_data["user_id"].', '.$id.' ,"'.Database::escape_string($event_name).'")
129 129
                     ';
130 130
                     Database::query($sql);
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
         // Second, we send to people linked to the event
136 136
         // So, we get everyone
137 137
         $sql = 'SELECT u.user_id, u.language, u.email, u.firstname, u.lastname
138
-                FROM ' . Database::get_main_table(TABLE_EVENT_TYPE_REL_USER) . ' ue
138
+                FROM ' . Database::get_main_table(TABLE_EVENT_TYPE_REL_USER).' ue
139 139
                 INNER JOIN '.Database::get_main_table(TABLE_MAIN_USER).' u ON u.user_id = ue.user_id
140
-                WHERE event_type_name = "' . $event_name . '"';
140
+                WHERE event_type_name = "' . $event_name.'"';
141 141
         $result = Database::store_result(Database::query($sql), 'ASSOC');
142 142
         // for each of the linked users
143 143
         foreach ($result as $key => $value) {
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 
178 178
             // If the mail only need to be send once (we know that thanks to the events.conf, we log it in the table
179 179
             if ($event_config[$event_name]["sending_mail_once"]) {
180
-                $sql = 'INSERT INTO ' . Database::get_main_table(TABLE_EVENT_SENT) . '
180
+                $sql = 'INSERT INTO '.Database::get_main_table(TABLE_EVENT_SENT).'
181 181
                     (user_from, user_to, event_type_name)
182 182
                     VALUES ('.$event_data["user_id"].', '.$value["user_id"].' , "'.Database::escape_string($event_name).'");
183 183
                     ';
@@ -202,16 +202,16 @@  discard block
 block discarded – undo
202 202
         $current_language = api_get_interface_language();
203 203
 
204 204
         $sql = 'SELECT COUNT(*) as total
205
-                FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE) . ' em
206
-                INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE) . ' l
205
+                FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE).' em
206
+                INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE).' l
207 207
                 ON em.language_id = l.id
208 208
                 WHERE
209
-                    em.event_type_name = "' . $event_name . '" and
209
+                    em.event_type_name = "' . $event_name.'" and
210 210
                     l.dokeos_folder = "'.$current_language.'" and
211 211
                     em.activated = 1';
212 212
 
213 213
         $exists = Database::store_result(Database::query($sql), 'ASSOC');
214
-        if ($exists[0]["total"])  {
214
+        if ($exists[0]["total"]) {
215 215
             return true;
216 216
         } else {
217 217
             return false;
@@ -228,12 +228,12 @@  discard block
 block discarded – undo
228 228
     private static function getMessage($event_name, $language)
229 229
     {
230 230
         $sql = 'SELECT message, subject, l.dokeos_folder
231
-                FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE) . ' em
232
-                INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE) . ' l
231
+                FROM ' . Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE).' em
232
+                INNER JOIN ' . Database::get_main_table(TABLE_MAIN_LANGUAGE).' l
233 233
                 ON em.language_id = l.id
234 234
                 WHERE
235
-                    em.event_type_name = "' . $event_name . '" AND
236
-                    (l.dokeos_folder = "' . $language . '" OR l.dokeos_folder = "english") AND
235
+                    em.event_type_name = "' . $event_name.'" AND
236
+                    (l.dokeos_folder = "' . $language.'" OR l.dokeos_folder = "english") AND
237 237
                     em.message <> ""
238 238
                 ';
239 239
         return Database::store_result(Database::query($sql), 'ASSOC');
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
     private static function formatMessage(&$message, &$subject, $event_config, $event_name, &$event_data)
275 275
     {
276 276
         foreach ($event_config[$event_name]["available_keyvars"] as $key => $word) {
277
-            $message = str_replace('((' . $key . '))', $event_data[$word], $message);
278
-            $subject = str_replace('((' . $key . '))', $event_data[$word], $subject);
277
+            $message = str_replace('(('.$key.'))', $event_data[$word], $message);
278
+            $subject = str_replace('(('.$key.'))', $event_data[$word], $subject);
279 279
         }
280 280
     }
281 281
 }
Please login to merge, or discard this patch.
main/inc/lib/event_email_template.class.php 3 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
     /**
13 13
      * Constructor
14 14
      */
15
-	public function __construct()
15
+    public function __construct()
16 16
     {
17 17
         $this->table =  Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE);
18
-	}
18
+    }
19 19
 
20 20
     public function get_all($where_conditions = array())
21 21
     {
@@ -29,19 +29,19 @@  discard block
 block discarded – undo
29 29
     /**
30 30
      * Displays the title + grid
31 31
      */
32
-	public function display()
32
+    public function display()
33 33
     {
34
-		// action links
35
-		$content = Display::actions(array(
34
+        // action links
35
+        $content = Display::actions(array(
36 36
                 array(
37 37
                     'url' => 'event_type.php' ,
38 38
                     'content' => Display::return_icon('new_document.png', get_lang('Add'), array(), ICON_SIZE_MEDIUM)
39
-                 )
39
+                    )
40 40
             )
41 41
         );
42 42
         $content .= Display::grid_html('event_email_template');
43 43
         return $content;
44
-	}
44
+    }
45 45
 
46 46
     public function get_status_list()
47 47
     {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
                 'Height' => '250',
83 83
             )
84 84
         );
85
-	    $status_list = $this->get_status_list();
85
+        $status_list = $this->get_status_list();
86 86
         $form->addElement('select', 'status', get_lang('Status'), $status_list);
87 87
         if ($action == 'edit') {
88 88
             $form->addElement('text', 'created_at', get_lang('CreatedAt'));
@@ -99,17 +99,17 @@  discard block
 block discarded – undo
99 99
         $defaults = $this->get($id);
100 100
 
101 101
         if (!empty($defaults['created_at'])) {
102
-        	$defaults['created_at'] = api_convert_and_format_date($defaults['created_at']);
102
+            $defaults['created_at'] = api_convert_and_format_date($defaults['created_at']);
103 103
         }
104 104
         if (!empty($defaults['updated_at'])) {
105
-        	$defaults['updated_at'] = api_convert_and_format_date($defaults['updated_at']);
105
+            $defaults['updated_at'] = api_convert_and_format_date($defaults['updated_at']);
106 106
         }
107 107
         $form->setDefaults($defaults);
108 108
 
109 109
         // Setting the rules
110 110
         $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
111 111
 
112
-		return $form;
112
+        return $form;
113 113
     }
114 114
 
115 115
     public function get_count()
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -84,7 +84,7 @@
 block discarded – undo
84 84
 
85 85
     /**
86 86
      * Available driver list.
87
-     * @return array
87
+     * @return string[]
88 88
      */
89 89
     private function getDefaultDriverList()
90 90
     {
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
      */
15 15
 	public function __construct()
16 16
     {
17
-        $this->table =  Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE);
17
+        $this->table = Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE);
18 18
 	}
19 19
 
20 20
     /**
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		// action links
39 39
 		$content = Display::actions(array(
40 40
                 array(
41
-                    'url' => 'event_type.php' ,
41
+                    'url' => 'event_type.php',
42 42
                     'content' => Display::return_icon('new_document.png', get_lang('Add'), array(), ICON_SIZE_MEDIUM)
43 43
                  )
44 44
             )
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 
122 122
     public function get_count()
123 123
     {
124
-        $row = Database::select('count(*) as count', $this->table, array(),'first');
124
+        $row = Database::select('count(*) as count', $this->table, array(), 'first');
125 125
 
126 126
         return $row['count'];
127 127
     }
Please login to merge, or discard this patch.
main/inc/lib/myspace.lib.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2097,7 +2097,9 @@
 block discarded – undo
2097 2097
                 FROM $tbl_course course
2098 2098
                 WHERE course.code IN (".implode(',',$courses_code).")";
2099 2099
 
2100
-        if (!in_array($direction, array('ASC','DESC'))) $direction = 'ASC';
2100
+        if (!in_array($direction, array('ASC','DESC'))) {
2101
+            $direction = 'ASC';
2102
+        }
2101 2103
 
2102 2104
         $column = intval($column);
2103 2105
         $from = intval($from);
Please login to merge, or discard this patch.
Spacing   +168 added lines, -168 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         $session_id  = intval($session_id);
135 135
 
136 136
         $sql = 'SELECT login_course_date, logout_course_date
137
-                FROM ' . $tbl_track_course . '
137
+                FROM ' . $tbl_track_course.'
138 138
                 WHERE
139 139
                     user_id = '.$user_id.' AND
140 140
                     c_id = '.$courseId.' AND
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
         foreach ($course_list as $course_item) {
174 174
             $courseInfo = api_get_course_info($course_item['code']);
175 175
             $courseId = $courseInfo['real_id'];
176
-            $new_course_list[] =  '"'.$courseId.'"';
176
+            $new_course_list[] = '"'.$courseId.'"';
177 177
         }
178 178
         $course_list = implode(', ', $new_course_list);
179 179
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
             return false;
182 182
         }
183 183
         $sql = 'SELECT login_course_date, logout_course_date, c_id
184
-                FROM ' . $tbl_track_course . '
184
+                FROM ' . $tbl_track_course.'
185 185
                 WHERE
186 186
                     user_id = '.$user_id.' AND
187 187
                     c_id IN ('.$course_list.') AND
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
             // student score
260 260
             $avg_score = Tracking :: get_avg_student_score($user_id, $courseCode);
261 261
             if (is_numeric($avg_score)) {
262
-                $avg_score = round($avg_score,2);
262
+                $avg_score = round($avg_score, 2);
263 263
             } else {
264 264
                 $$avg_score = '-';
265 265
             }
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 
296 296
         $t_head = '    <table style="width: 100%;border:0;padding:0;border-collapse:collapse;table-layout: fixed">';
297 297
         //$t_head .= '  <caption>'.get_lang('CourseInformation').'</caption>';
298
-        $t_head .=      '<tr>';
298
+        $t_head .= '<tr>';
299 299
         $t_head .= '        <th width="155px" style="border-left:0;border-bottom:0"><span>'.get_lang('Course').'</span></th>';
300 300
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgTimeSpentInTheCourse'), 6, true).'</span></th>';
301 301
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgStudentsProgress'), 6, true).'</span></th>';
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 
314 314
         $addparams = array('view' => 'admin', 'display' => 'user');
315 315
 
316
-        $table = new SortableTable('tracking_user_overview', array('MySpace','get_number_of_users_tracking_overview'), array('MySpace','get_user_data_tracking_overview'), 0);
316
+        $table = new SortableTable('tracking_user_overview', array('MySpace', 'get_number_of_users_tracking_overview'), array('MySpace', 'get_user_data_tracking_overview'), 0);
317 317
         $table->additional_parameters = $addparams;
318 318
 
319 319
         $table->set_header(0, get_lang('OfficialCode'), true, array('style' => 'font-size:8pt'), array('style' => 'font-size:8pt'));
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
         }
327 327
         $table->set_header(3, get_lang('LoginName'), true, array('style' => 'font-size:8pt'), array('style' => 'font-size:8pt'));
328 328
         $table->set_header(4, $t_head, false, array('style' => 'width:90%;border:0;padding:0;font-size:7.5pt;'), array('style' => 'width:90%;padding:0;font-size:7.5pt;'));
329
-        $table->set_column_filter(4, array('MySpace','course_info_tracking_filter'));
329
+        $table->set_column_filter(4, array('MySpace', 'course_info_tracking_filter'));
330 330
         $table->display();
331 331
     }
332 332
 
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         $table -> set_header(7, get_lang('Sessions'), false);
372 372
 
373 373
         if ($is_western_name_order) {
374
-            $csv_header[] = array (
374
+            $csv_header[] = array(
375 375
                 get_lang('FirstName', ''),
376 376
                 get_lang('LastName', ''),
377 377
                 get_lang('TimeSpentOnThePlatform', ''),
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
                 get_lang('NumberOfSessions', '')
382 382
             );
383 383
         } else {
384
-            $csv_header[] = array (
384
+            $csv_header[] = array(
385 385
                 get_lang('LastName', ''),
386 386
                 get_lang('FirstName', ''),
387 387
                 get_lang('TimeSpentOnThePlatform', ''),
@@ -523,9 +523,9 @@  discard block
 block discarded – undo
523 523
 
524 524
         if ($tracking_column != 3) {
525 525
             if ($tracking_direction == 'DESC') {
526
-                usort($all_datas, array('MySpace','rsort_users'));
526
+                usort($all_datas, array('MySpace', 'rsort_users'));
527 527
             } else {
528
-                usort($all_datas, array('MySpace','sort_users'));
528
+                usort($all_datas, array('MySpace', 'sort_users'));
529 529
             }
530 530
         }
531 531
 
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
         /**
585 585
          * Column config
586 586
          */
587
-        $column_model   = array(
587
+        $column_model = array(
588 588
             array(
589 589
                 'name' => 'username',
590 590
                 'index' => 'username',
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 
626 626
         $action_links = '';
627 627
         // jqgrid will use this URL to do the selects
628
-        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_session_lp_progress&session_id=' . $sessionId . '&course_id=' . $courseId . '&date_to=' . $date_to . '&date_from=' . $date_from;
628
+        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_session_lp_progress&session_id='.$sessionId.'&course_id='.$courseId.'&date_to='.$date_to.'&date_from='.$date_from;
629 629
 
630 630
         //Table Id
631 631
         $tableId = 'lpProgress';
@@ -647,11 +647,11 @@  discard block
 block discarded – undo
647 647
             true
648 648
         );
649 649
 
650
-        $return = '<script>$(function() {'. $table .
650
+        $return = '<script>$(function() {'.$table.
651 651
             'jQuery("#'.$tableId.'").jqGrid("navGrid","#'.$tableId.'_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
652 652
                 jQuery("#'.$tableId.'").jqGrid("navButtonAdd","#'.$tableId.'_pager",{
653 653
                        caption:"",
654
-                       title:"' . get_lang('ExportExcel') . '",
654
+                       title:"' . get_lang('ExportExcel').'",
655 655
                        onClickButton : function () {
656 656
                            jQuery("#'.$tableId.'").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
657 657
                        }
@@ -701,7 +701,7 @@  discard block
 block discarded – undo
701 701
         /**
702 702
          * Column config
703 703
          */
704
-        $column_model   = array(
704
+        $column_model = array(
705 705
             array('name'=>'session', 'index'=>'session', 'align'=>'left', 'search' => 'true', 'wrap_cell' => "true"),
706 706
             array('name'=>'exercise_id', 'index'=>'exercise_id', 'align'=>'left', 'search' => 'true'),
707 707
             array('name'=>'quiz_title', 'index'=>'quiz_title', 'align'=>'left', 'search' => 'true'),
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
         //get dynamic column names
719 719
 
720 720
         // jqgrid will use this URL to do the selects
721
-        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_exercise_progress&session_id=' . $sessionId . '&course_id=' . $courseId  . '&exercise_id=' . $exerciseId . '&date_to=' . $date_to . '&date_from=' . $date_from;
721
+        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_exercise_progress&session_id='.$sessionId.'&course_id='.$courseId.'&exercise_id='.$exerciseId.'&date_to='.$date_to.'&date_from='.$date_from;
722 722
 
723 723
         // Autowidth
724 724
         $extra_params['autowidth'] = 'true';
@@ -729,11 +729,11 @@  discard block
 block discarded – undo
729 729
         $tableId = 'exerciseProgressOverview';
730 730
         $table = Display::grid_js($tableId, $url, $columns, $column_model, $extra_params, array(), '', true);
731 731
 
732
-        $return = '<script>$(function() {'. $table .
732
+        $return = '<script>$(function() {'.$table.
733 733
             'jQuery("#'.$tableId.'").jqGrid("navGrid","#'.$tableId.'_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
734 734
                 jQuery("#'.$tableId.'").jqGrid("navButtonAdd","#'.$tableId.'_pager",{
735 735
                        caption:"",
736
-                       title:"' . get_lang('ExportExcel') . '",
736
+                       title:"' . get_lang('ExportExcel').'",
737 737
                        onClickButton : function () {
738 738
                            jQuery("#'.$tableId.'").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
739 739
                        }
@@ -819,8 +819,8 @@  discard block
 block discarded – undo
819 819
 
820 820
                     $column[] = $title;
821 821
                     $column_model[] = array(
822
-                        'name' => 'exer' . $i,
823
-                        'index' => 'exer' . $i,
822
+                        'name' => 'exer'.$i,
823
+                        'index' => 'exer'.$i,
824 824
                         'align' => 'center',
825 825
                         'search' => 'true',
826 826
                         'wrap_cell' => "true"
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
 
833 833
         //end get dynamic column names
834 834
         // jqgrid will use this URL to do the selects
835
-        $url = api_get_path(WEB_AJAX_PATH) . 'model.ajax.php?a=get_exercise_grade&session_id=' . $sessionId . '&course_id=' . $courseId;
835
+        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_exercise_grade&session_id='.$sessionId.'&course_id='.$courseId;
836 836
 
837 837
         // Autowidth
838 838
         $extra_params['autowidth'] = 'true';
@@ -843,13 +843,13 @@  discard block
 block discarded – undo
843 843
         $tableId = 'exerciseGradeOverview';
844 844
         $table = Display::grid_js($tableId, $url, $column, $column_model, $extra_params, array(), '', true);
845 845
 
846
-        $return = '<script>$(function() {' . $table .
847
-            'jQuery("#' . $tableId . '").jqGrid("navGrid","#' . $tableId . '_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
848
-                jQuery("#' . $tableId . '").jqGrid("navButtonAdd","#' . $tableId . '_pager",{
846
+        $return = '<script>$(function() {'.$table.
847
+            'jQuery("#'.$tableId.'").jqGrid("navGrid","#'.$tableId.'_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
848
+                jQuery("#' . $tableId.'").jqGrid("navButtonAdd","#'.$tableId.'_pager",{
849 849
                        caption:"",
850
-                       title:"' . get_lang('ExportExcel') . '",
850
+                       title:"' . get_lang('ExportExcel').'",
851 851
                        onClickButton : function () {
852
-                           jQuery("#' . $tableId . '").jqGrid("excelExport",{"url":"' . $url . '&export_format=xls"});
852
+                           jQuery("#' . $tableId.'").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
853 853
                        }
854 854
                 });
855 855
             });</script>';
@@ -882,10 +882,10 @@  discard block
 block discarded – undo
882 882
         /**
883 883
          * Column config
884 884
          */
885
-        $column_model   = array(
886
-            array('name'=>'username',   'index'=>'username',    'align'=>'left', 'search' => 'true', 'wrap_cell' => "true"),
887
-            array('name'=>'firstname',  'index'=>'firstname',   'align'=>'left', 'search' => 'true'),
888
-            array('name'=>'lastname',   'index'=>'lastname',    'align'=>'left', 'search' => 'true'),
885
+        $column_model = array(
886
+            array('name'=>'username', 'index'=>'username', 'align'=>'left', 'search' => 'true', 'wrap_cell' => "true"),
887
+            array('name'=>'firstname', 'index'=>'firstname', 'align'=>'left', 'search' => 'true'),
888
+            array('name'=>'lastname', 'index'=>'lastname', 'align'=>'left', 'search' => 'true'),
889 889
         );
890 890
         //get dinamic column names
891 891
         foreach ($questions as $question_id => $question) {
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
         $action_links = '';
902 902
 
903 903
         // jqgrid will use this URL to do the selects
904
-        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_survey_overview&session_id=' . $sessionId . '&course_id=' . $courseId . '&survey_id=' . $surveyId . '&date_to=' . $date_to . '&date_from=' . $date_from;
904
+        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_survey_overview&session_id='.$sessionId.'&course_id='.$courseId.'&survey_id='.$surveyId.'&date_to='.$date_to.'&date_from='.$date_from;
905 905
 
906 906
         // Table Id
907 907
         $tableId = 'lpProgress';
@@ -923,11 +923,11 @@  discard block
 block discarded – undo
923 923
             true
924 924
         );
925 925
 
926
-        $return = '<script>$(function() {'. $table .
926
+        $return = '<script>$(function() {'.$table.
927 927
             'jQuery("#'.$tableId.'").jqGrid("navGrid","#'.$tableId.'_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
928 928
                 jQuery("#'.$tableId.'").jqGrid("navButtonAdd","#'.$tableId.'_pager",{
929 929
                        caption:"",
930
-                       title:"' . get_lang('ExportExcel') . '",
930
+                       title:"' . get_lang('ExportExcel').'",
931 931
                        onClickButton : function () {
932 932
                            jQuery("#'.$tableId.'").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
933 933
                        }
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
      * Display a sortable table that contains an overview off all the progress of the user in a session
943 943
      * @author César Perales <[email protected]>, Beeznest Team
944 944
      */
945
-    static function display_tracking_progress_overview($sessionId = 0, $courseId = 0,  $date_from, $date_to)
945
+    static function display_tracking_progress_overview($sessionId = 0, $courseId = 0, $date_from, $date_to)
946 946
     {
947 947
         //The order is important you need to check the the $column variable in the model.ajax.php file
948 948
         $columns = array(
@@ -992,55 +992,55 @@  discard block
 block discarded – undo
992 992
         );
993 993
 
994 994
         //Column config
995
-        $column_model   = array(
996
-            array('name'=>'lastname',   'index'=>'lastname',     'align'=>'left'),
997
-            array('name'=>'firstname',  'index'=>'firstname',    'align'=>'left'),
998
-            array('name'=>'username',   'index'=>'username',     'align'=>'left'),
995
+        $column_model = array(
996
+            array('name'=>'lastname', 'index'=>'lastname', 'align'=>'left'),
997
+            array('name'=>'firstname', 'index'=>'firstname', 'align'=>'left'),
998
+            array('name'=>'username', 'index'=>'username', 'align'=>'left'),
999 999
             #array('name'=>'profile',   'index'=>'username',     'align'=>'left'),
1000
-            array('name'=>'total',      'index'=>'total',        'align'=>'left'),
1001
-            array('name'=>'courses',    'index'=>'courses',      'align'=>'left', 'sortable' => 'false'),
1002
-            array('name'=>'lessons',    'index'=>'lessons',      'align'=>'left', 'sortable' => 'false'),
1003
-            array('name'=>'exercises',  'index'=>'exercises',    'align'=>'left', 'sortable' => 'false'),
1004
-            array('name'=>'forums',     'index'=>'forums',       'align'=>'left', 'sortable' => 'false'),
1005
-            array('name'=>'homeworks',  'index'=>'homeworks',    'align'=>'left', 'sortable' => 'false'),
1006
-            array('name'=>'wikis',      'index'=>'wikis',        'align'=>'left', 'sortable' => 'false'),
1007
-            array('name'=>'surveys',    'index'=>'surveys',      'align'=>'left', 'sortable' => 'false'),
1000
+            array('name'=>'total', 'index'=>'total', 'align'=>'left'),
1001
+            array('name'=>'courses', 'index'=>'courses', 'align'=>'left', 'sortable' => 'false'),
1002
+            array('name'=>'lessons', 'index'=>'lessons', 'align'=>'left', 'sortable' => 'false'),
1003
+            array('name'=>'exercises', 'index'=>'exercises', 'align'=>'left', 'sortable' => 'false'),
1004
+            array('name'=>'forums', 'index'=>'forums', 'align'=>'left', 'sortable' => 'false'),
1005
+            array('name'=>'homeworks', 'index'=>'homeworks', 'align'=>'left', 'sortable' => 'false'),
1006
+            array('name'=>'wikis', 'index'=>'wikis', 'align'=>'left', 'sortable' => 'false'),
1007
+            array('name'=>'surveys', 'index'=>'surveys', 'align'=>'left', 'sortable' => 'false'),
1008 1008
             //Lessons
1009
-            array('name'=>'lessons_total',    'index'=>'lessons_total',      'align'=>'center', 'sortable' => 'false'),
1010
-            array('name'=>'lessons_done',     'index'=>'lessons_done',       'align'=>'center', 'sortable' => 'false'),
1011
-            array('name'=>'lessons_left',     'index'=>'lessons_left',       'align'=>'center', 'sortable' => 'false'),
1012
-            array('name'=>'lessons_progress', 'index'=>'lessons_progress',   'align'=>'center', 'sortable' => 'false'),
1009
+            array('name'=>'lessons_total', 'index'=>'lessons_total', 'align'=>'center', 'sortable' => 'false'),
1010
+            array('name'=>'lessons_done', 'index'=>'lessons_done', 'align'=>'center', 'sortable' => 'false'),
1011
+            array('name'=>'lessons_left', 'index'=>'lessons_left', 'align'=>'center', 'sortable' => 'false'),
1012
+            array('name'=>'lessons_progress', 'index'=>'lessons_progress', 'align'=>'center', 'sortable' => 'false'),
1013 1013
             //Exercises
1014
-            array('name'=>'exercises_total',    'index'=>'exercises_total',      'align'=>'center', 'sortable' => 'false'),
1015
-            array('name'=>'exercises_done',     'index'=>'exercises_done',       'align'=>'center', 'sortable' => 'false'),
1016
-            array('name'=>'exercises_left',     'index'=>'exercises_left',       'align'=>'center', 'sortable' => 'false'),
1017
-            array('name'=>'exercises_progress', 'index'=>'exercises_progress',   'align'=>'center', 'sortable' => 'false'),
1014
+            array('name'=>'exercises_total', 'index'=>'exercises_total', 'align'=>'center', 'sortable' => 'false'),
1015
+            array('name'=>'exercises_done', 'index'=>'exercises_done', 'align'=>'center', 'sortable' => 'false'),
1016
+            array('name'=>'exercises_left', 'index'=>'exercises_left', 'align'=>'center', 'sortable' => 'false'),
1017
+            array('name'=>'exercises_progress', 'index'=>'exercises_progress', 'align'=>'center', 'sortable' => 'false'),
1018 1018
             //Assignments
1019
-            array('name'=>'forums_total',    'index'=>'forums_total',        'align'=>'center', 'sortable' => 'false'),
1020
-            array('name'=>'forums_done',     'index'=>'forums_done',         'align'=>'center', 'sortable' => 'false'),
1021
-            array('name'=>'forums_left',     'index'=>'forums_left',         'align'=>'center', 'sortable' => 'false'),
1022
-            array('name'=>'forums_progress', 'index'=>'forums_progress',     'align'=>'center', 'sortable' => 'false'),
1019
+            array('name'=>'forums_total', 'index'=>'forums_total', 'align'=>'center', 'sortable' => 'false'),
1020
+            array('name'=>'forums_done', 'index'=>'forums_done', 'align'=>'center', 'sortable' => 'false'),
1021
+            array('name'=>'forums_left', 'index'=>'forums_left', 'align'=>'center', 'sortable' => 'false'),
1022
+            array('name'=>'forums_progress', 'index'=>'forums_progress', 'align'=>'center', 'sortable' => 'false'),
1023 1023
             //Assignments
1024
-            array('name'=>'assigments_total',    'index'=>'assigments_total',        'align'=>'center', 'sortable' => 'false'),
1025
-            array('name'=>'assigments_done',     'index'=>'assigments_done',         'align'=>'center', 'sortable' => 'false'),
1026
-            array('name'=>'assigments_left',     'index'=>'assigments_left',         'align'=>'center', 'sortable' => 'false'),
1027
-            array('name'=>'assigments_progress', 'index'=>'assigments_progress',     'align'=>'center', 'sortable' => 'false'),
1024
+            array('name'=>'assigments_total', 'index'=>'assigments_total', 'align'=>'center', 'sortable' => 'false'),
1025
+            array('name'=>'assigments_done', 'index'=>'assigments_done', 'align'=>'center', 'sortable' => 'false'),
1026
+            array('name'=>'assigments_left', 'index'=>'assigments_left', 'align'=>'center', 'sortable' => 'false'),
1027
+            array('name'=>'assigments_progress', 'index'=>'assigments_progress', 'align'=>'center', 'sortable' => 'false'),
1028 1028
             //Assignments
1029
-            array('name'=>'wiki_total',         'index'=>'wiki_total',       'align'=>'center', 'sortable' => 'false'),
1030
-            array('name'=>'wiki_revisions',     'index'=>'wiki_revisions',   'align'=>'center', 'sortable' => 'false'),
1031
-            array('name'=>'wiki_read',          'index'=>'wiki_read',        'align'=>'center', 'sortable' => 'false'),
1032
-            array('name'=>'wiki_unread',        'index'=>'wiki_unread',      'align'=>'center', 'sortable' => 'false'),
1033
-            array('name'=>'wiki_progress',      'index'=>'wiki_progress',    'align'=>'center', 'sortable' => 'false'),
1029
+            array('name'=>'wiki_total', 'index'=>'wiki_total', 'align'=>'center', 'sortable' => 'false'),
1030
+            array('name'=>'wiki_revisions', 'index'=>'wiki_revisions', 'align'=>'center', 'sortable' => 'false'),
1031
+            array('name'=>'wiki_read', 'index'=>'wiki_read', 'align'=>'center', 'sortable' => 'false'),
1032
+            array('name'=>'wiki_unread', 'index'=>'wiki_unread', 'align'=>'center', 'sortable' => 'false'),
1033
+            array('name'=>'wiki_progress', 'index'=>'wiki_progress', 'align'=>'center', 'sortable' => 'false'),
1034 1034
             //Surveys
1035
-            array('name'=>'surveys_total',    'index'=>'surveys_total',      'align'=>'center', 'sortable' => 'false'),
1036
-            array('name'=>'surveys_done',     'index'=>'surveys_done',       'align'=>'center', 'sortable' => 'false'),
1037
-            array('name'=>'surveys_left',     'index'=>'surveys_left',       'align'=>'center', 'sortable' => 'false'),
1038
-            array('name'=>'surveys_progress', 'index'=>'surveys_progress',   'align'=>'center', 'sortable' => 'false'),
1035
+            array('name'=>'surveys_total', 'index'=>'surveys_total', 'align'=>'center', 'sortable' => 'false'),
1036
+            array('name'=>'surveys_done', 'index'=>'surveys_done', 'align'=>'center', 'sortable' => 'false'),
1037
+            array('name'=>'surveys_left', 'index'=>'surveys_left', 'align'=>'center', 'sortable' => 'false'),
1038
+            array('name'=>'surveys_progress', 'index'=>'surveys_progress', 'align'=>'center', 'sortable' => 'false'),
1039 1039
         );
1040 1040
 
1041 1041
         $action_links = '';
1042 1042
         // jqgrid will use this URL to do the selects
1043
-        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_session_progress&session_id=' . $sessionId . '&course_id=' . $courseId . '&date_to=' . $date_to . '&date_from=' . $date_from;
1043
+        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_session_progress&session_id='.$sessionId.'&course_id='.$courseId.'&date_to='.$date_to.'&date_from='.$date_from;
1044 1044
 
1045 1045
         //Table Id
1046 1046
         $tableId = 'progressOverview';
@@ -1100,11 +1100,11 @@  discard block
 block discarded – undo
1100 1100
             true
1101 1101
         );
1102 1102
 
1103
-        $return = '<script>$(function() {'. $table .
1103
+        $return = '<script>$(function() {'.$table.
1104 1104
             'jQuery("#'.$tableId.'").jqGrid("navGrid","#'.$tableId.'_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
1105 1105
                 jQuery("#'.$tableId.'").jqGrid("navButtonAdd","#'.$tableId.'_pager",{
1106 1106
                        caption:"",
1107
-                       title:"' . get_lang('ExportExcel') . '",
1107
+                       title:"' . get_lang('ExportExcel').'",
1108 1108
                        onClickButton : function () {
1109 1109
                            jQuery("#'.$tableId.'").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
1110 1110
                        }
@@ -1164,7 +1164,7 @@  discard block
 block discarded – undo
1164 1164
                 // adding the fields that are checked to the session
1165 1165
                 $message = '';
1166 1166
                 foreach ($values as $field_ids => $value) {
1167
-                    if ($value == 1 && strstr($field_ids,'extra_export_field')) {
1167
+                    if ($value == 1 && strstr($field_ids, 'extra_export_field')) {
1168 1168
                         $_SESSION['additional_export_fields'][] = str_replace('extra_export_field', '', $field_ids);
1169 1169
                     }
1170 1170
                 }
@@ -1179,7 +1179,7 @@  discard block
 block discarded – undo
1179 1179
                 // Displaying a feedback message
1180 1180
                 if (!empty($_SESSION['additional_export_fields'])) {
1181 1181
                     Display::display_confirmation_message(get_lang('FollowingFieldsWillAlsoBeExported').': <br /><ul>'.$message.'</ul>', false);
1182
-                } else  {
1182
+                } else {
1183 1183
                     Display::display_confirmation_message(get_lang('NoAdditionalFieldsWillBeExported'), false);
1184 1184
                 }
1185 1185
             } else {
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
     {
1208 1208
         $t_head = '    <table style="width: 100%;border:0;padding:0;border-collapse:collapse;table-layout: fixed">';
1209 1209
         //$t_head .= '  <caption>'.get_lang('CourseInformation').'</caption>';
1210
-        $t_head .=      '<tr>';
1210
+        $t_head .= '<tr>';
1211 1211
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgTimeSpentInTheCourse'), 6, true).'</span></th>';
1212 1212
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgStudentsProgress'), 6, true).'</span></th>';
1213 1213
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgCourseScore'), 6, true).'</span></th>';
@@ -1224,13 +1224,13 @@  discard block
 block discarded – undo
1224 1224
 
1225 1225
         $addparams = array('view' => 'admin', 'display' => 'courseoverview');
1226 1226
 
1227
-        $table = new SortableTable('tracking_session_overview', array('MySpace', 'get_total_number_courses'), array('MySpace','get_course_data_tracking_overview'), 1);
1227
+        $table = new SortableTable('tracking_session_overview', array('MySpace', 'get_total_number_courses'), array('MySpace', 'get_course_data_tracking_overview'), 1);
1228 1228
         $table->additional_parameters = $addparams;
1229 1229
 
1230 1230
         $table->set_header(0, '', false, null, array('style' => 'display: none'));
1231 1231
         $table->set_header(1, get_lang('Course'), true, array('style' => 'font-size:8pt'), array('style' => 'font-size:8pt'));
1232 1232
         $table->set_header(2, $t_head, false, array('style' => 'width:90%;border:0;padding:0;font-size:7.5pt;'), array('style' => 'width:90%;padding:0;font-size:7.5pt;'));
1233
-        $table->set_column_filter(2, array('MySpace','course_tracking_filter'));
1233
+        $table->set_column_filter(2, array('MySpace', 'course_tracking_filter'));
1234 1234
         $table->display();
1235 1235
     }
1236 1236
 
@@ -1266,7 +1266,7 @@  discard block
 block discarded – undo
1266 1266
         $sql .= " ORDER BY col$column $direction ";
1267 1267
         $sql .= " LIMIT $from,$number_of_items";
1268 1268
         $result = Database::query($sql);
1269
-        $return = array ();
1269
+        $return = array();
1270 1270
         while ($course = Database::fetch_row($result)) {
1271 1271
             $return[] = $course;
1272 1272
         }
@@ -1319,18 +1319,18 @@  discard block
 block discarded – undo
1319 1319
             $progress += $progress_tmp[0];
1320 1320
             $nb_progress_lp += $progress_tmp[1];
1321 1321
             $score_tmp = Tracking :: get_avg_student_score($row->user_id, $course_code, array(), null, true);
1322
-            if(is_array($score_tmp)) {
1322
+            if (is_array($score_tmp)) {
1323 1323
                 $score += $score_tmp[0];
1324 1324
                 $nb_score_lp += $score_tmp[1];
1325 1325
             }
1326 1326
             $nb_messages += Tracking::count_student_messages($row->user_id, $course_code);
1327 1327
             $nb_assignments += Tracking::count_student_assignments($row->user_id, $course_code);
1328 1328
             $last_login_date_tmp = Tracking :: get_last_connection_date_on_the_course($row->user_id, $courseInfo, null, false);
1329
-            if($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned
1329
+            if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned
1330 1330
                 $last_login_date = $last_login_date_tmp;
1331
-            } else if($last_login_date_tmp != false && $last_login_date != false) { // TODO: Repeated previous condition. To be cleaned.
1331
+            } else if ($last_login_date_tmp != false && $last_login_date != false) { // TODO: Repeated previous condition. To be cleaned.
1332 1332
                 // Find the max and assign it to first_login_date
1333
-                if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1333
+                if (strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1334 1334
                     $last_login_date = $last_login_date_tmp;
1335 1335
                 }
1336 1336
             }
@@ -1340,27 +1340,27 @@  discard block
 block discarded – undo
1340 1340
             $total_score_possible += $exercise_results_tmp['score_possible'];
1341 1341
             $total_questions_answered += $exercise_results_tmp['questions_answered'];
1342 1342
         }
1343
-        if($nb_progress_lp > 0) {
1343
+        if ($nb_progress_lp > 0) {
1344 1344
             $avg_progress = round($progress / $nb_progress_lp, 2);
1345 1345
         } else {
1346 1346
             $avg_progress = 0;
1347 1347
         }
1348
-        if($nb_score_lp > 0) {
1348
+        if ($nb_score_lp > 0) {
1349 1349
             $avg_score = round($score / $nb_score_lp, 2);
1350 1350
         } else {
1351 1351
             $avg_score = '-';
1352 1352
         }
1353
-        if($last_login_date) {
1353
+        if ($last_login_date) {
1354 1354
             $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT, date_default_timezone_get());
1355 1355
         } else {
1356 1356
             $last_login_date = '-';
1357 1357
         }
1358
-        if($total_score_possible > 0) {
1358
+        if ($total_score_possible > 0) {
1359 1359
             $total_score_percentage = round($total_score_obtained / $total_score_possible * 100, 2);
1360 1360
         } else {
1361 1361
             $total_score_percentage = 0;
1362 1362
         }
1363
-        if($total_score_percentage > 0) {
1363
+        if ($total_score_percentage > 0) {
1364 1364
             $total_score = $total_score_obtained.'/'.$total_score_possible.' ('.$total_score_percentage.' %)';
1365 1365
         } else {
1366 1366
             $total_score = '-';
@@ -1468,7 +1468,7 @@  discard block
 block discarded – undo
1468 1468
                 $progress += $progress_tmp[0];
1469 1469
                 $nb_progress_lp += $progress_tmp[1];
1470 1470
                 $score_tmp = Tracking :: get_avg_student_score($row->user_id, $course_code, array(), null, true);
1471
-                if(is_array($score_tmp)) {
1471
+                if (is_array($score_tmp)) {
1472 1472
                     $score += $score_tmp[0];
1473 1473
                     $nb_score_lp += $score_tmp[1];
1474 1474
                 }
@@ -1476,11 +1476,11 @@  discard block
 block discarded – undo
1476 1476
                 $nb_assignments += Tracking::count_student_assignments($row->user_id, $course_code);
1477 1477
 
1478 1478
                 $last_login_date_tmp = Tracking::get_last_connection_date_on_the_course($row->user_id, $courseInfo, null, false);
1479
-                if($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned.
1479
+                if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned.
1480 1480
                     $last_login_date = $last_login_date_tmp;
1481
-                } else if($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned.
1481
+                } else if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned.
1482 1482
                     // Find the max and assign it to first_login_date
1483
-                    if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1483
+                    if (strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1484 1484
                         $last_login_date = $last_login_date_tmp;
1485 1485
                     }
1486 1486
                 }
@@ -1490,22 +1490,22 @@  discard block
 block discarded – undo
1490 1490
                 $total_score_possible += $exercise_results_tmp['score_possible'];
1491 1491
                 $total_questions_answered += $exercise_results_tmp['questions_answered'];
1492 1492
             }
1493
-            if($nb_progress_lp > 0) {
1493
+            if ($nb_progress_lp > 0) {
1494 1494
                 $avg_progress = round($progress / $nb_progress_lp, 2);
1495 1495
             } else {
1496 1496
                 $avg_progress = 0;
1497 1497
             }
1498
-            if($nb_score_lp > 0) {
1498
+            if ($nb_score_lp > 0) {
1499 1499
                 $avg_score = round($score / $nb_score_lp, 2);
1500 1500
             } else {
1501 1501
                 $avg_score = '-';
1502 1502
             }
1503
-            if($last_login_date) {
1503
+            if ($last_login_date) {
1504 1504
                 $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT, date_default_timezone_get());
1505 1505
             } else {
1506 1506
                 $last_login_date = '-';
1507 1507
             }
1508
-            if($total_score_possible > 0) {
1508
+            if ($total_score_possible > 0) {
1509 1509
                 $total_score_percentage = round($total_score_obtained / $total_score_possible * 100, 2);
1510 1510
             } else {
1511 1511
                 $total_score_percentage = 0;
@@ -1541,7 +1541,7 @@  discard block
 block discarded – undo
1541 1541
     {
1542 1542
         $t_head = '    <table style="width: 100%;border:0;padding:0;border-collapse:collapse;table-layout: fixed">';
1543 1543
         //$t_head .= '  <caption>'.get_lang('CourseInformation').'</caption>';
1544
-        $t_head .=      '<tr>';
1544
+        $t_head .= '<tr>';
1545 1545
         $t_head .= '        <th width="155px" style="border-left:0;border-bottom:0"><span>'.get_lang('Course').'</span></th>';
1546 1546
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgTimeSpentInTheCourse'), 6, true).'</span></th>';
1547 1547
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgStudentsProgress'), 6, true).'</span></th>';
@@ -1559,7 +1559,7 @@  discard block
 block discarded – undo
1559 1559
 
1560 1560
         $addparams = array('view' => 'admin', 'display' => 'sessionoverview');
1561 1561
 
1562
-        $table = new SortableTable('tracking_session_overview', array('MySpace','get_total_number_sessions'), array('MySpace','get_session_data_tracking_overview'), 1);
1562
+        $table = new SortableTable('tracking_session_overview', array('MySpace', 'get_total_number_sessions'), array('MySpace', 'get_session_data_tracking_overview'), 1);
1563 1563
         $table->additional_parameters = $addparams;
1564 1564
 
1565 1565
         $table->set_header(0, '', false, null, array('style' => 'display: none'));
@@ -1598,7 +1598,7 @@  discard block
 block discarded – undo
1598 1598
         $sql .= " ORDER BY col$column $direction ";
1599 1599
         $sql .= " LIMIT $from,$number_of_items";
1600 1600
         $result = Database::query($sql);
1601
-        $return = array ();
1601
+        $return = array();
1602 1602
         while ($session = Database::fetch_row($result)) {
1603 1603
             $return[] = $session;
1604 1604
         }
@@ -1687,10 +1687,10 @@  discard block
 block discarded – undo
1687 1687
                 if ($last_login_date_tmp != false && $last_login_date == false) {
1688 1688
                     // TODO: To be cleaned.
1689 1689
                     $last_login_date = $last_login_date_tmp;
1690
-                } else if($last_login_date_tmp != false && $last_login_date != false) {
1690
+                } else if ($last_login_date_tmp != false && $last_login_date != false) {
1691 1691
                     // TODO: Repeated previous condition! To be cleaned.
1692 1692
                     // Find the max and assign it to first_login_date
1693
-                    if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1693
+                    if (strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1694 1694
                         $last_login_date = $last_login_date_tmp;
1695 1695
                     }
1696 1696
                 }
@@ -1700,27 +1700,27 @@  discard block
 block discarded – undo
1700 1700
                 $total_score_possible += $exercise_results_tmp['score_possible'];
1701 1701
                 $total_questions_answered += $exercise_results_tmp['questions_answered'];
1702 1702
             }
1703
-            if($nb_progress_lp > 0) {
1703
+            if ($nb_progress_lp > 0) {
1704 1704
                 $avg_progress = round($progress / $nb_progress_lp, 2);
1705 1705
             } else {
1706 1706
                 $avg_progress = 0;
1707 1707
             }
1708
-            if($nb_score_lp > 0) {
1708
+            if ($nb_score_lp > 0) {
1709 1709
                 $avg_score = round($score / $nb_score_lp, 2);
1710 1710
             } else {
1711 1711
                 $avg_score = '-';
1712 1712
             }
1713
-            if($last_login_date) {
1713
+            if ($last_login_date) {
1714 1714
                 $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT, date_default_timezone_get());
1715 1715
             } else {
1716 1716
                 $last_login_date = '-';
1717 1717
             }
1718
-            if($total_score_possible > 0) {
1718
+            if ($total_score_possible > 0) {
1719 1719
                 $total_score_percentage = round($total_score_obtained / $total_score_possible * 100, 2);
1720 1720
             } else {
1721 1721
                 $total_score_percentage = 0;
1722 1722
             }
1723
-            if($total_score_percentage > 0) {
1723
+            if ($total_score_percentage > 0) {
1724 1724
                 $total_score = $total_score_obtained.'/'.$total_score_possible.' ('.$total_score_percentage.' %)';
1725 1725
             } else {
1726 1726
                 $total_score = '-';
@@ -1831,7 +1831,7 @@  discard block
 block discarded – undo
1831 1831
                 $total_score_obtained = 0;
1832 1832
                 $total_score_possible = 0;
1833 1833
                 $total_questions_answered = 0;
1834
-                while($row_user = Database::fetch_object($result_users)) {
1834
+                while ($row_user = Database::fetch_object($result_users)) {
1835 1835
                     // get time spent in the course and session
1836 1836
                     $time_spent += Tracking::get_time_spent_on_the_course($row_user->user_id, $courseId, $session_id);
1837 1837
                     $progress_tmp = Tracking::get_avg_student_progress($row_user->user_id, $row->code, array(), $session_id, true);
@@ -1860,11 +1860,11 @@  discard block
 block discarded – undo
1860 1860
                         $session_id,
1861 1861
                         false
1862 1862
                     );
1863
-                    if($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned.
1863
+                    if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned.
1864 1864
                         $last_login_date = $last_login_date_tmp;
1865
-                    } else if($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned.
1865
+                    } else if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned.
1866 1866
                         // Find the max and assign it to first_login_date
1867
-                        if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1867
+                        if (strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1868 1868
                             $last_login_date = $last_login_date_tmp;
1869 1869
                         }
1870 1870
                     }
@@ -1874,27 +1874,27 @@  discard block
 block discarded – undo
1874 1874
                     $total_score_possible += $exercise_results_tmp['score_possible'];
1875 1875
                     $total_questions_answered += $exercise_results_tmp['questions_answered'];
1876 1876
                 }
1877
-                if($nb_progress_lp > 0) {
1877
+                if ($nb_progress_lp > 0) {
1878 1878
                     $avg_progress = round($progress / $nb_progress_lp, 2);
1879 1879
                 } else {
1880 1880
                     $avg_progress = 0;
1881 1881
                 }
1882
-                if($nb_score_lp > 0) {
1882
+                if ($nb_score_lp > 0) {
1883 1883
                     $avg_score = round($score / $nb_score_lp, 2);
1884 1884
                 } else {
1885 1885
                     $avg_score = '-';
1886 1886
                 }
1887
-                if($last_login_date) {
1887
+                if ($last_login_date) {
1888 1888
                     $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT, date_default_timezone_get());
1889 1889
                 } else {
1890 1890
                     $last_login_date = '-';
1891 1891
                 }
1892
-                if($total_score_possible > 0) {
1892
+                if ($total_score_possible > 0) {
1893 1893
                     $total_score_percentage = round($total_score_obtained / $total_score_possible * 100, 2);
1894 1894
                 } else {
1895 1895
                     $total_score_percentage = 0;
1896 1896
                 }
1897
-                if($total_score_percentage > 0) {
1897
+                if ($total_score_percentage > 0) {
1898 1898
                     $total_score = $total_score_obtained.'/'.$total_score_possible.' ('.$total_score_percentage.' %)';
1899 1899
                 } else {
1900 1900
                     $total_score = '-';
@@ -1944,7 +1944,7 @@  discard block
 block discarded – undo
1944 1944
             FROM '.Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES)."
1945 1945
             WHERE c_id = ' . $courseId . '
1946 1946
             AND exe_user_id = '".intval($user_id)."'";
1947
-        if($session_id !== false) {
1947
+        if ($session_id !== false) {
1948 1948
             $sql .= " AND session_id = '".$session_id."' ";
1949 1949
         }
1950 1950
         $result = Database::query($sql);
@@ -1954,7 +1954,7 @@  discard block
 block discarded – undo
1954 1954
         while ($row = Database::fetch_array($result)) {
1955 1955
             $score_obtained += $row['exe_result'];
1956 1956
             $score_possible += $row['exe_weighting'];
1957
-            $questions_answered ++;
1957
+            $questions_answered++;
1958 1958
         }
1959 1959
 
1960 1960
         if ($score_possible != 0) {
@@ -2075,9 +2075,9 @@  discard block
 block discarded – undo
2075 2075
                     }
2076 2076
                 }
2077 2077
                 // time spent in the course
2078
-                $csv_row[] = api_time_to_hms(Tracking::get_time_spent_on_the_course ($user[4], $courseId));
2078
+                $csv_row[] = api_time_to_hms(Tracking::get_time_spent_on_the_course($user[4], $courseId));
2079 2079
                 // student progress in course
2080
-                $csv_row[] = round(Tracking::get_avg_student_progress ($user[4], $row[0]), 2);
2080
+                $csv_row[] = round(Tracking::get_avg_student_progress($user[4], $row[0]), 2);
2081 2081
                 // student score
2082 2082
                 $csv_row[] = round(Tracking::get_avg_student_score($user[4], $row[0]), 2);
2083 2083
                 // student tes score
@@ -2085,7 +2085,7 @@  discard block
 block discarded – undo
2085 2085
                 // student messages
2086 2086
                 $csv_row[] = Tracking::count_student_messages($user[4], $row[0]);
2087 2087
                 // student assignments
2088
-                $csv_row[] = Tracking::count_student_assignments ($user[4], $row[0]);
2088
+                $csv_row[] = Tracking::count_student_assignments($user[4], $row[0]);
2089 2089
                 // student exercises results
2090 2090
                 $exercises_results = MySpace::exercises_results($user[4], $row[0]);
2091 2091
                 $csv_row[] = $exercises_results['score_obtained'];
@@ -2093,7 +2093,7 @@  discard block
 block discarded – undo
2093 2093
                 $csv_row[] = $exercises_results['questions_answered'];
2094 2094
                 $csv_row[] = $exercises_results['percentage'];
2095 2095
                 // first connection
2096
-                $csv_row[] = Tracking::get_first_connection_date_on_the_course ($user[4], $courseId);
2096
+                $csv_row[] = Tracking::get_first_connection_date_on_the_course($user[4], $courseId);
2097 2097
                 // last connection
2098 2098
                 $csv_row[] = strip_tags(Tracking::get_last_connection_date_on_the_course($user[4], $courseInfo));
2099 2099
 
@@ -2127,9 +2127,9 @@  discard block
 block discarded – undo
2127 2127
         // get all courses with limit
2128 2128
         $sql = "SELECT course.code as col1, course.title as col2
2129 2129
                 FROM $tbl_course course
2130
-                WHERE course.code IN (".implode(',',$courses_code).")";
2130
+                WHERE course.code IN (".implode(',', $courses_code).")";
2131 2131
 
2132
-        if (!in_array($direction, array('ASC','DESC'))) $direction = 'ASC';
2132
+        if (!in_array($direction, array('ASC', 'DESC'))) $direction = 'ASC';
2133 2133
 
2134 2134
         $column = intval($column);
2135 2135
         $from = intval($from);
@@ -2198,7 +2198,7 @@  discard block
 block discarded – undo
2198 2198
             $table_row[] = $avg_assignments_in_course;
2199 2199
 
2200 2200
             //set the "from" value to know if I access the Reporting by the chamilo tab or the course link
2201
-            $table_row[] = '<center><a href="../../tracking/courseLog.php?cidReq=' .$course_code.'&from=myspace&id_session='.$session_id.'">
2201
+            $table_row[] = '<center><a href="../../tracking/courseLog.php?cidReq='.$course_code.'&from=myspace&id_session='.$session_id.'">
2202 2202
                              '.Display::return_icon('2rightarrow.png').'
2203 2203
                              </a>
2204 2204
                             </center>';
@@ -2207,7 +2207,7 @@  discard block
 block discarded – undo
2207 2207
                 $nb_students_in_course,
2208 2208
                 $avg_time_spent_in_course,
2209 2209
                 is_null($avg_progress_in_course) ? null : $avg_progress_in_course.'%',
2210
-                is_null($avg_score_in_course) ? null : is_numeric($avg_score_in_course) ? $avg_score_in_course.'%' : $avg_score_in_course ,
2210
+                is_null($avg_score_in_course) ? null : is_numeric($avg_score_in_course) ? $avg_score_in_course.'%' : $avg_score_in_course,
2211 2211
                 is_null($avg_score_in_exercise) ? null : $avg_score_in_exercise.'%',
2212 2212
                 $avg_messages_in_course,
2213 2213
                 $avg_assignments_in_course,
@@ -2275,7 +2275,7 @@  discard block
 block discarded – undo
2275 2275
         $sql .= " ORDER BY col$column $direction ";
2276 2276
         $sql .= " LIMIT $from,$number_of_items";
2277 2277
         $result = Database::query($sql);
2278
-        $return = array ();
2278
+        $return = array();
2279 2279
         while ($user = Database::fetch_row($result)) {
2280 2280
             $return[] = $user;
2281 2281
         }
@@ -2330,7 +2330,7 @@  discard block
 block discarded – undo
2330 2330
                     $i++;
2331 2331
                 }
2332 2332
             }
2333
-            $username_array = array('username' => $desired_username , 'sufix' => $sufix);
2333
+            $username_array = array('username' => $desired_username, 'sufix' => $sufix);
2334 2334
             return $username_array;
2335 2335
         } else {
2336 2336
             $username_array = array('username' => $username, 'sufix' => '');
@@ -2605,7 +2605,7 @@  discard block
 block discarded – undo
2605 2605
         foreach ($users as $index => $user) {
2606 2606
             $userid = $user['id'];
2607 2607
             $sql_insert = "INSERT IGNORE INTO $tbl_session_rel_user(session_id, user_id, registered_at)
2608
-                           VALUES ('$id_session','$userid', '" . api_get_utc_datetime() . "')";
2608
+                           VALUES ('$id_session','$userid', '".api_get_utc_datetime()."')";
2609 2609
             Database::query($sql_insert);
2610 2610
             $user['added_at_session'] = 1;
2611 2611
             $new_users[] = $user;
@@ -2639,10 +2639,10 @@  discard block
 block discarded – undo
2639 2639
                 );
2640 2640
                 $userInfo = api_get_user_info($user['id']);
2641 2641
 
2642
-                if (($user['added_at_platform'] == 1  && $user['added_at_session'] == 1) || $user['added_at_session'] == 1) {
2642
+                if (($user['added_at_platform'] == 1 && $user['added_at_session'] == 1) || $user['added_at_session'] == 1) {
2643 2643
                     if ($user['added_at_platform'] == 1) {
2644 2644
                         $addedto = get_lang('UserCreatedPlatform');
2645
-                    } else  {
2645
+                    } else {
2646 2646
                         $addedto = '          ';
2647 2647
                     }
2648 2648
 
@@ -2705,7 +2705,7 @@  discard block
 block discarded – undo
2705 2705
         global $current_tag;
2706 2706
         switch ($data) {
2707 2707
             case 'Contact' :
2708
-                $user = array ();
2708
+                $user = array();
2709 2709
                 break;
2710 2710
             default :
2711 2711
                 $current_tag = $data;
@@ -2752,9 +2752,9 @@  discard block
 block discarded – undo
2752 2752
         global $current_value;
2753 2753
         global $user;
2754 2754
         global $users;
2755
-        $users = array ();
2755
+        $users = array();
2756 2756
         $parser = xml_parser_create('UTF-8');
2757
-        xml_set_element_handler($parser, array('MySpace','element_start'), array('MySpace','element_end'));
2757
+        xml_set_element_handler($parser, array('MySpace', 'element_start'), array('MySpace', 'element_end'));
2758 2758
         xml_set_character_data_handler($parser, "character_data");
2759 2759
         xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);
2760 2760
         xml_parse($parser, api_utf8_encode_xml(file_get_contents($file)));
@@ -2800,7 +2800,7 @@  discard block
 block discarded – undo
2800 2800
             get_lang('SearchCourse'),
2801 2801
             $courseList,
2802 2802
             [
2803
-                'url' => api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?' . http_build_query([
2803
+                'url' => api_get_path(WEB_AJAX_PATH).'course.ajax.php?'.http_build_query([
2804 2804
                     'a' => 'search_course_by_session_all',
2805 2805
                     'session_id' => $sessionId
2806 2806
                 ])
@@ -2819,7 +2819,7 @@  discard block
 block discarded – undo
2819 2819
                             course_id: $('#course_id').val() || 0
2820 2820
                         });
2821 2821
 
2822
-                        return '" . api_get_path(WEB_AJAX_PATH) . "session.ajax.php?' + params;
2822
+                        return '" . api_get_path(WEB_AJAX_PATH)."session.ajax.php?' + params;
2823 2823
                     }
2824 2824
                 "
2825 2825
             ]
@@ -2850,7 +2850,7 @@  discard block
 block discarded – undo
2850 2850
                             course_id: $('#course_id').val()
2851 2851
                         });
2852 2852
 
2853
-                        return '" . api_get_path(WEB_AJAX_PATH) . "course.ajax.php?' + params;
2853
+                        return '" . api_get_path(WEB_AJAX_PATH)."course.ajax.php?' + params;
2854 2854
                     }
2855 2855
                 "
2856 2856
             ]
@@ -2876,8 +2876,8 @@  discard block
 block discarded – undo
2876 2876
         if ($form->validate()) {
2877 2877
             $table = new SortableTable(
2878 2878
                 'tracking_access_overview',
2879
-                ['MySpace','getNumberOfRrackingAccessOverview'],
2880
-                ['MySpace','getUserDataAccessTrackingOverview'],
2879
+                ['MySpace', 'getNumberOfRrackingAccessOverview'],
2880
+                ['MySpace', 'getUserDataAccessTrackingOverview'],
2881 2881
                 0
2882 2882
             );
2883 2883
             $table->additional_parameters = $form->exportValues();
@@ -2938,7 +2938,7 @@  discard block
 block discarded – undo
2938 2938
                     " : "
2939 2939
                         u.lastname AS col2,
2940 2940
                         u.firstname AS col3,
2941
-                " ) . "
2941
+                " )."
2942 2942
                 a.logout_course_date,
2943 2943
                 c.title,
2944 2944
                 c.code,
@@ -2949,7 +2949,7 @@  discard block
 block discarded – undo
2949 2949
 
2950 2950
         if (isset($_GET['session_id']) && !empty($_GET['session_id'])) {
2951 2951
             $sessionId = intval($_GET['session_id']);
2952
-            $sql .= " WHERE a.session_id = " . $sessionId;
2952
+            $sql .= " WHERE a.session_id = ".$sessionId;
2953 2953
         }
2954 2954
 
2955 2955
         $sql .= " ORDER BY col$column $orderDirection ";
@@ -3010,14 +3010,14 @@  discard block
 block discarded – undo
3010 3010
 function get_stats($user_id, $courseId, $start_date = null, $end_date = null)
3011 3011
 {
3012 3012
     // Database table definitions
3013
-    $tbl_track_course   = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
3013
+    $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
3014 3014
 
3015 3015
     $course_info = api_get_course_info_by_id($courseId);
3016 3016
     if (!empty($course_info)) {
3017 3017
         $strg_sd    = "";
3018 3018
         $strg_ed    = "";
3019
-        if ($start_date != null && $end_date != null){
3020
-            $end_date = add_day_to( $end_date );
3019
+        if ($start_date != null && $end_date != null) {
3020
+            $end_date = add_day_to($end_date);
3021 3021
             $strg_sd = "AND login_course_date BETWEEN '$start_date' AND '$end_date'";
3022 3022
             $strg_ed = "AND logout_course_date BETWEEN '$start_date' AND '$end_date'";
3023 3023
         }
@@ -3025,10 +3025,10 @@  discard block
 block discarded – undo
3025 3025
                 SEC_TO_TIME(avg(time_to_sec(timediff(logout_course_date,login_course_date)))) as avrg,
3026 3026
                 SEC_TO_TIME(sum(time_to_sec(timediff(logout_course_date,login_course_date)))) as total,
3027 3027
                 count(user_id) as times
3028
-                FROM ' . $tbl_track_course . '
3028
+                FROM ' . $tbl_track_course.'
3029 3029
                 WHERE
3030
-                    user_id = ' . intval($user_id) . ' AND
3031
-                    c_id = ' . intval($courseId) . ' '.$strg_sd.' '.$strg_ed.' '.'
3030
+                    user_id = ' . intval($user_id).' AND
3031
+                    c_id = ' . intval($courseId).' '.$strg_sd.' '.$strg_ed.' '.'
3032 3032
                 ORDER BY login_course_date ASC';
3033 3033
 
3034 3034
         $rs = Database::query($sql);
@@ -3046,7 +3046,7 @@  discard block
 block discarded – undo
3046 3046
 }
3047 3047
 
3048 3048
 function add_day_to($end_date) {
3049
-    $foo_date = strtotime( $end_date );
3049
+    $foo_date = strtotime($end_date);
3050 3050
     $foo_date = strtotime(" +1 day", $foo_date);
3051 3051
     $foo_date = date("Y-m-d", $foo_date);
3052 3052
     return $foo_date;
@@ -3106,7 +3106,7 @@  discard block
 block discarded – undo
3106 3106
  * @version OCT-22- 2010
3107 3107
  * @return array
3108 3108
  */
3109
-function convert_to_array($sql_result){
3109
+function convert_to_array($sql_result) {
3110 3110
     $result_to_print = '<table>';
3111 3111
     foreach ($sql_result as $key => $data) {
3112 3112
         $result_to_print .= '<tr><td>'.date('d-m-Y (H:i:s)', $data['login']).'</td><td>'.api_time_to_hms($data['logout'] - $data['login']).'</tr></td>'."\n";
@@ -3125,7 +3125,7 @@  discard block
 block discarded – undo
3125 3125
  * @version OCT-22- 2010
3126 3126
  * @return string
3127 3127
  */
3128
-function convert_to_string($sql_result){
3128
+function convert_to_string($sql_result) {
3129 3129
     $result_to_print = '<table>';
3130 3130
     if (!empty($sql_result)) {
3131 3131
         foreach ($sql_result as $key => $data) {
@@ -3150,18 +3150,18 @@  discard block
 block discarded – undo
3150 3150
  */
3151 3151
 function grapher($sql_result, $start_date, $end_date, $type = "")
3152 3152
 {
3153
-    if (empty($start_date)) { $start_date =""; }
3154
-    if (empty($end_date)) { $end_date =""; }
3155
-    if ($type == ""){ $type = 'day'; }
3156
-    $main_year  = $main_month_year = $main_day = array();
3153
+    if (empty($start_date)) { $start_date = ""; }
3154
+    if (empty($end_date)) { $end_date = ""; }
3155
+    if ($type == "") { $type = 'day'; }
3156
+    $main_year = $main_month_year = $main_day = array();
3157 3157
     // get last 8 days/months
3158 3158
     $last_days      = 5;
3159 3159
     $last_months    = 3;
3160 3160
     for ($i = $last_days; $i >= 0; $i--) {
3161
-        $main_day[date ('d-m-Y', mktime () - $i * 3600 * 24)] = 0;
3161
+        $main_day[date('d-m-Y', mktime() - $i * 3600 * 24)] = 0;
3162 3162
     }
3163 3163
     for ($i = $last_months; $i >= 0; $i--) {
3164
-        $main_month_year[date ('m-Y', mktime () - $i * 30 * 3600 * 24)] = 0;
3164
+        $main_month_year[date('m-Y', mktime() - $i * 30 * 3600 * 24)] = 0;
3165 3165
     }
3166 3166
 
3167 3167
     $i = 0;
@@ -3197,7 +3197,7 @@  discard block
 block discarded – undo
3197 3197
         /* Create and populate the pData object */
3198 3198
         $myData = new pData();
3199 3199
         $myData->addPoints($main_date, 'Serie1');
3200
-        if (count($main_date)!= 1) {
3200
+        if (count($main_date) != 1) {
3201 3201
             $myData->addPoints($labels, 'Labels');
3202 3202
             $myData->setSerieDescription('Labels', 'Months');
3203 3203
             $myData->setAbscissa('Labels');
@@ -3205,7 +3205,7 @@  discard block
 block discarded – undo
3205 3205
         $myData->setSerieWeight('Serie1', 1);
3206 3206
         $myData->setSerieDescription('Serie1', get_lang('MyResults'));
3207 3207
         $myData->setAxisName(0, get_lang('Minutes'));
3208
-        $myData->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
3208
+        $myData->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true);
3209 3209
 
3210 3210
         // Cache definition
3211 3211
         $cachePath = api_get_path(SYS_ARCHIVE_PATH);
@@ -3214,9 +3214,9 @@  discard block
 block discarded – undo
3214 3214
 
3215 3215
         if ($myCache->isInCache($chartHash)) {
3216 3216
             //if we already created the img
3217
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
3217
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
3218 3218
             $myCache->saveFromCache($chartHash, $imgPath);
3219
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
3219
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
3220 3220
         } else {
3221 3221
             /* Define width, height and angle */
3222 3222
             $mainWidth = 760;
@@ -3245,7 +3245,7 @@  discard block
 block discarded – undo
3245 3245
             /* Set the default font */
3246 3246
             $myPicture->setFontProperties(
3247 3247
                 array(
3248
-                    "FontName" => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
3248
+                    "FontName" => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
3249 3249
                     "FontSize" => 10)
3250 3250
             );
3251 3251
             /* Write the chart title */
@@ -3262,7 +3262,7 @@  discard block
 block discarded – undo
3262 3262
             /* Set the default font */
3263 3263
             $myPicture->setFontProperties(
3264 3264
                 array(
3265
-                    "FontName" => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
3265
+                    "FontName" => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
3266 3266
                     "FontSize" => 8
3267 3267
                 )
3268 3268
             );
@@ -3304,7 +3304,7 @@  discard block
 block discarded – undo
3304 3304
             /* Draw the line chart */
3305 3305
             $myPicture->setFontProperties(
3306 3306
                 array(
3307
-                    "FontName" => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
3307
+                    "FontName" => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
3308 3308
                     "FontSize" => 10
3309 3309
                 )
3310 3310
             );
@@ -3323,15 +3323,15 @@  discard block
 block discarded – undo
3323 3323
 
3324 3324
             /* Write and save into cache */
3325 3325
             $myCache->writeToCache($chartHash, $myPicture);
3326
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
3326
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
3327 3327
             $myCache->saveFromCache($chartHash, $imgPath);
3328
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
3328
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
3329 3329
         }
3330
-        $html = '<img src="' . $imgPath . '">';
3330
+        $html = '<img src="'.$imgPath.'">';
3331 3331
 
3332 3332
         return $html;
3333 3333
     } else {
3334
-        $foo_img = api_convert_encoding('<div id="messages" class="warning-message">'.get_lang('GraphicNotAvailable').'</div>','UTF-8');
3334
+        $foo_img = api_convert_encoding('<div id="messages" class="warning-message">'.get_lang('GraphicNotAvailable').'</div>', 'UTF-8');
3335 3335
 
3336 3336
         return $foo_img;
3337 3337
     }
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -666,7 +666,6 @@  discard block
 block discarded – undo
666 666
      * @param   int $sessionId  The session ID
667 667
      * @param   int $courseId   The course ID
668 668
      * @param   int $exerciseId The quiz ID
669
-     * @param   int $answer Answer status (0 = incorrect, 1 = correct, 2 = both)
670 669
      * @return  string  HTML array of results formatted for gridJS
671 670
      * @author César Perales <[email protected]>, Beeznest Team
672 671
      */
@@ -1254,6 +1253,7 @@  discard block
 block discarded – undo
1254 1253
      * @param int Number of items to select
1255 1254
      * @param string Column to order on
1256 1255
      * @param string Order direction
1256
+     * @param integer $number_of_items
1257 1257
      * @return array Results
1258 1258
      */
1259 1259
     public static function get_course_data_tracking_overview($from, $number_of_items, $column, $direction)
@@ -1588,6 +1588,7 @@  discard block
 block discarded – undo
1588 1588
      * @param int Number of items to select
1589 1589
      * @param string Column to order on
1590 1590
      * @param string Order direction
1591
+     * @param integer $number_of_items
1591 1592
      * @return array Results
1592 1593
      */
1593 1594
     public static function get_session_data_tracking_overview($from, $number_of_items, $column, $direction)
@@ -1608,7 +1609,6 @@  discard block
 block discarded – undo
1608 1609
     /**
1609 1610
      * Fills in session reporting data
1610 1611
      *
1611
-     * @param integer $user_id the id of the user
1612 1612
      * @param array $url_params additonal url parameters
1613 1613
      * @param array $row the row information (the other columns)
1614 1614
      * @return string html code
@@ -2239,6 +2239,7 @@  discard block
 block discarded – undo
2239 2239
      * @author Patrick Cool <[email protected]>, Ghent University, Belgium
2240 2240
      * @version Dokeos 1.8.6
2241 2241
      * @since October 2008
2242
+     * @param integer $number_of_items
2242 2243
      */
2243 2244
     public static function get_user_data_tracking_overview($from, $number_of_items, $column, $direction)
2244 2245
     {
@@ -2341,7 +2342,6 @@  discard block
 block discarded – undo
2341 2342
     /**
2342 2343
      * Checks if there are repeted users in a given array
2343 2344
      * @param  array $usernames list of the usernames in the uploaded file
2344
-     * @param  array $user_array['username'] and $user_array['sufix'] where sufix is the number part in a login i.e -> jmontoya2
2345 2345
      * @return array with the $usernames array and the $user_array array
2346 2346
      * @author Julio Montoya Armas
2347 2347
      */
@@ -2516,6 +2516,7 @@  discard block
 block discarded – undo
2516 2516
 
2517 2517
     /**
2518 2518
      * Adds missing user-information (which isn't required, like password, etc).
2519
+     * @return integer
2519 2520
      */
2520 2521
     function complete_missing_data($user) {
2521 2522
         // 1. Generate a password if it is necessary.
Please login to merge, or discard this patch.