Completed
Push — 1.11.x ( 8330c8...fa802f )
by José
74:15 queued 40:10
created
main/inc/lib/online.inc.php 3 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -208,6 +208,8 @@  discard block
 block discarded – undo
208 208
 }
209 209
 /**
210 210
  * Gives a list of people online now (and in the last $valid minutes)
211
+ * @param integer $from
212
+ * @param integer $time_limit
211 213
  * @return  array       For each line, a list of user IDs and login dates, or FALSE on error or empty results
212 214
  */
213 215
 function who_is_online($from, $number_of_items, $column = null, $direction = null, $time_limit = null, $friends = false)
@@ -424,6 +426,9 @@  discard block
 block discarded – undo
424 426
 	}
425 427
 }
426 428
 
429
+/**
430
+ * @param integer $uid
431
+ */
427 432
 function who_is_online_in_this_course_count($uid, $time_limit, $coursecode=null)
428 433
 {
429 434
 	if (empty($coursecode)) {
Please login to merge, or discard this patch.
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -290,8 +290,8 @@  discard block
 block discarded – undo
290 290
         }
291 291
     }
292 292
 
293
-	//This query will show all registered users. Only for dev purposes.
294
-	/*$query = "SELECT DISTINCT u.id as login_user_id, login_date FROM ".$track_online_table ."  e , $table_user u
293
+    //This query will show all registered users. Only for dev purposes.
294
+    /*$query = "SELECT DISTINCT u.id as login_user_id, login_date FROM ".$track_online_table ."  e , $table_user u
295 295
             GROUP by u.id
296 296
             ORDER BY $column $direction
297 297
             LIMIT $from, $number_of_items";*/
@@ -317,15 +317,15 @@  discard block
 block discarded – undo
317 317
     } else {
318 318
         $time_limit = intval($time_limit);
319 319
     }
320
-	$track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
321
-	$friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
322
-	$table_user = Database::get_main_table(TABLE_MAIN_USER);
323
-	$online_time = time() - $time_limit * 60;
324
-	$current_date = api_get_utc_datetime($online_time);
325
-
326
-	if ($friends) {
327
-		// 	who friends from social network is online
328
-		$query = "SELECT DISTINCT count(login_user_id) as count
320
+    $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
321
+    $friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
322
+    $table_user = Database::get_main_table(TABLE_MAIN_USER);
323
+    $online_time = time() - $time_limit * 60;
324
+    $current_date = api_get_utc_datetime($online_time);
325
+
326
+    if ($friends) {
327
+        // 	who friends from social network is online
328
+        $query = "SELECT DISTINCT count(login_user_id) as count
329 329
 				  FROM $track_online_table INNER JOIN $friend_user_table
330 330
                   ON (friend_user_id = login_user_id)
331 331
 				  WHERE
@@ -333,20 +333,20 @@  discard block
 block discarded – undo
333 333
 				        friend_user_id <> '".api_get_user_id()."' AND
334 334
 				        relation_type='".USER_RELATION_TYPE_FRIEND."' AND
335 335
 				        user_id = '".api_get_user_id()."' ";
336
-	} else {
337
-		// All users online
338
-		$query = "SELECT count(login_id) as count
336
+    } else {
337
+        // All users online
338
+        $query = "SELECT count(login_id) as count
339 339
                   FROM $track_online_table track INNER JOIN $table_user u
340 340
                   ON (u.id=track.login_user_id)
341 341
                   WHERE u.status != ".ANONYMOUS." AND login_date >= '$current_date'  ";
342
-	}
343
-
344
-	if (api_get_multiple_access_url()) {
345
-		$access_url_id = api_get_current_access_url_id();
346
-		if ($access_url_id != -1) {
347
-			if ($friends) {
348
-				// 	friends from social network is online
349
-				$query = "SELECT DISTINCT count(login_user_id) as count
342
+    }
343
+
344
+    if (api_get_multiple_access_url()) {
345
+        $access_url_id = api_get_current_access_url_id();
346
+        if ($access_url_id != -1) {
347
+            if ($friends) {
348
+                // 	friends from social network is online
349
+                $query = "SELECT DISTINCT count(login_user_id) as count
350 350
 							FROM $track_online_table track
351 351
 							INNER JOIN $friend_user_table ON (friend_user_id = login_user_id)
352 352
 							WHERE
@@ -354,29 +354,29 @@  discard block
 block discarded – undo
354 354
 							    login_date >= '".$current_date."' AND
355 355
 							    friend_user_id <> '".api_get_user_id()."' AND
356 356
 							    relation_type='".USER_RELATION_TYPE_FRIEND."'  ";
357
-			} else {
358
-				// all users online
359
-				$query = "SELECT count(login_id) as count FROM $track_online_table  track
357
+            } else {
358
+                // all users online
359
+                $query = "SELECT count(login_id) as count FROM $track_online_table  track
360 360
                           INNER JOIN $table_user u ON (u.id=track.login_user_id)
361 361
 						  WHERE
362 362
 						    u.status != ".ANONYMOUS." AND
363 363
 						    track.access_url_id =  $access_url_id AND
364 364
 						    login_date >= '$current_date' ";
365
-			}
366
-		}
367
-	}
365
+            }
366
+        }
367
+    }
368 368
 
369 369
     // Dev purposes show all users online
370 370
     /*$table_user = Database::get_main_table(TABLE_MAIN_USER);
371 371
     $query = "SELECT count(*)  as count FROM ".$table_user;*/
372 372
 
373
-	$result = Database::query($query);
374
-	if (Database::num_rows($result) > 0) {
375
-		$row = Database::fetch_array($result);
376
-		return $row['count'];
377
-	} else {
378
-		return false;
379
-	}
373
+    $result = Database::query($query);
374
+    if (Database::num_rows($result) > 0) {
375
+        $row = Database::fetch_array($result);
376
+        return $row['count'];
377
+    } else {
378
+        return false;
379
+    }
380 380
 }
381 381
 
382 382
 
@@ -404,52 +404,52 @@  discard block
 block discarded – undo
404 404
     $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
405 405
     $course_code = Database::escape_string($course_code);
406 406
     $courseInfo = api_get_course_info($course_code);
407
-	$courseId = $courseInfo['real_id'];
407
+    $courseId = $courseInfo['real_id'];
408 408
 
409 409
     $from = intval($from);
410 410
     $number_of_items = intval($number_of_items);
411 411
 
412
-	$query = "SELECT login_user_id, login_date FROM $track_online_table
412
+    $query = "SELECT login_user_id, login_date FROM $track_online_table
413 413
               WHERE login_user_id <> 2 AND c_id = $courseId AND login_date >= '$current_date'
414 414
               LIMIT $from, $number_of_items ";
415 415
 
416
-	$result = Database::query($query);
417
-	if ($result) {
418
-		$users_online = array();
416
+    $result = Database::query($query);
417
+    if ($result) {
418
+        $users_online = array();
419 419
 
420
-		while(list($login_user_id, $login_date) = Database::fetch_row($result)) {
420
+        while(list($login_user_id, $login_date) = Database::fetch_row($result)) {
421 421
             $users_online[] = $login_user_id;
422
-		}
423
-		return $users_online;
424
-	} else {
425
-		return false;
426
-	}
422
+        }
423
+        return $users_online;
424
+    } else {
425
+        return false;
426
+    }
427 427
 }
428 428
 
429 429
 function who_is_online_in_this_course_count($uid, $time_limit, $coursecode=null)
430 430
 {
431
-	if (empty($coursecode)) {
432
-		return false;
433
-	}
434
-	$track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
435
-	$time_limit = Database::escape_string($time_limit);
431
+    if (empty($coursecode)) {
432
+        return false;
433
+    }
434
+    $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
435
+    $time_limit = Database::escape_string($time_limit);
436 436
 
437 437
     $online_time = time() - $time_limit * 60;
438 438
     $current_date = api_get_utc_datetime($online_time);
439
-	$courseId = api_get_course_int_id($coursecode);
439
+    $courseId = api_get_course_int_id($coursecode);
440 440
 
441
-	if (empty($courseId)) {
442
-		return false;
443
-	}
441
+    if (empty($courseId)) {
442
+        return false;
443
+    }
444 444
 
445
-	$query = "SELECT count(login_user_id) as count
445
+    $query = "SELECT count(login_user_id) as count
446 446
               FROM $track_online_table
447 447
               WHERE login_user_id <> 2 AND c_id = $courseId AND login_date >= '$current_date' ";
448
-	$result = Database::query($query);
449
-	if (Database::num_rows($result) > 0) {
450
-		$row = Database::fetch_array($result);
451
-		return $row['count'];
452
-	} else {
453
-		return false;
454
-	}
448
+    $result = Database::query($query);
449
+    if (Database::num_rows($result) > 0) {
450
+        $row = Database::fetch_array($result);
451
+        return $row['count'];
452
+    } else {
453
+        return false;
454
+    }
455 455
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
 
33 33
         $login_date = api_get_utc_datetime();
34 34
         $access_url_id = 1;
35
-        if (api_get_multiple_access_url() && api_get_current_access_url_id()!=-1) {
35
+        if (api_get_multiple_access_url() && api_get_current_access_url_id() != -1) {
36 36
             $access_url_id = api_get_current_access_url_id();
37 37
         }
38 38
         $session_id = api_get_session_id();
39 39
         // if the $_course array exists this means we are in a course and we have to store this in the who's online table also
40 40
         // to have the x users in this course feature working
41
-        if (is_array($_course) && count($_course)>0 && !empty($_course['id'])) {
42
-            $query = "REPLACE INTO ".$online_table ." (login_id,login_user_id,login_date,user_ip, c_id, session_id, access_url_id)
41
+        if (is_array($_course) && count($_course) > 0 && !empty($_course['id'])) {
42
+            $query = "REPLACE INTO ".$online_table." (login_id,login_user_id,login_date,user_ip, c_id, session_id, access_url_id)
43 43
                       VALUES ($uid,$uid,'$login_date','$user_ip', '".$_course['real_id']."' , '$session_id' , '$access_url_id' )";
44 44
         } else {
45
-            $query = "REPLACE INTO ".$online_table ." (login_id,login_user_id,login_date,user_ip, c_id, session_id, access_url_id)
45
+            $query = "REPLACE INTO ".$online_table." (login_id,login_user_id,login_date,user_ip, c_id, session_id, access_url_id)
46 46
                       VALUES ($uid,$uid,'$login_date','$user_ip', 0, '$session_id', '$access_url_id')";
47 47
         }
48 48
         Database::query($query);
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
             $isFirstLogin = Session::read('first_user_login');
63 63
             if (empty($isFirstLogin)) {
64 64
                 $sql = "SELECT login_id FROM $table
65
-                        WHERE login_user_id = " . $userId . " LIMIT 1";
65
+                        WHERE login_user_id = ".$userId." LIMIT 1";
66 66
 
67 67
                 $result = Database::query($sql);
68 68
                 $loginData = array();
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     		ORDER BY login_date DESC
117 117
     		LIMIT 0,1";
118 118
     $q_last_connection = Database::query($sql);
119
-    if (Database::num_rows($q_last_connection)>0) {
119
+    if (Database::num_rows($q_last_connection) > 0) {
120 120
         $i_id_last_connection = Database::result($q_last_connection, 0, "login_id");
121 121
     }
122 122
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 {
167 167
     $online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
168 168
     $user_id = intval($user_id);
169
-    $query = "DELETE FROM " . $online_table . " WHERE login_user_id = $user_id";
169
+    $query = "DELETE FROM ".$online_table." WHERE login_user_id = $user_id";
170 170
     Database::query($query);
171 171
 }
172 172
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
     $access_url_id = api_get_current_access_url_id();
183 183
     $time_limit = api_get_setting('time_limit_whosonline');
184 184
 
185
-    $online_time = time() - $time_limit*60;
185
+    $online_time = time() - $time_limit * 60;
186 186
     $limit_date = api_get_utc_datetime($online_time);
187 187
     $user_id = intval($user_id);
188 188
 
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
     $current_date = api_get_utc_datetime($online_time);
240 240
     $track_online_table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ONLINE);
241 241
     $friend_user_table = Database::get_main_table(TABLE_MAIN_USER_REL_USER);
242
-    $table_user	= Database::get_main_table(TABLE_MAIN_USER);
242
+    $table_user = Database::get_main_table(TABLE_MAIN_USER);
243 243
 
244 244
     if ($friends) {
245 245
         // 	who friends from social network is online
@@ -255,8 +255,8 @@  discard block
 block discarded – undo
255 255
                   LIMIT $from, $number_of_items";
256 256
     } else {
257 257
         $query = "SELECT DISTINCT login_user_id, login_date
258
-                    FROM ".$track_online_table ." e
259
-                    INNER JOIN ".$table_user ." u ON (u.id = e.login_user_id)
258
+                    FROM ".$track_online_table." e
259
+                    INNER JOIN ".$table_user." u ON (u.id = e.login_user_id)
260 260
                   WHERE u.status != ".ANONYMOUS." AND login_date >= '".$current_date."'
261 261
                   ORDER BY $column $direction
262 262
                   LIMIT $from, $number_of_items";
@@ -279,8 +279,8 @@  discard block
 block discarded – undo
279 279
             } else {
280 280
                 // all users online
281 281
                 $query = "SELECT login_user_id, login_date
282
-                          FROM ".$track_online_table ." track
283
-                          INNER JOIN ".$table_user ." u
282
+                          FROM ".$track_online_table." track
283
+                          INNER JOIN ".$table_user." u
284 284
                           ON (u.id=track.login_user_id)
285 285
                           WHERE u.status != ".ANONYMOUS." AND track.access_url_id =  $access_url_id AND
286 286
                                 login_date >= '".$current_date."'
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 	if ($result) {
418 418
 		$users_online = array();
419 419
 
420
-		while(list($login_user_id, $login_date) = Database::fetch_row($result)) {
420
+		while (list($login_user_id, $login_date) = Database::fetch_row($result)) {
421 421
             $users_online[] = $login_user_id;
422 422
 		}
423 423
 		return $users_online;
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 	}
427 427
 }
428 428
 
429
-function who_is_online_in_this_course_count($uid, $time_limit, $coursecode=null)
429
+function who_is_online_in_this_course_count($uid, $time_limit, $coursecode = null)
430 430
 {
431 431
 	if (empty($coursecode)) {
432 432
 		return false;
Please login to merge, or discard this patch.
main/inc/lib/plugin.class.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 
144 144
     /**
145 145
      * Returns the contents of the CSS defined by the plugin
146
-     * @return array
146
+     * @return string
147 147
      */
148 148
     public function get_css()
149 149
     {
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
     /**
163 163
      * Returns an HTML form (generated by FormValidator) of the plugin settings
164
-     * @return string FormValidator-generated form
164
+     * @return FormValidator FormValidator-generated form
165 165
      */
166 166
     public function get_settings_form()
167 167
     {
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
      * @param boolean $add_tool_link Whether to add a tool link or not
384 384
      * (some tools might just offer a configuration section and act on the backend)
385 385
      *
386
-     * @return boolean  False on error, null otherwise
386
+     * @return boolean|null  False on error, null otherwise
387 387
      */
388 388
     public function install_course_fields($courseId, $add_tool_link = true)
389 389
     {
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
      * tool on the course's homepage
492 492
      * @param int $courseId
493 493
      *
494
-     * @return void
494
+     * @return false|null
495 495
      */
496 496
     public function uninstall_course_fields($courseId)
497 497
     {
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
     * @param string   $tabName
597 597
     * @param string   $url
598 598
     *
599
-    * @return boolean
599
+    * @return false|string
600 600
     */
601 601
     public function addTab($tabName, $url)
602 602
     {
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -591,13 +591,13 @@
 block discarded – undo
591 591
 
592 592
     }
593 593
 
594
-   /**
595
-    * Add a tab to platform
596
-    * @param string   $tabName
597
-    * @param string   $url
598
-    *
599
-    * @return boolean
600
-    */
594
+    /**
595
+     * Add a tab to platform
596
+     * @param string   $tabName
597
+     * @param string   $url
598
+     *
599
+     * @return boolean
600
+     */
601 601
     public function addTab($tabName, $url)
602 602
     {
603 603
         $sql = "SELECT * FROM settings_current
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         $this->fields = $settings;
61 61
 
62 62
         global $language_files;
63
-        $language_files[] = 'plugin_' . $this->get_name();
63
+        $language_files[] = 'plugin_'.$this->get_name();
64 64
     }
65 65
 
66 66
     /**
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
     {
269 269
         $settings = $this->get_settings();
270 270
         foreach ($settings as $setting) {
271
-            if ($setting['variable'] == $this->get_name() . '_' . $name) {
271
+            if ($setting['variable'] == $this->get_name().'_'.$name) {
272 272
 
273 273
                 return $setting['selected_value'];
274 274
             }
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
         if (!empty($this->course_settings)) {
405 405
             foreach ($this->course_settings as $setting) {
406 406
                 $variable = $setting['name'];
407
-                $value ='';
407
+                $value = '';
408 408
                 if (isset($setting['init_value'])) {
409 409
                     $value = $setting['init_value'];
410 410
                 }
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 
619 619
         // Avoid Tab Name Spaces
620 620
         $tabNameNoSpaces = preg_replace('/\s+/', '', $tabName);
621
-        $subkeytext = "Tabs" . $tabNameNoSpaces;
621
+        $subkeytext = "Tabs".$tabNameNoSpaces;
622 622
 
623 623
         // Check if it is already added
624 624
         $checkCondition = array(
@@ -637,7 +637,7 @@  discard block
 block discarded – undo
637 637
         }
638 638
 
639 639
         // End Check
640
-        $subkey = 'custom_tab_' . $tabNum;
640
+        $subkey = 'custom_tab_'.$tabNum;
641 641
         $attributes = array(
642 642
             'variable' => 'show_tabs',
643 643
             'subkey' => $subkey,
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 
656 656
         // Save the id
657 657
         $settings = $this->get_settings();
658
-        $setData = array (
658
+        $setData = array(
659 659
             'comment' => $subkey
660 660
         );
661 661
         $whereCondition = array(
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
                 $i = 1;
697 697
                 foreach ($tabs as $row) {
698 698
                     $attributes = array(
699
-                        'subkey' => 'custom_tab_' . $i
699
+                        'subkey' => 'custom_tab_'.$i
700 700
                     );
701 701
                     $this->updateTab($row['subkey'], $attributes);
702 702
                     $i++;
Please login to merge, or discard this patch.
main/inc/lib/plugin.lib.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -626,7 +626,7 @@
 block discarded – undo
626 626
 
627 627
     /**
628 628
      * Get first SMS plugin name
629
-     * @return string|boolean
629
+     * @return string|false
630 630
      */
631 631
     public function getSMSPluginName()
632 632
     {
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
     }
174 174
 
175 175
     /**
176
-    * @param string $pluginName
177
-    * @param int    $urlId
178
-    */
176
+     * @param string $pluginName
177
+     * @param int    $urlId
178
+     */
179 179
     public function uninstall($pluginName, $urlId = null)
180 180
     {
181 181
         if (empty($urlId)) {
@@ -252,12 +252,12 @@  discard block
 block discarded – undo
252 252
     }
253 253
 
254 254
     /**
255
-    * @param string $region
256
-    * @param string $template
257
-    * @param bool   $forced
258
-    *
259
-    * @return null|string
260
-    */
255
+     * @param string $region
256
+     * @param string $template
257
+     * @param bool   $forced
258
+     *
259
+     * @return null|string
260
+     */
261 261
     public function load_region($region, $template, $forced = false)
262 262
     {
263 263
         if ($region == 'course_tool_plugin') {
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
             // Extra options
427 427
             $plugin_settings = api_get_settings_params(
428 428
                 array(
429
-                    "subkey = ? AND category = ? AND type = ? " => array($plugin_name, 'Plugins','setting')
429
+                    "subkey = ? AND category = ? AND type = ? " => array($plugin_name, 'Plugins', 'setting')
430 430
                 )
431 431
             );
432 432
 
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
             if (!empty($obj->course_settings)) {
533 533
                 if (is_file(api_get_path(SYS_CODE_PATH).'img/icons/'.ICON_SIZE_SMALL.'/'.$plugin_name.'.png')) {
534 534
                     $icon = Display::return_icon(
535
-                        $plugin_name . '.png',
535
+                        $plugin_name.'.png',
536 536
                         Security::remove_XSS($pluginTitle),
537 537
                         '',
538 538
                         ICON_SIZE_SMALL
@@ -548,18 +548,18 @@  discard block
 block discarded – undo
548 548
 
549 549
                 $form->addHtml('<div class="panel panel-default">');
550 550
                 $form->addHtml('
551
-                    <div class="panel-heading" role="tab" id="heading-' . $plugin_name . '-settings">
551
+                    <div class="panel-heading" role="tab" id="heading-' . $plugin_name.'-settings">
552 552
                         <h4 class="panel-title">
553
-                            <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-' . $plugin_name . '-settings" aria-expanded="false" aria-controls="collapse-' . $plugin_name . '-settings">
553
+                            <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-' . $plugin_name.'-settings" aria-expanded="false" aria-controls="collapse-'.$plugin_name.'-settings">
554 554
                 ');
555
-                $form->addHtml($icon . ' ' . $pluginTitle);
555
+                $form->addHtml($icon.' '.$pluginTitle);
556 556
                 $form->addHtml('
557 557
                             </a>
558 558
                         </h4>
559 559
                     </div>
560 560
                 ');
561 561
                 $form->addHtml('
562
-                    <div id="collapse-' . $plugin_name . '-settings" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading-' . $plugin_name . '-settings">
562
+                    <div id="collapse-' . $plugin_name.'-settings" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading-'.$plugin_name.'-settings">
563 563
                         <div class="panel-body">
564 564
                 ');
565 565
 
Please login to merge, or discard this patch.
main/inc/lib/portfolio.class.php 2 patches
Doc Comments   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -126,6 +126,7 @@  discard block
 block discarded – undo
126 126
      * Returns a temporary url to download files and/or folders.
127 127
      *
128 128
      * @param string|array $ids
129
+     * @param string $tool
129 130
      * @return string
130 131
      */
131 132
     public static function download_url($ids, $tool)
@@ -293,7 +294,7 @@  discard block
 block discarded – undo
293 294
     /**
294 295
      * The name of the porfolio where to send.
295 296
      *
296
-     * @return type
297
+     * @return string
297 298
      */
298 299
     function get_portfolio()
299 300
     {
@@ -391,7 +392,6 @@  discard block
 block discarded – undo
391 392
      * Create a "send to portfolio" button
392 393
      *
393 394
      * @param string $tool          The name of the tool: document, work.
394
-     * @param int $c_id             The id of the course
395 395
      * @param int $id               The id of the object
396 396
      * @param array $attributes     Html attributes
397 397
      * @return \PortfolioShare
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
     /**
406 406
      * Returns the current secuirty token. Used to avoid see surfing attacks.
407 407
      *
408
-     * @return type
408
+     * @return string
409 409
      */
410 410
     static function security_token()
411 411
     {
@@ -420,6 +420,10 @@  discard block
 block discarded – undo
420 420
     protected $attributes = array();
421 421
     protected $tool = '';
422 422
 
423
+    /**
424
+     * @param string $tool
425
+     * @param integer $id
426
+     */
423 427
     function __construct($tool, $id, $attributes = array())
424 428
     {
425 429
         $this->tool = $tool;
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -482,14 +482,14 @@  discard block
 block discarded – undo
482 482
         $attributes['z-index'] = 100000;
483 483
         $s = ' ';
484 484
         foreach ($attributes as $key => $value) {
485
-            $s .= $key . '="' . $value . '" ';
485
+            $s .= $key.'="'.$value.'" ';
486 486
         }
487 487
 
488 488
         $result = array();
489
-        $result[] = '<span ' . $s . ' >';
489
+        $result[] = '<span '.$s.' >';
490 490
         $result[] = '<span class="dropdown" >';
491 491
         $result[] = '<a href="#" data-toggle="dropdown" class="dropdown-toggle">';
492
-        $result[] = Display::return_icon('document_send.png', get_lang('Send'), array(), ICON_SIZE_SMALL) . '<b class="caret"></b>';
492
+        $result[] = Display::return_icon('document_send.png', get_lang('Send'), array(), ICON_SIZE_SMALL).'<b class="caret"></b>';
493 493
         $result[] = '</a>';
494 494
         $result[] = '<ul class="dropdown-menu">';
495 495
 
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
             $parameters[PortfolioController::PARAM_TOOL] = $tool;
506 506
             $url = api_get_path(WEB_CODE_PATH).'portfolio/share.php?';
507 507
             $result[] = '<li>';
508
-            $result[] = '<a href="' . $url . '">' . $portfolio->get_title() . '</a>';
508
+            $result[] = '<a href="'.$url.'">'.$portfolio->get_title().'</a>';
509 509
             $result[] = '</li>';
510 510
         }
511 511
         $result[] = '</ul>';
@@ -564,8 +564,8 @@  discard block
 block discarded – undo
564 564
      */
565 565
     public function __construct($portfolio)
566 566
     {
567
-        $this->name = md5(__CLASS__) . '_' . $portfolio->get_name();
568
-        $this->title = $portfolio->get_title() ? $portfolio->get_title() : get_lang('SendTo') . ' ' . $portfolio->get_name();
567
+        $this->name = md5(__CLASS__).'_'.$portfolio->get_name();
568
+        $this->title = $portfolio->get_title() ? $portfolio->get_title() : get_lang('SendTo').' '.$portfolio->get_name();
569 569
         $this->portfolio = $portfolio;
570 570
     }
571 571
 
Please login to merge, or discard this patch.
main/inc/lib/promotion.lib.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
     }
130 130
 
131 131
     /**
132
-     * @return array
132
+     * @return string[]
133 133
      */
134 134
     public function get_status_list()
135 135
     {
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
     /**
273 273
      * @param int $id
274 274
      *
275
-     * @return bool
275
+     * @return null|false
276 276
      */
277 277
     public function delete($id)
278 278
     {
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
                     case 'updated_at':
64 64
                         break;
65 65
                     case 'name':
66
-                        $val .= ' ' . get_lang('CopyLabelSuffix');
66
+                        $val .= ' '.get_lang('CopyLabelSuffix');
67 67
                         $new[$key] = $val;
68 68
                         break;
69 69
                     case 'created_at':
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                         break;
73 73
                     case 'career_id':
74 74
                         if (!empty($career_id)) {
75
-                            $val = (int)$career_id;
75
+                            $val = (int) $career_id;
76 76
                         }
77 77
                         $new[$key] = $val;
78 78
                         break;
@@ -160,22 +160,22 @@  discard block
 block discarded – undo
160 160
     {
161 161
         // Action links
162 162
         echo '<div class="actions" style="margin-bottom:20px">';
163
-        echo '<a href="career_dashboard.php">' . Display::return_icon('back.png',
164
-                get_lang('Back'), '', '32') . '</a>';
165
-        echo '<a href="' . api_get_self() . '?action=add">' .
163
+        echo '<a href="career_dashboard.php">'.Display::return_icon('back.png',
164
+                get_lang('Back'), '', '32').'</a>';
165
+        echo '<a href="'.api_get_self().'?action=add">'.
166 166
             Display::return_icon(
167 167
                 'new_promotion.png',
168 168
                 get_lang('Add'),
169 169
                 '',
170 170
                 '32'
171
-            ) . '</a>';
172
-        echo '<a href="' . api_get_path(WEB_CODE_PATH) . 'session/session_add.php">' .
171
+            ).'</a>';
172
+        echo '<a href="'.api_get_path(WEB_CODE_PATH).'session/session_add.php">'.
173 173
             Display::return_icon(
174 174
                 'new_session.png',
175 175
                 get_lang('AddSession'),
176 176
                 '',
177 177
                 '32'
178
-            ) . '</a>';
178
+            ).'</a>';
179 179
         echo '</div>';
180 180
         echo Display::grid_html('promotions');
181 181
     }
Please login to merge, or discard this patch.
main/inc/lib/rights.lib.php 4 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -15,6 +15,10 @@
 block discarded – undo
15 15
 
16 16
 	// warning the goal of this function is to enforce rights managment in Chamilo
17 17
 	// thus default return value is always true
18
+
19
+	/**
20
+	 * @param string $handler
21
+	 */
18 22
 	public static function hasRight($handler) {
19 23
 		if (array_key_exists($handler, self::$rights_cache))
20 24
 			return self::$rights_cache[$handler];
Please login to merge, or discard this patch.
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -5,42 +5,42 @@
 block discarded – undo
5 5
  * @deprecated Don't use this class
6 6
  */
7 7
 class Rights {
8
-	private static $rights_cache = array();
9
-	private static $rights = array (
10
-		'show_tabs:reports' =>
11
-			array (
12
-				'type' => 'const',
13
-				'const' => 'true' )
14
-		);
8
+    private static $rights_cache = array();
9
+    private static $rights = array (
10
+        'show_tabs:reports' =>
11
+            array (
12
+                'type' => 'const',
13
+                'const' => 'true' )
14
+        );
15 15
 
16
-	// warning the goal of this function is to enforce rights managment in Chamilo
17
-	// thus default return value is always true
18
-	public static function hasRight($handler) {
19
-		if (array_key_exists($handler, self::$rights_cache))
20
-			return self::$rights_cache[$handler];
16
+    // warning the goal of this function is to enforce rights managment in Chamilo
17
+    // thus default return value is always true
18
+    public static function hasRight($handler) {
19
+        if (array_key_exists($handler, self::$rights_cache))
20
+            return self::$rights_cache[$handler];
21 21
 
22
-		if (!array_key_exists($handler, self::$rights))
23
-			return true; // handler does not exists
22
+        if (!array_key_exists($handler, self::$rights))
23
+            return true; // handler does not exists
24 24
 
25
-		if (self::$rights[$handler]['type'] == 'sql') {
26
-			$result = Database::query(self::$rights[$handler]['sql']);
27
-			if (Database::num_rows($result) > 0)
28
-				$result = true;
29
-			else
30
-				$result = false;
31
-		} else if (self::$rights[$handler]['type'] == 'const')
32
-			$result = self::$rights[$handler]['const'];
33
-		else if (self::$rights[$handler]['type'] == 'func')
34
-			$result = self::$rights[$handler]['func']();
35
-		else // handler type not implemented
36
-			return true;
37
-		self::$rights_cache[$handler] = $result;
38
-		return $result;
39
-	}
25
+        if (self::$rights[$handler]['type'] == 'sql') {
26
+            $result = Database::query(self::$rights[$handler]['sql']);
27
+            if (Database::num_rows($result) > 0)
28
+                $result = true;
29
+            else
30
+                $result = false;
31
+        } else if (self::$rights[$handler]['type'] == 'const')
32
+            $result = self::$rights[$handler]['const'];
33
+        else if (self::$rights[$handler]['type'] == 'func')
34
+            $result = self::$rights[$handler]['func']();
35
+        else // handler type not implemented
36
+            return true;
37
+        self::$rights_cache[$handler] = $result;
38
+        return $result;
39
+    }
40 40
 
41
-	public static function hasRightClosePageWithError($handler) {
42
-		if (hasRight($handler) == false)
43
-			die("You are not allowed here"); //FIXME
44
-	}
41
+    public static function hasRightClosePageWithError($handler) {
42
+        if (hasRight($handler) == false)
43
+            die("You are not allowed here"); //FIXME
44
+    }
45 45
 
46 46
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@
 block discarded – undo
6 6
  */
7 7
 class Rights {
8 8
 	private static $rights_cache = array();
9
-	private static $rights = array (
9
+	private static $rights = array(
10 10
 		'show_tabs:reports' =>
11
-			array (
11
+			array(
12 12
 				'type' => 'const',
13 13
 				'const' => 'true' )
14 14
 		);
Please login to merge, or discard this patch.
Braces   +23 added lines, -15 removed lines patch added patch discarded remove patch
@@ -16,31 +16,39 @@
 block discarded – undo
16 16
 	// warning the goal of this function is to enforce rights managment in Chamilo
17 17
 	// thus default return value is always true
18 18
 	public static function hasRight($handler) {
19
-		if (array_key_exists($handler, self::$rights_cache))
20
-			return self::$rights_cache[$handler];
19
+		if (array_key_exists($handler, self::$rights_cache)) {
20
+					return self::$rights_cache[$handler];
21
+		}
21 22
 
22
-		if (!array_key_exists($handler, self::$rights))
23
-			return true; // handler does not exists
23
+		if (!array_key_exists($handler, self::$rights)) {
24
+					return true;
25
+		}
26
+		// handler does not exists
24 27
 
25 28
 		if (self::$rights[$handler]['type'] == 'sql') {
26 29
 			$result = Database::query(self::$rights[$handler]['sql']);
27
-			if (Database::num_rows($result) > 0)
28
-				$result = true;
29
-			else
30
-				$result = false;
31
-		} else if (self::$rights[$handler]['type'] == 'const')
32
-			$result = self::$rights[$handler]['const'];
33
-		else if (self::$rights[$handler]['type'] == 'func')
34
-			$result = self::$rights[$handler]['func']();
35
-		else // handler type not implemented
30
+			if (Database::num_rows($result) > 0) {
31
+							$result = true;
32
+			} else {
33
+							$result = false;
34
+			}
35
+		} else if (self::$rights[$handler]['type'] == 'const') {
36
+					$result = self::$rights[$handler]['const'];
37
+		} else if (self::$rights[$handler]['type'] == 'func') {
38
+					$result = self::$rights[$handler]['func']();
39
+		} else {
40
+		    // handler type not implemented
36 41
 			return true;
42
+		}
37 43
 		self::$rights_cache[$handler] = $result;
38 44
 		return $result;
39 45
 	}
40 46
 
41 47
 	public static function hasRightClosePageWithError($handler) {
42
-		if (hasRight($handler) == false)
43
-			die("You are not allowed here"); //FIXME
48
+		if (hasRight($handler) == false) {
49
+					die("You are not allowed here");
50
+		}
51
+		//FIXME
44 52
 	}
45 53
 
46 54
 }
Please login to merge, or discard this patch.
main/inc/lib/search/ChamiloIndexer.class.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -71,6 +71,10 @@
 block discarded – undo
71 71
 
72 72
     /**
73 73
      * Get the terms stored at database
74
+     * @param string $prefix
75
+     * @param string $course_code
76
+     * @param string $tool_id
77
+     * @param integer $ref_id
74 78
      * @return  array Array of terms
75 79
      */
76 80
     function get_terms_on_db($prefix, $course_code, $tool_id, $ref_id) {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 /**
8 8
  * code
9 9
  */
10
-require_once dirname(__FILE__) . '/../../global.inc.php';
10
+require_once dirname(__FILE__).'/../../global.inc.php';
11 11
 include_once 'xapian/XapianIndexer.class.php';
12 12
 
13 13
 /**
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0))
40 40
             return FALSE;
41 41
 
42
-        require_once api_get_path(LIBRARY_PATH) . 'search/xapian/XapianQuery.php';
42
+        require_once api_get_path(LIBRARY_PATH).'search/xapian/XapianQuery.php';
43 43
 
44 44
         // compare terms
45 45
         $doc = $this->get_document($search_did);
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 
56 56
         // save it to search engine
57 57
         foreach ($missing_terms as $term) {
58
-            $this->add_term_to_doc($prefix . $term, $doc);
58
+            $this->add_term_to_doc($prefix.$term, $doc);
59 59
         }
60 60
         foreach ($deprecated_terms as $term) {
61
-            $this->remove_term_from_doc($prefix . $term, $doc);
61
+            $this->remove_term_from_doc($prefix.$term, $doc);
62 62
         }
63 63
 
64 64
         // don't do anything if no change
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
      * @return  array Array of terms
75 75
      */
76 76
     function get_terms_on_db($prefix, $course_code, $tool_id, $ref_id) {
77
-        require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
77
+        require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
78 78
         $terms = get_specific_field_values_list_by_prefix($prefix, $course_code, $tool_id, $ref_id);
79 79
         $prefix_terms = array();
80 80
         foreach ($terms as $term) {
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,8 +36,9 @@  discard block
 block discarded – undo
36 36
         $stored_terms = $this->get_terms_on_db($prefix, $course_code, $tool_id, $ref_id_high_level);
37 37
 
38 38
         // don't do anything if no change, verify only at DB, not the search engine
39
-        if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0))
40
-            return FALSE;
39
+        if ((count(array_diff($terms, $stored_terms)) == 0) && (count(array_diff($stored_terms, $terms)) == 0)) {
40
+                    return FALSE;
41
+        }
41 42
 
42 43
         require_once api_get_path(LIBRARY_PATH) . 'search/xapian/XapianQuery.php';
43 44
 
@@ -45,8 +46,9 @@  discard block
 block discarded – undo
45 46
         $doc = $this->get_document($search_did);
46 47
         $xapian_terms = xapian_get_doc_terms($doc, $prefix);
47 48
         $xterms = array();
48
-        foreach ($xapian_terms as $xapian_term)
49
-            $xterms[] = substr($xapian_term['name'], 1);
49
+        foreach ($xapian_terms as $xapian_term) {
50
+                    $xterms[] = substr($xapian_term['name'], 1);
51
+        }
50 52
 
51 53
         $dterms = $terms;
52 54
 
Please login to merge, or discard this patch.
main/inc/lib/search/ChamiloQuery.php 3 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,6 +23,9 @@  discard block
 block discarded – undo
23 23
     return chamilo_preprocess_results($results);
24 24
 }
25 25
 
26
+/**
27
+ * @param string $query_string
28
+ */
26 29
 function chamilo_query_simple_query($query_string, $offset=0, $length=10, $extra=NULL) {
27 30
     return xapian_query($query_string, NULL, $offset, $length, $extra);
28 31
 }
@@ -30,7 +33,7 @@  discard block
 block discarded – undo
30 33
 /**
31 34
  * Wrapper for getting boolean queries
32 35
  *
33
- * @param   string    $query_string   The term string
36
+ * @param string $term
34 37
  */
35 38
 function chamilo_get_boolean_query($term) {
36 39
   return xapian_get_boolean_query($term);
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
  * @param   array     extra           Extra queries to join with. Optional
19 19
  * @return  array
20 20
  */
21
-function chamilo_query_query($query_string, $offset=0, $length=10, $extra=NULL) {
21
+function chamilo_query_query($query_string, $offset = 0, $length = 10, $extra = NULL) {
22 22
     list($count, $results) = xapian_query($query_string, NULL, $offset, $length, $extra);
23 23
     return chamilo_preprocess_results($results);
24 24
 }
25 25
 
26
-function chamilo_query_simple_query($query_string, $offset=0, $length=10, $extra=NULL) {
26
+function chamilo_query_simple_query($query_string, $offset = 0, $length = 10, $extra = NULL) {
27 27
     return xapian_query($query_string, NULL, $offset, $length, $extra);
28 28
 }
29 29
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 function chamilo_preprocess_results($results) {
43 43
     // group by toolid
44 44
     $results_by_tool = array();
45
-    if (count($results)>0) {
45
+    if (count($results) > 0) {
46 46
 
47 47
 	    foreach ($results as $key => $row) {
48 48
 	        $results_by_tool[$row['toolid']][] = $row;
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 
51 51
 	    $processed_results = array();
52 52
 	    foreach ($results_by_tool as $toolid => $rows) {
53
-	        $tool_processor_class = $toolid .'_processor';
54
-	        $tool_processor_path = api_get_path(LIBRARY_PATH) .'search/tool_processors/'. $tool_processor_class .'.class.php';
53
+	        $tool_processor_class = $toolid.'_processor';
54
+	        $tool_processor_path = api_get_path(LIBRARY_PATH).'search/tool_processors/'.$tool_processor_class.'.class.php';
55 55
 	        if (file_exists($tool_processor_path)) {
56 56
 	            require_once($tool_processor_path);
57 57
 	            $tool_processor = new $tool_processor_class($rows);
@@ -71,6 +71,6 @@  discard block
 block discarded – undo
71 71
  * @param string $op
72 72
  * @return XapianQuery query joined
73 73
  */
74
-function chamilo_join_queries($query1, $query2=NULL, $op='or') {
74
+function chamilo_join_queries($query1, $query2 = NULL, $op = 'or') {
75 75
 	return xapian_join_queries($query1, $query2, $op);
76 76
 }
Please login to merge, or discard this patch.
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
  * @param   string    $query_string   The term string
34 34
  */
35 35
 function chamilo_get_boolean_query($term) {
36
-  return xapian_get_boolean_query($term);
36
+    return xapian_get_boolean_query($term);
37 37
 }
38 38
 
39 39
 /**
@@ -44,22 +44,22 @@  discard block
 block discarded – undo
44 44
     $results_by_tool = array();
45 45
     if (count($results)>0) {
46 46
 
47
-	    foreach ($results as $key => $row) {
48
-	        $results_by_tool[$row['toolid']][] = $row;
49
-	    }
47
+        foreach ($results as $key => $row) {
48
+            $results_by_tool[$row['toolid']][] = $row;
49
+        }
50 50
 
51
-	    $processed_results = array();
52
-	    foreach ($results_by_tool as $toolid => $rows) {
53
-	        $tool_processor_class = $toolid .'_processor';
54
-	        $tool_processor_path = api_get_path(LIBRARY_PATH) .'search/tool_processors/'. $tool_processor_class .'.class.php';
55
-	        if (file_exists($tool_processor_path)) {
56
-	            require_once($tool_processor_path);
57
-	            $tool_processor = new $tool_processor_class($rows);
58
-	            $processed_results = array_merge($tool_processor->process(), $processed_results);
59
-	        }
60
-	    }
51
+        $processed_results = array();
52
+        foreach ($results_by_tool as $toolid => $rows) {
53
+            $tool_processor_class = $toolid .'_processor';
54
+            $tool_processor_path = api_get_path(LIBRARY_PATH) .'search/tool_processors/'. $tool_processor_class .'.class.php';
55
+            if (file_exists($tool_processor_path)) {
56
+                require_once($tool_processor_path);
57
+                $tool_processor = new $tool_processor_class($rows);
58
+                $processed_results = array_merge($tool_processor->process(), $processed_results);
59
+            }
60
+        }
61 61
 
62
-	    return array(count($processed_results), $processed_results);
62
+        return array(count($processed_results), $processed_results);
63 63
     }
64 64
 }
65 65
 
@@ -72,5 +72,5 @@  discard block
 block discarded – undo
72 72
  * @return XapianQuery query joined
73 73
  */
74 74
 function chamilo_join_queries($query1, $query2=NULL, $op='or') {
75
-	return xapian_join_queries($query1, $query2, $op);
75
+    return xapian_join_queries($query1, $query2, $op);
76 76
 }
Please login to merge, or discard this patch.
main/inc/lib/search/search_widget.php 4 patches
Doc Comments   +2 added lines patch added patch discarded remove patch
@@ -273,6 +273,8 @@
 block discarded – undo
273 273
 
274 274
 /**
275 275
  * Show search form
276
+ * @param string $action
277
+ * @param boolean $show_thesaurus
276 278
  */
277 279
 function display_search_form($action, $show_thesaurus, $sf_terms, $op) {
278 280
     $type = (!empty($_REQUEST['type'])? htmlentities($_REQUEST['type']): 'normal');
Please login to merge, or discard this patch.
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -48,7 +48,9 @@  discard block
 block discarded – undo
48 48
 
49 49
     foreach ($sf_term_array as $raw_term) {
50 50
         $term = substr($raw_term, 1);
51
-        if (empty($term)) continue;
51
+        if (empty($term)) {
52
+            continue;
53
+        }
52 54
         $html_term = htmlspecialchars($term, ENT_QUOTES, $charset);
53 55
         $selected = '';
54 56
         if (!empty($_REQUEST['sf_'.$prefix]) && is_array($_REQUEST['sf_'.$prefix]) && in_array($term,$_REQUEST['sf_'.$prefix])) {
@@ -69,7 +71,9 @@  discard block
 block discarded – undo
69 71
     $max = count($sf_terms);
70 72
     $multiple_selects .='';
71 73
     foreach ($sf_terms as $prefix => $sf_term_array) {
72
-        if ($prefix == $prefilter_prefix) continue;
74
+        if ($prefix == $prefilter_prefix) {
75
+            continue;
76
+        }
73 77
         $multiple_select = '';
74 78
         if ($i>0) {
75 79
             //print "+" image
@@ -342,9 +346,10 @@  discard block
 block discarded – undo
342 346
 
343 347
 	// Tool introduction
344 348
     // TODO: Settings for the online editor to be checked (insert an image for example). Probably this is a special case here.
345
-    if (api_get_course_id() !== -1)
346
-    if (!empty($groupId)) {
349
+    if (api_get_course_id() !== -1) {
350
+        if (!empty($groupId)) {
347 351
         Display::display_introduction_section(TOOL_SEARCH.$groupId);
352
+    }
348 353
     } else {
349 354
         Display::display_introduction_section(TOOL_SEARCH);
350 355
     }
@@ -366,7 +371,9 @@  discard block
 block discarded – undo
366 371
                     break;
367 372
                 }
368 373
             }
369
-            if ($thesaurus_decided) break;
374
+            if ($thesaurus_decided) {
375
+                break;
376
+            }
370 377
         }
371 378
     }
372 379
 
Please login to merge, or discard this patch.
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
  * Get one term html select
31 31
  */
32 32
 function format_one_specific_field_select($prefix, $sf_term_array, $op, $extra_select_attr='size="7" class="sf-select-multiple"') {
33
-	global $charset;
33
+    global $charset;
34 34
     $multiple_select = '<select '. $extra_select_attr .' title="'. $prefix .'" id="sf-'. $prefix .'" name="sf_'. $prefix .'[]">';
35 35
 
36 36
     $all_selected = '';
@@ -119,20 +119,20 @@  discard block
 block discarded – undo
119 119
      * could not send a form in pagination
120 120
      */
121 121
 
122
-	if (isset($_GET['action']) && strcmp(trim($_GET['action']),'search')===0) {
123
-		$action='index.php';
124
-	}
125
-	$navigator_info = api_get_navigator();
122
+    if (isset($_GET['action']) && strcmp(trim($_GET['action']),'search')===0) {
123
+        $action='index.php';
124
+    }
125
+    $navigator_info = api_get_navigator();
126 126
 
127
-	if ($navigator_info['name']=='Internet Explorer' &&  $navigator_info['version']=='6') {
128
-		$submit_button1	= '<input type="submit" id="submit" value="'. get_lang('Search') .'" />';
129
-		$submit_button2 = '<input class="lower-submit" type="submit" value="'. get_lang('Search') .'" />';
127
+    if ($navigator_info['name']=='Internet Explorer' &&  $navigator_info['version']=='6') {
128
+        $submit_button1	= '<input type="submit" id="submit" value="'. get_lang('Search') .'" />';
129
+        $submit_button2 = '<input class="lower-submit" type="submit" value="'. get_lang('Search') .'" />';
130 130
         $reset_button 	= '<input type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords') .'" />';
131
-	} else {
132
-		$submit_button1 = '<button class="search" type="submit" id="submit" value="'. get_lang("Search") .'" /> '. get_lang('Search') .'</button>';
133
-		$submit_button2 = '<button class="search" type="submit" value="'. get_lang('Search') .'" />'. get_lang('Search') .'</button>';
131
+    } else {
132
+        $submit_button1 = '<button class="search" type="submit" id="submit" value="'. get_lang("Search") .'" /> '. get_lang('Search') .'</button>';
133
+        $submit_button2 = '<button class="search" type="submit" value="'. get_lang('Search') .'" />'. get_lang('Search') .'</button>';
134 134
         $reset_button 	= '<button class="save"   type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords') .'" />'. get_lang('SearchResetKeywords') .'</button> ';
135
-	}
135
+    }
136 136
 
137 137
     $form = '<form id="chamilo_search" action="'. $action .'" method="GET">
138 138
             <input type="text" id="query" name="query" size="40" value="'.stripslashes(Security::remove_XSS($_REQUEST['query'])).'" />
@@ -197,9 +197,9 @@  discard block
 block discarded – undo
197 197
      * SortableTableFromArray pagination is done with simple links, so now we
198 198
      * could not send a form in pagination
199 199
      */
200
-	if (isset($_GET['action']) && strcmp(trim($_GET['action']),'search')===0) {
201
-		$action='index.php';
202
-	}
200
+    if (isset($_GET['action']) && strcmp(trim($_GET['action']),'search')===0) {
201
+        $action='index.php';
202
+    }
203 203
 
204 204
     $form = '
205 205
         <form id="chamilo_search" action="'. $action .'" method="GET">
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
                         </table>
265 265
                     </div>';
266 266
         }
267
-       $form .= '
267
+        $form .= '
268 268
         </form>
269 269
         <br style="clear: both;"/>';
270 270
 
@@ -322,10 +322,10 @@  discard block
 block discarded – undo
322 322
         foreach ($specific_fields as $specific_field) {
323 323
             $temp = array();
324 324
             if (is_array($dkterms) && count($dkterms)>0) {
325
-            	foreach($dkterms[1] as $obj) {
326
-                	$temp = array_merge($obj['sf-'.$specific_field['code']], $temp);
327
-            	}
328
-        	}
325
+                foreach($dkterms[1] as $obj) {
326
+                    $temp = array_merge($obj['sf-'.$specific_field['code']], $temp);
327
+                }
328
+            }
329 329
             $sf_terms[$specific_field['code']] = $temp;
330 330
             $url_params[] = 'sf_'.$specific_field['code'];
331 331
             unset($temp);
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
     }
341 341
     echo '<h2>'.get_lang('Search').'</h2>';
342 342
 
343
-	// Tool introduction
343
+    // Tool introduction
344 344
     // TODO: Settings for the online editor to be checked (insert an image for example). Probably this is a special case here.
345 345
     if (api_get_course_id() !== -1)
346 346
     if (!empty($groupId)) {
Please login to merge, or discard this patch.
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 /**
8 8
  * Code
9 9
  */
10
-require_once dirname(__FILE__) . '/IndexableChunk.class.php';
10
+require_once dirname(__FILE__).'/IndexableChunk.class.php';
11 11
 require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
12 12
 
13 13
 /**
@@ -29,13 +29,13 @@  discard block
 block discarded – undo
29 29
 /**
30 30
  * Get one term html select
31 31
  */
32
-function format_one_specific_field_select($prefix, $sf_term_array, $op, $extra_select_attr='size="7" class="sf-select-multiple"') {
32
+function format_one_specific_field_select($prefix, $sf_term_array, $op, $extra_select_attr = 'size="7" class="sf-select-multiple"') {
33 33
 	global $charset;
34
-    $multiple_select = '<select '. $extra_select_attr .' title="'. $prefix .'" id="sf-'. $prefix .'" name="sf_'. $prefix .'[]">';
34
+    $multiple_select = '<select '.$extra_select_attr.' title="'.$prefix.'" id="sf-'.$prefix.'" name="sf_'.$prefix.'[]">';
35 35
 
36 36
     $all_selected = '';
37
-    if (!empty($_REQUEST['sf_'. $prefix]) ) {
38
-        if (in_array('__all__', $_REQUEST['sf_'. $prefix])) {
37
+    if (!empty($_REQUEST['sf_'.$prefix])) {
38
+        if (in_array('__all__', $_REQUEST['sf_'.$prefix])) {
39 39
             $all_selected = 'selected="selected"';
40 40
         }
41 41
     }
@@ -44,17 +44,17 @@  discard block
 block discarded – undo
44 44
     } else if ($op == 'or') {
45 45
         $all_selected_name = get_lang('Any');
46 46
     }
47
-    $multiple_select .= '<option value="__all__" '. $all_selected .' >-- '. $all_selected_name .' --</option>';
47
+    $multiple_select .= '<option value="__all__" '.$all_selected.' >-- '.$all_selected_name.' --</option>';
48 48
 
49 49
     foreach ($sf_term_array as $raw_term) {
50 50
         $term = substr($raw_term, 1);
51 51
         if (empty($term)) continue;
52 52
         $html_term = htmlspecialchars($term, ENT_QUOTES, $charset);
53 53
         $selected = '';
54
-        if (!empty($_REQUEST['sf_'.$prefix]) && is_array($_REQUEST['sf_'.$prefix]) && in_array($term,$_REQUEST['sf_'.$prefix])) {
54
+        if (!empty($_REQUEST['sf_'.$prefix]) && is_array($_REQUEST['sf_'.$prefix]) && in_array($term, $_REQUEST['sf_'.$prefix])) {
55 55
             $selected = 'selected="selected"';
56 56
         }
57
-        $multiple_select .= '<option value="'. $html_term .'" '.$selected.'>'. $html_term .'</option>';
57
+        $multiple_select .= '<option value="'.$html_term.'" '.$selected.'>'.$html_term.'</option>';
58 58
     }
59 59
     $multiple_select .= '</select>';
60 60
     return $multiple_select;
@@ -63,15 +63,15 @@  discard block
 block discarded – undo
63 63
 /**
64 64
  * Get terms html selects
65 65
  */
66
-function format_specific_fields_selects($sf_terms, $op, $prefilter_prefix='') {
66
+function format_specific_fields_selects($sf_terms, $op, $prefilter_prefix = '') {
67 67
     // Process each prefix type term
68 68
     $i = 0;
69 69
     $max = count($sf_terms);
70
-    $multiple_selects ='';
70
+    $multiple_selects = '';
71 71
     foreach ($sf_terms as $prefix => $sf_term_array) {
72 72
         if ($prefix == $prefilter_prefix) continue;
73 73
         $multiple_select = '';
74
-        if ($i>0) {
74
+        if ($i > 0) {
75 75
             //print "+" image
76 76
             $multiple_select .= '<td><img class="sf-select-splitter" src="../img/search-big-plus.gif" alt="plus-sign-decoration"/></td>';
77 77
         }
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
 
90 90
         $sf_copy = $sf_term_array;
91 91
         // get specific field name
92
-        $sf_value = get_specific_field_list(array( 'code' => "'$prefix'" ));
92
+        $sf_value = get_specific_field_list(array('code' => "'$prefix'"));
93 93
         $sf_value = array_shift($sf_value);
94
-        $multiple_select .= '<td><label class="sf-select-multiple-title" for="sf_'. $prefix .'[]">' . $sf_value['name'].'</label><br />';
94
+        $multiple_select .= '<td><label class="sf-select-multiple-title" for="sf_'.$prefix.'[]">'.$sf_value['name'].'</label><br />';
95 95
         $multiple_select .= format_one_specific_field_select($prefix, $sf_term_array, $op, 'multiple="multiple" size="7" class="sf-select-multiple"');
96 96
         $multiple_select .= '</td>';
97 97
         $multiple_selects .= $multiple_select;
@@ -107,11 +107,11 @@  discard block
 block discarded – undo
107 107
  */
108 108
 function search_widget_normal_form($action, $show_thesaurus, $sf_terms, $op) {
109 109
     $thesaurus_icon = Display::return_icon('thesaurus.gif', get_lang('SearchAdvancedOptions'), array('id'=>'thesaurus-icon'));
110
-    $advanced_options = '<a id="tags-toggle" href="#">'.  get_lang('SearchAdvancedOptions') .'</a>';
111
-    $display_thesaurus = ($show_thesaurus==true? 'block': 'none');
112
-    $help = '<h3>'. get_lang('SearchKeywordsHelpTitle') .'</h3>'. get_lang('SearchKeywordsHelpComment');
113
-    $mode = (!empty($_REQUEST['mode'])? htmlentities($_REQUEST['mode']): 'gallery');
114
-    $type = (!empty($_REQUEST['type'])? htmlentities($_REQUEST['type']): 'normal');
110
+    $advanced_options = '<a id="tags-toggle" href="#">'.get_lang('SearchAdvancedOptions').'</a>';
111
+    $display_thesaurus = ($show_thesaurus == true ? 'block' : 'none');
112
+    $help = '<h3>'.get_lang('SearchKeywordsHelpTitle').'</h3>'.get_lang('SearchKeywordsHelpComment');
113
+    $mode = (!empty($_REQUEST['mode']) ? htmlentities($_REQUEST['mode']) : 'gallery');
114
+    $type = (!empty($_REQUEST['type']) ? htmlentities($_REQUEST['type']) : 'normal');
115 115
 
116 116
     /**
117 117
      * POST avoid long urls, but we are using GET because
@@ -119,36 +119,36 @@  discard block
 block discarded – undo
119 119
      * could not send a form in pagination
120 120
      */
121 121
 
122
-	if (isset($_GET['action']) && strcmp(trim($_GET['action']),'search')===0) {
123
-		$action='index.php';
122
+	if (isset($_GET['action']) && strcmp(trim($_GET['action']), 'search') === 0) {
123
+		$action = 'index.php';
124 124
 	}
125 125
 	$navigator_info = api_get_navigator();
126 126
 
127
-	if ($navigator_info['name']=='Internet Explorer' &&  $navigator_info['version']=='6') {
128
-		$submit_button1	= '<input type="submit" id="submit" value="'. get_lang('Search') .'" />';
129
-		$submit_button2 = '<input class="lower-submit" type="submit" value="'. get_lang('Search') .'" />';
130
-        $reset_button 	= '<input type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords') .'" />';
127
+	if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
128
+		$submit_button1	= '<input type="submit" id="submit" value="'.get_lang('Search').'" />';
129
+		$submit_button2 = '<input class="lower-submit" type="submit" value="'.get_lang('Search').'" />';
130
+        $reset_button = '<input type="submit" id="tags-clean" value="'.get_lang('SearchResetKeywords').'" />';
131 131
 	} else {
132
-		$submit_button1 = '<button class="search" type="submit" id="submit" value="'. get_lang("Search") .'" /> '. get_lang('Search') .'</button>';
133
-		$submit_button2 = '<button class="search" type="submit" value="'. get_lang('Search') .'" />'. get_lang('Search') .'</button>';
134
-        $reset_button 	= '<button class="save"   type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords') .'" />'. get_lang('SearchResetKeywords') .'</button> ';
132
+		$submit_button1 = '<button class="search" type="submit" id="submit" value="'.get_lang("Search").'" /> '.get_lang('Search').'</button>';
133
+		$submit_button2 = '<button class="search" type="submit" value="'.get_lang('Search').'" />'.get_lang('Search').'</button>';
134
+        $reset_button = '<button class="save"   type="submit" id="tags-clean" value="'.get_lang('SearchResetKeywords').'" />'.get_lang('SearchResetKeywords').'</button> ';
135 135
 	}
136 136
 
137 137
     $query = isset($_REQUEST['query']) ? Security::remove_XSS($_REQUEST['query']) : null;
138 138
 
139
-    $form = '<form id="chamilo_search" action="'. $action .'" method="GET">
140
-            <input type="text" id="query" name="query" size="40" value="' . $query . '" />
141
-            <input type="hidden" name="mode" value="'. $mode .'"/>
142
-            <input type="hidden" name="type" value="'. $type .'"/>
139
+    $form = '<form id="chamilo_search" action="'.$action.'" method="GET">
140
+            <input type="text" id="query" name="query" size="40" value="' . $query.'" />
141
+            <input type="hidden" name="mode" value="'. $mode.'"/>
142
+            <input type="hidden" name="type" value="'. $type.'"/>
143 143
             <input type="hidden" name="tablename_page_nr" value="1" />
144 144
           	'.$submit_button1.'
145 145
             <br /><br />';
146 146
     $list = get_specific_field_list();
147 147
 
148
-    if(!empty($list)) {
149
-        $form .= '<span class="search-links-box">'. $advanced_options .'&nbsp;</span>
150
-            <div id="tags" class="tags" style="display:'. $display_thesaurus .';">
151
-                <div class="search-help-box">'. $help .'</div>
148
+    if (!empty($list)) {
149
+        $form .= '<span class="search-links-box">'.$advanced_options.'&nbsp;</span>
150
+            <div id="tags" class="tags" style="display:'. $display_thesaurus.';">
151
+                <div class="search-help-box">'. $help.'</div>
152 152
                 <table>
153 153
                 <tr>';
154 154
         $form .= format_specific_fields_selects($sf_terms, $op);
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
         $form .= '</tr>
163 163
                     <tr>
164 164
                         <td id="operator-select">
165
-                            '. get_lang('SearchCombineSearchWith') .':<br />
166
-                            <input type="radio" class="search-operator" name="operator" value="or" '. $or_checked .'>'. api_strtoupper(get_lang('Or')) .'</input>
167
-                            <input type="radio" class="search-operator" name="operator" value="and" '. $and_checked .'>'. api_strtoupper(get_lang('And')) .'</input>
165
+                            '. get_lang('SearchCombineSearchWith').':<br />
166
+                            <input type="radio" class="search-operator" name="operator" value="or" '. $or_checked.'>'.api_strtoupper(get_lang('Or')).'</input>
167
+                            <input type="radio" class="search-operator" name="operator" value="and" '. $and_checked.'>'.api_strtoupper(get_lang('And')).'</input>
168 168
                         </td>
169 169
                         <td></td>
170 170
                         <td>
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
                     </table>
177 177
                 </div>';
178 178
     }
179
-    $form .='</form>
179
+    $form .= '</form>
180 180
     <br style="clear: both;"/>';
181 181
     return $form;
182 182
 }
@@ -186,36 +186,36 @@  discard block
 block discarded – undo
186 186
  *
187 187
  * This type allow filter all other multiple select terms by one term in a dinamic way
188 188
  */
189
-function search_widget_prefilter_form($action, $show_thesaurus, $sf_terms, $op, $prefilter_prefix=NULL) {
189
+function search_widget_prefilter_form($action, $show_thesaurus, $sf_terms, $op, $prefilter_prefix = NULL) {
190 190
     $thesaurus_icon = Display::return_icon('thesaurus.gif', get_lang('SearchAdvancedOptions'), array('id'=>'thesaurus-icon'));
191
-    $advanced_options = '<a id="tags-toggle" href="#">'.  get_lang('SearchAdvancedOptions') .'</a>';
192
-    $display_thesaurus = ($show_thesaurus==true? 'block': 'none');
193
-    $help = '<h3>'. get_lang('SearchKeywordsHelpTitle') .'</h3>'. get_lang('SearchKeywordsHelpComment');
194
-    $mode = (!empty($_REQUEST['mode'])? htmlentities($_REQUEST['mode']): 'gallery');
195
-    $type = (!empty($_REQUEST['type'])? htmlentities($_REQUEST['type']): 'normal');
191
+    $advanced_options = '<a id="tags-toggle" href="#">'.get_lang('SearchAdvancedOptions').'</a>';
192
+    $display_thesaurus = ($show_thesaurus == true ? 'block' : 'none');
193
+    $help = '<h3>'.get_lang('SearchKeywordsHelpTitle').'</h3>'.get_lang('SearchKeywordsHelpComment');
194
+    $mode = (!empty($_REQUEST['mode']) ? htmlentities($_REQUEST['mode']) : 'gallery');
195
+    $type = (!empty($_REQUEST['type']) ? htmlentities($_REQUEST['type']) : 'normal');
196 196
 
197 197
     /**
198 198
      * POST avoid long urls, but we are using GET because
199 199
      * SortableTableFromArray pagination is done with simple links, so now we
200 200
      * could not send a form in pagination
201 201
      */
202
-	if (isset($_GET['action']) && strcmp(trim($_GET['action']),'search')===0) {
203
-		$action='index.php';
202
+	if (isset($_GET['action']) && strcmp(trim($_GET['action']), 'search') === 0) {
203
+		$action = 'index.php';
204 204
 	}
205 205
 
206 206
     $form = '
207
-        <form id="chamilo_search" action="'. $action .'" method="GET">
207
+        <form id="chamilo_search" action="'. $action.'" method="GET">
208 208
             <input type="text" id="query" name="query" size="40" />
209
-            <input type="hidden" name="mode" value="'. $mode .'"/>
210
-            <input type="hidden" name="type" value="'. $type .'"/>
209
+            <input type="hidden" name="mode" value="'. $mode.'"/>
210
+            <input type="hidden" name="type" value="'. $type.'"/>
211 211
             <input type="hidden" name="tablename_page_nr" value="1" />
212
-            <input type="submit" id="submit" value="'. get_lang("Search") .'" />
212
+            <input type="submit" id="submit" value="'. get_lang("Search").'" />
213 213
             <br /><br />';
214 214
         $list = get_specific_field_list();
215
-        if(!empty($list)) {
216
-            $form .=' <span class="search-links-box">'. $thesaurus_icon . $advanced_options .'&nbsp;</span>
217
-                    <div id="tags" class="tags" style="display:'. $display_thesaurus .';">
218
-                        <div class="search-help-box">'. $help .'</div>
215
+        if (!empty($list)) {
216
+            $form .= ' <span class="search-links-box">'.$thesaurus_icon.$advanced_options.'&nbsp;</span>
217
+                    <div id="tags" class="tags" style="display:'. $display_thesaurus.';">
218
+                        <div class="search-help-box">'. $help.'</div>
219 219
                         <table>
220 220
                         <tr>';
221 221
             if (!is_null($prefilter_prefix)) {
@@ -230,9 +230,9 @@  discard block
 block discarded – undo
230 230
                 $sf_term_array = $temp;
231 231
 
232 232
                 // get specific field name
233
-                $sf_value = get_specific_field_list(array( 'code' => "'$prefilter_prefix'" ));
233
+                $sf_value = get_specific_field_list(array('code' => "'$prefilter_prefix'"));
234 234
                 $sf_value = array_shift($sf_value);
235
-                $form .= '<label class="sf-select-multiple-title" for="sf_'. $prefix .'[]">'.$icons_for_search_terms[$prefix].' '.$sf_value['name'].'</label><br />';
235
+                $form .= '<label class="sf-select-multiple-title" for="sf_'.$prefix.'[]">'.$icons_for_search_terms[$prefix].' '.$sf_value['name'].'</label><br />';
236 236
 
237 237
                 $form .= format_one_specific_field_select($prefilter_prefix, $sf_term_array, $op, 'id="prefilter"');
238 238
                 $form .= format_specific_fields_selects($sf_terms, $op, $prefilter_prefix);
@@ -252,15 +252,15 @@  discard block
 block discarded – undo
252 252
                         </tr>
253 253
                         <tr>
254 254
                             <td id="operator-select">
255
-                                '. get_lang('SearchCombineSearchWith') .':<br />
256
-                                <input type="radio" class="search-operator" name="operator" value="or" '. $or_checked .'>'. api_strtoupper(get_lang('Or')) .'</input>
257
-                                <input type="radio" class="search-operator" name="operator" value="and" '. $and_checked .'>'. api_strtoupper(get_lang('And')) .'</input>
255
+                                '. get_lang('SearchCombineSearchWith').':<br />
256
+                                <input type="radio" class="search-operator" name="operator" value="or" '. $or_checked.'>'.api_strtoupper(get_lang('Or')).'</input>
257
+                                <input type="radio" class="search-operator" name="operator" value="and" '. $and_checked.'>'.api_strtoupper(get_lang('And')).'</input>
258 258
                             </td>
259 259
                             <td></td>
260 260
                             <td>
261 261
                                 <br />
262
-                                <input class="lower-submit" type="submit" value="'. get_lang('Search') .'" />
263
-                                <input type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords') .'" />
262
+                                <input class="lower-submit" type="submit" value="'. get_lang('Search').'" />
263
+                                <input type="submit" id="tags-clean" value="'. get_lang('SearchResetKeywords').'" />
264 264
                             </td>
265 265
                         </tr>
266 266
                         </table>
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
  * Show search form
278 278
  */
279 279
 function display_search_form($action, $show_thesaurus, $sf_terms, $op) {
280
-    $type = (!empty($_REQUEST['type'])? htmlentities($_REQUEST['type']): 'normal');
280
+    $type = (!empty($_REQUEST['type']) ? htmlentities($_REQUEST['type']) : 'normal');
281 281
 
282 282
     switch ($type) {
283 283
         case 'prefilter':
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
  * @param   string $action     Just in case your action is not
305 305
  * index.php
306 306
  */
307
-function search_widget_show($action='index.php')
307
+function search_widget_show($action = 'index.php')
308 308
 {
309 309
     require_once api_get_path(LIBRARY_PATH).'search/ChamiloQuery.php';
310 310
     // TODO: load images dinamically when they're avalaible from specific field ui to add
@@ -317,14 +317,14 @@  discard block
 block discarded – undo
317 317
     if (($cid = api_get_course_id()) != -1) { // with cid
318 318
 
319 319
         // get search engine terms
320
-        $course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID . $cid);
320
+        $course_filter = chamilo_get_boolean_query(XAPIAN_PREFIX_COURSEID.$cid);
321 321
         $dkterms = chamilo_query_simple_query('', 0, 1000, array($course_filter));
322 322
 
323 323
         //prepare specific fields names (and also get possible URL param names)
324 324
         foreach ($specific_fields as $specific_field) {
325 325
             $temp = array();
326
-            if (is_array($dkterms) && count($dkterms)>0) {
327
-            	foreach($dkterms[1] as $obj) {
326
+            if (is_array($dkterms) && count($dkterms) > 0) {
327
+            	foreach ($dkterms[1] as $obj) {
328 328
                 	$temp = array_merge($obj['sf-'.$specific_field['code']], $temp);
329 329
             	}
330 330
         	}
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
     }
353 353
 
354 354
     $op = 'or';
355
-    if (!empty($_REQUEST['operator']) && in_array($op,array('or','and'))) {
355
+    if (!empty($_REQUEST['operator']) && in_array($op, array('or', 'and'))) {
356 356
         $op = $_REQUEST['operator'];
357 357
     }
358 358
 
Please login to merge, or discard this patch.