Completed
Push — 1.11.x ( d00fca...f1f062 )
by José
28:05
created
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.
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.
Doc Comments   +19 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1532,7 +1532,7 @@  discard block
 block discarded – undo
1532 1532
      * @param	array	$id_checked an array to delete sessions
1533 1533
      * @param   boolean  $from_ws optional, true if the function is called
1534 1534
      * by a webservice, false otherwise.
1535
-     * @return	void	Nothing, or false on error
1535
+     * @return	boolean	Nothing, or false on error
1536 1536
      * */
1537 1537
     public static function delete($id_checked, $from_ws = false)
1538 1538
     {
@@ -1669,7 +1669,7 @@  discard block
 block discarded – undo
1669 1669
      * @param array $user_list
1670 1670
      * @param int $session_visibility
1671 1671
      * @param bool $empty_users
1672
-     * @return bool
1672
+     * @return false|null
1673 1673
      */
1674 1674
     public static function subscribe_users_to_session(
1675 1675
         $id_session,
@@ -1942,7 +1942,7 @@  discard block
 block discarded – undo
1942 1942
      * @param array $courseInfo
1943 1943
      * @param int $status
1944 1944
      * @param bool $updateTotal
1945
-     * @return bool
1945
+     * @return false|null
1946 1946
      */
1947 1947
     public static function removeUsersFromCourseSession(
1948 1948
         $userList,
@@ -2008,7 +2008,7 @@  discard block
 block discarded – undo
2008 2008
      * @param string $course_code
2009 2009
      * @param int $session_visibility
2010 2010
      * @param bool $removeUsersNotInList
2011
-     * @return bool
2011
+     * @return false|null
2012 2012
      */
2013 2013
     public static function subscribe_users_to_session_course(
2014 2014
         $user_list,
@@ -2192,7 +2192,7 @@  discard block
 block discarded – undo
2192 2192
      * @param	bool	$removeExistingCoursesWithUsers Whether to unsubscribe
2193 2193
      * existing courses and users (true, default) or not (false)
2194 2194
      * @param $copyEvaluation from base course to session course
2195
-     * @return	void	Nothing, or false on error
2195
+     * @return	false|null	Nothing, or false on error
2196 2196
      * */
2197 2197
     public static function add_courses_to_session(
2198 2198
         $sessionId,
@@ -2441,7 +2441,7 @@  discard block
 block discarded – undo
2441 2441
      * @param	string	$variable Field's internal variable name
2442 2442
      * @param	int		$fieldType Field's type
2443 2443
      * @param	string	$displayText Field's language var name
2444
-     * @return int     new extra field id
2444
+     * @return boolean     new extra field id
2445 2445
      */
2446 2446
     public static function create_session_extra_field($variable, $fieldType, $displayText)
2447 2447
     {
@@ -2670,7 +2670,7 @@  discard block
 block discarded – undo
2670 2670
      * @param	array	id_checked
2671 2671
      * @param	bool	include delete session
2672 2672
      * @param	bool	optional, true if the function is called by a webservice, false otherwise.
2673
-     * @return	void	Nothing, or false on error
2673
+     * @return	boolean	Nothing, or false on error
2674 2674
      * The parameters is a array to delete sessions
2675 2675
      * */
2676 2676
     public static function delete_session_category($id_checked, $delete_session = false, $from_ws = false)
@@ -3436,8 +3436,8 @@  discard block
 block discarded – undo
3436 3436
     /**
3437 3437
      * Gets the list of courses by session filtered by access_url
3438 3438
      *
3439
-     * @param $userId
3440
-     * @param $sessionId
3439
+     * @param integer $userId
3440
+     * @param null|integer $sessionId
3441 3441
      * @param null $from
3442 3442
      * @param null $limit
3443 3443
      * @param null $column
@@ -3562,6 +3562,7 @@  discard block
 block discarded – undo
3562 3562
     /**
3563 3563
      * Gets the count of courses by session filtered by access_url
3564 3564
      * @param int session id
3565
+     * @param integer $session_id
3565 3566
      * @return array list of courses
3566 3567
      */
3567 3568
     public static function getCourseCountBySessionId($session_id, $keyword = null)
@@ -3820,6 +3821,7 @@  discard block
 block discarded – undo
3820 3821
      * Updates a session status
3821 3822
      * @param	int 	session id
3822 3823
      * @param	int 	status
3824
+     * @param integer $status
3823 3825
      */
3824 3826
     public static function set_session_status($session_id, $status)
3825 3827
     {
@@ -4028,7 +4030,7 @@  discard block
 block discarded – undo
4028 4030
      * Protect a session to be edited.
4029 4031
      * @param int $id
4030 4032
      * @param bool $checkSession
4031
-     * @return mixed | bool true if pass the check, api_not_allowed otherwise
4033
+     * @return boolean|null | bool true if pass the check, api_not_allowed otherwise
4032 4034
      */
4033 4035
     public static function protectSession($id, $checkSession = true)
4034 4036
     {
@@ -4136,7 +4138,7 @@  discard block
 block discarded – undo
4136 4138
 
4137 4139
     /**
4138 4140
      * @param $id
4139
-     * @return bool
4141
+     * @return null|boolean
4140 4142
      */
4141 4143
     public static function protect_teacher_session_edit($id)
4142 4144
     {
@@ -4201,7 +4203,7 @@  discard block
 block discarded – undo
4201 4203
      *  true: if the session exists it will be updated.
4202 4204
      *  false: if session exists a new session will be created adding a counter session1, session2, etc
4203 4205
      * @param int $defaultUserId
4204
-     * @param mixed $logger
4206
+     * @param Logger $logger
4205 4207
      * @param array $extraFields convert a file row to an extra field. Example in CSV file there's a SessionID then it will
4206 4208
      * converted to extra_external_session_id if you set this: array('SessionId' => 'extra_external_session_id')
4207 4209
      * @param string $extraFieldId
@@ -5504,7 +5506,6 @@  discard block
 block discarded – undo
5504 5506
      * @param string $lastConnectionDate
5505 5507
      * @param array $sessionIdList
5506 5508
      * @param array $studentIdList
5507
-     * @param int $userStatus STUDENT|COURSEMANAGER constants
5508 5509
      *
5509 5510
      * @return array|int
5510 5511
      */
@@ -5656,7 +5657,7 @@  discard block
 block discarded – undo
5656 5657
     /**
5657 5658
      * Get the list of course tools that have to be dealt with in case of
5658 5659
      * registering any course to a session
5659
-     * @return array The list of tools to be dealt with (literal names)
5660
+     * @return string[] The list of tools to be dealt with (literal names)
5660 5661
      */
5661 5662
     public static function getCourseToolToBeManaged()
5662 5663
     {
@@ -5670,7 +5671,7 @@  discard block
 block discarded – undo
5670 5671
      * Calls the methods bound to each tool when a course is registered into a session
5671 5672
      * @param int $sessionId
5672 5673
      * @param int $courseId
5673
-     * @return void
5674
+     * @return boolean|null
5674 5675
      */
5675 5676
     public static function installCourse($sessionId, $courseId)
5676 5677
     {
@@ -6320,6 +6321,7 @@  discard block
 block discarded – undo
6320 6321
      * @param int $categoryId The internal ID of the session category
6321 6322
      * @param string $target Value to search for in the session field values
6322 6323
      * @param array $extraFields A list of fields to be scanned and returned
6324
+     * @param DateTime $publicationDate
6323 6325
      * @return mixed
6324 6326
      */
6325 6327
     public static function getShortSessionListAndExtraByCategory(
@@ -7656,7 +7658,7 @@  discard block
 block discarded – undo
7656 7658
     /**
7657 7659
      * Get link to the admin page for this session
7658 7660
      * @param   int $id Session ID
7659
-     * @return mixed    URL to the admin page to manage the session, or false on error
7661
+     * @return false|string    URL to the admin page to manage the session, or false on error
7660 7662
      */
7661 7663
     public static function getAdminPath($id)
7662 7664
     {
@@ -7673,7 +7675,7 @@  discard block
 block discarded – undo
7673 7675
      * If a course is provided, build the link to the course
7674 7676
      * @param   int $id Session ID
7675 7677
      * @param   int $courseId Course ID (optional) in case the link has to send straight to the course
7676
-     * @return mixed    URL to the page to use the session, or false on error
7678
+     * @return false|string    URL to the page to use the session, or false on error
7677 7679
      */
7678 7680
     public static function getPath($id, $courseId = 0)
7679 7681
     {
Please login to merge, or discard this patch.
Spacing   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
                     return $msg;
183 183
                 }
184 184
             } else {
185
-                $rs = Database::query("SELECT 1 FROM $tbl_session WHERE name='" . $name . "'");
185
+                $rs = Database::query("SELECT 1 FROM $tbl_session WHERE name='".$name."'");
186 186
                 if (Database::num_rows($rs)) {
187 187
                     $msg = get_lang('SessionNameAlreadyExists');
188 188
                     return $msg;
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
     public static function session_name_exists($name)
296 296
     {
297 297
         $name = Database::escape_string($name);
298
-        $sql = "SELECT COUNT(*) as count FROM " . Database::get_main_table(TABLE_MAIN_SESSION) . "
298
+        $sql = "SELECT COUNT(*) as count FROM ".Database::get_main_table(TABLE_MAIN_SESSION)."
299 299
                 WHERE name = '$name'";
300 300
         $result = Database::fetch_array(Database::query($sql));
301 301
 
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
             $where .= " AND (
327 327
                             s.session_admin_id = $user_id  OR
328 328
                             sru.user_id = '$user_id' AND
329
-                            sru.relation_type = '" . SESSION_RELATION_TYPE_RRHH . "'
329
+                            sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."'
330 330
                             )
331 331
                       ";
332 332
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
             $where_condition = str_replace('category_name', 'sc.name', $where_condition);
345 345
             $where_condition = str_replace(
346 346
                 array("AND session_active = '1'  )", " AND (  session_active = '1'  )"),
347
-                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 " )
347
+                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 ")
348 348
                 , $where_condition
349 349
             );
350 350
             $where_condition = str_replace(
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 
390 390
             $access_url_id = api_get_current_access_url_id();
391 391
             if ($access_url_id != -1) {
392
-                $where.= " AND ar.access_url_id = $access_url_id ";
392
+                $where .= " AND ar.access_url_id = $access_url_id ";
393 393
 
394 394
                 $sql = "SELECT count(id) as total_rows FROM (
395 395
                 SELECT DISTINCT
@@ -439,14 +439,14 @@  discard block
 block discarded – undo
439 439
             if (api_is_session_admin() &&
440 440
                 api_get_setting('allow_session_admins_to_manage_all_sessions') == 'false'
441 441
             ) {
442
-                $where .=" AND s.session_admin_id = $user_id ";
442
+                $where .= " AND s.session_admin_id = $user_id ";
443 443
             }
444 444
         }
445 445
 
446 446
         if (!api_is_platform_admin() && api_is_teacher() &&
447 447
             api_get_setting('allow_teachers_to_create_sessions') == 'true'
448 448
         ) {
449
-            $where .=" AND s.id_coach = $user_id ";
449
+            $where .= " AND s.id_coach = $user_id ";
450 450
         }
451 451
 
452 452
         $extra_field = new ExtraFieldModel('session');
@@ -498,10 +498,10 @@  discard block
 block discarded – undo
498 498
         $query = "$select FROM $tbl_session s $inject_joins $where $inject_where";
499 499
 
500 500
         if (api_is_multiple_url_enabled()) {
501
-            $table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
501
+            $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
502 502
             $access_url_id = api_get_current_access_url_id();
503 503
             if ($access_url_id != -1) {
504
-                $where.= " AND ar.access_url_id = $access_url_id ";
504
+                $where .= " AND ar.access_url_id = $access_url_id ";
505 505
                 $query = "$select
506 506
                         FROM $tbl_session s $inject_joins
507 507
                         INNER JOIN $table_access_url_rel_session ar
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
                 INNER JOIN $tbl_lp l ON l.id = v.lp_id
605 605
                 INNER JOIN $tbl_user u ON u.user_id = v.user_id
606 606
                 INNER JOIN $tbl_course c
607
-                WHERE v.session_id = " . $sessionId;
607
+                WHERE v.session_id = ".$sessionId;
608 608
         $result_rows = Database::query($sql);
609 609
         $row = Database::fetch_array($result_rows);
610 610
         $num = $row['total_rows'];
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
 
657 657
         $limit = null;
658 658
         if (!empty($options['limit'])) {
659
-            $limit = " LIMIT " . $options['limit'];
659
+            $limit = " LIMIT ".$options['limit'];
660 660
         }
661 661
 
662 662
         if (!empty($options['where'])) {
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
 
666 666
         $order = null;
667 667
         if (!empty($options['order'])) {
668
-            $order = " ORDER BY " . $options['order'];
668
+            $order = " ORDER BY ".$options['order'];
669 669
         }
670 670
 
671 671
         $sql = "SELECT u.user_id, u.lastname, u.firstname, u.username, u.email, s.c_id
@@ -724,13 +724,13 @@  discard block
 block discarded – undo
724 724
             foreach ($lessons as $lesson) {
725 725
                 $data[$lesson['id']] = (!empty($user_lessons[$lesson['id']]['progress'])) ? $user_lessons[$lesson['id']]['progress'] : 0;
726 726
                 $progress += $data[$lesson['id']];
727
-                $data[$lesson['id']] = $data[$lesson['id']] . '%';
727
+                $data[$lesson['id']] = $data[$lesson['id']].'%';
728 728
                 $count++;
729 729
             }
730 730
             if ($count == 0) {
731 731
                 $data['total'] = 0;
732 732
             } else {
733
-                $data['total'] = round($progress / $count, 2) . '%';
733
+                $data['total'] = round($progress / $count, 2).'%';
734 734
             }
735 735
             $table[] = $data;
736 736
         }
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 
772 772
         $limit = null;
773 773
         if (!empty($options['limit'])) {
774
-            $limit = " LIMIT " . $options['limit'];
774
+            $limit = " LIMIT ".$options['limit'];
775 775
         }
776 776
 
777 777
         if (!empty($options['where'])) {
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
 
781 781
         $order = null;
782 782
         if (!empty($options['order'])) {
783
-            $order = " ORDER BY " . $options['order'];
783
+            $order = " ORDER BY ".$options['order'];
784 784
         }
785 785
 
786 786
         $sql = "SELECT u.user_id, u.lastname, u.firstname, u.username, u.email, s.c_id
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 
883 883
         $limit = null;
884 884
         if (!empty($options['limit'])) {
885
-            $limit = " LIMIT " . $options['limit'];
885
+            $limit = " LIMIT ".$options['limit'];
886 886
         }
887 887
 
888 888
         if (!empty($options['where'])) {
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
 
892 892
         $order = null;
893 893
         if (!empty($options['order'])) {
894
-            $order = " ORDER BY " . $options['order'];
894
+            $order = " ORDER BY ".$options['order'];
895 895
         }
896 896
 
897 897
         //TODO, fix create report without session
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
         /**
925 925
          *  Lessons
926 926
          */
927
-        $sql = "SELECT * FROM $tbl_course_lp WHERE c_id = %s ";  //AND session_id = %s
927
+        $sql = "SELECT * FROM $tbl_course_lp WHERE c_id = %s "; //AND session_id = %s
928 928
         $sql_query = sprintf($sql, $course['real_id']);
929 929
         $result = Database::query($sql_query);
930 930
         $arrLesson = array(array());
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
             if (empty($arrLesson[$row['session_id']]['lessons_total'])) {
933 933
                 $arrLesson[$row['session_id']]['lessons_total'] = 1;
934 934
             } else {
935
-                $arrLesson[$row['session_id']]['lessons_total'] ++;
935
+                $arrLesson[$row['session_id']]['lessons_total']++;
936 936
             }
937 937
         }
938 938
 
@@ -1008,7 +1008,7 @@  discard block
 block discarded – undo
1008 1008
                 $course['real_id']
1009 1009
             );
1010 1010
             foreach ($user_list as $user_id) {
1011
-                isset($survey_user_list[$user_id]) ? $survey_user_list[$user_id] ++ : $survey_user_list[$user_id] = 1;
1011
+                isset($survey_user_list[$user_id]) ? $survey_user_list[$user_id]++ : $survey_user_list[$user_id] = 1;
1012 1012
             }
1013 1013
         }
1014 1014
 
@@ -1062,7 +1062,7 @@  discard block
 block discarded – undo
1062 1062
             $assignments_done = Tracking::count_student_assignments($user['user_id'], $course['code'], $user['id_session']);
1063 1063
             $assignments_left = $assignments_total - $assignments_done;
1064 1064
             if (!empty($assignments_total)) {
1065
-                $assignments_progress = round((( $assignments_done * 100 ) / $assignments_total), 2);
1065
+                $assignments_progress = round((($assignments_done * 100) / $assignments_total), 2);
1066 1066
             } else {
1067 1067
                 $assignments_progress = 0;
1068 1068
             }
@@ -1092,7 +1092,7 @@  discard block
 block discarded – undo
1092 1092
             $wiki_read = $row['count'];
1093 1093
             $wiki_unread = $wiki_total - $wiki_read;
1094 1094
             if (!empty($wiki_total)) {
1095
-                $wiki_progress = round((( $wiki_read * 100 ) / $wiki_total), 2);
1095
+                $wiki_progress = round((($wiki_read * 100) / $wiki_total), 2);
1096 1096
             } else {
1097 1097
                 $wiki_progress = 0;
1098 1098
             }
@@ -1101,7 +1101,7 @@  discard block
 block discarded – undo
1101 1101
             $surveys_done = (isset($survey_user_list[$user['user_id']]) ? $survey_user_list[$user['user_id']] : 0);
1102 1102
             $surveys_left = $surveys_total - $surveys_done;
1103 1103
             if (!empty($surveys_total)) {
1104
-                $surveys_progress = round((( $surveys_done * 100 ) / $surveys_total), 2);
1104
+                $surveys_progress = round((($surveys_done * 100) / $surveys_total), 2);
1105 1105
             } else {
1106 1106
                 $surveys_progress = 0;
1107 1107
             }
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
             );
1115 1115
             $forums_left = $forums_total - $forums_done;
1116 1116
             if (!empty($forums_total)) {
1117
-                $forums_progress = round((( $forums_done * 100 ) / $forums_total), 2);
1117
+                $forums_progress = round((($forums_done * 100) / $forums_total), 2);
1118 1118
             } else {
1119 1119
                 $forums_progress = 0;
1120 1120
             }
@@ -1122,58 +1122,58 @@  discard block
 block discarded – undo
1122 1122
             //Overall Total
1123 1123
             $overall_total = ($course_description_progress + $exercises_progress + $forums_progress + $assignments_progress + $wiki_progress + $surveys_progress) / 6;
1124 1124
 
1125
-            $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>';
1126
-            $linkForum = '<a href="' . api_get_path(WEB_CODE_PATH) . 'forum/index.php?cidReq=' . $course['code'] . '&id_session=' . $user['id_session'] . '"> %s </a>';
1127
-            $linkWork = '<a href="' . api_get_path(WEB_CODE_PATH) . 'work/work.php?cidReq=' . $course['code'] . '&id_session=' . $user['id_session'] . '"> %s </a>';
1128
-            $linkWiki = '<a href="' . api_get_path(WEB_CODE_PATH) . 'wiki/index.php?cidReq=' . $course['code'] . '&session_id=' . $user['id_session'] . '&action=statistics"> %s </a>';
1129
-            $linkSurvey = '<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/survey_list.php?cidReq=' . $course['code'] . '&id_session=' . $user['id_session'] . '"> %s </a>';
1125
+            $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>';
1126
+            $linkForum = '<a href="'.api_get_path(WEB_CODE_PATH).'forum/index.php?cidReq='.$course['code'].'&id_session='.$user['id_session'].'"> %s </a>';
1127
+            $linkWork = '<a href="'.api_get_path(WEB_CODE_PATH).'work/work.php?cidReq='.$course['code'].'&id_session='.$user['id_session'].'"> %s </a>';
1128
+            $linkWiki = '<a href="'.api_get_path(WEB_CODE_PATH).'wiki/index.php?cidReq='.$course['code'].'&session_id='.$user['id_session'].'&action=statistics"> %s </a>';
1129
+            $linkSurvey = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?cidReq='.$course['code'].'&id_session='.$user['id_session'].'"> %s </a>';
1130 1130
 
1131 1131
             $table[] = array(
1132 1132
                 'lastname' => $user[1],
1133 1133
                 'firstname' => $user[2],
1134 1134
                 'username' => $user[3],
1135 1135
                 #'profile'   => '',
1136
-                'total' => round($overall_total, 2) . '%',
1137
-                'courses' => sprintf($link, $course_description_progress . '%'),
1138
-                'lessons' => sprintf($link, $lessons_progress . '%'),
1139
-                'exercises' => sprintf($link, $exercises_progress . '%'),
1140
-                'forums' => sprintf($link, $forums_progress . '%'),
1141
-                'homeworks' => sprintf($link, $assignments_progress . '%'),
1142
-                'wikis' => sprintf($link, $wiki_progress . '%'),
1143
-                'surveys' => sprintf($link, $surveys_progress . '%'),
1136
+                'total' => round($overall_total, 2).'%',
1137
+                'courses' => sprintf($link, $course_description_progress.'%'),
1138
+                'lessons' => sprintf($link, $lessons_progress.'%'),
1139
+                'exercises' => sprintf($link, $exercises_progress.'%'),
1140
+                'forums' => sprintf($link, $forums_progress.'%'),
1141
+                'homeworks' => sprintf($link, $assignments_progress.'%'),
1142
+                'wikis' => sprintf($link, $wiki_progress.'%'),
1143
+                'surveys' => sprintf($link, $surveys_progress.'%'),
1144 1144
                 //course description
1145
-                'course_description_progress' => $course_description_progress . '%',
1145
+                'course_description_progress' => $course_description_progress.'%',
1146 1146
                 //lessons
1147 1147
                 'lessons_total' => sprintf($link, $lessons_total),
1148 1148
                 'lessons_done' => sprintf($link, $lessons_done),
1149 1149
                 'lessons_left' => sprintf($link, $lessons_left),
1150
-                'lessons_progress' => sprintf($link, $lessons_progress . '%'),
1150
+                'lessons_progress' => sprintf($link, $lessons_progress.'%'),
1151 1151
                 //exercises
1152 1152
                 'exercises_total' => sprintf($link, $exercises_total),
1153 1153
                 'exercises_done' => sprintf($link, $exercises_done),
1154 1154
                 'exercises_left' => sprintf($link, $exercises_left),
1155
-                'exercises_progress' => sprintf($link, $exercises_progress . '%'),
1155
+                'exercises_progress' => sprintf($link, $exercises_progress.'%'),
1156 1156
                 //forums
1157 1157
                 'forums_total' => sprintf($linkForum, $forums_total),
1158 1158
                 'forums_done' => sprintf($linkForum, $forums_done),
1159 1159
                 'forums_left' => sprintf($linkForum, $forums_left),
1160
-                'forums_progress' => sprintf($linkForum, $forums_progress . '%'),
1160
+                'forums_progress' => sprintf($linkForum, $forums_progress.'%'),
1161 1161
                 //assignments
1162 1162
                 'assignments_total' => sprintf($linkWork, $assignments_total),
1163 1163
                 'assignments_done' => sprintf($linkWork, $assignments_done),
1164 1164
                 'assignments_left' => sprintf($linkWork, $assignments_left),
1165
-                'assignments_progress' => sprintf($linkWork, $assignments_progress . '%'),
1165
+                'assignments_progress' => sprintf($linkWork, $assignments_progress.'%'),
1166 1166
                 //wiki
1167 1167
                 'wiki_total' => sprintf($linkWiki, $wiki_total),
1168 1168
                 'wiki_revisions' => sprintf($linkWiki, $wiki_revisions),
1169 1169
                 'wiki_read' => sprintf($linkWiki, $wiki_read),
1170 1170
                 'wiki_unread' => sprintf($linkWiki, $wiki_unread),
1171
-                'wiki_progress' => sprintf($linkWiki, $wiki_progress . '%'),
1171
+                'wiki_progress' => sprintf($linkWiki, $wiki_progress.'%'),
1172 1172
                 //survey
1173 1173
                 'surveys_total' => sprintf($linkSurvey, $surveys_total),
1174 1174
                 'surveys_done' => sprintf($linkSurvey, $surveys_done),
1175 1175
                 'surveys_left' => sprintf($linkSurvey, $surveys_left),
1176
-                'surveys_progress' => sprintf($linkSurvey, $surveys_progress . '%'),
1176
+                'surveys_progress' => sprintf($linkSurvey, $surveys_progress.'%'),
1177 1177
             );
1178 1178
         }
1179 1179
 
@@ -1255,7 +1255,7 @@  discard block
 block discarded – undo
1255 1255
 
1256 1256
         $limit = null;
1257 1257
         if (!empty($options['limit'])) {
1258
-            $limit = " LIMIT " . $options['limit'];
1258
+            $limit = " LIMIT ".$options['limit'];
1259 1259
         }
1260 1260
 
1261 1261
         if (!empty($options['where'])) {
@@ -1264,7 +1264,7 @@  discard block
 block discarded – undo
1264 1264
 
1265 1265
         $order = null;
1266 1266
         if (!empty($options['order'])) {
1267
-            $order = " ORDER BY " . $options['order'];
1267
+            $order = " ORDER BY ".$options['order'];
1268 1268
         }
1269 1269
 
1270 1270
         //TODO add course name
@@ -1277,7 +1277,7 @@  discard block
 block discarded – undo
1277 1277
                     " : "
1278 1278
                     u.lastname,
1279 1279
                     u.firstname,
1280
-                ") . "
1280
+                ")."
1281 1281
                 a.logout_course_date,
1282 1282
                 a.counter,
1283 1283
                 c.title,
@@ -1359,7 +1359,7 @@  discard block
 block discarded – undo
1359 1359
             if (Database::num_rows($result) > 0) {
1360 1360
                 $row = Database::fetch_array($result);
1361 1361
                 $count = $row['count'] + 1;
1362
-                $session_name = $session_name . '_' . $count;
1362
+                $session_name = $session_name.'_'.$count;
1363 1363
                 $result = self::session_name_exists($session_name);
1364 1364
                 if (!$result) {
1365 1365
                     return $session_name;
@@ -1866,7 +1866,7 @@  discard block
 block discarded – undo
1866 1866
         // Delete users from the session
1867 1867
         if ($empty_users === true) {
1868 1868
             $sql = "DELETE FROM $tbl_session_rel_user
1869
-                    WHERE session_id = $id_session AND relation_type<>" . SESSION_RELATION_TYPE_RRHH . "";
1869
+                    WHERE session_id = $id_session AND relation_type<>".SESSION_RELATION_TYPE_RRHH."";
1870 1870
             Database::query($sql);
1871 1871
         }
1872 1872
 
@@ -1877,7 +1877,7 @@  discard block
 block discarded – undo
1877 1877
             $enreg_user = Database::escape_string($enreg_user);
1878 1878
             $nbr_users++;
1879 1879
             $sql = "INSERT IGNORE INTO $tbl_session_rel_user (relation_type, session_id, user_id, registered_at)
1880
-                    VALUES (0, $id_session, $enreg_user, '" . api_get_utc_datetime() . "')";
1880
+                    VALUES (0, $id_session, $enreg_user, '".api_get_utc_datetime()."')";
1881 1881
             Database::query($sql);
1882 1882
         }
1883 1883
 
@@ -1969,7 +1969,7 @@  discard block
 block discarded – undo
1969 1969
         $statusCondition = null;
1970 1970
         if (isset($status) && !is_null($status)) {
1971 1971
             $status = intval($status);
1972
-            $statusCondition  = " AND status = $status";
1972
+            $statusCondition = " AND status = $status";
1973 1973
         }
1974 1974
 
1975 1975
         foreach ($userList as $userId) {
@@ -2101,7 +2101,7 @@  discard block
 block discarded – undo
2101 2101
             if (empty($count)) {
2102 2102
                 // If user is not registered to a session then add it.
2103 2103
                 $sql = "INSERT IGNORE INTO $tbl_session_rel_user (session_id, user_id, registered_at)
2104
-                        VALUES ($session_id, $enreg_user, '" . api_get_utc_datetime() . "')";
2104
+                        VALUES ($session_id, $enreg_user, '".api_get_utc_datetime()."')";
2105 2105
                 Database::query($sql);
2106 2106
 
2107 2107
                 $sql = "UPDATE $tbl_session SET nbr_users = nbr_users + 1
@@ -2144,7 +2144,7 @@  discard block
 block discarded – undo
2144 2144
                 WHERE
2145 2145
                     session_id = $session_id AND
2146 2146
                     user_id = $user_id AND
2147
-                    relation_type <> " . SESSION_RELATION_TYPE_RRHH . "";
2147
+                    relation_type <> ".SESSION_RELATION_TYPE_RRHH."";
2148 2148
         $result = Database::query($sql);
2149 2149
         $return = Database::affected_rows($result);
2150 2150
 
@@ -2229,7 +2229,7 @@  discard block
 block discarded – undo
2229 2229
                 FROM $tbl_session_rel_user
2230 2230
                 WHERE
2231 2231
                     session_id = $sessionId AND
2232
-                    relation_type<>" . SESSION_RELATION_TYPE_RRHH;
2232
+                    relation_type<>".SESSION_RELATION_TYPE_RRHH;
2233 2233
         $result = Database::query($sql);
2234 2234
         $user_list = Database::store_result($result);
2235 2235
 
@@ -2240,7 +2240,7 @@  discard block
 block discarded – undo
2240 2240
 
2241 2241
                     $sql = "DELETE FROM $tbl_session_rel_course
2242 2242
                             WHERE
2243
-                                c_id = " . $existingCourse['c_id'] . " AND
2243
+                                c_id = ".$existingCourse['c_id']." AND
2244 2244
                                 session_id = $sessionId";
2245 2245
                     Database::query($sql);
2246 2246
 
@@ -2303,7 +2303,7 @@  discard block
 block discarded – undo
2303 2303
                             $links = $cat->get_links(null, false, $courseInfo['code'], 0);
2304 2304
 
2305 2305
                             $cat->set_session_id($sessionId);
2306
-                            $oldCategoryId= $cat->get_id();
2306
+                            $oldCategoryId = $cat->get_id();
2307 2307
                             $newId = $cat->add();
2308 2308
                             $newCategoryIdList[$oldCategoryId] = $newId;
2309 2309
                             $parentId = $cat->get_parent_id();
@@ -2490,7 +2490,7 @@  discard block
 block discarded – undo
2490 2490
         $return_value = false;
2491 2491
         $sql = "SELECT c_id FROM $tbl_session_course
2492 2492
                 WHERE
2493
-                  session_id = " . intval($session_id) . " AND
2493
+                  session_id = ".intval($session_id)." AND
2494 2494
                   c_id = " . intval($courseId);
2495 2495
         $result = Database::query($sql);
2496 2496
         $num = Database::num_rows($result);
@@ -2514,8 +2514,8 @@  discard block
 block discarded – undo
2514 2514
         }
2515 2515
 
2516 2516
         $sql = 'SELECT *
2517
-		        FROM ' . $tbl_session . '
2518
-		        WHERE name = "' . Database::escape_string($session_name) . '"';
2517
+		        FROM ' . $tbl_session.'
2518
+		        WHERE name = "' . Database::escape_string($session_name).'"';
2519 2519
         $result = Database::query($sql);
2520 2520
         $num = Database::num_rows($result);
2521 2521
         if ($num > 0) {
@@ -2555,8 +2555,8 @@  discard block
 block discarded – undo
2555 2555
         $month_end = intval($smonth_end);
2556 2556
         $day_end = intval($sday_end);
2557 2557
 
2558
-        $date_start = "$year_start-" . (($month_start < 10) ? "0$month_start" : $month_start) . "-" . (($day_start < 10) ? "0$day_start" : $day_start);
2559
-        $date_end = "$year_end-" . (($month_end < 10) ? "0$month_end" : $month_end) . "-" . (($day_end < 10) ? "0$day_end" : $day_end);
2558
+        $date_start = "$year_start-".(($month_start < 10) ? "0$month_start" : $month_start)."-".(($day_start < 10) ? "0$day_start" : $day_start);
2559
+        $date_end = "$year_end-".(($month_end < 10) ? "0$month_end" : $month_end)."-".(($day_end < 10) ? "0$day_end" : $day_end);
2560 2560
 
2561 2561
         if (empty($name)) {
2562 2562
             $msg = get_lang('SessionCategoryNameIsRequired');
@@ -2633,8 +2633,8 @@  discard block
 block discarded – undo
2633 2633
         $month_end = intval($smonth_end);
2634 2634
         $day_end = intval($sday_end);
2635 2635
         $id = intval($id);
2636
-        $date_start = "$year_start-" . (($month_start < 10) ? "0$month_start" : $month_start) . "-" . (($day_start < 10) ? "0$day_start" : $day_start);
2637
-        $date_end = "$year_end-" . (($month_end < 10) ? "0$month_end" : $month_end) . "-" . (($day_end < 10) ? "0$day_end" : $day_end);
2636
+        $date_start = "$year_start-".(($month_start < 10) ? "0$month_start" : $month_start)."-".(($day_start < 10) ? "0$day_start" : $day_start);
2637
+        $date_end = "$year_end-".(($month_end < 10) ? "0$month_end" : $month_end)."-".(($day_end < 10) ? "0$day_end" : $day_end);
2638 2638
 
2639 2639
         if (empty($name)) {
2640 2640
             $msg = get_lang('SessionCategoryNameIsRequired');
@@ -2654,13 +2654,13 @@  discard block
 block discarded – undo
2654 2654
         if ($date_end <> null) {
2655 2655
             $sql = "UPDATE $tbl_session_category
2656 2656
                     SET
2657
-                        name = '" . Database::escape_string($name) . "',
2657
+                        name = '".Database::escape_string($name)."',
2658 2658
                         date_start = '$date_start' ,
2659 2659
                         date_end = '$date_end'
2660 2660
                     WHERE id= $id";
2661 2661
         } else {
2662 2662
             $sql = "UPDATE $tbl_session_category SET
2663
-                        name = '" . Database::escape_string($name) . "',
2663
+                        name = '".Database::escape_string($name)."',
2664 2664
                         date_start = '$date_start',
2665 2665
                         date_end = NULL
2666 2666
                     WHERE id= $id";
@@ -2690,10 +2690,10 @@  discard block
 block discarded – undo
2690 2690
 
2691 2691
         //Setting session_category_id to 0
2692 2692
         $sql = "UPDATE $tbl_session SET session_category_id = 0
2693
-                WHERE session_category_id IN (" . $id_checked . ")";
2693
+                WHERE session_category_id IN (".$id_checked.")";
2694 2694
         Database::query($sql);
2695 2695
 
2696
-        $sql = "SELECT id FROM $tbl_session WHERE session_category_id IN (" . $id_checked . ")";
2696
+        $sql = "SELECT id FROM $tbl_session WHERE session_category_id IN (".$id_checked.")";
2697 2697
         $result = Database::query($sql);
2698 2698
         while ($rows = Database::fetch_array($result)) {
2699 2699
             $session_id = $rows['id'];
@@ -2705,7 +2705,7 @@  discard block
 block discarded – undo
2705 2705
                 }
2706 2706
             }
2707 2707
         }
2708
-        $sql = "DELETE FROM $tbl_session_category WHERE id IN (" . $id_checked . ")";
2708
+        $sql = "DELETE FROM $tbl_session_category WHERE id IN (".$id_checked.")";
2709 2709
         Database::query($sql);
2710 2710
 
2711 2711
         // Add event to system log
@@ -2778,7 +2778,7 @@  discard block
 block discarded – undo
2778 2778
                 $value = Database::escape_string($options['value']);
2779 2779
                 $sql_query .= ' AND ';
2780 2780
                 if (in_array($field, $availableFields) && in_array($operator, $availableOperator)) {
2781
-                    $sql_query .= $field . " $operator '" . $value . "'";
2781
+                    $sql_query .= $field." $operator '".$value."'";
2782 2782
                 }
2783 2783
             }
2784 2784
         }
@@ -2845,8 +2845,8 @@  discard block
 block discarded – undo
2845 2845
     {
2846 2846
         $tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
2847 2847
         $id = api_get_current_access_url_id();
2848
-        $sql = 'SELECT * FROM ' . $tbl_session_category . '
2849
-                WHERE access_url_id = ' . $id . '
2848
+        $sql = 'SELECT * FROM '.$tbl_session_category.'
2849
+                WHERE access_url_id = ' . $id.'
2850 2850
                 ORDER BY name ASC';
2851 2851
         $result = Database::query($sql);
2852 2852
         if (Database::num_rows($result) > 0) {
@@ -2999,7 +2999,7 @@  discard block
 block discarded – undo
2999 2999
         $sql = "DELETE FROM $tbl_session_rel_user
3000 3000
                 WHERE
3001 3001
                     session_id = $sessionId AND                            
3002
-                    relation_type =" . SESSION_RELATION_TYPE_RRHH;
3002
+                    relation_type =".SESSION_RELATION_TYPE_RRHH;
3003 3003
         Database::query($sql);
3004 3004
 
3005 3005
         return true;
@@ -3053,12 +3053,12 @@  discard block
 block discarded – undo
3053 3053
                         ON (a.session_id = s.session_id)
3054 3054
                         WHERE
3055 3055
                             s.user_id = $userId AND
3056
-                            relation_type = " . SESSION_RELATION_TYPE_RRHH . " AND
3056
+                            relation_type = ".SESSION_RELATION_TYPE_RRHH." AND
3057 3057
                             access_url_id = " . api_get_current_access_url_id();
3058 3058
             } else {
3059 3059
                 $sql = "SELECT s.session_id 
3060 3060
                         FROM $tbl_session_rel_user s
3061
-                        WHERE user_id = $userId AND relation_type=" . SESSION_RELATION_TYPE_RRHH;
3061
+                        WHERE user_id = $userId AND relation_type=".SESSION_RELATION_TYPE_RRHH;
3062 3062
             }
3063 3063
             $result = Database::query($sql);
3064 3064
 
@@ -3068,7 +3068,7 @@  discard block
 block discarded – undo
3068 3068
                             WHERE
3069 3069
                                 session_id = {$row['session_id']} AND
3070 3070
                                 user_id = $userId AND
3071
-                                relation_type =" . SESSION_RELATION_TYPE_RRHH;
3071
+                                relation_type =".SESSION_RELATION_TYPE_RRHH;
3072 3072
                     Database::query($sql);
3073 3073
                 }
3074 3074
             }
@@ -3083,7 +3083,7 @@  discard block
 block discarded – undo
3083 3083
                         WHERE
3084 3084
                             session_id = $session_id AND
3085 3085
                             user_id = $userId AND
3086
-                            relation_type = '" . SESSION_RELATION_TYPE_RRHH . "'";
3086
+                            relation_type = '".SESSION_RELATION_TYPE_RRHH."'";
3087 3087
                 $result = Database::query($sql);
3088 3088
                 if (Database::num_rows($result) == 0) {
3089 3089
                     $sql = "INSERT IGNORE INTO $tbl_session_rel_user (session_id, user_id, relation_type, registered_at)
@@ -3133,8 +3133,8 @@  discard block
 block discarded – undo
3133 3133
                     WHERE
3134 3134
                         sru.user_id = '$userId' AND
3135 3135
                         sru.session_id = '$sessionId' AND
3136
-                        sru.relation_type = '" . SESSION_RELATION_TYPE_RRHH . "' AND
3137
-                        access_url_id = " . api_get_current_access_url_id() . "
3136
+                        sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."' AND
3137
+                        access_url_id = " . api_get_current_access_url_id()."
3138 3138
                         ";
3139 3139
         } else {
3140 3140
             $sql = "$select FROM $tbl_session s
@@ -3143,7 +3143,7 @@  discard block
 block discarded – undo
3143 3143
                         sru.session_id = s.id AND
3144 3144
                         sru.user_id = '$userId' AND
3145 3145
                         sru.session_id = '$sessionId' AND
3146
-                        sru.relation_type = '" . SESSION_RELATION_TYPE_RRHH . "'
3146
+                        sru.relation_type = '".SESSION_RELATION_TYPE_RRHH."'
3147 3147
                     ";
3148 3148
         }
3149 3149
 
@@ -3243,7 +3243,7 @@  discard block
 block discarded – undo
3243 3243
 
3244 3244
         $limitCondition = null;
3245 3245
         if (!empty($start) && !empty($limit)) {
3246
-            $limitCondition = " LIMIT " . intval($start) . ", " . intval($limit);
3246
+            $limitCondition = " LIMIT ".intval($start).", ".intval($limit);
3247 3247
         }
3248 3248
 
3249 3249
         if (empty($orderCondition)) {
@@ -3320,26 +3320,26 @@  discard block
 block discarded – undo
3320 3320
 
3321 3321
         $sessions = array();
3322 3322
         if (Database::num_rows($result) > 0) {
3323
-            $sysUploadPath = api_get_path(SYS_UPLOAD_PATH). 'sessions/';
3324
-            $webUploadPath = api_get_path(WEB_UPLOAD_PATH). 'sessions/';
3323
+            $sysUploadPath = api_get_path(SYS_UPLOAD_PATH).'sessions/';
3324
+            $webUploadPath = api_get_path(WEB_UPLOAD_PATH).'sessions/';
3325 3325
             $imgPath = Display::return_icon('session_default_small.png', null, null, null, null, true);
3326 3326
 
3327 3327
             $tableExtraFields = Database::get_main_table(TABLE_EXTRA_FIELD);
3328
-            $sql = "SELECT id FROM " . $tableExtraFields . "
3328
+            $sql = "SELECT id FROM ".$tableExtraFields."
3329 3329
                     WHERE extra_field_type = 3 AND variable='image'";
3330 3330
             $resultField = Database::query($sql);
3331 3331
             $imageFieldId = Database::fetch_assoc($resultField);
3332 3332
 
3333 3333
             while ($row = Database::fetch_array($result)) {
3334 3334
 
3335
-                $row['image'] =  null;
3336
-                $sessionImage = $sysUploadPath . $imageFieldId['id'] . '_' . $row['id'] . '.png';
3335
+                $row['image'] = null;
3336
+                $sessionImage = $sysUploadPath.$imageFieldId['id'].'_'.$row['id'].'.png';
3337 3337
 
3338 3338
                 if (is_file($sessionImage)) {
3339
-                    $sessionImage = $webUploadPath . $imageFieldId['id'] . '_' . $row['id'] . '.png';
3339
+                    $sessionImage = $webUploadPath.$imageFieldId['id'].'_'.$row['id'].'.png';
3340 3340
                     $row['image'] = $sessionImage;
3341 3341
                 } else {
3342
-                    $row['image'] =  $imgPath;
3342
+                    $row['image'] = $imgPath;
3343 3343
                 }
3344 3344
 
3345 3345
                 if ($row['display_start_date'] == '0000-00-00 00:00:00' || $row['display_start_date'] == '0000-00-00') {
@@ -3439,7 +3439,7 @@  discard block
 block discarded – undo
3439 3439
                 return intval($count['count']);
3440 3440
             }
3441 3441
 
3442
-            while ($row = Database::fetch_array($result,'ASSOC'))	{
3442
+            while ($row = Database::fetch_array($result, 'ASSOC')) {
3443 3443
                 $courses[$row['real_id']] = $row;
3444 3444
             }
3445 3445
         }
@@ -3483,7 +3483,7 @@  discard block
 block discarded – undo
3483 3483
         }
3484 3484
 
3485 3485
         $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
3486
-        $tbl_session_rel_course	= Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
3486
+        $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
3487 3487
 
3488 3488
         if ($getCount) {
3489 3489
             $select = "SELECT COUNT(DISTINCT(c.code)) as count ";
@@ -3508,7 +3508,7 @@  discard block
 block discarded – undo
3508 3508
 		        ";
3509 3509
         if ($getCount) {
3510 3510
             $result = Database::query($sql);
3511
-            $row = Database::fetch_array($result,'ASSOC');
3511
+            $row = Database::fetch_array($result, 'ASSOC');
3512 3512
             return $row['count'];
3513 3513
         }
3514 3514
 
@@ -3523,7 +3523,7 @@  discard block
 block discarded – undo
3523 3523
         $courses = array();
3524 3524
 
3525 3525
         if ($num_rows > 0) {
3526
-            while ($row = Database::fetch_array($result,'ASSOC'))	{
3526
+            while ($row = Database::fetch_array($result, 'ASSOC')) {
3527 3527
                 $courses[$row['id']] = $row;
3528 3528
             }
3529 3529
         }
@@ -3601,7 +3601,7 @@  discard block
 block discarded – undo
3601 3601
         $result = Database::query($sql);
3602 3602
         $num_rows = Database::num_rows($result);
3603 3603
         if ($num_rows > 0) {
3604
-            $row = Database::fetch_array($result,'ASSOC');
3604
+            $row = Database::fetch_array($result, 'ASSOC');
3605 3605
             return $row['count'];
3606 3606
         }
3607 3607
 
@@ -3720,9 +3720,9 @@  discard block
 block discarded – undo
3720 3720
 
3721 3721
             if ($access_url_id != -1) {
3722 3722
                 $sql = 'SELECT DISTINCT session.*
3723
-                    FROM ' . $session_table . ' session INNER JOIN ' . $tbl_session_rel_access_url . ' session_rel_url
3723
+                    FROM ' . $session_table.' session INNER JOIN '.$tbl_session_rel_access_url.' session_rel_url
3724 3724
                     ON (session.id = session_rel_url.session_id)
3725
-                    WHERE '.$sqlCoach.' access_url_id = ' . $access_url_id;
3725
+                    WHERE '.$sqlCoach.' access_url_id = '.$access_url_id;
3726 3726
             }
3727 3727
         }
3728 3728
         $sql .= ' ORDER by name';
@@ -3756,8 +3756,8 @@  discard block
 block discarded – undo
3756 3756
                 FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user
3757 3757
                 WHERE
3758 3758
                     session_rcru.user_id = user.user_id AND
3759
-                    session_rcru.session_id = '" . intval($session_id) . "' AND
3760
-                    session_rcru.c_id ='" . intval($courseId) . "' AND
3759
+                    session_rcru.session_id = '".intval($session_id)."' AND
3760
+                    session_rcru.c_id ='" . intval($courseId)."' AND
3761 3761
                     user.user_id = " . intval($user_id);
3762 3762
 
3763 3763
         $result = Database::query($sql);
@@ -3788,8 +3788,8 @@  discard block
 block discarded – undo
3788 3788
         $sql = "SELECT session_rcru.status
3789 3789
                 FROM $tbl_session_rel_course_rel_user session_rcru, $tbl_user user
3790 3790
                 WHERE session_rcru.user_id = user.user_id AND
3791
-                    session_rcru.session_id = '" . intval($session_id) . "' AND
3792
-                    session_rcru.c_id ='" . intval($courseId) . "' AND
3791
+                    session_rcru.session_id = '".intval($session_id)."' AND
3792
+                    session_rcru.c_id ='" . intval($courseId)."' AND
3793 3793
                     user.user_id = " . intval($user_id);
3794 3794
         $result = Database::query($sql);
3795 3795
         $status = false;
@@ -3866,7 +3866,7 @@  discard block
 block discarded – undo
3866 3866
         // Get timestamp for now in UTC - see http://php.net/manual/es/function.time.php#117251
3867 3867
         $now = time() - date('Z');
3868 3868
         // Timestamp in one month
3869
-        $inOneMonth = $now + (30*24*3600);
3869
+        $inOneMonth = $now + (30 * 24 * 3600);
3870 3870
         $inOneMonth = api_get_local_time($inOneMonth);
3871 3871
         if (api_strtotime($s['access_start_date']) < $now) {
3872 3872
             $s['access_start_date'] = api_get_local_time($now);
@@ -3888,16 +3888,16 @@  discard block
 block discarded – undo
3888 3888
         }
3889 3889
         // Now try to create the session
3890 3890
         $sid = self::create_session(
3891
-            $s['name'] . ' ' . get_lang('CopyLabelSuffix'),
3891
+            $s['name'].' '.get_lang('CopyLabelSuffix'),
3892 3892
             $s['access_start_date'],
3893 3893
             $s['access_end_date'],
3894 3894
             $s['display_start_date'],
3895 3895
             $s['display_end_date'],
3896 3896
             $s['coach_access_start_date'],
3897 3897
             $s['coach_access_end_date'],
3898
-            (int)$s['id_coach'],
3898
+            (int) $s['id_coach'],
3899 3899
             $s['session_category_id'],
3900
-            (int)$s['visibility'],
3900
+            (int) $s['visibility'],
3901 3901
             true
3902 3902
         );
3903 3903
 
@@ -4016,7 +4016,7 @@  discard block
 block discarded – undo
4016 4016
         $session_table = Database::get_main_table(TABLE_MAIN_SESSION);
4017 4017
         $sql = "SELECT DISTINCT id
4018 4018
 	         	FROM $session_table
4019
-	         	WHERE session.id_coach =  '" . $user_id . "' AND id = '$session_id'";
4019
+	         	WHERE session.id_coach =  '".$user_id."' AND id = '$session_id'";
4020 4020
         $result = Database::query($sql);
4021 4021
         if ($result && Database::num_rows($result)) {
4022 4022
             return true;
@@ -4035,7 +4035,7 @@  discard block
 block discarded – undo
4035 4035
         $access_url_rel_session_table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
4036 4036
         $sql = "SELECT count(id) FROM $session_table s";
4037 4037
         if (!empty($access_url_id) && $access_url_id == intval($access_url_id)) {
4038
-            $sql .= ", $access_url_rel_session_table u " .
4038
+            $sql .= ", $access_url_rel_session_table u ".
4039 4039
                 " WHERE s.id = u.session_id AND u.access_url_id = $access_url_id";
4040 4040
         }
4041 4041
         $res = Database::query($sql);
@@ -4274,7 +4274,7 @@  discard block
 block discarded – undo
4274 4274
 
4275 4275
         $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
4276 4276
         $tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
4277
-        $tbl_session_course  = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
4277
+        $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
4278 4278
         $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
4279 4279
 
4280 4280
         $sessions = array();
@@ -4410,10 +4410,10 @@  discard block
 block discarded – undo
4410 4410
                     $suffix = null;
4411 4411
                     while (!$unique_name) {
4412 4412
                         if ($i > 1) {
4413
-                            $suffix = ' - ' . $i;
4413
+                            $suffix = ' - '.$i;
4414 4414
                         }
4415
-                        $sql = 'SELECT 1 FROM ' . $tbl_session . '
4416
-                                WHERE name="' . Database::escape_string($session_name). $suffix . '"';
4415
+                        $sql = 'SELECT 1 FROM '.$tbl_session.'
4416
+                                WHERE name="' . Database::escape_string($session_name).$suffix.'"';
4417 4417
                         $rs = Database::query($sql);
4418 4418
 
4419 4419
                         if (Database::result($rs, 0, 0)) {
@@ -4426,14 +4426,14 @@  discard block
 block discarded – undo
4426 4426
 
4427 4427
                     // Creating the session.
4428 4428
                     $sql = "INSERT IGNORE INTO $tbl_session SET
4429
-                            name = '" . Database::escape_string($session_name). "',
4429
+                            name = '".Database::escape_string($session_name)."',
4430 4430
                             id_coach = '$coach_id',
4431 4431
                             access_start_date = '$dateStart',
4432 4432
                             access_end_date = '$dateEnd',
4433 4433
                             display_start_date = '$dateStart',
4434 4434
                             display_end_date = '$dateEnd',
4435 4435
                             visibility = '$visibilityAfterExpirationPerSession',                            
4436
-                            session_admin_id = " . $defaultUserId . " 
4436
+                            session_admin_id = ".$defaultUserId." 
4437 4437
                             $sessionCondition $extraParameters $extraSessionParameters";
4438 4438
                     Database::query($sql);
4439 4439
 
@@ -4499,7 +4499,7 @@  discard block
 block discarded – undo
4499 4499
 
4500 4500
                             // Delete session-user relation only for students
4501 4501
                             $sql = "DELETE FROM $tbl_session_user
4502
-                                    WHERE session_id = '$session_id' AND relation_type <> " . SESSION_RELATION_TYPE_RRHH;
4502
+                                    WHERE session_id = '$session_id' AND relation_type <> ".SESSION_RELATION_TYPE_RRHH;
4503 4503
                             Database::query($sql);
4504 4504
 
4505 4505
                             $sql = "DELETE FROM $tbl_session_course WHERE session_id = '$session_id'";
@@ -4590,7 +4590,7 @@  discard block
 block discarded – undo
4590 4590
 
4591 4591
                             // Delete session-user relation only for students
4592 4592
                             $sql = "DELETE FROM $tbl_session_user
4593
-                                    WHERE session_id = '$session_id' AND relation_type <> " . SESSION_RELATION_TYPE_RRHH;
4593
+                                    WHERE session_id = '$session_id' AND relation_type <> ".SESSION_RELATION_TYPE_RRHH;
4594 4594
                             Database::query($sql);
4595 4595
 
4596 4596
                             $sql = "DELETE FROM $tbl_session_course WHERE session_id = '$session_id'";
@@ -4633,7 +4633,7 @@  discard block
 block discarded – undo
4633 4633
                             $sql = "INSERT IGNORE INTO $tbl_session_user SET
4634 4634
                                     user_id = '$user_id',
4635 4635
                                     session_id = '$session_id',
4636
-                                    registered_at = '" . api_get_utc_datetime() . "'";
4636
+                                    registered_at = '".api_get_utc_datetime()."'";
4637 4637
                             Database::query($sql);
4638 4638
                             if ($debug) {
4639 4639
                                 $logger->addInfo("Sessions - Adding User #$user_id ($user) to session #$session_id");
@@ -5201,7 +5201,7 @@  discard block
 block discarded – undo
5201 5201
             foreach ($sessions as $session) {
5202 5202
                 $courseList = SessionManager::get_course_list_by_session_id($session['id']);
5203 5203
                 foreach ($courseList as $course) {
5204
-                    $coursesFromSession[$course['code'].':'.$session['id']] = $course['visual_code'] . ' - ' . $course['title'] . ' (' . $session['name'] . ')';
5204
+                    $coursesFromSession[$course['code'].':'.$session['id']] = $course['visual_code'].' - '.$course['title'].' ('.$session['name'].')';
5205 5205
                 }
5206 5206
             }
5207 5207
         }
@@ -5348,7 +5348,7 @@  discard block
 block discarded – undo
5348 5348
 
5349 5349
         if (!empty($lastConnectionDate)) {
5350 5350
             $lastConnectionDate = Database::escape_string($lastConnectionDate);
5351
-            $userConditions .=  " AND u.last_login <= '$lastConnectionDate' ";
5351
+            $userConditions .= " AND u.last_login <= '$lastConnectionDate' ";
5352 5352
         }
5353 5353
 
5354 5354
         if (!empty($keyword)) {
@@ -5418,7 +5418,7 @@  discard block
 block discarded – undo
5418 5418
         $result = Database::query($sql);
5419 5419
         $result = Database::store_result($result);
5420 5420
 
5421
-        return $result ;
5421
+        return $result;
5422 5422
     }
5423 5423
 
5424 5424
     /**
@@ -5478,7 +5478,7 @@  discard block
 block discarded – undo
5478 5478
                     $userToString = null;
5479 5479
                     foreach ($userList as $userInfo) {
5480 5480
                         $newUserList[] = $userInfo['user_id'];
5481
-                        $userToString .= $userInfo['firstname'] . ' ' . $userInfo['lastname'] . '<br />';
5481
+                        $userToString .= $userInfo['firstname'].' '.$userInfo['lastname'].'<br />';
5482 5482
                     }
5483 5483
 
5484 5484
                     if (!empty($sessionsDestination)) {
@@ -5491,7 +5491,7 @@  discard block
 block discarded – undo
5491 5491
                                 $messages[] = Display::return_message(sprintf(get_lang('SessionXSkipped'), $sessionDestinationId), 'warning', false);
5492 5492
                                 continue;
5493 5493
                             }
5494
-                            $messages[] = Display::return_message(get_lang('StudentList') . '<br />' . $userToString, 'info', false);
5494
+                            $messages[] = Display::return_message(get_lang('StudentList').'<br />'.$userToString, 'info', false);
5495 5495
                             SessionManager::subscribe_users_to_session(
5496 5496
                                 $sessionDestinationId,
5497 5497
                                 $newUserList,
@@ -5546,7 +5546,7 @@  discard block
 block discarded – undo
5546 5546
                 }
5547 5547
             }
5548 5548
         }
5549
-        $sessionUrl = api_get_path(WEB_CODE_PATH) . 'admin/resume_session.php?id_session=';
5549
+        $sessionUrl = api_get_path(WEB_CODE_PATH).'admin/resume_session.php?id_session=';
5550 5550
 
5551 5551
         $htmlResult = null;
5552 5552
 
@@ -5561,7 +5561,7 @@  discard block
 block discarded – undo
5561 5561
                     $sessionInfo = self::fetch($sessionId);
5562 5562
                     $htmlResult .= '<br />';
5563 5563
                     $htmlResult .= Display::url(
5564
-                        get_lang('Session') . ': ' . $sessionInfo['name'] . ' <br />', $sessionUrl . $sessionId, array('target' => '_blank')
5564
+                        get_lang('Session').': '.$sessionInfo['name'].' <br />', $sessionUrl.$sessionId, array('target' => '_blank')
5565 5565
                     );
5566 5566
                     $teacherList = array();
5567 5567
                     foreach ($coachList as $coachId) {
@@ -5674,7 +5674,7 @@  discard block
 block discarded – undo
5674 5674
                 }
5675 5675
 
5676 5676
                 $sessionIdList = array_map('intval', $sessionIdList);
5677
-                $sessionToString = implode("', '",  $sessionIdList);
5677
+                $sessionToString = implode("', '", $sessionIdList);
5678 5678
 
5679 5679
                 $course = Database::get_main_table(TABLE_MAIN_COURSE);
5680 5680
                 $sessionCourse = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
@@ -5686,7 +5686,7 @@  discard block
 block discarded – undo
5686 5686
                         INNER JOIN $courseUser cu ON (cu.c_id = c.id)
5687 5687
 		                WHERE src.session_id IN ('$sessionToString') AND cu.status = 1";
5688 5688
                 $result = Database::query($sql);
5689
-                while($row = Database::fetch_array($result, 'ASSOC')) {
5689
+                while ($row = Database::fetch_array($result, 'ASSOC')) {
5690 5690
                     $teacherListId[$row['user_id']] = $row['user_id'];
5691 5691
                 }
5692 5692
             } else {
@@ -5761,7 +5761,7 @@  discard block
 block discarded – undo
5761 5761
         $toolList = self::getCourseToolToBeManaged();
5762 5762
 
5763 5763
         foreach ($toolList as $tool) {
5764
-            $method = 'add' . $tool;
5764
+            $method = 'add'.$tool;
5765 5765
             if (method_exists(get_class(), $method)) {
5766 5766
                 self::$method($sessionId, $courseId);
5767 5767
             }
@@ -5780,7 +5780,7 @@  discard block
 block discarded – undo
5780 5780
         $toolList = self::getCourseToolToBeManaged();
5781 5781
 
5782 5782
         foreach ($toolList as $tool) {
5783
-            $method = 'remove' . $tool;
5783
+            $method = 'remove'.$tool;
5784 5784
             if (method_exists(get_class(), $method)) {
5785 5785
                 self::$method($sessionId, $courseId);
5786 5786
             }
@@ -5898,18 +5898,18 @@  discard block
 block discarded – undo
5898 5898
                         }
5899 5899
                     }
5900 5900
 
5901
-                    $message .= '<strong>' . get_lang('User') . '</strong> ' . $userInfo['complete_name'] . ' <br />';
5901
+                    $message .= '<strong>'.get_lang('User').'</strong> '.$userInfo['complete_name'].' <br />';
5902 5902
 
5903 5903
                     if (!in_array($userInfo['status'], array(DRH)) && !api_is_platform_admin_by_id($userInfo['user_id'])) {
5904
-                        $message .= get_lang('UserMustHaveTheDrhRole') . '<br />';
5904
+                        $message .= get_lang('UserMustHaveTheDrhRole').'<br />';
5905 5905
                         continue;
5906 5906
                     }
5907 5907
 
5908 5908
                     if (!empty($sessionList)) {
5909
-                        $message .= '<strong>' . get_lang('Sessions') . ':</strong> <br />';
5910
-                        $message .= implode(', ', $sessionList) . '<br /><br />';
5909
+                        $message .= '<strong>'.get_lang('Sessions').':</strong> <br />';
5910
+                        $message .= implode(', ', $sessionList).'<br /><br />';
5911 5911
                     } else {
5912
-                        $message .= get_lang('NoSessionProvided') . ' <br /><br />';
5912
+                        $message .= get_lang('NoSessionProvided').' <br /><br />';
5913 5913
                     }
5914 5914
                 }
5915 5915
             }
@@ -6089,8 +6089,8 @@  discard block
 block discarded – undo
6089 6089
 
6090 6090
         $firstAccess = api_strtotime($courseAccess['login_course_date'], 'UTC');
6091 6091
 
6092
-        $endDateInSeconds = $firstAccess + $duration*24*60*60;
6093
-        $leftDays = round(($endDateInSeconds- $currentTime) / 60 / 60 / 24);
6092
+        $endDateInSeconds = $firstAccess + $duration * 24 * 60 * 60;
6093
+        $leftDays = round(($endDateInSeconds - $currentTime) / 60 / 60 / 24);
6094 6094
 
6095 6095
         return $leftDays;
6096 6096
     }
@@ -6382,7 +6382,7 @@  discard block
 block discarded – undo
6382 6382
                 FROM $table scu
6383 6383
                 INNER JOIN $tableUser u 
6384 6384
                 ON scu.user_id = u.id
6385
-                WHERE scu.session_id = " . intval($sessionId) ."
6385
+                WHERE scu.session_id = ".intval($sessionId)."
6386 6386
                 GROUP BY u.id";
6387 6387
 
6388 6388
         $result = Database::query($sql);
@@ -6420,7 +6420,7 @@  discard block
 block discarded – undo
6420 6420
             $sfTable = Database::get_main_table(TABLE_EXTRA_FIELD);
6421 6421
             $sfvTable = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
6422 6422
             // Join session field and session field values tables
6423
-            $joinTable = $sfTable . ' sf INNER JOIN ' . $sfvTable . ' sfv ON sf.id = sfv.field_id';
6423
+            $joinTable = $sfTable.' sf INNER JOIN '.$sfvTable.' sfv ON sf.id = sfv.field_id';
6424 6424
             $fieldsArray = array();
6425 6425
             foreach ($extraFields as $field) {
6426 6426
                 $fieldsArray[] = Database::escape_string($field);
@@ -6463,14 +6463,14 @@  discard block
 block discarded – undo
6463 6463
                 for ($i = 1; $i < count($fieldsArray); $i++) {
6464 6464
                     $whereParams .= ', ?';
6465 6465
                 }
6466
-                $whereFieldVariables = ' variable IN ( ' . $whereParams .' )';
6467
-                $whereFieldIds = 'field_id IN ( ' . $whereParams .  ' )';
6466
+                $whereFieldVariables = ' variable IN ( '.$whereParams.' )';
6467
+                $whereFieldIds = 'field_id IN ( '.$whereParams.' )';
6468 6468
             }
6469 6469
             // Get session fields
6470 6470
             $extraField = new ExtraFieldModel('session');
6471 6471
             $questionMarks = substr(str_repeat('?, ', count($fieldsArray)), 0, -2);
6472 6472
             $fieldsList = $extraField->get_all(array(
6473
-                ' variable IN ( ' . $questionMarks . ' )' => $fieldsArray,
6473
+                ' variable IN ( '.$questionMarks.' )' => $fieldsArray,
6474 6474
             ));
6475 6475
             // Index session fields
6476 6476
             foreach ($fieldsList as $field) {
@@ -6479,7 +6479,7 @@  discard block
 block discarded – undo
6479 6479
             // Get session field values
6480 6480
             $extra = new ExtraFieldValue('session');
6481 6481
             $questionMarksFields = substr(str_repeat('?, ', count($fields)), 0, -2);
6482
-            $sessionFieldValueList = $extra->get_all(array ('where' => array('field_id IN ( ' . $questionMarksFields . ' )' => array_keys($fields))));
6482
+            $sessionFieldValueList = $extra->get_all(array('where' => array('field_id IN ( '.$questionMarksFields.' )' => array_keys($fields))));
6483 6483
             // Add session fields values to session list
6484 6484
             foreach ($sessionList as $id => &$session) {
6485 6485
                 foreach ($sessionFieldValueList as $sessionFieldValue) {
@@ -6532,7 +6532,7 @@  discard block
 block discarded – undo
6532 6532
             // Check the result
6533 6533
             if ($result < 1) {
6534 6534
                 // If not found any result, update error message
6535
-                $errorResult['errorMessage'] = 'Not found any session category name ' . $categoryName;
6535
+                $errorResult['errorMessage'] = 'Not found any session category name '.$categoryName;
6536 6536
             } elseif (count($result) > 1 && !$force) {
6537 6537
                 // If found more than one result and force is disabled, update error message
6538 6538
                 $errorResult['errorMessage'] = 'Found many session categories';
@@ -6591,7 +6591,7 @@  discard block
 block discarded – undo
6591 6591
             // Check if session list query had result
6592 6592
             if (!empty($sessionList)) {
6593 6593
                 // implode all session id
6594
-                $sessionIdsString = '(' . implode(', ', array_keys($sessionList)) . ')';
6594
+                $sessionIdsString = '('.implode(', ', array_keys($sessionList)).')';
6595 6595
                 // Get all field variables
6596 6596
                 $sessionFieldList = Database::select(
6597 6597
                     'id, variable',
@@ -6678,7 +6678,7 @@  discard block
 block discarded – undo
6678 6678
                 return $sessionList;
6679 6679
             } else {
6680 6680
                 // Not found result, update error message
6681
-                $errorResult['errorMessage'] = 'Not found any session for session category id ' . $sessionCategoryId;
6681
+                $errorResult['errorMessage'] = 'Not found any session for session category id '.$sessionCategoryId;
6682 6682
             }
6683 6683
         }
6684 6684
 
@@ -6782,7 +6782,7 @@  discard block
 block discarded – undo
6782 6782
 
6783 6783
         $sessionExtraField = new ExtraFieldModel('session');
6784 6784
         $fieldList = $sessionExtraField->get_all(array(
6785
-            "variable IN ( " . implode(", ", $variablePlaceHolders) . " ) " => $variables,
6785
+            "variable IN ( ".implode(", ", $variablePlaceHolders)." ) " => $variables,
6786 6786
         ));
6787 6787
 
6788 6788
         $fields = array();
@@ -6796,7 +6796,7 @@  discard block
 block discarded – undo
6796 6796
         $extra = new ExtraFieldValue('session');
6797 6797
         $sessionFieldValueList = $extra->get_all(
6798 6798
             array(
6799
-                "field_id IN ( " . implode(", ", $variablePlaceHolders) . " )" => array_keys($fields),
6799
+                "field_id IN ( ".implode(", ", $variablePlaceHolders)." )" => array_keys($fields),
6800 6800
             )
6801 6801
         );
6802 6802
 
@@ -6868,7 +6868,7 @@  discard block
 block discarded – undo
6868 6868
                 INNER JOIN $sessionUserTable sru 
6869 6869
                 ON s.id = sru.id_session
6870 6870
                 WHERE
6871
-                    (sru.id_user IN (" . implode(', ', $userIdList) . ")
6871
+                    (sru.id_user IN (".implode(', ', $userIdList).")
6872 6872
                     AND sru.relation_type = 0
6873 6873
                 )";
6874 6874
 
@@ -6884,7 +6884,7 @@  discard block
 block discarded – undo
6884 6884
                         WHERE
6885 6885
                             srau.access_url_id = $accessUrlId
6886 6886
                             AND (
6887
-                                sru.id_user IN (" . implode(', ', $userIdList) . ")
6887
+                                sru.id_user IN (".implode(', ', $userIdList).")
6888 6888
                                 AND sru.relation_type = 0
6889 6889
                             )";
6890 6890
             }
@@ -7106,7 +7106,7 @@  discard block
 block discarded – undo
7106 7106
                     get_lang('CoachName'),
7107 7107
                     $coachInfo ? [$coachInfo['id'] => $coachInfo['complete_name_with_username']] : [],
7108 7108
                     [
7109
-                        'url' => api_get_path(WEB_AJAX_PATH) . 'session.ajax.php?a=search_general_coach',
7109
+                        'url' => api_get_path(WEB_AJAX_PATH).'session.ajax.php?a=search_general_coach',
7110 7110
                         'width' => '100%',
7111 7111
                     ]
7112 7112
                 );
@@ -7117,7 +7117,7 @@  discard block
 block discarded – undo
7117 7117
         $form->addHtml('<div id="ajax_list_coachs"></div>');
7118 7118
 
7119 7119
         $form->addButtonAdvancedSettings('advanced_params');
7120
-        $form->addElement('html','<div id="advanced_params_options" style="display:none">');
7120
+        $form->addElement('html', '<div id="advanced_params_options" style="display:none">');
7121 7121
 
7122 7122
         $form->addSelect(
7123 7123
             'session_category',
@@ -7296,16 +7296,16 @@  discard block
 block discarded – undo
7296 7296
         if (api_is_session_admin() &&
7297 7297
             api_get_setting('allow_session_admins_to_see_all_sessions') == 'false'
7298 7298
         ) {
7299
-            $where.=" WHERE s.session_admin_id = $user_id ";
7299
+            $where .= " WHERE s.session_admin_id = $user_id ";
7300 7300
         }
7301 7301
 
7302 7302
         if (!empty($options['where'])) {
7303 7303
             $options['where'] = str_replace('course_title', 'c.title', $options['where']);
7304
-            $options['where'] = str_replace("( session_active = '0' )", '1=1',  $options['where']);
7304
+            $options['where'] = str_replace("( session_active = '0' )", '1=1', $options['where']);
7305 7305
 
7306 7306
             $options['where'] = str_replace(
7307 7307
                 array("AND session_active = '1'  )", " AND (  session_active = '1'  )"),
7308
-                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 " )
7308
+                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 ")
7309 7309
                 , $options['where']
7310 7310
             );
7311 7311
 
@@ -7347,10 +7347,10 @@  discard block
 block discarded – undo
7347 7347
                        $where ";
7348 7348
 
7349 7349
         if (api_is_multiple_url_enabled()) {
7350
-            $table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
7350
+            $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
7351 7351
             $access_url_id = api_get_current_access_url_id();
7352 7352
             if ($access_url_id != -1) {
7353
-                $where.= " AND ar.access_url_id = $access_url_id ";
7353
+                $where .= " AND ar.access_url_id = $access_url_id ";
7354 7354
 
7355 7355
                 $query_rows = "SELECT count(*) as total_rows
7356 7356
                                FROM $tbl_session s
@@ -7395,12 +7395,12 @@  discard block
 block discarded – undo
7395 7395
                     //get_lang('CourseTitle'),
7396 7396
                     get_lang('Visibility'),
7397 7397
                 );
7398
-                $column_model = array (
7399
-                    array('name'=>'name', 'index'=>'s.name', 'width'=>'160',  'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7400
-                    array('name'=>'category_name', 'index'=>'category_name', 'width'=>'40',  'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7401
-                    array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'50',   'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)),
7402
-                    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)),
7403
-                    array('name'=>'visibility', 'index'=>'visibility',      'width'=>'40',   'align'=>'left', 'search' => 'false'),
7398
+                $column_model = array(
7399
+                    array('name'=>'name', 'index'=>'s.name', 'width'=>'160', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7400
+                    array('name'=>'category_name', 'index'=>'category_name', 'width'=>'40', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7401
+                    array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'50', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)),
7402
+                    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)),
7403
+                    array('name'=>'visibility', 'index'=>'visibility', 'width'=>'40', 'align'=>'left', 'search' => 'false'),
7404 7404
                 );
7405 7405
                 break;
7406 7406
             case 'complete':
@@ -7413,12 +7413,12 @@  discard block
 block discarded – undo
7413 7413
                     get_lang('Visibility'),
7414 7414
                     get_lang('CourseTitle'),
7415 7415
                 );
7416
-                $column_model = array (
7417
-                    array('name'=>'name', 'index'=>'s.name', 'width'=>'200',  'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7418
-                    array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'70',   'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)),
7419
-                    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)),
7420
-                    array('name'=>'coach_name', 'index'=>'coach_name',     'width'=>'70',   'align'=>'left', 'search' => 'false', 'searchoptions' => array('sopt' => $operators)),
7421
-                    array('name'=>'session_active', 'index'=>'session_active', 'width'=>'25',   'align'=>'left', 'search' => 'true', 'stype'=>'select',
7416
+                $column_model = array(
7417
+                    array('name'=>'name', 'index'=>'s.name', 'width'=>'200', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('sopt' => $operators)),
7418
+                    array('name'=>'display_start_date', 'index'=>'display_start_date', 'width'=>'70', 'align'=>'left', 'search' => 'true', 'searchoptions' => array('dataInit' => 'date_pick_today', 'sopt' => $date_operators)),
7419
+                    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)),
7420
+                    array('name'=>'coach_name', 'index'=>'coach_name', 'width'=>'70', 'align'=>'left', 'search' => 'false', 'searchoptions' => array('sopt' => $operators)),
7421
+                    array('name'=>'session_active', 'index'=>'session_active', 'width'=>'25', 'align'=>'left', 'search' => 'true', 'stype'=>'select',
7422 7422
                         // for the bottom bar
7423 7423
                         'searchoptions' => array(
7424 7424
                             'defaultValue'  => '1',
@@ -7426,8 +7426,8 @@  discard block
 block discarded – undo
7426 7426
                         // for the top bar
7427 7427
                         'editoptions' => array('value' => '" ":'.get_lang('All').';1:'.get_lang('Active').';0:'.get_lang('Inactive')),
7428 7428
                     ),
7429
-                    array('name'=>'visibility',     'index'=>'visibility',      'width'=>'40',   'align'=>'left', 'search' => 'false'),
7430
-                    array('name'=>'course_title',    'index'=>'course_title',   'width'=>'50',   'hidden' => 'true', 'search' => 'true', 'searchoptions' => array('searchhidden' =>'true','sopt' => $operators)),
7429
+                    array('name'=>'visibility', 'index'=>'visibility', 'width'=>'40', 'align'=>'left', 'search' => 'false'),
7430
+                    array('name'=>'course_title', 'index'=>'course_title', 'width'=>'50', 'hidden' => 'true', 'search' => 'true', 'searchoptions' => array('searchhidden' =>'true', 'sopt' => $operators)),
7431 7431
                 );
7432 7432
                 break;
7433 7433
         }
@@ -7436,14 +7436,14 @@  discard block
 block discarded – undo
7436 7436
         $session_field = new ExtraFieldModel('session');
7437 7437
         $rules = $session_field->getRules($columns, $column_model);
7438 7438
 
7439
-        $column_model[] = array('name'=>'actions', 'index'=>'actions', 'width'=>'80',  'align'=>'left','formatter'=>'action_formatter','sortable'=>'false', 'search' => 'false');
7439
+        $column_model[] = array('name'=>'actions', 'index'=>'actions', 'width'=>'80', 'align'=>'left', 'formatter'=>'action_formatter', 'sortable'=>'false', 'search' => 'false');
7440 7440
         $columns[] = get_lang('Actions');
7441 7441
 
7442 7442
         foreach ($column_model as $col_model) {
7443 7443
             $simple_column_name[] = $col_model['name'];
7444 7444
         }
7445 7445
 
7446
-        $return_array =  array(
7446
+        $return_array = array(
7447 7447
             'columns' => $columns,
7448 7448
             'column_model' => $column_model,
7449 7449
             'rules' => $rules,
@@ -7532,7 +7532,7 @@  discard block
 block discarded – undo
7532 7532
             if (api_is_session_admin() &&
7533 7533
                 api_get_setting('allow_session_admins_to_manage_all_sessions') == 'false'
7534 7534
             ) {
7535
-                $where.=" AND s.session_admin_id = $user_id ";
7535
+                $where .= " AND s.session_admin_id = $user_id ";
7536 7536
             }
7537 7537
         }
7538 7538
 
@@ -7614,11 +7614,11 @@  discard block
 block discarded – undo
7614 7614
             }
7615 7615
             $options['where'] = str_replace('course_title', 'c.title', $options['where']);
7616 7616
 
7617
-            $options['where'] = str_replace("( session_active = '0' )", '1=1',  $options['where']);
7617
+            $options['where'] = str_replace("( session_active = '0' )", '1=1', $options['where']);
7618 7618
 
7619 7619
             $options['where'] = str_replace(
7620 7620
                 array("AND session_active = '1'  )", " AND (  session_active = '1'  )"),
7621
-                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 " )
7621
+                array(') GROUP BY s.name HAVING session_active = 1 ', " GROUP BY s.name HAVING session_active = 1 ")
7622 7622
                 , $options['where']
7623 7623
             );
7624 7624
 
@@ -7653,10 +7653,10 @@  discard block
 block discarded – undo
7653 7653
             $where;
7654 7654
 
7655 7655
         if (api_is_multiple_url_enabled()) {
7656
-            $table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
7656
+            $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
7657 7657
             $access_url_id = api_get_current_access_url_id();
7658 7658
             if ($access_url_id != -1) {
7659
-                $where.= " AND ar.access_url_id = $access_url_id ";
7659
+                $where .= " AND ar.access_url_id = $access_url_id ";
7660 7660
                 $query = "$select
7661 7661
                     FROM $tbl_session s
7662 7662
                     LEFT JOIN $tbl_session_field_values fv ON (fv.session_id = s.id)
@@ -7680,7 +7680,7 @@  discard block
 block discarded – undo
7680 7680
         $formatted_sessions = array();
7681 7681
 
7682 7682
         if (Database::num_rows($result)) {
7683
-            $sessions   = Database::store_result($result, 'ASSOC');
7683
+            $sessions = Database::store_result($result, 'ASSOC');
7684 7684
             foreach ($sessions as $session) {
7685 7685
                 $session_id = $session['id'];
7686 7686
                 $session['name'] = Display::url($session['name'], "resume_session.php?id_session=".$session['id']);
@@ -7695,14 +7695,14 @@  discard block
 block discarded – undo
7695 7695
 
7696 7696
                 switch ($session['visibility']) {
7697 7697
                     case SESSION_VISIBLE_READ_ONLY: //1
7698
-                        $session['visibility'] =  get_lang('ReadOnly');
7698
+                        $session['visibility'] = get_lang('ReadOnly');
7699 7699
                         break;
7700 7700
                     case SESSION_VISIBLE:           //2
7701 7701
                     case SESSION_AVAILABLE:         //4
7702
-                        $session['visibility'] =  get_lang('Visible');
7702
+                        $session['visibility'] = get_lang('Visible');
7703 7703
                         break;
7704 7704
                     case SESSION_INVISIBLE:         //3
7705
-                        $session['visibility'] =  api_ucfirst(get_lang('Invisible'));
7705
+                        $session['visibility'] = api_ucfirst(get_lang('Invisible'));
7706 7706
                         break;
7707 7707
                 }
7708 7708
 
@@ -7778,7 +7778,7 @@  discard block
 block discarded – undo
7778 7778
         if (empty($session)) {
7779 7779
             return false;
7780 7780
         }
7781
-        return api_get_path(WEB_CODE_PATH) . 'session/resume_session.php?id_session=' . $id;
7781
+        return api_get_path(WEB_CODE_PATH).'session/resume_session.php?id_session='.$id;
7782 7782
     }
7783 7783
 
7784 7784
     /**
@@ -7796,7 +7796,7 @@  discard block
 block discarded – undo
7796 7796
             return false;
7797 7797
         }
7798 7798
         if (empty($courseId)) {
7799
-            return api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . $id;
7799
+            return api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$id;
7800 7800
         } else {
7801 7801
             $courseInfo = api_get_course_info_by_id($courseId);
7802 7802
             if ($courseInfo) {
@@ -8007,7 +8007,7 @@  discard block
 block discarded – undo
8007 8007
             // sort $listCat by catSessionName
8008 8008
             usort($listCat, 'self::compareBySessionName');
8009 8009
             // in each catSession sort sessionList by sessionName
8010
-            foreach($listCat as $i => $listCatSessionInfo) {
8010
+            foreach ($listCat as $i => $listCatSessionInfo) {
8011 8011
                 $listSessionList = $listCatSessionInfo['sessionList'];
8012 8012
                 usort($listSessionList, 'self::compareCatSessionInfo');
8013 8013
                 $listCat[$i]['sessionList'] = $listSessionList;
@@ -8022,8 +8022,8 @@  discard block
 block discarded – undo
8022 8022
             );
8023 8023
 
8024 8024
             $userCatId = intval($userCatId);
8025
-            $listResults[$userCatId]['courseInUserCategoryId'] =  $userCatId;
8026
-            $listResults[$userCatId]['courseInUserCategoryTitle'] =  $userCatTitle;
8025
+            $listResults[$userCatId]['courseInUserCategoryId'] = $userCatId;
8026
+            $listResults[$userCatId]['courseInUserCategoryTitle'] = $userCatTitle;
8027 8027
             $listResults[$userCatId]['courseInUserCatList'][] = $listOneCourse;
8028 8028
         }
8029 8029
 
@@ -8049,7 +8049,7 @@  discard block
 block discarded – undo
8049 8049
     {
8050 8050
         if ($listA['sessionName'] == $listB['sessionName']) {
8051 8051
             return 0;
8052
-        } else if($listA['sessionName'] > $listB['sessionName']) {
8052
+        } else if ($listA['sessionName'] > $listB['sessionName']) {
8053 8053
             return 1;
8054 8054
         } else {
8055 8055
             return -1;
@@ -8069,7 +8069,7 @@  discard block
 block discarded – undo
8069 8069
             return 1;
8070 8070
         } else if ($listA['catSessionName'] == $listB['catSessionName']) {
8071 8071
             return 0;
8072
-        } else if($listA['catSessionName'] > $listB['catSessionName']) {
8072
+        } else if ($listA['catSessionName'] > $listB['catSessionName']) {
8073 8073
             return 1;
8074 8074
         } else {
8075 8075
             return -1;
@@ -8085,7 +8085,7 @@  discard block
 block discarded – undo
8085 8085
     {
8086 8086
         if ($listA['courseInUserCategoryTitle'] == $listB['courseInUserCategoryTitle']) {
8087 8087
             return 0;
8088
-        } else if($listA['courseInUserCategoryTitle'] > $listB['courseInUserCategoryTitle']) {
8088
+        } else if ($listA['courseInUserCategoryTitle'] > $listB['courseInUserCategoryTitle']) {
8089 8089
             return 1;
8090 8090
         } else {
8091 8091
             return -1;
@@ -8101,7 +8101,7 @@  discard block
 block discarded – undo
8101 8101
     {
8102 8102
         if ($listA['title'] == $listB['title']) {
8103 8103
             return 0;
8104
-        } else if($listA['title'] > $listB['title']) {
8104
+        } else if ($listA['title'] > $listB['title']) {
8105 8105
             return 1;
8106 8106
         } else {
8107 8107
             return -1;
@@ -8146,8 +8146,8 @@  discard block
 block discarded – undo
8146 8146
 
8147 8147
                 $marginShift = 20;
8148 8148
                 if ($catSessionName != '') {
8149
-                    $htmlCatSessions .= '<div style="margin-left:'.$marginShift.'px;">' .
8150
-                        CourseManager::course_item_html($listParamsCatSession, true) . '</div>';
8149
+                    $htmlCatSessions .= '<div style="margin-left:'.$marginShift.'px;">'.
8150
+                        CourseManager::course_item_html($listParamsCatSession, true).'</div>';
8151 8151
                     $marginShift = 40;
8152 8152
                 }
8153 8153
 
@@ -8212,12 +8212,12 @@  discard block
 block discarded – undo
8212 8212
                 $userId = api_get_user_id();
8213 8213
                 $response = self::isUserSubscribedAsStudent($sessionId, $userId);
8214 8214
                 if ($response) {
8215
-                    $urlToRedirect = api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . $sessionId;
8215
+                    $urlToRedirect = api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.$sessionId;
8216 8216
                     if (!empty($onlyOneCourseSessionToRedirect)) {
8217
-                        $urlToRedirect = api_get_path(WEB_PATH) . 'courses/' . $onlyOneCourseSessionToRedirect . '/index.php?id_session=' . $sessionId;
8217
+                        $urlToRedirect = api_get_path(WEB_PATH).'courses/'.$onlyOneCourseSessionToRedirect.'/index.php?id_session='.$sessionId;
8218 8218
                     }
8219 8219
 
8220
-                    header('Location: ' . $urlToRedirect);
8220
+                    header('Location: '.$urlToRedirect);
8221 8221
                     exit;
8222 8222
                 }
8223 8223
             }
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.
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.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
             return false;
115 115
         }
116 116
         $this->path = $path;
117
-        $this->set_image_wrapper();  //Creates image obj
117
+        $this->set_image_wrapper(); //Creates image obj
118 118
     }
119 119
 
120 120
     abstract function set_image_wrapper();
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
         if ($this->debug) error_log('Image::set_image_wrapper loaded');
157 157
         try {
158 158
             if (file_exists($this->path)) {
159
-                $this->image     = new Imagick($this->path);
159
+                $this->image = new Imagick($this->path);
160 160
 
161 161
                 if ($this->image) {
162 162
                     $this->fill_image_info(); //Fills height, width and type
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
             } else {
165 165
                 if ($this->debug) error_log('Image::image does not exist');
166 166
             }
167
-        } catch(ImagickException $e) {
167
+        } catch (ImagickException $e) {
168 168
             if ($this->debug) error_log($e->getMessage());
169 169
         }
170 170
     }
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 
186 186
 	public function get_image_size()
187 187
     {
188
-		$imagesize = array('width'=>0,'height'=>0);
188
+		$imagesize = array('width'=>0, 'height'=>0);
189 189
 	    if ($this->image_validated) {
190 190
             $imagesize = $this->image->getImageGeometry();
191 191
 	    }
@@ -202,8 +202,8 @@  discard block
 block discarded – undo
202 202
             $height = $thumbh;
203 203
         } else {
204 204
             $scale  = ($this->width > 0 && $this->height > 0) ? min($thumbw / $this->width, $thumbh / $this->height) : 0;
205
-            $width  = (int)($this->width * $scale);
206
-            $height = (int)($this->height * $scale);
205
+            $width  = (int) ($this->width * $scale);
206
+            $height = (int) ($this->height * $scale);
207 207
         }
208 208
 		$result = $this->image->resizeImage($width, $height, $this->filter, 1);
209 209
 		$this->width  = $thumbw;
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 		$result = false;
250 250
 		try {
251 251
 		    $result = $this->image->writeImage($file);
252
-		} catch(ImagickException $e) {
252
+		} catch (ImagickException $e) {
253 253
             if ($this->debug) error_log($e->getMessage());
254 254
         }
255 255
 
@@ -310,9 +310,9 @@  discard block
 block discarded – undo
310 310
 
311 311
     public function get_image_size()
312 312
     {
313
-        $return_array = array('width'=>0,'height'=>0);
313
+        $return_array = array('width'=>0, 'height'=>0);
314 314
         if ($this->image_validated) {
315
-	        $return_array = array('width'=>$this->width,'height'=>$this->height);
315
+	        $return_array = array('width'=>$this->width, 'height'=>$this->height);
316 316
         }
317 317
         return $return_array;
318 318
 	}
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
     public function fill_image_info()
321 321
     {
322 322
     	if (file_exists($this->path)) {
323
-	        $image_info     = getimagesize($this->path);
323
+	        $image_info = getimagesize($this->path);
324 324
 			$this->width    = $image_info[0];
325 325
 			$this->height   = $image_info[1];
326 326
 			$this->type     = $image_info[2];
@@ -340,11 +340,11 @@  discard block
 block discarded – undo
340 340
                 $height = $thumbh;
341 341
             } else {
342 342
                 $scale = min($thumbw / $this->width, $thumbh / $this->height);
343
-                $width = (int)($this->width * $scale);
344
-                $height = (int)($this->height * $scale);
343
+                $width = (int) ($this->width * $scale);
344
+                $height = (int) ($this->height * $scale);
345 345
             }
346
-			$deltaw = (int)(($thumbw - $width) / 2);
347
-			$deltah = (int)(($thumbh - $height) / 2);
346
+			$deltaw = (int) (($thumbw - $width) / 2);
347
+			$deltah = (int) (($thumbh - $height) / 2);
348 348
 			$dst_img = @ImageCreateTrueColor($thumbw, $thumbh);
349 349
             		@imagealphablending($dst_img, false);
350 350
 		        @imagesavealpha($dst_img, true);
@@ -359,8 +359,8 @@  discard block
 block discarded – undo
359 359
                 $height = $thumbh;
360 360
             } else {
361 361
                 $scale = ($this->width > 0 && $this->height > 0) ? min($thumbw / $this->width, $thumbh / $this->height) : 0;
362
-                $width  = (int)($this->width * $scale);
363
-                $height = (int)($this->height * $scale);
362
+                $width  = (int) ($this->width * $scale);
363
+                $height = (int) ($this->height * $scale);
364 364
             }
365 365
 			$deltaw = 0;
366 366
 			$deltah = 0;
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
 	public function send_image($file = '', $compress = -1, $convert_file_to = null)
419 419
     {
420 420
 	    if (!$this->image_validated) return false;
421
-        $compress = (int)$compress;
421
+        $compress = (int) $compress;
422 422
         $type = $this->type;
423 423
         if (!empty($convert_file_to) && in_array($convert_file_to, $this->allowed_extensions)) {
424 424
             $type = $convert_file_to;
@@ -462,11 +462,11 @@  discard block
 block discarded – undo
462 462
          * so that we can use black (0,0,0) as transparent, which is what
463 463
          * the image is filled with when created.
464 464
          */
465
-        $transparent = imagecolorallocate($dest_img, 0,0,0);
465
+        $transparent = imagecolorallocate($dest_img, 0, 0, 0);
466 466
         imagealphablending($dest_img, false);
467 467
         imagesavealpha($dest_img, true);
468 468
         imagecolortransparent($dest_img, $transparent);
469
-        imagecopy($dest_img, $this->bg, 0,0, 0, 0,imagesx($this->bg), imagesx($this->bg));
469
+        imagecopy($dest_img, $this->bg, 0, 0, 0, 0, imagesx($this->bg), imagesx($this->bg));
470 470
         imagefilter($dest_img, IMG_FILTER_GRAYSCALE);
471 471
         $this->bg = $dest_img;
472 472
 
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.
main/inc/lib/urlmanager.lib.php 3 patches
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -11,15 +11,15 @@  discard block
 block discarded – undo
11 11
 class UrlManager
12 12
 {
13 13
     /**
14
-    * Creates a new url access
15
-    *
16
-    * @author Julio Montoya <[email protected]>,
17
-    *
18
-    * @param	string	$url The URL of the site
19
-    * @param	string  $description The description of the site
20
-    * @param	int		$active is active or not
21
-    * @return boolean if success
22
-    */
14
+     * Creates a new url access
15
+     *
16
+     * @author Julio Montoya <[email protected]>,
17
+     *
18
+     * @param	string	$url The URL of the site
19
+     * @param	string  $description The description of the site
20
+     * @param	int		$active is active or not
21
+     * @return boolean if success
22
+     */
23 23
     public static function add($url, $description, $active)
24 24
     {
25 25
         $tms = time();
@@ -36,15 +36,15 @@  discard block
 block discarded – undo
36 36
     }
37 37
 
38 38
     /**
39
-    * Updates an URL access
40
-    * @author Julio Montoya <[email protected]>,
41
-    *
42
-    * @param	int 	$url_id The url id
43
-    * @param	string 	$url
44
-    * @param	string  $description The description of the site
45
-    * @param	int		$active is active or not
46
-    * @return 	boolean if success
47
-    */
39
+     * Updates an URL access
40
+     * @author Julio Montoya <[email protected]>,
41
+     *
42
+     * @param	int 	$url_id The url id
43
+     * @param	string 	$url
44
+     * @param	string  $description The description of the site
45
+     * @param	int		$active is active or not
46
+     * @return 	boolean if success
47
+     */
48 48
     public static function update($url_id, $url, $description, $active)
49 49
     {
50 50
         $url_id = intval($url_id);
@@ -63,12 +63,12 @@  discard block
 block discarded – undo
63 63
     }
64 64
 
65 65
     /**
66
-    * Deletes an url
67
-    * @author Julio Montoya
68
-    * @param int $id url id
66
+     * Deletes an url
67
+     * @author Julio Montoya
68
+     * @param int $id url id
69 69
      *
70
-    * @return boolean true if success
71
-    * */
70
+     * @return boolean true if success
71
+     * */
72 72
     public static function delete($id)
73 73
     {
74 74
         $id = intval($id);
@@ -200,12 +200,12 @@  discard block
 block discarded – undo
200 200
     }
201 201
 
202 202
     /**
203
-    * Gets the inner join of access_url and the course table
204
-    *
205
-    * @author Julio Montoya
206
-    * @param int  access url id
207
-    * @return array   Database::store_result of the result
208
-    **/
203
+     * Gets the inner join of access_url and the course table
204
+     *
205
+     * @author Julio Montoya
206
+     * @param int  access url id
207
+     * @return array   Database::store_result of the result
208
+     **/
209 209
     public static function get_url_rel_course_data($access_url_id = null)
210 210
     {
211 211
         $where = '';
@@ -362,12 +362,12 @@  discard block
 block discarded – undo
362 362
     }
363 363
 
364 364
     /**
365
-    * Checks the relationship between an URL and a User (return the num_rows)
366
-    * @author Julio Montoya
367
-    * @param int user id
368
-    * @param int url id
369
-    * @return boolean true if success
370
-    * */
365
+     * Checks the relationship between an URL and a User (return the num_rows)
366
+     * @author Julio Montoya
367
+     * @param int user id
368
+     * @param int url id
369
+     * @return boolean true if success
370
+     * */
371 371
     public static function relation_url_user_exist($user_id, $url_id)
372 372
     {
373 373
         $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
@@ -377,15 +377,15 @@  discard block
 block discarded – undo
377 377
         $num = Database::num_rows($result);
378 378
 
379 379
         return $num;
380
-	}
380
+    }
381 381
 
382 382
     /**
383
-    * Checks the relationship between an URL and a Course (return the num_rows)
384
-    * @author Julio Montoya
385
-    * @param int $courseId
386
-    * @param int $urlId
387
-    * @return boolean true if success
388
-    * */
383
+     * Checks the relationship between an URL and a Course (return the num_rows)
384
+     * @author Julio Montoya
385
+     * @param int $courseId
386
+     * @param int $urlId
387
+     * @return boolean true if success
388
+     * */
389 389
     public static function relation_url_course_exist($courseId, $urlId)
390 390
     {
391 391
         $table_url_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
@@ -420,12 +420,12 @@  discard block
 block discarded – undo
420 420
     }
421 421
 
422 422
     /**
423
-    * Checks the relationship between an URL and a Session (return the num_rows)
424
-    * @author Julio Montoya
425
-    * @param int user id
426
-    * @param int url id
427
-    * @return boolean true if success
428
-    * */
423
+     * Checks the relationship between an URL and a Session (return the num_rows)
424
+     * @author Julio Montoya
425
+     * @param int user id
426
+     * @param int url id
427
+     * @return boolean true if success
428
+     * */
429 429
     public static function relation_url_session_exist($session_id, $url_id)
430 430
     {
431 431
         $table_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
@@ -737,13 +737,13 @@  discard block
 block discarded – undo
737 737
     }
738 738
 
739 739
     /**
740
-    * Deletes an url and user relationship
741
-    * @author Julio Montoya
742
-    * @param int user id
743
-    * @param int url id
740
+     * Deletes an url and user relationship
741
+     * @author Julio Montoya
742
+     * @param int user id
743
+     * @param int url id
744 744
      *
745
-    * @return boolean true if success
746
-    * */
745
+     * @return boolean true if success
746
+     * */
747 747
     public static function delete_url_rel_user($user_id, $url_id)
748 748
     {
749 749
         $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
@@ -758,13 +758,13 @@  discard block
 block discarded – undo
758 758
     }
759 759
 
760 760
     /**
761
-    * Deletes an url and course relationship
762
-    * @author Julio Montoya
763
-    * @param  int  $courseId
764
-    * @param  int  $urlId
761
+     * Deletes an url and course relationship
762
+     * @author Julio Montoya
763
+     * @param  int  $courseId
764
+     * @param  int  $urlId
765 765
      *
766
-    * @return boolean true if success
767
-    * */
766
+     * @return boolean true if success
767
+     * */
768 768
     public static function delete_url_rel_course($courseId, $urlId)
769 769
     {
770 770
         $table_url_rel_course= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
@@ -814,13 +814,13 @@  discard block
 block discarded – undo
814 814
     }
815 815
 
816 816
     /**
817
-    * Deletes an url and session relationship
818
-    * @author Julio Montoya
819
-    * @param  char  course code
820
-    * @param  int url id
817
+     * Deletes an url and session relationship
818
+     * @author Julio Montoya
819
+     * @param  char  course code
820
+     * @param  int url id
821 821
      *
822
-    * @return boolean true if success
823
-    * */
822
+     * @return boolean true if success
823
+     * */
824 824
     public static function delete_url_rel_session($session_id, $url_id)
825 825
     {
826 826
         $table_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
Please login to merge, or discard this patch.
Doc Comments   +16 added lines, -13 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     * @param	string	$url The URL of the site
19 19
     * @param	string  $description The description of the site
20 20
     * @param	int		$active is active or not
21
-    * @return boolean if success
21
+    * @return Doctrine\DBAL\Driver\Statement|null if success
22 22
     */
23 23
     public static function add($url, $description, $active)
24 24
     {
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     * @param	string 	$url
44 44
     * @param	string  $description The description of the site
45 45
     * @param	int		$active is active or not
46
-    * @return 	boolean if success
46
+    * @return 	Doctrine\DBAL\Driver\Statement|null if success
47 47
     */
48 48
     public static function update($url_id, $url, $description, $active)
49 49
     {
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
     * @author Julio Montoya
387 387
     * @param int user id
388 388
     * @param int url id
389
-    * @return boolean true if success
389
+    * @return integer true if success
390 390
     * */
391 391
     public static function relation_url_user_exist($user_id, $url_id)
392 392
     {
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
     * @author Julio Montoya
405 405
     * @param int $courseId
406 406
     * @param int $urlId
407
-    * @return boolean true if success
407
+    * @return integer true if success
408 408
     * */
409 409
     public static function relation_url_course_exist($courseId, $urlId)
410 410
     {
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
      * @author Julio Montoya
426 426
      * @param int $userGroupId
427 427
      * @param int $urlId
428
-     * @return boolean true if success
428
+     * @return integer true if success
429 429
      * */
430 430
     public static function relationUrlUsergroupExist($userGroupId, $urlId)
431 431
     {
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
     * @author Julio Montoya
446 446
     * @param int user id
447 447
     * @param int url id
448
-    * @return boolean true if success
448
+    * @return integer true if success
449 449
     * */
450 450
     public static function relation_url_session_exist($session_id, $url_id)
451 451
     {
@@ -568,6 +568,8 @@  discard block
 block discarded – undo
568 568
      * @author Julio Montoya
569 569
      * @param  array of course ids
570 570
      * @param  array of url_ids
571
+     * @param integer[] $courseCategoryList
572
+     * @param integer[] $urlList
571 573
      * @return array
572 574
      **/
573 575
     public static function addCourseCategoryListToUrl($courseCategoryList, $urlList)
@@ -598,7 +600,7 @@  discard block
 block discarded – undo
598 600
      * @author Julio Montoya
599 601
      * @param int $categoryCourseId
600 602
      * @param int $urlId
601
-     * @return boolean true if success
603
+     * @return integer true if success
602 604
      * */
603 605
     public static function relationUrlCourseCategoryExist($categoryCourseId, $urlId)
604 606
     {
@@ -615,7 +617,7 @@  discard block
 block discarded – undo
615 617
     /**
616 618
      * @param int $userGroupId
617 619
      * @param int $urlId
618
-     * @return int
620
+     * @return string
619 621
      */
620 622
     public static function addUserGroupToUrl($userGroupId, $urlId)
621 623
     {
@@ -716,7 +718,7 @@  discard block
 block discarded – undo
716 718
      * @param int $courseId
717 719
      * @param int $url_id
718 720
      *
719
-     * @return resource
721
+     * @return boolean
720 722
      */
721 723
     public static function add_course_to_url($courseId, $url_id = 1)
722 724
     {
@@ -807,7 +809,7 @@  discard block
 block discarded – undo
807 809
     * @param  int  $courseId
808 810
     * @param  int  $urlId
809 811
      *
810
-    * @return boolean true if success
812
+    * @return Doctrine\DBAL\Driver\Statement|null true if success
811 813
     * */
812 814
     public static function delete_url_rel_course($courseId, $urlId)
813 815
     {
@@ -825,7 +827,7 @@  discard block
 block discarded – undo
825 827
      * @param  int $userGroupId
826 828
      * @param  int $urlId
827 829
      *
828
-     * @return boolean true if success
830
+     * @return Doctrine\DBAL\Driver\Statement|null true if success
829 831
      * */
830 832
     public static function delete_url_rel_usergroup($userGroupId, $urlId)
831 833
     {
@@ -844,7 +846,7 @@  discard block
 block discarded – undo
844 846
      * @param  int $userGroupId
845 847
      * @param  int $urlId
846 848
      *
847
-     * @return boolean true if success
849
+     * @return Doctrine\DBAL\Driver\Statement|null true if success
848 850
      * */
849 851
     public static function deleteUrlRelCourseCategory($userGroupId, $urlId)
850 852
     {
@@ -862,8 +864,9 @@  discard block
 block discarded – undo
862 864
     * @author Julio Montoya
863 865
     * @param  char  course code
864 866
     * @param  int url id
867
+    * @param integer $url_id
865 868
      *
866
-    * @return boolean true if success
869
+    * @return Doctrine\DBAL\Driver\Statement|null true if success
867 870
     * */
868 871
     public static function delete_url_rel_session($session_id, $url_id)
869 872
     {
Please login to merge, or discard this patch.
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
     public static function add($url, $description, $active)
24 24
     {
25 25
         $tms = time();
26
-        $table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
26
+        $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
27 27
         $sql = "INSERT INTO $table
28 28
                 SET url 	= '".Database::escape_string($url)."',
29 29
                 description = '".Database::escape_string($description)."',
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         $sql = "DELETE FROM $tableUser WHERE access_url_id = ".$id;
93 93
         Database::query($sql);
94 94
 
95
-        $sql= "DELETE FROM $table WHERE id = ".$id;
95
+        $sql = "DELETE FROM $table WHERE id = ".$id;
96 96
         Database::query($sql);
97 97
 
98 98
         return true;
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
      */
106 106
     public static function url_exist($url)
107 107
     {
108
-        $table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
108
+        $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
109 109
         $sql = "SELECT id FROM $table
110 110
                 WHERE url = '".Database::escape_string($url)."' ";
111 111
         $res = Database::query($sql);
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
      * */
140 140
     public static function url_count()
141 141
     {
142
-        $table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
142
+        $table_access_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
143 143
         $sql = "SELECT count(id) as count_result FROM $table_access_url";
144 144
         $res = Database::query($sql);
145
-        $url = Database::fetch_array($res,'ASSOC');
145
+        $url = Database::fetch_array($res, 'ASSOC');
146 146
         $result = $url['count_result'];
147 147
 
148 148
         return $result;
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
                 FROM $table
161 161
                 ORDER BY id";
162 162
         $res = Database::query($sql);
163
-        $urls = array ();
163
+        $urls = array();
164 164
         while ($url = Database::fetch_array($res)) {
165 165
             $urls[] = $url;
166 166
         }
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
      **/
278 278
     public static function get_url_rel_session_data($access_url_id = null)
279 279
     {
280
-        $where ='';
280
+        $where = '';
281 281
         $table_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
282 282
         $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
283 283
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
         $table_user_group = Database::get_main_table(TABLE_USERGROUP);
314 314
 
315 315
         if (!empty($access_url_id)) {
316
-            $where ="WHERE $table_url_rel_usergroup.access_url_id = ".intval($access_url_id);
316
+            $where = "WHERE $table_url_rel_usergroup.access_url_id = ".intval($access_url_id);
317 317
         }
318 318
 
319 319
         $sql = "SELECT u.id, u.name, access_url_id
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
     public static function relation_url_user_exist($user_id, $url_id)
392 392
     {
393 393
         $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
394
-        $sql= "SELECT user_id FROM $table
394
+        $sql = "SELECT user_id FROM $table
395 395
                WHERE access_url_id = ".intval($url_id)." AND user_id = ".intval($user_id)." ";
396 396
         $result = Database::query($sql);
397 397
         $num = Database::num_rows($result);
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
     public static function relation_url_course_exist($courseId, $urlId)
410 410
     {
411 411
         $table_url_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
412
-        $sql= "SELECT c_id FROM $table_url_rel_course
412
+        $sql = "SELECT c_id FROM $table_url_rel_course
413 413
                WHERE
414 414
                     access_url_id = ".intval($urlId)." AND
415 415
                     c_id = '".intval($courseId)."'";
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
     public static function relationUrlUsergroupExist($userGroupId, $urlId)
431 431
     {
432 432
         $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USERGROUP);
433
-        $sql= "SELECT usergroup_id FROM $table
433
+        $sql = "SELECT usergroup_id FROM $table
434 434
                WHERE 
435 435
                     access_url_id = ".intval($urlId)." AND
436 436
                     usergroup_id = ".intval($userGroupId);
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
     * */
450 450
     public static function relation_url_session_exist($session_id, $url_id)
451 451
     {
452
-        $table_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
452
+        $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
453 453
         $session_id = intval($session_id);
454
-        $url_id		= intval($url_id);
454
+        $url_id = intval($url_id);
455 455
         $sql = "SELECT session_id FROM $table_url_rel_session
456 456
                 WHERE
457 457
                     access_url_id = ".intval($url_id)." AND
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
         if (is_array($user_list) && is_array($url_list)) {
478 478
             foreach ($url_list as $url_id) {
479 479
                 foreach ($user_list as $user_id) {
480
-                    $count = UrlManager::relation_url_user_exist($user_id,$url_id);
480
+                    $count = UrlManager::relation_url_user_exist($user_id, $url_id);
481 481
                     if ($count == 0) {
482 482
                         $sql = "INSERT INTO $table_url_rel_user
483 483
                                 SET 
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
      * @param  array of url_ids
506 506
      * @return array
507 507
      **/
508
-    public static function add_courses_to_urls($course_list,$url_list)
508
+    public static function add_courses_to_urls($course_list, $url_list)
509 509
     {
510 510
         $table_url_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
511 511
         $result_array = array();
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
                     $courseId = $courseInfo['real_id'];
518 518
 
519 519
                     $count = self::relation_url_course_exist($courseId, $url_id);
520
-                    if ($count==0) {
520
+                    if ($count == 0) {
521 521
                         $sql = "INSERT INTO $table_url_rel_course
522 522
                                 SET c_id = '".$courseId."', access_url_id = ".intval($url_id);
523 523
                         $result = Database::query($sql);
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
     public static function relationUrlCourseCategoryExist($categoryCourseId, $urlId)
604 604
     {
605 605
         $table = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE_CATEGORY);
606
-        $sql= "SELECT course_category_id FROM $table
606
+        $sql = "SELECT course_category_id FROM $table
607 607
                WHERE access_url_id = ".intval($urlId)." AND
608 608
                      course_category_id = ".intval($categoryCourseId);
609 609
         $result = Database::query($sql);
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
         $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
775 775
         $result = true;
776 776
         if (!empty($user_id) && !empty($url_id)) {
777
-            $sql= "DELETE FROM $table_url_rel_user
777
+            $sql = "DELETE FROM $table_url_rel_user
778 778
                    WHERE user_id = ".intval($user_id)." AND access_url_id = ".intval($url_id);
779 779
             $result = Database::query($sql);
780 780
         }
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
         $table_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
795 795
         $result = true;
796 796
         if (!empty($userId)) {
797
-            $sql= "DELETE FROM $table_url_rel_user
797
+            $sql = "DELETE FROM $table_url_rel_user
798 798
                    WHERE user_id = ".intval($userId);
799 799
             Database::query($sql);
800 800
         }
@@ -812,8 +812,8 @@  discard block
 block discarded – undo
812 812
     * */
813 813
     public static function delete_url_rel_course($courseId, $urlId)
814 814
     {
815
-        $table_url_rel_course= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
816
-        $sql= "DELETE FROM $table_url_rel_course
815
+        $table_url_rel_course = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
816
+        $sql = "DELETE FROM $table_url_rel_course
817 817
                WHERE c_id = '".intval($courseId)."' AND access_url_id=".intval($urlId)."  ";
818 818
         $result = Database::query($sql);
819 819
 
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
     public static function delete_url_rel_usergroup($userGroupId, $urlId)
832 832
     {
833 833
         $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USERGROUP);
834
-        $sql= "DELETE FROM $table
834
+        $sql = "DELETE FROM $table
835 835
                WHERE usergroup_id = '".intval($userGroupId)."' AND
836 836
                      access_url_id = ".intval($urlId);
837 837
         $result = Database::query($sql);
@@ -850,7 +850,7 @@  discard block
 block discarded – undo
850 850
     public static function deleteUrlRelCourseCategory($userGroupId, $urlId)
851 851
     {
852 852
         $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE_CATEGORY);
853
-        $sql= "DELETE FROM $table
853
+        $sql = "DELETE FROM $table
854 854
                WHERE course_category_id = '".intval($userGroupId)."' AND
855 855
                      access_url_id=".intval($urlId)."  ";
856 856
         $result = Database::query($sql);
@@ -869,9 +869,9 @@  discard block
 block discarded – undo
869 869
     public static function delete_url_rel_session($session_id, $url_id)
870 870
     {
871 871
         $table_url_rel_session = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
872
-        $sql= "DELETE FROM $table_url_rel_session
872
+        $sql = "DELETE FROM $table_url_rel_session
873 873
                WHERE session_id = ".intval($session_id)." AND access_url_id=".intval($url_id)."  ";
874
-        $result = Database::query($sql,'ASSOC');
874
+        $result = Database::query($sql, 'ASSOC');
875 875
 
876 876
         return $result;
877 877
     }
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
      * */
885 885
     public static function update_urls_rel_user($user_list, $access_url_id)
886 886
     {
887
-        $table_url_rel_user	= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
887
+        $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
888 888
         $sql = "SELECT user_id 
889 889
                 FROM $table_url_rel_user 
890 890
                 WHERE access_url_id = ".intval($access_url_id);
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
         $result = Database::query($sql);
941 941
 
942 942
         $existing_courses = array();
943
-        while ($row = Database::fetch_array($result)){
943
+        while ($row = Database::fetch_array($result)) {
944 944
             $existing_courses[] = $row['c_id'];
945 945
         }
946 946
 
@@ -973,7 +973,7 @@  discard block
 block discarded – undo
973 973
         $result = Database::query($sql);
974 974
         $existingItems = array();
975 975
 
976
-        while ($row = Database::fetch_array($result)){
976
+        while ($row = Database::fetch_array($result)) {
977 977
             $existingItems[] = $row['usergroup_id'];
978 978
         }
979 979
 
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
         $result = Database::query($sql);
1007 1007
         $existingItems = array();
1008 1008
 
1009
-        while ($row = Database::fetch_array($result)){
1009
+        while ($row = Database::fetch_array($result)) {
1010 1010
             $existingItems[] = $row['course_category_id'];
1011 1011
         }
1012 1012
 
@@ -1046,13 +1046,13 @@  discard block
 block discarded – undo
1046 1046
      * */
1047 1047
     public static function update_urls_rel_session($session_list, $access_url_id)
1048 1048
     {
1049
-        $table_url_rel_session	= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
1049
+        $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
1050 1050
 
1051 1051
         $sql = "SELECT session_id FROM $table_url_rel_session WHERE access_url_id=".intval($access_url_id);
1052 1052
         $result = Database::query($sql);
1053 1053
         $existing_sessions = array();
1054 1054
 
1055
-        while ($row = Database::fetch_array($result)){
1055
+        while ($row = Database::fetch_array($result)) {
1056 1056
             $existing_sessions[] = $row['session_id'];
1057 1057
         }
1058 1058
 
@@ -1082,13 +1082,13 @@  discard block
 block discarded – undo
1082 1082
      */
1083 1083
     public static function get_access_url_from_user($user_id)
1084 1084
     {
1085
-        $table_url_rel_user	= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
1086
-        $table_url	= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
1085
+        $table_url_rel_user = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
1086
+        $table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
1087 1087
         $sql = "SELECT url, access_url_id FROM $table_url_rel_user url_rel_user INNER JOIN $table_url u
1088 1088
                 ON (url_rel_user.access_url_id = u.id)
1089 1089
                 WHERE user_id = ".intval($user_id);
1090 1090
         $result = Database::query($sql);
1091
-        $url_list = Database::store_result($result,'ASSOC');
1091
+        $url_list = Database::store_result($result, 'ASSOC');
1092 1092
 
1093 1093
         return $url_list;
1094 1094
     }
@@ -1099,14 +1099,14 @@  discard block
 block discarded – undo
1099 1099
      */
1100 1100
     public static function get_access_url_from_course($courseId)
1101 1101
     {
1102
-        $table	= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
1103
-        $table_url	= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
1102
+        $table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_COURSE);
1103
+        $table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
1104 1104
         $sql = "SELECT url, access_url_id FROM $table c INNER JOIN $table_url u
1105 1105
                 ON (c.access_url_id = u.id)
1106 1106
                 WHERE c_id = ".intval($courseId);
1107 1107
 
1108 1108
         $result = Database::query($sql);
1109
-        $url_list = Database::store_result($result,'ASSOC');
1109
+        $url_list = Database::store_result($result, 'ASSOC');
1110 1110
         return $url_list;
1111 1111
     }
1112 1112
 
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
     public static function get_access_url_from_session($session_id)
1118 1118
     {
1119 1119
         $table_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
1120
-        $table_url  = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
1120
+        $table_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
1121 1121
         $sql = "SELECT url, access_url_id FROM $table_url_rel_session url_rel_session INNER JOIN $table_url u
1122 1122
                 ON (url_rel_session.access_url_id = u.id)
1123 1123
                 WHERE session_id = ".intval($session_id);
@@ -1133,7 +1133,7 @@  discard block
 block discarded – undo
1133 1133
      */
1134 1134
     public static function get_url_id($url)
1135 1135
     {
1136
-        $table_access_url= Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
1136
+        $table_access_url = Database :: get_main_table(TABLE_MAIN_ACCESS_URL);
1137 1137
         $sql = "SELECT id FROM $table_access_url WHERE url = '".Database::escape_string($url)."'";
1138 1138
         $result = Database::query($sql);
1139 1139
         $access_url_id = Database::result($result, 0, 0);
Please login to merge, or discard this patch.
main/inc/lib/zombie/zombie_manager.class.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         $count = intval($count);
80 80
         $from = intval($from);
81 81
 
82
-        $sql .=  " ORDER BY $column $direction";
82
+        $sql .= " ORDER BY $column $direction";
83 83
         $sql .= " LIMIT $count, $from ";
84 84
 
85 85
         $result = Database::query($sql);
@@ -93,8 +93,8 @@  discard block
 block discarded – undo
93 93
     static function deactivate_zombies($ceiling)
94 94
     {
95 95
         $zombies = self::list_zombies($ceiling);
96
-        $ids  = array();
97
-        foreach($zombies as $zombie) {
96
+        $ids = array();
97
+        foreach ($zombies as $zombie) {
98 98
             $ids[] = $zombie['user_id'];
99 99
         }
100 100
         UserManager::deactivate_users($ids);
Please login to merge, or discard this patch.
main/tracking/lp_results_by_user.php 3 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,8 +73,9 @@
 block discarded – undo
73 73
 //$form->addElement('submit','submit',get_lang('Filter'));
74 74
 $form->addButtonFilter(get_lang('Filter'));
75 75
 
76
-if (!empty($_REQUEST['course_code']))
76
+if (!empty($_REQUEST['course_code'])) {
77 77
     $selected_course = $_REQUEST['course_code'];
78
+}
78 79
 if (!empty($selected_course)) {
79 80
     $selected_course = api_get_course_info($selected_course);
80 81
     $course_list = array($selected_course);
Please login to merge, or discard this patch.
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -16,34 +16,34 @@  discard block
 block discarded – undo
16 16
 $is_allowedToTrack = $is_courseAdmin || $is_platformAdmin || $is_courseCoach || $is_sessionAdmin;
17 17
 
18 18
 if (!$is_allowedToTrack) {
19
-	Display :: display_header(null);
20
-	api_not_allowed();
21
-	Display :: display_footer();
19
+    Display :: display_header(null);
20
+    api_not_allowed();
21
+    Display :: display_footer();
22 22
 }
23 23
 
24 24
 $export_to_csv = false;
25 25
 if (isset($_GET['export'])) {
26
-	$export_to_csv = true;
26
+    $export_to_csv = true;
27 27
 }
28 28
 
29 29
 if (api_is_platform_admin() ) {
30
-	$global = true;
30
+    $global = true;
31 31
 } else {
32
-	$global = false;
32
+    $global = false;
33 33
 }
34 34
 
35 35
 if ($global) {
36
-	$temp_course_list = CourseManager :: get_courses_list();
37
-	foreach($temp_course_list  as $temp_course_item) {
38
-		$course_item = CourseManager ::get_course_information($temp_course_item['code']);
36
+    $temp_course_list = CourseManager :: get_courses_list();
37
+    foreach($temp_course_list  as $temp_course_item) {
38
+        $course_item = CourseManager ::get_course_information($temp_course_item['code']);
39 39
         $course_list[] = array(
40 40
             'code' => $course_item['code'],
41 41
             'title' => $course_item['title'],
42 42
         );
43
-	}
43
+    }
44 44
 } else {
45 45
     $current_course['code'] = $_course['id'];
46
-	$course_list = array($current_course);
46
+    $course_list = array($current_course);
47 47
 }
48 48
 
49 49
 $new_course_select = array();
@@ -54,20 +54,20 @@  discard block
 block discarded – undo
54 54
 $form = new FormValidator('search_simple', 'POST', '', '', null, false);
55 55
 $form->addElement('select','course_code',get_lang('Course'), $new_course_select);
56 56
 if ($global) {
57
-	$form->addElement('hidden','view','admin');
57
+    $form->addElement('hidden','view','admin');
58 58
 } else {
59
-	//Get exam lists
59
+    //Get exam lists
60 60
     $course_id = api_get_course_int_id();
61
-	$t_quiz = Database::get_course_table(TABLE_QUIZ_TEST);
62
-	$sqlExercices = "SELECT quiz.title,id FROM ".$t_quiz." AS quiz
61
+    $t_quiz = Database::get_course_table(TABLE_QUIZ_TEST);
62
+    $sqlExercices = "SELECT quiz.title,id FROM ".$t_quiz." AS quiz
63 63
 	                 WHERE c_id = $course_id AND active='1'
64 64
 	                 ORDER BY quiz.title ASC";
65
-	$resultExercices = Database::query($sqlExercices);
66
-	$exercise_list[0] = get_lang('All');
67
-	while($a_exercices = Database::fetch_array($resultExercices)) {
68
-		$exercise_list[$a_exercices['id']] = $a_exercices['title'];
69
-	}
70
-	$form->addElement('select', 'exercise_id', get_lang('Exercise'), $exercise_list);
65
+    $resultExercices = Database::query($sqlExercices);
66
+    $exercise_list[0] = get_lang('All');
67
+    while($a_exercices = Database::fetch_array($resultExercices)) {
68
+        $exercise_list[$a_exercices['id']] = $a_exercices['title'];
69
+    }
70
+    $form->addElement('select', 'exercise_id', get_lang('Exercise'), $exercise_list);
71 71
 }
72 72
 
73 73
 //$form->addElement('submit','submit',get_lang('Filter'));
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 }
82 82
 
83 83
 if (!$export_to_csv) {
84
-	Display :: display_header(get_lang('Reporting'));
85
-	echo '<div class="actions" style ="font-size:10pt;">';
86
-	if ($global) {
84
+    Display :: display_header(get_lang('Reporting'));
85
+    echo '<div class="actions" style ="font-size:10pt;">';
86
+    if ($global) {
87 87
 
88 88
         echo '<div style="float:right"> <a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'">
89 89
                 '.Display::return_icon('csv.gif').'
@@ -93,81 +93,81 @@  discard block
 block discarded – undo
93 93
                 &nbsp;'.get_lang('Print').'</a>
94 94
                 	</div>';
95 95
 
96
-		$menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=teacher">'.get_lang('TeacherInterface').'</a>';
96
+        $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=teacher">'.get_lang('TeacherInterface').'</a>';
97 97
         if (api_is_platform_admin()) {
98
-		  $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=admin">'.get_lang('AdminInterface').'</a>';
98
+            $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=admin">'.get_lang('AdminInterface').'</a>';
99 99
         } else {
100 100
             $menu_items[] = '<a href="'.api_get_path(WEB_CODE_PATH).'mySpace/?view=coach">'.get_lang('AdminInterface').'</a>';
101 101
         }
102
-		$menu_items[] = get_lang('ExamTracking');
103
-		$nb_menu_items = count($menu_items);
104
-		if($nb_menu_items>1) {
105
-			foreach($menu_items as $key=> $item) {
106
-				echo $item;
107
-				if($key!=$nb_menu_items-1) {
108
-					echo ' | ';
109
-				}
110
-			}
111
-			echo '<br />';
112
-		}
113
-	} else {
114
-	    echo '<a href="courseLog.php?'.api_get_cidreq().'&studentlist=true">'.get_lang('StudentsTracking').'</a>&nbsp;|
102
+        $menu_items[] = get_lang('ExamTracking');
103
+        $nb_menu_items = count($menu_items);
104
+        if($nb_menu_items>1) {
105
+            foreach($menu_items as $key=> $item) {
106
+                echo $item;
107
+                if($key!=$nb_menu_items-1) {
108
+                    echo ' | ';
109
+                }
110
+            }
111
+            echo '<br />';
112
+        }
113
+    } else {
114
+        echo '<a href="courseLog.php?'.api_get_cidreq().'&studentlist=true">'.get_lang('StudentsTracking').'</a>&nbsp;|
115 115
 		     <a href="courseLog.php?'.api_get_cidreq().'&studentlist=false">'.get_lang('CourseTracking').'</a>&nbsp;|&nbsp';
116 116
         echo '<a href="courseLog.php?'.api_get_cidreq().'&studentlist=resources">'.get_lang('ResourcesTracking').'</a>';
117
-		echo ' | '.get_lang('ExamTracking').'';
117
+        echo ' | '.get_lang('ExamTracking').'';
118 118
         echo '<a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'">
119 119
             '.Display::return_icon('excel.gif').'
120 120
             &nbsp;'.get_lang('ExportAsXLS').'</a><br /><br />';
121 121
 
122
-	}
122
+    }
123 123
     echo '</div>';
124
-	echo '<br /><br />';
125
-	$form->display();
124
+    echo '<br /><br />';
125
+    $form->display();
126 126
 }
127 127
 $main_result = array();
128 128
 $session_id = 0;
129 129
 $user_list = array();
130 130
 // Getting course list
131 131
 foreach ($course_list  as $current_course ) {
132
-	$course_info = api_get_course_info($current_course['code']);
133
-	$_course = $course_info;
134
-
135
-	// Getting LP list
136
-	$list = new LearnpathList('', $current_course['code'], $session_id);
137
-	$lp_list = $list->get_flat_list();
138
-
139
-	// Looping LPs
140
-	$lps = array();
141
-	foreach ($lp_list as $lp_id =>$lp) {
142
-		$exercise_list = Event::get_all_exercises_from_lp($lp_id, $course_info['real_id']);
143
-		$attempt_result = array();
144
-		// Looping Chamilo Exercises in LP
145
-		foreach ($exercise_list as $exercise) {
146
-			$exercise_stats = Event::get_all_exercise_event_from_lp(
147
-				$exercise['path'],
148
-				$course_info['real_id'],
149
-				$session_id
150
-			);
151
-			// Looping Exercise Attempts
152
-			foreach ($exercise_stats as $stats) {
153
-				$attempt_result[$exercise['id']]['users'][$stats['exe_user_id']][$stats['exe_id']] = $stats;
154
-				$user_list[$stats['exe_user_id']] = $stats['exe_user_id'];
155
-			}
156
-			$exercise_list_name[$exercise['id']] = $exercise['title'];
157
-		}
158
-		$lps[$lp_id] = array('lp_name' =>$lp['lp_name'], 'exercises' =>$attempt_result);
159
-		$lp_list_name[$lp_id] = $lp['lp_name'];
160
-	}
161
-	$main_result[$current_course['code']] = $lps;
132
+    $course_info = api_get_course_info($current_course['code']);
133
+    $_course = $course_info;
134
+
135
+    // Getting LP list
136
+    $list = new LearnpathList('', $current_course['code'], $session_id);
137
+    $lp_list = $list->get_flat_list();
138
+
139
+    // Looping LPs
140
+    $lps = array();
141
+    foreach ($lp_list as $lp_id =>$lp) {
142
+        $exercise_list = Event::get_all_exercises_from_lp($lp_id, $course_info['real_id']);
143
+        $attempt_result = array();
144
+        // Looping Chamilo Exercises in LP
145
+        foreach ($exercise_list as $exercise) {
146
+            $exercise_stats = Event::get_all_exercise_event_from_lp(
147
+                $exercise['path'],
148
+                $course_info['real_id'],
149
+                $session_id
150
+            );
151
+            // Looping Exercise Attempts
152
+            foreach ($exercise_stats as $stats) {
153
+                $attempt_result[$exercise['id']]['users'][$stats['exe_user_id']][$stats['exe_id']] = $stats;
154
+                $user_list[$stats['exe_user_id']] = $stats['exe_user_id'];
155
+            }
156
+            $exercise_list_name[$exercise['id']] = $exercise['title'];
157
+        }
158
+        $lps[$lp_id] = array('lp_name' =>$lp['lp_name'], 'exercises' =>$attempt_result);
159
+        $lp_list_name[$lp_id] = $lp['lp_name'];
160
+    }
161
+    $main_result[$current_course['code']] = $lps;
162 162
 }
163 163
 
164 164
 if (!empty($user_list)) {
165 165
     foreach($user_list as $user_id) {
166 166
         $user_data = api_get_user_info($user_id);
167
-		$user_list_name[$user_id] = api_get_person_name(
168
-			$user_data['firstname'],
169
-			$user_data['lastname']
170
-		);
167
+        $user_list_name[$user_id] = api_get_person_name(
168
+            $user_data['firstname'],
169
+            $user_data['lastname']
170
+        );
171 171
     }
172 172
 }
173 173
 $export_array =  array();
@@ -207,15 +207,15 @@  discard block
 block discarded – undo
207 207
                         $html_result .= Display::tag('td', $result);
208 208
 
209 209
                         $html_result .= '</tr>';
210
-						$export_array[] = array(
211
-							$course_code,
212
-							$lp_list_name[$lp_id],
213
-							$exercise_list_name[$exercise_id],
214
-							$user_list_name[$user_id],
215
-							$attempt,
216
-							api_get_local_time($attempt_data['exe_date']),
217
-							$result,
218
-						);
210
+                        $export_array[] = array(
211
+                            $course_code,
212
+                            $lp_list_name[$lp_id],
213
+                            $exercise_list_name[$exercise_id],
214
+                            $user_list_name[$user_id],
215
+                            $attempt,
216
+                            api_get_local_time($attempt_data['exe_date']),
217
+                            $result,
218
+                        );
219 219
                         $attempt++;
220 220
                     }
221 221
                 }
@@ -226,30 +226,30 @@  discard block
 block discarded – undo
226 226
 }
227 227
 
228 228
 if (!$export_to_csv) {
229
-	echo $html_result;
229
+    echo $html_result;
230 230
 }
231 231
 $filename = 'learning_path_results-'.date('Y-m-d-h:i:s').'.xls';
232 232
 if ($export_to_csv) {
233 233
     export_complete_report_csv($filename, $export_array);
234
-	exit;
234
+    exit;
235 235
 }
236 236
 
237 237
 function export_complete_report_csv($filename, $array)
238 238
 {
239
-	$header[] = array(
240
-		get_lang('Course'),
241
-		get_lang('LearningPath'),
242
-		get_lang('Exercise'),
243
-		get_lang('User'),
244
-		get_lang('Attempt'),
245
-		get_lang('Date'),
246
-		get_lang('Results'),
247
-	);
248
-	if (!empty($array)) {
249
-		$array = array_merge($header, $array);
250
-		Export :: arrayToCsv($array, $filename);
251
-	}
252
-	exit;
239
+    $header[] = array(
240
+        get_lang('Course'),
241
+        get_lang('LearningPath'),
242
+        get_lang('Exercise'),
243
+        get_lang('User'),
244
+        get_lang('Attempt'),
245
+        get_lang('Date'),
246
+        get_lang('Results'),
247
+    );
248
+    if (!empty($array)) {
249
+        $array = array_merge($header, $array);
250
+        Export :: arrayToCsv($array, $filename);
251
+    }
252
+    exit;
253 253
 
254 254
 }
255 255
 Display :: display_footer();
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 	$export_to_csv = true;
27 27
 }
28 28
 
29
-if (api_is_platform_admin() ) {
29
+if (api_is_platform_admin()) {
30 30
 	$global = true;
31 31
 } else {
32 32
 	$global = false;
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 
35 35
 if ($global) {
36 36
 	$temp_course_list = CourseManager :: get_courses_list();
37
-	foreach($temp_course_list  as $temp_course_item) {
37
+	foreach ($temp_course_list  as $temp_course_item) {
38 38
 		$course_item = CourseManager ::get_course_information($temp_course_item['code']);
39 39
         $course_list[] = array(
40 40
             'code' => $course_item['code'],
@@ -47,14 +47,14 @@  discard block
 block discarded – undo
47 47
 }
48 48
 
49 49
 $new_course_select = array();
50
-foreach($course_list as $data) {
50
+foreach ($course_list as $data) {
51 51
     $new_course_select[$data['code']] = $data['title'];
52 52
 }
53 53
 
54 54
 $form = new FormValidator('search_simple', 'POST', '', '', null, false);
55
-$form->addElement('select','course_code',get_lang('Course'), $new_course_select);
55
+$form->addElement('select', 'course_code', get_lang('Course'), $new_course_select);
56 56
 if ($global) {
57
-	$form->addElement('hidden','view','admin');
57
+	$form->addElement('hidden', 'view', 'admin');
58 58
 } else {
59 59
 	//Get exam lists
60 60
     $course_id = api_get_course_int_id();
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 	                 ORDER BY quiz.title ASC";
65 65
 	$resultExercices = Database::query($sqlExercices);
66 66
 	$exercise_list[0] = get_lang('All');
67
-	while($a_exercices = Database::fetch_array($resultExercices)) {
67
+	while ($a_exercices = Database::fetch_array($resultExercices)) {
68 68
 		$exercise_list[$a_exercices['id']] = $a_exercices['title'];
69 69
 	}
70 70
 	$form->addElement('select', 'exercise_id', get_lang('Exercise'), $exercise_list);
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
         echo '<div style="float:right"> <a href="'.api_get_self().'?export=1&score='.$filter_score.'&exercise_id='.$exercise_id.'">
89 89
                 '.Display::return_icon('csv.gif').'
90
-                &nbsp;'.get_lang('ExportAsCSV').'</a>' .
90
+                &nbsp;'.get_lang('ExportAsCSV').'</a>'.
91 91
                 '<a href="javascript: void(0);" onclick="javascript: window.print()">
92 92
                 '.Display::return_icon('printmgr.gif').'
93 93
                 &nbsp;'.get_lang('Print').'</a>
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
         }
102 102
 		$menu_items[] = get_lang('ExamTracking');
103 103
 		$nb_menu_items = count($menu_items);
104
-		if($nb_menu_items>1) {
105
-			foreach($menu_items as $key=> $item) {
104
+		if ($nb_menu_items > 1) {
105
+			foreach ($menu_items as $key=> $item) {
106 106
 				echo $item;
107
-				if($key!=$nb_menu_items-1) {
107
+				if ($key != $nb_menu_items - 1) {
108 108
 					echo ' | ';
109 109
 				}
110 110
 			}
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 $session_id = 0;
129 129
 $user_list = array();
130 130
 // Getting course list
131
-foreach ($course_list  as $current_course ) {
131
+foreach ($course_list  as $current_course) {
132 132
 	$course_info = api_get_course_info($current_course['code']);
133 133
 	$_course = $course_info;
134 134
 
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 }
163 163
 
164 164
 if (!empty($user_list)) {
165
-    foreach($user_list as $user_id) {
165
+    foreach ($user_list as $user_id) {
166 166
         $user_data = api_get_user_info($user_id);
167 167
 		$user_list_name[$user_id] = api_get_person_name(
168 168
 			$user_data['firstname'],
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 		);
171 171
     }
172 172
 }
173
-$export_array =  array();
173
+$export_array = array();
174 174
 if (!empty($main_result)) {
175 175
 
176 176
     $html_result .= '<table  class="data_table">';
@@ -193,9 +193,9 @@  discard block
 block discarded – undo
193 193
 
194 194
             foreach ($exercises as $exercise_id => $exercise_data) {
195 195
                 $users = $exercise_data['users'];
196
-                foreach($users as $user_id => $attempts) {
196
+                foreach ($users as $user_id => $attempts) {
197 197
                     $attempt = 1;
198
-                    foreach($attempts as $exe_id => $attempt_data) {
198
+                    foreach ($attempts as $exe_id => $attempt_data) {
199 199
                         $html_result .= '<tr colspan="">';
200 200
                         $html_result .= Display::tag('td', $course_code);
201 201
                         $html_result .= Display::tag('td', $lp_list_name[$lp_id]);
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
             }
223 223
         }
224 224
     }
225
-    $html_result .='</table>';
225
+    $html_result .= '</table>';
226 226
 }
227 227
 
228 228
 if (!$export_to_csv) {
Please login to merge, or discard this patch.
main/tracking/logins_details.php 3 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -75,13 +75,13 @@  discard block
 block discarded – undo
75 75
     // check if uid is tutor of this group
76 76
     $courseId = api_get_course_int_id();
77 77
 
78
-    if (( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse)) {
78
+    if (($is_allowedToTrack || $is_allowedToTrackEverybodyInCourse)) {
79 79
         if ($is_allowedToTrackEverybodyInCourse) {
80 80
             $sql = "SELECT u.firstname,u.lastname, u.email
81 81
                     FROM $TABLECOURSUSER cu , $TABLEUSER u
82 82
                     WHERE
83 83
                         cu.user_id = u.user_id AND
84
-                        cu.relation_type<>" . COURSE_RELATION_TYPE_RRHH . " AND
84
+                        cu.relation_type<>".COURSE_RELATION_TYPE_RRHH." AND
85 85
                         cu.c_id = '$courseId' AND
86 86
                         u.user_id = '$uInfo'";
87 87
         } else {
@@ -97,21 +97,21 @@  discard block
 block discarded – undo
97 97
             $res[2] == "" ? $res2 = get_lang('NoEmail') : $res2 = Display::encrypted_mailto_link($res[2]);
98 98
 
99 99
             echo "<tr><td>";
100
-            echo $informationsAbout . " : <br>";
100
+            echo $informationsAbout." : <br>";
101 101
             echo "<ul>\n"
102
-            . "<li>" . get_lang('FirstName') . " : " . $res[0] . "</li>\n"
103
-            . "<li>" . get_lang('LastName') . " : " . $res[1] . "</li>\n"
104
-            . "<li>" . get_lang('Email') . " : " . $res2 . "</li>\n"
102
+            . "<li>".get_lang('FirstName')." : ".$res[0]."</li>\n"
103
+            . "<li>".get_lang('LastName')." : ".$res[1]."</li>\n"
104
+            . "<li>".get_lang('Email')." : ".$res2."</li>\n"
105 105
             . "</ul>";
106 106
             echo "</td></tr>";
107 107
             /*             * ***** MENU ******* */
108 108
             echo "<tr>
109 109
                 <td>
110
-                [<a href='userLog.php?uInfo=$uInfo&view=$view'>" . get_lang('Back') . "</a>]
110
+                [<a href='userLog.php?uInfo=$uInfo&view=$view'>".get_lang('Back')."</a>]
111 111
         ";
112 112
             echo "  &nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;&nbsp;
113
-                [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=week&reqdate=$reqdate' class='specialLink'>" . get_lang('PeriodWeek') . "</a>]
114
-                [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=month&reqdate=$reqdate' class='specialLink'>" . get_lang('PeriodMonth') . "</a>]
113
+                [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=week&reqdate=$reqdate' class='specialLink'>".get_lang('PeriodWeek')."</a>]
114
+                [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=month&reqdate=$reqdate' class='specialLink'>".get_lang('PeriodMonth')."</a>]
115 115
                 &nbsp;&nbsp;&nbsp;||&nbsp;&nbsp;&nbsp;
116 116
         ";
117 117
             switch ($period) {
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
                     $previousReqDate = $reqdate - 7 * 86400;
121 121
                     $nextReqDate = $reqdate + 7 * 86400;
122 122
                     echo "
123
-                    [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=week&reqdate=$previousReqDate' class='specialLink'>" . get_lang('PreviousWeek') . "</a>]
124
-                    [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=week&reqdate=$nextReqDate' class='specialLink'>" . get_lang('NextWeek') . "</a>]
123
+                    [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=week&reqdate=$previousReqDate' class='specialLink'>".get_lang('PreviousWeek')."</a>]
124
+                    [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=week&reqdate=$nextReqDate' class='specialLink'>".get_lang('NextWeek')."</a>]
125 125
                 ";
126 126
                     break;
127 127
                 default :
@@ -132,8 +132,8 @@  discard block
 block discarded – undo
132 132
                     $previousReqDate = mktime(1, 1, 1, date("m", $reqdate) - 1, 1, date("Y", $reqdate));
133 133
                     $nextReqDate = mktime(1, 1, 1, date("m", $reqdate) + 1, 1, date("Y", $reqdate));
134 134
                     echo "
135
-                    [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=month&reqdate=$previousReqDate' class='specialLink'>" . get_lang('PreviousMonth') . "</a>]
136
-                    [<a href='" . api_get_self() . "?uInfo=$uInfo&view=$view&period=month&reqdate=$nextReqDate' class='specialLink'>" . get_lang('NextMonth') . "</a>]
135
+                    [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=month&reqdate=$previousReqDate' class='specialLink'>".get_lang('PreviousMonth')."</a>]
136
+                    [<a href='" . api_get_self()."?uInfo=$uInfo&view=$view&period=month&reqdate=$nextReqDate' class='specialLink'>".get_lang('NextMonth')."</a>]
137 137
                 ";
138 138
                     break;
139 139
             }
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
                         AND YEAR(access_date) = YEAR(FROM_UNIXTIME('$reqdate'))
154 154
                         GROUP BY DAYOFMONTH(access_date)
155 155
                         ORDER BY access_date ASC";
156
-                $displayedDate = $MonthsLong[date("n", $reqdate) - 1] . date(" Y", $reqdate);
156
+                $displayedDate = $MonthsLong[date("n", $reqdate) - 1].date(" Y", $reqdate);
157 157
                 break;
158 158
             case "week" :
159 159
                 $sql = "SELECT access_date
@@ -165,24 +165,24 @@  discard block
 block discarded – undo
165 165
                         GROUP BY DAYOFMONTH(access_date)
166 166
                         ORDER BY access_date ASC";
167 167
                 $weeklowreqdate = ($reqdate - (86400 * date("w", $reqdate)));
168
-                $weekhighreqdate = ($reqdate + (86400 * (6 - date("w", $reqdate)) ));
169
-                $displayedDate = get_lang('From') . " " . date("d ", $weeklowreqdate) . $MonthsLong[date("n", $weeklowreqdate) - 1] . date(" Y", $weeklowreqdate)
170
-                        . " " . get_lang('To') . " " . date("d ", $weekhighreqdate) . $MonthsLong[date("n", $weekhighreqdate) - 1] . date(" Y", $weekhighreqdate);
168
+                $weekhighreqdate = ($reqdate + (86400 * (6 - date("w", $reqdate))));
169
+                $displayedDate = get_lang('From')." ".date("d ", $weeklowreqdate).$MonthsLong[date("n", $weeklowreqdate) - 1].date(" Y", $weeklowreqdate)
170
+                        . " ".get_lang('To')." ".date("d ", $weekhighreqdate).$MonthsLong[date("n", $weekhighreqdate) - 1].date(" Y", $weekhighreqdate);
171 171
                 break;
172 172
         }
173 173
         echo "<tr><td>";
174 174
         $results = StatsUtils::getManyResults1Col($sql);
175 175
         /*             * * display of the displayed period  ** */
176 176
         echo "<table width='100%' cellpadding='2' cellspacing='1' border='0' align=center>";
177
-        echo "<td bgcolor='#E6E6E6'>" . $displayedDate . "</td>";
177
+        echo "<td bgcolor='#E6E6E6'>".$displayedDate."</td>";
178 178
         if (is_array($results)) {
179 179
             for ($j = 0; $j < sizeof($results); $j++) {
180 180
                 $beautifulDateTime = api_convert_and_format_date($results[$j], null, date_default_timezone_get());
181 181
                 echo "<tr>";
182
-                echo "<td style='padding-left : 40px;' valign='top'>" . $beautifulDateTime . "</td>";
182
+                echo "<td style='padding-left : 40px;' valign='top'>".$beautifulDateTime."</td>";
183 183
                 echo"</tr>";
184 184
                 // $limit is used to select only results between $results[$j] (current login) and next one
185
-                if ($j == ( sizeof($results) - 1 ))
185
+                if ($j == (sizeof($results) - 1))
186 186
                     $limit = date("Y-m-d H:i:s", $nextReqDate);
187 187
                 else
188 188
                     $limit = $results[$j + 1];
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
                         FROM $TABLETRACK_ACCESS
193 193
                         WHERE access_user_id = $uInfo
194 194
                             AND access_tool IS NOT NULL
195
-                            AND access_date > '" . $results[$j] . "'
196
-                            AND access_date < '" . $limit . "'
195
+                            AND access_date > '".$results[$j]."'
196
+                            AND access_date < '" . $limit."'
197 197
                             AND c_id = $courseId
198 198
                         GROUP BY access_tool
199 199
                         ORDER BY access_tool ASC";
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
                     echo "<table width='50%' cellpadding='0' cellspacing='0' border='0'>\n";
205 205
                     for ($k = 0; $k < count($results2); $k++) {
206 206
                         echo "<tr>\n";
207
-                        echo "<td width='70%' style='padding-left : 60px;'>" . get_lang($results2[$k][0]) . "</td>\n";
208
-                        echo "<td width='30%' align='right' style='padding-right : 40px'>" . $results2[$k][1] . " " . get_lang('Visits') . "</td>\n";
207
+                        echo "<td width='70%' style='padding-left : 60px;'>".get_lang($results2[$k][0])."</td>\n";
208
+                        echo "<td width='30%' align='right' style='padding-right : 40px'>".$results2[$k][1]." ".get_lang('Visits')."</td>\n";
209 209
                         echo "</tr>";
210 210
                     }
211 211
                     echo "</table>\n";
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
             }
216 216
         } else {
217 217
             echo "<tr>";
218
-            echo "<td colspan='2' bgcolor='#eeeeee'>" . get_lang('NoResult') . "</td>";
218
+            echo "<td colspan='2' bgcolor='#eeeeee'>".get_lang('NoResult')."</td>";
219 219
             echo "</tr>";
220 220
         }
221 221
         echo "</table>";
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -182,10 +182,11 @@
 block discarded – undo
182 182
                 echo "<td style='padding-left : 40px;' valign='top'>" . $beautifulDateTime . "</td>";
183 183
                 echo"</tr>";
184 184
                 // $limit is used to select only results between $results[$j] (current login) and next one
185
-                if ($j == ( sizeof($results) - 1 ))
186
-                    $limit = date("Y-m-d H:i:s", $nextReqDate);
187
-                else
188
-                    $limit = $results[$j + 1];
185
+                if ($j == ( sizeof($results) - 1 )) {
186
+                                    $limit = date("Y-m-d H:i:s", $nextReqDate);
187
+                } else {
188
+                                    $limit = $results[$j + 1];
189
+                }
189 190
                 // select all access to tool between displayed date and next displayed date or now() if
190 191
                 // displayed date is the last login date
191 192
                 $sql = "SELECT access_tool, count(access_tool)
Please login to merge, or discard this patch.
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,6 @@
 block discarded – undo
7 7
  * 	@author Sebastien Piraux
8 8
  *
9 9
  * 	@package chamilo.tracking
10
-
11 10
  */
12 11
 /**
13 12
  * Code
Please login to merge, or discard this patch.
main/tracking/course_log_groups.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
 $action_links = '
100 100
 function action_formatter(cellvalue, options, rowObject) {
101
-    return \'<a href="course_log_tools.php?id_session=0&cidReq='.$course_code.'&gidReq=\'+options.rowId+\'">'.Display::return_icon('2rightarrow.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'.
101
+    return \'<a href="course_log_tools.php?id_session=0&cidReq='.$course_code.'&gidReq=\'+options.rowId+\'">'.Display::return_icon('2rightarrow.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'.
102 102
     '\';
103 103
 }';
104 104
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 $htmlHeadXtra[] = '
109 109
 <script>
110 110
 $(function() {
111
-    '.Display::grid_js('group_users',$url, $columns, $column_model, $extra_params, array(), $action_links, true).'
111
+    '.Display::grid_js('group_users', $url, $columns, $column_model, $extra_params, array(), $action_links, true).'
112 112
 });
113 113
 </script>';
114 114
 
Please login to merge, or discard this patch.