Completed
Push — 1.11.x ( 78f130...f6f5c2 )
by José
50:40 queued 24:26
created
main/inc/lib/internationalization_database/transliteration/x16.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 // $Id: x16.php,v 1.1.8.1 2008/06/12 20:34:31 smk Exp $
3 3
 
4 4
 return array(
5
-  'en' => array('kka', 'kk', 'nu', 'no', 'ne', 'nee', 'ni', 'na', 'mu', 'mo', 'me', 'mee', 'mi', 'ma', 'yu', 'yo',
5
+    'en' => array('kka', 'kk', 'nu', 'no', 'ne', 'nee', 'ni', 'na', 'mu', 'mo', 'me', 'mee', 'mi', 'ma', 'yu', 'yo',
6 6
     'ye', 'yee', 'yi', 'ya', 'ju', 'ju', 'jo', 'je', 'jee', 'ji', 'ji', 'ja', 'jju', 'jjo', 'jje', 'jjee',
7 7
     'jji', 'jja', 'lu', 'lo', 'le', 'lee', 'li', 'la', 'dlu', 'dlo', 'dle', 'dlee', 'dli', 'dla', 'lhu', 'lho',
8 8
     'lhe', 'lhee', 'lhi', 'lha', 'tlhu', 'tlho', 'tlhe', 'tlhee', 'tlhi', 'tlha', 'tlu', 'tlo', 'tle', 'tlee', 'tli', 'tla',
Please login to merge, or discard this patch.
main/inc/lib/internationalization_database/transliteration/x6c.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 // $Id: x6c.php,v 1.1.8.1 2008/06/12 20:34:31 smk Exp $
3 3
 
4 4
 return array(
5
-  'en' => array('Lu ', 'Mu ', 'Li ', 'Tong ', 'Rong ', 'Chang ', 'Pu ', 'Luo ', 'Zhan ', 'Sao ', 'Zhan ', 'Meng ', 'Luo ', 'Qu ', 'Die ', 'Shi ',
5
+    'en' => array('Lu ', 'Mu ', 'Li ', 'Tong ', 'Rong ', 'Chang ', 'Pu ', 'Luo ', 'Zhan ', 'Sao ', 'Zhan ', 'Meng ', 'Luo ', 'Qu ', 'Die ', 'Shi ',
6 6
     'Di ', 'Min ', 'Jue ', 'Mang ', 'Qi ', 'Pie ', 'Nai ', 'Qi ', 'Dao ', 'Xian ', 'Chuan ', 'Fen ', 'Ri ', 'Nei ', NULL, 'Fu ',
7 7
     'Shen ', 'Dong ', 'Qing ', 'Qi ', 'Yin ', 'Xi ', 'Hai ', 'Yang ', 'An ', 'Ya ', 'Ke ', 'Qing ', 'Ya ', 'Dong ', 'Dan ', 'Lu ',
8 8
     'Qing ', 'Yang ', 'Yun ', 'Yun ', 'Shui ', 'San ', 'Zheng ', 'Bing ', 'Yong ', 'Dang ', 'Shitamizu ', 'Le ', 'Ni ', 'Tun ', 'Fan ', 'Gui ',
Please login to merge, or discard this patch.
main/inc/lib/internationalization_database/transliteration/xb8.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 // $Id: xb8.php,v 1.1.8.1 2008/06/12 20:34:32 smk Exp $
3 3
 
4 4
 return array(
5
-  'en' => array('reoss', 'reong', 'reoj', 'reoc', 'reok', 'reot', 'reop', 'reoh', 're', 'reg', 'regg', 'regs', 'ren', 'renj', 'renh', 'red',
5
+    'en' => array('reoss', 'reong', 'reoj', 'reoc', 'reok', 'reot', 'reop', 'reoh', 're', 'reg', 'regg', 'regs', 'ren', 'renj', 'renh', 'red',
6 6
     'rel', 'relg', 'relm', 'relb', 'rels', 'relt', 'relp', 'relh', 'rem', 'reb', 'rebs', 'res', 'ress', 'reng', 'rej', 'rec',
7 7
     'rek', 'ret', 'rep', 'reh', 'ryeo', 'ryeog', 'ryeogg', 'ryeogs', 'ryeon', 'ryeonj', 'ryeonh', 'ryeod', 'ryeol', 'ryeolg', 'ryeolm', 'ryeolb',
8 8
     'ryeols', 'ryeolt', 'ryeolp', 'ryeolh', 'ryeom', 'ryeob', 'ryeobs', 'ryeos', 'ryeoss', 'ryeong', 'ryeoj', 'ryeoc', 'ryeok', 'ryeot', 'ryeop', 'ryeoh',
Please login to merge, or discard this patch.
main/inc/lib/internationalization_database/transliteration/xbd.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 // $Id: xbd.php,v 1.1.8.1 2008/06/12 20:34:32 smk Exp $
3 3
 
4 4
 return array(
5
-  'en' => array('bols', 'bolt', 'bolp', 'bolh', 'bom', 'bob', 'bobs', 'bos', 'boss', 'bong', 'boj', 'boc', 'bok', 'bot', 'bop', 'boh',
5
+    'en' => array('bols', 'bolt', 'bolp', 'bolh', 'bom', 'bob', 'bobs', 'bos', 'boss', 'bong', 'boj', 'boc', 'bok', 'bot', 'bop', 'boh',
6 6
     'bwa', 'bwag', 'bwagg', 'bwags', 'bwan', 'bwanj', 'bwanh', 'bwad', 'bwal', 'bwalg', 'bwalm', 'bwalb', 'bwals', 'bwalt', 'bwalp', 'bwalh',
7 7
     'bwam', 'bwab', 'bwabs', 'bwas', 'bwass', 'bwang', 'bwaj', 'bwac', 'bwak', 'bwat', 'bwap', 'bwah', 'bwae', 'bwaeg', 'bwaegg', 'bwaegs',
8 8
     'bwaen', 'bwaenj', 'bwaenh', 'bwaed', 'bwael', 'bwaelg', 'bwaelm', 'bwaelb', 'bwaels', 'bwaelt', 'bwaelp', 'bwaelh', 'bwaem', 'bwaeb', 'bwaebs', 'bwaes',
Please login to merge, or discard this patch.
main/inc/lib/login_redirection.class.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,30 +18,30 @@  discard block
 block discarded – undo
18 18
         if (api_is_student() && !api_get_setting('student_page_after_login') == '') {
19 19
             $redirect_url = html_entity_decode(api_get_setting('student_page_after_login'));
20 20
             if ($redirect_url[0] == "/") {
21
-                $redirect_url = substr(api_get_path(WEB_PATH), 0, -1) . $redirect_url;
21
+                $redirect_url = substr(api_get_path(WEB_PATH), 0, -1).$redirect_url;
22 22
             }
23 23
         }
24 24
         if (api_is_teacher() && !api_get_setting('teacher_page_after_login') == '') {
25 25
             $redirect_url = html_entity_decode(api_get_setting('teacher_page_after_login'));
26 26
             if ($redirect_url[0] == "/") {
27
-                $redirect_url = substr(api_get_path(WEB_PATH), 0, -1) . $redirect_url;
27
+                $redirect_url = substr(api_get_path(WEB_PATH), 0, -1).$redirect_url;
28 28
             }
29 29
         }
30 30
         if (api_is_drh() && !api_get_setting('drh_page_after_login') == '') {
31 31
             $redirect_url = html_entity_decode(api_get_setting('drh_page_after_login'));
32 32
             if ($redirect_url[0] == "/") {
33
-                $redirect_url = substr(api_get_path(WEB_PATH), 0, -1) . $redirect_url;
33
+                $redirect_url = substr(api_get_path(WEB_PATH), 0, -1).$redirect_url;
34 34
             }
35 35
         }
36 36
         if (api_is_session_admin() && !api_get_setting('sessionadmin_page_after_login') == '') {
37 37
             $redirect_url = html_entity_decode(api_get_setting('sessionadmin_page_after_login'));
38 38
             if ($redirect_url[0] == "/") {
39
-                $redirect_url = substr(api_get_path(WEB_PATH), 0, -1) . $redirect_url;
39
+                $redirect_url = substr(api_get_path(WEB_PATH), 0, -1).$redirect_url;
40 40
             }
41 41
         }
42 42
 
43 43
         if (!empty($redirect_url)) {
44
-            header('Location: ' . $redirect_url . $param);
44
+            header('Location: '.$redirect_url.$param);
45 45
             exit();
46 46
         }
47 47
 
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         if (CustomPages::enabled()) {
50 50
             CustomPages::display(CustomPages::INDEX_LOGGED);
51 51
         }
52
-        header('location: ' . api_get_path(WEB_PATH) . api_get_setting('page_after_login') . $param);
52
+        header('location: '.api_get_path(WEB_PATH).api_get_setting('page_after_login').$param);
53 53
         exit();
54 54
     }
55 55
 }
Please login to merge, or discard this patch.
main/inc/lib/sessionmanager.lib.php 4 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6022,7 +6022,7 @@
 block discarded – undo
6022 6022
         ]);
6023 6023
     }
6024 6024
 
6025
-	/**
6025
+    /**
6026 6026
      * Get the count of user courses in session
6027 6027
      * @param int $sessionId The session id
6028 6028
      * @return array
Please login to merge, or discard this patch.
Doc Comments   +18 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1652,7 +1652,7 @@  discard block
 block discarded – undo
1652 1652
      * @param array $user_list
1653 1653
      * @param int $session_visibility
1654 1654
      * @param bool $empty_users
1655
-     * @return bool
1655
+     * @return false|null
1656 1656
      */
1657 1657
     public static function subscribe_users_to_session(
1658 1658
         $id_session,
@@ -1925,7 +1925,7 @@  discard block
 block discarded – undo
1925 1925
      * @param array $courseInfo
1926 1926
      * @param int $status
1927 1927
      * @param bool $updateTotal
1928
-     * @return bool
1928
+     * @return false|null
1929 1929
      */
1930 1930
     public static function removeUsersFromCourseSession(
1931 1931
         $userList,
@@ -1991,7 +1991,7 @@  discard block
 block discarded – undo
1991 1991
      * @param string $course_code
1992 1992
      * @param int $session_visibility
1993 1993
      * @param bool $removeUsersNotInList
1994
-     * @return bool
1994
+     * @return false|null
1995 1995
      */
1996 1996
     public static function subscribe_users_to_session_course(
1997 1997
         $user_list,
@@ -2175,7 +2175,7 @@  discard block
 block discarded – undo
2175 2175
      * @param	bool	$removeExistingCoursesWithUsers Whether to unsubscribe
2176 2176
      * existing courses and users (true, default) or not (false)
2177 2177
      * @param $copyEvaluation from base course to session course
2178
-     * @return	void	Nothing, or false on error
2178
+     * @return	false|null	Nothing, or false on error
2179 2179
      * */
2180 2180
     public static function add_courses_to_session(
2181 2181
         $sessionId,
@@ -2424,7 +2424,7 @@  discard block
 block discarded – undo
2424 2424
      * @param	string	$variable Field's internal variable name
2425 2425
      * @param	int		$fieldType Field's type
2426 2426
      * @param	string	$displayText Field's language var name
2427
-     * @return int     new extra field id
2427
+     * @return boolean     new extra field id
2428 2428
      */
2429 2429
     public static function create_session_extra_field($variable, $fieldType, $displayText)
2430 2430
     {
@@ -2648,7 +2648,7 @@  discard block
 block discarded – undo
2648 2648
      * @param	array	id_checked
2649 2649
      * @param	bool	include delete session
2650 2650
      * @param	bool	optional, true if the function is called by a webservice, false otherwise.
2651
-     * @return	void	Nothing, or false on error
2651
+     * @return	boolean	Nothing, or false on error
2652 2652
      * The parameters is a array to delete sessions
2653 2653
      * */
2654 2654
     public static function delete_session_category($id_checked, $delete_session = false, $from_ws = false)
@@ -3414,8 +3414,8 @@  discard block
 block discarded – undo
3414 3414
     /**
3415 3415
      * Gets the list of courses by session filtered by access_url
3416 3416
      *
3417
-     * @param $userId
3418
-     * @param $sessionId
3417
+     * @param integer $userId
3418
+     * @param null|integer $sessionId
3419 3419
      * @param null $from
3420 3420
      * @param null $limit
3421 3421
      * @param null $column
@@ -3540,6 +3540,7 @@  discard block
 block discarded – undo
3540 3540
     /**
3541 3541
      * Gets the count of courses by session filtered by access_url
3542 3542
      * @param int session id
3543
+     * @param integer $session_id
3543 3544
      * @return array list of courses
3544 3545
      */
3545 3546
     public static function getCourseCountBySessionId($session_id, $keyword = null)
@@ -3798,6 +3799,7 @@  discard block
 block discarded – undo
3798 3799
      * Updates a session status
3799 3800
      * @param	int 	session id
3800 3801
      * @param	int 	status
3802
+     * @param integer $status
3801 3803
      */
3802 3804
     public static function set_session_status($session_id, $status)
3803 3805
     {
@@ -4006,7 +4008,7 @@  discard block
 block discarded – undo
4006 4008
      * Protect a session to be edited.
4007 4009
      * @param int $id
4008 4010
      * @param bool $checkSession
4009
-     * @return mixed | bool true if pass the check, api_not_allowed otherwise
4011
+     * @return boolean|null | bool true if pass the check, api_not_allowed otherwise
4010 4012
      */
4011 4013
     public static function protectSession($id, $checkSession = true)
4012 4014
     {
@@ -4114,7 +4116,7 @@  discard block
 block discarded – undo
4114 4116
 
4115 4117
     /**
4116 4118
      * @param $id
4117
-     * @return bool
4119
+     * @return null|boolean
4118 4120
      */
4119 4121
     public static function protect_teacher_session_edit($id)
4120 4122
     {
@@ -4179,7 +4181,7 @@  discard block
 block discarded – undo
4179 4181
      *  true: if the session exists it will be updated.
4180 4182
      *  false: if session exists a new session will be created adding a counter session1, session2, etc
4181 4183
      * @param int $defaultUserId
4182
-     * @param mixed $logger
4184
+     * @param Logger $logger
4183 4185
      * @param array $extraFields convert a file row to an extra field. Example in CSV file there's a SessionID then it will
4184 4186
      * converted to extra_external_session_id if you set this: array('SessionId' => 'extra_external_session_id')
4185 4187
      * @param string $extraFieldId
@@ -5482,7 +5484,6 @@  discard block
 block discarded – undo
5482 5484
      * @param string $lastConnectionDate
5483 5485
      * @param array $sessionIdList
5484 5486
      * @param array $studentIdList
5485
-     * @param int $userStatus STUDENT|COURSEMANAGER constants
5486 5487
      *
5487 5488
      * @return array|int
5488 5489
      */
@@ -5634,7 +5635,7 @@  discard block
 block discarded – undo
5634 5635
     /**
5635 5636
      * Get the list of course tools that have to be dealt with in case of
5636 5637
      * registering any course to a session
5637
-     * @return array The list of tools to be dealt with (literal names)
5638
+     * @return string[] The list of tools to be dealt with (literal names)
5638 5639
      */
5639 5640
     public static function getCourseToolToBeManaged()
5640 5641
     {
@@ -5648,7 +5649,7 @@  discard block
 block discarded – undo
5648 5649
      * Calls the methods bound to each tool when a course is registered into a session
5649 5650
      * @param int $sessionId
5650 5651
      * @param int $courseId
5651
-     * @return void
5652
+     * @return boolean|null
5652 5653
      */
5653 5654
     public static function installCourse($sessionId, $courseId)
5654 5655
     {
@@ -6288,6 +6289,7 @@  discard block
 block discarded – undo
6288 6289
      * @param int $categoryId The internal ID of the session category
6289 6290
      * @param string $target Value to search for in the session field values
6290 6291
      * @param array $extraFields A list of fields to be scanned and returned
6292
+     * @param DateTime $publicationDate
6291 6293
      * @return mixed
6292 6294
      */
6293 6295
     public static function getShortSessionListAndExtraByCategory($categoryId, $target, $extraFields = null, $publicationDate = null)
@@ -7618,7 +7620,7 @@  discard block
 block discarded – undo
7618 7620
     /**
7619 7621
      * Get link to the admin page for this session
7620 7622
      * @param   int $id Session ID
7621
-     * @return mixed    URL to the admin page to manage the session, or false on error
7623
+     * @return false|string    URL to the admin page to manage the session, or false on error
7622 7624
      */
7623 7625
     public static function getAdminPath($id)
7624 7626
     {
@@ -7635,7 +7637,7 @@  discard block
 block discarded – undo
7635 7637
      * If a course is provided, build the link to the course
7636 7638
      * @param   int $id Session ID
7637 7639
      * @param   int $courseId Course ID (optional) in case the link has to send straight to the course
7638
-     * @return mixed    URL to the page to use the session, or false on error
7640
+     * @return false|string    URL to the page to use the session, or false on error
7639 7641
      */
7640 7642
     public static function getPath($id, $courseId = 0)
7641 7643
     {
Please login to merge, or discard this patch.
Spacing   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
                     return $msg;
178 178
                 }
179 179
             } else {
180
-                $rs = Database::query("SELECT 1 FROM $tbl_session WHERE name='" . $name . "'");
180
+                $rs = Database::query("SELECT 1 FROM $tbl_session WHERE name='".$name."'");
181 181
                 if (Database::num_rows($rs)) {
182 182
                     $msg = get_lang('SessionNameAlreadyExists');
183 183
                     return $msg;
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     public static function session_name_exists($name)
291 291
     {
292 292
         $name = Database::escape_string($name);
293
-        $sql = "SELECT COUNT(*) as count FROM " . Database::get_main_table(TABLE_MAIN_SESSION) . "
293
+        $sql = "SELECT COUNT(*) as count FROM ".Database::get_main_table(TABLE_MAIN_SESSION)."
294 294
                 WHERE name = '$name'";
295 295
         $result = Database::fetch_array(Database::query($sql));
296 296
 
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
             $where .= " AND (
322 322
                             s.session_admin_id = $user_id  OR
323 323
                             sru.user_id = '$user_id' AND
324
-                            sru.relation_type = '" . SESSION_RELATION_TYPE_RRHH . "'
324
+                            sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."'
325 325
                             )
326 326
                       ";
327 327
 
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
             $where_condition = str_replace('category_name', 'sc.name', $where_condition);
340 340
             $where_condition = str_replace(
341 341
                 array("AND session_active = '1'  )", " AND (  session_active = '1'  )"),
342
-                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 " )
342
+                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 ")
343 343
                 , $where_condition
344 344
             );
345 345
             $where_condition = str_replace(
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 
385 385
             $access_url_id = api_get_current_access_url_id();
386 386
             if ($access_url_id != -1) {
387
-                $where.= " AND ar.access_url_id = $access_url_id ";
387
+                $where .= " AND ar.access_url_id = $access_url_id ";
388 388
 
389 389
                 $sql = "SELECT count(id) as total_rows FROM (
390 390
                 SELECT DISTINCT
@@ -434,14 +434,14 @@  discard block
 block discarded – undo
434 434
             if (api_is_session_admin() &&
435 435
                 api_get_setting('allow_session_admins_to_manage_all_sessions') == 'false'
436 436
             ) {
437
-                $where .=" AND s.session_admin_id = $user_id ";
437
+                $where .= " AND s.session_admin_id = $user_id ";
438 438
             }
439 439
         }
440 440
 
441 441
         if (!api_is_platform_admin() && api_is_teacher() &&
442 442
             api_get_setting('allow_teachers_to_create_sessions') == 'true'
443 443
         ) {
444
-            $where .=" AND s.id_coach = $user_id ";
444
+            $where .= " AND s.id_coach = $user_id ";
445 445
         }
446 446
 
447 447
         $extra_field = new ExtraFieldModel('session');
@@ -491,10 +491,10 @@  discard block
 block discarded – undo
491 491
         $query = "$select FROM $tbl_session s $inject_joins $where $inject_where";
492 492
 
493 493
         if (api_is_multiple_url_enabled()) {
494
-            $table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
494
+            $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
495 495
             $access_url_id = api_get_current_access_url_id();
496 496
             if ($access_url_id != -1) {
497
-                $where.= " AND ar.access_url_id = $access_url_id ";
497
+                $where .= " AND ar.access_url_id = $access_url_id ";
498 498
                 $query = "$select
499 499
                         FROM $tbl_session s $inject_joins
500 500
                         INNER JOIN $table_access_url_rel_session ar
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
                 INNER JOIN $tbl_lp l ON l.id = v.lp_id
599 599
                 INNER JOIN $tbl_user u ON u.user_id = v.user_id
600 600
                 INNER JOIN $tbl_course c
601
-                WHERE v.session_id = " . $sessionId;
601
+                WHERE v.session_id = ".$sessionId;
602 602
         $result_rows = Database::query($sql);
603 603
         $row = Database::fetch_array($result_rows);
604 604
         $num = $row['total_rows'];
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 
651 651
         $limit = null;
652 652
         if (!empty($options['limit'])) {
653
-            $limit = " LIMIT " . $options['limit'];
653
+            $limit = " LIMIT ".$options['limit'];
654 654
         }
655 655
 
656 656
         if (!empty($options['where'])) {
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 
660 660
         $order = null;
661 661
         if (!empty($options['order'])) {
662
-            $order = " ORDER BY " . $options['order'];
662
+            $order = " ORDER BY ".$options['order'];
663 663
         }
664 664
 
665 665
         $sql = "SELECT u.user_id, u.lastname, u.firstname, u.username, u.email, s.c_id
@@ -718,13 +718,13 @@  discard block
 block discarded – undo
718 718
             foreach ($lessons as $lesson) {
719 719
                 $data[$lesson['id']] = (!empty($user_lessons[$lesson['id']]['progress'])) ? $user_lessons[$lesson['id']]['progress'] : 0;
720 720
                 $progress += $data[$lesson['id']];
721
-                $data[$lesson['id']] = $data[$lesson['id']] . '%';
721
+                $data[$lesson['id']] = $data[$lesson['id']].'%';
722 722
                 $count++;
723 723
             }
724 724
             if ($count == 0) {
725 725
                 $data['total'] = 0;
726 726
             } else {
727
-                $data['total'] = round($progress / $count, 2) . '%';
727
+                $data['total'] = round($progress / $count, 2).'%';
728 728
             }
729 729
             $table[] = $data;
730 730
         }
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 
766 766
         $limit = null;
767 767
         if (!empty($options['limit'])) {
768
-            $limit = " LIMIT " . $options['limit'];
768
+            $limit = " LIMIT ".$options['limit'];
769 769
         }
770 770
 
771 771
         if (!empty($options['where'])) {
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
 
775 775
         $order = null;
776 776
         if (!empty($options['order'])) {
777
-            $order = " ORDER BY " . $options['order'];
777
+            $order = " ORDER BY ".$options['order'];
778 778
         }
779 779
 
780 780
         $sql = "SELECT u.user_id, u.lastname, u.firstname, u.username, u.email, s.c_id
@@ -876,7 +876,7 @@  discard block
 block discarded – undo
876 876
 
877 877
         $limit = null;
878 878
         if (!empty($options['limit'])) {
879
-            $limit = " LIMIT " . $options['limit'];
879
+            $limit = " LIMIT ".$options['limit'];
880 880
         }
881 881
 
882 882
         if (!empty($options['where'])) {
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
 
886 886
         $order = null;
887 887
         if (!empty($options['order'])) {
888
-            $order = " ORDER BY " . $options['order'];
888
+            $order = " ORDER BY ".$options['order'];
889 889
         }
890 890
 
891 891
         //TODO, fix create report without session
@@ -918,7 +918,7 @@  discard block
 block discarded – undo
918 918
         /**
919 919
          *  Lessons
920 920
          */
921
-        $sql = "SELECT * FROM $tbl_course_lp WHERE c_id = %s ";  //AND session_id = %s
921
+        $sql = "SELECT * FROM $tbl_course_lp WHERE c_id = %s "; //AND session_id = %s
922 922
         $sql_query = sprintf($sql, $course['real_id']);
923 923
         $result = Database::query($sql_query);
924 924
         $arrLesson = array(array());
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
             if (empty($arrLesson[$row['session_id']]['lessons_total'])) {
927 927
                 $arrLesson[$row['session_id']]['lessons_total'] = 1;
928 928
             } else {
929
-                $arrLesson[$row['session_id']]['lessons_total'] ++;
929
+                $arrLesson[$row['session_id']]['lessons_total']++;
930 930
             }
931 931
         }
932 932
 
@@ -1000,7 +1000,7 @@  discard block
 block discarded – undo
1000 1000
                 $course['real_id']
1001 1001
             );
1002 1002
             foreach ($user_list as $user_id) {
1003
-                isset($survey_user_list[$user_id]) ? $survey_user_list[$user_id] ++ : $survey_user_list[$user_id] = 1;
1003
+                isset($survey_user_list[$user_id]) ? $survey_user_list[$user_id]++ : $survey_user_list[$user_id] = 1;
1004 1004
             }
1005 1005
         }
1006 1006
 
@@ -1054,7 +1054,7 @@  discard block
 block discarded – undo
1054 1054
             $assignments_done = Tracking::count_student_assignments($user['user_id'], $course['code'], $user['id_session']);
1055 1055
             $assignments_left = $assignments_total - $assignments_done;
1056 1056
             if (!empty($assignments_total)) {
1057
-                $assignments_progress = round((( $assignments_done * 100 ) / $assignments_total), 2);
1057
+                $assignments_progress = round((($assignments_done * 100) / $assignments_total), 2);
1058 1058
             } else {
1059 1059
                 $assignments_progress = 0;
1060 1060
             }
@@ -1084,7 +1084,7 @@  discard block
 block discarded – undo
1084 1084
             $wiki_read = $row['count'];
1085 1085
             $wiki_unread = $wiki_total - $wiki_read;
1086 1086
             if (!empty($wiki_total)) {
1087
-                $wiki_progress = round((( $wiki_read * 100 ) / $wiki_total), 2);
1087
+                $wiki_progress = round((($wiki_read * 100) / $wiki_total), 2);
1088 1088
             } else {
1089 1089
                 $wiki_progress = 0;
1090 1090
             }
@@ -1093,7 +1093,7 @@  discard block
 block discarded – undo
1093 1093
             $surveys_done = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0);
1094 1094
             $surveys_left = $surveys_total - $surveys_done;
1095 1095
             if (!empty($surveys_total)) {
1096
-                $surveys_progress = round((( $surveys_done * 100 ) / $surveys_total), 2);
1096
+                $surveys_progress = round((($surveys_done * 100) / $surveys_total), 2);
1097 1097
             } else {
1098 1098
                 $surveys_progress = 0;
1099 1099
             }
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
             );
1107 1107
             $forums_left = $forums_total - $forums_done;
1108 1108
             if (!empty($forums_total)) {
1109
-                $forums_progress = round((( $forums_done * 100 ) / $forums_total), 2);
1109
+                $forums_progress = round((($forums_done * 100) / $forums_total), 2);
1110 1110
             } else {
1111 1111
                 $forums_progress = 0;
1112 1112
             }
@@ -1114,58 +1114,58 @@  discard block
 block discarded – undo
1114 1114
             //Overall Total
1115 1115
             $overall_total = ($course_description_progress + $exercises_progress + $forums_progress + $assignments_progress + $wiki_progress + $surveys_progress) / 6;
1116 1116
 
1117
-            $link = '<a href="' . api_get_path(WEB_CODE_PATH) . 'mySpace/myStudents.php?student=' . $user[0] . '&details=true&course=' . $course['code'] . '&id_session=' . $user['id_session'] . '"> %s </a>';
1118
-            $linkForum = '<a href="' . api_get_path(WEB_CODE_PATH) . 'forum/index.php?cidReq=' . $course['code'] . '&id_session=' . $user['id_session'] . '"> %s </a>';
1119
-            $linkWork = '<a href="' . api_get_path(WEB_CODE_PATH) . 'work/work.php?cidReq=' . $course['code'] . '&id_session=' . $user['id_session'] . '"> %s </a>';
1120
-            $linkWiki = '<a href="' . api_get_path(WEB_CODE_PATH) . 'wiki/index.php?cidReq=' . $course['code'] . '&session_id=' . $user['id_session'] . '&action=statistics"> %s </a>';
1121
-            $linkSurvey = '<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/survey_list.php?cidReq=' . $course['code'] . '&id_session=' . $user['id_session'] . '"> %s </a>';
1117
+            $link = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?student='.$user[0].'&details=true&course='.$course['code'].'&id_session='.$user['id_session'].'"> %s </a>';
1118
+            $linkForum = '<a href="'.api_get_path(WEB_CODE_PATH).'forum/index.php?cidReq='.$course['code'].'&id_session='.$user['id_session'].'"> %s </a>';
1119
+            $linkWork = '<a href="'.api_get_path(WEB_CODE_PATH).'work/work.php?cidReq='.$course['code'].'&id_session='.$user['id_session'].'"> %s </a>';
1120
+            $linkWiki = '<a href="'.api_get_path(WEB_CODE_PATH).'wiki/index.php?cidReq='.$course['code'].'&session_id='.$user['id_session'].'&action=statistics"> %s </a>';
1121
+            $linkSurvey = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?cidReq='.$course['code'].'&id_session='.$user['id_session'].'"> %s </a>';
1122 1122
 
1123 1123
             $table[] = array(
1124 1124
                 'lastname' => $user[1],
1125 1125
                 'firstname' => $user[2],
1126 1126
                 'username' => $user[3],
1127 1127
                 #'profile'   => '',
1128
-                'total' => round($overall_total, 2) . '%',
1129
-                'courses' => sprintf($link, $course_description_progress . '%'),
1130
-                'lessons' => sprintf($link, $lessons_progress . '%'),
1131
-                'exercises' => sprintf($link, $exercises_progress . '%'),
1132
-                'forums' => sprintf($link, $forums_progress . '%'),
1133
-                'homeworks' => sprintf($link, $assignments_progress . '%'),
1134
-                'wikis' => sprintf($link, $wiki_progress . '%'),
1135
-                'surveys' => sprintf($link, $surveys_progress . '%'),
1128
+                'total' => round($overall_total, 2).'%',
1129
+                'courses' => sprintf($link, $course_description_progress.'%'),
1130
+                'lessons' => sprintf($link, $lessons_progress.'%'),
1131
+                'exercises' => sprintf($link, $exercises_progress.'%'),
1132
+                'forums' => sprintf($link, $forums_progress.'%'),
1133
+                'homeworks' => sprintf($link, $assignments_progress.'%'),
1134
+                'wikis' => sprintf($link, $wiki_progress.'%'),
1135
+                'surveys' => sprintf($link, $surveys_progress.'%'),
1136 1136
                 //course description
1137
-                'course_description_progress' => $course_description_progress . '%',
1137
+                'course_description_progress' => $course_description_progress.'%',
1138 1138
                 //lessons
1139 1139
                 'lessons_total' => sprintf($link, $lessons_total),
1140 1140
                 'lessons_done' => sprintf($link, $lessons_done),
1141 1141
                 'lessons_left' => sprintf($link, $lessons_left),
1142
-                'lessons_progress' => sprintf($link, $lessons_progress . '%'),
1142
+                'lessons_progress' => sprintf($link, $lessons_progress.'%'),
1143 1143
                 //exercises
1144 1144
                 'exercises_total' => sprintf($link, $exercises_total),
1145 1145
                 'exercises_done' => sprintf($link, $exercises_done),
1146 1146
                 'exercises_left' => sprintf($link, $exercises_left),
1147
-                'exercises_progress' => sprintf($link, $exercises_progress . '%'),
1147
+                'exercises_progress' => sprintf($link, $exercises_progress.'%'),
1148 1148
                 //forums
1149 1149
                 'forums_total' => sprintf($linkForum, $forums_total),
1150 1150
                 'forums_done' => sprintf($linkForum, $forums_done),
1151 1151
                 'forums_left' => sprintf($linkForum, $forums_left),
1152
-                'forums_progress' => sprintf($linkForum, $forums_progress . '%'),
1152
+                'forums_progress' => sprintf($linkForum, $forums_progress.'%'),
1153 1153
                 //assignments
1154 1154
                 'assignments_total' => sprintf($linkWork, $assignments_total),
1155 1155
                 'assignments_done' => sprintf($linkWork, $assignments_done),
1156 1156
                 'assignments_left' => sprintf($linkWork, $assignments_left),
1157
-                'assignments_progress' => sprintf($linkWork, $assignments_progress . '%'),
1157
+                'assignments_progress' => sprintf($linkWork, $assignments_progress.'%'),
1158 1158
                 //wiki
1159 1159
                 'wiki_total' => sprintf($linkWiki, $wiki_total),
1160 1160
                 'wiki_revisions' => sprintf($linkWiki, $wiki_revisions),
1161 1161
                 'wiki_read' => sprintf($linkWiki, $wiki_read),
1162 1162
                 'wiki_unread' => sprintf($linkWiki, $wiki_unread),
1163
-                'wiki_progress' => sprintf($linkWiki, $wiki_progress . '%'),
1163
+                'wiki_progress' => sprintf($linkWiki, $wiki_progress.'%'),
1164 1164
                 //survey
1165 1165
                 'surveys_total' => sprintf($linkSurvey, $surveys_total),
1166 1166
                 'surveys_done' => sprintf($linkSurvey, $surveys_done),
1167 1167
                 'surveys_left' => sprintf($linkSurvey, $surveys_left),
1168
-                'surveys_progress' => sprintf($linkSurvey, $surveys_progress . '%'),
1168
+                'surveys_progress' => sprintf($linkSurvey, $surveys_progress.'%'),
1169 1169
             );
1170 1170
         }
1171 1171
 
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
 
1246 1246
         $limit = null;
1247 1247
         if (!empty($options['limit'])) {
1248
-            $limit = " LIMIT " . $options['limit'];
1248
+            $limit = " LIMIT ".$options['limit'];
1249 1249
         }
1250 1250
 
1251 1251
         if (!empty($options['where'])) {
@@ -1254,7 +1254,7 @@  discard block
 block discarded – undo
1254 1254
 
1255 1255
         $order = null;
1256 1256
         if (!empty($options['order'])) {
1257
-            $order = " ORDER BY " . $options['order'];
1257
+            $order = " ORDER BY ".$options['order'];
1258 1258
         }
1259 1259
 
1260 1260
         //TODO add course name
@@ -1267,7 +1267,7 @@  discard block
 block discarded – undo
1267 1267
                     " : "
1268 1268
                     u.lastname,
1269 1269
                     u.firstname,
1270
-                ") . "
1270
+                ")."
1271 1271
                 a.logout_course_date,
1272 1272
                 a.counter,
1273 1273
                 c.title,
@@ -1349,7 +1349,7 @@  discard block
 block discarded – undo
1349 1349
             if (Database::num_rows($result) > 0) {
1350 1350
                 $row = Database::fetch_array($result);
1351 1351
                 $count = $row['count'] + 1;
1352
-                $session_name = $session_name . '_' . $count;
1352
+                $session_name = $session_name.'_'.$count;
1353 1353
                 $result = self::session_name_exists($session_name);
1354 1354
                 if (!$result) {
1355 1355
                     return $session_name;
@@ -1844,7 +1844,7 @@  discard block
 block discarded – undo
1844 1844
         // Delete users from the session
1845 1845
         if ($empty_users === true) {
1846 1846
             $sql = "DELETE FROM $tbl_session_rel_user
1847
-                    WHERE session_id = $id_session AND relation_type<>" . SESSION_RELATION_TYPE_RRHH . "";
1847
+                    WHERE session_id = $id_session AND relation_type<>".SESSION_RELATION_TYPE_RRHH."";
1848 1848
             Database::query($sql);
1849 1849
         }
1850 1850
 
@@ -1855,7 +1855,7 @@  discard block
 block discarded – undo
1855 1855
             $enreg_user = Database::escape_string($enreg_user);
1856 1856
             $nbr_users++;
1857 1857
             $sql = "INSERT IGNORE INTO $tbl_session_rel_user (relation_type, session_id, user_id, registered_at)
1858
-                    VALUES (0, $id_session, $enreg_user, '" . api_get_utc_datetime() . "')";
1858
+                    VALUES (0, $id_session, $enreg_user, '".api_get_utc_datetime()."')";
1859 1859
             Database::query($sql);
1860 1860
         }
1861 1861
 
@@ -1945,9 +1945,9 @@  discard block
 block discarded – undo
1945 1945
         is_array($courseInfo) ? $courseId = $courseInfo['real_id'] : $courseId = $courseInfo;
1946 1946
 
1947 1947
         $statusCondition = null;
1948
-        if (isset($status) && !is_null($status))  {
1948
+        if (isset($status) && !is_null($status)) {
1949 1949
             $status = intval($status);
1950
-            $statusCondition  = " AND status = $status";
1950
+            $statusCondition = " AND status = $status";
1951 1951
         }
1952 1952
 
1953 1953
         foreach ($userList as $userId) {
@@ -2079,7 +2079,7 @@  discard block
 block discarded – undo
2079 2079
             if (empty($count)) {
2080 2080
                 // If user is not registered to a session then add it.
2081 2081
                 $sql = "INSERT IGNORE INTO $tbl_session_rel_user (session_id, user_id, registered_at)
2082
-                        VALUES ($session_id, $enreg_user, '" . api_get_utc_datetime() . "')";
2082
+                        VALUES ($session_id, $enreg_user, '".api_get_utc_datetime()."')";
2083 2083
                 Database::query($sql);
2084 2084
 
2085 2085
                 $sql = "UPDATE $tbl_session SET nbr_users = nbr_users + 1
@@ -2122,7 +2122,7 @@  discard block
 block discarded – undo
2122 2122
                 WHERE
2123 2123
                     session_id = $session_id AND
2124 2124
                     user_id = $user_id AND
2125
-                    relation_type <> " . SESSION_RELATION_TYPE_RRHH . "";
2125
+                    relation_type <> ".SESSION_RELATION_TYPE_RRHH."";
2126 2126
         $result = Database::query($sql);
2127 2127
         $return = Database::affected_rows($result);
2128 2128
 
@@ -2207,7 +2207,7 @@  discard block
 block discarded – undo
2207 2207
                 FROM $tbl_session_rel_user
2208 2208
                 WHERE
2209 2209
                     session_id = $sessionId AND
2210
-                    relation_type<>" . SESSION_RELATION_TYPE_RRHH;
2210
+                    relation_type<>".SESSION_RELATION_TYPE_RRHH;
2211 2211
         $result = Database::query($sql);
2212 2212
         $user_list = Database::store_result($result);
2213 2213
 
@@ -2218,7 +2218,7 @@  discard block
 block discarded – undo
2218 2218
 
2219 2219
                     $sql = "DELETE FROM $tbl_session_rel_course
2220 2220
                             WHERE
2221
-                                c_id = " . $existingCourse['c_id'] . " AND
2221
+                                c_id = ".$existingCourse['c_id']." AND
2222 2222
                                 session_id = $sessionId";
2223 2223
                     Database::query($sql);
2224 2224
 
@@ -2281,7 +2281,7 @@  discard block
 block discarded – undo
2281 2281
                             $links = $cat->get_links(null, false, $courseInfo['code'], 0);
2282 2282
 
2283 2283
                             $cat->set_session_id($sessionId);
2284
-                            $oldCategoryId= $cat->get_id();
2284
+                            $oldCategoryId = $cat->get_id();
2285 2285
                             $newId = $cat->add();
2286 2286
                             $newCategoryIdList[$oldCategoryId] = $newId;
2287 2287
                             $parentId = $cat->get_parent_id();
@@ -2468,7 +2468,7 @@  discard block
 block discarded – undo
2468 2468
         $return_value = false;
2469 2469
         $sql = "SELECT c_id FROM $tbl_session_course
2470 2470
                 WHERE
2471
-                  session_id = " . intval($session_id) . " AND
2471
+                  session_id = ".intval($session_id)." AND
2472 2472
                   c_id = " . intval($courseId);
2473 2473
         $result = Database::query($sql);
2474 2474
         $num = Database::num_rows($result);
@@ -2492,8 +2492,8 @@  discard block
 block discarded – undo
2492 2492
         }
2493 2493
 
2494 2494
         $sql = 'SELECT *
2495
-		        FROM ' . $tbl_session . '
2496
-		        WHERE name = "' . Database::escape_string($session_name) . '"';
2495
+		        FROM ' . $tbl_session.'
2496
+		        WHERE name = "' . Database::escape_string($session_name).'"';
2497 2497
         $result = Database::query($sql);
2498 2498
         $num = Database::num_rows($result);
2499 2499
         if ($num > 0) {
@@ -2533,8 +2533,8 @@  discard block
 block discarded – undo
2533 2533
         $month_end = intval($smonth_end);
2534 2534
         $day_end = intval($sday_end);
2535 2535
 
2536
-        $date_start = "$year_start-" . (($month_start < 10) ? "0$month_start" : $month_start) . "-" . (($day_start < 10) ? "0$day_start" : $day_start);
2537
-        $date_end = "$year_end-" . (($month_end < 10) ? "0$month_end" : $month_end) . "-" . (($day_end < 10) ? "0$day_end" : $day_end);
2536
+        $date_start = "$year_start-".(($month_start < 10) ? "0$month_start" : $month_start)."-".(($day_start < 10) ? "0$day_start" : $day_start);
2537
+        $date_end = "$year_end-".(($month_end < 10) ? "0$month_end" : $month_end)."-".(($day_end < 10) ? "0$day_end" : $day_end);
2538 2538
 
2539 2539
         if (empty($name)) {
2540 2540
             $msg = get_lang('SessionCategoryNameIsRequired');
@@ -2606,8 +2606,8 @@  discard block
 block discarded – undo
2606 2606
         $month_end = intval($smonth_end);
2607 2607
         $day_end = intval($sday_end);
2608 2608
         $id = intval($id);
2609
-        $date_start = "$year_start-" . (($month_start < 10) ? "0$month_start" : $month_start) . "-" . (($day_start < 10) ? "0$day_start" : $day_start);
2610
-        $date_end = "$year_end-" . (($month_end < 10) ? "0$month_end" : $month_end) . "-" . (($day_end < 10) ? "0$day_end" : $day_end);
2609
+        $date_start = "$year_start-".(($month_start < 10) ? "0$month_start" : $month_start)."-".(($day_start < 10) ? "0$day_start" : $day_start);
2610
+        $date_end = "$year_end-".(($month_end < 10) ? "0$month_end" : $month_end)."-".(($day_end < 10) ? "0$day_end" : $day_end);
2611 2611
 
2612 2612
         if (empty($name)) {
2613 2613
             $msg = get_lang('SessionCategoryNameIsRequired');
@@ -2627,13 +2627,13 @@  discard block
 block discarded – undo
2627 2627
         if ($date_end <> null) {
2628 2628
             $sql = "UPDATE $tbl_session_category
2629 2629
                     SET
2630
-                        name = '" . Database::escape_string($name) . "',
2630
+                        name = '".Database::escape_string($name)."',
2631 2631
                         date_start = '$date_start' ,
2632 2632
                         date_end = '$date_end'
2633 2633
                     WHERE id= $id";
2634 2634
         } else {
2635 2635
             $sql = "UPDATE $tbl_session_category SET
2636
-                        name = '" . Database::escape_string($name) . "',
2636
+                        name = '".Database::escape_string($name)."',
2637 2637
                         date_start = '$date_start',
2638 2638
                         date_end = NULL
2639 2639
                     WHERE id= $id";
@@ -2663,10 +2663,10 @@  discard block
 block discarded – undo
2663 2663
 
2664 2664
         //Setting session_category_id to 0
2665 2665
         $sql = "UPDATE $tbl_session SET session_category_id = 0
2666
-                WHERE session_category_id IN (" . $id_checked . ")";
2666
+                WHERE session_category_id IN (".$id_checked.")";
2667 2667
         Database::query($sql);
2668 2668
 
2669
-        $sql = "SELECT id FROM $tbl_session WHERE session_category_id IN (" . $id_checked . ")";
2669
+        $sql = "SELECT id FROM $tbl_session WHERE session_category_id IN (".$id_checked.")";
2670 2670
         $result = Database::query($sql);
2671 2671
         while ($rows = Database::fetch_array($result)) {
2672 2672
             $session_id = $rows['id'];
@@ -2678,7 +2678,7 @@  discard block
 block discarded – undo
2678 2678
                 }
2679 2679
             }
2680 2680
         }
2681
-        $sql = "DELETE FROM $tbl_session_category WHERE id IN (" . $id_checked . ")";
2681
+        $sql = "DELETE FROM $tbl_session_category WHERE id IN (".$id_checked.")";
2682 2682
         Database::query($sql);
2683 2683
 
2684 2684
         // Add event to system log
@@ -2751,7 +2751,7 @@  discard block
 block discarded – undo
2751 2751
                 $value = Database::escape_string($options['value']);
2752 2752
                 $sql_query .= ' AND ';
2753 2753
                 if (in_array($field, $availableFields) && in_array($operator, $availableOperator)) {
2754
-                    $sql_query .= $field . " $operator '" . $value . "'";
2754
+                    $sql_query .= $field." $operator '".$value."'";
2755 2755
                 }
2756 2756
             }
2757 2757
         }
@@ -2818,8 +2818,8 @@  discard block
 block discarded – undo
2818 2818
     {
2819 2819
         $tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
2820 2820
         $id = api_get_current_access_url_id();
2821
-        $sql = 'SELECT * FROM ' . $tbl_session_category . '
2822
-                WHERE access_url_id = ' . $id . '
2821
+        $sql = 'SELECT * FROM '.$tbl_session_category.'
2822
+                WHERE access_url_id = ' . $id.'
2823 2823
                 ORDER BY name ASC';
2824 2824
         $result = Database::query($sql);
2825 2825
         if (Database::num_rows($result) > 0) {
@@ -2972,7 +2972,7 @@  discard block
 block discarded – undo
2972 2972
         $sql = "DELETE FROM $tbl_session_rel_user
2973 2973
                 WHERE
2974 2974
                     session_id = $sessionId AND                            
2975
-                    relation_type =" . SESSION_RELATION_TYPE_RRHH;
2975
+                    relation_type =".SESSION_RELATION_TYPE_RRHH;
2976 2976
         Database::query($sql);
2977 2977
 
2978 2978
         return true;
@@ -3026,12 +3026,12 @@  discard block
 block discarded – undo
3026 3026
                         ON (a.session_id = s.session_id)
3027 3027
                         WHERE
3028 3028
                             s.user_id = $userId AND
3029
-                            relation_type = " . SESSION_RELATION_TYPE_RRHH . " AND
3029
+                            relation_type = ".SESSION_RELATION_TYPE_RRHH." AND
3030 3030
                             access_url_id = " . api_get_current_access_url_id();
3031 3031
             } else {
3032 3032
                 $sql = "SELECT s.session_id 
3033 3033
                         FROM $tbl_session_rel_user s
3034
-                        WHERE user_id = $userId AND relation_type=" . SESSION_RELATION_TYPE_RRHH;
3034
+                        WHERE user_id = $userId AND relation_type=".SESSION_RELATION_TYPE_RRHH;
3035 3035
             }
3036 3036
             $result = Database::query($sql);
3037 3037
 
@@ -3041,7 +3041,7 @@  discard block
 block discarded – undo
3041 3041
                             WHERE
3042 3042
                                 session_id = {$row['session_id']} AND
3043 3043
                                 user_id = $userId AND
3044
-                                relation_type =" . SESSION_RELATION_TYPE_RRHH;
3044
+                                relation_type =".SESSION_RELATION_TYPE_RRHH;
3045 3045
                     Database::query($sql);
3046 3046
                 }
3047 3047
             }
@@ -3055,8 +3055,8 @@  discard block
 block discarded – undo
3055 3055
                         VALUES (
3056 3056
                             $session_id,
3057 3057
                             $userId,
3058
-                            '" . SESSION_RELATION_TYPE_RRHH . "',
3059
-                            '" . api_get_utc_datetime() . "'
3058
+                            '".SESSION_RELATION_TYPE_RRHH."',
3059
+                            '" . api_get_utc_datetime()."'
3060 3060
                         )";
3061 3061
                 Database::query($sql);
3062 3062
                 $affected_rows++;
@@ -3097,8 +3097,8 @@  discard block
 block discarded – undo
3097 3097
                     WHERE
3098 3098
                         sru.user_id = '$userId' AND
3099 3099
                         sru.session_id = '$sessionId' AND
3100
-                        sru.relation_type = '" . SESSION_RELATION_TYPE_RRHH . "' AND
3101
-                        access_url_id = " . api_get_current_access_url_id() . "
3100
+                        sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."' AND
3101
+                        access_url_id = " . api_get_current_access_url_id()."
3102 3102
                         ";
3103 3103
         } else {
3104 3104
             $sql = "$select FROM $tbl_session s
@@ -3107,7 +3107,7 @@  discard block
 block discarded – undo
3107 3107
                         sru.session_id = s.id AND
3108 3108
                         sru.user_id = '$userId' AND
3109 3109
                         sru.session_id = '$sessionId' AND
3110
-                        sru.relation_type = '" . SESSION_RELATION_TYPE_RRHH . "'
3110
+                        sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."'
3111 3111
                     ";
3112 3112
         }
3113 3113
 
@@ -3206,7 +3206,7 @@  discard block
 block discarded – undo
3206 3206
 
3207 3207
         $limitCondition = null;
3208 3208
         if (!empty($start) && !empty($limit)) {
3209
-            $limitCondition = " LIMIT " . intval($start) . ", " . intval($limit);
3209
+            $limitCondition = " LIMIT ".intval($start).", ".intval($limit);
3210 3210
         }
3211 3211
 
3212 3212
         if (empty($orderCondition)) {
@@ -3284,26 +3284,26 @@  discard block
 block discarded – undo
3284 3284
 
3285 3285
         $sessions = array();
3286 3286
         if (Database::num_rows($result) > 0) {
3287
-            $sysUploadPath = api_get_path(SYS_UPLOAD_PATH). 'sessions/';
3288
-            $webUploadPath = api_get_path(WEB_UPLOAD_PATH). 'sessions/';
3287
+            $sysUploadPath = api_get_path(SYS_UPLOAD_PATH).'sessions/';
3288
+            $webUploadPath = api_get_path(WEB_UPLOAD_PATH).'sessions/';
3289 3289
             $imgPath = Display::return_icon('session_default_small.png', null, null, null, null, true);
3290 3290
 
3291 3291
             $tableExtraFields = Database::get_main_table(TABLE_EXTRA_FIELD);
3292
-            $sql = "SELECT id FROM " . $tableExtraFields . "
3292
+            $sql = "SELECT id FROM ".$tableExtraFields."
3293 3293
                     WHERE extra_field_type = 3 AND variable='image'";
3294 3294
             $resultField = Database::query($sql);
3295 3295
             $imageFieldId = Database::fetch_assoc($resultField);
3296 3296
 
3297 3297
             while ($row = Database::fetch_array($result)) {
3298 3298
 
3299
-                $row['image'] =  null;
3300
-                $sessionImage = $sysUploadPath . $imageFieldId['id'] . '_' . $row['id'] . '.png';
3299
+                $row['image'] = null;
3300
+                $sessionImage = $sysUploadPath.$imageFieldId['id'].'_'.$row['id'].'.png';
3301 3301
 
3302 3302
                 if (is_file($sessionImage)) {
3303
-                    $sessionImage = $webUploadPath . $imageFieldId['id'] . '_' . $row['id'] . '.png';
3303
+                    $sessionImage = $webUploadPath.$imageFieldId['id'].'_'.$row['id'].'.png';
3304 3304
                     $row['image'] = $sessionImage;
3305 3305
                 } else {
3306
-                    $row['image'] =  $imgPath;
3306
+                    $row['image'] = $imgPath;
3307 3307
                 }
3308 3308
 
3309 3309
                 if ($row['display_start_date'] == '0000-00-00 00:00:00' || $row['display_start_date'] == '0000-00-00') {
@@ -3403,7 +3403,7 @@  discard block
 block discarded – undo
3403 3403
                 return intval($count['count']);
3404 3404
             }
3405 3405
 
3406
-            while ($row = Database::fetch_array($result,'ASSOC'))	{
3406
+            while ($row = Database::fetch_array($result, 'ASSOC')) {
3407 3407
                 $courses[$row['real_id']] = $row;
3408 3408
             }
3409 3409
         }
@@ -3447,7 +3447,7 @@  discard block
 block discarded – undo
3447 3447
         }
3448 3448
 
3449 3449
         $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
3450
-        $tbl_session_rel_course	= Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
3450
+        $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
3451 3451
 
3452 3452
         if ($getCount) {
3453 3453
             $select = "SELECT COUNT(DISTINCT(c.code)) as count ";
@@ -3472,7 +3472,7 @@  discard block
 block discarded – undo
3472 3472
 		        ";
3473 3473
         if ($getCount) {
3474 3474
             $result = Database::query($sql);
3475
-            $row = Database::fetch_array($result,'ASSOC');
3475
+            $row = Database::fetch_array($result, 'ASSOC');
3476 3476
             return $row['count'];
3477 3477
         }
3478 3478
 
@@ -3487,7 +3487,7 @@  discard block
 block discarded – undo
3487 3487
         $courses = array();
3488 3488
 
3489 3489
         if ($num_rows > 0) {
3490
-            while ($row = Database::fetch_array($result,'ASSOC'))	{
3490
+            while ($row = Database::fetch_array($result, 'ASSOC')) {
3491 3491
                 $courses[$row['id']] = $row;
3492 3492
             }
3493 3493
         }
@@ -3565,7 +3565,7 @@  discard block
 block discarded – undo
3565 3565
         $result = Database::query($sql);
3566 3566
         $num_rows = Database::num_rows($result);
3567 3567
         if ($num_rows > 0) {
3568
-            $row = Database::fetch_array($result,'ASSOC');
3568
+            $row = Database::fetch_array($result, 'ASSOC');
3569 3569
             return $row['count'];
3570 3570
         }
3571 3571
 
@@ -3684,9 +3684,9 @@  discard block
 block discarded – undo
3684 3684
 
3685 3685
             if ($access_url_id != -1) {
3686 3686
                 $sql = 'SELECT DISTINCT session.*
3687
-                    FROM ' . $session_table . ' session INNER JOIN ' . $tbl_session_rel_access_url . ' session_rel_url
3687
+                    FROM ' . $session_table.' session INNER JOIN '.$tbl_session_rel_access_url.' session_rel_url
3688 3688
                     ON (session.id = session_rel_url.session_id)
3689
-                    WHERE '.$sqlCoach.' access_url_id = ' . $access_url_id;
3689
+                    WHERE '.$sqlCoach.' access_url_id = '.$access_url_id;
3690 3690
             }
3691 3691
         }
3692 3692
         $sql .= ' ORDER by name';
@@ -3720,8 +3720,8 @@  discard block
 block discarded – undo
3720 3720
                 FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user
3721 3721
                 WHERE
3722 3722
                     session_rcru.user_id = user.user_id AND
3723
-                    session_rcru.session_id = '" . intval($session_id) . "' AND
3724
-                    session_rcru.c_id ='" . intval($courseId) . "' AND
3723
+                    session_rcru.session_id = '".intval($session_id)."' AND
3724
+                    session_rcru.c_id ='" . intval($courseId)."' AND
3725 3725
                     user.user_id = " . intval($user_id);
3726 3726
 
3727 3727
         $result = Database::query($sql);
@@ -3752,8 +3752,8 @@  discard block
 block discarded – undo
3752 3752
         $sql = "SELECT session_rcru.status
3753 3753
                 FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user
3754 3754
                 WHERE session_rcru.user_id = user.user_id AND
3755
-                    session_rcru.session_id = '" . intval($session_id) . "' AND
3756
-                    session_rcru.c_id ='" . intval($courseId) . "' AND
3755
+                    session_rcru.session_id = '".intval($session_id)."' AND
3756
+                    session_rcru.c_id ='" . intval($courseId)."' AND
3757 3757
                     user.user_id = " . intval($user_id);
3758 3758
         $result = Database::query($sql);
3759 3759
         $status = false;
@@ -3830,7 +3830,7 @@  discard block
 block discarded – undo
3830 3830
         // Get timestamp for now in UTC - see http://php.net/manual/es/function.time.php#117251
3831 3831
         $now = time() - date('Z');
3832 3832
         // Timestamp in one month
3833
-        $inOneMonth = $now + (30*24*3600);
3833
+        $inOneMonth = $now + (30 * 24 * 3600);
3834 3834
         $inOneMonth = api_get_local_time($inOneMonth);
3835 3835
         if (api_strtotime($s['access_start_date']) < $now) {
3836 3836
             $s['access_start_date'] = api_get_local_time($now);
@@ -3852,16 +3852,16 @@  discard block
 block discarded – undo
3852 3852
         }
3853 3853
         // Now try to create the session
3854 3854
         $sid = self::create_session(
3855
-            $s['name'] . ' ' . get_lang('CopyLabelSuffix'),
3855
+            $s['name'].' '.get_lang('CopyLabelSuffix'),
3856 3856
             $s['access_start_date'],
3857 3857
             $s['access_end_date'],
3858 3858
             $s['display_start_date'],
3859 3859
             $s['display_end_date'],
3860 3860
             $s['coach_access_start_date'],
3861 3861
             $s['coach_access_end_date'],
3862
-            (int)$s['id_coach'],
3862
+            (int) $s['id_coach'],
3863 3863
             $s['session_category_id'],
3864
-            (int)$s['visibility'],
3864
+            (int) $s['visibility'],
3865 3865
             true
3866 3866
         );
3867 3867
 
@@ -3975,7 +3975,7 @@  discard block
 block discarded – undo
3975 3975
         $session_table = Database::get_main_table(TABLE_MAIN_SESSION);
3976 3976
         $sql = "SELECT DISTINCT id
3977 3977
 	         	FROM $session_table
3978
-	         	WHERE session.id_coach =  '" . $user_id . "' AND id = '$session_id'";
3978
+	         	WHERE session.id_coach =  '".$user_id."' AND id = '$session_id'";
3979 3979
         $result = Database::query($sql);
3980 3980
         if ($result && Database::num_rows($result)) {
3981 3981
             return true;
@@ -3994,7 +3994,7 @@  discard block
 block discarded – undo
3994 3994
         $access_url_rel_session_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
3995 3995
         $sql = "SELECT count(id) FROM $session_table s";
3996 3996
         if (!empty($access_url_id) && $access_url_id == intval($access_url_id)) {
3997
-            $sql .= ", $access_url_rel_session_table u " .
3997
+            $sql .= ", $access_url_rel_session_table u ".
3998 3998
                 " WHERE s.id = u.session_id AND u.access_url_id = $access_url_id";
3999 3999
         }
4000 4000
         $res = Database::query($sql);
@@ -4233,7 +4233,7 @@  discard block
 block discarded – undo
4233 4233
 
4234 4234
         $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
4235 4235
         $tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
4236
-        $tbl_session_course  = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
4236
+        $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
4237 4237
         $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
4238 4238
 
4239 4239
         $sessions = array();
@@ -4369,10 +4369,10 @@  discard block
 block discarded – undo
4369 4369
                     $suffix = null;
4370 4370
                     while (!$unique_name) {
4371 4371
                         if ($i > 1) {
4372
-                            $suffix = ' - ' . $i;
4372
+                            $suffix = ' - '.$i;
4373 4373
                         }
4374
-                        $sql = 'SELECT 1 FROM ' . $tbl_session . '
4375
-                                WHERE name="' . Database::escape_string($session_name). $suffix . '"';
4374
+                        $sql = 'SELECT 1 FROM '.$tbl_session.'
4375
+                                WHERE name="' . Database::escape_string($session_name).$suffix.'"';
4376 4376
                         $rs = Database::query($sql);
4377 4377
 
4378 4378
                         if (Database::result($rs, 0, 0)) {
@@ -4385,14 +4385,14 @@  discard block
 block discarded – undo
4385 4385
 
4386 4386
                     // Creating the session.
4387 4387
                     $sql = "INSERT IGNORE INTO $tbl_session SET
4388
-                            name = '" . Database::escape_string($session_name). "',
4388
+                            name = '".Database::escape_string($session_name)."',
4389 4389
                             id_coach = '$coach_id',
4390 4390
                             access_start_date = '$dateStart',
4391 4391
                             access_end_date = '$dateEnd',
4392 4392
                             display_start_date = '$dateStart',
4393 4393
                             display_end_date = '$dateEnd',
4394 4394
                             visibility = '$visibilityAfterExpirationPerSession',                            
4395
-                            session_admin_id = " . $defaultUserId . " 
4395
+                            session_admin_id = ".$defaultUserId." 
4396 4396
                             $sessionCondition $extraParameters $extraSessionParameters";
4397 4397
                     Database::query($sql);
4398 4398
 
@@ -4458,7 +4458,7 @@  discard block
 block discarded – undo
4458 4458
 
4459 4459
                             // Delete session-user relation only for students
4460 4460
                             $sql = "DELETE FROM $tbl_session_user
4461
-                                    WHERE session_id = '$session_id' AND relation_type <> " . SESSION_RELATION_TYPE_RRHH;
4461
+                                    WHERE session_id = '$session_id' AND relation_type <> ".SESSION_RELATION_TYPE_RRHH;
4462 4462
                             Database::query($sql);
4463 4463
 
4464 4464
                             $sql = "DELETE FROM $tbl_session_course WHERE session_id = '$session_id'";
@@ -4549,7 +4549,7 @@  discard block
 block discarded – undo
4549 4549
 
4550 4550
                             // Delete session-user relation only for students
4551 4551
                             $sql = "DELETE FROM $tbl_session_user
4552
-                                    WHERE session_id = '$session_id' AND relation_type <> " . SESSION_RELATION_TYPE_RRHH;
4552
+                                    WHERE session_id = '$session_id' AND relation_type <> ".SESSION_RELATION_TYPE_RRHH;
4553 4553
                             Database::query($sql);
4554 4554
 
4555 4555
                             $sql = "DELETE FROM $tbl_session_course WHERE session_id = '$session_id'";
@@ -4592,7 +4592,7 @@  discard block
 block discarded – undo
4592 4592
                             $sql = "INSERT IGNORE INTO $tbl_session_user SET
4593 4593
                                     user_id = '$user_id',
4594 4594
                                     session_id = '$session_id',
4595
-                                    registered_at = '" . api_get_utc_datetime() . "'";
4595
+                                    registered_at = '".api_get_utc_datetime()."'";
4596 4596
                             Database::query($sql);
4597 4597
                             if ($debug) {
4598 4598
                                 $logger->addInfo("Sessions - Adding User #$user_id ($user) to session #$session_id");
@@ -5243,7 +5243,7 @@  discard block
 block discarded – undo
5243 5243
 
5244 5244
         if (!empty($lastConnectionDate)) {
5245 5245
             $lastConnectionDate = Database::escape_string($lastConnectionDate);
5246
-            $userConditions .=  " AND u.last_login <= '$lastConnectionDate' ";
5246
+            $userConditions .= " AND u.last_login <= '$lastConnectionDate' ";
5247 5247
         }
5248 5248
 
5249 5249
         if (!empty($keyword)) {
@@ -5313,7 +5313,7 @@  discard block
 block discarded – undo
5313 5313
         $result = Database::query($sql);
5314 5314
         $result = Database::store_result($result);
5315 5315
 
5316
-        return $result ;
5316
+        return $result;
5317 5317
     }
5318 5318
 
5319 5319
     /**
@@ -5373,7 +5373,7 @@  discard block
 block discarded – undo
5373 5373
                     $userToString = null;
5374 5374
                     foreach ($userList as $userInfo) {
5375 5375
                         $newUserList[] = $userInfo['user_id'];
5376
-                        $userToString .= $userInfo['firstname'] . ' ' . $userInfo['lastname'] . '<br />';
5376
+                        $userToString .= $userInfo['firstname'].' '.$userInfo['lastname'].'<br />';
5377 5377
                     }
5378 5378
 
5379 5379
                     if (!empty($sessionsDestination)) {
@@ -5386,7 +5386,7 @@  discard block
 block discarded – undo
5386 5386
                                 $messages[] = Display::return_message(sprintf(get_lang('SessionXSkipped'), $sessionDestinationId), 'warning', false);
5387 5387
                                 continue;
5388 5388
                             }
5389
-                            $messages[] = Display::return_message(get_lang('StudentList') . '<br />' . $userToString, 'info', false);
5389
+                            $messages[] = Display::return_message(get_lang('StudentList').'<br />'.$userToString, 'info', false);
5390 5390
                             SessionManager::subscribe_users_to_session(
5391 5391
                                 $sessionDestinationId,
5392 5392
                                 $newUserList,
@@ -5441,7 +5441,7 @@  discard block
 block discarded – undo
5441 5441
                 }
5442 5442
             }
5443 5443
         }
5444
-        $sessionUrl = api_get_path(WEB_CODE_PATH) . 'admin/resume_session.php?id_session=';
5444
+        $sessionUrl = api_get_path(WEB_CODE_PATH).'admin/resume_session.php?id_session=';
5445 5445
 
5446 5446
         $htmlResult = null;
5447 5447
 
@@ -5456,7 +5456,7 @@  discard block
 block discarded – undo
5456 5456
                     $sessionInfo = self::fetch($sessionId);
5457 5457
                     $htmlResult .= '<br />';
5458 5458
                     $htmlResult .= Display::url(
5459
-                        get_lang('Session') . ': ' . $sessionInfo['name'] . ' <br />', $sessionUrl . $sessionId, array('target' => '_blank')
5459
+                        get_lang('Session').': '.$sessionInfo['name'].' <br />', $sessionUrl.$sessionId, array('target' => '_blank')
5460 5460
                     );
5461 5461
                     $teacherList = array();
5462 5462
                     foreach ($coachList as $coachId) {
@@ -5569,7 +5569,7 @@  discard block
 block discarded – undo
5569 5569
                 }
5570 5570
 
5571 5571
                 $sessionIdList = array_map('intval', $sessionIdList);
5572
-                $sessionToString = implode("', '",  $sessionIdList);
5572
+                $sessionToString = implode("', '", $sessionIdList);
5573 5573
 
5574 5574
                 $course = Database::get_main_table(TABLE_MAIN_COURSE);
5575 5575
                 $sessionCourse = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
@@ -5581,7 +5581,7 @@  discard block
 block discarded – undo
5581 5581
                         INNER JOIN $courseUser cu ON (cu.c_id = c.id)
5582 5582
 		                WHERE src.session_id IN ('$sessionToString') AND cu.status = 1";
5583 5583
                 $result = Database::query($sql);
5584
-                while($row = Database::fetch_array($result, 'ASSOC')) {
5584
+                while ($row = Database::fetch_array($result, 'ASSOC')) {
5585 5585
                     $teacherListId[$row['user_id']] = $row['user_id'];
5586 5586
                 }
5587 5587
             } else {
@@ -5656,7 +5656,7 @@  discard block
 block discarded – undo
5656 5656
         $toolList = self::getCourseToolToBeManaged();
5657 5657
 
5658 5658
         foreach ($toolList as $tool) {
5659
-            $method = 'add' . $tool;
5659
+            $method = 'add'.$tool;
5660 5660
             if (method_exists(get_class(), $method)) {
5661 5661
                 self::$method($sessionId, $courseId);
5662 5662
             }
@@ -5675,7 +5675,7 @@  discard block
 block discarded – undo
5675 5675
         $toolList = self::getCourseToolToBeManaged();
5676 5676
 
5677 5677
         foreach ($toolList as $tool) {
5678
-            $method = 'remove' . $tool;
5678
+            $method = 'remove'.$tool;
5679 5679
             if (method_exists(get_class(), $method)) {
5680 5680
                 self::$method($sessionId, $courseId);
5681 5681
             }
@@ -5793,18 +5793,18 @@  discard block
 block discarded – undo
5793 5793
                         }
5794 5794
                     }
5795 5795
 
5796
-                    $message .= '<strong>' . get_lang('User') . '</strong> ' . $userInfo['complete_name'] . ' <br />';
5796
+                    $message .= '<strong>'.get_lang('User').'</strong> '.$userInfo['complete_name'].' <br />';
5797 5797
 
5798 5798
                     if (!in_array($userInfo['status'], array(DRH)) && !api_is_platform_admin_by_id($userInfo['user_id'])) {
5799
-                        $message .= get_lang('UserMustHaveTheDrhRole') . '<br />';
5799
+                        $message .= get_lang('UserMustHaveTheDrhRole').'<br />';
5800 5800
                         continue;
5801 5801
                     }
5802 5802
 
5803 5803
                     if (!empty($sessionList)) {
5804
-                        $message .= '<strong>' . get_lang('Sessions') . ':</strong> <br />';
5805
-                        $message .= implode(', ', $sessionList) . '<br /><br />';
5804
+                        $message .= '<strong>'.get_lang('Sessions').':</strong> <br />';
5805
+                        $message .= implode(', ', $sessionList).'<br /><br />';
5806 5806
                     } else {
5807
-                        $message .= get_lang('NoSessionProvided') . ' <br /><br />';
5807
+                        $message .= get_lang('NoSessionProvided').' <br /><br />';
5808 5808
                     }
5809 5809
                 }
5810 5810
             }
@@ -5984,8 +5984,8 @@  discard block
 block discarded – undo
5984 5984
 
5985 5985
         $firstAccess = api_strtotime($courseAccess['login_course_date'], 'UTC');
5986 5986
 
5987
-        $endDateInSeconds = $firstAccess + $duration*24*60*60;
5988
-        $leftDays = round(($endDateInSeconds- $currentTime) / 60 / 60 / 24);
5987
+        $endDateInSeconds = $firstAccess + $duration * 24 * 60 * 60;
5988
+        $leftDays = round(($endDateInSeconds - $currentTime) / 60 / 60 / 24);
5989 5989
 
5990 5990
         return $leftDays;
5991 5991
     }
@@ -6267,7 +6267,7 @@  discard block
 block discarded – undo
6267 6267
         $sql = "SELECT COUNT(1) as count, u.id, scu.status status_in_session, u.status user_status
6268 6268
                 FROM $tableSessionRelCourseRelUser scu
6269 6269
                 INNER JOIN $tableUser u ON scu.user_id = u.id
6270
-                WHERE scu.session_id = " . intval($sessionId) ."
6270
+                WHERE scu.session_id = ".intval($sessionId)."
6271 6271
                 GROUP BY u.id";
6272 6272
 
6273 6273
         $result = Database::query($sql);
@@ -6302,7 +6302,7 @@  discard block
 block discarded – undo
6302 6302
             $sfTable = Database::get_main_table(TABLE_EXTRA_FIELD);
6303 6303
             $sfvTable = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
6304 6304
             // Join session field and session field values tables
6305
-            $joinTable = $sfTable . ' sf INNER JOIN ' . $sfvTable . ' sfv ON sf.id = sfv.field_id';
6305
+            $joinTable = $sfTable.' sf INNER JOIN '.$sfvTable.' sfv ON sf.id = sfv.field_id';
6306 6306
             $fieldsArray = array();
6307 6307
             foreach ($extraFields as $field) {
6308 6308
                 $fieldsArray[] = Database::escape_string($field);
@@ -6345,14 +6345,14 @@  discard block
 block discarded – undo
6345 6345
                 for ($i = 1; $i < count($fieldsArray); $i++) {
6346 6346
                     $whereParams .= ', ?';
6347 6347
                 }
6348
-                $whereFieldVariables = ' variable IN ( ' . $whereParams .' )';
6349
-                $whereFieldIds = 'field_id IN ( ' . $whereParams .  ' )';
6348
+                $whereFieldVariables = ' variable IN ( '.$whereParams.' )';
6349
+                $whereFieldIds = 'field_id IN ( '.$whereParams.' )';
6350 6350
             }
6351 6351
             // Get session fields
6352 6352
             $extraField = new ExtraFieldModel('session');
6353 6353
             $questionMarks = substr(str_repeat('?, ', count($fieldsArray)), 0, -2);
6354 6354
             $fieldsList = $extraField->get_all(array(
6355
-                ' variable IN ( ' . $questionMarks . ' )' => $fieldsArray,
6355
+                ' variable IN ( '.$questionMarks.' )' => $fieldsArray,
6356 6356
             ));
6357 6357
             // Index session fields
6358 6358
             foreach ($fieldsList as $field) {
@@ -6361,7 +6361,7 @@  discard block
 block discarded – undo
6361 6361
             // Get session field values
6362 6362
             $extra = new ExtraFieldValue('session');
6363 6363
             $questionMarksFields = substr(str_repeat('?, ', count($fields)), 0, -2);
6364
-            $sessionFieldValueList = $extra->get_all(array ('where' => array('field_id IN ( ' . $questionMarksFields . ' )' => array_keys($fields))));
6364
+            $sessionFieldValueList = $extra->get_all(array('where' => array('field_id IN ( '.$questionMarksFields.' )' => array_keys($fields))));
6365 6365
             // Add session fields values to session list
6366 6366
             foreach ($sessionList as $id => &$session) {
6367 6367
                 foreach ($sessionFieldValueList as $sessionFieldValue) {
@@ -6414,7 +6414,7 @@  discard block
 block discarded – undo
6414 6414
             // Check the result
6415 6415
             if ($result < 1) {
6416 6416
                 // If not found any result, update error message
6417
-                $errorResult['errorMessage'] = 'Not found any session category name ' . $categoryName;
6417
+                $errorResult['errorMessage'] = 'Not found any session category name '.$categoryName;
6418 6418
             } elseif (count($result) > 1 && !$force) {
6419 6419
                 // If found more than one result and force is disabled, update error message
6420 6420
                 $errorResult['errorMessage'] = 'Found many session categories';
@@ -6473,7 +6473,7 @@  discard block
 block discarded – undo
6473 6473
             // Check if session list query had result
6474 6474
             if (!empty($sessionList)) {
6475 6475
                 // implode all session id
6476
-                $sessionIdsString = '(' . implode(', ', array_keys($sessionList)) . ')';
6476
+                $sessionIdsString = '('.implode(', ', array_keys($sessionList)).')';
6477 6477
                 // Get all field variables
6478 6478
                 $sessionFieldList = Database::select(
6479 6479
                     'id, variable',
@@ -6560,7 +6560,7 @@  discard block
 block discarded – undo
6560 6560
                 return $sessionList;
6561 6561
             } else {
6562 6562
                 // Not found result, update error message
6563
-                $errorResult['errorMessage'] = 'Not found any session for session category id ' . $sessionCategoryId;
6563
+                $errorResult['errorMessage'] = 'Not found any session for session category id '.$sessionCategoryId;
6564 6564
             }
6565 6565
         }
6566 6566
 
@@ -6664,7 +6664,7 @@  discard block
 block discarded – undo
6664 6664
 
6665 6665
         $sessionExtraField = new ExtraFieldModel('session');
6666 6666
         $fieldList = $sessionExtraField->get_all(array(
6667
-            "variable IN ( " . implode(", ", $variablePlaceHolders) . " ) " => $variables,
6667
+            "variable IN ( ".implode(", ", $variablePlaceHolders)." ) " => $variables,
6668 6668
         ));
6669 6669
 
6670 6670
         $fields = array();
@@ -6678,7 +6678,7 @@  discard block
 block discarded – undo
6678 6678
         $extra = new ExtraFieldValue('session');
6679 6679
         $sessionFieldValueList = $extra->get_all(
6680 6680
             array(
6681
-                "field_id IN ( " . implode(", ", $variablePlaceHolders) . " )" => array_keys($fields),
6681
+                "field_id IN ( ".implode(", ", $variablePlaceHolders)." )" => array_keys($fields),
6682 6682
             )
6683 6683
         );
6684 6684
 
@@ -6749,7 +6749,7 @@  discard block
 block discarded – undo
6749 6749
                 FROM $sessionTable s
6750 6750
                 INNER JOIN $sessionUserTable sru ON s.id = sru.id_session
6751 6751
                 WHERE
6752
-                    (sru.id_user IN (" . implode(', ', $userIdList) . ")
6752
+                    (sru.id_user IN (".implode(', ', $userIdList).")
6753 6753
                     AND sru.relation_type = 0
6754 6754
                 )";
6755 6755
 
@@ -6765,7 +6765,7 @@  discard block
 block discarded – undo
6765 6765
                         WHERE
6766 6766
                             srau.access_url_id = $accessUrlId
6767 6767
                             AND (
6768
-                                sru.id_user IN (" . implode(', ', $userIdList) . ")
6768
+                                sru.id_user IN (".implode(', ', $userIdList).")
6769 6769
                                 AND sru.relation_type = 0
6770 6770
                             )";
6771 6771
             }
@@ -6786,7 +6786,7 @@  discard block
 block discarded – undo
6786 6786
      */
6787 6787
     public static function getSessionVisibility($sessionInfo)
6788 6788
     {
6789
-        switch($sessionInfo['visibility']) {
6789
+        switch ($sessionInfo['visibility']) {
6790 6790
             case 1:
6791 6791
                 return get_lang('ReadOnly');
6792 6792
             case 2:
@@ -6963,7 +6963,7 @@  discard block
 block discarded – undo
6963 6963
                     get_lang('CoachName'),
6964 6964
                     null,
6965 6965
                     [
6966
-                        'url' => api_get_path(WEB_AJAX_PATH) . 'session.ajax.php?a=search_general_coach',
6966
+                        'url' => api_get_path(WEB_AJAX_PATH).'session.ajax.php?a=search_general_coach',
6967 6967
                         'width' => '100%',
6968 6968
                     ]
6969 6969
                 );
@@ -6974,7 +6974,7 @@  discard block
 block discarded – undo
6974 6974
         $form->addHtml('<div id="ajax_list_coachs"></div>');
6975 6975
 
6976 6976
         $form->addButtonAdvancedSettings('advanced_params');
6977
-        $form->addElement('html','<div id="advanced_params_options" style="display:none">');
6977
+        $form->addElement('html', '<div id="advanced_params_options" style="display:none">');
6978 6978
 
6979 6979
         $form->addSelect('session_category', get_lang('SessionCategory'), $categoriesOptions, array(
6980 6980
             'id' => 'session_category'
@@ -7141,16 +7141,16 @@  discard block
 block discarded – undo
7141 7141
         if (api_is_session_admin() &&
7142 7142
             api_get_setting('allow_session_admins_to_see_all_sessions') == 'false'
7143 7143
         ) {
7144
-            $where.=" WHERE s.session_admin_id = $user_id ";
7144
+            $where .= " WHERE s.session_admin_id = $user_id ";
7145 7145
         }
7146 7146
 
7147 7147
         if (!empty($options['where'])) {
7148 7148
             $options['where'] = str_replace('course_title', 'c.title', $options['where']);
7149
-            $options['where'] = str_replace("( session_active = '0' )", '1=1',  $options['where']);
7149
+            $options['where'] = str_replace("( session_active = '0' )", '1=1', $options['where']);
7150 7150
 
7151 7151
             $options['where'] = str_replace(
7152 7152
                 array("AND session_active = '1'  )", " AND (  session_active = '1'  )"),
7153
-                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 " )
7153
+                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 ")
7154 7154
                 , $options['where']
7155 7155
             );
7156 7156
 
@@ -7192,10 +7192,10 @@  discard block
 block discarded – undo
7192 7192
                        $where ";
7193 7193
 
7194 7194
         if (api_is_multiple_url_enabled()) {
7195
-            $table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
7195
+            $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
7196 7196
             $access_url_id = api_get_current_access_url_id();
7197 7197
             if ($access_url_id != -1) {
7198
-                $where.= " AND ar.access_url_id = $access_url_id ";
7198
+                $where .= " AND ar.access_url_id = $access_url_id ";
7199 7199
 
7200 7200
                 $query_rows = "SELECT count(*) as total_rows
7201 7201
                                FROM $tbl_session s
@@ -7240,12 +7240,12 @@  discard block
 block discarded – undo
7240 7240
                     //get_lang('CourseTitle'),
7241 7241
                     get_lang('Visibility'),
7242 7242
                 );
7243
-                $column_model = array (
7244
-                    array('name'=>'name', 'index'=>'s.name', 'width'=>'160',  'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7245
-                    array('name'=>'category_name', 'index'=>'category_name', 'width'=>'40',  'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7246
-                    array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'50',   'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)),
7247
-                    array('name'=>'display_end_date', 'index'=>'display_end_date', 'width'=>'50',   'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_one_month', 'sopt' => $date_operators)),
7248
-                    array('name'=>'visibility', 'index'=>'visibility',      'width'=>'40',   'align'=>'left', 'search' => 'false'),
7243
+                $column_model = array(
7244
+                    array('name'=>'name', 'index'=>'s.name', 'width'=>'160', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7245
+                    array('name'=>'category_name', 'index'=>'category_name', 'width'=>'40', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7246
+                    array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)),
7247
+                    array('name'=>'display_end_date', 'index'=>'display_end_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_one_month', 'sopt' => $date_operators)),
7248
+                    array('name'=>'visibility', 'index'=>'visibility', 'width'=>'40', 'align'=>'left', 'search' => 'false'),
7249 7249
                 );
7250 7250
                 break;
7251 7251
             case 'complete':
@@ -7258,12 +7258,12 @@  discard block
 block discarded – undo
7258 7258
                     get_lang('Visibility'),
7259 7259
                     get_lang('CourseTitle'),
7260 7260
                 );
7261
-                $column_model = array (
7262
-                    array('name'=>'name', 'index'=>'s.name', 'width'=>'200',  'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7263
-                    array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'70',   'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)),
7264
-                    array('name'=>'display_end_date', 'index'=>'display_end_date', 'width'=>'70',   'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_one_month', 'sopt' => $date_operators)),
7265
-                    array('name'=>'coach_name', 'index'=>'coach_name',     'width'=>'70',   'align'=>'left', 'search' => 'false', 'searchoptions' => array('sopt' => $operators)),
7266
-                    array('name'=>'session_active', 'index'=>'session_active', 'width'=>'25',   'align'=>'left', 'search' => 'true', 'stype'=>'select',
7261
+                $column_model = array(
7262
+                    array('name'=>'name', 'index'=>'s.name', 'width'=>'200', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7263
+                    array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'70', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)),
7264
+                    array('name'=>'display_end_date', 'index'=>'display_end_date', 'width'=>'70', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_one_month', 'sopt' => $date_operators)),
7265
+                    array('name'=>'coach_name', 'index'=>'coach_name', 'width'=>'70', 'align'=>'left', 'search' => 'false', 'searchoptions' => array('sopt' => $operators)),
7266
+                    array('name'=>'session_active', 'index'=>'session_active', 'width'=>'25', 'align'=>'left', 'search' => 'true', 'stype'=>'select',
7267 7267
                         // for the bottom bar
7268 7268
                         'searchoptions' => array(
7269 7269
                             'defaultValue'  => '1',
@@ -7271,8 +7271,8 @@  discard block
 block discarded – undo
7271 7271
                         // for the top bar
7272 7272
                         'editoptions' => array('value' => '" ":'.get_lang('All').';1:'.get_lang('Active').';0:'.get_lang('Inactive')),
7273 7273
                     ),
7274
-                    array('name'=>'visibility',     'index'=>'visibility',      'width'=>'40',   'align'=>'left', 'search' => 'false'),
7275
-                    array('name'=>'course_title',    'index'=>'course_title',   'width'=>'50',   'hidden' => 'true', 'search' => 'true', 'searchoptions' => array('searchhidden' =>'true','sopt' => $operators)),
7274
+                    array('name'=>'visibility', 'index'=>'visibility', 'width'=>'40', 'align'=>'left', 'search' => 'false'),
7275
+                    array('name'=>'course_title', 'index'=>'course_title', 'width'=>'50', 'hidden' => 'true', 'search' => 'true', 'searchoptions' => array('searchhidden' =>'true', 'sopt' => $operators)),
7276 7276
                 );
7277 7277
                 break;
7278 7278
         }
@@ -7281,14 +7281,14 @@  discard block
 block discarded – undo
7281 7281
         $session_field = new ExtraFieldModel('session');
7282 7282
         $rules = $session_field->getRules($columns, $column_model);
7283 7283
 
7284
-        $column_model[] = array('name'=>'actions', 'index'=>'actions', 'width'=>'80',  'align'=>'left','formatter'=>'action_formatter','sortable'=>'false', 'search' => 'false');
7284
+        $column_model[] = array('name'=>'actions', 'index'=>'actions', 'width'=>'80', 'align'=>'left', 'formatter'=>'action_formatter', 'sortable'=>'false', 'search' => 'false');
7285 7285
         $columns[] = get_lang('Actions');
7286 7286
 
7287 7287
         foreach ($column_model as $col_model) {
7288 7288
             $simple_column_name[] = $col_model['name'];
7289 7289
         }
7290 7290
 
7291
-        $return_array =  array(
7291
+        $return_array = array(
7292 7292
             'columns' => $columns,
7293 7293
             'column_model' => $column_model,
7294 7294
             'rules' => $rules,
@@ -7377,7 +7377,7 @@  discard block
 block discarded – undo
7377 7377
             if (api_is_session_admin() &&
7378 7378
                 api_get_setting('allow_session_admins_to_manage_all_sessions') == 'false'
7379 7379
             ) {
7380
-                $where.=" AND s.session_admin_id = $user_id ";
7380
+                $where .= " AND s.session_admin_id = $user_id ";
7381 7381
             }
7382 7382
         }
7383 7383
 
@@ -7460,11 +7460,11 @@  discard block
 block discarded – undo
7460 7460
             }
7461 7461
             $options['where'] = str_replace('course_title', 'c.title', $options['where']);
7462 7462
 
7463
-            $options['where'] = str_replace("( session_active = '0' )", '1=1',  $options['where']);
7463
+            $options['where'] = str_replace("( session_active = '0' )", '1=1', $options['where']);
7464 7464
 
7465 7465
             $options['where'] = str_replace(
7466 7466
                 array("AND session_active = '1'  )", " AND (  session_active = '1'  )"),
7467
-                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 " )
7467
+                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 ")
7468 7468
                 , $options['where']
7469 7469
             );
7470 7470
 
@@ -7499,10 +7499,10 @@  discard block
 block discarded – undo
7499 7499
             $where;
7500 7500
 
7501 7501
         if (api_is_multiple_url_enabled()) {
7502
-            $table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
7502
+            $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
7503 7503
             $access_url_id = api_get_current_access_url_id();
7504 7504
             if ($access_url_id != -1) {
7505
-                $where.= " AND ar.access_url_id = $access_url_id ";
7505
+                $where .= " AND ar.access_url_id = $access_url_id ";
7506 7506
                 $query = "$select
7507 7507
                     FROM $tbl_session s
7508 7508
                     LEFT JOIN $tbl_session_field_values fv ON (fv.session_id = s.id)
@@ -7529,7 +7529,7 @@  discard block
 block discarded – undo
7529 7529
         $formatted_sessions = array();
7530 7530
 
7531 7531
         if (Database::num_rows($result)) {
7532
-            $sessions   = Database::store_result($result, 'ASSOC');
7532
+            $sessions = Database::store_result($result, 'ASSOC');
7533 7533
             foreach ($sessions as $session) {
7534 7534
                 $session_id = $session['id'];
7535 7535
                 $session['name'] = Display::url($session['name'], "resume_session.php?id_session=".$session['id']);
@@ -7544,14 +7544,14 @@  discard block
 block discarded – undo
7544 7544
 
7545 7545
                 switch ($session['visibility']) {
7546 7546
                     case SESSION_VISIBLE_READ_ONLY: //1
7547
-                        $session['visibility'] =  get_lang('ReadOnly');
7547
+                        $session['visibility'] = get_lang('ReadOnly');
7548 7548
                         break;
7549 7549
                     case SESSION_VISIBLE:           //2
7550 7550
                     case SESSION_AVAILABLE:         //4
7551
-                        $session['visibility'] =  get_lang('Visible');
7551
+                        $session['visibility'] = get_lang('Visible');
7552 7552
                         break;
7553 7553
                     case SESSION_INVISIBLE:         //3
7554
-                        $session['visibility'] =  api_ucfirst(get_lang('Invisible'));
7554
+                        $session['visibility'] = api_ucfirst(get_lang('Invisible'));
7555 7555
                         break;
7556 7556
                 }
7557 7557
 
@@ -7627,7 +7627,7 @@  discard block
 block discarded – undo
7627 7627
         if (empty($session)) {
7628 7628
             return false;
7629 7629
         }
7630
-        return api_get_path(WEB_CODE_PATH) . 'session/resume_session.php?id_session=' . $id;
7630
+        return api_get_path(WEB_CODE_PATH).'session/resume_session.php?id_session='.$id;
7631 7631
     }
7632 7632
 
7633 7633
     /**
@@ -7645,7 +7645,7 @@  discard block
 block discarded – undo
7645 7645
             return false;
7646 7646
         }
7647 7647
         if (empty($courseId)) {
7648
-            return api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . $id;
7648
+            return api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$id;
7649 7649
         } else {
7650 7650
             $courseInfo = api_get_course_info_by_id($courseId);
7651 7651
             if ($courseInfo) {
@@ -7851,7 +7851,7 @@  discard block
 block discarded – undo
7851 7851
             // sort $listCat by catSessionName
7852 7852
             usort($listCat, 'self::compareBySessionName');
7853 7853
             // in each catSession sort sessionList by sessionName
7854
-            foreach($listCat as $i => $listCatSessionInfo) {
7854
+            foreach ($listCat as $i => $listCatSessionInfo) {
7855 7855
                 $listSessionList = $listCatSessionInfo['sessionList'];
7856 7856
                 usort($listSessionList, 'self::compareCatSessionInfo');
7857 7857
                 $listCat[$i]['sessionList'] = $listSessionList;
@@ -7866,8 +7866,8 @@  discard block
 block discarded – undo
7866 7866
             );
7867 7867
 
7868 7868
             $userCatId = intval($userCatId);
7869
-            $listResults[$userCatId]['courseInUserCategoryId'] =  $userCatId;
7870
-            $listResults[$userCatId]['courseInUserCategoryTitle'] =  $userCatTitle;
7869
+            $listResults[$userCatId]['courseInUserCategoryId'] = $userCatId;
7870
+            $listResults[$userCatId]['courseInUserCategoryTitle'] = $userCatTitle;
7871 7871
             $listResults[$userCatId]['courseInUserCatList'][] = $listOneCourse;
7872 7872
         }
7873 7873
 
@@ -7893,7 +7893,7 @@  discard block
 block discarded – undo
7893 7893
     {
7894 7894
         if ($listA['sessionName'] == $listB['sessionName']) {
7895 7895
             return 0;
7896
-        } else if($listA['sessionName'] > $listB['sessionName']) {
7896
+        } else if ($listA['sessionName'] > $listB['sessionName']) {
7897 7897
             return 1;
7898 7898
         } else {
7899 7899
             return -1;
@@ -7913,7 +7913,7 @@  discard block
 block discarded – undo
7913 7913
             return 1;
7914 7914
         } else if ($listA['catSessionName'] == $listB['catSessionName']) {
7915 7915
             return 0;
7916
-        } else if($listA['catSessionName'] > $listB['catSessionName']) {
7916
+        } else if ($listA['catSessionName'] > $listB['catSessionName']) {
7917 7917
             return 1;
7918 7918
         } else {
7919 7919
             return -1;
@@ -7929,7 +7929,7 @@  discard block
 block discarded – undo
7929 7929
     {
7930 7930
         if ($listA['courseInUserCategoryTitle'] == $listB['courseInUserCategoryTitle']) {
7931 7931
             return 0;
7932
-        } else if($listA['courseInUserCategoryTitle'] > $listB['courseInUserCategoryTitle']) {
7932
+        } else if ($listA['courseInUserCategoryTitle'] > $listB['courseInUserCategoryTitle']) {
7933 7933
             return 1;
7934 7934
         } else {
7935 7935
             return -1;
@@ -7945,7 +7945,7 @@  discard block
 block discarded – undo
7945 7945
     {
7946 7946
         if ($listA['title'] == $listB['title']) {
7947 7947
             return 0;
7948
-        } else if($listA['title'] > $listB['title']) {
7948
+        } else if ($listA['title'] > $listB['title']) {
7949 7949
             return 1;
7950 7950
         } else {
7951 7951
             return -1;
@@ -7991,8 +7991,8 @@  discard block
 block discarded – undo
7991 7991
 
7992 7992
                 $marginShift = 20;
7993 7993
                 if ($catSessionName != '') {
7994
-                    $htmlCatSessions .= '<div style="margin-left:'.$marginShift.'px;">' .
7995
-                        CourseManager::course_item_html($listParamsCatSession, true) . '</div>';
7994
+                    $htmlCatSessions .= '<div style="margin-left:'.$marginShift.'px;">'.
7995
+                        CourseManager::course_item_html($listParamsCatSession, true).'</div>';
7996 7996
                     $marginShift = 40;
7997 7997
                 }
7998 7998
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2896,10 +2896,11 @@
 block discarded – undo
2896 2896
                                 c_id = $courseId AND
2897 2897
                                 user_id = $user_id ";
2898 2898
                     $result = Database::query($sql);
2899
-                    if (Database::affected_rows($result) > 0)
2900
-                        return true;
2901
-                    else
2902
-                        return false;
2899
+                    if (Database::affected_rows($result) > 0) {
2900
+                                            return true;
2901
+                    } else {
2902
+                                            return false;
2903
+                    }
2903 2904
                 } else {
2904 2905
                     // The user is not subscribed to the session, so make sure
2905 2906
                     // he isn't subscribed to a course in this session either
Please login to merge, or discard this patch.
main/inc/lib/conditional_login.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
                     if (isset($condition['conditional_function']) && $condition['conditional_function']($user) == false) {
24 24
                         $_SESSION['conditional_login']['uid'] = $user['user_id'];
25 25
                         $_SESSION['conditional_login']['can_login'] = false;
26
-                        header("Location:". $condition['url']);
26
+                        header("Location:".$condition['url']);
27 27
                         exit();
28 28
                     }
29 29
                 }
Please login to merge, or discard this patch.
main/inc/lib/image.lib.php 4 patches
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             if ($height >= $max_size_for_picture) {
48 48
                 // scale width
49 49
                 $new_width = round($width * ($max_size_for_picture / $height));
50
-                 $this->image_wrapper->resize($new_width, $max_size_for_picture, 0);
50
+                    $this->image_wrapper->resize($new_width, $max_size_for_picture, 0);
51 51
             }
52 52
         }
53 53
     }
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
     public function __construct($path)
151 151
     {
152
-          parent::__construct($path);
152
+            parent::__construct($path);
153 153
     }
154 154
 
155 155
     public function set_image_wrapper()
@@ -184,19 +184,19 @@  discard block
 block discarded – undo
184 184
         }
185 185
     }
186 186
 
187
-	public function get_image_size()
187
+    public function get_image_size()
188 188
     {
189
-		$imagesize = array('width'=>0,'height'=>0);
190
-	    if ($this->image_validated) {
189
+        $imagesize = array('width'=>0,'height'=>0);
190
+        if ($this->image_validated) {
191 191
             $imagesize = $this->image->getImageGeometry();
192
-	    }
193
-	    return $imagesize;
194
-	}
192
+        }
193
+        return $imagesize;
194
+    }
195 195
 
196
-	//@todo implement border logic case for Imagick
197
-	public function resize($thumbw, $thumbh, $border, $specific_size = false)
196
+    //@todo implement border logic case for Imagick
197
+    public function resize($thumbw, $thumbh, $border, $specific_size = false)
198 198
     {
199
-	    if (!$this->image_validated) return false;
199
+        if (!$this->image_validated) return false;
200 200
 
201 201
         if ($specific_size) {
202 202
             $width = $thumbw;
@@ -206,10 +206,10 @@  discard block
 block discarded – undo
206 206
             $width  = (int)($this->width * $scale);
207 207
             $height = (int)($this->height * $scale);
208 208
         }
209
-		$result = $this->image->resizeImage($width, $height, $this->filter, 1);
210
-		$this->width  = $thumbw;
211
-		$this->height = $thumbh;
212
-	}
209
+        $result = $this->image->resizeImage($width, $height, $this->filter, 1);
210
+        $this->width  = $thumbw;
211
+        $this->height = $thumbh;
212
+    }
213 213
     
214 214
     /**
215 215
      * @author José Loguercio <[email protected]>
@@ -224,8 +224,8 @@  discard block
 block discarded – undo
224 224
     public function crop($x, $y, $width, $height, $src_width, $src_height) {
225 225
         if (!$this->image_validated) return false;
226 226
         $this->image->cropimage($width, $height, $x, $y);
227
-		$this->width  = $width;
228
-		$this->height = $height;
227
+        $this->width  = $width;
228
+        $this->height = $height;
229 229
     }
230 230
 
231 231
     public function send_image($file = '', $compress = -1, $convert_file_to = null)
@@ -235,35 +235,35 @@  discard block
 block discarded – undo
235 235
         if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) {
236 236
             $type = $convert_file_to;
237 237
         }
238
-		switch ($type) {
239
-		    case 'jpeg':
240
-			case 'jpg':
241
-				if (!$file) header("Content-type: image/jpeg");
242
-				break;
243
-			case 'png':
244
-				if (!$file) header("Content-type: image/png");
245
-				break;
246
-			case 'gif':
247
-				if (!$file) header("Content-type: image/gif");
248
-				break;
249
-		}
250
-		$result = false;
251
-		try {
252
-		    $result = $this->image->writeImage($file);
253
-		} catch(ImagickException $e) {
238
+        switch ($type) {
239
+            case 'jpeg':
240
+            case 'jpg':
241
+                if (!$file) header("Content-type: image/jpeg");
242
+                break;
243
+            case 'png':
244
+                if (!$file) header("Content-type: image/png");
245
+                break;
246
+            case 'gif':
247
+                if (!$file) header("Content-type: image/gif");
248
+                break;
249
+        }
250
+        $result = false;
251
+        try {
252
+            $result = $this->image->writeImage($file);
253
+        } catch(ImagickException $e) {
254 254
             if ($this->debug) error_log($e->getMessage());
255 255
         }
256 256
 
257
-		if (!$file) {
258
-		    echo $this->image;
259
-		    $this->image->clear();
257
+        if (!$file) {
258
+            echo $this->image;
259
+            $this->image->clear();
260 260
             $this->image->destroy();
261
-		} else {
262
-		    $this->image->clear();
261
+        } else {
262
+            $this->image->clear();
263 263
             $this->image->destroy();
264
-		    return $result;
265
-		}
266
-	}
264
+            return $result;
265
+        }
266
+    }
267 267
 
268 268
 }
269 269
 
@@ -285,21 +285,21 @@  discard block
 block discarded – undo
285 285
         $this->fill_image_info();
286 286
 
287 287
         switch ($this->type) {
288
-        	case 0:
289
-        		$handler = false;
290
-        		break;
291
-		    case 1 :
288
+            case 0:
289
+                $handler = false;
290
+                break;
291
+            case 1 :
292 292
                 $handler = @imagecreatefromgif($this->path);
293 293
                 $this->type = 'gif';
294 294
                 break;
295
-		    case 2 :
295
+            case 2 :
296 296
                 $handler = @imagecreatefromjpeg($this->path);
297 297
                 $this->type = 'jpg';
298 298
                 break;
299
-		    case 3 :
300
-		        $handler = @imagecreatefrompng($this->path);
301
-		        $this->type = 'png';
302
-		        break;
299
+            case 3 :
300
+                $handler = @imagecreatefrompng($this->path);
301
+                $this->type = 'png';
302
+                break;
303 303
         }
304 304
         if ($handler) {
305 305
             $this->image_validated = true;
@@ -313,29 +313,29 @@  discard block
 block discarded – undo
313 313
     {
314 314
         $return_array = array('width'=>0,'height'=>0);
315 315
         if ($this->image_validated) {
316
-	        $return_array = array('width'=>$this->width,'height'=>$this->height);
316
+            $return_array = array('width'=>$this->width,'height'=>$this->height);
317 317
         }
318 318
         return $return_array;
319
-	}
319
+    }
320 320
 
321 321
     public function fill_image_info()
322 322
     {
323
-    	if (file_exists($this->path)) {
324
-	        $image_info     = getimagesize($this->path);
325
-			$this->width    = $image_info[0];
326
-			$this->height   = $image_info[1];
327
-			$this->type     = $image_info[2];
328
-    	} else {
329
-    		$this->width    = 0;
330
-    		$this->height   = 0;
331
-    		$this->type     = 0;
332
-    	}
323
+        if (file_exists($this->path)) {
324
+            $image_info     = getimagesize($this->path);
325
+            $this->width    = $image_info[0];
326
+            $this->height   = $image_info[1];
327
+            $this->type     = $image_info[2];
328
+        } else {
329
+            $this->width    = 0;
330
+            $this->height   = 0;
331
+            $this->type     = 0;
332
+        }
333 333
     }
334 334
 
335 335
     public function resize($thumbw, $thumbh, $border, $specific_size = false)
336 336
     {
337 337
         if (!$this->image_validated) return false;
338
-		if ($border == 1) {
338
+        if ($border == 1) {
339 339
             if ($specific_size) {
340 340
                 $width = $thumbw;
341 341
                 $height = $thumbh;
@@ -344,17 +344,17 @@  discard block
 block discarded – undo
344 344
                 $width = (int)($this->width * $scale);
345 345
                 $height = (int)($this->height * $scale);
346 346
             }
347
-			$deltaw = (int)(($thumbw - $width) / 2);
348
-			$deltah = (int)(($thumbh - $height) / 2);
349
-			$dst_img = @ImageCreateTrueColor($thumbw, $thumbh);
350
-            		@imagealphablending($dst_img, false);
351
-		        @imagesavealpha($dst_img, true);
352
-			if (!empty($this->color)) {
353
-				@imagefill($dst_img, 0, 0, $this->color);
354
-			}
355
-			$this->width = $thumbw;
356
-			$this->height = $thumbh;
357
-		} elseif ($border == 0) {
347
+            $deltaw = (int)(($thumbw - $width) / 2);
348
+            $deltah = (int)(($thumbh - $height) / 2);
349
+            $dst_img = @ImageCreateTrueColor($thumbw, $thumbh);
350
+                    @imagealphablending($dst_img, false);
351
+                @imagesavealpha($dst_img, true);
352
+            if (!empty($this->color)) {
353
+                @imagefill($dst_img, 0, 0, $this->color);
354
+            }
355
+            $this->width = $thumbw;
356
+            $this->height = $thumbh;
357
+        } elseif ($border == 0) {
358 358
             if ($specific_size) {
359 359
                 $width = $thumbw;
360 360
                 $height = $thumbh;
@@ -363,19 +363,19 @@  discard block
 block discarded – undo
363 363
                 $width  = (int)($this->width * $scale);
364 364
                 $height = (int)($this->height * $scale);
365 365
             }
366
-			$deltaw = 0;
367
-			$deltah = 0;
368
-			$dst_img = @ImageCreateTrueColor($width, $height);
369
-            		@imagealphablending($dst_img, false);
370
-		        @imagesavealpha($dst_img, true);
371
-			$this->width = $width;
372
-			$this->height = $height;
373
-		}
374
-		$src_img = $this->bg;
375
-		@ImageCopyResampled($dst_img, $src_img, $deltaw, $deltah, 0, 0, $width, $height, ImageSX($src_img), ImageSY($src_img));
376
-		$this->bg = $dst_img;
377
-		@imagedestroy($src_img);
378
-	}
366
+            $deltaw = 0;
367
+            $deltah = 0;
368
+            $dst_img = @ImageCreateTrueColor($width, $height);
369
+                    @imagealphablending($dst_img, false);
370
+                @imagesavealpha($dst_img, true);
371
+            $this->width = $width;
372
+            $this->height = $height;
373
+        }
374
+        $src_img = $this->bg;
375
+        @ImageCopyResampled($dst_img, $src_img, $deltaw, $deltah, 0, 0, $width, $height, ImageSX($src_img), ImageSY($src_img));
376
+        $this->bg = $dst_img;
377
+        @imagedestroy($src_img);
378
+    }
379 379
     
380 380
     /**
381 381
      * @author José Loguercio <[email protected]>
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
     public function crop($x, $y, $width, $height, $src_width, $src_height) {
390 390
         if (!$this->image_validated) return false;
391 391
         $this->width = $width;
392
-		$this->height = $height;
392
+        $this->height = $height;
393 393
         $src = null;
394 394
         $dest = @imagecreatetruecolor($width, $height);
395 395
         $type = $this->type;
@@ -400,56 +400,56 @@  discard block
 block discarded – undo
400 400
                 @imagecopy($dest, $src, 0, 0, $x, $y, $src_width, $src_height);
401 401
                 @imagejpeg($dest, $this->path);
402 402
                 break;
403
-		    case 'png' :
403
+            case 'png' :
404 404
                 $src = @imagecreatefrompng($this->path);
405 405
                 @imagecopy($dest, $src, 0, 0, $x, $y, $src_width, $src_height);
406 406
                 @imagepng($dest, $this->path);
407 407
                 break;
408
-		    case 'gif' :
409
-		        $src = @imagecreatefromgif($this->path);
408
+            case 'gif' :
409
+                $src = @imagecreatefromgif($this->path);
410 410
                 @imagecopy($dest, $src, 0, 0, $x, $y, $src_width, $src_height);
411 411
                 @imagegif($dest, $this->path);
412
-		        break;
412
+                break;
413 413
             default: return 0;
414 414
         }
415 415
         @imagedestroy($dest);
416 416
         @imagedestroy($src);
417 417
     }
418 418
 
419
-	public function send_image($file = '', $compress = -1, $convert_file_to = null)
419
+    public function send_image($file = '', $compress = -1, $convert_file_to = null)
420 420
     {
421
-	    if (!$this->image_validated) return false;
421
+        if (!$this->image_validated) return false;
422 422
         $compress = (int)$compress;
423 423
         $type = $this->type;
424 424
         if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) {
425 425
             $type = $convert_file_to;
426 426
         }
427
-		switch ($type) {
428
-		    case 'jpeg':
429
-			case 'jpg':
430
-				if (!$file) header("Content-type: image/jpeg");
431
-				if ($compress == -1) $compress = 100;
432
-				return imagejpeg($this->bg, $file, $compress);
433
-				break;
434
-			case 'png':
435
-				if (!$file) header("Content-type: image/png");
436
-				if ($compress != -1) {
437
-					@imagetruecolortopalette($this->bg, true, $compress);
438
-				}
439
-				return imagepng($this->bg, $file, $compress);
440
-				break;
441
-			case 'gif':
442
-				if (!$file) header("Content-type: image/gif");
443
-				if ($compress != -1) {
444
-					@imagetruecolortopalette($this->bg, true, $compress);
445
-				}
446
-				return imagegif($this->bg, $file, $compress);
447
-				break;
448
-			default: return 0;
449
-		}
450
-		// TODO: Occupied memory is not released, because the following fragment of code is actually dead.
451
-		@imagedestroy($this->bg);
452
-	}
427
+        switch ($type) {
428
+            case 'jpeg':
429
+            case 'jpg':
430
+                if (!$file) header("Content-type: image/jpeg");
431
+                if ($compress == -1) $compress = 100;
432
+                return imagejpeg($this->bg, $file, $compress);
433
+                break;
434
+            case 'png':
435
+                if (!$file) header("Content-type: image/png");
436
+                if ($compress != -1) {
437
+                    @imagetruecolortopalette($this->bg, true, $compress);
438
+                }
439
+                return imagepng($this->bg, $file, $compress);
440
+                break;
441
+            case 'gif':
442
+                if (!$file) header("Content-type: image/gif");
443
+                if ($compress != -1) {
444
+                    @imagetruecolortopalette($this->bg, true, $compress);
445
+                }
446
+                return imagegif($this->bg, $file, $compress);
447
+                break;
448
+            default: return 0;
449
+        }
450
+        // TODO: Occupied memory is not released, because the following fragment of code is actually dead.
451
+        @imagedestroy($this->bg);
452
+    }
453 453
 
454 454
     /**
455 455
      * Convert image to black & white
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             return false;
116 116
         }
117 117
         $this->path = preg_match(VALID_WEB_PATH, $path) ? (api_is_internal_path($path) ? api_get_path(TO_SYS, $path) : $path) : $path;
118
-        $this->set_image_wrapper();  //Creates image obj
118
+        $this->set_image_wrapper(); //Creates image obj
119 119
     }
120 120
 
121 121
     abstract function set_image_wrapper();
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         if ($this->debug) error_log('Image::set_image_wrapper loaded');
158 158
         try {
159 159
             if (file_exists($this->path)) {
160
-                $this->image     = new Imagick($this->path);
160
+                $this->image = new Imagick($this->path);
161 161
 
162 162
                 if ($this->image) {
163 163
                     $this->fill_image_info(); //Fills height, width and type
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
             } else {
166 166
                 if ($this->debug) error_log('Image::image does not exist');
167 167
             }
168
-        } catch(ImagickException $e) {
168
+        } catch (ImagickException $e) {
169 169
             if ($this->debug) error_log($e->getMessage());
170 170
         }
171 171
     }
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 
187 187
 	public function get_image_size()
188 188
     {
189
-		$imagesize = array('width'=>0,'height'=>0);
189
+		$imagesize = array('width'=>0, 'height'=>0);
190 190
 	    if ($this->image_validated) {
191 191
             $imagesize = $this->image->getImageGeometry();
192 192
 	    }
@@ -203,8 +203,8 @@  discard block
 block discarded – undo
203 203
             $height = $thumbh;
204 204
         } else {
205 205
             $scale  = ($this->width > 0 && $this->height > 0) ? min($thumbw / $this->width, $thumbh / $this->height) : 0;
206
-            $width  = (int)($this->width * $scale);
207
-            $height = (int)($this->height * $scale);
206
+            $width  = (int) ($this->width * $scale);
207
+            $height = (int) ($this->height * $scale);
208 208
         }
209 209
 		$result = $this->image->resizeImage($width, $height, $this->filter, 1);
210 210
 		$this->width  = $thumbw;
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 		$result = false;
251 251
 		try {
252 252
 		    $result = $this->image->writeImage($file);
253
-		} catch(ImagickException $e) {
253
+		} catch (ImagickException $e) {
254 254
             if ($this->debug) error_log($e->getMessage());
255 255
         }
256 256
 
@@ -311,9 +311,9 @@  discard block
 block discarded – undo
311 311
 
312 312
     public function get_image_size()
313 313
     {
314
-        $return_array = array('width'=>0,'height'=>0);
314
+        $return_array = array('width'=>0, 'height'=>0);
315 315
         if ($this->image_validated) {
316
-	        $return_array = array('width'=>$this->width,'height'=>$this->height);
316
+	        $return_array = array('width'=>$this->width, 'height'=>$this->height);
317 317
         }
318 318
         return $return_array;
319 319
 	}
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
     public function fill_image_info()
322 322
     {
323 323
     	if (file_exists($this->path)) {
324
-	        $image_info     = getimagesize($this->path);
324
+	        $image_info = getimagesize($this->path);
325 325
 			$this->width    = $image_info[0];
326 326
 			$this->height   = $image_info[1];
327 327
 			$this->type     = $image_info[2];
@@ -341,11 +341,11 @@  discard block
 block discarded – undo
341 341
                 $height = $thumbh;
342 342
             } else {
343 343
                 $scale = min($thumbw / $this->width, $thumbh / $this->height);
344
-                $width = (int)($this->width * $scale);
345
-                $height = (int)($this->height * $scale);
344
+                $width = (int) ($this->width * $scale);
345
+                $height = (int) ($this->height * $scale);
346 346
             }
347
-			$deltaw = (int)(($thumbw - $width) / 2);
348
-			$deltah = (int)(($thumbh - $height) / 2);
347
+			$deltaw = (int) (($thumbw - $width) / 2);
348
+			$deltah = (int) (($thumbh - $height) / 2);
349 349
 			$dst_img = @ImageCreateTrueColor($thumbw, $thumbh);
350 350
             		@imagealphablending($dst_img, false);
351 351
 		        @imagesavealpha($dst_img, true);
@@ -360,8 +360,8 @@  discard block
 block discarded – undo
360 360
                 $height = $thumbh;
361 361
             } else {
362 362
                 $scale = ($this->width > 0 && $this->height > 0) ? min($thumbw / $this->width, $thumbh / $this->height) : 0;
363
-                $width  = (int)($this->width * $scale);
364
-                $height = (int)($this->height * $scale);
363
+                $width  = (int) ($this->width * $scale);
364
+                $height = (int) ($this->height * $scale);
365 365
             }
366 366
 			$deltaw = 0;
367 367
 			$deltah = 0;
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 	public function send_image($file = '', $compress = -1, $convert_file_to = null)
420 420
     {
421 421
 	    if (!$this->image_validated) return false;
422
-        $compress = (int)$compress;
422
+        $compress = (int) $compress;
423 423
         $type = $this->type;
424 424
         if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) {
425 425
             $type = $convert_file_to;
@@ -463,11 +463,11 @@  discard block
 block discarded – undo
463 463
          * so that we can use black (0,0,0) as transparent, which is what
464 464
          * the image is filled with when created.
465 465
          */
466
-        $transparent = imagecolorallocate($dest_img, 0,0,0);
466
+        $transparent = imagecolorallocate($dest_img, 0, 0, 0);
467 467
         imagealphablending($dest_img, false);
468 468
         imagesavealpha($dest_img, true);
469 469
         imagecolortransparent($dest_img, $transparent);
470
-        imagecopy($dest_img, $this->bg, 0,0, 0, 0,imagesx($this->bg), imagesx($this->bg));
470
+        imagecopy($dest_img, $this->bg, 0, 0, 0, 0, imagesx($this->bg), imagesx($this->bg));
471 471
         imagefilter($dest_img, IMG_FILTER_GRAYSCALE);
472 472
         $this->bg = $dest_img;
473 473
 
Please login to merge, or discard this patch.
Braces   +57 added lines, -19 removed lines patch added patch discarded remove patch
@@ -154,7 +154,9 @@  discard block
 block discarded – undo
154 154
 
155 155
     public function set_image_wrapper()
156 156
     {
157
-        if ($this->debug) error_log('Image::set_image_wrapper loaded');
157
+        if ($this->debug) {
158
+            error_log('Image::set_image_wrapper loaded');
159
+        }
158 160
         try {
159 161
             if (file_exists($this->path)) {
160 162
                 $this->image     = new Imagick($this->path);
@@ -163,10 +165,14 @@  discard block
 block discarded – undo
163 165
                     $this->fill_image_info(); //Fills height, width and type
164 166
                 }
165 167
             } else {
166
-                if ($this->debug) error_log('Image::image does not exist');
168
+                if ($this->debug) {
169
+                    error_log('Image::image does not exist');
170
+                }
167 171
             }
168 172
         } catch(ImagickException $e) {
169
-            if ($this->debug) error_log($e->getMessage());
173
+            if ($this->debug) {
174
+                error_log($e->getMessage());
175
+            }
170 176
         }
171 177
     }
172 178
 
@@ -180,7 +186,9 @@  discard block
 block discarded – undo
180 186
 
181 187
         if (in_array($this->type, $this->allowed_extensions)) {
182 188
             $this->image_validated = true;
183
-            if ($this->debug) error_log('image_validated true');
189
+            if ($this->debug) {
190
+                error_log('image_validated true');
191
+            }
184 192
         }
185 193
     }
186 194
 
@@ -196,7 +204,9 @@  discard block
 block discarded – undo
196 204
 	//@todo implement border logic case for Imagick
197 205
 	public function resize($thumbw, $thumbh, $border, $specific_size = false)
198 206
     {
199
-	    if (!$this->image_validated) return false;
207
+	    if (!$this->image_validated) {
208
+	        return false;
209
+	    }
200 210
 
201 211
         if ($specific_size) {
202 212
             $width = $thumbw;
@@ -222,7 +232,9 @@  discard block
 block discarded – undo
222 232
      */
223 233
     
224 234
     public function crop($x, $y, $width, $height, $src_width, $src_height) {
225
-        if (!$this->image_validated) return false;
235
+        if (!$this->image_validated) {
236
+            return false;
237
+        }
226 238
         $this->image->cropimage($width, $height, $x, $y);
227 239
 		$this->width  = $width;
228 240
 		$this->height = $height;
@@ -230,7 +242,9 @@  discard block
 block discarded – undo
230 242
 
231 243
     public function send_image($file = '', $compress = -1, $convert_file_to = null)
232 244
     {
233
-        if (!$this->image_validated) return false;
245
+        if (!$this->image_validated) {
246
+            return false;
247
+        }
234 248
         $type = $this->type;
235 249
         if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) {
236 250
             $type = $convert_file_to;
@@ -238,20 +252,28 @@  discard block
 block discarded – undo
238 252
 		switch ($type) {
239 253
 		    case 'jpeg':
240 254
 			case 'jpg':
241
-				if (!$file) header("Content-type: image/jpeg");
255
+				if (!$file) {
256
+				    header("Content-type: image/jpeg");
257
+				}
242 258
 				break;
243 259
 			case 'png':
244
-				if (!$file) header("Content-type: image/png");
260
+				if (!$file) {
261
+				    header("Content-type: image/png");
262
+				}
245 263
 				break;
246 264
 			case 'gif':
247
-				if (!$file) header("Content-type: image/gif");
265
+				if (!$file) {
266
+				    header("Content-type: image/gif");
267
+				}
248 268
 				break;
249 269
 		}
250 270
 		$result = false;
251 271
 		try {
252 272
 		    $result = $this->image->writeImage($file);
253 273
 		} catch(ImagickException $e) {
254
-            if ($this->debug) error_log($e->getMessage());
274
+            if ($this->debug) {
275
+                error_log($e->getMessage());
276
+            }
255 277
         }
256 278
 
257 279
 		if (!$file) {
@@ -334,7 +356,9 @@  discard block
 block discarded – undo
334 356
 
335 357
     public function resize($thumbw, $thumbh, $border, $specific_size = false)
336 358
     {
337
-        if (!$this->image_validated) return false;
359
+        if (!$this->image_validated) {
360
+            return false;
361
+        }
338 362
 		if ($border == 1) {
339 363
             if ($specific_size) {
340 364
                 $width = $thumbw;
@@ -387,7 +411,9 @@  discard block
 block discarded – undo
387 411
      * @param int $src_height the source height of the original image
388 412
      */
389 413
     public function crop($x, $y, $width, $height, $src_width, $src_height) {
390
-        if (!$this->image_validated) return false;
414
+        if (!$this->image_validated) {
415
+            return false;
416
+        }
391 417
         $this->width = $width;
392 418
 		$this->height = $height;
393 419
         $src = null;
@@ -418,7 +444,9 @@  discard block
 block discarded – undo
418 444
 
419 445
 	public function send_image($file = '', $compress = -1, $convert_file_to = null)
420 446
     {
421
-	    if (!$this->image_validated) return false;
447
+	    if (!$this->image_validated) {
448
+	        return false;
449
+	    }
422 450
         $compress = (int)$compress;
423 451
         $type = $this->type;
424 452
         if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) {
@@ -427,19 +455,27 @@  discard block
 block discarded – undo
427 455
 		switch ($type) {
428 456
 		    case 'jpeg':
429 457
 			case 'jpg':
430
-				if (!$file) header("Content-type: image/jpeg");
431
-				if ($compress == -1) $compress = 100;
458
+				if (!$file) {
459
+				    header("Content-type: image/jpeg");
460
+				}
461
+				if ($compress == -1) {
462
+				    $compress = 100;
463
+				}
432 464
 				return imagejpeg($this->bg, $file, $compress);
433 465
 				break;
434 466
 			case 'png':
435
-				if (!$file) header("Content-type: image/png");
467
+				if (!$file) {
468
+				    header("Content-type: image/png");
469
+				}
436 470
 				if ($compress != -1) {
437 471
 					@imagetruecolortopalette($this->bg, true, $compress);
438 472
 				}
439 473
 				return imagepng($this->bg, $file, $compress);
440 474
 				break;
441 475
 			case 'gif':
442
-				if (!$file) header("Content-type: image/gif");
476
+				if (!$file) {
477
+				    header("Content-type: image/gif");
478
+				}
443 479
 				if ($compress != -1) {
444 480
 					@imagetruecolortopalette($this->bg, true, $compress);
445 481
 				}
@@ -456,7 +492,9 @@  discard block
 block discarded – undo
456 492
      */
457 493
     function convert2bw()
458 494
     {
459
-        if (!$this->image_validated) return false;
495
+        if (!$this->image_validated) {
496
+            return false;
497
+        }
460 498
 
461 499
         $dest_img = imagecreatetruecolor(imagesx($this->bg), imagesy($this->bg));
462 500
         /* copy ignore the transparent color
Please login to merge, or discard this patch.
Doc Comments   +16 added lines patch added patch discarded remove patch
@@ -63,6 +63,9 @@  discard block
 block discarded – undo
63 63
         return $image;
64 64
     }
65 65
 
66
+    /**
67
+     * @param string $convert_file_to
68
+     */
66 69
     public function send_image(
67 70
         $file = '',
68 71
         $compress = -1,
@@ -144,6 +147,9 @@  discard block
 block discarded – undo
144 147
     public $image;
145 148
     public $filter = Imagick::FILTER_LANCZOS;
146 149
 
150
+    /**
151
+     * @param string $path
152
+     */
147 153
     public function __construct($path)
148 154
     {
149 155
           parent::__construct($path);
@@ -191,6 +197,10 @@  discard block
 block discarded – undo
191 197
 	}
192 198
 
193 199
 	//@todo implement border logic case for Imagick
200
+
201
+	/**
202
+	 * @param integer $border
203
+	 */
194 204
 	public function resize($thumbw, $thumbh, $border, $specific_size = false)
195 205
     {
196 206
 	    if (!$this->image_validated) return false;
@@ -272,6 +282,9 @@  discard block
 block discarded – undo
272 282
 {
273 283
     public $bg;
274 284
 
285
+    /**
286
+     * @param string $path
287
+     */
275 288
     function __construct($path) {
276 289
         parent::__construct($path);
277 290
     }
@@ -329,6 +342,9 @@  discard block
 block discarded – undo
329 342
     	}
330 343
     }
331 344
 
345
+    /**
346
+     * @param integer $border
347
+     */
332 348
     public function resize($thumbw, $thumbh, $border, $specific_size = false)
333 349
     {
334 350
         if (!$this->image_validated) return false;
Please login to merge, or discard this patch.
main/inc/lib/timeline.lib.php 2 patches
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -25,10 +25,10 @@  discard block
 block discarded – undo
25 25
     );
26 26
     public $is_course_model = true;
27 27
 
28
-	public function __construct()
28
+    public function __construct()
29 29
     {
30 30
         $this->table =  Database::get_course_table(TABLE_TIMELINE);
31
-	}
31
+    }
32 32
 
33 33
     /**
34 34
      * Get the count of elements
@@ -52,16 +52,16 @@  discard block
 block discarded – undo
52 52
     /**
53 53
      * Displays the title + grid
54 54
      */
55
-	public function listing()
55
+    public function listing()
56 56
     {
57
-		// action links
58
-		$html = '<div class="actions">';
57
+        // action links
58
+        $html = '<div class="actions">';
59 59
         //$html .= '<a href="career_dashboard.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>';
60
-		$html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'),'','32').'</a>';
61
-		$html .= '</div>';
60
+        $html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'),'','32').'</a>';
61
+        $html .= '</div>';
62 62
         $html .= Display::grid_html('timelines');
63 63
         return $html;
64
-	}
64
+    }
65 65
 
66 66
     public function get_status_list()
67 67
     {
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 
90 90
         $form->addElement('text', 'headline', get_lang('Name'), array('size' => '70'));
91 91
         //$form->addHtmlEditor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'Careers','Width' => '100%', 'Height' => '250'));
92
-	    $status_list = $this->get_status_list();
92
+        $status_list = $this->get_status_list();
93 93
         $form->addElement('select', 'status', get_lang('Status'), $status_list);
94 94
         if ($action == 'edit') {
95 95
             //$form->addElement('text', 'created_at', get_lang('CreatedAt'));
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
         // Setting the rules
175 175
         $form->addRule('headline', get_lang('ThisFieldIsRequired'), 'required');
176
-		return $form;
176
+        return $form;
177 177
 
178 178
     }
179 179
 
@@ -184,11 +184,11 @@  discard block
 block discarded – undo
184 184
     public function save_item($params)
185 185
     {
186 186
         $params['c_id'] = api_get_course_int_id();
187
-	    $id = parent::save($params);
188
-	    if (!empty($id)) {
189
-	    	//event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id());
190
-   		}
191
-   		return $id;
187
+        $id = parent::save($params);
188
+        if (!empty($id)) {
189
+            //event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id());
190
+            }
191
+            return $id;
192 192
     }
193 193
 
194 194
     /**
@@ -199,16 +199,16 @@  discard block
 block discarded – undo
199 199
         $params['c_id'] = api_get_course_int_id();
200 200
         $params['parent_id'] = '0';
201 201
         $params['type'] = 'default';
202
-	    $id = parent::save($params);
203
-	    if (!empty($id)) {
204
-	    	//event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id());
205
-   		}
206
-   		return $id;
202
+        $id = parent::save($params);
203
+        if (!empty($id)) {
204
+            //event_system(LOG_CAREER_CREATE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id());
205
+            }
206
+            return $id;
207 207
     }
208 208
 
209 209
     public function delete($id) {
210
-	    parent::delete($id);
211
-	    //event_system(LOG_CAREER_DELETE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id());
210
+        parent::delete($id);
211
+        //event_system(LOG_CAREER_DELETE, LOG_CAREER_ID, $id, api_get_utc_datetime(), api_get_user_id());
212 212
     }
213 213
 
214 214
     public function get_url($id) {
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
         $item['asset'] = array( 'media'     => $item['media'],
248 248
                                 'credit'    => $item['media_credit'],
249 249
                                 'caption'   => $item['media_caption'],
250
-         );
250
+            );
251 251
 
252 252
         //Cleaning items
253 253
         unset($item['id']);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
 	public function __construct()
29 29
     {
30
-        $this->table =  Database::get_course_table(TABLE_TIMELINE);
30
+        $this->table = Database::get_course_table(TABLE_TIMELINE);
31 31
 	}
32 32
 
33 33
     /**
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function get_all($where_conditions = array())
48 48
     {
49
-        return Database::select('*',$this->table, array('where'=>$where_conditions,'order' =>'headline ASC'));
49
+        return Database::select('*', $this->table, array('where'=>$where_conditions, 'order' =>'headline ASC'));
50 50
     }
51 51
 
52 52
     /**
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		// action links
58 58
 		$html = '<div class="actions">';
59 59
         //$html .= '<a href="career_dashboard.php">'.Display::return_icon('back.png',get_lang('Back'),'','32').'</a>';
60
-		$html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'),'','32').'</a>';
60
+		$html .= '<a href="'.api_get_self().'?action=add">'.Display::return_icon('add.png', get_lang('Add'), '', '32').'</a>';
61 61
 		$html .= '</div>';
62 62
         $html .= Display::grid_html('timelines');
63 63
         return $html;
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
         }
245 245
         unset($item['end_date']);
246 246
         // Assets
247
-        $item['asset'] = array( 'media'     => $item['media'],
247
+        $item['asset'] = array('media'     => $item['media'],
248 248
                                 'credit'    => $item['media_credit'],
249 249
                                 'caption'   => $item['media_caption'],
250 250
          );
Please login to merge, or discard this patch.