Test Setup Failed
Push — master ( a0e228...8ccadc )
by Angel Fernando Quiroz
158:51 queued 93:10
created
main/inc/lib/browser/Browser.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 
159 159
     /**
160 160
      * Set the name of the browser
161
-     * @param $browser string The name of the Browser
161
+     * @param string $browser string The name of the Browser
162 162
      */
163 163
     public function setBrowser($browser)
164 164
     {
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 
267 267
     /**
268 268
      * Set the browser to be from AOL
269
-     * @param $isAol
269
+     * @param boolean $isAol
270 270
      */
271 271
     public function setAol($isAol)
272 272
     {
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
     }
257 257
 
258 258
     /**
259
-    * Is the browser from facebook?
260
-    * @return boolean True if the browser is from facebook otherwise false
261
-    */
259
+     * Is the browser from facebook?
260
+     * @return boolean True if the browser is from facebook otherwise false
261
+     */
262 262
     public function isFacebook() 
263 263
     { 
264 264
         return $this->_is_facebook;
@@ -591,12 +591,12 @@  discard block
 block discarded – undo
591 591
             }
592 592
             return true;
593 593
         } // Test for versions > IE 10
594
-		else if(stripos($this->_agent, 'trident') !== false) {
595
-			$this->setBrowser(self::BROWSER_IE);
596
-			$result = explode('rv:', $this->_agent);
597
-			$this->setVersion(preg_replace('/[^0-9.]+/', '', $result[1]));
598
-			$this->_agent = str_replace(array("Mozilla", "Gecko"), "MSIE", $this->_agent);
599
-		} // Test for Pocket IE
594
+        else if(stripos($this->_agent, 'trident') !== false) {
595
+            $this->setBrowser(self::BROWSER_IE);
596
+            $result = explode('rv:', $this->_agent);
597
+            $this->setVersion(preg_replace('/[^0-9.]+/', '', $result[1]));
598
+            $this->_agent = str_replace(array("Mozilla", "Gecko"), "MSIE", $this->_agent);
599
+        } // Test for Pocket IE
600 600
         else if (stripos($this->_agent, 'mspie') !== false || stripos($this->_agent, 'pocket') !== false) {
601 601
             $aresult = explode(' ', stristr($this->_agent, 'mspie'));
602 602
             $this->setPlatform(self::PLATFORM_WINDOWS_CE);
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -345,9 +345,9 @@  discard block
 block discarded – undo
345 345
      */
346 346
     public function __toString()
347 347
     {
348
-        return "<strong>Browser Name:</strong> {$this->getBrowser()}<br/>\n" .
349
-        "<strong>Browser Version:</strong> {$this->getVersion()}<br/>\n" .
350
-        "<strong>Browser User Agent String:</strong> {$this->getUserAgent()}<br/>\n" .
348
+        return "<strong>Browser Name:</strong> {$this->getBrowser()}<br/>\n".
349
+        "<strong>Browser Version:</strong> {$this->getVersion()}<br/>\n".
350
+        "<strong>Browser User Agent String:</strong> {$this->getUserAgent()}<br/>\n".
351 351
         "<strong>Platform:</strong> {$this->getPlatform()}<br/>";
352 352
     }
353 353
 
@@ -585,13 +585,13 @@  discard block
 block discarded – undo
585 585
             $aresult = explode(' ', stristr(str_replace(';', '; ', $this->_agent), 'msie'));
586 586
             $this->setBrowser(self::BROWSER_IE);
587 587
             $this->setVersion(str_replace(array('(', ')', ';'), '', $aresult[1]));
588
-            if(stripos($this->_agent, 'IEMobile') !== false) {
588
+            if (stripos($this->_agent, 'IEMobile') !== false) {
589 589
                 $this->setBrowser(self::BROWSER_POCKET_IE);
590 590
                 $this->setMobile(true);
591 591
             }
592 592
             return true;
593 593
         } // Test for versions > IE 10
594
-		else if(stripos($this->_agent, 'trident') !== false) {
594
+		else if (stripos($this->_agent, 'trident') !== false) {
595 595
 			$this->setBrowser(self::BROWSER_IE);
596 596
 			$result = explode('rv:', $this->_agent);
597 597
 			$this->setVersion(preg_replace('/[^0-9.]+/', '', $result[1]));
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
      */
1013 1013
     protected function checkFacebookExternalHit()
1014 1014
     {
1015
-        if(stristr($this->_agent,'FacebookExternalHit'))
1015
+        if (stristr($this->_agent, 'FacebookExternalHit'))
1016 1016
         {
1017 1017
             $this->setRobot(true);
1018 1018
             $this->setFacebook(true);
@@ -1027,7 +1027,7 @@  discard block
 block discarded – undo
1027 1027
      */
1028 1028
     protected function checkForFacebookIos()
1029 1029
     {
1030
-        if(stristr($this->_agent,'FBIOS'))
1030
+        if (stristr($this->_agent, 'FBIOS'))
1031 1031
         {
1032 1032
             $this->setFacebook(true);
1033 1033
             return true;
@@ -1041,10 +1041,10 @@  discard block
 block discarded – undo
1041 1041
      */
1042 1042
     protected function getSafariVersionOnIos()
1043 1043
     {
1044
-        $aresult = explode('/',stristr($this->_agent,'Version'));
1045
-        if( isset($aresult[1]) )
1044
+        $aresult = explode('/', stristr($this->_agent, 'Version'));
1045
+        if (isset($aresult[1]))
1046 1046
         {
1047
-            $aversion = explode(' ',$aresult[1]);
1047
+            $aversion = explode(' ', $aresult[1]);
1048 1048
             $this->setVersion($aversion[0]);
1049 1049
             return true;
1050 1050
         }
@@ -1057,10 +1057,10 @@  discard block
 block discarded – undo
1057 1057
      */
1058 1058
     protected function getChromeVersionOnIos()
1059 1059
     {
1060
-        $aresult = explode('/',stristr($this->_agent,'CriOS'));
1061
-        if( isset($aresult[1]) )
1060
+        $aresult = explode('/', stristr($this->_agent, 'CriOS'));
1061
+        if (isset($aresult[1]))
1062 1062
         {
1063
-            $aversion = explode(' ',$aresult[1]);
1063
+            $aversion = explode(' ', $aresult[1]);
1064 1064
             $this->setVersion($aversion[0]);
1065 1065
             $this->setBrowser(self::BROWSER_CHROME);
1066 1066
             return true;
@@ -1073,7 +1073,7 @@  discard block
 block discarded – undo
1073 1073
      * @return boolean True if the browser is iPhone otherwise false
1074 1074
      */
1075 1075
     protected function checkBrowseriPhone() {
1076
-        if( stripos($this->_agent,'iPhone') !== false ) {
1076
+        if (stripos($this->_agent, 'iPhone') !== false) {
1077 1077
             $this->setVersion(self::VERSION_UNKNOWN);
1078 1078
             $this->setBrowser(self::BROWSER_IPHONE);
1079 1079
             $this->getSafariVersionOnIos();
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
      * @return boolean True if the browser is iPad otherwise false
1091 1091
      */
1092 1092
     protected function checkBrowseriPad() {
1093
-        if( stripos($this->_agent,'iPad') !== false ) {
1093
+        if (stripos($this->_agent, 'iPad') !== false) {
1094 1094
             $this->setVersion(self::VERSION_UNKNOWN);
1095 1095
             $this->setBrowser(self::BROWSER_IPAD);
1096 1096
             $this->getSafariVersionOnIos();
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
      * @return boolean True if the browser is iPod otherwise false
1108 1108
      */
1109 1109
     protected function checkBrowseriPod() {
1110
-        if( stripos($this->_agent,'iPod') !== false ) {
1110
+        if (stripos($this->_agent, 'iPod') !== false) {
1111 1111
             $this->setVersion(self::VERSION_UNKNOWN);
1112 1112
             $this->setBrowser(self::BROWSER_IPOD);
1113 1113
             $this->getSafariVersionOnIos();
Please login to merge, or discard this patch.
Braces   +16 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1152,68 +1152,52 @@
 block discarded – undo
1152 1152
         if (stripos($this->_agent, 'windows') !== false)
1153 1153
         {
1154 1154
             $this->_platform = self::PLATFORM_WINDOWS;
1155
-        }
1156
-        else if (stripos($this->_agent, 'iPad') !== false)
1155
+        } else if (stripos($this->_agent, 'iPad') !== false)
1157 1156
         {
1158 1157
             $this->_platform = self::PLATFORM_IPAD;
1159
-        }
1160
-        else if (stripos($this->_agent, 'iPod') !== false)
1158
+        } else if (stripos($this->_agent, 'iPod') !== false)
1161 1159
         {
1162 1160
             $this->_platform = self::PLATFORM_IPOD;
1163
-        }
1164
-        else if (stripos($this->_agent, 'iPhone') !== false)
1161
+        } else if (stripos($this->_agent, 'iPhone') !== false)
1165 1162
         {
1166 1163
             $this->_platform = self::PLATFORM_IPHONE;
1167
-        }
1168
-        elseif (stripos($this->_agent, 'mac') !== false)
1164
+        } elseif (stripos($this->_agent, 'mac') !== false)
1169 1165
         {
1170 1166
             $this->_platform = self::PLATFORM_APPLE;
1171
-        }
1172
-        elseif (stripos($this->_agent, 'android') !== false)
1167
+        } elseif (stripos($this->_agent, 'android') !== false)
1173 1168
         {
1174 1169
             $this->_platform = self::PLATFORM_ANDROID;
1175
-        }
1176
-        elseif (stripos($this->_agent, 'linux') !== false)
1170
+        } elseif (stripos($this->_agent, 'linux') !== false)
1177 1171
         {
1178 1172
             $this->_platform = self::PLATFORM_LINUX;
1179
-        }
1180
-        else if (stripos($this->_agent, 'Nokia') !== false)
1173
+        } else if (stripos($this->_agent, 'Nokia') !== false)
1181 1174
         {
1182 1175
             $this->_platform = self::PLATFORM_NOKIA;
1183
-        }
1184
-        else if (stripos($this->_agent, 'BlackBerry') !== false)
1176
+        } else if (stripos($this->_agent, 'BlackBerry') !== false)
1185 1177
         {
1186 1178
             $this->_platform = self::PLATFORM_BLACKBERRY;
1187
-        }
1188
-        elseif (stripos($this->_agent, 'FreeBSD') !== false)
1179
+        } elseif (stripos($this->_agent, 'FreeBSD') !== false)
1189 1180
         {
1190 1181
             $this->_platform = self::PLATFORM_FREEBSD;
1191
-        }
1192
-        elseif (stripos($this->_agent, 'OpenBSD') !== false)
1182
+        } elseif (stripos($this->_agent, 'OpenBSD') !== false)
1193 1183
         {
1194 1184
             $this->_platform = self::PLATFORM_OPENBSD;
1195
-        }
1196
-        elseif (stripos($this->_agent, 'NetBSD') !== false)
1185
+        } elseif (stripos($this->_agent, 'NetBSD') !== false)
1197 1186
         {
1198 1187
             $this->_platform = self::PLATFORM_NETBSD;
1199
-        }
1200
-        elseif (stripos($this->_agent, 'OpenSolaris') !== false)
1188
+        } elseif (stripos($this->_agent, 'OpenSolaris') !== false)
1201 1189
         {
1202 1190
             $this->_platform = self::PLATFORM_OPENSOLARIS;
1203
-        }
1204
-        elseif (stripos($this->_agent, 'SunOS') !== false)
1191
+        } elseif (stripos($this->_agent, 'SunOS') !== false)
1205 1192
         {
1206 1193
             $this->_platform = self::PLATFORM_SUNOS;
1207
-        }
1208
-        elseif (stripos($this->_agent, 'OS\/2') !== false)
1194
+        } elseif (stripos($this->_agent, 'OS\/2') !== false)
1209 1195
         {
1210 1196
             $this->_platform = self::PLATFORM_OS2;
1211
-        }
1212
-        elseif (stripos($this->_agent, 'BeOS') !== false)
1197
+        } elseif (stripos($this->_agent, 'BeOS') !== false)
1213 1198
         {
1214 1199
             $this->_platform = self::PLATFORM_BEOS;
1215
-        }
1216
-        elseif (stripos($this->_agent, 'win') !== false)
1200
+        } elseif (stripos($this->_agent, 'win') !== false)
1217 1201
         {
1218 1202
             $this->_platform = self::PLATFORM_WINDOWS;
1219 1203
         }
Please login to merge, or discard this patch.
main/inc/lib/chat.lib.php 3 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -41,6 +41,7 @@  discard block
 block discarded – undo
41 41
     /**
42 42
     * Set user chat status
43 43
     * @param int 0 if disconnected, 1 if connected
44
+    * @param integer $status
44 45
      *
45 46
     * @return void
46 47
     */
@@ -164,6 +165,7 @@  discard block
 block discarded – undo
164 165
     /**
165 166
      * Saves into session the fact that a chat window exists with the given user
166 167
      * @param int The ID of the user with whom the current user is chatting
168
+     * @param integer $user_id
167 169
      * @return void
168 170
      */
169 171
     public function save_window($user_id)
Please login to merge, or discard this patch.
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   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
     }
45 45
 
46 46
     /**
47
-    * Set user chat status
48
-    * @param int 0 if disconnected, 1 if connected
47
+     * Set user chat status
48
+     * @param int 0 if disconnected, 1 if connected
49 49
      *
50
-    * @return void
51
-    */
50
+     * @return void
51
+     */
52 52
     public function setUserStatus($status)
53 53
     {
54 54
         UserManager::update_extra_field_value(api_get_user_id(), 'user_chat_status', $status);
@@ -149,10 +149,10 @@  discard block
 block discarded – undo
149 149
     }
150 150
 
151 151
     /**
152
-    * Returns an array of messages inside a chat session with a specific user
153
-    * @param int The ID of the user with whom the current user is chatting
154
-    * @return array Messages list
155
-    */
152
+     * Returns an array of messages inside a chat session with a specific user
153
+     * @param int The ID of the user with whom the current user is chatting
154
+     * @return array Messages list
155
+     */
156 156
     public function box_session($user_id)
157 157
     {
158 158
         $items = array();
Please login to merge, or discard this patch.
main/inc/lib/course_description.lib.php 2 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
      * Get all data by description and session id,
96 96
      * first you must set session_id property with the object CourseDescription
97 97
      * @param    int  $description_type Description type
98
-     * @param   string $course_code Course code (optional)
98
+     * @param   string $courseId Course code (optional)
99 99
      * @param    int $session_id Session id (optional)
100 100
      * @return array    List of fields from the descriptions found of the given type
101 101
      */
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 
360 360
     /**
361 361
      * Get description titles by default
362
-     * @return array
362
+     * @return string[]
363 363
      */
364 364
     public function get_default_description_title()
365 365
     {
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
 
379 379
     /**
380 380
      * Get description titles editable by default
381
-     * @return array
381
+     * @return boolean[]
382 382
      */
383 383
     public function get_default_description_title_editable()
384 384
     {
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 
398 398
     /**
399 399
      * Get description icons by default
400
-     * @return array
400
+     * @return string[]
401 401
      */
402 402
     public function get_default_description_icon()
403 403
     {
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 
418 418
     /**
419 419
      * Get questions by default for help
420
-     * @return array
420
+     * @return string[]
421 421
      */
422 422
     public function get_default_question()
423 423
     {
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 
437 437
     /**
438 438
      * Get informations by default for help
439
-     * @return array
439
+     * @return string[]
440 440
      */
441 441
     public function get_default_information()
442 442
     {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 
177 177
         $sql = "SELECT MAX(description_type) as MAX
178 178
                 FROM $tbl_course_description
179
-		        WHERE c_id = $course_id AND session_id='" . $this->session_id . "'";
179
+		        WHERE c_id = $course_id AND session_id='".$this->session_id."'";
180 180
         $rs = Database::query($sql);
181 181
         $max = Database::fetch_array($rs);
182 182
         $description_type = $max['MAX'] + 1;
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
             'session_id' => $this->session_id
212 212
         ];
213 213
 
214
-        $last_id  = Database::insert($table, $params);
214
+        $last_id = Database::insert($table, $params);
215 215
 
216 216
         if ($last_id > 0) {
217 217
             $sql = "UPDATE $table SET id = iid WHERE iid = $last_id";
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
         $sql = "DELETE FROM $tbl_course_description
320 320
 			 	WHERE
321 321
 			 	    c_id = $course_id AND
322
-			 	    id = '" . intval($this->id) . "' AND
323
-			 	    session_id = '" . intval($this->session_id) . "'";
322
+			 	    id = '".intval($this->id)."' AND
323
+			 	    session_id = '" . intval($this->session_id)."'";
324 324
         $result = Database::query($sql);
325 325
         $affected_rows = Database::affected_rows($result);
326 326
         if ($this->id > 0) {
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
         $course_id = api_get_course_int_id();
350 350
 
351 351
         $sql = "SELECT id FROM $tbl_course_description
352
-		        WHERE c_id = $course_id AND description_type = '" . intval($description_type) . "'";
352
+		        WHERE c_id = $course_id AND description_type = '".intval($description_type)."'";
353 353
         $rs = Database::query($sql);
354 354
         $row = Database::fetch_array($rs);
355 355
         $description_id = $row['id'];
Please login to merge, or discard this patch.
main/inc/lib/dashboard.lib.php 4 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -493,6 +493,7 @@
 block discarded – undo
493 493
 	 * This function update extra user blocks data after closing a dashboard block
494 494
 	 * @param int 		User id
495 495
 	 * @param string	plugin path
496
+	 * @param integer $user_id
496 497
 	 * @return bool
497 498
 	 */
498 499
 	public static function close_user_block($user_id, $path)
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -380,7 +380,9 @@
 block discarded – undo
380 380
 					// check if user is allowed to see the block
381 381
 					if (method_exists($obj_block, 'is_block_visible_for_user')) {
382 382
 						$is_block_visible_for_user = $obj_block->is_block_visible_for_user($user_id);
383
-						if (!$is_block_visible_for_user) continue;
383
+						if (!$is_block_visible_for_user) {
384
+						    continue;
385
+						}
384 386
 					}
385 387
 
386 388
 					echo '<tr>';
Please login to merge, or discard this patch.
Indentation   +255 added lines, -255 removed lines patch added patch discarded remove patch
@@ -249,286 +249,286 @@
 block discarded – undo
249 249
         return $affected_rows;
250 250
     }
251 251
 
252
-	/**
253
-	 * Get all plugins path inside dashboard directory
254
-	 * @return array name plugins directories
255
-	 */
256
-	public static function getPossibleDashboardPluginsPath()
252
+    /**
253
+     * Get all plugins path inside dashboard directory
254
+     * @return array name plugins directories
255
+     */
256
+    public static function getPossibleDashboardPluginsPath()
257 257
     {
258
-		// get all plugins path inside plugin directory
259
-		/* We scan the plugin directory. Each folder is a potential plugin. */
260
-		$possiblePlugins = array();
261
-		$dashboard_pluginpath = api_get_path(SYS_PLUGIN_PATH).'dashboard/';
262
-		$handle = @opendir($dashboard_pluginpath);
263
-		while (false !== ($file = readdir($handle))) {
264
-			if ($file <> '.' AND $file <> '..' AND is_dir($dashboard_pluginpath.$file)) {
265
-				$possiblePlugins[] = $file;
266
-			}
267
-		}
268
-		@closedir($handle);
269
-
270
-		return $possiblePlugins;
271
-	}
272
-
273
-	/**
274
-	 * Get all blocks data without plugin directory
275
-	 * @return array Block data
276
-	 */
277
-	public static function get_block_data_without_plugin()
258
+        // get all plugins path inside plugin directory
259
+        /* We scan the plugin directory. Each folder is a potential plugin. */
260
+        $possiblePlugins = array();
261
+        $dashboard_pluginpath = api_get_path(SYS_PLUGIN_PATH).'dashboard/';
262
+        $handle = @opendir($dashboard_pluginpath);
263
+        while (false !== ($file = readdir($handle))) {
264
+            if ($file <> '.' AND $file <> '..' AND is_dir($dashboard_pluginpath.$file)) {
265
+                $possiblePlugins[] = $file;
266
+            }
267
+        }
268
+        @closedir($handle);
269
+
270
+        return $possiblePlugins;
271
+    }
272
+
273
+    /**
274
+     * Get all blocks data without plugin directory
275
+     * @return array Block data
276
+     */
277
+    public static function get_block_data_without_plugin()
278 278
     {
279
-		$tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK);
280
-		$possibleplugins = self::getPossibleDashboardPluginsPath();
281
-
282
-		// We check if plugin exists inside directory for updating active field
283
-		$sql = "SELECT * FROM $tbl_block";
284
-		$rs = Database::query($sql);
285
-		if (Database::num_rows($rs) > 0){
286
-			while ($row = Database::fetch_array($rs)) {
287
-				$path = $row['path'];
288
-				if (!in_array($row['path'],$possibleplugins)) {
289
-					$active = 0;
290
-				} else {
291
-					$active = 1;
292
-				}
293
-				// update active
294
-				$upd = "UPDATE $tbl_block SET active = '$active'
279
+        $tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK);
280
+        $possibleplugins = self::getPossibleDashboardPluginsPath();
281
+
282
+        // We check if plugin exists inside directory for updating active field
283
+        $sql = "SELECT * FROM $tbl_block";
284
+        $rs = Database::query($sql);
285
+        if (Database::num_rows($rs) > 0){
286
+            while ($row = Database::fetch_array($rs)) {
287
+                $path = $row['path'];
288
+                if (!in_array($row['path'],$possibleplugins)) {
289
+                    $active = 0;
290
+                } else {
291
+                    $active = 1;
292
+                }
293
+                // update active
294
+                $upd = "UPDATE $tbl_block SET active = '$active'
295 295
 				        WHERE path = '".$row['path']."'";
296
-				Database::query($upd);
297
-			}
298
-		}
299
-
300
-		// get disabled block data
301
-		$block_data = array();
302
-		$sql = "SELECT * FROM $tbl_block WHERE active = 0";
303
-		$rs_block = Database::query($sql);
304
-		if (Database::num_rows($rs_block) > 0) {
305
-			while ($row_block = Database::fetch_array($rs_block)) {
306
-				$block_data[] = $row_block;
307
-			}
308
-		}
309
-
310
-		return $block_data;
311
-
312
-	}
313
-
314
-	/**
315
-	 * get data about enabled dashboard block (stored insise block table)
316
-	 * @param  string	plugin path
317
-	 * @return array 	data
318
-	 */
319
-	public static function get_enabled_dashboard_blocks($path = '')
296
+                Database::query($upd);
297
+            }
298
+        }
299
+
300
+        // get disabled block data
301
+        $block_data = array();
302
+        $sql = "SELECT * FROM $tbl_block WHERE active = 0";
303
+        $rs_block = Database::query($sql);
304
+        if (Database::num_rows($rs_block) > 0) {
305
+            while ($row_block = Database::fetch_array($rs_block)) {
306
+                $block_data[] = $row_block;
307
+            }
308
+        }
309
+
310
+        return $block_data;
311
+
312
+    }
313
+
314
+    /**
315
+     * get data about enabled dashboard block (stored insise block table)
316
+     * @param  string	plugin path
317
+     * @return array 	data
318
+     */
319
+    public static function get_enabled_dashboard_blocks($path = '')
320 320
     {
321
-		$tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK);
322
-		$condition_path = '';
323
-		if (!empty($path)) {
324
-			$path = Database::escape_string($path);
325
-			$condition_path = ' AND path = "'.$path.'" ';
326
-		}
327
-
328
-		$sql = "SELECT * FROM $tbl_block WHERE active = 1 $condition_path ";
329
-		$rs  = Database::query($sql);
330
-		$block_data = array();
331
-		if (Database::num_rows($rs) > 0) {
332
-			while ($row = Database::fetch_array($rs)) {
333
-				$block_data[$row['path']] = $row;
334
-			}
335
-		}
336
-		return $block_data;
337
-	}
338
-
339
-	/**
340
-	 * display user dashboard list
341
-	 * @param int  User id
342
-	 * @return void
343
-	 */
344
-	public static function display_user_dashboard_list($user_id)
321
+        $tbl_block = Database :: get_main_table(TABLE_MAIN_BLOCK);
322
+        $condition_path = '';
323
+        if (!empty($path)) {
324
+            $path = Database::escape_string($path);
325
+            $condition_path = ' AND path = "'.$path.'" ';
326
+        }
327
+
328
+        $sql = "SELECT * FROM $tbl_block WHERE active = 1 $condition_path ";
329
+        $rs  = Database::query($sql);
330
+        $block_data = array();
331
+        if (Database::num_rows($rs) > 0) {
332
+            while ($row = Database::fetch_array($rs)) {
333
+                $block_data[$row['path']] = $row;
334
+            }
335
+        }
336
+        return $block_data;
337
+    }
338
+
339
+    /**
340
+     * display user dashboard list
341
+     * @param int  User id
342
+     * @return void
343
+     */
344
+    public static function display_user_dashboard_list($user_id)
345 345
     {
346
-		$enabled_dashboard_plugins = self::get_enabled_dashboard_blocks();
347
-		$user_block_data = self::get_user_block_data($user_id);
348
-
349
-		if (count($enabled_dashboard_plugins) > 0) {
350
-			echo '<div style="margin-top:20px">';
351
-			echo '<div><strong>'.get_lang('SelectBlockForDisplayingInsideBlocksDashboardView').'</strong></div><br />';
352
-			echo '<form name="dashboard_list" method="post" action="index.php?action=store_user_block">';
353
-			echo '<table class="data_table">';
354
-			echo '<tr>';
355
-			echo '<th width="5%">';
356
-			echo get_lang('Enabled');
357
-			echo '</th>';
358
-			echo '<th width="30%">';
359
-			echo get_lang('Name');
360
-			echo '</th>';
361
-			echo '<th width="40%">';
362
-			echo get_lang('Description');
363
-			echo '</th>';
364
-			echo '<th>';
365
-			echo get_lang('ColumnPosition');
366
-			echo '</th>';
367
-			echo '</tr>';
368
-
369
-			// We display all enabled plugins and the checkboxes
370
-			foreach ($enabled_dashboard_plugins as $block) {
371
-
372
-				$path = $block['path'];
373
-				$controller_class = $block['controller'];
374
-				$filename_controller = $path.'.class.php';
375
-				$dashboard_plugin_path = api_get_path(SYS_PLUGIN_PATH).'dashboard/'.$path.'/';
376
-				require_once $dashboard_plugin_path.$filename_controller;
377
-				if (class_exists($controller_class)) {
378
-					$obj_block = new $controller_class($user_id);
379
-
380
-					// check if user is allowed to see the block
381
-					if (method_exists($obj_block, 'is_block_visible_for_user')) {
382
-						$is_block_visible_for_user = $obj_block->is_block_visible_for_user($user_id);
383
-						if (!$is_block_visible_for_user) continue;
384
-					}
385
-
386
-					echo '<tr>';
387
-					// checkboxes
388
-					self::display_user_dashboard_list_checkboxes($user_id, $block['id']);
389
-					echo '<td>'.$block['name'].'</td>';
390
-					echo '<td>'.$block['description'].'</td>';
391
-					echo '<td>
346
+        $enabled_dashboard_plugins = self::get_enabled_dashboard_blocks();
347
+        $user_block_data = self::get_user_block_data($user_id);
348
+
349
+        if (count($enabled_dashboard_plugins) > 0) {
350
+            echo '<div style="margin-top:20px">';
351
+            echo '<div><strong>'.get_lang('SelectBlockForDisplayingInsideBlocksDashboardView').'</strong></div><br />';
352
+            echo '<form name="dashboard_list" method="post" action="index.php?action=store_user_block">';
353
+            echo '<table class="data_table">';
354
+            echo '<tr>';
355
+            echo '<th width="5%">';
356
+            echo get_lang('Enabled');
357
+            echo '</th>';
358
+            echo '<th width="30%">';
359
+            echo get_lang('Name');
360
+            echo '</th>';
361
+            echo '<th width="40%">';
362
+            echo get_lang('Description');
363
+            echo '</th>';
364
+            echo '<th>';
365
+            echo get_lang('ColumnPosition');
366
+            echo '</th>';
367
+            echo '</tr>';
368
+
369
+            // We display all enabled plugins and the checkboxes
370
+            foreach ($enabled_dashboard_plugins as $block) {
371
+
372
+                $path = $block['path'];
373
+                $controller_class = $block['controller'];
374
+                $filename_controller = $path.'.class.php';
375
+                $dashboard_plugin_path = api_get_path(SYS_PLUGIN_PATH).'dashboard/'.$path.'/';
376
+                require_once $dashboard_plugin_path.$filename_controller;
377
+                if (class_exists($controller_class)) {
378
+                    $obj_block = new $controller_class($user_id);
379
+
380
+                    // check if user is allowed to see the block
381
+                    if (method_exists($obj_block, 'is_block_visible_for_user')) {
382
+                        $is_block_visible_for_user = $obj_block->is_block_visible_for_user($user_id);
383
+                        if (!$is_block_visible_for_user) continue;
384
+                    }
385
+
386
+                    echo '<tr>';
387
+                    // checkboxes
388
+                    self::display_user_dashboard_list_checkboxes($user_id, $block['id']);
389
+                    echo '<td>'.$block['name'].'</td>';
390
+                    echo '<td>'.$block['description'].'</td>';
391
+                    echo '<td>
392 392
                             <select class="selectpicker show-tick form-control" name="columns['.$block['id'].']">
393 393
                             <option value="1" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column']==1?'selected':'').' >1</option>
394 394
                             <option value="2" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column']==2?'selected':'').' >2</option>
395 395
                             </select>
396 396
                           </td>';
397
-					echo '</tr>';
398
-				} else {
399
-					echo Display::tag('tr',  Display::tag('td', get_lang('Error').' '.$controller_class, array('colspan'=>'3')));
400
-				}
401
-			}
402
-
403
-			echo '</table>';
404
-			echo '<div class="row"><div class="col-md-12">';
405
-			echo '<button class="btn btn-default" type="submit" name="submit_dashboard_list" value="'.get_lang('EnableDashboardBlock').'"><em class="fa fa-check-square"></em> '.
397
+                    echo '</tr>';
398
+                } else {
399
+                    echo Display::tag('tr',  Display::tag('td', get_lang('Error').' '.$controller_class, array('colspan'=>'3')));
400
+                }
401
+            }
402
+
403
+            echo '</table>';
404
+            echo '<div class="row"><div class="col-md-12">';
405
+            echo '<button class="btn btn-default" type="submit" name="submit_dashboard_list" value="'.get_lang('EnableDashboardBlock').'"><em class="fa fa-check-square"></em> '.
406 406
                 get_lang('EnableDashboardBlock').'</button></form>';
407
-			echo '</div></div>';
408
-		} else {
409
-			echo '<div style="margin-top:20px">'.get_lang('ThereAreNoEnabledDashboardPlugins').'</div>';
410
-			if (api_is_platform_admin()) {
411
-				echo '<a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins">'.
407
+            echo '</div></div>';
408
+        } else {
409
+            echo '<div style="margin-top:20px">'.get_lang('ThereAreNoEnabledDashboardPlugins').'</div>';
410
+            if (api_is_platform_admin()) {
411
+                echo '<a class="btn btn-default" href="'.api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins">'.
412 412
                     get_lang('ConfigureDashboardPlugin').'</a>';
413
-			}
414
-		}
415
-	}
416
-
417
-	/**
418
-	 * display checkboxes for user dashboard list
419
-	 * @param int 	User id
420
-	 * @param int	Block id
421
-	 * @return void
422
-	 */
423
-	public static function display_user_dashboard_list_checkboxes($user_id, $block_id) {
424
-
425
-		$user_id = intval($user_id);
426
-		$user_block_data = self::get_user_block_data($user_id);
427
-		$enabled_blocks_id = array_keys($user_block_data);
428
-
429
-		$checked = '';
430
-		if (in_array($block_id, $enabled_blocks_id)) {
431
-			$checked = "checked";
432
-		}
433
-
434
-		echo "<td align=\"center\">";
435
-		echo '<input type="checkbox" name="enabled_blocks['.$block_id.']" value="true" '.$checked.'/>';
436
-		echo "</td>";
437
-	}
438
-
439
-	/**
440
-	 * This function store enabled blocks id with its column position (block_id1:colum;block_id2:colum; ...) inside extra user fields
441
-	 * @param int User id
442
-	 * @param array selected blocks
443
-	 * @param array columns position
444
-	 * @return bool
445
-	 */
446
-	public static function store_user_blocks($user_id, $enabled_blocks, $columns) {
447
-		$selected_blocks_id  = array();
448
-		if (is_array($enabled_blocks) && count($enabled_blocks) > 0) {
449
-			$selected_blocks_id = array_keys($enabled_blocks);
450
-		}
451
-
452
-		// build data for storing inside extra user field
453
-		$fname = 'dashboard';
454
-		$fvalue = array();
455
-		foreach ($selected_blocks_id as $block_id) {
456
-			$fvalue[] = $block_id.':'.$columns[$block_id];
457
-		}
413
+            }
414
+        }
415
+    }
416
+
417
+    /**
418
+     * display checkboxes for user dashboard list
419
+     * @param int 	User id
420
+     * @param int	Block id
421
+     * @return void
422
+     */
423
+    public static function display_user_dashboard_list_checkboxes($user_id, $block_id) {
424
+
425
+        $user_id = intval($user_id);
426
+        $user_block_data = self::get_user_block_data($user_id);
427
+        $enabled_blocks_id = array_keys($user_block_data);
428
+
429
+        $checked = '';
430
+        if (in_array($block_id, $enabled_blocks_id)) {
431
+            $checked = "checked";
432
+        }
433
+
434
+        echo "<td align=\"center\">";
435
+        echo '<input type="checkbox" name="enabled_blocks['.$block_id.']" value="true" '.$checked.'/>';
436
+        echo "</td>";
437
+    }
438
+
439
+    /**
440
+     * This function store enabled blocks id with its column position (block_id1:colum;block_id2:colum; ...) inside extra user fields
441
+     * @param int User id
442
+     * @param array selected blocks
443
+     * @param array columns position
444
+     * @return bool
445
+     */
446
+    public static function store_user_blocks($user_id, $enabled_blocks, $columns) {
447
+        $selected_blocks_id  = array();
448
+        if (is_array($enabled_blocks) && count($enabled_blocks) > 0) {
449
+            $selected_blocks_id = array_keys($enabled_blocks);
450
+        }
451
+
452
+        // build data for storing inside extra user field
453
+        $fname = 'dashboard';
454
+        $fvalue = array();
455
+        foreach ($selected_blocks_id as $block_id) {
456
+            $fvalue[] = $block_id.':'.$columns[$block_id];
457
+        }
458 458
         $upd_extra_field = UserManager::update_extra_field_value(
459 459
             $user_id,
460 460
             $fname,
461 461
             $fvalue
462 462
         );
463 463
 
464
-		return $upd_extra_field;
464
+        return $upd_extra_field;
465 465
 
466
-	}
466
+    }
467 467
 
468
-	/**
469
-	 * This function get user block data (block id with its number of column) from extra user data
470
-	 * @param int  		User id
471
-	 * @return array  	data (block_id,column)
472
-	 */
473
-	public static function get_user_block_data($user_id)
468
+    /**
469
+     * This function get user block data (block id with its number of column) from extra user data
470
+     * @param int  		User id
471
+     * @return array  	data (block_id,column)
472
+     */
473
+    public static function get_user_block_data($user_id)
474 474
     {
475
-		$user_id = intval($user_id);
476
-		$field_variable = 'dashboard';
477
-		$extra_user_data = UserManager::get_extra_user_data_by_field($user_id, $field_variable);
475
+        $user_id = intval($user_id);
476
+        $field_variable = 'dashboard';
477
+        $extra_user_data = UserManager::get_extra_user_data_by_field($user_id, $field_variable);
478 478
 
479
-		if (isset($extra_user_data[$field_variable])) {
479
+        if (isset($extra_user_data[$field_variable])) {
480 480
             $extra_user_data = explode(';', $extra_user_data[$field_variable]);
481 481
         }
482 482
 
483
-		$data = array();
484
-		foreach ($extra_user_data as $extra) {
485
-			$split_extra = explode(':',$extra);
486
-			if (!empty($split_extra)) {
487
-				$block_id = $split_extra[0];
488
-				$column = isset($split_extra[1]) ? $split_extra[1] : null;
489
-				$data[$block_id] = array('block_id' => $block_id, 'column' => $column);
490
-			}
491
-		}
492
-
493
-		return $data;
494
-	}
495
-
496
-	/**
497
-	 * This function update extra user blocks data after closing a dashboard block
498
-	 * @param int 		User id
499
-	 * @param string	plugin path
500
-	 * @return bool
501
-	 */
502
-	public static function close_user_block($user_id, $path)
483
+        $data = array();
484
+        foreach ($extra_user_data as $extra) {
485
+            $split_extra = explode(':',$extra);
486
+            if (!empty($split_extra)) {
487
+                $block_id = $split_extra[0];
488
+                $column = isset($split_extra[1]) ? $split_extra[1] : null;
489
+                $data[$block_id] = array('block_id' => $block_id, 'column' => $column);
490
+            }
491
+        }
492
+
493
+        return $data;
494
+    }
495
+
496
+    /**
497
+     * This function update extra user blocks data after closing a dashboard block
498
+     * @param int 		User id
499
+     * @param string	plugin path
500
+     * @return bool
501
+     */
502
+    public static function close_user_block($user_id, $path)
503 503
     {
504
-		$enabled_dashboard_blocks = self::get_enabled_dashboard_blocks($path);
505
-		$user_block_data = self::get_user_block_data($user_id);
506
-
507
-		foreach ($enabled_dashboard_blocks as $enabled_block) {
508
-			unset($user_block_data[$enabled_block['id']]);
509
-		}
510
-
511
-		// get columns and blocks id for updating extra user data
512
-		$columns = array();
513
-		$user_blocks_id = array();
514
-		foreach ($user_block_data as $data) {
515
-			$user_blocks_id[$data['block_id']] = true;
516
-			$columns[$data['block_id']] = $data['column'];
517
-		}
518
-
519
-		// update extra user blocks data
520
-		$upd_extra_field = self::store_user_blocks($user_id, $user_blocks_id, $columns);
521
-
522
-		return $upd_extra_field;
523
-	}
524
-
525
-	/**
526
-	 * get links for styles from dashboard plugins
527
-	 * @return string   links
528
-	 */
529
-	public static function get_links_for_styles_from_dashboard_plugins() {
530
-
531
-		return '<link rel="stylesheet" href="'.api_get_path(WEB_PLUGIN_PATH).'dashboard/css/default.css" type="text/css" />'.PHP_EOL;
532
-	}
504
+        $enabled_dashboard_blocks = self::get_enabled_dashboard_blocks($path);
505
+        $user_block_data = self::get_user_block_data($user_id);
506
+
507
+        foreach ($enabled_dashboard_blocks as $enabled_block) {
508
+            unset($user_block_data[$enabled_block['id']]);
509
+        }
510
+
511
+        // get columns and blocks id for updating extra user data
512
+        $columns = array();
513
+        $user_blocks_id = array();
514
+        foreach ($user_block_data as $data) {
515
+            $user_blocks_id[$data['block_id']] = true;
516
+            $columns[$data['block_id']] = $data['column'];
517
+        }
518
+
519
+        // update extra user blocks data
520
+        $upd_extra_field = self::store_user_blocks($user_id, $user_blocks_id, $columns);
521
+
522
+        return $upd_extra_field;
523
+    }
524
+
525
+    /**
526
+     * get links for styles from dashboard plugins
527
+     * @return string   links
528
+     */
529
+    public static function get_links_for_styles_from_dashboard_plugins() {
530
+
531
+        return '<link rel="stylesheet" href="'.api_get_path(WEB_PLUGIN_PATH).'dashboard/css/default.css" type="text/css" />'.PHP_EOL;
532
+    }
533 533
 
534 534
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
                 echo '<tr>';
54 54
                 self::display_dashboard_plugin_checkboxes($testplugin);
55
-                for ($i = 0 ; $i < count($table_cols); $i++) {
55
+                for ($i = 0; $i < count($table_cols); $i++) {
56 56
                     if (isset($plugin_info[strtolower($table_cols[$i])])) {
57 57
                         echo '<td>';
58 58
                         echo $plugin_info[$table_cols[$i]];
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
                     echo Display::tag(
68 68
                         'tr',
69 69
                         Display::tag('td',
70
-                            get_lang('CheckFilePermissions') . ' ' . Security::remove_XSS($plugin_info_file),
70
+                            get_lang('CheckFilePermissions').' '.Security::remove_XSS($plugin_info_file),
71 71
                             array('colspan' => '3'))
72 72
                     );
73 73
                 }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
             foreach ($disabled_blocks_data as $disabled_block) {
80 80
                 echo '<tr style="background-color:#eee">';
81 81
                 echo '<td><center><input type="checkbox" name="disabled_block" value="true" checked disabled /></center>';
82
-                for ($j = 0 ; $j < count($table_cols); $j++) {
82
+                for ($j = 0; $j < count($table_cols); $j++) {
83 83
                     if (isset($disabled_block[strtolower($table_cols[$j])])) {
84 84
                         if ($j == 2) {
85 85
                             echo '<td>';
@@ -189,10 +189,10 @@  discard block
 block discarded – undo
189 189
             }
190 190
             // clean from block data
191 191
             if (!empty($not_selected_blocks_id)) {
192
-                $sql_check = "SELECT id FROM $tbl_block WHERE id IN(".implode(',',$not_selected_blocks_id).")";
192
+                $sql_check = "SELECT id FROM $tbl_block WHERE id IN(".implode(',', $not_selected_blocks_id).")";
193 193
                 $rs_check = Database::query($sql_check);
194 194
                 if (Database::num_rows($rs_check) > 0) {
195
-                    $del = "DELETE FROM $tbl_block WHERE id IN(".implode(',',$not_selected_blocks_id).")";
195
+                    $del = "DELETE FROM $tbl_block WHERE id IN(".implode(',', $not_selected_blocks_id).")";
196 196
                     Database::query($del);
197 197
                 }
198 198
             }
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
                         $affected_rows = Database::affected_rows($result);
213 213
                     } else {
214 214
                         // insert
215
-                        $plugin_info_file = $dashboard_pluginpath . $testplugin . "/$testplugin.info";
215
+                        $plugin_info_file = $dashboard_pluginpath.$testplugin."/$testplugin.info";
216 216
                         $plugin_info = array();
217 217
                         if (file_exists($plugin_info_file)) {
218 218
                             $plugin_info = parse_info_file($plugin_info_file);
@@ -282,10 +282,10 @@  discard block
 block discarded – undo
282 282
 		// We check if plugin exists inside directory for updating active field
283 283
 		$sql = "SELECT * FROM $tbl_block";
284 284
 		$rs = Database::query($sql);
285
-		if (Database::num_rows($rs) > 0){
285
+		if (Database::num_rows($rs) > 0) {
286 286
 			while ($row = Database::fetch_array($rs)) {
287 287
 				$path = $row['path'];
288
-				if (!in_array($row['path'],$possibleplugins)) {
288
+				if (!in_array($row['path'], $possibleplugins)) {
289 289
 					$active = 0;
290 290
 				} else {
291 291
 					$active = 1;
@@ -390,13 +390,13 @@  discard block
 block discarded – undo
390 390
 					echo '<td>'.$block['description'].'</td>';
391 391
 					echo '<td>
392 392
                             <select class="selectpicker show-tick form-control" name="columns['.$block['id'].']">
393
-                            <option value="1" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column']==1?'selected':'').' >1</option>
394
-                            <option value="2" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column']==2?'selected':'').' >2</option>
393
+                            <option value="1" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column'] == 1 ? 'selected' : '').' >1</option>
394
+                            <option value="2" '.(isset($user_block_data[$block['id']]) && $user_block_data[$block['id']]['column'] == 2 ? 'selected' : '').' >2</option>
395 395
                             </select>
396 396
                           </td>';
397 397
 					echo '</tr>';
398 398
 				} else {
399
-					echo Display::tag('tr',  Display::tag('td', get_lang('Error').' '.$controller_class, array('colspan'=>'3')));
399
+					echo Display::tag('tr', Display::tag('td', get_lang('Error').' '.$controller_class, array('colspan'=>'3')));
400 400
 				}
401 401
 			}
402 402
 
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 
483 483
 		$data = array();
484 484
 		foreach ($extra_user_data as $extra) {
485
-			$split_extra = explode(':',$extra);
485
+			$split_extra = explode(':', $extra);
486 486
 			if (!empty($split_extra)) {
487 487
 				$block_id = $split_extra[0];
488 488
 				$column = isset($split_extra[1]) ? $split_extra[1] : null;
Please login to merge, or discard this patch.
main/inc/lib/database.lib.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
      *
67 67
      * @param string $table
68 68
      *
69
-     * @return mixed
69
+     * @return string
70 70
      */
71 71
     public static function get_main_table($table)
72 72
     {
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 
266 266
     /**
267 267
      * Frees all the memory associated with the provided result identifier.
268
-     * @return bool     Returns TRUE on success or FALSE on failure.
268
+     * @return boolean|null     Returns TRUE on success or FALSE on failure.
269 269
      * Notes: Use this method if you are concerned about how much memory is being used for queries that return large result sets.
270 270
      * Anyway, all associated result memory is automatically freed at the end of the script's execution.
271 271
      */
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
      * @param array     $attributes
382 382
      * @param bool      $show_query
383 383
      *
384
-     * @return bool|int
384
+     * @return false|string
385 385
      */
386 386
     public static function insert($table_name, $attributes, $show_query = false)
387 387
     {
Please login to merge, or discard this patch.
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/diagnoser.lib.php 4 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -351,6 +351,12 @@
 block discarded – undo
351 351
 
352 352
     /**
353 353
      * Additional functions needed for fast integration
354
+     * @param integer $status
355
+     * @param string $section
356
+     * @param string $title
357
+     * @param string $url
358
+     * @param string|null $formatter
359
+     * @param string $comment
354 360
      */
355 361
     public function build_setting($status, $section, $title, $url, $current_value, $expected_value, $formatter, $comment, $img_path = null) {
356 362
         switch ($status) {
Please login to merge, or discard this patch.
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -401,19 +401,19 @@
 block discarded – undo
401 401
 
402 402
     public function format_yes_no_optional($value)
403 403
     {
404
-    	$return = '';
405
-    	switch($value) {
406
-     		case 0:
407
-     			$return = get_lang('No');
408
-     			break;
409
-     		case 1:
410
-     			$return = get_lang('Yes');
411
-     			break;
412
-			case 2:
413
-				$return = get_lang('Optional');
414
-				break;
415
-    	}
416
-    	return $return;
404
+        $return = '';
405
+        switch($value) {
406
+                case 0:
407
+                 $return = get_lang('No');
408
+                    break;
409
+                case 1:
410
+                 $return = get_lang('Yes');
411
+                    break;
412
+            case 2:
413
+                $return = get_lang('Optional');
414
+                break;
415
+        }
416
+        return $return;
417 417
 
418 418
     }
419 419
 
Please login to merge, or discard this patch.
Braces   +13 added lines, -9 removed lines patch added patch discarded remove patch
@@ -158,8 +158,9 @@  discard block
 block discarded – undo
158 158
         $array[] = $this->build_setting($status, '[INI]', 'display_errors', 'http://www.php.net/manual/en/ini.core.php#ini.display_errors', $setting, $req_setting, 'on_off', get_lang('DisplayErrorsInfo'));
159 159
 
160 160
         $setting = ini_get('default_charset');
161
-        if ($setting == '')
162
-            $setting = null;
161
+        if ($setting == '') {
162
+                    $setting = null;
163
+        }
163 164
         $req_setting = null;
164 165
         $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_ERROR;
165 166
         $array[] = $this->build_setting($status, '[INI]', 'default_charset', 'http://www.php.net/manual/en/ini.core.php#ini.default-charset', $setting, $req_setting, null, get_lang('DefaultCharsetInfo'));
@@ -177,22 +178,25 @@  discard block
 block discarded – undo
177 178
         $setting = ini_get('memory_limit');
178 179
         $req_setting = '>= '.REQUIRED_MIN_MEMORY_LIMIT.'M';
179 180
         $status = self :: STATUS_ERROR;
180
-        if ((float)$setting >= REQUIRED_MIN_MEMORY_LIMIT)
181
-            $status = self :: STATUS_OK;
181
+        if ((float)$setting >= REQUIRED_MIN_MEMORY_LIMIT) {
182
+                    $status = self :: STATUS_OK;
183
+        }
182 184
         $array[] = $this->build_setting($status, '[INI]', 'memory_limit', 'http://www.php.net/manual/en/ini.core.php#ini.memory-limit', $setting, $req_setting, null, get_lang('MemoryLimitInfo'));
183 185
 
184 186
         $setting = ini_get('post_max_size');
185 187
         $req_setting = '>= '.REQUIRED_MIN_POST_MAX_SIZE.'M';
186 188
         $status = self :: STATUS_ERROR;
187
-        if ((float)$setting >= REQUIRED_MIN_POST_MAX_SIZE)
188
-            $status = self :: STATUS_OK;
189
+        if ((float)$setting >= REQUIRED_MIN_POST_MAX_SIZE) {
190
+                    $status = self :: STATUS_OK;
191
+        }
189 192
         $array[] = $this->build_setting($status, '[INI]', 'post_max_size', 'http://www.php.net/manual/en/ini.core.php#ini.post-max-size', $setting, $req_setting, null, get_lang('PostMaxSizeInfo'));
190 193
 
191 194
         $setting = ini_get('upload_max_filesize');
192 195
         $req_setting = '>= '.REQUIRED_MIN_UPLOAD_MAX_FILESIZE.'M';
193 196
         $status = self :: STATUS_ERROR;
194
-        if ((float)$setting >= REQUIRED_MIN_UPLOAD_MAX_FILESIZE)
195
-            $status = self :: STATUS_OK;
197
+        if ((float)$setting >= REQUIRED_MIN_UPLOAD_MAX_FILESIZE) {
198
+                    $status = self :: STATUS_OK;
199
+        }
196 200
         $array[] = $this->build_setting($status, '[INI]', 'upload_max_filesize', 'http://www.php.net/manual/en/ini.core.php#ini.upload_max_filesize', $setting, $req_setting, null, get_lang('UploadMaxFilesizeInfo'));
197 201
 
198 202
         $setting = ini_get('variables_order');
@@ -205,7 +209,7 @@  discard block
 block discarded – undo
205 209
         $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_WARNING;
206 210
         $array[] = $this->build_setting($status, '[SESSION]', 'session.gc_maxlifetime', 'http://www.php.net/manual/en/ini.core.php#session.gc-maxlifetime', $setting, $req_setting, null, get_lang('SessionGCMaxLifetimeInfo'));
207 211
 
208
-        if (api_check_browscap()){$setting = true;}else{$setting=false;}
212
+        if (api_check_browscap()){$setting = true;} else{$setting=false;}
209 213
         $req_setting = true;
210 214
         $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_WARNING;
211 215
         $array[] = $this->build_setting($status, '[INI]', 'browscap', 'http://www.php.net/manual/en/misc.configuration.php#ini.browscap', $setting, $req_setting, 'on_off', get_lang('BrowscapInfo'));
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 {
16 16
     const STATUS_OK = 1;
17 17
     const STATUS_WARNING = 2;
18
-    const STATUS_ERROR 	= 3;
18
+    const STATUS_ERROR = 3;
19 19
     const STATUS_INFORMATION = 4;
20 20
 
21 21
     /**
@@ -43,12 +43,12 @@  discard block
 block discarded – undo
43 43
                 $html .= '<li>';
44 44
             }
45 45
             $params['section'] = $section;
46
-            $html .='<a href="system_status.php?section='.$section.'">'.get_lang($section).'</a></li>';
46
+            $html .= '<a href="system_status.php?section='.$section.'">'.get_lang($section).'</a></li>';
47 47
         }
48 48
 
49 49
         $html .= '</ul><div class="tab-pane">';
50 50
 
51
-        $data = call_user_func(array($this, 'get_' . $currentSection . '_data'));
51
+        $data = call_user_func(array($this, 'get_'.$currentSection.'_data'));
52 52
         echo $html;
53 53
 
54 54
         if ($currentSection != 'paths') {
@@ -115,11 +115,11 @@  discard block
 block discarded – undo
115 115
     {
116 116
         $array = array();
117 117
         $writable_folders = array(
118
-            api_get_path(SYS_APP_PATH) .'cache',
118
+            api_get_path(SYS_APP_PATH).'cache',
119 119
             api_get_path(SYS_COURSE_PATH),
120
-            api_get_path(SYS_APP_PATH) .'home',
121
-            api_get_path(SYS_APP_PATH) .'upload/users/',
122
-            api_get_path(SYS_PATH) .'main/default_course_document/images/',
120
+            api_get_path(SYS_APP_PATH).'home',
121
+            api_get_path(SYS_APP_PATH).'upload/users/',
122
+            api_get_path(SYS_PATH).'main/default_course_document/images/',
123 123
         );
124 124
         foreach ($writable_folders as $index => $folder) {
125 125
             $writable = is_writable($folder);
@@ -138,10 +138,10 @@  discard block
 block discarded – undo
138 138
 
139 139
         $exists = file_exists(api_get_path(SYS_CODE_PATH).'install');
140 140
         $status = $exists ? self :: STATUS_WARNING : self :: STATUS_OK;
141
-        $array[] = $this->build_setting($status, '[FILES]', get_lang('DirectoryExists') . ': /install', 'http://be2.php.net/file_exists', $exists, 0, 'yes_no', get_lang('DirectoryShouldBeRemoved'));
141
+        $array[] = $this->build_setting($status, '[FILES]', get_lang('DirectoryExists').': /install', 'http://be2.php.net/file_exists', $exists, 0, 'yes_no', get_lang('DirectoryShouldBeRemoved'));
142 142
 
143 143
         $app_version = api_get_setting('chamilo_database_version');
144
-        $array[] = $this->build_setting(self :: STATUS_INFORMATION, '[DB]', 'chamilo_database_version', '#', $app_version, 0, null,  'Chamilo DB version');
144
+        $array[] = $this->build_setting(self :: STATUS_INFORMATION, '[DB]', 'chamilo_database_version', '#', $app_version, 0, null, 'Chamilo DB version');
145 145
 
146 146
         return $array;
147 147
     }
@@ -208,33 +208,33 @@  discard block
 block discarded – undo
208 208
         $array[] = $this->build_setting($status, '[INI]', 'default_charset', 'http://www.php.net/manual/en/ini.core.php#ini.default-charset', $setting, $req_setting, null, get_lang('DefaultCharsetInfo'));
209 209
 
210 210
         $setting = ini_get('max_execution_time');
211
-        $req_setting = '300 (' . get_lang('Minimum') . ')';
211
+        $req_setting = '300 ('.get_lang('Minimum').')';
212 212
         $status = $setting >= 300 ? self :: STATUS_OK : self :: STATUS_WARNING;
213 213
         $array[] = $this->build_setting($status, '[INI]', 'max_execution_time', 'http://www.php.net/manual/en/ini.core.php#ini.max-execution-time', $setting, $req_setting, null, get_lang('MaxExecutionTimeInfo'));
214 214
 
215 215
         $setting = ini_get('max_input_time');
216
-        $req_setting = '300 (' . get_lang('Minimum') . ')';
216
+        $req_setting = '300 ('.get_lang('Minimum').')';
217 217
         $status = $setting >= 300 ? self :: STATUS_OK : self :: STATUS_WARNING;
218 218
         $array[] = $this->build_setting($status, '[INI]', 'max_input_time', 'http://www.php.net/manual/en/ini.core.php#ini.max-input-time', $setting, $req_setting, null, get_lang('MaxInputTimeInfo'));
219 219
 
220 220
         $setting = ini_get('memory_limit');
221 221
         $req_setting = '>= '.REQUIRED_MIN_MEMORY_LIMIT.'M';
222 222
         $status = self :: STATUS_ERROR;
223
-        if ((float)$setting >= REQUIRED_MIN_MEMORY_LIMIT)
223
+        if ((float) $setting >= REQUIRED_MIN_MEMORY_LIMIT)
224 224
             $status = self :: STATUS_OK;
225 225
         $array[] = $this->build_setting($status, '[INI]', 'memory_limit', 'http://www.php.net/manual/en/ini.core.php#ini.memory-limit', $setting, $req_setting, null, get_lang('MemoryLimitInfo'));
226 226
 
227 227
         $setting = ini_get('post_max_size');
228 228
         $req_setting = '>= '.REQUIRED_MIN_POST_MAX_SIZE.'M';
229 229
         $status = self :: STATUS_ERROR;
230
-        if ((float)$setting >= REQUIRED_MIN_POST_MAX_SIZE)
230
+        if ((float) $setting >= REQUIRED_MIN_POST_MAX_SIZE)
231 231
             $status = self :: STATUS_OK;
232 232
         $array[] = $this->build_setting($status, '[INI]', 'post_max_size', 'http://www.php.net/manual/en/ini.core.php#ini.post-max-size', $setting, $req_setting, null, get_lang('PostMaxSizeInfo'));
233 233
 
234 234
         $setting = ini_get('upload_max_filesize');
235 235
         $req_setting = '>= '.REQUIRED_MIN_UPLOAD_MAX_FILESIZE.'M';
236 236
         $status = self :: STATUS_ERROR;
237
-        if ((float)$setting >= REQUIRED_MIN_UPLOAD_MAX_FILESIZE)
237
+        if ((float) $setting >= REQUIRED_MIN_UPLOAD_MAX_FILESIZE)
238 238
             $status = self :: STATUS_OK;
239 239
         $array[] = $this->build_setting($status, '[INI]', 'upload_max_filesize', 'http://www.php.net/manual/en/ini.core.php#ini.upload_max_filesize', $setting, $req_setting, null, get_lang('UploadMaxFilesizeInfo'));
240 240
 
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
         $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_WARNING;
249 249
         $array[] = $this->build_setting($status, '[SESSION]', 'session.gc_maxlifetime', 'http://www.php.net/manual/en/ini.core.php#session.gc-maxlifetime', $setting, $req_setting, null, get_lang('SessionGCMaxLifetimeInfo'));
250 250
 
251
-        if (api_check_browscap()){$setting = true;}else{$setting=false;}
251
+        if (api_check_browscap()) {$setting = true; } else {$setting = false; }
252 252
         $req_setting = true;
253 253
         $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_WARNING;
254 254
         $array[] = $this->build_setting($status, '[INI]', 'browscap', 'http://www.php.net/manual/en/misc.configuration.php#ini.browscap', $setting, $req_setting, 'on_off', get_lang('BrowscapInfo'));
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 
305 305
             $loaded = extension_loaded($extension);
306 306
             $status = $loaded ? self :: STATUS_OK : self :: STATUS_ERROR;
307
-            $array[] = $this->build_setting($status, '[EXTENSION]', get_lang('LoadedExtension') . ': ' . $extension, $url, $loaded, $expected_value, 'yes_no_optional', $comment);
307
+            $array[] = $this->build_setting($status, '[EXTENSION]', get_lang('LoadedExtension').': '.$extension, $url, $loaded, $expected_value, 'yes_no_optional', $comment);
308 308
         }
309 309
 
310 310
         return $array;
@@ -427,9 +427,9 @@  discard block
 block discarded – undo
427 427
         $formatted_expected_value = $expected_value;
428 428
 
429 429
         if ($formatter) {
430
-            if (method_exists($this, 'format_' . $formatter)) {
431
-                $formatted_current_value = call_user_func(array($this, 'format_' . $formatter), $current_value);
432
-                $formatted_expected_value = call_user_func(array($this, 'format_' . $formatter), $expected_value);
430
+            if (method_exists($this, 'format_'.$formatter)) {
431
+                $formatted_current_value = call_user_func(array($this, 'format_'.$formatter), $current_value);
432
+                $formatted_expected_value = call_user_func(array($this, 'format_'.$formatter), $expected_value);
433 433
             }
434 434
         }
435 435
 
@@ -444,13 +444,13 @@  discard block
 block discarded – undo
444 444
      */
445 445
     public function get_link($title, $url)
446 446
     {
447
-        return '<a href="' . $url . '" target="about:bank">' . $title . '</a>';
447
+        return '<a href="'.$url.'" target="about:bank">'.$title.'</a>';
448 448
     }
449 449
 
450 450
     public function format_yes_no_optional($value)
451 451
     {
452 452
     	$return = '';
453
-    	switch($value) {
453
+    	switch ($value) {
454 454
      		case 0:
455 455
      			$return = get_lang('No');
456 456
      			break;
Please login to merge, or discard this patch.
main/inc/lib/exercise.lib.php 2 patches
Doc Comments   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1255,6 +1255,7 @@  discard block
 block discarded – undo
1255 1255
 
1256 1256
     /**
1257 1257
      * Validates the time control key
1258
+     * @param integer $exercise_id
1258 1259
      */
1259 1260
     public static function exercise_time_control_is_valid(
1260 1261
         $exercise_id,
@@ -1388,7 +1389,7 @@  discard block
 block discarded – undo
1388 1389
      * @param int $in_direction
1389 1390
      * @param string $in_hotpot_path
1390 1391
      * @param bool $in_get_count
1391
-     * @param null $where_condition
1392
+     * @param string $where_condition
1392 1393
      * @return array|int
1393 1394
      */
1394 1395
     public static function get_exam_results_hotpotatoes_data(
@@ -2179,7 +2180,7 @@  discard block
 block discarded – undo
2179 2180
     /**
2180 2181
      * Return true if pass_pourcentage activated (we use the pass pourcentage feature
2181 2182
      * return false if pass_percentage = 0 (we don't use the pass pourcentage feature
2182
-     * @param $in_pass_pourcentage
2183
+     * @param string $in_pass_pourcentage
2183 2184
      * @return boolean
2184 2185
      * In this version, pass_percentage and show_success_message are disabled if
2185 2186
      * pass_percentage is set to 0
@@ -2192,7 +2193,7 @@  discard block
 block discarded – undo
2192 2193
     /**
2193 2194
      * Converts a numeric value in a percentage example 0.66666 to 66.67 %
2194 2195
      * @param $value
2195
-     * @return float Converted number
2196
+     * @return string Converted number
2196 2197
      */
2197 2198
     public static function convert_to_percentage($value)
2198 2199
     {
@@ -2208,7 +2209,7 @@  discard block
 block discarded – undo
2208 2209
      * @param   float $score
2209 2210
      * @param   float $weight
2210 2211
      * @deprecated seem not to be used
2211
-     * @return  float   the score rounded converted to the new range
2212
+     * @return  string|null   the score rounded converted to the new range
2212 2213
      */
2213 2214
     public static function convert_score($score, $weight)
2214 2215
     {
@@ -2759,6 +2760,7 @@  discard block
 block discarded – undo
2759 2760
      * @param    int        exercise id
2760 2761
      * @param    int    $courseId
2761 2762
      * @param    int        session id
2763
+     * @param integer $user_count
2762 2764
      * @return    float    Best average score
2763 2765
      */
2764 2766
     public static function get_best_average_score_by_exercise(
@@ -3198,8 +3200,9 @@  discard block
 block discarded – undo
3198 3200
     }
3199 3201
 
3200 3202
     /**
3201
-     * @param array $answer
3203
+     * @param string|null $answer
3202 3204
      * @param string $user_answer
3205
+     * @param string|null $current_answer
3203 3206
      * @return array
3204 3207
      */
3205 3208
     public static function check_fill_in_blanks($answer, $user_answer, $current_answer)
@@ -3805,7 +3808,7 @@  discard block
 block discarded – undo
3805 3808
 
3806 3809
     /**
3807 3810
      * @param int $countLetter
3808
-     * @return mixed
3811
+     * @return string
3809 3812
      */
3810 3813
     public static function detectInputAppropriateClass($countLetter)
3811 3814
     {
Please login to merge, or discard this patch.
Spacing   +117 added lines, -117 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
                 if ($show_title) {
66 66
                     TestCategory::displayCategoryAndTitle($objQuestionTmp->id);
67 67
                     echo Display::div(
68
-                        $current_item . '. ' . $objQuestionTmp->selectTitle(),
68
+                        $current_item.'. '.$objQuestionTmp->selectTitle(),
69 69
                         array('class' => 'question_title')
70 70
                     );
71 71
                 }
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
                 $config = array(
162 162
                     'ToolbarSet' => 'TestFreeAnswer'
163 163
                 );
164
-                $form->addHtmlEditor("choice[" . $questionId . "]", null, false, false, $config);
165
-                $form->setDefaults(array("choice[" . $questionId . "]" => $fck_content));
164
+                $form->addHtmlEditor("choice[".$questionId."]", null, false, false, $config);
165
+                $form->setDefaults(array("choice[".$questionId."]" => $fck_content));
166 166
                 $s .= $form->returnForm();
167 167
             } elseif ($answerType == ORAL_EXPRESSION) {
168 168
                 // Add nanog
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
                 $config = array(
192 192
                     'ToolbarSet' => 'TestFreeAnswer'
193 193
                 );
194
-                $form->addHtmlEditor("choice[" . $questionId . "]", null, false, false, $config);
194
+                $form->addHtmlEditor("choice[".$questionId."]", null, false, false, $config);
195 195
                 //$form->setDefaults(array("choice[" . $questionId . "]" => $fck_content));
196 196
                 $s .= $form->returnForm();
197 197
             }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 
273 273
                 // Unique answer
274 274
                 if (in_array($answerType, [UNIQUE_ANSWER, UNIQUE_ANSWER_NO_OPTION, UNIQUE_ANSWER_IMAGE])) {
275
-                    $input_id = 'choice-' . $questionId . '-' . $answerId;
275
+                    $input_id = 'choice-'.$questionId.'-'.$answerId;
276 276
                     if (isset($user_choice[0]) && $user_choice[0]->getAnswer() == $numAnswer) {
277 277
                         $attributes = array(
278 278
                             'id' => $input_id,
@@ -297,14 +297,14 @@  discard block
 block discarded – undo
297 297
                     if ($answerType == UNIQUE_ANSWER_IMAGE) {
298 298
                         if ($show_comment) {
299 299
                             if (empty($comment)) {
300
-                                $s .= '<div id="answer' . $questionId . $numAnswer . '" '
300
+                                $s .= '<div id="answer'.$questionId.$numAnswer.'" '
301 301
                                     . 'class="exercise-unique-answer-image" style="text-align: center">';
302 302
                             } else {
303
-                                $s .= '<div id="answer' . $questionId . $numAnswer . '" '
303
+                                $s .= '<div id="answer'.$questionId.$numAnswer.'" '
304 304
                                     . 'class="exercise-unique-answer-image col-xs-6 col-sm-12" style="text-align: center">';
305 305
                             }
306 306
                         } else {
307
-                            $s .= '<div id="answer' . $questionId . $numAnswer . '" '
307
+                            $s .= '<div id="answer'.$questionId.$numAnswer.'" '
308 308
                                 . 'class="exercise-unique-answer-image col-xs-6 col-md-3" style="text-align: center">';
309 309
                         }
310 310
                     }
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
                     $answer = Security::remove_XSS($answer, STUDENT);
313 313
                     $s .= Display::input(
314 314
                         'hidden',
315
-                        'choice2[' . $questionId . ']',
315
+                        'choice2['.$questionId.']',
316 316
                         '0'
317 317
                     );
318 318
 
@@ -320,13 +320,13 @@  discard block
 block discarded – undo
320 320
 
321 321
                     if ($answerType == UNIQUE_ANSWER_IMAGE) {
322 322
                         $attributes['style'] = 'display: none;';
323
-                        $answer = '<div class="thumbnail">' . $answer . '</div>';
323
+                        $answer = '<div class="thumbnail">'.$answer.'</div>';
324 324
                     }
325 325
 
326 326
                     $answer_input .= '<label class="radio">';
327 327
                     $answer_input .= Display::input(
328 328
                         'radio',
329
-                        'choice[' . $questionId . ']',
329
+                        'choice['.$questionId.']',
330 330
                         $numAnswer,
331 331
                         $attributes
332 332
                     );
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
                     $answerType == MULTIPLE_ANSWER_TRUE_FALSE ||
354 354
                     $answerType == GLOBAL_MULTIPLE_ANSWER
355 355
                 ) {
356
-                    $input_id = 'choice-' . $questionId . '-' . $answerId;
356
+                    $input_id = 'choice-'.$questionId.'-'.$answerId;
357 357
                     $answer = Security::remove_XSS($answer, STUDENT);
358 358
 
359 359
                     if (in_array($numAnswer, $user_choice_array)) {
@@ -374,12 +374,12 @@  discard block
 block discarded – undo
374 374
                     }
375 375
 
376 376
                     if ($answerType == MULTIPLE_ANSWER || $answerType == GLOBAL_MULTIPLE_ANSWER) {
377
-                        $s .= '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />';
377
+                        $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />';
378 378
 
379 379
                         $answer_input = '<label class="checkbox">';
380 380
                         $answer_input .= Display::input(
381 381
                             'checkbox',
382
-                            'choice[' . $questionId . '][' . $numAnswer . ']',
382
+                            'choice['.$questionId.']['.$numAnswer.']',
383 383
                             $numAnswer,
384 384
                             $attributes
385 385
                         );
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
                                     'td',
433 433
                                     Display::input(
434 434
                                         'radio',
435
-                                        'choice[' . $questionId . '][' . $numAnswer . ']',
435
+                                        'choice['.$questionId.']['.$numAnswer.']',
436 436
                                         $id,
437 437
                                         $attributes
438 438
                                     ),
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
                     }
451 451
                 } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION) {
452 452
                     // multiple answers
453
-                    $input_id = 'choice-' . $questionId . '-' . $answerId;
453
+                    $input_id = 'choice-'.$questionId.'-'.$answerId;
454 454
 
455 455
                     if (in_array($numAnswer, $user_choice_array)) {
456 456
                         $attributes = array(
@@ -470,11 +470,11 @@  discard block
 block discarded – undo
470 470
                     }
471 471
 
472 472
                     $answer = Security::remove_XSS($answer, STUDENT);
473
-                    $answer_input = '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />';
473
+                    $answer_input = '<input type="hidden" name="choice2['.$questionId.']" value="0" />';
474 474
                     $answer_input .= '<label class="checkbox">';
475 475
                     $answer_input .= Display::input(
476 476
                         'checkbox',
477
-                        'choice[' . $questionId . '][' . $numAnswer . ']',
477
+                        'choice['.$questionId.']['.$numAnswer.']',
478 478
                         1,
479 479
                         $attributes
480 480
                     );
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
                     }
496 496
 
497 497
                 } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) {
498
-                    $s .= '<input type="hidden" name="choice2[' . $questionId . ']" value="0" />';
498
+                    $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />';
499 499
 
500 500
                     $my_choice = array();
501 501
                     if (!empty($user_choice_array)) {
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
                             'td',
531 531
                             Display::input(
532 532
                                 'radio',
533
-                                'choice[' . $questionId . '][' . $numAnswer . ']',
533
+                                'choice['.$questionId.']['.$numAnswer.']',
534 534
                                 $key,
535 535
                                 $attributes
536 536
                             )
@@ -627,8 +627,8 @@  discard block
 block discarded – undo
627 627
                             TABLE_STATISTIC_TRACK_E_ATTEMPT
628 628
                         );
629 629
                         $sql = 'SELECT answer
630
-                                FROM ' . $trackAttempts . '
631
-                                WHERE exe_id=' . $exe_id . ' AND question_id=' . $questionId;
630
+                                FROM ' . $trackAttempts.'
631
+                                WHERE exe_id=' . $exe_id.' AND question_id='.$questionId;
632 632
                         $rsLastAttempt = Database::query($sql);
633 633
                         $rowLastAttempt = Database::fetch_array($rsLastAttempt);
634 634
                         $answer = $rowLastAttempt['answer'];
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
                                 '',
688 688
                                 $answerCorrected
689 689
                             );
690
-                            $answerCorrected = '[' . $answerCorrected . ']';
690
+                            $answerCorrected = '['.$answerCorrected.']';
691 691
                             $studentAnswerList[] = $answerCorrected;
692 692
                         }
693 693
                     }
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
                     */
707 707
                     $tabComments = api_preg_split(
708 708
                         '/\[[^]]+\]/',
709
-                        ' ' . $answer . ' '
709
+                        ' '.$answer.' '
710 710
                     );
711 711
                     if (!empty($correctAnswerList) && !empty($studentAnswerList)) {
712 712
                         $answer = "";
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
                                 $size
724 724
                             );
725 725
 
726
-                            $answer .= $tabComments[$i] .
726
+                            $answer .= $tabComments[$i].
727 727
                                 Display::input(
728 728
                                     'text',
729 729
                                     "choice[$questionId][]",
@@ -769,12 +769,12 @@  discard block
 block discarded – undo
769 769
                         $s .= '<tr><td width="45%" valign="top">';
770 770
                         $parsed_answer = $answer;
771 771
                         //left part questions
772
-                        $s .= '<p class="indent">' . $lines_count . '.&nbsp;' . $parsed_answer . '</p></td>';
772
+                        $s .= '<p class="indent">'.$lines_count.'.&nbsp;'.$parsed_answer.'</p></td>';
773 773
                         //middle part (matches selects)
774 774
 
775 775
                         $s .= '<td width="10%" valign="top" align="center" >
776 776
                                 <div class="select-matching">
777
-                                <select name="choice[' . $questionId . '][' . $numAnswer . ']">';
777
+                                <select name="choice[' . $questionId.']['.$numAnswer.']">';
778 778
 
779 779
                         // fills the list-box
780 780
                         foreach ($select_items as $key => $val) {
@@ -790,14 +790,14 @@  discard block
 block discarded – undo
790 790
                             if (isset($user_choice_array_position[$numAnswer]) && $val['id'] == $user_choice_array_position[$numAnswer]) {
791 791
                                 $selected = 'selected="selected"';
792 792
                             }
793
-                            $s .= '<option value="' . $val['id'] . '" ' . $selected . '>' . $val['letter'] . '</option>';
793
+                            $s .= '<option value="'.$val['id'].'" '.$selected.'>'.$val['letter'].'</option>';
794 794
 
795 795
                         }  // end foreach()
796 796
 
797 797
                         $s .= '</select></div></td><td width="5%" class="separate">&nbsp;</td>';
798 798
                         $s .= '<td width="40%" valign="top" >';
799 799
                         if (isset($select_items[$lines_count])) {
800
-                            $s .= '<div class="text-right"><p class="indent">' . $select_items[$lines_count]['letter'].'.&nbsp; '. $select_items[$lines_count]['answer'].'</p></div>';
800
+                            $s .= '<div class="text-right"><p class="indent">'.$select_items[$lines_count]['letter'].'.&nbsp; '.$select_items[$lines_count]['answer'].'</p></div>';
801 801
                         } else {
802 802
                             $s .= '&nbsp;';
803 803
                         }
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
                                 $s .= '<tr>
813 813
                                       <td colspan="2"></td>
814 814
                                       <td valign="top">';
815
-                                $s .= '<b>' . $select_items[$lines_count]['letter'] . '.</b> ' . $select_items[$lines_count]['answer'];
815
+                                $s .= '<b>'.$select_items[$lines_count]['letter'].'.</b> '.$select_items[$lines_count]['answer'];
816 816
                                 $s .= "</td>
817 817
                                 </tr>";
818 818
                                 $lines_count++;
@@ -828,9 +828,9 @@  discard block
 block discarded – undo
828 828
                         $data = $objAnswerTmp->getAnswerByAutoId($data['correct']);
829 829
                         $lines_count = $data['answer'];*/
830 830
 
831
-                        $windowId = $questionId . '_' . $lines_count;
831
+                        $windowId = $questionId.'_'.$lines_count;
832 832
 
833
-                        $s .= '<li class="touch-items" id="' . $windowId . '">';
833
+                        $s .= '<li class="touch-items" id="'.$windowId.'">';
834 834
                         $s .= Display::div(
835 835
                             $parsed_answer,
836 836
                             [
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
                                 Display::tag(
889 889
                                     'b',
890 890
                                     $select_items[$lines_count]['letter']
891
-                                ) . $select_items[$lines_count]['answer'],
891
+                                ).$select_items[$lines_count]['answer'],
892 892
                                 [
893 893
                                     'id' => "window_{$windowId}_answer",
894 894
                                     'style' => 'display: none;'
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
 
1033 1033
             if ($show_comment) {
1034 1034
                 $s .= '</table>';
1035
-            } elseif(
1035
+            } elseif (
1036 1036
                 in_array(
1037 1037
                     $answerType,
1038 1038
                     [
@@ -1057,7 +1057,7 @@  discard block
 block discarded – undo
1057 1057
 
1058 1058
                 for ($answerId = 1; $answerId <= $nbrAnswers; $answerId++) {
1059 1059
                     $answerCorrect = $objAnswerTmp->isCorrect($answerId);
1060
-                    $windowId = $questionId . '_' . $counterAnswer;
1060
+                    $windowId = $questionId.'_'.$counterAnswer;
1061 1061
 
1062 1062
                     if ($answerCorrect) {
1063 1063
                         $s .= Display::div(
@@ -1102,7 +1102,7 @@  discard block
 block discarded – undo
1102 1102
                 $course = api_get_course_info();
1103 1103
                 $doc_id = DocumentManager::get_document_id(
1104 1104
                     $course,
1105
-                    '/images/' . $pictureName
1105
+                    '/images/'.$pictureName
1106 1106
                 );
1107 1107
                 if (is_numeric($doc_id)) {
1108 1108
                     $images_folder_visibility = api_get_item_visibility(
@@ -1127,7 +1127,7 @@  discard block
 block discarded – undo
1127 1127
                 echo "
1128 1128
                     <script>
1129 1129
                         $(document).on('ready', function () {
1130
-                            new " . ($answerType == HOT_SPOT ?  "HotspotQuestion" : "DelineationQuestion" ) . "({
1130
+                            new " . ($answerType == HOT_SPOT ? "HotspotQuestion" : "DelineationQuestion")."({
1131 1131
                                 questionId: $questionId,
1132 1132
                                 exerciseId: $exerciseId,
1133 1133
                                 selector: '#hotspot-preview-$questionId',
@@ -1161,7 +1161,7 @@  discard block
 block discarded – undo
1161 1161
             if ($answerType != HOT_SPOT_DELINEATION) {
1162 1162
                 $answerList = '
1163 1163
                     <div class="well well-sm">
1164
-                        <h5 class="page-header">' . get_lang('HotspotZones') . '</h5>
1164
+                        <h5 class="page-header">' . get_lang('HotspotZones').'</h5>
1165 1165
                         <ol>
1166 1166
                 ';
1167 1167
 
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
             if (!$only_questions) {
1187 1187
                 if ($show_title) {
1188 1188
                     TestCategory::displayCategoryAndTitle($objQuestionTmp->id);
1189
-                    echo '<div class="question_title">' . $current_item . '. ' . $questionName . '</div>';
1189
+                    echo '<div class="question_title">'.$current_item.'. '.$questionName.'</div>';
1190 1190
                 }
1191 1191
                 //@todo I need to the get the feedback type
1192 1192
                 echo <<<HOTSPOT
@@ -1204,7 +1204,7 @@  discard block
 block discarded – undo
1204 1204
                                 <div class=\"hotspot-image\"></div>
1205 1205
                                 <script>
1206 1206
                                     $(document).on('ready', function () {
1207
-                                        new " . ($answerType == HOT_SPOT_DELINEATION ? 'DelineationQuestion' : 'HotspotQuestion') . "({
1207
+                                        new " . ($answerType == HOT_SPOT_DELINEATION ? 'DelineationQuestion' : 'HotspotQuestion')."({
1208 1208
                                             questionId: $questionId,
1209 1209
                                             exerciseId: $exe_id,
1210 1210
                                             selector: '#question_div_' + $questionId + ' .hotspot-image',
@@ -1323,11 +1323,11 @@  discard block
 block discarded – undo
1323 1323
         $lp_id = intval($lp_id);
1324 1324
         $lp_item_id = intval($lp_item_id);
1325 1325
         return
1326
-            api_get_course_int_id() . '_' .
1327
-            api_get_session_id() . '_' .
1328
-            $exercise_id . '_' .
1329
-            api_get_user_id() . '_' .
1330
-            $lp_id . '_' .
1326
+            api_get_course_int_id().'_'.
1327
+            api_get_session_id().'_'.
1328
+            $exercise_id.'_'.
1329
+            api_get_user_id().'_'.
1330
+            $lp_id.'_'.
1331 1331
             $lp_item_id;
1332 1332
     }
1333 1333
 
@@ -1439,14 +1439,14 @@  discard block
 block discarded – undo
1439 1439
         $res = Database::query($sql);
1440 1440
         $result = array();
1441 1441
         $apiIsAllowedToEdit = api_is_allowed_to_edit();
1442
-        $urlBase = api_get_path(WEB_CODE_PATH) .
1443
-            'exercice/hotpotatoes_exercise_report.php?action=delete&' .
1444
-            api_get_cidreq() . '&id=';
1442
+        $urlBase = api_get_path(WEB_CODE_PATH).
1443
+            'exercice/hotpotatoes_exercise_report.php?action=delete&'.
1444
+            api_get_cidreq().'&id=';
1445 1445
         while ($data = Database::fetch_array($res)) {
1446 1446
             $actions = null;
1447 1447
 
1448 1448
             if ($apiIsAllowedToEdit) {
1449
-                $url = $urlBase . $data['id'] . '&path=' . $data['exe_name'];
1449
+                $url = $urlBase.$data['id'].'&path='.$data['exe_name'];
1450 1450
                 $actions = Display::url(
1451 1451
                     Display::return_icon('delete.png', get_lang('Delete')),
1452 1452
                     $url
@@ -1462,7 +1462,7 @@  discard block
 block discarded – undo
1462 1462
                     GroupManager::get_user_group_name($data['user_id'])
1463 1463
                 ),
1464 1464
                 'exe_date' => $data['exe_date'],
1465
-                'score' => $data['exe_result'] . ' / ' . $data['exe_weighting'],
1465
+                'score' => $data['exe_result'].' / '.$data['exe_weighting'],
1466 1466
                 'actions' => $actions,
1467 1467
             );
1468 1468
         }
@@ -1545,18 +1545,18 @@  discard block
 block discarded – undo
1545 1545
         $TBL_TRACK_HOTPOTATOES = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_HOTPOTATOES);
1546 1546
         $TBL_TRACK_ATTEMPT_RECORDING = Database:: get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT_RECORDING);
1547 1547
 
1548
-        $session_id_and = ' AND te.session_id = ' . $sessionId . ' ';
1548
+        $session_id_and = ' AND te.session_id = '.$sessionId.' ';
1549 1549
         $exercise_id = intval($exercise_id);
1550 1550
 
1551 1551
         $exercise_where = '';
1552 1552
         if (!empty($exercise_id)) {
1553
-            $exercise_where .= ' AND te.exe_exo_id = ' . $exercise_id . '  ';
1553
+            $exercise_where .= ' AND te.exe_exo_id = '.$exercise_id.'  ';
1554 1554
         }
1555 1555
 
1556 1556
         $hotpotatoe_where = '';
1557 1557
         if (!empty($_GET['path'])) {
1558 1558
             $hotpotatoe_path = Database::escape_string($_GET['path']);
1559
-            $hotpotatoe_where .= ' AND exe_name = "' . $hotpotatoe_path . '"  ';
1559
+            $hotpotatoe_where .= ' AND exe_name = "'.$hotpotatoe_path.'"  ';
1560 1560
         }
1561 1561
 
1562 1562
         // sql for chamilo-type tests for teacher / tutor view
@@ -1568,7 +1568,7 @@  discard block
 block discarded – undo
1568 1568
             WHERE
1569 1569
                 c_id = $course_id AND
1570 1570
                 exe_exo_id = $exercise_id AND
1571
-                ttte.session_id = " . $sessionId . "
1571
+                ttte.session_id = ".$sessionId."
1572 1572
         )";
1573 1573
 
1574 1574
         if ($is_allowedToEdit) {
@@ -1591,9 +1591,9 @@  discard block
 block discarded – undo
1591 1591
                         g.id as group_id
1592 1592
                     FROM $TBL_USER u
1593 1593
                     INNER JOIN $TBL_GROUP_REL_USER gru
1594
-                    ON (gru.user_id = u.user_id AND gru.c_id=" . $course_id . ")
1594
+                    ON (gru.user_id = u.user_id AND gru.c_id=".$course_id.")
1595 1595
                     INNER JOIN $TBL_GROUP g
1596
-                    ON (gru.group_id = g.id AND g.c_id=" . $course_id . ")
1596
+                    ON (gru.group_id = g.id AND g.c_id=".$course_id.")
1597 1597
                 )";
1598 1598
             }
1599 1599
 
@@ -1655,9 +1655,9 @@  discard block
 block discarded – undo
1655 1655
                     g.id as group_id
1656 1656
                 FROM $TBL_USER u
1657 1657
                 LEFT OUTER JOIN $TBL_GROUP_REL_USER gru
1658
-                ON ( gru.user_id = u.user_id AND gru.c_id=" . $course_id . " )
1658
+                ON ( gru.user_id = u.user_id AND gru.c_id=".$course_id." )
1659 1659
                 LEFT OUTER JOIN $TBL_GROUP g
1660
-                ON (gru.group_id = g.id AND g.c_id = " . $course_id . ")
1660
+                ON (gru.group_id = g.id AND g.c_id = ".$course_id.")
1661 1661
             )";
1662 1662
             }
1663 1663
 
@@ -1670,12 +1670,12 @@  discard block
 block discarded – undo
1670 1670
             (
1671 1671
                 SELECT u.user_id, firstname, lastname, email, username, ' ' as group_name, '' as group_id, official_code
1672 1672
                 FROM $TBL_USER u
1673
-                WHERE u.status NOT IN(" . api_get_users_status_ignored_in_reports('string') . ")
1673
+                WHERE u.status NOT IN(".api_get_users_status_ignored_in_reports('string').")
1674 1674
             )";
1675 1675
             }
1676 1676
 
1677 1677
             $sqlFromOption = " , $TBL_GROUP_REL_USER AS gru ";
1678
-            $sqlWhereOption = "  AND gru.c_id = " . $course_id ." AND gru.user_id = user.user_id ";
1678
+            $sqlWhereOption = "  AND gru.c_id = ".$course_id." AND gru.user_id = user.user_id ";
1679 1679
             $first_and_last_name = api_is_western_name_order() ? "firstname, lastname" : "lastname, firstname";
1680 1680
 
1681 1681
             if ($get_count) {
@@ -1712,8 +1712,8 @@  discard block
 block discarded – undo
1712 1712
                 ON (user.user_id = exe_user_id)
1713 1713
                 WHERE
1714 1714
                     te.status != 'incomplete' AND
1715
-                    te.c_id = " . $course_id . " $session_id_and AND
1716
-                    ce.active <>-1 AND ce.c_id = " . $course_id . "
1715
+                    te.c_id = ".$course_id." $session_id_and AND
1716
+                    ce.active <>-1 AND ce.c_id = ".$course_id."
1717 1717
                     $exercise_where
1718 1718
                     $extra_where_conditions
1719 1719
                 ";
@@ -1740,12 +1740,12 @@  discard block
 block discarded – undo
1740 1740
                     $sqlFromOption
1741 1741
                 WHERE
1742 1742
                     user.user_id=tth.exe_user_id
1743
-                    AND tth.c_id = " . $course_id . "
1743
+                    AND tth.c_id = ".$course_id."
1744 1744
                     $hotpotatoe_where
1745 1745
                     $sqlWhereOption
1746
-                    AND user.status NOT IN(" . api_get_users_status_ignored_in_reports(
1746
+                    AND user.status NOT IN(".api_get_users_status_ignored_in_reports(
1747 1747
                     'string'
1748
-                ) . ")
1748
+                ).")
1749 1749
                 ORDER BY
1750 1750
                     tth.c_id ASC,
1751 1751
                     tth.exe_date DESC";
@@ -1821,12 +1821,12 @@  discard block
 block discarded – undo
1821 1821
 
1822 1822
                     if ($from_gradebook && ($is_allowedToEdit)) {
1823 1823
                         if (in_array(
1824
-                            $results[$i]['username'] . $results[$i]['firstname'] . $results[$i]['lastname'],
1824
+                            $results[$i]['username'].$results[$i]['firstname'].$results[$i]['lastname'],
1825 1825
                             $users_array_id
1826 1826
                         )) {
1827 1827
                             continue;
1828 1828
                         }
1829
-                        $users_array_id[] = $results[$i]['username'] . $results[$i]['firstname'] . $results[$i]['lastname'];
1829
+                        $users_array_id[] = $results[$i]['username'].$results[$i]['firstname'].$results[$i]['lastname'];
1830 1830
                     }
1831 1831
 
1832 1832
                     $lp_obj = isset($results[$i]['orig_lp_id']) && isset($lp_list[$results[$i]['orig_lp_id']]) ? $lp_list[$results[$i]['orig_lp_id']] : null;
@@ -1835,8 +1835,8 @@  discard block
 block discarded – undo
1835 1835
                     if ($lp_obj) {
1836 1836
                         $url = api_get_path(
1837 1837
                                 WEB_CODE_PATH
1838
-                            ) . 'newscorm/lp_controller.php?' . api_get_cidreq(
1839
-                            ) . '&action=view&lp_id=' . $results[$i]['orig_lp_id'];
1838
+                            ).'newscorm/lp_controller.php?'.api_get_cidreq(
1839
+                            ).'&action=view&lp_id='.$results[$i]['orig_lp_id'];
1840 1840
                         $lp_name = Display::url(
1841 1841
                             $lp_obj['lp_name'],
1842 1842
                             $url,
@@ -1854,7 +1854,7 @@  discard block
 block discarded – undo
1854 1854
                         );
1855 1855
 
1856 1856
                         foreach ($group_list as $id) {
1857
-                            $group_name_list .= $clean_group_list[$id] . '<br/>';
1857
+                            $group_name_list .= $clean_group_list[$id].'<br/>';
1858 1858
                         }
1859 1859
                         $results[$i]['group_name'] = $group_name_list;
1860 1860
                     }
@@ -1910,8 +1910,8 @@  discard block
 block discarded – undo
1910 1910
                                 }
1911 1911
                             }
1912 1912
                             if ($revised) {
1913
-                                $actions .= "<a href='exercise_show.php?" . api_get_cidreq(
1914
-                                    ) . "&action=edit&id=$id'>" .
1913
+                                $actions .= "<a href='exercise_show.php?".api_get_cidreq(
1914
+                                    )."&action=edit&id=$id'>".
1915 1915
                                     Display:: return_icon(
1916 1916
                                         'edit.png',
1917 1917
                                         get_lang('Edit'),
@@ -1920,8 +1920,8 @@  discard block
 block discarded – undo
1920 1920
                                     );
1921 1921
                                 $actions .= '&nbsp;';
1922 1922
                             } else {
1923
-                                $actions .= "<a href='exercise_show.php?" . api_get_cidreq(
1924
-                                    ) . "&action=qualify&id=$id'>" .
1923
+                                $actions .= "<a href='exercise_show.php?".api_get_cidreq(
1924
+                                    )."&action=qualify&id=$id'>".
1925 1925
                                     Display:: return_icon(
1926 1926
                                         'quiz.gif',
1927 1927
                                         get_lang('Qualify')
@@ -1931,12 +1931,12 @@  discard block
 block discarded – undo
1931 1931
                             $actions .= "</a>";
1932 1932
 
1933 1933
                             if ($filter == 2) {
1934
-                                $actions .= ' <a href="exercise_history.php?' . api_get_cidreq(
1935
-                                    ) . '&exe_id=' . $id . '">' .
1934
+                                $actions .= ' <a href="exercise_history.php?'.api_get_cidreq(
1935
+                                    ).'&exe_id='.$id.'">'.
1936 1936
                                     Display:: return_icon(
1937 1937
                                         'history.gif',
1938 1938
                                         get_lang('ViewHistoryChange')
1939
-                                    ) . '</a>';
1939
+                                    ).'</a>';
1940 1940
                             }
1941 1941
 
1942 1942
                             //Admin can always delete the attempt
@@ -1948,35 +1948,35 @@  discard block
 block discarded – undo
1948 1948
                                     date('Y-m-d h:i:s'),
1949 1949
                                     false
1950 1950
                                 );
1951
-                                $actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip=' . $ip . '" target="_blank">';
1951
+                                $actions .= '<a href="http://www.whatsmyip.org/ip-geo-location/?ip='.$ip.'" target="_blank">';
1952 1952
                                 $actions .= Display::return_icon('info.png', $ip, ['title' => $ip]);
1953 1953
                                 $actions .= '</a>';
1954 1954
 
1955
-                                $delete_link = '<a href="exercise_report.php?' . api_get_cidreq(
1956
-                                    ) . '&filter_by_user=' . intval(
1955
+                                $delete_link = '<a href="exercise_report.php?'.api_get_cidreq(
1956
+                                    ).'&filter_by_user='.intval(
1957 1957
                                         $_GET['filter_by_user']
1958
-                                    ) . '&filter=' . $filter . '&exerciseId=' . $exercise_id . '&delete=delete&did=' . $id . '"
1958
+                                    ).'&filter='.$filter.'&exerciseId='.$exercise_id.'&delete=delete&did='.$id.'"
1959 1959
                                 onclick="javascript:if(!confirm(\'' . sprintf(
1960 1960
                                         get_lang('DeleteAttempt'),
1961 1961
                                         $results[$i]['username'],
1962 1962
                                         $dt
1963
-                                    ) . '\')) return false;">' . Display:: return_icon(
1963
+                                    ).'\')) return false;">'.Display:: return_icon(
1964 1964
                                         'delete.png',
1965 1965
                                         get_lang('Delete')
1966
-                                    ) . '</a>';
1966
+                                    ).'</a>';
1967 1967
                                 $delete_link = utf8_encode($delete_link);
1968 1968
 
1969 1969
                                 if (api_is_drh() && !api_is_platform_admin()) {
1970 1970
                                     $delete_link = null;
1971 1971
                                 }
1972
-                                $actions .= $delete_link . '&nbsp;';
1972
+                                $actions .= $delete_link.'&nbsp;';
1973 1973
                             }
1974 1974
 
1975 1975
                         } else {
1976 1976
                             $attempt_url = api_get_path(
1977 1977
                                     WEB_CODE_PATH
1978
-                                ) . 'exercice/result.php?' . api_get_cidreq(
1979
-                                ) . '&id=' . $results[$i]['exe_id'] . '&id_session=' . $sessionId;
1978
+                                ).'exercice/result.php?'.api_get_cidreq(
1979
+                                ).'&id='.$results[$i]['exe_id'].'&id_session='.$sessionId;
1980 1980
                             $attempt_link = Display::url(
1981 1981
                                 get_lang('Show'),
1982 1982
                                 $attempt_url,
@@ -2033,7 +2033,7 @@  discard block
 block discarded – undo
2033 2033
                     $hp_result = round(
2034 2034
                             ($hpresults[$i][4] / ($hpresults[$i][5] != 0 ? $hpresults[$i][5] : 1)) * 100,
2035 2035
                             2
2036
-                        ) . '% (' . $hpresults[$i][4] . ' / ' . $hpresults[$i][5] . ')';
2036
+                        ).'% ('.$hpresults[$i][4].' / '.$hpresults[$i][5].')';
2037 2037
                     if ($is_allowedToEdit) {
2038 2038
                         $list_info[] = array(
2039 2039
                             $hpresults[$i][0],
@@ -2106,13 +2106,13 @@  discard block
 block discarded – undo
2106 2106
 
2107 2107
         $html = null;
2108 2108
         if ($show_percentage) {
2109
-            $parent = '(' . $score . ' / ' . $weight . ')';
2110
-            $html = $percentage . "%  $parent";
2109
+            $parent = '('.$score.' / '.$weight.')';
2110
+            $html = $percentage."%  $parent";
2111 2111
             if ($show_only_percentage) {
2112
-                $html = $percentage . "% ";
2112
+                $html = $percentage."% ";
2113 2113
             }
2114 2114
         } else {
2115
-            $html = $score . ' / ' . $weight;
2115
+            $html = $score.' / '.$weight;
2116 2116
         }
2117 2117
         $html = Display::span($html, array('class' => 'score_exercise'));
2118 2118
 
@@ -2206,7 +2206,7 @@  discard block
 block discarded – undo
2206 2206
     {
2207 2207
         $return = '-';
2208 2208
         if ($value != '') {
2209
-            $return = float_format($value * 100, 1) . ' %';
2209
+            $return = float_format($value * 100, 1).' %';
2210 2210
         }
2211 2211
         return $return;
2212 2212
     }
@@ -2284,7 +2284,7 @@  discard block
 block discarded – undo
2284 2284
         }
2285 2285
 
2286 2286
         $needle_where = !empty($search) ? " AND title LIKE '?' " : '';
2287
-        $needle = !empty($search) ? "%" . $search . "%" : '';
2287
+        $needle = !empty($search) ? "%".$search."%" : '';
2288 2288
 
2289 2289
         // Show courses by active status
2290 2290
         $active_sql = '';
@@ -2299,7 +2299,7 @@  discard block
 block discarded – undo
2299 2299
         if ($search_all_sessions == true) {
2300 2300
             $conditions = array(
2301 2301
                 'where' => array(
2302
-                    $active_sql . ' c_id = ? ' . $needle_where . $time_conditions => array(
2302
+                    $active_sql.' c_id = ? '.$needle_where.$time_conditions => array(
2303 2303
                         $course_id,
2304 2304
                         $needle
2305 2305
                     )
@@ -2310,7 +2310,7 @@  discard block
 block discarded – undo
2310 2310
             if ($session_id == 0) {
2311 2311
                 $conditions = array(
2312 2312
                     'where' => array(
2313
-                        $active_sql . ' session_id = ? AND c_id = ? ' . $needle_where . $time_conditions => array(
2313
+                        $active_sql.' session_id = ? AND c_id = ? '.$needle_where.$time_conditions => array(
2314 2314
                             $session_id,
2315 2315
                             $course_id,
2316 2316
                             $needle
@@ -2321,7 +2321,7 @@  discard block
 block discarded – undo
2321 2321
             } else {
2322 2322
                 $conditions = array(
2323 2323
                     'where' => array(
2324
-                        $active_sql . ' (session_id = 0 OR session_id = ? ) AND c_id = ? ' . $needle_where . $time_conditions => array(
2324
+                        $active_sql.' (session_id = 0 OR session_id = ? ) AND c_id = ? '.$needle_where.$time_conditions => array(
2325 2325
                             $session_id,
2326 2326
                             $course_id,
2327 2327
                             $needle
@@ -2500,7 +2500,7 @@  discard block
 block discarded – undo
2500 2500
 
2501 2501
             if ($return_string) {
2502 2502
                 if (!empty($position) && !empty($my_ranking)) {
2503
-                    $return_value = $position . '/' . count($my_ranking);
2503
+                    $return_value = $position.'/'.count($my_ranking);
2504 2504
                 } else {
2505 2505
                     $return_value = '-';
2506 2506
                 }
@@ -2580,7 +2580,7 @@  discard block
 block discarded – undo
2580 2580
 
2581 2581
             if ($return_string) {
2582 2582
                 if (!empty($position) && !empty($my_ranking)) {
2583
-                    return $position . '/' . count($my_ranking);
2583
+                    return $position.'/'.count($my_ranking);
2584 2584
                 }
2585 2585
             }
2586 2586
             return $return_value;
@@ -2980,7 +2980,7 @@  discard block
 block discarded – undo
2980 2980
             $courseCondition = "
2981 2981
             INNER JOIN $courseUser cu
2982 2982
             ON cu.c_id = c.id AND cu.user_id  = exe_user_id";
2983
-            $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT;
2983
+            $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT;
2984 2984
         } else {
2985 2985
             $courseCondition = "
2986 2986
             INNER JOIN $courseUserSession cu
@@ -3056,7 +3056,7 @@  discard block
 block discarded – undo
3056 3056
             $courseCondition = "
3057 3057
             INNER JOIN $courseUser cu
3058 3058
             ON cu.c_id = c.id AND cu.user_id  = exe_user_id";
3059
-            $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT;
3059
+            $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT;
3060 3060
         } else {
3061 3061
             $courseCondition = "
3062 3062
             INNER JOIN $courseUserSession cu
@@ -3148,7 +3148,7 @@  discard block
 block discarded – undo
3148 3148
             $courseCondition = "
3149 3149
             INNER JOIN $courseUser cu
3150 3150
             ON cu.c_id = c.id AND cu.user_id  = exe_user_id";
3151
-            $courseConditionWhere = " AND relation_type <> 2 AND cu.status = " . STUDENT;
3151
+            $courseConditionWhere = " AND relation_type <> 2 AND cu.status = ".STUDENT;
3152 3152
         } else {
3153 3153
             $courseCondition = "
3154 3154
             INNER JOIN $courseUserSession cu
@@ -3330,7 +3330,7 @@  discard block
 block discarded – undo
3330 3330
                 }
3331 3331
             }
3332 3332
             // adds the correct word, followed by ] to close the blank
3333
-            $answer .= ' / <font color="green"><b>' . $real_correct_tags[$i] . '</b></font>]';
3333
+            $answer .= ' / <font color="green"><b>'.$real_correct_tags[$i].'</b></font>]';
3334 3334
             if (isset ($real_text[$i + 1])) {
3335 3335
                 $answer .= $real_text[$i + 1];
3336 3336
             }
@@ -3390,13 +3390,13 @@  discard block
 block discarded – undo
3390 3390
         // check the default value of option
3391 3391
         $tabSelected = array($in_default => " selected='selected' ");
3392 3392
         $res = "";
3393
-        $res .= "<select name='$in_name' id='$in_name' onchange='" . $in_onchange . "' >";
3394
-        $res .= "<option value='-1'" . $tabSelected["-1"] . ">-- " . get_lang(
3393
+        $res .= "<select name='$in_name' id='$in_name' onchange='".$in_onchange."' >";
3394
+        $res .= "<option value='-1'".$tabSelected["-1"].">-- ".get_lang(
3395 3395
                 'AllGroups'
3396
-            ) . " --</option>";
3397
-        $res .= "<option value='0'" . $tabSelected["0"] . ">- " . get_lang(
3396
+            )." --</option>";
3397
+        $res .= "<option value='0'".$tabSelected["0"].">- ".get_lang(
3398 3398
                 'NotInAGroup'
3399
-            ) . " -</option>";
3399
+            )." -</option>";
3400 3400
         $tabGroups = GroupManager::get_group_list();
3401 3401
         $currentCatId = 0;
3402 3402
         for ($i = 0; $i < count($tabGroups); $i++) {
@@ -3404,10 +3404,10 @@  discard block
 block discarded – undo
3404 3404
                 $tabGroups[$i]["id"]
3405 3405
             );
3406 3406
             if ($tabCategory["id"] != $currentCatId) {
3407
-                $res .= "<option value='-1' disabled='disabled'>" . $tabCategory["title"] . "</option>";
3407
+                $res .= "<option value='-1' disabled='disabled'>".$tabCategory["title"]."</option>";
3408 3408
                 $currentCatId = $tabCategory["id"];
3409 3409
             }
3410
-            $res .= "<option " . $tabSelected[$tabGroups[$i]["id"]] . "style='margin-left:40px' value='" . $tabGroups[$i]["id"] . "'>" . $tabGroups[$i]["name"] . "</option>";
3410
+            $res .= "<option ".$tabSelected[$tabGroups[$i]["id"]]."style='margin-left:40px' value='".$tabGroups[$i]["id"]."'>".$tabGroups[$i]["name"]."</option>";
3411 3411
         }
3412 3412
         $res .= "</select>";
3413 3413
         return $res;
@@ -3612,14 +3612,14 @@  discard block
 block discarded – undo
3612 3612
                 if ($show_results) {
3613 3613
                     $comnt = Event::get_comments($exe_id, $questionId);
3614 3614
                     if (!empty($comnt)) {
3615
-                        echo '<b>' . get_lang('Feedback') . '</b>';
3616
-                        echo '<div id="question_feedback">' . $comnt . '</div>';
3615
+                        echo '<b>'.get_lang('Feedback').'</b>';
3616
+                        echo '<div id="question_feedback">'.$comnt.'</div>';
3617 3617
                     }
3618 3618
                 }
3619 3619
 
3620 3620
                 if ($show_results) {
3621 3621
                     $score = array(
3622
-                        'result' => get_lang('Score') . " : " . self::show_score(
3622
+                        'result' => get_lang('Score')." : ".self::show_score(
3623 3623
                                 $my_total_score,
3624 3624
                                 $my_total_weight,
3625 3625
                                 false,
@@ -3693,13 +3693,13 @@  discard block
 block discarded – undo
3693 3693
         }
3694 3694
 
3695 3695
         if ($show_all_but_expected_answer) {
3696
-            $exercise_content .= "<div class='normal-message'>" . get_lang(
3696
+            $exercise_content .= "<div class='normal-message'>".get_lang(
3697 3697
                     "ExerciseWithFeedbackWithoutCorrectionComment"
3698
-                ) . "</div>";
3698
+                )."</div>";
3699 3699
         }
3700 3700
         // Remove audio auto play from questions on results page - refs BT#7939
3701 3701
         $exercise_content = preg_replace(
3702
-            ['/autoplay[\=\".+\"]+/','/autostart[\=\".+\"]+/'],
3702
+            ['/autoplay[\=\".+\"]+/', '/autostart[\=\".+\"]+/'],
3703 3703
             '',
3704 3704
             $exercise_content
3705 3705
         );
@@ -3793,11 +3793,11 @@  discard block
 block discarded – undo
3793 3793
                     $ribbon_total_success_or_error = ' ribbon-total-error';
3794 3794
                 }
3795 3795
             }
3796
-            $ribbon .= '<div class="total ' . $ribbon_total_success_or_error . '">';
3796
+            $ribbon .= '<div class="total '.$ribbon_total_success_or_error.'">';
3797 3797
         } else {
3798 3798
             $ribbon .= '<div class="total">';
3799 3799
         }
3800
-        $ribbon .= '<h3>' . get_lang('YourTotalScore') . ":&nbsp;";
3800
+        $ribbon .= '<h3>'.get_lang('YourTotalScore').":&nbsp;";
3801 3801
         $ribbon .= self::show_score($score, $weight, false, true);
3802 3802
 
3803 3803
         $ribbon .= '</h3>';
Please login to merge, or discard this patch.
main/inc/lib/export.lib.inc.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
      * @param string Name of common tag to place each line in
158 158
      * @param string Name of the root element. A root element should always be given.
159 159
      * @param string Encoding in which the data is provided
160
-     * @return void  Prompts the user for a file download
160
+     * @return boolean  Prompts the user for a file download
161 161
      */
162 162
     public static function export_complex_table_xml(
163 163
         $data,
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
      * @param string $name
284 284
      * @param string $format
285 285
      *
286
-     * @return bool
286
+     * @return false|null
287 287
      */
288 288
     public static function htmlToOdt($html, $name, $format = 'odt')
289 289
     {
Please login to merge, or discard this patch.
Unused Use Statements   -6 removed lines patch added patch discarded remove patch
@@ -3,14 +3,8 @@
 block discarded – undo
3 3
 
4 4
 use Ddeboer\DataImport\Writer\ExcelWriter;
5 5
 use Ddeboer\DataImport\Writer\CsvWriter;
6
-use Ddeboer\DataImport\Workflow;
7
-
8
-use Ddeboer\DataImport\Reader\CsvReader;
9
-use Ddeboer\DataImport\Reader\ArrayReader;
10
-use Ddeboer\DataImport\Writer\ArrayWriter;
11 6
 use Chamilo\CoreBundle\Component\Editor\Connector;
12 7
 use Chamilo\CoreBundle\Component\Filesystem\Data;
13
-use ChamiloSession as Session;
14 8
 use MediaAlchemyst\Alchemyst;
15 9
 use MediaAlchemyst\DriversContainer;
16 10
 use Neutron\TemporaryFilesystem\Manager;
Please login to merge, or discard this patch.
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 
57 57
         DocumentManager::file_send_for_download($filePath, true, $filename.'.csv');
58 58
         exit;
59
-	}
59
+    }
60 60
 
61 61
     /**
62 62
      * Export tabular data to XLS-file
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 
80 80
         DocumentManager::file_send_for_download($filePath, true, $filename.'.xlsx');
81 81
         exit;
82
-	}
82
+    }
83 83
 
84 84
     /**
85 85
      * Export tabular data to XLS-file (as html table)
@@ -112,13 +112,13 @@  discard block
 block discarded – undo
112 112
     }
113 113
 
114 114
     /**
115
-    * Export tabular data to XML-file
116
-    * @param array  Simple array of data to put in XML
117
-    * @param string Name of file to be given to the user
118
-    * @param string Name of common tag to place each line in
119
-    * @param string Name of the root element. A root element should always be given.
120
-    * @param string Encoding in which the data is provided
121
-    */
115
+     * Export tabular data to XML-file
116
+     * @param array  Simple array of data to put in XML
117
+     * @param string Name of file to be given to the user
118
+     * @param string Name of common tag to place each line in
119
+     * @param string Name of the root element. A root element should always be given.
120
+     * @param string Encoding in which the data is provided
121
+     */
122 122
     public static function arrayToXml(
123 123
         $data,
124 124
         $filename = 'export',
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
         fclose($handle);
149 149
         DocumentManager :: file_send_for_download($file, true, $filename.'.xml');
150 150
         exit;
151
-	}
151
+    }
152 152
 
153 153
     /**
154 154
      * Export hierarchical tabular data to XML-file
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
         foreach ($data as $row) {
198 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";
200
+                $string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n";
201 201
                 $string .= str_repeat("\t",$level).'</'.$row['name'].'>';
202 202
             } else {
203 203
                 $string .= $row['value'];
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         $writer->setStream(fopen($filePath, 'w'));
51 51
 
52 52
         foreach ($data as $item) {
53
-            $item = is_array($item) ? $item : (array)$item;
53
+            $item = is_array($item) ? $item : (array) $item;
54 54
             $writer->writeItem($item);
55 55
         }
56 56
         $writer->finish();
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
         }
101 101
         foreach ($data as $row) {
102 102
             $string = implode("</td><td>", $row);
103
-            $string = '<tr><td>' . $string . '</td></tr>';
103
+            $string = '<tr><td>'.$string.'</td></tr>';
104 104
             if ($encoding != 'utf-8') {
105 105
                 $string = api_convert_encoding($string, $encoding, $systemEncoding);
106 106
             }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
             fwrite($handle, '<'.$wrapper_tagname.'>');
175 175
         }
176 176
         $s = self::_export_complex_table_xml_helper($data);
177
-        fwrite($handle,$s);
177
+        fwrite($handle, $s);
178 178
         if (!is_null($wrapper_tagname)) {
179 179
             fwrite($handle, '</'.$wrapper_tagname.'>'."\n");
180 180
         }
@@ -196,10 +196,10 @@  discard block
 block discarded – undo
196 196
         }
197 197
         $string = '';
198 198
         foreach ($data as $row) {
199
-            $string .= "\n".str_repeat("\t",$level).'<'.$row['name'].'>';
199
+            $string .= "\n".str_repeat("\t", $level).'<'.$row['name'].'>';
200 200
             if (is_array($row['value'])) {
201
-            	$string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n";
202
-                $string .= str_repeat("\t",$level).'</'.$row['name'].'>';
201
+            	$string .= self::_export_complex_table_xml_helper($row['value'], $level + 1)."\n";
202
+                $string .= str_repeat("\t", $level).'</'.$row['name'].'>';
203 203
             } else {
204 204
                 $string .= $row['value'];
205 205
                 $string .= '</'.$row['name'].'>';
Please login to merge, or discard this patch.
main/inc/lib/extra_field.lib.php 3 patches
Doc Comments   +8 added lines, -9 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     }
124 124
 
125 125
     /**
126
-     * @return array
126
+     * @return string[]
127 127
      */
128 128
     public static function getValidExtraFieldTypes()
129 129
     {
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 
200 200
     /**
201 201
      * @param array $conditions
202
-     * @param null  $order_field_options_by
202
+     * @param string  $order_field_options_by
203 203
      *
204 204
      * @return array
205 205
      */
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
     /**
238 238
      * @param string $variable
239 239
      *
240
-     * @return array|bool
240
+     * @return integer
241 241
      */
242 242
     public function get_handler_field_info_by_field_variable($variable)
243 243
     {
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
     /**
320 320
      * @param string $handler
321 321
      *
322
-     * @return array
322
+     * @return string[]
323 323
      */
324 324
     public static function get_extra_fields_by_handler($handler)
325 325
     {
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
     }
497 497
 
498 498
     /**
499
-     * @return array
499
+     * @return string[]
500 500
      */
501 501
     public function get_field_types()
502 502
     {
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
     /**
507 507
      * @param int $id
508 508
      *
509
-     * @return null
509
+     * @return string|null
510 510
      */
511 511
     public function get_field_type_by_id($id)
512 512
     {
@@ -691,7 +691,6 @@  discard block
 block discarded – undo
691 691
      * @param FormValidator $form
692 692
      * @param array $extraData
693 693
      * @param bool $admin_permissions
694
-     * @param int $user_id
695 694
      * @param array $extra
696 695
      * @param int $itemId
697 696
      * @param array $exclude variables of extra field to exclude
@@ -1592,7 +1591,7 @@  discard block
 block discarded – undo
1592 1591
     }
1593 1592
 
1594 1593
     /**
1595
-     * @return array
1594
+     * @return string[]
1596 1595
      */
1597 1596
     public function getJqgridColumnNames()
1598 1597
     {
@@ -1832,7 +1831,7 @@  discard block
 block discarded – undo
1832 1831
     }
1833 1832
 
1834 1833
     /**
1835
-     * @param array $columns
1834
+     * @param string[] $columns
1836 1835
      * @param array  $column_model
1837 1836
      * @param array  $extraFields
1838 1837
      * @return array
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
         'changeable',
20 20
         'filter',
21 21
         'extra_field_type',
22
-         /* Enable this when field_loggeable is introduced as a table field (2.0)
22
+            /* Enable this when field_loggeable is introduced as a table field (2.0)
23 23
         'field_loggeable',
24 24
          */
25 25
         'created_at'
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
      * France:Paris;Bretagne;Marseilles;Lyon|Belgique:Bruxelles;Namur;Liège;Bruges|Peru:Lima;Piura;
524 524
      * into
525 525
      * array(
526
- *      'France' =>
526
+     *      'France' =>
527 527
      *      array('Paris', 'Bregtane', 'Marseilles'),
528 528
      *  'Belgique' =>
529 529
      *      array('Namur', 'Liège')
@@ -1184,7 +1184,7 @@  discard block
 block discarded – undo
1184 1184
 
1185 1185
                         if ($this->type == 'user') {
1186 1186
 
1187
-                           /* //the magic should be here
1187
+                            /* //the magic should be here
1188 1188
                             $user_tags = UserManager::get_user_tags($user_id, $field_details[0]);
1189 1189
 
1190 1190
                             $tag_list = '';
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -26,19 +26,19 @@  discard block
 block discarded – undo
26 26
     );
27 27
 
28 28
     public $ops = array(
29
-        'eq' => '=',        //equal
30
-        'ne' => '<>',       //not equal
31
-        'lt' => '<',        //less than
32
-        'le' => '<=',       //less than or equal
33
-        'gt' => '>',        //greater than
34
-        'ge' => '>=',       //greater than or equal
35
-        'bw' => 'LIKE',     //begins with
29
+        'eq' => '=', //equal
30
+        'ne' => '<>', //not equal
31
+        'lt' => '<', //less than
32
+        'le' => '<=', //less than or equal
33
+        'gt' => '>', //greater than
34
+        'ge' => '>=', //greater than or equal
35
+        'bw' => 'LIKE', //begins with
36 36
         'bn' => 'NOT LIKE', //doesn't begin with
37
-        'in' => 'LIKE',     //is in
37
+        'in' => 'LIKE', //is in
38 38
         'ni' => 'NOT LIKE', //is not in
39
-        'ew' => 'LIKE',     //ends with
39
+        'ew' => 'LIKE', //ends with
40 40
         'en' => 'NOT LIKE', //doesn't end with
41
-        'cn' => 'LIKE',     //contains
41
+        'cn' => 'LIKE', //contains
42 42
         'nc' => 'NOT LIKE'  //doesn't contain
43 43
     );
44 44
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
      */
324 324
     public static function get_extra_fields_by_handler($handler)
325 325
     {
326
-        $types= array();
326
+        $types = array();
327 327
         $types[self::FIELD_TYPE_TEXT] = get_lang('FieldTypeText');
328 328
         $types[self::FIELD_TYPE_TEXTAREA] = get_lang('FieldTypeTextarea');
329 329
         $types[self::FIELD_TYPE_RADIO] = get_lang('FieldTypeRadio');
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
                         // chzn-select doesn't work for sessions??
963 963
                         $form->addElement(
964 964
                             'select',
965
-                            'extra_' . $field_details['variable'],
965
+                            'extra_'.$field_details['variable'],
966 966
                             $field_details['display_text'],
967 967
                             $options,
968 968
                             array('id' => 'extra_'.$field_details['variable'])
@@ -1021,7 +1021,7 @@  discard block
 block discarded – undo
1021 1021
 
1022 1022
                         if (!$admin_permissions) {
1023 1023
                             if ($field_details['visible'] == 0) {
1024
-                                $form->freeze('extra_' . $field_details['variable']);
1024
+                                $form->freeze('extra_'.$field_details['variable']);
1025 1025
                             }
1026 1026
                         }
1027 1027
                         break;
@@ -1369,9 +1369,9 @@  discard block
 block discarded – undo
1369 1369
 
1370 1370
                         if (is_array($extraData) && array_key_exists($fieldVariable, $extraData)) {
1371 1371
 
1372
-                            if (file_exists(api_get_path(SYS_UPLOAD_PATH) . $extraData[$fieldVariable])) {
1372
+                            if (file_exists(api_get_path(SYS_UPLOAD_PATH).$extraData[$fieldVariable])) {
1373 1373
                                 $fieldTexts[] = Display::img(
1374
-                                    api_get_path(WEB_UPLOAD_PATH) . $extraData[$fieldVariable],
1374
+                                    api_get_path(WEB_UPLOAD_PATH).$extraData[$fieldVariable],
1375 1375
                                     $field_details['display_text'],
1376 1376
                                     array('width' => '300')
1377 1377
                                 );
@@ -1388,10 +1388,10 @@  discard block
 block discarded – undo
1388 1388
                         $form->applyFilter('extra_'.$field_details['variable'], 'stripslashes');
1389 1389
                         $form->applyFilter('extra_'.$field_details['variable'], 'trim');
1390 1390
 
1391
-                        $allowed_picture_types = array ('jpg', 'jpeg', 'png', 'gif');
1391
+                        $allowed_picture_types = array('jpg', 'jpeg', 'png', 'gif');
1392 1392
                         $form->addRule(
1393 1393
                             'extra_'.$field_details['variable'],
1394
-                            get_lang('OnlyImagesAllowed') . ' ('.implode(',', $allowed_picture_types).')',
1394
+                            get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')',
1395 1395
                             'filetype',
1396 1396
                             $allowed_picture_types
1397 1397
                         );
@@ -1433,10 +1433,10 @@  discard block
 block discarded – undo
1433 1433
                         if (is_array($extraData) &&
1434 1434
                             array_key_exists($fieldVariable, $extraData)
1435 1435
                         ) {
1436
-                            if (file_exists(api_get_path(SYS_UPLOAD_PATH) . $extraData[$fieldVariable])) {
1436
+                            if (file_exists(api_get_path(SYS_UPLOAD_PATH).$extraData[$fieldVariable])) {
1437 1437
                                 $fieldTexts[] = Display::url(
1438
-                                    api_get_path(WEB_UPLOAD_PATH) . $extraData[$fieldVariable],
1439
-                                    api_get_path(WEB_UPLOAD_PATH) . $extraData[$fieldVariable],
1438
+                                    api_get_path(WEB_UPLOAD_PATH).$extraData[$fieldVariable],
1439
+                                    api_get_path(WEB_UPLOAD_PATH).$extraData[$fieldVariable],
1440 1440
                                     array(
1441 1441
                                         'title' => $field_details['display_text'],
1442 1442
                                         'target' => '_blank'
@@ -1486,12 +1486,12 @@  discard block
 block discarded – undo
1486 1486
                             "extra_{$field_details['variable']}",
1487 1487
                             $field_details['display_text']
1488 1488
                         );
1489
-                        $form->applyFilter('extra_' . $field_details['variable'], 'stripslashes');
1489
+                        $form->applyFilter('extra_'.$field_details['variable'], 'stripslashes');
1490 1490
 
1491 1491
                         if (!$admin_permissions) {
1492 1492
                             if ($field_details['visible'] == 0) {
1493 1493
                                 $form->freeze(
1494
-                                    'extra_' . $field_details['variable']
1494
+                                    'extra_'.$field_details['variable']
1495 1495
                                 );
1496 1496
                             }
1497 1497
                         }
@@ -1502,13 +1502,13 @@  discard block
 block discarded – undo
1502 1502
                             $field_details['display_text']
1503 1503
                         );
1504 1504
                         $form->applyFilter(
1505
-                            'extra_' . $field_details['variable'],
1505
+                            'extra_'.$field_details['variable'],
1506 1506
                             'stripslashes'
1507 1507
                         );
1508 1508
                         if (!$admin_permissions) {
1509 1509
                             if ($field_details['visible'] == 0) {
1510 1510
                                 $form->freeze(
1511
-                                    'extra_' . $field_details['variable']
1511
+                                    'extra_'.$field_details['variable']
1512 1512
                                 );
1513 1513
                             }
1514 1514
                         }
@@ -1518,12 +1518,12 @@  discard block
 block discarded – undo
1518 1518
                             "extra_{$field_details['variable']}",
1519 1519
                             $field_details['display_text']
1520 1520
                         );
1521
-                        $form->applyFilter('extra_' . $field_details['variable'], 'stripslashes');
1521
+                        $form->applyFilter('extra_'.$field_details['variable'], 'stripslashes');
1522 1522
 
1523 1523
                         if (!$admin_permissions) {
1524 1524
                             if ($field_details['visible'] == 0) {
1525 1525
                                 $form->freeze(
1526
-                                    'extra_' . $field_details['variable']
1526
+                                    'extra_'.$field_details['variable']
1527 1527
                                 );
1528 1528
                             }
1529 1529
                         }
@@ -1534,13 +1534,13 @@  discard block
 block discarded – undo
1534 1534
                             $field_details['display_text']
1535 1535
                         );
1536 1536
                         $form->applyFilter(
1537
-                            'extra_' . $field_details['variable'],
1537
+                            'extra_'.$field_details['variable'],
1538 1538
                             'stripslashes'
1539 1539
                         );
1540 1540
                         if (!$admin_permissions) {
1541 1541
                             if ($field_details['visible'] == 0) {
1542 1542
                                 $form->freeze(
1543
-                                    'extra_' . $field_details['variable']
1543
+                                    'extra_'.$field_details['variable']
1544 1544
                                 );
1545 1545
                             }
1546 1546
                         }
@@ -2221,19 +2221,19 @@  discard block
 block discarded – undo
2221 2221
                         break;
2222 2222
                     }
2223 2223
 
2224
-                    if (!file_exists(api_get_path(SYS_UPLOAD_PATH) . $valueData['value'])) {
2224
+                    if (!file_exists(api_get_path(SYS_UPLOAD_PATH).$valueData['value'])) {
2225 2225
                         break;
2226 2226
                     }
2227 2227
 
2228 2228
                     $image = Display::img(
2229
-                        api_get_path(WEB_UPLOAD_PATH) . $valueData['value'],
2229
+                        api_get_path(WEB_UPLOAD_PATH).$valueData['value'],
2230 2230
                         $field['display_text'],
2231 2231
                         array('width' => '300')
2232 2232
                     );
2233 2233
 
2234 2234
                     $displayedValue = Display::url(
2235 2235
                         $image,
2236
-                        api_get_path(WEB_UPLOAD_PATH) . $valueData['value'],
2236
+                        api_get_path(WEB_UPLOAD_PATH).$valueData['value'],
2237 2237
                         array('target' => '_blank')
2238 2238
                     );
2239 2239
                     break;
@@ -2242,13 +2242,13 @@  discard block
 block discarded – undo
2242 2242
                         break;
2243 2243
                     }
2244 2244
 
2245
-                    if (!file_exists(api_get_path(SYS_UPLOAD_PATH) . $valueData['value'])) {
2245
+                    if (!file_exists(api_get_path(SYS_UPLOAD_PATH).$valueData['value'])) {
2246 2246
                         break;
2247 2247
                     }
2248 2248
 
2249 2249
                     $displayedValue = Display::url(
2250 2250
                         get_lang('Download'),
2251
-                        api_get_path(WEB_UPLOAD_PATH) . $valueData['value'],
2251
+                        api_get_path(WEB_UPLOAD_PATH).$valueData['value'],
2252 2252
                         array(
2253 2253
                             'title' => $field['display_text'],
2254 2254
                             'target' => '_blank'
Please login to merge, or discard this patch.