Completed
Push — 1.11.x ( 566ea6...b264ab )
by José
110:20 queued 69:00
created
main/inc/lib/gradebook.lib.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         }
57 57
 
58 58
         $c_id = $c_id ? intval($c_id) : api_get_course_int_id();
59
-        $table  = Database::get_course_table(TABLE_TOOL_LIST);
59
+        $table = Database::get_course_table(TABLE_TOOL_LIST);
60 60
         $sql = "SELECT * from $table
61 61
                 WHERE c_id = $c_id and name='$name'
62 62
                 LIMIT 1";
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         $clean_gradebook = array();
114 114
 
115 115
         if (!empty($skill_gradebooks_source)) {
116
-            foreach($skill_gradebooks_source as $source) {
116
+            foreach ($skill_gradebooks_source as $source) {
117 117
                 $clean_gradebook[] = $source['skill_id'];
118 118
             }
119 119
         }
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
         $selected_skills = self::get_skills_by_gradebook($gradebook_id);
193 193
         $clean_selected_skills = array();
194 194
         if (!empty($selected_skills)) {
195
-            foreach($selected_skills as $skill) {
195
+            foreach ($selected_skills as $skill) {
196 196
                 $clean_selected_skills[] = $skill['id'];
197 197
             }
198 198
         }
Please login to merge, or discard this patch.
main/inc/lib/database.lib.php 2 patches
Spacing   +18 added lines, -19 removed lines patch added patch discarded remove patch
@@ -115,8 +115,7 @@  discard block
 block discarded – undo
115 115
      */
116 116
     public static function getUTCDateTimeTypeClass()
117 117
     {
118
-        return isset(self::$utcDateTimeClass) ? self::$utcDateTimeClass :
119
-        'Application\DoctrineExtensions\DBAL\Types\UTCDateTimeType';
118
+        return isset(self::$utcDateTimeClass) ? self::$utcDateTimeClass : 'Application\DoctrineExtensions\DBAL\Types\UTCDateTimeType';
120 119
     }
121 120
 
122 121
     /**
@@ -393,7 +392,7 @@  discard block
 block discarded – undo
393 392
 
394 393
         if (!empty($params)) {
395 394
             $sql = 'INSERT INTO '.$table_name.' ('.implode(',', $params).')
396
-                    VALUES (:'.implode(', :' ,$params).')';
395
+                    VALUES (:'.implode(', :', $params).')';
397 396
 
398 397
             $statement = self::getManager()->getConnection()->prepare($sql);
399 398
             $result = $statement->execute($attributes);
@@ -434,7 +433,7 @@  discard block
 block discarded – undo
434 433
             foreach ($attributes as $key => $value) {
435 434
                 $update_sql .= "$key = :$key ";
436 435
                 if ($count < count($attributes)) {
437
-                    $update_sql.=', ';
436
+                    $update_sql .= ', ';
438 437
                 }
439 438
                 $count++;
440 439
             }
@@ -481,7 +480,7 @@  discard block
 block discarded – undo
481 480
             if ($columns == '*') {
482 481
                 $clean_columns = '*';
483 482
             } else {
484
-                $clean_columns = (string)$columns;
483
+                $clean_columns = (string) $columns;
485 484
             }
486 485
         }
487 486
 
@@ -527,9 +526,9 @@  discard block
 block discarded – undo
527 526
                     foreach ($condition_data as $condition => $value_array) {
528 527
                         if (is_array($value_array)) {
529 528
                             $clean_values = array();
530
-                            foreach($value_array as $item) {
529
+                            foreach ($value_array as $item) {
531 530
                                 $item = Database::escape_string($item);
532
-                                $clean_values[]= $item;
531
+                                $clean_values[] = $item;
533 532
                             }
534 533
                         } else {
535 534
                             $value_array = Database::escape_string($value_array);
@@ -537,23 +536,23 @@  discard block
 block discarded – undo
537 536
                         }
538 537
 
539 538
                         if (!empty($condition) && $clean_values != '') {
540
-                            $condition = str_replace('%',"'@percentage@'", $condition); //replace "%"
541
-                            $condition = str_replace("'?'","%s", $condition);
542
-                            $condition = str_replace("?","%s", $condition);
539
+                            $condition = str_replace('%', "'@percentage@'", $condition); //replace "%"
540
+                            $condition = str_replace("'?'", "%s", $condition);
541
+                            $condition = str_replace("?", "%s", $condition);
543 542
 
544
-                            $condition = str_replace("@%s@","@-@", $condition);
545
-                            $condition = str_replace("%s","'%s'", $condition);
546
-                            $condition = str_replace("@-@","@%s@", $condition);
543
+                            $condition = str_replace("@%s@", "@-@", $condition);
544
+                            $condition = str_replace("%s", "'%s'", $condition);
545
+                            $condition = str_replace("@-@", "@%s@", $condition);
547 546
 
548 547
                             // Treat conditions as string
549 548
                             $condition = vsprintf($condition, $clean_values);
550
-                            $condition = str_replace('@percentage@','%', $condition); //replace "%"
549
+                            $condition = str_replace('@percentage@', '%', $condition); //replace "%"
551 550
                             $where_return .= $condition;
552 551
                         }
553 552
                     }
554 553
 
555 554
                     if (!empty($where_return)) {
556
-                        $return_value = " WHERE $where_return" ;
555
+                        $return_value = " WHERE $where_return";
557 556
                     }
558 557
                     break;
559 558
                 case 'order':
@@ -565,7 +564,7 @@  discard block
 block discarded – undo
565 564
                         $new_order_array = explode(',', $order_array);
566 565
                         $temp_value = array();
567 566
 
568
-                        foreach($new_order_array as $element) {
567
+                        foreach ($new_order_array as $element) {
569 568
                             $element = explode(' ', $element);
570 569
                             $element = array_filter($element);
571 570
                             $element = array_values($element);
@@ -576,10 +575,10 @@  discard block
 block discarded – undo
576 575
                                 if (in_array($element[1], array('desc', 'asc'))) {
577 576
                                     $order = $element[1];
578 577
                                 }
579
-                                $temp_value[]= $element[0].' '.$order.' ';
578
+                                $temp_value[] = $element[0].' '.$order.' ';
580 579
                             } else {
581 580
                                 //by default DESC
582
-                                $temp_value[]= $element[0].' DESC ';
581
+                                $temp_value[] = $element[0].' DESC ';
583 582
                             }
584 583
                         }
585 584
                         if (!empty($temp_value)) {
@@ -594,7 +593,7 @@  discard block
 block discarded – undo
594 593
                     if (!empty($limit_array)) {
595 594
                         if (count($limit_array) > 1) {
596 595
                             $return_value .= ' LIMIT '.intval($limit_array[0]).' , '.intval($limit_array[1]);
597
-                        }  else {
596
+                        } else {
598 597
                             $return_value .= ' LIMIT '.intval($limit_array[0]);
599 598
                         }
600 599
                     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -594,7 +594,7 @@
 block discarded – undo
594 594
                     if (!empty($limit_array)) {
595 595
                         if (count($limit_array) > 1) {
596 596
                             $return_value .= ' LIMIT '.intval($limit_array[0]).' , '.intval($limit_array[1]);
597
-                        }  else {
597
+                        } else {
598 598
                             $return_value .= ' LIMIT '.intval($limit_array[0]);
599 599
                         }
600 600
                     }
Please login to merge, or discard this patch.
main/inc/lib/extra_field_value.lib.php 3 patches
Indentation   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -720,11 +720,11 @@  discard block
 block discarded – undo
720 720
         return false;
721 721
     }
722 722
 
723
-     /**
724
-     * @param int $itemId
725
-     * @param int $fieldId
726
-     * @return array
727
-     */
723
+        /**
724
+         * @param int $itemId
725
+         * @param int $fieldId
726
+         * @return array
727
+         */
728 728
     public function getAllValuesByItemAndField($itemId, $fieldId)
729 729
     {
730 730
         $fieldId = intval($fieldId);
@@ -847,7 +847,6 @@  discard block
 block discarded – undo
847 847
     /**
848 848
      * Deletes all values from an item
849 849
      * @param int $itemId (session id, course id, etc)
850
-
851 850
      * @assert (-1,-1) == null
852 851
      */
853 852
     public function deleteValuesByItem($itemId)
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
                             break;
210 210
                     }
211 211
 
212
-                    $fileName = ExtraField::FIELD_TYPE_FILE_IMAGE . "_{$params['item_id']}.png";
212
+                    $fileName = ExtraField::FIELD_TYPE_FILE_IMAGE."_{$params['item_id']}.png";
213 213
 
214 214
                     if (!file_exists($fileDir)) {
215 215
                         mkdir($fileDir, $dirPermissions, true);
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
 
218 218
                     if ($value['error'] == 0) {
219 219
                         $imageExtraField = new Image($value['tmp_name']);
220
-                        $imageExtraField->send_image($fileDir . $fileName, -1, 'png');
220
+                        $imageExtraField->send_image($fileDir.$fileName, -1, 'png');
221 221
                         $newParams = array(
222 222
                             'item_id' => $params['item_id'],
223 223
                             'field_id' => $extraFieldInfo['id'],
224
-                            'value' => $fileDirStored . $fileName,
224
+                            'value' => $fileDirStored.$fileName,
225 225
                             'comment' => $comment
226 226
                         );
227 227
 
@@ -247,18 +247,18 @@  discard block
 block discarded – undo
247 247
                     }
248 248
 
249 249
                     $cleanedName = api_replace_dangerous_char($value['name']);
250
-                    $fileName = ExtraField::FIELD_TYPE_FILE . "_{$params['item_id']}_$cleanedName";
250
+                    $fileName = ExtraField::FIELD_TYPE_FILE."_{$params['item_id']}_$cleanedName";
251 251
                     if (!file_exists($fileDir)) {
252 252
                         mkdir($fileDir, $dirPermissions, true);
253 253
                     }
254 254
 
255 255
                     if ($value['error'] == 0) {
256
-                        moveUploadedFile($value, $fileDir . $fileName);
256
+                        moveUploadedFile($value, $fileDir.$fileName);
257 257
 
258 258
                         $new_params = array(
259 259
                             'item_id' => $params['item_id'],
260 260
                             'field_id' => $extraFieldInfo['id'],
261
-                            'value' => $fileDirStored . $fileName
261
+                            'value' => $fileDirStored.$fileName
262 262
                         );
263 263
 
264 264
                         if ($this->type !== 'session' && $this->type !== 'course') {
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
                 */
381 381
                 if (false) {
382 382
                     global $app;
383
-                    switch($this->type) {
383
+                    switch ($this->type) {
384 384
                         case 'question':
385 385
                             $extraFieldValue = new ChamiloLMS\Entity\QuestionFieldValues();
386 386
                             $extraFieldValue->setUserId(api_get_user_id());
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
                 */
443 443
                 if (false) {
444 444
                     global $app;
445
-                    switch($this->type) {
445
+                    switch ($this->type) {
446 446
                         case 'question':
447 447
                             $extraFieldValue = $app['orm.ems']['db_write']->getRepository('ChamiloLMS\Entity\QuestionFieldValues')->find($field_values['id']);
448 448
                             $extraFieldValue->setUserId(api_get_user_id());
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
      * This function is used with $extraField->addElements()
74 74
      * @param array $params array for the insertion into the *_field_values table
75 75
      *
76
-     * @return mixed false on empty params, void otherwise
76
+     * @return false|null false on empty params, void otherwise
77 77
      * @assert (array()) === false
78 78
      */
79 79
     public function saveFieldValues($params)
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
      * @param int $item_id Item ID (It could be a session_id, course_id or user_id)
531 531
      * @param int $field_id Field ID (the ID from the *_field table)
532 532
      * @param bool $transform Whether to transform the result to a human readable strings
533
-     * @return mixed A structured array with the field_id and field_value, or false on error
533
+     * @return string A structured array with the field_id and field_value, or false on error
534 534
      * @assert (-1,-1) === false
535 535
      */
536 536
     public function get_values_by_handler_and_field_id($item_id, $field_id, $transform = false)
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
      * @param int $item_id Item ID from the original table
624 624
      * @param string $field_variable The name of the field we are looking for
625 625
      * @param bool $transform
626
-     * @param bool $allVisibility
626
+     * @param bool $visibility
627 627
      *
628 628
      * @return mixed Array of results, or false on error or not found
629 629
      * @assert (-1,'') === false
Please login to merge, or discard this patch.
main/inc/lib/export.lib.inc.php 3 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         }
100 100
         foreach ($data as $row) {
101 101
             $string = implode("</td><td>", $row);
102
-            $string = '<tr><td>' . $string . '</td></tr>';
102
+            $string = '<tr><td>'.$string.'</td></tr>';
103 103
             if ($encoding != 'utf-8') {
104 104
                 $string = api_convert_encoding($string, $encoding, $systemEncoding);
105 105
             }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
             fwrite($handle, '<'.$wrapper_tagname.'>');
174 174
         }
175 175
         $s = self::_export_complex_table_xml_helper($data);
176
-        fwrite($handle,$s);
176
+        fwrite($handle, $s);
177 177
         if (!is_null($wrapper_tagname)) {
178 178
             fwrite($handle, '</'.$wrapper_tagname.'>'."\n");
179 179
         }
@@ -195,10 +195,10 @@  discard block
 block discarded – undo
195 195
         }
196 196
         $string = '';
197 197
         foreach ($data as $row) {
198
-            $string .= "\n".str_repeat("\t",$level).'<'.$row['name'].'>';
198
+            $string .= "\n".str_repeat("\t", $level).'<'.$row['name'].'>';
199 199
             if (is_array($row['value'])) {
200
-            	$string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n";
201
-                $string .= str_repeat("\t",$level).'</'.$row['name'].'>';
200
+            	$string .= self::_export_complex_table_xml_helper($row['value'], $level + 1)."\n";
201
+                $string .= str_repeat("\t", $level).'</'.$row['name'].'>';
202 202
             } else {
203 203
                 $string .= $row['value'];
204 204
                 $string .= '</'.$row['name'].'>';
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      * @param array $data
39 39
      * @param string $filename
40 40
      *
41
-     * @return mixed csv file | false if no data to export
41
+     * @return false|null csv file | false if no data to export
42 42
      */
43 43
     public static function arrayToCsv($data, $filename = 'export')
44 44
     {
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      * @param string Name of common tag to place each line in
161 161
      * @param string Name of the root element. A root element should always be given.
162 162
      * @param string Encoding in which the data is provided
163
-     * @return void  Prompts the user for a file download
163
+     * @return boolean  Prompts the user for a file download
164 164
      */
165 165
     public static function export_complex_table_xml(
166 166
         $data,
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
      * @param string $name
287 287
      * @param string $format
288 288
      *
289
-     * @return bool
289
+     * @return false|null
290 290
      */
291 291
     public static function htmlToOdt($html, $name, $format = 'odt')
292 292
     {
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
     }
116 116
 
117 117
     /**
118
-    * Export tabular data to XML-file
119
-    * @param array  Simple array of data to put in XML
120
-    * @param string Name of file to be given to the user
121
-    * @param string Name of common tag to place each line in
122
-    * @param string Name of the root element. A root element should always be given.
123
-    * @param string Encoding in which the data is provided
124
-    */
118
+     * Export tabular data to XML-file
119
+     * @param array  Simple array of data to put in XML
120
+     * @param string Name of file to be given to the user
121
+     * @param string Name of common tag to place each line in
122
+     * @param string Name of the root element. A root element should always be given.
123
+     * @param string Encoding in which the data is provided
124
+     */
125 125
     public static function arrayToXml(
126 126
         $data,
127 127
         $filename = 'export',
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         foreach ($data as $row) {
201 201
             $string .= "\n".str_repeat("\t",$level).'<'.$row['name'].'>';
202 202
             if (is_array($row['value'])) {
203
-            	$string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n";
203
+                $string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n";
204 204
                 $string .= str_repeat("\t",$level).'</'.$row['name'].'>';
205 205
             } else {
206 206
                 $string .= $row['value'];
Please login to merge, or discard this patch.
main/inc/lib/chat.lib.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         $to_user_id,
187 187
         $message,
188 188
         $printResult = true,
189
-        $sanitize =  true
189
+        $sanitize = true
190 190
     )
191 191
     {
192 192
         $user_friend_relation = SocialManager::get_relation_between_contacts(
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
                 $messagesan = $message;
207 207
             }
208 208
 
209
-            error_log(print_r($sanitize) . '----' . $messagesan);
209
+            error_log(print_r($sanitize).'----'.$messagesan);
210 210
 
211 211
             if (!isset($_SESSION['chatHistory'][$to_user_id])) {
212 212
                 $_SESSION['chatHistory'][$to_user_id] = array();
@@ -289,9 +289,9 @@  discard block
 block discarded – undo
289 289
      */
290 290
     public static function disableChat()
291 291
     {
292
-        if (!empty($_SESSION['disable_chat'])){
292
+        if (!empty($_SESSION['disable_chat'])) {
293 293
             $status = $_SESSION['disable_chat'];
294
-            if ($status == true){
294
+            if ($status == true) {
295 295
                 $_SESSION['disable_chat'] = null;
296 296
                 return true;
297 297
             }
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
     }
40 40
 
41 41
     /**
42
-    * Set user chat status
43
-    * @param int 0 if disconnected, 1 if connected
44
-    * @param integer $status
42
+     * Set user chat status
43
+     * @param int 0 if disconnected, 1 if connected
44
+     * @param integer $status
45 45
      *
46
-    * @return void
47
-    */
46
+     * @return void
47
+     */
48 48
     public function setUserStatus($status)
49 49
     {
50 50
         UserManager::update_extra_field_value(api_get_user_id(), 'user_chat_status', $status);
@@ -148,10 +148,10 @@  discard block
 block discarded – undo
148 148
     }
149 149
 
150 150
     /**
151
-    * Returns an array of messages inside a chat session with a specific user
152
-    * @param int The ID of the user with whom the current user is chatting
153
-    * @return array Messages list
154
-    */
151
+     * Returns an array of messages inside a chat session with a specific user
152
+     * @param int The ID of the user with whom the current user is chatting
153
+     * @return array Messages list
154
+     */
155 155
     public function box_session($user_id)
156 156
     {
157 157
         $items = array();
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
             }
300 300
         }
301 301
          
302
-         return false;
302
+            return false;
303 303
     }
304 304
     
305 305
     public function is_chat_blocked_by_exercises()
Please login to merge, or discard this patch.
main/inc/lib/array.lib.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -108,24 +108,24 @@
 block discarded – undo
108 108
  */
109 109
 function utf8_sort($array)
110 110
 {
111
-	$old_locale = setlocale(LC_ALL, null);
112
-	$code = api_get_language_isocode();
113
-	$locale_list = array($code.'.utf8', 'en.utf8','en_US.utf8','en_GB.utf8');
114
-	$try_sort = false;
111
+    $old_locale = setlocale(LC_ALL, null);
112
+    $code = api_get_language_isocode();
113
+    $locale_list = array($code.'.utf8', 'en.utf8','en_US.utf8','en_GB.utf8');
114
+    $try_sort = false;
115 115
 
116
-	foreach($locale_list as $locale) {
117
-		$my_local = setlocale(LC_COLLATE, $locale);
118
-		if ($my_local) {
119
-			$try_sort = true;
120
-			break;
121
-		}
122
-	}
116
+    foreach($locale_list as $locale) {
117
+        $my_local = setlocale(LC_COLLATE, $locale);
118
+        if ($my_local) {
119
+            $try_sort = true;
120
+            break;
121
+        }
122
+    }
123 123
 
124
-	if ($try_sort) {
125
-		uasort($array, 'strcoll');
126
-	}
127
-	setlocale(LC_COLLATE, $old_locale);
128
-	return $array;
124
+    if ($try_sort) {
125
+        uasort($array, 'strcoll');
126
+    }
127
+    setlocale(LC_COLLATE, $old_locale);
128
+    return $array;
129 129
 }
130 130
 
131 131
 /**
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 {
111 111
 	$old_locale = setlocale(LC_ALL, null);
112 112
 	$code = api_get_language_isocode();
113
-	$locale_list = array($code.'.utf8', 'en.utf8','en_US.utf8','en_GB.utf8');
113
+	$locale_list = array($code.'.utf8', 'en.utf8', 'en_US.utf8', 'en_GB.utf8');
114 114
 	$try_sort = false;
115 115
 
116
-	foreach($locale_list as $locale) {
116
+	foreach ($locale_list as $locale) {
117 117
 		$my_local = setlocale(LC_COLLATE, $locale);
118 118
 		if ($my_local) {
119 119
 			$try_sort = true;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     $flatten = array();
152 152
     array_walk_recursive(
153 153
         $array,
154
-        function ($value) use (&$flatten) {
154
+        function($value) use (&$flatten) {
155 155
             $flatten[] = $value;
156 156
         }
157 157
     );
Please login to merge, or discard this patch.
main/inc/lib/notebook.lib.php 2 patches
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -219,10 +219,10 @@
 block discarded – undo
219 219
         // action links
220 220
         echo '<div class="actions">';
221 221
         if (!api_is_anonymous()) {
222
-            if (api_get_session_id() == 0)
223
-                echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' .
222
+            if (api_get_session_id() == 0) {
223
+                            echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' .
224 224
                     Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
225
-            elseif (api_is_allowed_to_session_edit(false, true)) {
225
+            } elseif (api_is_allowed_to_session_edit(false, true)) {
226 226
                 echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' .
227 227
                     Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
228 228
             }
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         return "<script>
30 30
 				function confirmation (name)
31 31
 				{
32
-					if (confirm(\" " . get_lang("NoteConfirmDelete") . " \"+ name + \" ?\"))
32
+					if (confirm(\" " . get_lang("NoteConfirmDelete")." \"+ name + \" ?\"))
33 33
 						{return true;}
34 34
 					else
35 35
 						{return false;}
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
                 description 		AS note_comment,
108 108
                 session_id			AS session_id
109 109
                FROM $t_notebook
110
-               WHERE c_id = $course_id AND notebook_id = '" . intval($notebook_id) . "' ";
110
+               WHERE c_id = $course_id AND notebook_id = '".intval($notebook_id)."' ";
111 111
         $result = Database::query($sql);
112 112
         if (Database::num_rows($result) != 1) {
113 113
             return array();
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
         $sql = "DELETE FROM $t_notebook
182 182
                 WHERE
183 183
                     c_id = $course_id AND
184
-                    notebook_id='" . intval($notebook_id) . "' AND
185
-                    user_id = '" . api_get_user_id() . "'";
184
+                    notebook_id='".intval($notebook_id)."' AND
185
+                    user_id = '" . api_get_user_id()."'";
186 186
         $result = Database::query($sql);
187 187
         $affected_rows = Database::affected_rows($result);
188 188
         if ($affected_rows != 1) {
@@ -220,22 +220,22 @@  discard block
 block discarded – undo
220 220
         echo '<div class="actions">';
221 221
         if (!api_is_anonymous()) {
222 222
             if (api_get_session_id() == 0)
223
-                echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' .
224
-                    Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
223
+                echo '<a href="index.php?'.api_get_cidreq().'&action=addnote">'.
224
+                    Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32').'</a>';
225 225
             elseif (api_is_allowed_to_session_edit(false, true)) {
226
-                echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' .
227
-                    Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
226
+                echo '<a href="index.php?'.api_get_cidreq().'&action=addnote">'.
227
+                    Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32').'</a>';
228 228
             }
229 229
         } else {
230
-            echo '<a href="javascript:void(0)">' . Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
230
+            echo '<a href="javascript:void(0)">'.Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32').'</a>';
231 231
         }
232 232
 
233
-        echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=creation_date&direction=' . $link_sort_direction . '">' .
234
-            Display::return_icon('notes_order_by_date_new.png', get_lang('OrderByCreationDate'), '', '32') . '</a>';
235
-        echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=update_date&direction=' . $link_sort_direction . '">' .
236
-            Display::return_icon('notes_order_by_date_mod.png', get_lang('OrderByModificationDate'), '', '32') . '</a>';
237
-        echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=title&direction=' . $link_sort_direction . '">' .
238
-            Display::return_icon('notes_order_by_title.png', get_lang('OrderByTitle'), '', '32') . '</a>';
233
+        echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=creation_date&direction='.$link_sort_direction.'">'.
234
+            Display::return_icon('notes_order_by_date_new.png', get_lang('OrderByCreationDate'), '', '32').'</a>';
235
+        echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=update_date&direction='.$link_sort_direction.'">'.
236
+            Display::return_icon('notes_order_by_date_mod.png', get_lang('OrderByModificationDate'), '', '32').'</a>';
237
+        echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=title&direction='.$link_sort_direction.'">'.
238
+            Display::return_icon('notes_order_by_title.png', get_lang('OrderByTitle'), '', '32').'</a>';
239 239
         echo '</div>';
240 240
 
241 241
         if (!isset($_SESSION['notebook_view']) || !in_array($_SESSION['notebook_view'], array('creation_date', 'update_date', 'title'))) {
@@ -246,9 +246,9 @@  discard block
 block discarded – undo
246 246
         $t_notebook = Database :: get_course_table(TABLE_NOTEBOOK);
247 247
         $order_by = "";
248 248
         if ($_SESSION['notebook_view'] == 'creation_date' || $_SESSION['notebook_view'] == 'update_date') {
249
-            $order_by = " ORDER BY " . $_SESSION['notebook_view'] . " $sort_direction ";
249
+            $order_by = " ORDER BY ".$_SESSION['notebook_view']." $sort_direction ";
250 250
         } else {
251
-            $order_by = " ORDER BY " . $_SESSION['notebook_view'] . " $sort_direction ";
251
+            $order_by = " ORDER BY ".$_SESSION['notebook_view']." $sort_direction ";
252 252
         }
253 253
 
254 254
         //condition for the session
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
         $sql = "SELECT * FROM $t_notebook
262 262
                 WHERE
263 263
                     c_id = $course_id AND
264
-                    user_id = '" . api_get_user_id() . "'
264
+                    user_id = '".api_get_user_id()."'
265 265
                     $condition_session
266 266
                     $cond_extra $order_by
267 267
                 ";
@@ -274,18 +274,18 @@  discard block
 block discarded – undo
274 274
 
275 275
             $updateValue = '';
276 276
             if ($row['update_date'] <> $row['creation_date']) {
277
-                $updateValue = ', ' . get_lang('UpdateDate') . ': ' . date_to_str_ago($row['update_date']) . '&nbsp;&nbsp;<span class="dropbox_date">' . $update_date . '</span>';
277
+                $updateValue = ', '.get_lang('UpdateDate').': '.date_to_str_ago($row['update_date']).'&nbsp;&nbsp;<span class="dropbox_date">'.$update_date.'</span>';
278 278
             }
279 279
 
280
-            $actions = '<a href="' . api_get_self() . '?action=editnote&notebook_id=' . $row['notebook_id'] . '">' .
281
-                Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a>';
282
-            $actions .= '<a href="' . api_get_self() . '?action=deletenote&notebook_id=' . $row['notebook_id'] . '" onclick="return confirmation(\'' . $row['title'] . '\');">' .
283
-                Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
280
+            $actions = '<a href="'.api_get_self().'?action=editnote&notebook_id='.$row['notebook_id'].'">'.
281
+                Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
282
+            $actions .= '<a href="'.api_get_self().'?action=deletenote&notebook_id='.$row['notebook_id'].'" onclick="return confirmation(\''.$row['title'].'\');">'.
283
+                Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
284 284
 
285 285
             echo Display::panel(
286 286
                 $row['description'],
287
-                $row['title'] . $session_img.' <div class="pull-right">'.$actions.'</div>',
288
-                get_lang('CreationDate') . ': ' . date_to_str_ago($row['creation_date']) . '&nbsp;&nbsp;<span class="dropbox_date">' . $creation_date . $updateValue."</span>"
287
+                $row['title'].$session_img.' <div class="pull-right">'.$actions.'</div>',
288
+                get_lang('CreationDate').': '.date_to_str_ago($row['creation_date']).'&nbsp;&nbsp;<span class="dropbox_date">'.$creation_date.$updateValue."</span>"
289 289
             );
290 290
         }
291 291
     }
Please login to merge, or discard this patch.
main/inc/lib/display.lib.php 4 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -666,9 +666,10 @@
 block discarded – undo
666 666
         $result = '';
667 667
         for ($i = $min; $i <= $max; $i ++) {
668 668
             $result .= '<option value="'.$i.'"';
669
-            if (is_int($selected_num))
670
-                if ($selected_num == $i) {
669
+            if (is_int($selected_num)) {
670
+                            if ($selected_num == $i) {
671 671
                     $result .= ' selected="selected"';
672
+            }
672 673
                 }
673 674
             $result .= '>'.$i.'</option>';
674 675
         }
Please login to merge, or discard this patch.
Doc Comments   +26 added lines, -17 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     }
33 33
 
34 34
     /**
35
-     * @return array
35
+     * @return string[]
36 36
      */
37 37
     public static function toolList()
38 38
     {
@@ -290,7 +290,6 @@  discard block
 block discarded – undo
290 290
      * 					'page_nr' = The page to display
291 291
      * 					'hide_navigation' =  true to hide the navigation
292 292
      * @param array $query_vars Additional variables to add in the query-string
293
-     * @param array $form actions Additional variables to add in the query-string
294 293
      * @param mixed An array with bool values to know which columns show.
295 294
      * i.e: $visibility_options= array(true, false) we will only show the first column
296 295
      * 				Can be also only a bool value. TRUE: show all columns, FALSE: show nothing
@@ -331,7 +330,6 @@  discard block
 block discarded – undo
331 330
      * 					'page_nr' = The page to display
332 331
      * 					'hide_navigation' =  true to hide the navigation
333 332
      * @param array $query_vars Additional variables to add in the query-string
334
-     * @param array $form actions Additional variables to add in the query-string
335 333
      * @param mixed An array with bool values to know which columns show. i.e:
336 334
      *  $visibility_options= array(true, false) we will only show the first column
337 335
      * 	Can be also only a bool value. TRUE: show all columns, FALSE: show nothing
@@ -388,10 +386,11 @@  discard block
 block discarded – undo
388 386
      * 					'per_page' = number of items to show per page
389 387
      * 					'page_nr' = The page to display
390 388
      * @param array $query_vars Additional variables to add in the query-string
391
-     * @param array $column_show Array of binaries 1= show columns 0. hide a column
389
+     * @param integer[] $column_show Array of binaries 1= show columns 0. hide a column
392 390
      * @param array $column_order An array of integers that let us decide how the columns are going to be sort.
393 391
      * 						      i.e:  $column_order=array('1''4','3','4'); The 2nd column will be order like the 4th column
394 392
      * @param array $form_actions Set optional forms actions
393
+     * @param string $table_name
395 394
      *
396 395
      * @author Julio Montoya
397 396
      */
@@ -444,7 +443,7 @@  discard block
 block discarded – undo
444 443
      * @param bool	$filter (true) or not (false)
445 444
      * @param bool $returnValue
446 445
      *
447
-     * @return void
446
+     * @return string|null
448 447
      */
449 448
     public static function display_normal_message($message, $filter = true, $returnValue = false)
450 449
     {
@@ -474,7 +473,7 @@  discard block
 block discarded – undo
474 473
     /**
475 474
      * Displays an confirmation message. Use this if something has been done successfully
476 475
      * @param bool	Filter (true) or not (false)
477
-     * @return void
476
+     * @return string|null
478 477
      */
479 478
     public static function display_confirmation_message ($message, $filter = true, $returnValue = false)
480 479
     {
@@ -491,7 +490,7 @@  discard block
 block discarded – undo
491 490
      * @param string $message - include any additional html
492 491
      *                          tags if you need them
493 492
      * @param bool	Filter (true) or not (false)
494
-     * @return void
493
+     * @return string|null
495 494
      */
496 495
     public static function display_error_message ($message, $filter = true, $returnValue = false)
497 496
     {
@@ -681,6 +680,7 @@  discard block
 block discarded – undo
681 680
      * @param string   The alt text (probably a language variable)
682 681
      * @param array    additional attributes (for instance height, width, onclick, ...)
683 682
      * @param integer  The wanted width of the icon (to be looked for in the corresponding img/icons/ folder)
683
+     * @param string $image
684 684
      * @return void
685 685
     */
686 686
     public static function display_icon(
@@ -886,6 +886,7 @@  discard block
 block discarded – undo
886 886
     /**
887 887
      * Displays an HTML input tag
888 888
      *
889
+     * @param string $type
889 890
      */
890 891
     public static function input($type, $name, $value, $attributes = array())
891 892
     {
@@ -902,8 +903,8 @@  discard block
 block discarded – undo
902 903
     }
903 904
 
904 905
     /**
905
-     * @param $name
906
-     * @param $value
906
+     * @param string $name
907
+     * @param string $value
907 908
      * @param array $attributes
908 909
      * @return string
909 910
      */
@@ -918,6 +919,7 @@  discard block
 block discarded – undo
918 919
     /**
919 920
      * Displays an HTML select tag
920 921
      *
922
+     * @param string $blank_item_text
921 923
      */
922 924
     public static function select(
923 925
         $name,
@@ -984,8 +986,8 @@  discard block
 block discarded – undo
984 986
                         $( "#tabs" ).tabs();
985 987
                     });
986 988
                 </script>
987
-     * @param   array   $headers list of the tab titles
988
-     * @param   array   $items
989
+     * @param   string[]   $headers list of the tab titles
990
+     * @param   string[]   $items
989 991
      * @param   string  $id id of the container of the tab in the example "tabs"
990 992
      * @param   array   $attributes for the ul
991 993
      * @param array $ul_attributes
@@ -1039,7 +1041,7 @@  discard block
 block discarded – undo
1039 1041
 
1040 1042
     /**
1041 1043
      * @param $headers
1042
-     * @param null $selected
1044
+     * @param integer $selected
1043 1045
      *
1044 1046
      * @return string
1045 1047
      */
@@ -1077,6 +1079,7 @@  discard block
 block discarded – undo
1077 1079
      * As you can see both function use the same "my_grid_name" this is very important otherwise nothing will work
1078 1080
      *
1079 1081
      * @param   string  the div id, this value must be the same with the first parameter of Display::grid_js()
1082
+     * @param string $div_id
1080 1083
      * @return  string  html
1081 1084
      *
1082 1085
      */
@@ -1632,6 +1635,8 @@  discard block
 block discarded – undo
1632 1635
      * @param  string  url that will be added (for jquery see hot_courses.tpl)
1633 1636
 	 * @param	string	point info array see function CourseManager::get_course_ranking()
1634 1637
 	 * @param	bool	add a div wrapper
1638
+	 * @param string $id
1639
+	 * @param string $url
1635 1640
 	 * @todo	use     templates
1636 1641
      **/
1637 1642
     public static function return_rating_system($id, $url, $point_info = array(), $add_div_wrapper = true)
@@ -1727,6 +1732,9 @@  discard block
 block discarded – undo
1727 1732
         return '<'.$size.'>'.Security::remove_XSS($title).'</'.$size.'>';
1728 1733
     }
1729 1734
 
1735
+    /**
1736
+     * @param string $title
1737
+     */
1730 1738
     public static function page_subheader2($title, $second_title = null)
1731 1739
     {
1732 1740
         return self::page_header($title, $second_title, 'h4');
@@ -1957,6 +1965,7 @@  discard block
 block discarded – undo
1957 1965
 
1958 1966
     /**
1959 1967
      * @todo use twig
1968
+     * @param string $title
1960 1969
      */
1961 1970
     public static function group_button($title, $elements)
1962 1971
     {
@@ -2174,9 +2183,9 @@  discard block
 block discarded – undo
2174 2183
 
2175 2184
     /**
2176 2185
      * @param int $id
2177
-     * @param array $content
2186
+     * @param string[] $content
2178 2187
      * @param int $col
2179
-     * @param bool|true $right
2188
+     * @param boolean $right
2180 2189
      * @return string
2181 2190
      */
2182 2191
     public static function toolbarAction($id, $content = array(), $col = 2, $right = true)
@@ -2258,10 +2267,10 @@  discard block
 block discarded – undo
2258 2267
     /**
2259 2268
      * @param string $title
2260 2269
      * @param string $content
2261
-     * @param null $id
2270
+     * @param string $id
2262 2271
      * @param array $params
2263
-     * @param null $idAccordion
2264
-     * @param null $idCollapse
2272
+     * @param string $idAccordion
2273
+     * @param string $idCollapse
2265 2274
      * @param bool|true $open
2266 2275
      * @param bool|false $fullClickable
2267 2276
      * @return null|string
Please login to merge, or discard this patch.
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -49,12 +49,12 @@  discard block
 block discarded – undo
49 49
         );
50 50
     }
51 51
 
52
-     /**
53
-     * Displays the page header
54
-     * @param string The name of the page (will be showed in the page title)
55
-     * @param string Optional help file name
56
-     * @param string $page_header
57
-     */
52
+        /**
53
+         * Displays the page header
54
+         * @param string The name of the page (will be showed in the page title)
55
+         * @param string Optional help file name
56
+         * @param string $page_header
57
+         */
58 58
     public static function display_header($tool_name ='', $help = null, $page_header = null)
59 59
     {
60 60
         $origin = api_get_origin();
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
      */
449 449
     public static function display_normal_message($message, $filter = true, $returnValue = false)
450 450
     {
451
-    	$message = self::return_message($message, 'normal', $filter);
451
+        $message = self::return_message($message, 'normal', $filter);
452 452
         if ($returnValue) {
453 453
             return $message;
454 454
         } else {
@@ -528,22 +528,22 @@  discard block
 block discarded – undo
528 528
         }
529 529
 
530 530
         if ($filter) {
531
-        	$message = api_htmlentities($message, ENT_QUOTES, api_is_xml_http_request() ? 'UTF-8' : api_get_system_encoding());
531
+            $message = api_htmlentities($message, ENT_QUOTES, api_is_xml_http_request() ? 'UTF-8' : api_get_system_encoding());
532 532
         }
533 533
 
534 534
         $class = "";
535 535
         switch($type) {
536 536
             case 'warning':
537 537
                $class .= 'alert alert-warning';
538
-               break;
538
+                break;
539 539
             case 'error':
540 540
                $class .= 'alert alert-danger';
541
-               break;
541
+                break;
542 542
             case 'confirmation':
543 543
             case 'confirm':
544 544
             case 'success':
545 545
                 $class .= 'alert alert-success';
546
-               break;
546
+                break;
547 547
             case 'normal':
548 548
             default:
549 549
                 $class .= 'alert alert-info';
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
      * @param array    additional attributes (for instance height, width, onclick, ...)
687 687
      * @param integer  The wanted width of the icon (to be looked for in the corresponding img/icons/ folder)
688 688
      * @return void
689
-    */
689
+     */
690 690
     public static function display_icon(
691 691
         $image,
692 692
         $alt_text = '',
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
      * @author Julio Montoya 2010 Function improved, adding image constants
723 723
      * @author Yannick Warnier 2011 Added size handler
724 724
      * @version Feb 2011
725
-    */
725
+     */
726 726
     public static function return_icon(
727 727
         $image,
728 728
         $alt_text = '',
@@ -911,14 +911,14 @@  discard block
 block discarded – undo
911 911
      */
912 912
     public static function input($type, $name, $value, $attributes = array())
913 913
     {
914
-         if (isset($type)) {
915
-             $attributes['type']= $type;
916
-         }
917
-         if (isset($name)) {
918
-             $attributes['name']= $name;
919
-         }
920
-         if (isset($value)) {
921
-             $attributes['value']= $value;
914
+            if (isset($type)) {
915
+                $attributes['type']= $type;
916
+            }
917
+            if (isset($name)) {
918
+                $attributes['name']= $name;
919
+            }
920
+            if (isset($value)) {
921
+                $attributes['value']= $value;
922 922
         }
923 923
         return self::tag('input', '', $attributes);
924 924
     }
@@ -931,10 +931,10 @@  discard block
 block discarded – undo
931 931
      */
932 932
     public static function button($name, $value, $attributes = array())
933 933
     {
934
-    	if (!empty($name)) {
934
+        if (!empty($name)) {
935 935
             $attributes['name'] = $name;
936
-    	}
937
-    	return self::tag('button', $value, $attributes);
936
+        }
937
+        return self::tag('button', $value, $attributes);
938 938
     }
939 939
 
940 940
     /**
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
      * in the $htmlHeadXtra variable before the display_header
1002 1002
      * Add this script
1003 1003
      * @example
1004
-             * <script>
1004
+     * <script>
1005 1005
                     $(function() {
1006 1006
                         $( "#tabs" ).tabs();
1007 1007
                     });
@@ -1067,20 +1067,20 @@  discard block
 block discarded – undo
1067 1067
      */
1068 1068
     public static function tabsOnlyLink($headers, $selected = null)
1069 1069
     {
1070
-         $id = uniqid();
1071
-         $i = 1;
1072
-         $lis = null;
1073
-         foreach ($headers as $item) {
1070
+            $id = uniqid();
1071
+            $i = 1;
1072
+            $lis = null;
1073
+            foreach ($headers as $item) {
1074 1074
             $class = null;
1075 1075
             if ($i == $selected) {
1076 1076
                 $class = 'active';
1077 1077
             }
1078
-             $item = self::tag(
1079
-                 'a',
1080
-                 $item['content'],
1081
-                 array('id' => $id.'-'.$i, 'href' => $item['url'])
1082
-             );
1083
-             $lis .= self::tag('li', $item, array('class' => $class));
1078
+                $item = self::tag(
1079
+                    'a',
1080
+                    $item['content'],
1081
+                    array('id' => $id.'-'.$i, 'href' => $item['url'])
1082
+                );
1083
+                $lis .= self::tag('li', $item, array('class' => $class));
1084 1084
             $i++;
1085 1085
         }
1086 1086
         return self::tag('ul', $lis, array('class' => 'nav nav-tabs tabs-margin'));
@@ -1292,8 +1292,8 @@  discard block
 block discarded – undo
1292 1292
      */
1293 1293
     public static function table($headers, $rows, $attributes = array())
1294 1294
     {
1295
-    	if (empty($attributes)) {
1296
-    		$attributes['class'] = 'data_table';
1295
+        if (empty($attributes)) {
1296
+            $attributes['class'] = 'data_table';
1297 1297
         }
1298 1298
         $table = new HTML_Table($attributes);
1299 1299
         $row = 0;
@@ -1301,17 +1301,17 @@  discard block
 block discarded – undo
1301 1301
 
1302 1302
         // Course headers
1303 1303
         if (!empty($headers)) {
1304
-	        foreach ($headers as $item) {
1305
-	            $table->setHeaderContents($row, $column, $item);
1306
-	            $column++;
1307
-	        }
1308
-	        $row = 1;
1309
-	        $column = 0;
1304
+            foreach ($headers as $item) {
1305
+                $table->setHeaderContents($row, $column, $item);
1306
+                $column++;
1307
+            }
1308
+            $row = 1;
1309
+            $column = 0;
1310 1310
         }
1311 1311
 
1312 1312
         if (!empty($rows)) {
1313
-	        foreach($rows as $content) {
1314
-	            $table->setCellContents($row, $column, $content);
1313
+            foreach($rows as $content) {
1314
+                $table->setCellContents($row, $column, $content);
1315 1315
                 $row++;
1316 1316
             }
1317 1317
         }
@@ -1417,7 +1417,7 @@  discard block
 block discarded – undo
1417 1417
                         //$item_property['tool'] != TOOL_DROPBOX &&
1418 1418
                         $item_property['tool'] != TOOL_NOTEBOOK &&
1419 1419
                         $item_property['tool'] != TOOL_CHAT)
1420
-                   )
1420
+                    )
1421 1421
                 )
1422 1422
                 // Take only what's visible or "invisible but where the user is a teacher" or where the visibility is unset.
1423 1423
                 && ($item_property['visibility'] == '1'
@@ -1433,7 +1433,7 @@  discard block
 block discarded – undo
1433 1433
                         ($item_property['to_user_id'] != $user_id) &&
1434 1434
                         (!isset($item_property['to_group_id']) || !in_array($item_property['to_group_id'], $group_ids)))
1435 1435
                 ) {
1436
-                   continue;
1436
+                    continue;
1437 1437
                 }
1438 1438
 
1439 1439
                 // If it's a survey, make sure the user's invited. Otherwise drop it.
@@ -1651,21 +1651,21 @@  discard block
 block discarded – undo
1651 1651
      *
1652 1652
      * @param  string  id of the rating ul element
1653 1653
      * @param  string  url that will be added (for jquery see hot_courses.tpl)
1654
-	 * @param	string	point info array see function CourseManager::get_course_ranking()
1655
-	 * @param	bool	add a div wrapper
1656
-	 * @todo	use     templates
1654
+     * @param	string	point info array see function CourseManager::get_course_ranking()
1655
+     * @param	bool	add a div wrapper
1656
+     * @todo	use     templates
1657 1657
      **/
1658 1658
     public static function return_rating_system($id, $url, $point_info = array(), $add_div_wrapper = true)
1659 1659
     {
1660
-		$number_of_users_who_voted = isset($point_info['users_who_voted']) ? $point_info['users_who_voted'] : null;
1661
-		$percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0;
1660
+        $number_of_users_who_voted = isset($point_info['users_who_voted']) ? $point_info['users_who_voted'] : null;
1661
+        $percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0;
1662 1662
 
1663
-		if (!empty($percentage)) {
1663
+        if (!empty($percentage)) {
1664 1664
             $percentage = $percentage*125/100;
1665 1665
         }
1666
-		$accesses =  isset($point_info['accesses']) ? $point_info['accesses'] : 0;
1666
+        $accesses =  isset($point_info['accesses']) ? $point_info['accesses'] : 0;
1667 1667
 
1668
-		$star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']);
1668
+        $star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']);
1669 1669
 
1670 1670
         $html = '<ul id="'.$id.'" class="star-rating">
1671 1671
 					<li class="current-rating" style="width:'.$percentage.'px;"></li>
@@ -1676,26 +1676,26 @@  discard block
 block discarded – undo
1676 1676
 					<li><a href="javascript:void(0);" data-link="'.$url.'&amp;star=5" title="'.$star_label.'" class="five-stars">5</a></li>
1677 1677
 				</ul>';
1678 1678
 
1679
-		$labels = array();
1679
+        $labels = array();
1680 1680
 
1681
-		$labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes');
1682
-		$labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits');
1683
-		/* if (!empty($number_of_users_who_voted)) {
1681
+        $labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes');
1682
+        $labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits');
1683
+        /* if (!empty($number_of_users_who_voted)) {
1684 1684
 			$labels[]= get_lang('Average').' '.$point_info['point_average_star'].'/5';
1685 1685
 		} */
1686 1686
 
1687
-		$labels[]= $point_info['user_vote']  ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] ';
1687
+        $labels[]= $point_info['user_vote']  ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] ';
1688 1688
 
1689
-		if (!$add_div_wrapper && api_is_anonymous()) {
1690
-			$labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error'));
1691
-		}
1689
+        if (!$add_div_wrapper && api_is_anonymous()) {
1690
+            $labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error'));
1691
+        }
1692 1692
 
1693 1693
         $html .= Display::div(implode(' | ', $labels) , array('id' =>  'vote_label_'.$id, 'class' => 'vote_label_info'));
1694 1694
         $html .= ' '.Display::span(' ', array('id' =>  'vote_label2_'.$id));
1695 1695
 
1696 1696
         if ($add_div_wrapper) {
1697
-			$html = Display::div($html, array('id' => 'rating_wrapper_'.$id));
1698
-		}
1697
+            $html = Display::div($html, array('id' => 'rating_wrapper_'.$id));
1698
+        }
1699 1699
 
1700 1700
         return $html;
1701 1701
     }
@@ -1733,8 +1733,8 @@  discard block
 block discarded – undo
1733 1733
         return self::page_header($title, $second_title);
1734 1734
     }
1735 1735
 
1736
-     public static function page_subheader_and_translate($title, $second_title = null)
1737
-     {
1736
+        public static function page_subheader_and_translate($title, $second_title = null)
1737
+        {
1738 1738
         $title = get_lang($title);
1739 1739
         return self::page_subheader($title, $second_title);
1740 1740
     }
Please login to merge, or discard this patch.
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
      * @param string Optional help file name
56 56
      * @param string $page_header
57 57
      */
58
-    public static function display_header($tool_name ='', $help = null, $page_header = null)
58
+    public static function display_header($tool_name = '', $help = null, $page_header = null)
59 59
     {
60 60
         $origin = api_get_origin();
61 61
         $showHeader = true;
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
         $grid_class = array(),
352 352
         $elementCount = 0
353 353
     ) {
354
-        $column =  0;
354
+        $column = 0;
355 355
         $default_items_per_page = isset($paging_options['per_page']) ? $paging_options['per_page'] : 20;
356 356
 
357 357
         $table = new SortableTableFromArray($content, $column, $default_items_per_page, $name);
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
      * @param bool	Filter (true) or not (false)
477 477
      * @return void
478 478
      */
479
-    public static function display_confirmation_message ($message, $filter = true, $returnValue = false)
479
+    public static function display_confirmation_message($message, $filter = true, $returnValue = false)
480 480
     {
481 481
         $message = self::return_message($message, 'confirm', $filter);
482 482
         if ($returnValue) {
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
      * @param bool	Filter (true) or not (false)
494 494
      * @return void
495 495
      */
496
-    public static function display_error_message ($message, $filter = true, $returnValue = false)
496
+    public static function display_error_message($message, $filter = true, $returnValue = false)
497 497
     {
498 498
         $message = self::return_message($message, 'error', $filter);
499 499
         if ($returnValue) {
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
      * @param string $type
509 509
      * @param bool $filter
510 510
      */
511
-    public static function return_message_and_translate($message, $type='normal', $filter = true)
511
+    public static function return_message_and_translate($message, $type = 'normal', $filter = true)
512 512
     {
513 513
         $message = get_lang($message);
514 514
         echo self::return_message($message, $type, $filter);
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
         }
533 533
 
534 534
         $class = "";
535
-        switch($type) {
535
+        switch ($type) {
536 536
             case 'warning':
537 537
                $class .= 'alert alert-warning';
538 538
                break;
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
      * @param string  optional, class from stylesheet
561 561
      * @return string encrypted mailto hyperlink
562 562
      */
563
-    public static function encrypted_mailto_link ($email, $clickable_text = null, $style_class = '')
563
+    public static function encrypted_mailto_link($email, $clickable_text = null, $style_class = '')
564 564
     {
565 565
         if (is_null($clickable_text)) {
566 566
             $clickable_text = $email;
@@ -575,14 +575,14 @@  discard block
 block discarded – undo
575 575
         }
576 576
         // Encrypt email
577 577
         $hmail = '';
578
-        for ($i = 0; $i < strlen($email); $i ++) {
578
+        for ($i = 0; $i < strlen($email); $i++) {
579 579
             $hmail .= '&#'.ord($email {
580 580
             $i }).';';
581 581
         }
582 582
         $hclickable_text = null;
583 583
         // Encrypt clickable text if @ is present
584 584
         if (strpos($clickable_text, '@')) {
585
-            for ($i = 0; $i < strlen($clickable_text); $i ++) {
585
+            for ($i = 0; $i < strlen($clickable_text); $i++) {
586 586
                 $hclickable_text .= '&#'.ord($clickable_text {
587 587
                 $i }).';';
588 588
             }
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
         }
615 615
         // Encrypt email
616 616
         $hmail = '';
617
-        for ($i = 0; $i < strlen($email); $i ++) {
617
+        for ($i = 0; $i < strlen($email); $i++) {
618 618
             $hmail .= '&#'.ord($email {
619 619
             $i }).';';
620 620
         }
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
     public static function get_alphabet_options($selected_letter = '')
648 648
     {
649 649
         $result = '';
650
-        for ($i = 65; $i <= 90; $i ++) {
650
+        for ($i = 65; $i <= 90; $i++) {
651 651
             $letter = chr($i);
652 652
             $result .= '<option value="'.$letter.'"';
653 653
             if ($selected_letter == $letter) {
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
     public static function get_numeric_options($min, $max, $selected_num = 0)
669 669
     {
670 670
         $result = '';
671
-        for ($i = $min; $i <= $max; $i ++) {
671
+        for ($i = $min; $i <= $max; $i++) {
672 672
             $result .= '<option value="'.$i.'"';
673 673
             if (is_int($selected_num))
674 674
                 if ($selected_num == $i) {
@@ -738,8 +738,8 @@  discard block
 block discarded – undo
738 738
         // important to use the public path (i.e. web/css/) rather than the
739 739
         // internal path (/app/Resource/public/css/) because the path used
740 740
         // in the end must be the public path
741
-        $alternateCssPath = api_get_path(SYS_PUBLIC_PATH) . 'css/';
742
-        $alternateWebCssPath = api_get_path(WEB_PUBLIC_PATH) . 'css/';
741
+        $alternateCssPath = api_get_path(SYS_PUBLIC_PATH).'css/';
742
+        $alternateWebCssPath = api_get_path(WEB_PUBLIC_PATH).'css/';
743 743
 
744 744
         $image = trim($image);
745 745
 
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
             $size = ICON_SIZE_SMALL;
750 750
         }
751 751
 
752
-        $size_extra = $size . '/';
752
+        $size_extra = $size.'/';
753 753
 
754 754
         // Checking the img/ folder
755 755
         $icon = $w_code_path.'img/'.$image;
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
         $theme = 'themes/chamilo/icons/';
758 758
 
759 759
         if ($loadThemeIcon) {
760
-            $theme = 'themes/' . api_get_visual_theme() . '/icons/';
760
+            $theme = 'themes/'.api_get_visual_theme().'/icons/';
761 761
             // Checking the theme icons folder example: app/Resources/public/css/themes/chamilo/icons/XXX
762 762
             if (is_file($alternateCssPath.$theme.$size_extra.$image)) {
763 763
                 $icon = $alternateWebCssPath.$theme.$size_extra.$image;
@@ -873,7 +873,7 @@  discard block
 block discarded – undo
873 873
             }
874 874
         }
875 875
         //some tags don't have this </XXX>
876
-        if (in_array($tag, array('img','input','br'))) {
876
+        if (in_array($tag, array('img', 'input', 'br'))) {
877 877
             $return_value = '<'.$tag.' '.$attribute_list.' />';
878 878
         } else {
879 879
             $return_value = '<'.$tag.' '.$attribute_list.' > '.$content.'</'.$tag.'>';
@@ -926,13 +926,13 @@  discard block
 block discarded – undo
926 926
     public static function input($type, $name, $value, $attributes = array())
927 927
     {
928 928
          if (isset($type)) {
929
-             $attributes['type']= $type;
929
+             $attributes['type'] = $type;
930 930
          }
931 931
          if (isset($name)) {
932
-             $attributes['name']= $name;
932
+             $attributes['name'] = $name;
933 933
          }
934 934
          if (isset($value)) {
935
-             $attributes['value']= $value;
935
+             $attributes['value'] = $value;
936 936
         }
937 937
         return self::tag('input', '', $attributes);
938 938
     }
@@ -965,14 +965,14 @@  discard block
 block discarded – undo
965 965
     ) {
966 966
         $html = '';
967 967
         $extra = '';
968
-        $default_id = 'id="' . $name . '" ';
968
+        $default_id = 'id="'.$name.'" ';
969 969
         foreach ($extra_attributes as $key => $parameter) {
970 970
             if ($key == 'id') {
971 971
                 $default_id = '';
972 972
             }
973
-            $extra .= $key . '="' . $parameter . '" ';
973
+            $extra .= $key.'="'.$parameter.'" ';
974 974
         }
975
-        $html .= '<select name="' . $name . '" ' . $default_id . ' ' . $extra . '>';
975
+        $html .= '<select name="'.$name.'" '.$default_id.' '.$extra.'>';
976 976
 
977 977
         if ($show_blank_item) {
978 978
             if (empty($blank_item_text)) {
@@ -980,14 +980,14 @@  discard block
 block discarded – undo
980 980
             } else {
981 981
                 $blank_item_text = Security::remove_XSS($blank_item_text);
982 982
             }
983
-            $html .= self::tag('option', '-- ' . $blank_item_text . ' --', array('value' => '-1'));
983
+            $html .= self::tag('option', '-- '.$blank_item_text.' --', array('value' => '-1'));
984 984
         }
985 985
         if ($values) {
986 986
             foreach ($values as $key => $value) {
987 987
                 if (is_array($value) && isset($value['name'])) {
988 988
                     $value = $value['name'];
989 989
                 }
990
-                $html .= '<option value="' . $key . '"';
990
+                $html .= '<option value="'.$key.'"';
991 991
 
992 992
                 if (is_array($default)) {
993 993
                     foreach ($default as $item) {
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
                     }
1003 1003
                 }
1004 1004
 
1005
-                $html .= '>' . $value . '</option>';
1005
+                $html .= '>'.$value.'</option>';
1006 1006
             }
1007 1007
         }
1008 1008
         $html .= '</select>';
@@ -1030,7 +1030,7 @@  discard block
 block discarded – undo
1030 1030
      */
1031 1031
     public static function tabs($headers, $items, $id = 'tabs', $attributes = array(), $ul_attributes = array())
1032 1032
     {
1033
-        if (empty($headers) || count($headers) == 0 ) {
1033
+        if (empty($headers) || count($headers) == 0) {
1034 1034
             return '';
1035 1035
         }
1036 1036
 
@@ -1070,7 +1070,7 @@  discard block
 block discarded – undo
1070 1070
 
1071 1071
         $main_div = self::tag('div', $ul.self::tag('div', $divs, ['class' => 'tab-content']), $attributes);
1072 1072
 
1073
-        return $main_div ;
1073
+        return $main_div;
1074 1074
     }
1075 1075
 
1076 1076
     /**
@@ -1118,8 +1118,8 @@  discard block
 block discarded – undo
1118 1118
      */
1119 1119
     public static function grid_html($div_id)
1120 1120
     {
1121
-        $table  = self::tag('table','', array('id' => $div_id));
1122
-        $table .= self::tag('div','', array('id' => $div_id.'_pager'));
1121
+        $table  = self::tag('table', '', array('id' => $div_id));
1122
+        $table .= self::tag('div', '', array('id' => $div_id.'_pager'));
1123 1123
         return $table;
1124 1124
     }
1125 1125
 
@@ -1180,7 +1180,7 @@  discard block
 block discarded – undo
1180 1180
         $obj->colNames      = $column_names;
1181 1181
         $obj->colModel      = $column_model;
1182 1182
         $obj->pager         = '#'.$div_id.'_pager';
1183
-        $obj->datatype  = 'json';
1183
+        $obj->datatype = 'json';
1184 1184
         $obj->viewrecords = 'true';
1185 1185
 
1186 1186
         $all_value = 10000000;
@@ -1241,10 +1241,10 @@  discard block
 block discarded – undo
1241 1241
         // Adding static data.
1242 1242
         if (!empty($data)) {
1243 1243
             $data_var = $div_id.'_data';
1244
-            $json.=' var '.$data_var.' = '.json_encode($data).';';
1244
+            $json .= ' var '.$data_var.' = '.json_encode($data).';';
1245 1245
             $obj->data = $data_var;
1246 1246
             $obj->datatype = 'local';
1247
-            $json.="\n";
1247
+            $json .= "\n";
1248 1248
         }
1249 1249
 
1250 1250
         $obj->end = 'end';
@@ -1258,12 +1258,12 @@  discard block
 block discarded – undo
1258 1258
         }
1259 1259
 
1260 1260
         // Fixing true/false js values that doesn't need the ""
1261
-        $json_encode = str_replace(':"true"',':true',$json_encode);
1261
+        $json_encode = str_replace(':"true"', ':true', $json_encode);
1262 1262
         // wrap_cell is not a valid jqgrid attributes is a hack to wrap a text
1263 1263
         $json_encode = str_replace('"wrap_cell":true', 'cellattr : function(rowId, value, rowObject, colModel, arrData) { return \'class = "jqgrid_whitespace"\'; }', $json_encode);
1264
-        $json_encode = str_replace(':"false"',':false',$json_encode);
1264
+        $json_encode = str_replace(':"false"', ':false', $json_encode);
1265 1265
         $json_encode = str_replace('"formatter":"action_formatter"', 'formatter:action_formatter', $json_encode);
1266
-        $json_encode = str_replace(array('{"first":"first",','"end":"end"}'), '', $json_encode);
1266
+        $json_encode = str_replace(array('{"first":"first",', '"end":"end"}'), '', $json_encode);
1267 1267
 
1268 1268
         // Creating the jqgrid element.
1269 1269
         $json .= '$("#'.$div_id.'").jqGrid({';
@@ -1278,22 +1278,22 @@  discard block
 block discarded – undo
1278 1278
             $groups = '';
1279 1279
             foreach ($extra_params['groupHeaders'] as $group) {
1280 1280
                 //{ "startColumnName" : "courses", "numberOfColumns" : 1, "titleText" : "Order Info" },
1281
-                $groups .= '{ "startColumnName" : "' . $group['startColumnName'] . '", "numberOfColumns" : ' . $group['numberOfColumns'] . ', "titleText" : "' . $group['titleText']  . '" },';
1281
+                $groups .= '{ "startColumnName" : "'.$group['startColumnName'].'", "numberOfColumns" : '.$group['numberOfColumns'].', "titleText" : "'.$group['titleText'].'" },';
1282 1282
 
1283 1283
             }
1284 1284
             $json .= '$("#'.$div_id.'").jqGrid("setGroupHeaders", {
1285 1285
                 "useColSpanStyle" : false,
1286 1286
                 "groupHeaders"    : [
1287
-                    ' . $groups . '
1287
+                    ' . $groups.'
1288 1288
                 ]
1289 1289
             });';
1290 1290
         }
1291 1291
 
1292 1292
         $all_text = addslashes(get_lang('All'));
1293 1293
         $json .= '$("'.$obj->pager.' option[value='.$all_value.']").text("'.$all_text.'");';
1294
-        $json.= "\n";
1294
+        $json .= "\n";
1295 1295
         // Adding edit/delete icons.
1296
-        $json.= $formatter;
1296
+        $json .= $formatter;
1297 1297
 
1298 1298
         return $json;
1299 1299
     }
@@ -1324,7 +1324,7 @@  discard block
 block discarded – undo
1324 1324
         }
1325 1325
 
1326 1326
         if (!empty($rows)) {
1327
-	        foreach($rows as $content) {
1327
+	        foreach ($rows as $content) {
1328 1328
 	            $table->setCellContents($row, $column, $content);
1329 1329
                 $row++;
1330 1330
             }
@@ -1486,7 +1486,7 @@  discard block
 block discarded – undo
1486 1486
 
1487 1487
         // Show all tool icons where there is something new.
1488 1488
         $return = '&nbsp;';
1489
-        foreach($notifications as $notification) {
1489
+        foreach ($notifications as $notification) {
1490 1490
             $lastDate = date('d/m/Y H:i', convert_sql_date($notification['lastedit_date']));
1491 1491
             $type = $notification['lastedit_type'];
1492 1492
             $label = get_lang('TitleNotification').": ".get_lang($type)." ($lastDate)";
@@ -1529,9 +1529,9 @@  discard block
 block discarded – undo
1529 1529
             $tbl_session            = Database :: get_main_table(TABLE_MAIN_SESSION);
1530 1530
             $active = false;
1531 1531
             // Request for the name of the general coach
1532
-            $sql ='SELECT tu.lastname, tu.firstname, ts.*
1532
+            $sql = 'SELECT tu.lastname, tu.firstname, ts.*
1533 1533
                     FROM '.$tbl_session.' ts
1534
-                    LEFT JOIN '.$main_user_table .' tu
1534
+                    LEFT JOIN '.$main_user_table.' tu
1535 1535
                     ON ts.id_coach = tu.user_id
1536 1536
                     WHERE ts.id = '.intval($session_id);
1537 1537
             $rs = Database::query($sql);
@@ -1543,7 +1543,7 @@  discard block
 block discarded – undo
1543 1543
             $session['title'] = $session_info['name'];
1544 1544
             $session['id_coach'] = $session_info['id_coach'];
1545 1545
             $session['coach'] = '';
1546
-            $session['dates'] =  '';
1546
+            $session['dates'] = '';
1547 1547
 
1548 1548
             if (
1549 1549
                 (
@@ -1616,11 +1616,11 @@  discard block
 block discarded – undo
1616 1616
                         );
1617 1617
                     }
1618 1618
 
1619
-                    $session['dates'] = $start_buffer . " " . $stop_buffer;
1619
+                    $session['dates'] = $start_buffer." ".$stop_buffer;
1620 1620
 
1621 1621
                 }
1622 1622
 
1623
-                if ( api_get_setting('show_session_coach') === 'true' ) {
1623
+                if (api_get_setting('show_session_coach') === 'true') {
1624 1624
                     $session['coach'] = api_get_person_name(
1625 1625
                         $session_info['firstname'],
1626 1626
                         $session_info['lastname']
@@ -1675,9 +1675,9 @@  discard block
 block discarded – undo
1675 1675
 		$percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0;
1676 1676
 
1677 1677
 		if (!empty($percentage)) {
1678
-            $percentage = $percentage*125/100;
1678
+            $percentage = $percentage * 125 / 100;
1679 1679
         }
1680
-		$accesses =  isset($point_info['accesses']) ? $point_info['accesses'] : 0;
1680
+		$accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0;
1681 1681
 
1682 1682
 		$star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']);
1683 1683
 
@@ -1692,19 +1692,19 @@  discard block
 block discarded – undo
1692 1692
 
1693 1693
 		$labels = array();
1694 1694
 
1695
-		$labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes');
1696
-		$labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits');
1695
+		$labels[] = $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes');
1696
+		$labels[] = $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits');
1697 1697
 		/* if (!empty($number_of_users_who_voted)) {
1698 1698
 			$labels[]= get_lang('Average').' '.$point_info['point_average_star'].'/5';
1699 1699
 		} */
1700 1700
 
1701
-		$labels[]= $point_info['user_vote']  ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] ';
1701
+		$labels[] = $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote').' [?] ';
1702 1702
 
1703 1703
 		if (!$add_div_wrapper && api_is_anonymous()) {
1704
-			$labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error'));
1704
+			$labels[] = Display::tag('span', get_lang('LoginToVote'), array('class' => 'error'));
1705 1705
 		}
1706 1706
 
1707
-        $html .= Display::div(implode(' | ', $labels) , array('id' =>  'vote_label_'.$id, 'class' => 'vote_label_info'));
1707
+        $html .= Display::div(implode(' | ', $labels), array('id' =>  'vote_label_'.$id, 'class' => 'vote_label_info'));
1708 1708
         $html .= ' '.Display::span(' ', array('id' =>  'vote_label2_'.$id));
1709 1709
 
1710 1710
         if ($add_div_wrapper) {
@@ -1782,8 +1782,8 @@  discard block
 block discarded – undo
1782 1782
         if (!empty($list)) {
1783 1783
             $html = '<dl class="dl-horizontal">';
1784 1784
             foreach ($list as $item) {
1785
-                $html .= '<dt>' . $item['title'] . '</dt>';
1786
-                $html .= '<dd>' . $item['content'] . '</dd>';
1785
+                $html .= '<dt>'.$item['title'].'</dt>';
1786
+                $html .= '<dd>'.$item['content'].'</dd>';
1787 1787
             }
1788 1788
             $html .= '</dl>';
1789 1789
         }
@@ -1825,7 +1825,7 @@  discard block
 block discarded – undo
1825 1825
      * @param string $type
1826 1826
      * @return null|string
1827 1827
      */
1828
-    public static function badge($count, $type ="warning")
1828
+    public static function badge($count, $type = "warning")
1829 1829
     {
1830 1830
         $class = '';
1831 1831
 
@@ -1901,7 +1901,7 @@  discard block
 block discarded – undo
1901 1901
         if (!empty($content)) {
1902 1902
             $html = '<span class="label '.$class.'">';
1903 1903
             $html .= $content;
1904
-            $html .='</span>';
1904
+            $html .= '</span>';
1905 1905
         }
1906 1906
 
1907 1907
         return $html;
@@ -1922,7 +1922,7 @@  discard block
 block discarded – undo
1922 1922
                     $class = 'class ="active"';
1923 1923
                 }
1924 1924
 
1925
-                if (basename($_SERVER['REQUEST_URI']) == basename($value['url']) ) {
1925
+                if (basename($_SERVER['REQUEST_URI']) == basename($value['url'])) {
1926 1926
                     $class = 'class ="active"';
1927 1927
                 }
1928 1928
                 $html .= "<li $class >";
@@ -2176,7 +2176,7 @@  discard block
 block discarded – undo
2176 2176
         }
2177 2177
         $label = $nextValue + $localCounter + 1;
2178 2178
         if ($isMedia) {
2179
-            $label = ($fixedValue + 1) .' '.chr(97 + $localCounter);
2179
+            $label = ($fixedValue + 1).' '.chr(97 + $localCounter);
2180 2180
             $link_to_show = $link.$fixedValue.'#questionanchor'.$itemId;
2181 2181
         }
2182 2182
         $link = Display::url($label.' ', $link_to_show, $linkAttributes);
@@ -2288,7 +2288,7 @@  discard block
 block discarded – undo
2288 2288
      */
2289 2289
     public static function getVCardUserLink($userId)
2290 2290
     {
2291
-        $vCardUrl = api_get_path(WEB_PATH).'main/social/vcard_export.php?userId='.intval($userId);;
2291
+        $vCardUrl = api_get_path(WEB_PATH).'main/social/vcard_export.php?userId='.intval($userId); ;
2292 2292
 
2293 2293
         return $vCardUrl;
2294 2294
     }
@@ -2306,7 +2306,7 @@  discard block
 block discarded – undo
2306 2306
     {
2307 2307
         $title = !empty($title) ? '<div class="panel-heading"><h3 class="panel-title">'.$title.'</h3>'.$extra.'</div>' : '';
2308 2308
         $footer = !empty($footer) ? '<div class="panel-footer ">'.$footer.'</div>' : '';
2309
-        $styles = ['primary','success','info','warning','danger'];
2309
+        $styles = ['primary', 'success', 'info', 'warning', 'danger'];
2310 2310
         $style = !in_array($style, $styles) ? 'default' : $style;
2311 2311
 
2312 2312
         return '
@@ -2351,7 +2351,7 @@  discard block
 block discarded – undo
2351 2351
         $attributes['class'] = isset($attributes['class']) ? "$buttonClass {$attributes['class']}" : $buttonClass;
2352 2352
 
2353 2353
         if (!$includeText) {
2354
-            $text = '<span class="sr-only">' . $text . '</span>';
2354
+            $text = '<span class="sr-only">'.$text.'</span>';
2355 2355
         }
2356 2356
 
2357 2357
         return self::url("$icon $text", $url, $attributes);
@@ -2366,16 +2366,16 @@  discard block
 block discarded – undo
2366 2366
      */
2367 2367
     public static function toolbarAction($id, $content = array(), $col = 2, $right = true)
2368 2368
     {
2369
-        $columns = 12/$col;
2369
+        $columns = 12 / $col;
2370 2370
         $html = '';
2371
-        $html .= '<div id="' . $id . '" class="actions">';
2371
+        $html .= '<div id="'.$id.'" class="actions">';
2372 2372
         $html .= '<div class="row">';
2373 2373
         if ($col > 4) {
2374 2374
             $html = '<div class="alert alert-warning" role="alert">Action toolbar design does not work when exceeding four columns - check Display::toolbarAction()</div>';
2375 2375
         } else {
2376
-            for ( $i = 0; $i < $col; $i++ ) {
2377
-                $html .= '<div class="col-md-' . $columns . '">';
2378
-                if ( $col == 2 && $i == 1 ) {
2376
+            for ($i = 0; $i < $col; $i++) {
2377
+                $html .= '<div class="col-md-'.$columns.'">';
2378
+                if ($col == 2 && $i == 1) {
2379 2379
                     if ($right === true) {
2380 2380
                         $html .= '<div class="pull-right">';
2381 2381
                         $html .= (isset($content[$i]) ? $content[$i] : '');
@@ -2490,9 +2490,9 @@  discard block
 block discarded – undo
2490 2490
             $params['class'] = 'panel panel-default';
2491 2491
             $html = null;
2492 2492
             if (!empty($title)) {
2493
-                $html .= '<div class="panel-heading">'.$title.'</div>' . PHP_EOL;
2493
+                $html .= '<div class="panel-heading">'.$title.'</div>'.PHP_EOL;
2494 2494
             }
2495
-            $html.= '<div class="panel-body">'.$content.'</div>' . PHP_EOL;
2495
+            $html .= '<div class="panel-body">'.$content.'</div>'.PHP_EOL;
2496 2496
             $html = Display::div($html, $params);
2497 2497
         }
2498 2498
         return $html;
Please login to merge, or discard this patch.
main/inc/lib/events.lib.php 3 patches
Spacing   +10 added lines, -12 removed lines patch added patch discarded remove patch
@@ -78,9 +78,7 @@  discard block
 block discarded – undo
78 78
         Database::query($sql);
79 79
 
80 80
         // Auto subscribe
81
-        $user_status = $userInfo['status']  == SESSIONADMIN ? 'sessionadmin' :
82
-            $userInfo['status'] == COURSEMANAGER ? 'teacher' :
83
-                $userInfo['status'] == DRH ? 'DRH' : 'student';
81
+        $user_status = $userInfo['status'] == SESSIONADMIN ? 'sessionadmin' : $userInfo['status'] == COURSEMANAGER ? 'teacher' : $userInfo['status'] == DRH ? 'DRH' : 'student';
84 82
         $autoSubscribe = api_get_setting($user_status.'_autosubscribe');
85 83
         if ($autoSubscribe) {
86 84
             $autoSubscribe = explode('|', $autoSubscribe);
@@ -334,7 +332,7 @@  discard block
 block discarded – undo
334 332
         global $debug;
335 333
 
336 334
         if ($debug) error_log('Called to update_event_exercice');
337
-        if ($debug) error_log('duration:' . $duration);
335
+        if ($debug) error_log('duration:'.$duration);
338 336
 
339 337
         if ($exeid != '') {
340 338
             /*
@@ -382,7 +380,7 @@  discard block
 block discarded – undo
382 380
         		   status = '".$status."',
383 381
         		   questions_to_check = '".$remind_list."',
384 382
         		   data_tracking = '".implode(',', $question_list)."',
385
-                   user_ip = '" . Database::escape_string(api_get_real_ip()) . "'
383
+                   user_ip = '" . Database::escape_string(api_get_real_ip())."'
386 384
         		 WHERE exe_id = '".Database::escape_string($exeid)."'";
387 385
             $res = Database::query($sql);
388 386
 
@@ -1036,15 +1034,15 @@  discard block
 block discarded – undo
1036 1034
 
1037 1035
         if (!empty($exe_list) && is_array($exe_list) && count($exe_list) > 0) {
1038 1036
             $sql = "DELETE FROM $track_e_exercises
1039
-                WHERE exe_id IN (" . implode(',', $exe_list) . ")";
1037
+                WHERE exe_id IN (".implode(',', $exe_list).")";
1040 1038
             Database::query($sql);
1041 1039
 
1042 1040
             $sql = "DELETE FROM $track_attempts
1043
-                WHERE exe_id IN (" . implode(',', $exe_list) . ")";
1041
+                WHERE exe_id IN (".implode(',', $exe_list).")";
1044 1042
             Database::query($sql);
1045 1043
 
1046 1044
             $sql = "DELETE FROM $recording_table
1047
-                WHERE exe_id IN (" . implode(',', $exe_list) . ")";
1045
+                WHERE exe_id IN (".implode(',', $exe_list).")";
1048 1046
             Database::query($sql);
1049 1047
         }
1050 1048
 
@@ -1086,7 +1084,7 @@  discard block
 block discarded – undo
1086 1084
             Event::addEvent(
1087 1085
                 LOG_EXERCISE_RESULT_DELETE,
1088 1086
                 LOG_EXERCISE_AND_USER_ID,
1089
-                $exercise_id . '-' . $user_id,
1087
+                $exercise_id.'-'.$user_id,
1090 1088
                 null,
1091 1089
                 null,
1092 1090
                 $course_id,
@@ -1458,7 +1456,7 @@  discard block
 block discarded – undo
1458 1456
         $res = Database::query($sql);
1459 1457
         $list = array();
1460 1458
         while ($row = Database::fetch_array($res, 'ASSOC')) {
1461
-            $list[$row['exe_id']] = $row;  /*
1459
+            $list[$row['exe_id']] = $row; /*
1462 1460
               $sql = "SELECT * FROM $table_track_attempt WHERE exe_id = {$row['exe_id']}";
1463 1461
               $res_question = Database::query($sql);
1464 1462
               while($row_q = Database::fetch_array($res_question,'ASSOC')) {
@@ -1684,7 +1682,7 @@  discard block
 block discarded – undo
1684 1682
         Event::addEvent(
1685 1683
             LOG_QUESTION_RESULT_DELETE,
1686 1684
             LOG_EXERCISE_ATTEMPT_QUESTION_ID,
1687
-            $exe_id . '-' . $question_id,
1685
+            $exe_id.'-'.$question_id,
1688 1686
             null,
1689 1687
             null,
1690 1688
             $courseId,
@@ -1720,7 +1718,7 @@  discard block
 block discarded – undo
1720 1718
         Event::addEvent(
1721 1719
             LOG_QUESTION_RESULT_DELETE,
1722 1720
             LOG_EXERCISE_ATTEMPT_QUESTION_ID,
1723
-            $exe_id . '-' . $question_id,
1721
+            $exe_id.'-'.$question_id,
1724 1722
             null,
1725 1723
             null,
1726 1724
             $courseId,
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -333,8 +333,12 @@  discard block
 block discarded – undo
333 333
     ) {
334 334
         global $debug;
335 335
 
336
-        if ($debug) error_log('Called to update_event_exercice');
337
-        if ($debug) error_log('duration:' . $duration);
336
+        if ($debug) {
337
+            error_log('Called to update_event_exercice');
338
+        }
339
+        if ($debug) {
340
+            error_log('duration:' . $duration);
341
+        }
338 342
 
339 343
         if ($exeid != '') {
340 344
             /*
@@ -386,8 +390,12 @@  discard block
 block discarded – undo
386 390
         		 WHERE exe_id = '".Database::escape_string($exeid)."'";
387 391
             $res = Database::query($sql);
388 392
 
389
-            if ($debug) error_log('update_event_exercice called');
390
-            if ($debug) error_log("$sql");
393
+            if ($debug) {
394
+                error_log('update_event_exercice called');
395
+            }
396
+            if ($debug) {
397
+                error_log("$sql");
398
+            }
391 399
 
392 400
             //Deleting control time session track
393 401
             //ExerciseLib::exercise_time_control_delete($exo_id);
Please login to merge, or discard this patch.
Doc Comments   +20 added lines, -10 removed lines patch added patch discarded remove patch
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
     }
240 240
 
241 241
     /**
242
-     * @param doc_id id of document (id in mainDb.document table)
242
+     * @param doc_id string of document (id in mainDb.document table)
243 243
      * @author Sebastien Piraux <[email protected]>
244 244
      * @desc Record information for upload event
245 245
      * used in the works tool to record informations when
@@ -313,6 +313,9 @@  discard block
 block discarded – undo
313 313
      * @param   int     session_id
314 314
      * @param   int     learnpath_id (id of the learnpath)
315 315
      * @param   int     learnpath_item_id (id of the learnpath_item)
316
+     * @param integer $score
317
+     * @param integer $weighting
318
+     * @param integer $session_id
316 319
      *
317 320
      * @author Sebastien Piraux <[email protected]>
318 321
      * @author Julio Montoya Armas <[email protected]> Reworked 2010
@@ -414,7 +417,9 @@  discard block
 block discarded – undo
414 417
      * @param	integer	Session ID (from the session table). Default value of null means "get from context".
415 418
      * @param	integer	Learnpath ID (from c_lp table). Default value of null means "get from context".
416 419
      * @param	integer	Learnpath item ID (from the c_lp_item table). Default value of null means "get from context".
417
-     * @return	boolean	Result of the insert query
420
+     * @param integer $exe_id
421
+     * @param integer $position
422
+     * @return	false|string	Result of the insert query
418 423
      */
419 424
     public static function saveQuestionAttempt(
420 425
         $score,
@@ -581,6 +586,7 @@  discard block
 block discarded – undo
581 586
      * @param	int		Whether this answer is correct (1) or not (0)
582 587
      * @param	string	Coordinates of this point (e.g. 123;324)
583 588
      * @param	bool update results?
589
+     * @param integer $exe_id
584 590
      * @return	boolean	Result of the insert query
585 591
      * @uses Course code and user_id from global scope $_cid and $_user
586 592
      */
@@ -720,7 +726,6 @@  discard block
 block discarded – undo
720 726
     /**
721 727
      * Get every email stored in the database
722 728
      *
723
-     * @param int $etId
724 729
      * @return type
725 730
      * @assert () !== false
726 731
      */
@@ -788,11 +793,11 @@  discard block
 block discarded – undo
788 793
     /**
789 794
      * Save the new message for one event and for one language
790 795
      *
791
-     * @param string $eventName
796
+     * @param string $event_name
792 797
      * @param array $users
793 798
      * @param string $message
794 799
      * @param string $subject
795
-     * @param string $eventMessageLanguage
800
+     * @param string $event_message_language
796 801
      * @param int $activated
797 802
      */
798 803
     public static function save_event_type_message($event_name, $users, $message, $subject, $event_message_language, $activated)
@@ -926,10 +931,10 @@  discard block
 block discarded – undo
926 931
     }
927 932
 
928 933
     /**
929
-     * @param $user_id
934
+     * @param integer $user_id
930 935
      * @param $exerciseId
931
-     * @param $lp_id
932
-     * @param $lp_item_id
936
+     * @param integer $lp_id
937
+     * @param integer $lp_item_id
933 938
      * @return int
934 939
      */
935 940
     public static function get_attempt_count_not_finished($user_id, $exerciseId, $lp_id, $lp_item_id)
@@ -1106,6 +1111,7 @@  discard block
 block discarded – undo
1106 1111
      * @param   int     exercise id
1107 1112
      * @param   int $courseId
1108 1113
      * @param   int     session id
1114
+     * @param integer $user_id
1109 1115
      * @return  array   with the results
1110 1116
      *
1111 1117
      */
@@ -1201,6 +1207,7 @@  discard block
 block discarded – undo
1201 1207
      * @param   int     exercise id
1202 1208
      * @param   int  $courseId
1203 1209
      * @param   int     session id
1210
+     * @param integer $user_id
1204 1211
      * @return  array   with the results
1205 1212
      *
1206 1213
      */
@@ -1241,6 +1248,7 @@  discard block
 block discarded – undo
1241 1248
      * @param   int     exercise id
1242 1249
      * @param   string  course code
1243 1250
      * @param   int     session id
1251
+     * @param integer $exe_id
1244 1252
      * @return  array   with the results
1245 1253
      *
1246 1254
      */
@@ -1290,6 +1298,8 @@  discard block
 block discarded – undo
1290 1298
      * @param   int     lp id
1291 1299
      * @param   int     lp item id
1292 1300
      * @param   string 	order asc or desc
1301
+     * @param integer $courseId
1302
+     * @param string $order
1293 1303
      * @return  array   with the results
1294 1304
      *
1295 1305
      */
@@ -1349,7 +1359,7 @@  discard block
 block discarded – undo
1349 1359
      * @param   int     exercise id
1350 1360
      * @param   int     $courseId
1351 1361
      * @param   int     session id
1352
-     * @return  array   with the results
1362
+     * @return  string   with the results
1353 1363
      *
1354 1364
      */
1355 1365
     public static function count_exercise_attempts_by_user($user_id, $exercise_id, $courseId, $session_id = 0)
@@ -1525,7 +1535,7 @@  discard block
 block discarded – undo
1525 1535
      * @param   int     exercise id
1526 1536
      * @param   int   course id
1527 1537
      * @param   int     session id
1528
-     * @return  array   with the results
1538
+     * @return  integer   with the results
1529 1539
      *
1530 1540
      */
1531 1541
     public static function get_count_exercises_attempted_by_course($courseId, $session_id = 0)
Please login to merge, or discard this patch.