Completed
Push — master ( 8be9e6...40c911 )
by Angel Fernando Quiroz
76:02 queued 40:43
created
main/auth/sso/sso.class.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@
 block discarded – undo
80 80
 
81 81
     /**
82 82
      * Validates the received active connection data with the database
83
-     * @return	bool	Return the loginFailed variable value to local.inc.php
83
+     * @return	null|false	Return the loginFailed variable value to local.inc.php
84 84
      */
85 85
     public function check_user()
86 86
     {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      */
35 35
     public function __construct()
36 36
     {
37
-        $this->protocol   = api_get_setting('sso_authentication_protocol');
37
+        $this->protocol = api_get_setting('sso_authentication_protocol');
38 38
         // There can be multiple domains, so make sure to take only the first
39 39
         // This might be later extended with a decision process
40 40
         $domains = explode(',', api_get_setting('sso_authentication_domain'));
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         $this->auth_uri = api_get_setting('sso_authentication_auth_uri');
43 43
         $this->deauth_uri = api_get_setting('sso_authentication_unauth_uri');
44 44
         //cut the string to avoid recursive URL construction in case of failure
45
-        $this->referer = $this->protocol.$_SERVER['HTTP_HOST'].substr($_SERVER['REQUEST_URI'],0,strpos($_SERVER['REQUEST_URI'],'sso'));
45
+        $this->referer = $this->protocol.$_SERVER['HTTP_HOST'].substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], 'sso'));
46 46
         $this->deauth_url = $this->protocol.$this->domain.$this->deauth_uri;
47 47
         $this->master_url = $this->protocol.$this->domain.$this->auth_uri;
48 48
         $this->referrer_uri = base64_encode($_SERVER['REQUEST_URI']);
@@ -130,11 +130,11 @@  discard block
 block discarded – undo
130 130
                 ) {
131 131
                     //error_log('user n password are ok');
132 132
                     //Check if the account is active (not locked)
133
-                    if ($uData['active']=='1') {
133
+                    if ($uData['active'] == '1') {
134 134
                         // check if the expiration date has not been reached
135 135
                         if (empty($uData['expiration_date'])
136 136
                             or $uData['expiration_date'] > date('Y-m-d H:i:s')
137
-                            or $uData['expiration_date']=='0000-00-00 00:00:00') {
137
+                            or $uData['expiration_date'] == '0000-00-00 00:00:00') {
138 138
 
139 139
                             //If Multiple URL is enabled
140 140
                             if (api_get_multiple_access_url()) {
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
                                             // the user credentials are OK, which
169 169
                                             // should be protection enough
170 170
                                             // against evil URL spoofing...
171
-                                            $sso_target = api_get_path(WEB_PATH) . base64_decode($sso['ruri']);
171
+                                            $sso_target = api_get_path(WEB_PATH).base64_decode($sso['ruri']);
172 172
                                         } else {
173
-                                            $sso_target = isset($sso['target']) ? $sso['target'] : api_get_path(WEB_PATH) . 'index.php';
173
+                                            $sso_target = isset($sso['target']) ? $sso['target'] : api_get_path(WEB_PATH).'index.php';
174 174
                                         }
175
-                                        header('Location: '. $sso_target);
175
+                                        header('Location: '.$sso_target);
176 176
                                         exit;
177 177
                                     } else {
178 178
                                         // user does not have permission for this site
@@ -286,9 +286,9 @@  discard block
 block discarded – undo
286 286
         $userId = intval($userId);
287 287
 
288 288
         if ($asAdmin && api_is_platform_admin(true)) {
289
-            return api_get_path(WEB_CODE_PATH) . "admin/user_edit.php?user_id=$userId";
289
+            return api_get_path(WEB_CODE_PATH)."admin/user_edit.php?user_id=$userId";
290 290
         }
291 291
 
292
-        return api_get_path(WEB_CODE_PATH) . 'auth/profile.php';
292
+        return api_get_path(WEB_CODE_PATH).'auth/profile.php';
293 293
     }
294 294
 }
Please login to merge, or discard this patch.
main/coursecopy/copy_course_session.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -47,6 +47,9 @@
 block discarded – undo
47 47
 
48 48
 /* FUNCTIONS */
49 49
 
50
+/**
51
+ * @param string $name
52
+ */
50 53
 function make_select_session_list($name, $sessions, $attr = array())
51 54
 {
52 55
     $attributes = '';
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
 function display_form()
87 87
 {
88
-    $html  = '';
88
+    $html = '';
89 89
     $sessions = SessionManager::get_sessions_list(array(), array('name', 'ASC'));
90 90
 
91 91
     // Link back to the documents overview
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
     //destination
111 111
     $html .= '<div class="form-group">';
112
-    $html .= '<label class="col-sm-2 control-label">' . get_lang('DestinationCoursesFromSession') . ': </label>';
112
+    $html .= '<label class="col-sm-2 control-label">'.get_lang('DestinationCoursesFromSession').': </label>';
113 113
     $html .= '<div class="col-sm-5" id="ajax_sessions_list_destination">';
114 114
     $html .= '<select class="form-control" name="sessions_list_destination" onchange="javascript: xajax_search_courses(this.value,\'destination\');">';
115 115
     $html .= '<option value = "0">'.get_lang('ThereIsNotStillASession').'</option></select ></div>';
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     $html .= '<button class="btn btn-success" type="submit" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES))."'".')) return false;"><em class="fa fa-files-o"></em> '.get_lang('CopyCourse').'</button>';
132 132
 
133 133
     // Add Security token
134
-    $html .= '<input type="hidden" value="' . Security::get_token() . '" name="sec_token">';
134
+    $html .= '<input type="hidden" value="'.Security::get_token().'" name="sec_token">';
135 135
     $html .= '</div></div>';
136 136
     $html .= '</form>';
137 137
 
Please login to merge, or discard this patch.
main/document/downloadfolder.inc.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -327,7 +327,7 @@
 block discarded – undo
327 327
  * @param array $arr1 first array
328 328
  * @param array $arr2 second array
329 329
  *
330
- * @return array difference between the two arrays
330
+ * @return string difference between the two arrays
331 331
  */
332 332
 function diff($arr1, $arr2)
333 333
 {
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
 // A student should not be able to download a root shared directory
53 53
 if (($path == '/shared_folder' ||
54
-    $path == '/shared_folder_session_' . api_get_session_id()) &&
54
+    $path == '/shared_folder_session_'.api_get_session_id()) &&
55 55
     (!api_is_allowed_to_edit() || !api_is_platform_admin())
56 56
 ) {
57 57
     api_not_allowed(true);
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
                 (props.session_id IN ('0', '$sessionId') OR props.session_id IS NULL) AND
150 150
                 docs.c_id = ".$courseId." ";
151 151
 
152
-    $sql.= DocumentManager::getSessionFolderFilters($querypath, $sessionId);
152
+    $sql .= DocumentManager::getSessionFolderFilters($querypath, $sessionId);
153 153
 
154 154
     $result = Database::query($sql);
155 155
 
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
                 $groupCondition
215 215
             ";
216 216
 
217
-    $sql.= DocumentManager::getSessionFolderFilters($querypath, $sessionId);
217
+    $sql .= DocumentManager::getSessionFolderFilters($querypath, $sessionId);
218 218
     $result = Database::query($sql);
219 219
 
220 220
     $files = array();
@@ -294,9 +294,9 @@  discard block
 block discarded – undo
294 294
     // Add all files in our final array to the zipfile
295 295
     for ($i = 0; $i < count($files_for_zipfile); $i++) {
296 296
         $zip->add(
297
-            $sysCoursePath . $courseInfo['path'] . '/document' . $files_for_zipfile[$i],
297
+            $sysCoursePath.$courseInfo['path'].'/document'.$files_for_zipfile[$i],
298 298
             PCLZIP_OPT_REMOVE_PATH,
299
-            $sysCoursePath . $courseInfo['path'] . '/document' . $remove_dir,
299
+            $sysCoursePath.$courseInfo['path'].'/document'.$remove_dir,
300 300
             PCLZIP_CB_PRE_ADD,
301 301
             'fixDocumentNameCallback'
302 302
         );
Please login to merge, or discard this patch.
main/gradebook/lib/be/learnpathlink.class.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@
 block discarded – undo
95 95
 
96 96
 	/**
97 97
 	 * Get the progress of this learnpath. Only the last attempt are taken into account.
98
-	 * @param $stud_id student id (default: all students who have results - then the average is returned)
98
+	 * @param integer $stud_id student id (default: all students who have results - then the average is returned)
99 99
 	 * @return	array (score, max) if student is given
100 100
 	 * 			array (sum of scores, number of scores) otherwise
101 101
 	 * 			or null if no scores available
Please login to merge, or discard this patch.
Indentation   +243 added lines, -243 removed lines patch added patch discarded remove patch
@@ -9,261 +9,261 @@
 block discarded – undo
9 9
  */
10 10
 class LearnpathLink extends AbstractLink
11 11
 {
12
-	private $course_info = null;
13
-	private $learnpath_table = null;
14
-	private $learnpath_data = null;
15
-
16
-	/**
17
-	 * Constructor
18
-	 */
19
-	public function __construct()
20
-	{
21
-		parent::__construct();
22
-		$this->set_type(LINK_LEARNPATH);
23
-	}
24
-
25
-	/**
26
-	 * Generate an array of learnpaths that a teacher hasn't created a link for.
27
-	 * @return array 2-dimensional array - every element contains 2 subelements (id, name)
28
-	 */
29
-	public function get_not_created_links()
30
-	{
31
-		return false;
32
-		if (empty($this->course_code))
33
-			die('Error in get_not_created_links() : course code not set');
34
-
35
-		$tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
36
-
37
-		$sql = 'SELECT id, name from '.$this->get_learnpath_table().' lp
12
+    private $course_info = null;
13
+    private $learnpath_table = null;
14
+    private $learnpath_data = null;
15
+
16
+    /**
17
+     * Constructor
18
+     */
19
+    public function __construct()
20
+    {
21
+        parent::__construct();
22
+        $this->set_type(LINK_LEARNPATH);
23
+    }
24
+
25
+    /**
26
+     * Generate an array of learnpaths that a teacher hasn't created a link for.
27
+     * @return array 2-dimensional array - every element contains 2 subelements (id, name)
28
+     */
29
+    public function get_not_created_links()
30
+    {
31
+        return false;
32
+        if (empty($this->course_code))
33
+            die('Error in get_not_created_links() : course code not set');
34
+
35
+        $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
36
+
37
+        $sql = 'SELECT id, name from '.$this->get_learnpath_table().' lp
38 38
 				WHERE c_id = '.$this->course_id.' AND id NOT IN '
39
-			.' (SELECT ref_id FROM '.$tbl_grade_links
40
-			.' WHERE type = '.LINK_LEARNPATH
41
-			." AND course_code = '".$this->get_course_code()."'"
42
-			.') AND lp.session_id='.api_get_session_id().'';
43
-
44
-		$result = Database::query($sql);
45
-
46
-		$cats=array();
47
-		while ($data=Database::fetch_array($result)) {
48
-			$cats[] = array ($data['id'], $data['name']);
49
-		}
50
-
51
-		return $cats;
52
-	}
53
-
54
-	/**
55
-	 * Generate an array of all learnpaths available.
56
-	 * @return array 2-dimensional array - every element contains 2 subelements (id, name)
57
-	 */
58
-	public function get_all_links()
59
-	{
60
-		if (empty($this->course_code))
61
-			die('Error in get_not_created_links() : course code not set');
62
-
63
-		$session_id = api_get_session_id();
64
-		if (empty($session_id)) {
65
-			$session_condition = api_get_session_condition(0, true);
66
-		} else {
67
-			$session_condition = api_get_session_condition($session_id, true, true);
68
-		}
69
-
70
-		$sql = 'SELECT id, name FROM '.$this->get_learnpath_table().'
39
+            .' (SELECT ref_id FROM '.$tbl_grade_links
40
+            .' WHERE type = '.LINK_LEARNPATH
41
+            ." AND course_code = '".$this->get_course_code()."'"
42
+            .') AND lp.session_id='.api_get_session_id().'';
43
+
44
+        $result = Database::query($sql);
45
+
46
+        $cats=array();
47
+        while ($data=Database::fetch_array($result)) {
48
+            $cats[] = array ($data['id'], $data['name']);
49
+        }
50
+
51
+        return $cats;
52
+    }
53
+
54
+    /**
55
+     * Generate an array of all learnpaths available.
56
+     * @return array 2-dimensional array - every element contains 2 subelements (id, name)
57
+     */
58
+    public function get_all_links()
59
+    {
60
+        if (empty($this->course_code))
61
+            die('Error in get_not_created_links() : course code not set');
62
+
63
+        $session_id = api_get_session_id();
64
+        if (empty($session_id)) {
65
+            $session_condition = api_get_session_condition(0, true);
66
+        } else {
67
+            $session_condition = api_get_session_condition($session_id, true, true);
68
+        }
69
+
70
+        $sql = 'SELECT id, name FROM '.$this->get_learnpath_table().'
71 71
                 WHERE c_id = '.$this->course_id.' '.$session_condition.' ';
72
-		$result = Database::query($sql);
72
+        $result = Database::query($sql);
73 73
 
74
-		$cats = array();
75
-		while ($data=Database::fetch_array($result)) {
76
-			$cats[] = array ($data['id'], $data['name']);
77
-		}
74
+        $cats = array();
75
+        while ($data=Database::fetch_array($result)) {
76
+            $cats[] = array ($data['id'], $data['name']);
77
+        }
78 78
 
79
-		return $cats;
80
-	}
79
+        return $cats;
80
+    }
81 81
 
82 82
 
83
-	/**
84
-	 * Has anyone used this learnpath yet ?
85
-	 */
86
-	public function has_results()
87
-	{
88
-		$tbl_stats = Database::get_course_table(TABLE_LP_VIEW);
89
-		$sql = "SELECT count(id) AS number FROM $tbl_stats
83
+    /**
84
+     * Has anyone used this learnpath yet ?
85
+     */
86
+    public function has_results()
87
+    {
88
+        $tbl_stats = Database::get_course_table(TABLE_LP_VIEW);
89
+        $sql = "SELECT count(id) AS number FROM $tbl_stats
90 90
 				WHERE c_id = ".$this->course_id." AND lp_id = ".$this->get_ref_id();
91
-		$result = Database::query($sql);
92
-		$number = Database::fetch_array($result,'NUM');
93
-		return ($number[0] != 0);
94
-	}
95
-
96
-	/**
97
-	 * Get the progress of this learnpath. Only the last attempt are taken into account.
98
-	 * @param $stud_id student id (default: all students who have results - then the average is returned)
99
-	 * @return	array (score, max) if student is given
100
-	 * 			array (sum of scores, number of scores) otherwise
101
-	 * 			or null if no scores available
102
-	 */
103
-	public function calc_score($stud_id = null, $type = null)
104
-	{
105
-		$tbl_stats = Database::get_course_table(TABLE_LP_VIEW);
106
-		$session_id = api_get_session_id();
107
-
108
-		$sql = "SELECT * FROM $tbl_stats
91
+        $result = Database::query($sql);
92
+        $number = Database::fetch_array($result,'NUM');
93
+        return ($number[0] != 0);
94
+    }
95
+
96
+    /**
97
+     * Get the progress of this learnpath. Only the last attempt are taken into account.
98
+     * @param $stud_id student id (default: all students who have results - then the average is returned)
99
+     * @return	array (score, max) if student is given
100
+     * 			array (sum of scores, number of scores) otherwise
101
+     * 			or null if no scores available
102
+     */
103
+    public function calc_score($stud_id = null, $type = null)
104
+    {
105
+        $tbl_stats = Database::get_course_table(TABLE_LP_VIEW);
106
+        $session_id = api_get_session_id();
107
+
108
+        $sql = "SELECT * FROM $tbl_stats
109 109
                 WHERE
110 110
                 	c_id = ".$this->course_id." AND
111 111
                     lp_id = ".$this->get_ref_id()." AND
112 112
                     session_id = $session_id ";
113 113
 
114
-		if (isset($stud_id))
115
-			$sql .= ' AND user_id = '.intval($stud_id);
116
-
117
-		// order by id, that way the student's first attempt is accessed first
118
-		$sql .= ' ORDER BY view_count DESC';
119
-
120
-		$scores = Database::query($sql);
121
-		// for 1 student
122
-		if (isset($stud_id)) {
123
-			if ($data = Database::fetch_assoc($scores)) {
124
-				return array ($data['progress'], 100);
125
-			} else
126
-				return null;
127
-		} else {
128
-			// all students -> get average
129
-			$students = array();  // user list, needed to make sure we only
130
-			// take first attempts into account
131
-			$rescount = 0;
132
-			$sum = 0;
133
-			$bestResult = 0;
134
-			$sumResult = 0;
135
-			while ($data = Database::fetch_array($scores)) {
136
-				if (!(array_key_exists($data['user_id'], $students))) {
137
-					$students[$data['user_id']] = $data['progress'];
138
-					$rescount++;
139
-					$sum += $data['progress'] / 100;
140
-					$sumResult += $data['progress'];
141
-
142
-					if ($data['progress'] > $bestResult) {
143
-						$bestResult = $data['progress'];
144
-					}
145
-				}
146
-			}
147
-
148
-			if ($rescount == 0) {
149
-				return null;
150
-			} else {
151
-
152
-				switch ($type) {
153
-					case 'best':
154
-						return array($bestResult, 100);
155
-						break;
156
-					case 'average':
157
-						return array($sumResult/$rescount, 100);
158
-						break;
159
-					case 'ranking':
160
-						return AbstractLink::getCurrentUserRanking($stud_id, $students);
161
-						break;
162
-					default:
163
-						return array($sum, $rescount);
164
-						break;
165
-				}
166
-			}
167
-		}
168
-	}
169
-
170
-	/**
171
-	 * Get URL where to go to if the user clicks on the link.
172
-	 */
173
-	public function get_link()
174
-	{
175
-		$session_id = api_get_session_id();
176
-		$url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq_params($this->get_course_code(), $session_id).'&gradebook=view';
177
-
178
-		if (!api_is_allowed_to_edit() || $this->calc_score(api_get_user_id()) == null) {
179
-			$url .= '&action=view&lp_id='.$this->get_ref_id();
180
-		} else {
181
-			$url .= '&action=build&lp_id='.$this->get_ref_id();
182
-		}
183
-		return $url;
184
-	}
185
-
186
-	/**
187
-	 * Get name to display: same as learnpath title
188
-	 */
189
-	public function get_name()
190
-	{
191
-		$data = $this->get_learnpath_data();
192
-		return $data['name'];
193
-	}
194
-
195
-	/**
196
-	 * Get description to display: same as learnpath description
197
-	 */
198
-	public function get_description()
199
-	{
200
-		$data = $this->get_learnpath_data();
201
-		return $data['description'];
202
-	}
203
-
204
-	/**
205
-	 * Check if this still links to a learnpath
206
-	 */
207
-	public function is_valid_link() {
208
-		$sql = 'SELECT count(id) FROM '.$this->get_learnpath_table().'
114
+        if (isset($stud_id))
115
+            $sql .= ' AND user_id = '.intval($stud_id);
116
+
117
+        // order by id, that way the student's first attempt is accessed first
118
+        $sql .= ' ORDER BY view_count DESC';
119
+
120
+        $scores = Database::query($sql);
121
+        // for 1 student
122
+        if (isset($stud_id)) {
123
+            if ($data = Database::fetch_assoc($scores)) {
124
+                return array ($data['progress'], 100);
125
+            } else
126
+                return null;
127
+        } else {
128
+            // all students -> get average
129
+            $students = array();  // user list, needed to make sure we only
130
+            // take first attempts into account
131
+            $rescount = 0;
132
+            $sum = 0;
133
+            $bestResult = 0;
134
+            $sumResult = 0;
135
+            while ($data = Database::fetch_array($scores)) {
136
+                if (!(array_key_exists($data['user_id'], $students))) {
137
+                    $students[$data['user_id']] = $data['progress'];
138
+                    $rescount++;
139
+                    $sum += $data['progress'] / 100;
140
+                    $sumResult += $data['progress'];
141
+
142
+                    if ($data['progress'] > $bestResult) {
143
+                        $bestResult = $data['progress'];
144
+                    }
145
+                }
146
+            }
147
+
148
+            if ($rescount == 0) {
149
+                return null;
150
+            } else {
151
+
152
+                switch ($type) {
153
+                    case 'best':
154
+                        return array($bestResult, 100);
155
+                        break;
156
+                    case 'average':
157
+                        return array($sumResult/$rescount, 100);
158
+                        break;
159
+                    case 'ranking':
160
+                        return AbstractLink::getCurrentUserRanking($stud_id, $students);
161
+                        break;
162
+                    default:
163
+                        return array($sum, $rescount);
164
+                        break;
165
+                }
166
+            }
167
+        }
168
+    }
169
+
170
+    /**
171
+     * Get URL where to go to if the user clicks on the link.
172
+     */
173
+    public function get_link()
174
+    {
175
+        $session_id = api_get_session_id();
176
+        $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq_params($this->get_course_code(), $session_id).'&gradebook=view';
177
+
178
+        if (!api_is_allowed_to_edit() || $this->calc_score(api_get_user_id()) == null) {
179
+            $url .= '&action=view&lp_id='.$this->get_ref_id();
180
+        } else {
181
+            $url .= '&action=build&lp_id='.$this->get_ref_id();
182
+        }
183
+        return $url;
184
+    }
185
+
186
+    /**
187
+     * Get name to display: same as learnpath title
188
+     */
189
+    public function get_name()
190
+    {
191
+        $data = $this->get_learnpath_data();
192
+        return $data['name'];
193
+    }
194
+
195
+    /**
196
+     * Get description to display: same as learnpath description
197
+     */
198
+    public function get_description()
199
+    {
200
+        $data = $this->get_learnpath_data();
201
+        return $data['description'];
202
+    }
203
+
204
+    /**
205
+     * Check if this still links to a learnpath
206
+     */
207
+    public function is_valid_link() {
208
+        $sql = 'SELECT count(id) FROM '.$this->get_learnpath_table().'
209 209
                 WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' ';
210
-		$result = Database::query($sql);
211
-		$number = Database::fetch_row($result,'NUM');
212
-		return ($number[0] != 0);
213
-	}
214
-
215
-	public function get_type_name()
216
-	{
217
-		return get_lang('LearningPaths');
218
-	}
219
-
220
-	public function needs_name_and_description()
221
-	{
222
-		return false;
223
-	}
224
-
225
-	public function needs_max()
226
-	{
227
-		return false;
228
-	}
229
-
230
-	public function needs_results()
231
-	{
232
-		return false;
233
-	}
234
-
235
-	public function is_allowed_to_change_name()
236
-	{
237
-		return false;
238
-	}
239
-
240
-	// INTERNAL FUNCTIONS
241
-
242
-	/**
243
-	 * Lazy load function to get the database table of the learnpath
244
-	 */
245
-	private function get_learnpath_table()
246
-	{
247
-		$this->learnpath_table = Database :: get_course_table(TABLE_LP_MAIN);
248
-		return $this->learnpath_table;
249
-	}
250
-
251
-	/**
252
-	 * Lazy load function to get the database contents of this learnpath
253
-	 */
254
-	private function get_learnpath_data()
255
-	{
256
-		if (!isset($this->learnpath_data)) {
257
-			$sql = 'SELECT * FROM '.$this->get_learnpath_table().'
210
+        $result = Database::query($sql);
211
+        $number = Database::fetch_row($result,'NUM');
212
+        return ($number[0] != 0);
213
+    }
214
+
215
+    public function get_type_name()
216
+    {
217
+        return get_lang('LearningPaths');
218
+    }
219
+
220
+    public function needs_name_and_description()
221
+    {
222
+        return false;
223
+    }
224
+
225
+    public function needs_max()
226
+    {
227
+        return false;
228
+    }
229
+
230
+    public function needs_results()
231
+    {
232
+        return false;
233
+    }
234
+
235
+    public function is_allowed_to_change_name()
236
+    {
237
+        return false;
238
+    }
239
+
240
+    // INTERNAL FUNCTIONS
241
+
242
+    /**
243
+     * Lazy load function to get the database table of the learnpath
244
+     */
245
+    private function get_learnpath_table()
246
+    {
247
+        $this->learnpath_table = Database :: get_course_table(TABLE_LP_MAIN);
248
+        return $this->learnpath_table;
249
+    }
250
+
251
+    /**
252
+     * Lazy load function to get the database contents of this learnpath
253
+     */
254
+    private function get_learnpath_data()
255
+    {
256
+        if (!isset($this->learnpath_data)) {
257
+            $sql = 'SELECT * FROM '.$this->get_learnpath_table().'
258 258
                     WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' ';
259
-			$result = Database::query($sql);
260
-			$this->learnpath_data = Database::fetch_array($result);
261
-		}
262
-		return $this->learnpath_data;
263
-	}
264
-
265
-	public function get_icon_name()
266
-	{
267
-		return 'learnpath';
268
-	}
259
+            $result = Database::query($sql);
260
+            $this->learnpath_data = Database::fetch_array($result);
261
+        }
262
+        return $this->learnpath_data;
263
+    }
264
+
265
+    public function get_icon_name()
266
+    {
267
+        return 'learnpath';
268
+    }
269 269
 }
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 
44 44
 		$result = Database::query($sql);
45 45
 
46
-		$cats=array();
47
-		while ($data=Database::fetch_array($result)) {
48
-			$cats[] = array ($data['id'], $data['name']);
46
+		$cats = array();
47
+		while ($data = Database::fetch_array($result)) {
48
+			$cats[] = array($data['id'], $data['name']);
49 49
 		}
50 50
 
51 51
 		return $cats;
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 		$result = Database::query($sql);
73 73
 
74 74
 		$cats = array();
75
-		while ($data=Database::fetch_array($result)) {
76
-			$cats[] = array ($data['id'], $data['name']);
75
+		while ($data = Database::fetch_array($result)) {
76
+			$cats[] = array($data['id'], $data['name']);
77 77
 		}
78 78
 
79 79
 		return $cats;
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 		$sql = "SELECT count(id) AS number FROM $tbl_stats
90 90
 				WHERE c_id = ".$this->course_id." AND lp_id = ".$this->get_ref_id();
91 91
 		$result = Database::query($sql);
92
-		$number = Database::fetch_array($result,'NUM');
92
+		$number = Database::fetch_array($result, 'NUM');
93 93
 		return ($number[0] != 0);
94 94
 	}
95 95
 
@@ -121,12 +121,12 @@  discard block
 block discarded – undo
121 121
 		// for 1 student
122 122
 		if (isset($stud_id)) {
123 123
 			if ($data = Database::fetch_assoc($scores)) {
124
-				return array ($data['progress'], 100);
124
+				return array($data['progress'], 100);
125 125
 			} else
126 126
 				return null;
127 127
 		} else {
128 128
 			// all students -> get average
129
-			$students = array();  // user list, needed to make sure we only
129
+			$students = array(); // user list, needed to make sure we only
130 130
 			// take first attempts into account
131 131
 			$rescount = 0;
132 132
 			$sum = 0;
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 						return array($bestResult, 100);
155 155
 						break;
156 156
 					case 'average':
157
-						return array($sumResult/$rescount, 100);
157
+						return array($sumResult / $rescount, 100);
158 158
 						break;
159 159
 					case 'ranking':
160 160
 						return AbstractLink::getCurrentUserRanking($stud_id, $students);
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	public function get_link()
174 174
 	{
175 175
 		$session_id = api_get_session_id();
176
-		$url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq_params($this->get_course_code(), $session_id).'&gradebook=view';
176
+		$url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq_params($this->get_course_code(), $session_id).'&gradebook=view';
177 177
 
178 178
 		if (!api_is_allowed_to_edit() || $this->calc_score(api_get_user_id()) == null) {
179 179
 			$url .= '&action=view&lp_id='.$this->get_ref_id();
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 		$sql = 'SELECT count(id) FROM '.$this->get_learnpath_table().'
209 209
                 WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' ';
210 210
 		$result = Database::query($sql);
211
-		$number = Database::fetch_row($result,'NUM');
211
+		$number = Database::fetch_row($result, 'NUM');
212 212
 		return ($number[0] != 0);
213 213
 	}
214 214
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,8 +29,9 @@  discard block
 block discarded – undo
29 29
 	public function get_not_created_links()
30 30
 	{
31 31
 		return false;
32
-		if (empty($this->course_code))
33
-			die('Error in get_not_created_links() : course code not set');
32
+		if (empty($this->course_code)) {
33
+					die('Error in get_not_created_links() : course code not set');
34
+		}
34 35
 
35 36
 		$tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
36 37
 
@@ -57,8 +58,9 @@  discard block
 block discarded – undo
57 58
 	 */
58 59
 	public function get_all_links()
59 60
 	{
60
-		if (empty($this->course_code))
61
-			die('Error in get_not_created_links() : course code not set');
61
+		if (empty($this->course_code)) {
62
+					die('Error in get_not_created_links() : course code not set');
63
+		}
62 64
 
63 65
 		$session_id = api_get_session_id();
64 66
 		if (empty($session_id)) {
@@ -111,8 +113,9 @@  discard block
 block discarded – undo
111 113
                     lp_id = ".$this->get_ref_id()." AND
112 114
                     session_id = $session_id ";
113 115
 
114
-		if (isset($stud_id))
115
-			$sql .= ' AND user_id = '.intval($stud_id);
116
+		if (isset($stud_id)) {
117
+					$sql .= ' AND user_id = '.intval($stud_id);
118
+		}
116 119
 
117 120
 		// order by id, that way the student's first attempt is accessed first
118 121
 		$sql .= ' ORDER BY view_count DESC';
@@ -122,8 +125,9 @@  discard block
 block discarded – undo
122 125
 		if (isset($stud_id)) {
123 126
 			if ($data = Database::fetch_assoc($scores)) {
124 127
 				return array ($data['progress'], 100);
125
-			} else
126
-				return null;
128
+			} else {
129
+							return null;
130
+			}
127 131
 		} else {
128 132
 			// all students -> get average
129 133
 			$students = array();  // user list, needed to make sure we only
Please login to merge, or discard this patch.
main/gradebook/lib/fe/gradebooktable.class.php 3 patches
Doc Comments   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,6 +32,8 @@  discard block
 block discarded – undo
32 32
      * @param array $evals
33 33
      * @param array $links
34 34
      * @param null $addparams
35
+     * @param boolean $showTeacherView
36
+     * @param integer $userId
35 37
      */
36 38
     public function __construct(
37 39
         $currentcat,
@@ -895,7 +897,7 @@  discard block
 block discarded – undo
895 897
 
896 898
     /**
897 899
      * @param $item
898
-     * @return mixed
900
+     * @return string|null
899 901
      */
900 902
     private function build_course_code($item)
901 903
     {
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -256,10 +256,11 @@
 block discarded – undo
256 256
         }
257 257
 
258 258
         // Categories.
259
-        if (!empty($data_array))
260
-        foreach ($data_array as $data) {
259
+        if (!empty($data_array)) {
260
+                foreach ($data_array as $data) {
261 261
             // list of items inside the gradebook (exercises, lps, forums, etc)
262 262
             $row  = array();
263
+        }
263 264
             /** @var AbstractLink $item */
264 265
             $item = $mainCategory = $data[0];
265 266
 
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             $this->set_additional_parameters($addparams);
72 72
         }
73 73
 
74
-        $column= 0;
74
+        $column = 0;
75 75
         if ($this->teacherView) {
76 76
             if ($this->exportToPdf == false) {
77 77
                 $this->set_header($column++, '', '', 'width="25px"');
@@ -281,13 +281,13 @@  discard block
 block discarded – undo
281 281
                 $main_categories[$item->get_id()]['name'] = $item->get_name();
282 282
             } else {
283 283
                 $name = $this->build_name_link($item, $type);
284
-                $row[] = $invisibility_span_open.$name. $invisibility_span_close;
284
+                $row[] = $invisibility_span_open.$name.$invisibility_span_close;
285 285
                 $main_categories[$item->get_id()]['name'] = $name;
286 286
             }
287 287
 
288 288
             $this->dataForGraph['categories'][] = $item->get_name();
289 289
 
290
-            $main_categories[$item->get_id()]['weight']= $item->get_weight();
290
+            $main_categories[$item->get_id()]['weight'] = $item->get_weight();
291 291
             $total_categories_weight += $item->get_weight();
292 292
 
293 293
             // Description.
@@ -307,9 +307,9 @@  discard block
 block discarded – undo
307 307
             );
308 308
 
309 309
             if ($this->teacherView) {
310
-                $row[] = $invisibility_span_open .Display::tag('p', $weight, array('class' => 'score')).$invisibility_span_close;
310
+                $row[] = $invisibility_span_open.Display::tag('p', $weight, array('class' => 'score')).$invisibility_span_close;
311 311
             } else {
312
-                $row[] = $invisibility_span_open .$weight.$invisibility_span_close;
312
+                $row[] = $invisibility_span_open.$weight.$invisibility_span_close;
313 313
             }
314 314
 
315 315
             $category_weight = $item->get_weight();
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 
336 336
                 if (!empty($score[1])) {
337 337
                     $completeScore = $scoredisplay->display_score($score, SCORE_DIV_PERCENT);
338
-                    $score = $score[0]/$score[1]*$item->get_weight();
338
+                    $score = $score[0] / $score[1] * $item->get_weight();
339 339
                     $score = $scoredisplay->display_score(array($score, null), SCORE_SIMPLE);
340 340
                     $scoreToDisplay = Display::tip($score, $completeScore);
341 341
                 } else {
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
                         $row[] = $this->build_type_column($item, array('style' => 'padding-left:5px'));
454 454
 
455 455
                         // Name.
456
-                        $row[] = $invisibility_span_open."&nbsp;&nbsp;&nbsp;  ".$this->build_name_link($item, $type) . $invisibility_span_close;
456
+                        $row[] = $invisibility_span_open."&nbsp;&nbsp;&nbsp;  ".$this->build_name_link($item, $type).$invisibility_span_close;
457 457
 
458 458
                         // Description.
459 459
                         if ($this->exportToPdf == false) {
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
                             // Students get the results and certificates columns
492 492
                             $eval_n_links = array_merge($alleval, $alllink);
493 493
 
494
-                            if (count($eval_n_links)> 0) {
494
+                            if (count($eval_n_links) > 0) {
495 495
                                 $value_data = isset($data[4]) ? $data[4] : null;
496 496
                                 if (!is_null($value_data)) {
497 497
                                     //$score = $item->calc_score(api_get_user_id());
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
                 $row = array(
588 588
                     null,
589 589
                     null,
590
-                    '<strong>' . get_lang('Total') . '</strong>',
590
+                    '<strong>'.get_lang('Total').'</strong>',
591 591
                     null,
592 592
                     $total
593 593
                 );
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
                 if ($this->exportToPdf) {
658 658
                     $row = array(
659 659
                         null,
660
-                        '<h3>' . get_lang('Total') . '</h3>',
660
+                        '<h3>'.get_lang('Total').'</h3>',
661 661
                         $main_weight,
662 662
                         $totalResult,
663 663
                         $totalRanking,
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
                 } else {
668 668
                     $row = array(
669 669
                         null,
670
-                        '<h3>' . get_lang('Total') . '</h3>',
670
+                        '<h3>'.get_lang('Total').'</h3>',
671 671
                         null,
672 672
                         $main_weight,
673 673
                         $totalResult,
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
         }
683 683
 
684 684
         // Warning messages
685
-        $view = isset($_GET['view']) ? $_GET['view']: null;
685
+        $view = isset($_GET['view']) ? $_GET['view'] : null;
686 686
 
687 687
         if ($this->teacherView) {
688 688
             if (isset($_GET['selectcat']) &&
@@ -693,14 +693,14 @@  discard block
 block discarded – undo
693 693
                 $category = Category::load($id_cat);
694 694
                 $weight_category = intval($this->build_weight($category[0]));
695 695
                 $course_code = $this->build_course_code($category[0]);
696
-                $weight_total_links  = round($weight_total_links);
696
+                $weight_total_links = round($weight_total_links);
697 697
 
698 698
                 if ($weight_total_links > $weight_category ||
699 699
                     $weight_total_links < $weight_category ||
700 700
                     $weight_total_links > $weight_category
701 701
                 ) {
702 702
                     $warning_message = sprintf(get_lang('TotalWeightMustBeX'), $weight_category);
703
-                    $modify_icons  = '<a href="gradebook_edit_cat.php?editcat='.$id_cat.'&cidReq='.$course_code.'&id_session='.api_get_session_id().'">'.
703
+                    $modify_icons = '<a href="gradebook_edit_cat.php?editcat='.$id_cat.'&cidReq='.$course_code.'&id_session='.api_get_session_id().'">'.
704 704
                         Display::return_icon('edit.png', $warning_message, array(), ICON_SIZE_SMALL).'</a>';
705 705
                     $warning_message .= $modify_icons;
706 706
                     Display::display_warning_message($warning_message, false);
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
                         if (empty($certificate_min_score) ||
756 756
                             ($certificate_min_score > $weight_category)
757 757
                         ) {
758
-                            $warning_message .= $course_code .'&nbsp;-&nbsp;'.get_lang('CertificateMinimunScoreIsRequiredAndMustNotBeMoreThan').'&nbsp;'.$weight_category.'<br />';
758
+                            $warning_message .= $course_code.'&nbsp;-&nbsp;'.get_lang('CertificateMinimunScoreIsRequiredAndMustNotBeMoreThan').'&nbsp;'.$weight_category.'<br />';
759 759
                         }
760 760
                     }
761 761
 
@@ -817,10 +817,10 @@  discard block
 block discarded – undo
817 817
                 get_lang('Results'),
818 818
                 array("FontSize" => 11, "Align" => TEXT_ALIGN_BOTTOMMIDDLE)
819 819
             );
820
-            $pChart->setGraphArea(50, 30, $xSize-50, $ySize-50);
820
+            $pChart->setGraphArea(50, 30, $xSize - 50, $ySize - 50);
821 821
             $pChart->setFontProperties(
822 822
                 array(
823
-                    'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
823
+                    'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
824 824
                     'FontSize' => 10,
825 825
                 )
826 826
             );
@@ -868,13 +868,13 @@  discard block
 block discarded – undo
868 868
             $chartHash = $myCache->getHash($dataSet);
869 869
 
870 870
             $myCache->writeToCache($chartHash, $pChart);
871
-            $imgSysPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
871
+            $imgSysPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
872 872
             $myCache->saveFromCache($chartHash, $imgSysPath);
873
-            $imgWebPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
873
+            $imgWebPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
874 874
 
875 875
             if (file_exists($imgSysPath)) {
876 876
                 $result = '<div id="contentArea" style="text-align: center;" >';
877
-                $result .= '<img src="' . $imgWebPath.'" >';
877
+                $result .= '<img src="'.$imgWebPath.'" >';
878 878
                 $result .= '</div>';
879 879
                 return $result;
880 880
             }
@@ -919,13 +919,13 @@  discard block
 block discarded – undo
919 919
         switch ($item->get_item_type()) {
920 920
             // category
921 921
             case 'C':
922
-                return 'CATE' . $item->get_id();
922
+                return 'CATE'.$item->get_id();
923 923
             // evaluation
924 924
             case 'E':
925
-                return 'EVAL' . $item->get_id();
925
+                return 'EVAL'.$item->get_id();
926 926
             // link
927 927
             case 'L':
928
-                return 'LINK' . $item->get_id();
928
+                return 'LINK'.$item->get_id();
929 929
         }
930 930
     }
931 931
 
@@ -953,10 +953,10 @@  discard block
 block discarded – undo
953 953
         switch ($item->get_item_type()) {
954 954
             // category
955 955
             case 'C':
956
-                $prms_uri='?selectcat=' . $item->get_id() . '&amp;view='.$view;
956
+                $prms_uri = '?selectcat='.$item->get_id().'&amp;view='.$view;
957 957
                 if (isset($_GET['isStudentView'])) {
958
-                    if ( isset($is_student) || (isset($_SESSION['studentview']) && $_SESSION['studentview']=='studentview') ) {
959
-                        $prms_uri=$prms_uri.'&amp;isStudentView='.Security::remove_XSS($_GET['isStudentView']);
958
+                    if (isset($is_student) || (isset($_SESSION['studentview']) && $_SESSION['studentview'] == 'studentview')) {
959
+                        $prms_uri = $prms_uri.'&amp;isStudentView='.Security::remove_XSS($_GET['isStudentView']);
960 960
                     }
961 961
                 }
962 962
 
@@ -965,7 +965,7 @@  discard block
 block discarded – undo
965 965
                 return '&nbsp;<a href="'.Security::remove_XSS($_SESSION['gradebook_dest']).$prms_uri.'">'
966 966
                 . $item->get_name()
967 967
                 . '</a>'
968
-                . ($item->is_course() ? ' &nbsp;[' . $item->get_course_code() . ']'.$show_message : '');
968
+                . ($item->is_course() ? ' &nbsp;['.$item->get_course_code().']'.$show_message : '');
969 969
                 // evaluation
970 970
             case 'E':
971 971
                 $cat = new Category();
@@ -973,10 +973,10 @@  discard block
 block discarded – undo
973 973
                 $show_message = $cat->show_message_resource_delete($course_id);
974 974
 
975 975
                 // course/platform admin can go to the view_results page
976
-                if (api_is_allowed_to_edit() && $show_message===false) {
976
+                if (api_is_allowed_to_edit() && $show_message === false) {
977 977
                     if ($item->get_type() == 'presence') {
978 978
                         return '&nbsp;'
979
-                        . '<a href="gradebook_view_result.php?'.api_get_cidreq().'&selecteval=' . $item->get_id() . '">'
979
+                        . '<a href="gradebook_view_result.php?'.api_get_cidreq().'&selecteval='.$item->get_id().'">'
980 980
                         . $item->get_name()
981 981
                         . '</a>';
982 982
                     } else {
@@ -985,20 +985,20 @@  discard block
 block discarded – undo
985 985
                             $extra = '';
986 986
                         }
987 987
                         return '&nbsp;'
988
-                        . '<a href="gradebook_view_result.php?' . api_get_cidreq() . '&selecteval=' . $item->get_id() . '">'
988
+                        . '<a href="gradebook_view_result.php?'.api_get_cidreq().'&selecteval='.$item->get_id().'">'
989 989
                         . $item->get_name()
990 990
                         . '</a>&nbsp;'.$extra;
991 991
                     }
992
-                } elseif (ScoreDisplay :: instance()->is_custom() && $show_message===false) {
992
+                } elseif (ScoreDisplay :: instance()->is_custom() && $show_message === false) {
993 993
                     // students can go to the statistics page (if custom display enabled)
994 994
                     return '&nbsp;'
995
-                    . '<a href="gradebook_statistics.php?' . api_get_cidreq() . '&selecteval=' . $item->get_id() . '">'
995
+                    . '<a href="gradebook_statistics.php?'.api_get_cidreq().'&selecteval='.$item->get_id().'">'
996 996
                     . $item->get_name()
997 997
                     . '</a>';
998 998
 
999 999
                 } elseif ($show_message === false && !api_is_allowed_to_edit() && !ScoreDisplay :: instance()->is_custom()) {
1000 1000
                     return '&nbsp;'
1001
-                    . '<a href="gradebook_statistics.php?' . api_get_cidreq() . '&selecteval=' . $item->get_id() . '">'
1001
+                    . '<a href="gradebook_statistics.php?'.api_get_cidreq().'&selecteval='.$item->get_id().'">'
1002 1002
                     . $item->get_name()
1003 1003
                     . '</a>';
1004 1004
                 } else {
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
                 $url = $item->get_link();
1014 1014
 
1015 1015
                 if (isset($url) && $show_message === false) {
1016
-                    $text = '&nbsp;<a href="' . $item->get_link() . '">'
1016
+                    $text = '&nbsp;<a href="'.$item->get_link().'">'
1017 1017
                         . $item->get_name()
1018 1018
                         . '</a>';
1019 1019
                 } else {
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Rule/MaxFileSize.php 2 patches
Doc Comments   -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,6 @@
 block discarded – undo
9 9
 {
10 10
 	/**
11 11
 	 * @param $value array     Uploaded file info (from $_FILES)
12
-	 * @param null $options
13 12
 	 * @return bool
14 13
 	 */
15 14
 	public function validate($elementValue, $maxSize)
Please login to merge, or discard this patch.
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -7,22 +7,22 @@
 block discarded – undo
7 7
  */
8 8
 class HTML_QuickForm_Rule_MaxFileSize extends HTML_QuickForm_Rule
9 9
 {
10
-	/**
11
-	 * @param $value array     Uploaded file info (from $_FILES)
12
-	 * @param null $options
13
-	 * @return bool
14
-	 */
15
-	public function validate($elementValue, $maxSize)
16
-	{
17
-		if (!empty($elementValue['error']) &&
18
-			(UPLOAD_ERR_FORM_SIZE == $elementValue['error'] || UPLOAD_ERR_INI_SIZE == $elementValue['error'])
19
-		) {
20
-			return false;
21
-		}
22
-		if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) {
23
-			return true;
24
-		}
10
+    /**
11
+     * @param $value array     Uploaded file info (from $_FILES)
12
+     * @param null $options
13
+     * @return bool
14
+     */
15
+    public function validate($elementValue, $maxSize)
16
+    {
17
+        if (!empty($elementValue['error']) &&
18
+            (UPLOAD_ERR_FORM_SIZE == $elementValue['error'] || UPLOAD_ERR_INI_SIZE == $elementValue['error'])
19
+        ) {
20
+            return false;
21
+        }
22
+        if (!HTML_QuickForm_file::_ruleIsUploadedFile($elementValue)) {
23
+            return true;
24
+        }
25 25
 
26
-		return ($maxSize >= @filesize($elementValue['tmp_name']));
27
-	}
26
+        return ($maxSize >= @filesize($elementValue['tmp_name']));
27
+    }
28 28
 }
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Rule/MobilePhoneNumber.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
      *
17 17
      * @param string Mobile phone number to be validated
18 18
      * @param string Not using it. Just to respect the declaration
19
-     * @return boolean Returns true if valid, false otherwise.
19
+     * @return integer Returns true if valid, false otherwise.
20 20
      */
21 21
     function validate($mobilePhoneNumber, $options = null)
22 22
     {
Please login to merge, or discard this patch.
main/inc/lib/hook/HookManagement.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -138,7 +138,7 @@
 block discarded – undo
138 138
 
139 139
     /**
140 140
      * Return a list an associative array where keys are the active hook observer class name
141
-     * @param $eventName
141
+     * @param string $eventName
142 142
      *
143 143
      * @return array
144 144
      */
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -145,10 +145,10 @@  discard block
 block discarded – undo
145 145
     public function listHookObservers($eventName)
146 146
     {
147 147
         $array = array();
148
-        $joinTable = $this->tables[TABLE_HOOK_CALL] . ' hc' .
149
-            ' INNER JOIN ' . $this->tables[TABLE_HOOK_EVENT] . ' he' .
150
-            ' ON hc.hook_event_id = he.id ' .
151
-            ' INNER JOIN ' . $this->tables[TABLE_HOOK_OBSERVER] . ' ho ' .
148
+        $joinTable = $this->tables[TABLE_HOOK_CALL].' hc'.
149
+            ' INNER JOIN '.$this->tables[TABLE_HOOK_EVENT].' he'.
150
+            ' ON hc.hook_event_id = he.id '.
151
+            ' INNER JOIN '.$this->tables[TABLE_HOOK_OBSERVER].' ho '.
152 152
             ' ON hc.hook_observer_id = ho.id ';
153 153
         $columns = 'ho.class_name, ho.path, ho.plugin_name, hc.enabled';
154 154
         $where = array('where' => array('he.class_name = ? ' => $eventName, 'AND hc.enabled = ? ' => 1));
@@ -202,10 +202,10 @@  discard block
 block discarded – undo
202 202
     public function listAllHookCalls()
203 203
     {
204 204
         $array = array();
205
-        $joinTable = $this->tables[TABLE_HOOK_CALL] . ' hc' .
206
-            ' INNER JOIN ' . $this->tables[TABLE_HOOK_EVENT] . ' he' .
207
-            ' ON hc.hook_event_id = he.id ' .
208
-            ' INNER JOIN ' . $this->tables[TABLE_HOOK_OBSERVER] . ' ho ' .
205
+        $joinTable = $this->tables[TABLE_HOOK_CALL].' hc'.
206
+            ' INNER JOIN '.$this->tables[TABLE_HOOK_EVENT].' he'.
207
+            ' ON hc.hook_event_id = he.id '.
208
+            ' INNER JOIN '.$this->tables[TABLE_HOOK_OBSERVER].' ho '.
209 209
             ' ON hc.hook_observer_id = ho.id ';
210 210
         $columns = 'he.class_name AS event_class_name, ho.class_name AS observer_class_name, hc.id AS id, hc.type AS type';
211 211
         $rows = Database::select($columns, $joinTable);
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
         if (isset($eventName) && !isset($this->hookEvents[$eventName])) {
232 232
             $attributes = array(
233 233
                 'class_name' => $eventName,
234
-                'description' => get_lang('HookDescription' . $eventName),
234
+                'description' => get_lang('HookDescription'.$eventName),
235 235
             );
236 236
             $id = Database::insert($this->tables[TABLE_HOOK_EVENT], $attributes);
237 237
             $this->hookEvents[$eventName] = $id;
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
         // Check if exists hook observer
241 241
         if (isset($observerClassName) &&
242 242
             !isset($this->hookObservers[$observerClassName])
243
-        ){
243
+        ) {
244 244
             $object = $observerClassName::create();
245 245
             $attributes = array(
246 246
                 'class_name' => $observerClassName,
@@ -338,10 +338,10 @@  discard block
 block discarded – undo
338 338
         $eventName = Database::escape_string($eventName);
339 339
         $observerClassName($observerClassName);
340 340
         $type = Database::escape_string($type);
341
-        $joinTable = $this->tables[TABLE_HOOK_CALL] . ' hc' .
342
-            ' INNER JOIN ' . $this->tables[TABLE_HOOK_EVENT] . ' he' .
343
-            ' ON hc.hook_event_id = he.id ' .
344
-            ' INNER JOIN ' . $this->tables[TABLE_HOOK_OBSERVER] . ' ho ' .
341
+        $joinTable = $this->tables[TABLE_HOOK_CALL].' hc'.
342
+            ' INNER JOIN '.$this->tables[TABLE_HOOK_EVENT].' he'.
343
+            ' ON hc.hook_event_id = he.id '.
344
+            ' INNER JOIN '.$this->tables[TABLE_HOOK_OBSERVER].' ho '.
345 345
             ' ON hc.hook_observer_id = ho.id ';
346 346
         $row = Database::select(
347 347
             'id',
Please login to merge, or discard this patch.
src/Chamilo/CoreBundle/Component/Editor/TinyMce/TinyMce.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
      */
48 48
     public function editorReplace()
49 49
     {
50
-        $toolbar  = new Toolbar\Basic($this->urlGenerator, $this->toolbarSet, $this->config, 'TinyMce');
50
+        $toolbar = new Toolbar\Basic($this->urlGenerator, $this->toolbarSet, $this->config, 'TinyMce');
51 51
         $toolbar->setLanguage($this->getLocale());
52 52
         $config = $toolbar->getConfig();
53 53
         $config['selector'] = "#".$this->name;
Please login to merge, or discard this patch.