Passed
Push — 1.10.x ( 57ccd9...af0b2a )
by Angel Fernando Quiroz
93:14 queued 54:02
created
main/gradebook/lib/be/surveylink.class.php 1 patch
Indentation   +243 added lines, -243 removed lines patch added patch discarded remove patch
@@ -8,94 +8,94 @@  discard block
 block discarded – undo
8 8
  */
9 9
 class SurveyLink extends AbstractLink
10 10
 {
11
-	private $survey_table = null;
12
-
13
-	/**
14
-	 * Constructor
15
-	 */
16
-	public function __construct()
17
-	{
18
-		parent::__construct();
19
-		$this->set_type(LINK_SURVEY);
20
-	}
21
-
22
-	public function get_name()
23
-	{
24
-		$this->get_survey_data();
25
-		return $this->survey_data['code'].': '.self::html_to_text($this->survey_data['title']);
26
-	}
27
-
28
-	public function get_description()
29
-	{
30
-		$this->get_survey_data();
31
-		return $this->survey_data['subtitle'];
32
-	}
33
-
34
-	public function get_type_name()
35
-	{
36
-		return get_lang('Survey');
37
-	}
38
-
39
-	public function is_allowed_to_change_name()
40
-	{
41
-		return false;
42
-	}
43
-
44
-	public function needs_name_and_description()
45
-	{
46
-		return false;
47
-	}
48
-
49
-	public function needs_max()
50
-	{
51
-		return false;
52
-	}
53
-
54
-	public function needs_results()
55
-	{
56
-		return false;
57
-	}
58
-
59
-	/**
60
-	 * Generates an array of all surveys available.
61
-	 * @return array 2-dimensional array - every element contains 2 subelements (id, name)
62
-	 */
63
-	public function get_all_links()
64
-	{
65
-		if (empty($this->course_code)) {
66
-			die('Error in get_all_links() : course code not set');
67
-		}
68
-		$tbl_survey = $this->get_survey_table();
69
-		$session_id = api_get_session_id();
70
-		$course_id = api_get_course_int_id();
71
-		$sql = 'SELECT survey_id, title, code FROM '.$tbl_survey.'
11
+    private $survey_table = null;
12
+
13
+    /**
14
+     * Constructor
15
+     */
16
+    public function __construct()
17
+    {
18
+        parent::__construct();
19
+        $this->set_type(LINK_SURVEY);
20
+    }
21
+
22
+    public function get_name()
23
+    {
24
+        $this->get_survey_data();
25
+        return $this->survey_data['code'].': '.self::html_to_text($this->survey_data['title']);
26
+    }
27
+
28
+    public function get_description()
29
+    {
30
+        $this->get_survey_data();
31
+        return $this->survey_data['subtitle'];
32
+    }
33
+
34
+    public function get_type_name()
35
+    {
36
+        return get_lang('Survey');
37
+    }
38
+
39
+    public function is_allowed_to_change_name()
40
+    {
41
+        return false;
42
+    }
43
+
44
+    public function needs_name_and_description()
45
+    {
46
+        return false;
47
+    }
48
+
49
+    public function needs_max()
50
+    {
51
+        return false;
52
+    }
53
+
54
+    public function needs_results()
55
+    {
56
+        return false;
57
+    }
58
+
59
+    /**
60
+     * Generates an array of all surveys available.
61
+     * @return array 2-dimensional array - every element contains 2 subelements (id, name)
62
+     */
63
+    public function get_all_links()
64
+    {
65
+        if (empty($this->course_code)) {
66
+            die('Error in get_all_links() : course code not set');
67
+        }
68
+        $tbl_survey = $this->get_survey_table();
69
+        $session_id = api_get_session_id();
70
+        $course_id = api_get_course_int_id();
71
+        $sql = 'SELECT survey_id, title, code FROM '.$tbl_survey.'
72 72
 				WHERE c_id = '.$course_id.' AND session_id = '.intval($session_id).'';
73
-		$result = Database::query($sql);
74
-		while ($data = Database::fetch_array($result)) {
75
-			$links[] = array(
76
-				$data['survey_id'],
77
-				api_trunc_str(
78
-					$data['code'] . ': ' . self::html_to_text($data['title']),
79
-					80
80
-				)
81
-			);
82
-		}
83
-
84
-		return isset($links) ? $links : null;
85
-	}
86
-
87
-	/**
88
-	 * Generates an array of surveys that a teacher hasn't created a link for.
89
-	 * @return array 2-dimensional array - every element contains 2 subelements (id, name)
90
-	 */
91
-	public function get_not_created_links()
92
-	{
93
-		if (empty($this->course_code)) {
94
-			die('Error in get_not_created_links() : course code not set');
95
-		}
96
-		$tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
97
-
98
-		$sql = 'SELECT survey_id, title, code
73
+        $result = Database::query($sql);
74
+        while ($data = Database::fetch_array($result)) {
75
+            $links[] = array(
76
+                $data['survey_id'],
77
+                api_trunc_str(
78
+                    $data['code'] . ': ' . self::html_to_text($data['title']),
79
+                    80
80
+                )
81
+            );
82
+        }
83
+
84
+        return isset($links) ? $links : null;
85
+    }
86
+
87
+    /**
88
+     * Generates an array of surveys that a teacher hasn't created a link for.
89
+     * @return array 2-dimensional array - every element contains 2 subelements (id, name)
90
+     */
91
+    public function get_not_created_links()
92
+    {
93
+        if (empty($this->course_code)) {
94
+            die('Error in get_not_created_links() : course code not set');
95
+        }
96
+        $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
97
+
98
+        $sql = 'SELECT survey_id, title, code
99 99
     			FROM '.$this->get_survey_table().' AS srv
100 100
 				WHERE survey_id NOT IN
101 101
 					(
@@ -106,28 +106,28 @@  discard block
 block discarded – undo
106 106
 					)
107 107
 					AND srv.session_id = '.api_get_session_id();
108 108
 
109
-		$result = Database::query($sql);
110
-
111
-		$links = array();
112
-		while ($data = Database::fetch_array($result)) {
113
-			$links[] = array(
114
-				$data['survey_id'],
115
-				api_trunc_str($data['code'].': '.self::html_to_text($data['title']), 80)
116
-			);
117
-		}
118
-		return $links;
119
-	}
120
-
121
-	/**
122
-	 * Has anyone done this survey yet?
123
-	 */
124
-	public function has_results($stud_id=null)
125
-	{
126
-		$ref_id = intval($this->get_ref_id());
127
-		$session_id = api_get_session_id();
128
-		$tbl_survey = Database::get_course_table(TABLE_SURVEY);
129
-		$tbl_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION);
130
-		$sql = "SELECT
109
+        $result = Database::query($sql);
110
+
111
+        $links = array();
112
+        while ($data = Database::fetch_array($result)) {
113
+            $links[] = array(
114
+                $data['survey_id'],
115
+                api_trunc_str($data['code'].': '.self::html_to_text($data['title']), 80)
116
+            );
117
+        }
118
+        return $links;
119
+    }
120
+
121
+    /**
122
+     * Has anyone done this survey yet?
123
+     */
124
+    public function has_results($stud_id=null)
125
+    {
126
+        $ref_id = intval($this->get_ref_id());
127
+        $session_id = api_get_session_id();
128
+        $tbl_survey = Database::get_course_table(TABLE_SURVEY);
129
+        $tbl_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION);
130
+        $sql = "SELECT
131 131
 				COUNT(i.answered)
132 132
 				FROM $tbl_survey AS s
133 133
 				JOIN $tbl_survey_invitation AS i ON s.code = i.survey_code
@@ -137,30 +137,30 @@  discard block
 block discarded – undo
137 137
 					s.survey_id = $ref_id AND
138 138
 					i.session_id = $session_id";
139 139
 
140
-		$sql_result = Database::query($sql);
141
-		$data = Database::fetch_array($sql_result);
140
+        $sql_result = Database::query($sql);
141
+        $data = Database::fetch_array($sql_result);
142 142
 
143
-		return ($data[0] != 0);
144
-	}
143
+        return ($data[0] != 0);
144
+    }
145 145
 
146
-	/**
147
-	 * @param int $stud_id
148
-	 * @return array|null
149
-	 */
150
-	public function calc_score($stud_id = null, $type = null)
151
-	{
152
-		// Note: Max score is assumed to be always 1 for surveys,
153
-		// only student's participation is to be taken into account.
154
-		$max_score = 1;
146
+    /**
147
+     * @param int $stud_id
148
+     * @return array|null
149
+     */
150
+    public function calc_score($stud_id = null, $type = null)
151
+    {
152
+        // Note: Max score is assumed to be always 1 for surveys,
153
+        // only student's participation is to be taken into account.
154
+        $max_score = 1;
155 155
 
156
-		$ref_id = intval($this->get_ref_id());
157
-		$session_id = api_get_session_id();
158
-		$tbl_survey = Database::get_course_table(TABLE_SURVEY);
159
-		$tbl_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION);
156
+        $ref_id = intval($this->get_ref_id());
157
+        $session_id = api_get_session_id();
158
+        $tbl_survey = Database::get_course_table(TABLE_SURVEY);
159
+        $tbl_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION);
160 160
 
161
-		$get_individual_score = !is_null($stud_id);
161
+        $get_individual_score = !is_null($stud_id);
162 162
 
163
-		$sql = "SELECT i.answered
163
+        $sql = "SELECT i.answered
164 164
 				FROM $tbl_survey AS s
165 165
 				JOIN $tbl_survey_invitation AS i
166 166
 				ON s.code = i.survey_code
@@ -171,131 +171,131 @@  discard block
 block discarded – undo
171 171
 					i.session_id = $session_id
172 172
 				";
173 173
 
174
-		if ($get_individual_score) {
175
-			$sql .= ' AND i.user = '.intval($stud_id);
176
-		}
177
-
178
-		$sql_result = Database::query($sql);
179
-
180
-		if ($get_individual_score) {
181
-			// for 1 student
182
-			if ($data = Database::fetch_array($sql_result)) {
183
-				return array($data['answered'] ? $max_score : 0, $max_score);
184
-			}
185
-			return array(0, $max_score);
186
-		} else {
187
-			// for all the students -> get average
188
-			$rescount = 0;
189
-			$sum = 0;
190
-			$bestResult = 0;
191
-			$weight = 0;
192
-			while ($data = Database::fetch_array($sql_result)) {
193
-				$sum += $data['answered'] ? $max_score : 0;
194
-				$rescount++;
195
-				if ($data['answered'] > $bestResult) {
196
-					$bestResult = $data['answered'];
197
-					$weight = $assignment['qualification'];
198
-				}
199
-			}
200
-			$sum = $sum / $max_score;
201
-
202
-			if ($rescount == 0) {
203
-				return null;
204
-			}
205
-
206
-			switch ($type) {
207
-				case 'best':
208
-					return array($bestResult, $rescount);
209
-					break;
210
-				case 'average':
211
-					return array($sum, $rescount);
212
-					break;
213
-				case 'ranking':
214
-					return null;
215
-					break;
216
-				default:
217
-					return array($sum, $rescount);
218
-					break;
219
-			}
220
-		}
221
-	}
222
-
223
-	/**
224
-	 * Lazy load function to get the database table of the surveys
225
-	 */
226
-	private function get_survey_table()
227
-	{
228
-		$this->survey_table = Database :: get_course_table(TABLE_SURVEY);
229
-		return $this->survey_table;
230
-	}
231
-
232
-	/**
233
-	 * Check if this still links to a survey
234
-	 */
235
-	public function is_valid_link()
236
-	{
237
-		$session_id = api_get_session_id();
238
-		$sql = 'SELECT count(survey_id) FROM '.$this->get_survey_table().'
174
+        if ($get_individual_score) {
175
+            $sql .= ' AND i.user = '.intval($stud_id);
176
+        }
177
+
178
+        $sql_result = Database::query($sql);
179
+
180
+        if ($get_individual_score) {
181
+            // for 1 student
182
+            if ($data = Database::fetch_array($sql_result)) {
183
+                return array($data['answered'] ? $max_score : 0, $max_score);
184
+            }
185
+            return array(0, $max_score);
186
+        } else {
187
+            // for all the students -> get average
188
+            $rescount = 0;
189
+            $sum = 0;
190
+            $bestResult = 0;
191
+            $weight = 0;
192
+            while ($data = Database::fetch_array($sql_result)) {
193
+                $sum += $data['answered'] ? $max_score : 0;
194
+                $rescount++;
195
+                if ($data['answered'] > $bestResult) {
196
+                    $bestResult = $data['answered'];
197
+                    $weight = $assignment['qualification'];
198
+                }
199
+            }
200
+            $sum = $sum / $max_score;
201
+
202
+            if ($rescount == 0) {
203
+                return null;
204
+            }
205
+
206
+            switch ($type) {
207
+                case 'best':
208
+                    return array($bestResult, $rescount);
209
+                    break;
210
+                case 'average':
211
+                    return array($sum, $rescount);
212
+                    break;
213
+                case 'ranking':
214
+                    return null;
215
+                    break;
216
+                default:
217
+                    return array($sum, $rescount);
218
+                    break;
219
+            }
220
+        }
221
+    }
222
+
223
+    /**
224
+     * Lazy load function to get the database table of the surveys
225
+     */
226
+    private function get_survey_table()
227
+    {
228
+        $this->survey_table = Database :: get_course_table(TABLE_SURVEY);
229
+        return $this->survey_table;
230
+    }
231
+
232
+    /**
233
+     * Check if this still links to a survey
234
+     */
235
+    public function is_valid_link()
236
+    {
237
+        $session_id = api_get_session_id();
238
+        $sql = 'SELECT count(survey_id) FROM '.$this->get_survey_table().'
239 239
         		 WHERE
240 240
         		 	c_id = '.$this->course_id.' AND
241 241
         		 	survey_id = '.intval($this->get_ref_id()).' AND
242 242
         		 	session_id='.intval($session_id).'';
243
-		$result = Database::query($sql);
244
-		$number = Database::fetch_row($result);
245
-		return ($number[0] != 0);
246
-	}
247
-
248
-	public function get_test_id()
249
-	{
250
-		return 'DEBUG:ID';
251
-	}
252
-
253
-	public function get_link()
254
-	{
255
-		if (api_is_allowed_to_edit()) { // Let students make access only through "Surveys" tool.
256
-			$tbl_name = $this->get_survey_table();
257
-			$session_id = api_get_session_id();
258
-			if ($tbl_name != '') {
259
-				$sql = 'SELECT survey_id FROM '.$this->get_survey_table().'
243
+        $result = Database::query($sql);
244
+        $number = Database::fetch_row($result);
245
+        return ($number[0] != 0);
246
+    }
247
+
248
+    public function get_test_id()
249
+    {
250
+        return 'DEBUG:ID';
251
+    }
252
+
253
+    public function get_link()
254
+    {
255
+        if (api_is_allowed_to_edit()) { // Let students make access only through "Surveys" tool.
256
+            $tbl_name = $this->get_survey_table();
257
+            $session_id = api_get_session_id();
258
+            if ($tbl_name != '') {
259
+                $sql = 'SELECT survey_id FROM '.$this->get_survey_table().'
260 260
     					WHERE
261 261
     						c_id = '.$this->course_id.' AND
262 262
     						survey_id = '.intval($this->get_ref_id()).' AND
263 263
     						session_id = '.intval($session_id).' ';
264
-				$result = Database::query($sql);
265
-				$row = Database::fetch_array($result, 'ASSOC');
266
-				$survey_id = $row['survey_id'];
267
-				return api_get_path(WEB_PATH).'main/survey/reporting.php?cidReq='.$this->get_course_code().'&survey_id='.$survey_id;
268
-			}
269
-		}
270
-		return null;
271
-	}
272
-
273
-	private function get_survey_data()
274
-	{
275
-		$tbl_name = $this->get_survey_table();
276
-		$session_id = api_get_session_id();
277
-		if ($tbl_name == '') {
278
-			return false;
279
-		} elseif (!isset($this->survey_data)) {
280
-			$sql = 'SELECT * FROM '.$tbl_name.'
264
+                $result = Database::query($sql);
265
+                $row = Database::fetch_array($result, 'ASSOC');
266
+                $survey_id = $row['survey_id'];
267
+                return api_get_path(WEB_PATH).'main/survey/reporting.php?cidReq='.$this->get_course_code().'&survey_id='.$survey_id;
268
+            }
269
+        }
270
+        return null;
271
+    }
272
+
273
+    private function get_survey_data()
274
+    {
275
+        $tbl_name = $this->get_survey_table();
276
+        $session_id = api_get_session_id();
277
+        if ($tbl_name == '') {
278
+            return false;
279
+        } elseif (!isset($this->survey_data)) {
280
+            $sql = 'SELECT * FROM '.$tbl_name.'
281 281
 					WHERE
282 282
 						c_id = '.$this->course_id.' AND
283 283
 						survey_id = '.intval($this->get_ref_id()).' AND
284 284
 						session_id='.intval($session_id).'';
285
-			$query = Database::query($sql);
286
-			$this->survey_data = Database::fetch_array($query);
287
-		}
288
-		return $this->survey_data;
289
-	}
290
-
291
-	public function get_icon_name()
292
-	{
293
-		return 'survey';
294
-	}
295
-
296
-	private static function html_to_text($string)
297
-	{
298
-		return strip_tags($string);
299
-		//return trim(api_html_entity_decode(strip_tags(str_ireplace(array('<p>', '</p>', '<br />', '<br/>', '<br>'), array('', ' ', ' ', ' ', ' '), $string)), ENT_QUOTES));
300
-	}
285
+            $query = Database::query($sql);
286
+            $this->survey_data = Database::fetch_array($query);
287
+        }
288
+        return $this->survey_data;
289
+    }
290
+
291
+    public function get_icon_name()
292
+    {
293
+        return 'survey';
294
+    }
295
+
296
+    private static function html_to_text($string)
297
+    {
298
+        return strip_tags($string);
299
+        //return trim(api_html_entity_decode(strip_tags(str_ireplace(array('<p>', '</p>', '<br />', '<br/>', '<br>'), array('', ' ', ' ', ' ', ' '), $string)), ENT_QUOTES));
300
+    }
301 301
 }
Please login to merge, or discard this patch.
main/gradebook/lib/be/studentpublicationlink.class.php 1 patch
Indentation   +317 added lines, -317 removed lines patch added patch discarded remove patch
@@ -8,102 +8,102 @@  discard block
 block discarded – undo
8 8
  */
9 9
 class StudentPublicationLink extends AbstractLink
10 10
 {
11
-	private $studpub_table = null;
12
-	private $itemprop_table = null;
13
-
14
-	/**
15
-	 * Constructor
16
-	 */
17
-	public function __construct()
18
-	{
19
-		parent::__construct();
20
-		$this->set_type(LINK_STUDENTPUBLICATION);
21
-	}
22
-
23
-	/**
24
-	 *
25
-	 * Returns the URL of a document
26
-	 * This function is loaded when using a gradebook as a tab (gradebook = -1)
27
-	 * see issue #2705
28
-	 *
29
-	 */
30
-	public function get_view_url($stud_id)
31
-	{
32
-		// find a file uploaded by the given student,
33
-		// with the same title as the evaluation name
34
-
35
-		$eval = $this->get_evaluation();
36
-		$stud_id = intval($stud_id);
37
-
38
-		$sql = 'SELECT pub.url
11
+    private $studpub_table = null;
12
+    private $itemprop_table = null;
13
+
14
+    /**
15
+     * Constructor
16
+     */
17
+    public function __construct()
18
+    {
19
+        parent::__construct();
20
+        $this->set_type(LINK_STUDENTPUBLICATION);
21
+    }
22
+
23
+    /**
24
+     *
25
+     * Returns the URL of a document
26
+     * This function is loaded when using a gradebook as a tab (gradebook = -1)
27
+     * see issue #2705
28
+     *
29
+     */
30
+    public function get_view_url($stud_id)
31
+    {
32
+        // find a file uploaded by the given student,
33
+        // with the same title as the evaluation name
34
+
35
+        $eval = $this->get_evaluation();
36
+        $stud_id = intval($stud_id);
37
+
38
+        $sql = 'SELECT pub.url
39 39
 				FROM '.$this->get_itemprop_table().' prop, '.$this->get_studpub_table().' pub'
40
-			." WHERE
40
+            ." WHERE
41 41
 					prop.c_id = ".$this->course_id." AND
42 42
 					pub.c_id = ".$this->course_id." AND
43 43
 					prop.tool = 'work'"
44
-			.' AND prop.insert_user_id = '.$stud_id
45
-			.' AND prop.ref = pub.id'
46
-			." AND pub.title = '".Database::escape_string($eval->get_name())."' AND pub.session_id=".api_get_session_id()."";
47
-
48
-		$result = Database::query($sql);
49
-		if ($fileurl = Database::fetch_row($result)) {
50
-			return null;
51
-		} else {
52
-			return null;
53
-		}
54
-	}
55
-
56
-	public function get_type_name()
57
-	{
58
-		return get_lang('Works');
59
-	}
60
-
61
-	public function is_allowed_to_change_name()
62
-	{
63
-		return false;
64
-	}
65
-
66
-	/**
67
-	 * Generate an array of exercises that a teacher hasn't created a link for.
68
-	 * @return array 2-dimensional array - every element contains 2 subelements (id, name)
69
-	 */
70
-	public function get_not_created_links()
71
-	{
72
-		return false;
73
-		if (empty($this->course_code)) {
74
-			die('Error in get_not_created_links() : course code not set');
75
-		}
76
-		$tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
77
-
78
-		$sql = 'SELECT id, url from '.$this->get_studpub_table()
79
-			.' pup WHERE c_id = '.$this->course_id.' AND has_properties != '."''".' AND id NOT IN'
80
-			.' (SELECT ref_id FROM '.$tbl_grade_links
81
-			.' WHERE type = '.LINK_STUDENTPUBLICATION
82
-			." AND course_code = '".Database::escape_string($this->get_course_code())."'"
83
-			.') AND pub.session_id='.api_get_session_id().'';
84
-
85
-		$result = Database::query($sql);
86
-
87
-		$cats=array();
88
-		while ($data=Database::fetch_array($result)) {
89
-			$cats[] = array ($data['id'], $data['url']);
90
-		}
91
-		return $cats;
92
-	}
93
-
94
-	/**
95
-	 * Generate an array of all exercises available.
96
-	 * @return array 2-dimensional array - every element contains 2 subelements (id, name)
97
-	 */
98
-	public function get_all_links()
99
-	{
100
-		if (empty($this->course_code)) {
101
-			die('Error in get_not_created_links() : course code not set');
102
-		}
103
-		$tbl_grade_links = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
104
-
105
-		$session_id = api_get_session_id();
106
-		/*
44
+            .' AND prop.insert_user_id = '.$stud_id
45
+            .' AND prop.ref = pub.id'
46
+            ." AND pub.title = '".Database::escape_string($eval->get_name())."' AND pub.session_id=".api_get_session_id()."";
47
+
48
+        $result = Database::query($sql);
49
+        if ($fileurl = Database::fetch_row($result)) {
50
+            return null;
51
+        } else {
52
+            return null;
53
+        }
54
+    }
55
+
56
+    public function get_type_name()
57
+    {
58
+        return get_lang('Works');
59
+    }
60
+
61
+    public function is_allowed_to_change_name()
62
+    {
63
+        return false;
64
+    }
65
+
66
+    /**
67
+     * Generate an array of exercises that a teacher hasn't created a link for.
68
+     * @return array 2-dimensional array - every element contains 2 subelements (id, name)
69
+     */
70
+    public function get_not_created_links()
71
+    {
72
+        return false;
73
+        if (empty($this->course_code)) {
74
+            die('Error in get_not_created_links() : course code not set');
75
+        }
76
+        $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
77
+
78
+        $sql = 'SELECT id, url from '.$this->get_studpub_table()
79
+            .' pup WHERE c_id = '.$this->course_id.' AND has_properties != '."''".' AND id NOT IN'
80
+            .' (SELECT ref_id FROM '.$tbl_grade_links
81
+            .' WHERE type = '.LINK_STUDENTPUBLICATION
82
+            ." AND course_code = '".Database::escape_string($this->get_course_code())."'"
83
+            .') AND pub.session_id='.api_get_session_id().'';
84
+
85
+        $result = Database::query($sql);
86
+
87
+        $cats=array();
88
+        while ($data=Database::fetch_array($result)) {
89
+            $cats[] = array ($data['id'], $data['url']);
90
+        }
91
+        return $cats;
92
+    }
93
+
94
+    /**
95
+     * Generate an array of all exercises available.
96
+     * @return array 2-dimensional array - every element contains 2 subelements (id, name)
97
+     */
98
+    public function get_all_links()
99
+    {
100
+        if (empty($this->course_code)) {
101
+            die('Error in get_not_created_links() : course code not set');
102
+        }
103
+        $tbl_grade_links = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
104
+
105
+        $session_id = api_get_session_id();
106
+        /*
107 107
         if (empty($session_id)) {
108 108
             $session_condition = api_get_session_condition(0, true);
109 109
         } else {
@@ -112,68 +112,68 @@  discard block
 block discarded – undo
112 112
         $sql = "SELECT id, url, title FROM $tbl_grade_links
113 113
                 WHERE c_id = {$this->course_id}  AND filetype='folder' AND active = 1 $session_condition ";*/
114 114
 
115
-		//Only show works from the session
116
-		//AND has_properties != ''
117
-		$sql = "SELECT id, url, title FROM $tbl_grade_links
115
+        //Only show works from the session
116
+        //AND has_properties != ''
117
+        $sql = "SELECT id, url, title FROM $tbl_grade_links
118 118
 				WHERE
119 119
 					c_id = {$this->course_id} AND
120 120
 					active = 1 AND
121 121
 					filetype='folder' AND
122 122
 					session_id = ".api_get_session_id()."";
123 123
 
124
-		$result = Database::query($sql);
125
-		while ($data = Database::fetch_array($result)) {
126
-			$work_name = $data['title'];
127
-			if (empty($work_name)) {
128
-				$work_name = basename($data['url']);
129
-			}
130
-			$cats[] = array ($data['id'], $work_name);
131
-		}
132
-		$cats=isset($cats) ? $cats : array();
133
-		return $cats;
134
-	}
135
-
136
-	/**
137
-	 * Has anyone done this exercise yet ?
138
-	 */
139
-	public function has_results()
140
-	{
141
-		$tbl_grade_links = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
142
-		$sql = 'SELECT count(*) AS number FROM '.$tbl_grade_links."
124
+        $result = Database::query($sql);
125
+        while ($data = Database::fetch_array($result)) {
126
+            $work_name = $data['title'];
127
+            if (empty($work_name)) {
128
+                $work_name = basename($data['url']);
129
+            }
130
+            $cats[] = array ($data['id'], $work_name);
131
+        }
132
+        $cats=isset($cats) ? $cats : array();
133
+        return $cats;
134
+    }
135
+
136
+    /**
137
+     * Has anyone done this exercise yet ?
138
+     */
139
+    public function has_results()
140
+    {
141
+        $tbl_grade_links = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
142
+        $sql = 'SELECT count(*) AS number FROM '.$tbl_grade_links."
143 143
 				WHERE 	c_id 		= {$this->course_id} AND
144 144
 						parent_id 	= '".intval($this->get_ref_id())."' AND
145 145
 						session_id	=".api_get_session_id()."";
146
-		$result = Database::query($sql);
147
-		$number = Database::fetch_row($result);
148
-		return ($number[0] != 0);
149
-	}
150
-
151
-	/**
152
-	 * @param null $stud_id
153
-	 * @return array|null
154
-	 */
155
-	public function calc_score($stud_id = null, $type = null)
156
-	{
157
-		$stud_id = intval($stud_id);
158
-		$table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
159
-		$sql = 'SELECT * FROM '.$table."
146
+        $result = Database::query($sql);
147
+        $number = Database::fetch_row($result);
148
+        return ($number[0] != 0);
149
+    }
150
+
151
+    /**
152
+     * @param null $stud_id
153
+     * @return array|null
154
+     */
155
+    public function calc_score($stud_id = null, $type = null)
156
+    {
157
+        $stud_id = intval($stud_id);
158
+        $table = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
159
+        $sql = 'SELECT * FROM '.$table."
160 160
     			WHERE
161 161
     				c_id = {$this->course_id} AND
162 162
     				id  = '".intval($this->get_ref_id())."' AND
163 163
     				session_id	= ".api_get_session_id()."
164 164
 				"
165
-		;
165
+        ;
166 166
 
167
-		$query = Database::query($sql);
168
-		$assignment = Database::fetch_array($query);
167
+        $query = Database::query($sql);
168
+        $assignment = Database::fetch_array($query);
169 169
 
170
-		if (count($assignment) == 0) {
171
-			$parentId = '0';
172
-		} else {
173
-			$parentId = $assignment['id'];
174
-		}
170
+        if (count($assignment) == 0) {
171
+            $parentId = '0';
172
+        } else {
173
+            $parentId = $assignment['id'];
174
+        }
175 175
 
176
-		$sql = 'SELECT * FROM '.$table.'
176
+        $sql = 'SELECT * FROM '.$table.'
177 177
     			WHERE
178 178
     				c_id = '.$this->course_id.' AND
179 179
     				active = 1 AND
@@ -181,190 +181,190 @@  discard block
 block discarded – undo
181 181
     				session_id = '.api_get_session_id() .' AND
182 182
     				qualificator_id <> 0
183 183
 				';
184
-		if (!empty($stud_id)) {
185
-			$sql .= " AND user_id = $stud_id ";
186
-		}
187
-
188
-		$order = api_get_setting('student_publication_to_take_in_gradebook');
189
-
190
-		switch ($order) {
191
-			case 'last':
192
-				// latest attempt
193
-				$sql .= ' ORDER BY sent_date DESC';
194
-				break;
195
-			case 'first':
196
-			default:
197
-				// first attempt
198
-				$sql .= ' ORDER BY id';
199
-				break;
200
-		}
201
-
202
-		$scores = Database::query($sql);
203
-
204
-		// for 1 student
205
-		if (!empty($stud_id)) {
206
-			if ($data = Database::fetch_array($scores)) {
207
-				return array(
208
-					$data['qualification'],
209
-					$assignment['qualification']
210
-				);
211
-			} else {
212
-				return '';
213
-			}
214
-		} else {
215
-			$students = array();  // user list, needed to make sure we only
216
-			// take first attempts into account
217
-			$rescount = 0;
218
-			$sum = 0;
219
-			$bestResult = 0;
220
-			$weight = 0;
221
-			$sumResult = 0;
222
-			$myResult = 0;
223
-
224
-			while ($data = Database::fetch_array($scores)) {
225
-				if (!(array_key_exists($data['user_id'], $students))) {
226
-					if ($assignment['qualification'] != 0) {
227
-						$students[$data['user_id']] = $data['qualification'];
228
-						$rescount++;
229
-						$sum += $data['qualification'] / $assignment['qualification'];
230
-						$sumResult += $data['qualification'];
231
-
232
-						if ($data['qualification'] > $bestResult) {
233
-							$bestResult = $data['qualification'];
234
-						}
235
-						$weight = $assignment['qualification'];
236
-					}
237
-				}
238
-			}
239
-
240
-			if ($rescount == 0) {
241
-				return null;
242
-			} else {
243
-				switch ($type) {
244
-					case 'best':
245
-						return array($bestResult, $weight);
246
-						break;
247
-					case 'average':
248
-						return array($sumResult/$rescount, $weight);
249
-						break;
250
-					case 'ranking':
251
-						return AbstractLink::getCurrentUserRanking($stud_id, $students);
252
-						break;
253
-					default:
254
-						return array($sum, $rescount);
255
-						break;
256
-				}
257
-			}
258
-		}
259
-	}
260
-
261
-	/**
262
-	 * Lazy load function to get the database table of the student publications
263
-	 */
264
-	private function get_studpub_table()
265
-	{
266
-		return $this->studpub_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
267
-	}
268
-
269
-	/**
270
-	 * Lazy load function to get the database table of the item properties
271
-	 */
272
-	private function get_itemprop_table()
273
-	{
274
-		return $this->itemprop_table = Database :: get_course_table(TABLE_ITEM_PROPERTY);
275
-	}
276
-
277
-	public function needs_name_and_description()
278
-	{
279
-		return false;
280
-	}
281
-
282
-	public function get_name()
283
-	{
284
-		$this->get_exercise_data();
285
-		return (isset($this->exercise_data['title']) && !empty($this->exercise_data['title'])) ? $this->exercise_data['title'] : get_lang('Untitled');
286
-	}
287
-
288
-	public function get_description()
289
-	{
290
-		$this->get_exercise_data();
291
-		return isset($this->exercise_data['description']) ? $this->exercise_data['description'] : null;
292
-	}
293
-
294
-	public function get_test_id()
295
-	{
296
-		return 'DEBUG:ID';
297
-	}
298
-
299
-	public function get_link()
300
-	{
301
-		$session_id = api_get_session_id();
302
-		$url = api_get_path(WEB_PATH).'main/work/work.php?session_id='.$session_id.'&cidReq='.$this->get_course_code().'&id='.$this->exercise_data['id'].'&gradebook=view';
303
-		return $url;
304
-	}
305
-
306
-	private function get_exercise_data()
307
-	{
308
-		$tbl_name = $this->get_studpub_table();
309
-		$course_info = api_get_course_info($this->get_course_code());
310
-		if ($tbl_name=='') {
311
-			return false;
312
-		} elseif (!isset($this->exercise_data)) {
313
-			$sql = 'SELECT * FROM '.$this->get_studpub_table()."
184
+        if (!empty($stud_id)) {
185
+            $sql .= " AND user_id = $stud_id ";
186
+        }
187
+
188
+        $order = api_get_setting('student_publication_to_take_in_gradebook');
189
+
190
+        switch ($order) {
191
+            case 'last':
192
+                // latest attempt
193
+                $sql .= ' ORDER BY sent_date DESC';
194
+                break;
195
+            case 'first':
196
+            default:
197
+                // first attempt
198
+                $sql .= ' ORDER BY id';
199
+                break;
200
+        }
201
+
202
+        $scores = Database::query($sql);
203
+
204
+        // for 1 student
205
+        if (!empty($stud_id)) {
206
+            if ($data = Database::fetch_array($scores)) {
207
+                return array(
208
+                    $data['qualification'],
209
+                    $assignment['qualification']
210
+                );
211
+            } else {
212
+                return '';
213
+            }
214
+        } else {
215
+            $students = array();  // user list, needed to make sure we only
216
+            // take first attempts into account
217
+            $rescount = 0;
218
+            $sum = 0;
219
+            $bestResult = 0;
220
+            $weight = 0;
221
+            $sumResult = 0;
222
+            $myResult = 0;
223
+
224
+            while ($data = Database::fetch_array($scores)) {
225
+                if (!(array_key_exists($data['user_id'], $students))) {
226
+                    if ($assignment['qualification'] != 0) {
227
+                        $students[$data['user_id']] = $data['qualification'];
228
+                        $rescount++;
229
+                        $sum += $data['qualification'] / $assignment['qualification'];
230
+                        $sumResult += $data['qualification'];
231
+
232
+                        if ($data['qualification'] > $bestResult) {
233
+                            $bestResult = $data['qualification'];
234
+                        }
235
+                        $weight = $assignment['qualification'];
236
+                    }
237
+                }
238
+            }
239
+
240
+            if ($rescount == 0) {
241
+                return null;
242
+            } else {
243
+                switch ($type) {
244
+                    case 'best':
245
+                        return array($bestResult, $weight);
246
+                        break;
247
+                    case 'average':
248
+                        return array($sumResult/$rescount, $weight);
249
+                        break;
250
+                    case 'ranking':
251
+                        return AbstractLink::getCurrentUserRanking($stud_id, $students);
252
+                        break;
253
+                    default:
254
+                        return array($sum, $rescount);
255
+                        break;
256
+                }
257
+            }
258
+        }
259
+    }
260
+
261
+    /**
262
+     * Lazy load function to get the database table of the student publications
263
+     */
264
+    private function get_studpub_table()
265
+    {
266
+        return $this->studpub_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
267
+    }
268
+
269
+    /**
270
+     * Lazy load function to get the database table of the item properties
271
+     */
272
+    private function get_itemprop_table()
273
+    {
274
+        return $this->itemprop_table = Database :: get_course_table(TABLE_ITEM_PROPERTY);
275
+    }
276
+
277
+    public function needs_name_and_description()
278
+    {
279
+        return false;
280
+    }
281
+
282
+    public function get_name()
283
+    {
284
+        $this->get_exercise_data();
285
+        return (isset($this->exercise_data['title']) && !empty($this->exercise_data['title'])) ? $this->exercise_data['title'] : get_lang('Untitled');
286
+    }
287
+
288
+    public function get_description()
289
+    {
290
+        $this->get_exercise_data();
291
+        return isset($this->exercise_data['description']) ? $this->exercise_data['description'] : null;
292
+    }
293
+
294
+    public function get_test_id()
295
+    {
296
+        return 'DEBUG:ID';
297
+    }
298
+
299
+    public function get_link()
300
+    {
301
+        $session_id = api_get_session_id();
302
+        $url = api_get_path(WEB_PATH).'main/work/work.php?session_id='.$session_id.'&cidReq='.$this->get_course_code().'&id='.$this->exercise_data['id'].'&gradebook=view';
303
+        return $url;
304
+    }
305
+
306
+    private function get_exercise_data()
307
+    {
308
+        $tbl_name = $this->get_studpub_table();
309
+        $course_info = api_get_course_info($this->get_course_code());
310
+        if ($tbl_name=='') {
311
+            return false;
312
+        } elseif (!isset($this->exercise_data)) {
313
+            $sql = 'SELECT * FROM '.$this->get_studpub_table()."
314 314
 					WHERE
315 315
 					 	c_id ='".$course_info['real_id']."' AND
316 316
 					 	id = '".intval($this->get_ref_id())."' ";
317
-			$query = Database::query($sql);
318
-			$this->exercise_data = Database::fetch_array($query);
319
-		}
320
-		return $this->exercise_data;
321
-	}
322
-
323
-	public function needs_max()
324
-	{
325
-		return false;
326
-	}
327
-
328
-	public function needs_results()
329
-	{
330
-		return false;
331
-	}
332
-
333
-	public function is_valid_link()
334
-	{
335
-		$sql = 'SELECT count(id) FROM '.$this->get_studpub_table().'
317
+            $query = Database::query($sql);
318
+            $this->exercise_data = Database::fetch_array($query);
319
+        }
320
+        return $this->exercise_data;
321
+    }
322
+
323
+    public function needs_max()
324
+    {
325
+        return false;
326
+    }
327
+
328
+    public function needs_results()
329
+    {
330
+        return false;
331
+    }
332
+
333
+    public function is_valid_link()
334
+    {
335
+        $sql = 'SELECT count(id) FROM '.$this->get_studpub_table().'
336 336
     			WHERE c_id = "'.$this->course_id.'" AND id = '.intval($this->get_ref_id()).'';
337
-		$result = Database::query($sql);
338
-		$number = Database::fetch_row($result);
339
-		return ($number[0] != 0);
340
-	}
341
-
342
-	public function get_icon_name()
343
-	{
344
-		return 'studentpublication';
345
-	}
346
-
347
-	public function save_linked_data()
348
-	{
349
-		$weight = (float)$this->get_weight();
350
-		$ref_id = $this->get_ref_id();
351
-
352
-		if (!empty($ref_id)) {
353
-			//Cleans works
354
-			$sql = 'UPDATE '.$this->get_studpub_table().' SET weight= '.$weight.'
337
+        $result = Database::query($sql);
338
+        $number = Database::fetch_row($result);
339
+        return ($number[0] != 0);
340
+    }
341
+
342
+    public function get_icon_name()
343
+    {
344
+        return 'studentpublication';
345
+    }
346
+
347
+    public function save_linked_data()
348
+    {
349
+        $weight = (float)$this->get_weight();
350
+        $ref_id = $this->get_ref_id();
351
+
352
+        if (!empty($ref_id)) {
353
+            //Cleans works
354
+            $sql = 'UPDATE '.$this->get_studpub_table().' SET weight= '.$weight.'
355 355
                     WHERE c_id = '.$this->course_id.' AND id ='.$ref_id;
356
-			Database::query($sql);
357
-		}
358
-	}
359
-
360
-	public function delete_linked_data()
361
-	{
362
-		$ref_id = $this->get_ref_id();
363
-		if (!empty($ref_id)) {
364
-			//Cleans works
365
-			$sql = 'UPDATE '.$this->get_studpub_table().' SET weight=0
356
+            Database::query($sql);
357
+        }
358
+    }
359
+
360
+    public function delete_linked_data()
361
+    {
362
+        $ref_id = $this->get_ref_id();
363
+        if (!empty($ref_id)) {
364
+            //Cleans works
365
+            $sql = 'UPDATE '.$this->get_studpub_table().' SET weight=0
366 366
                     WHERE c_id = '.$this->course_id.' AND id ='.$ref_id;
367
-			Database::query($sql);
368
-		}
369
-	}
367
+            Database::query($sql);
368
+        }
369
+    }
370 370
 }
Please login to merge, or discard this patch.
main/gradebook/lib/GradebookUtils.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -249,7 +249,7 @@
 block discarded – undo
249 249
                     }
250 250
                 }
251 251
 
252
-               $modify_icons .= '<a href="gradebook_edit_all.php?selectcat=' .$cat->get_id() . '&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id().'">' .
252
+                $modify_icons .= '<a href="gradebook_edit_all.php?selectcat=' .$cat->get_id() . '&cidReq=' . $cat->get_course_code() . '&id_session='.$cat->get_session_id().'">' .
253 253
                     Display::return_icon(
254 254
                         'percentage.png',
255 255
                         get_lang('EditAllWeights'),
Please login to merge, or discard this patch.
main/admin/grade_models.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
                         array('name'=>'name',           'index'=>'name',        'width'=>'80',   'align'=>'left'),
81 81
                         array('name'=>'description',    'index'=>'description', 'width'=>'500',  'align'=>'left','sortable'=>'false'),
82 82
                         array('name'=>'actions',        'index'=>'actions',     'width'=>'100',  'align'=>'left','formatter'=>'action_formatter','sortable'=>'false')
83
-                       );
83
+                        );
84 84
 //Autowidth
85 85
 $extra_params['autowidth'] = 'true';
86 86
 //height auto
@@ -89,8 +89,8 @@  discard block
 block discarded – undo
89 89
 //With this function we can add actions to the jgrid (edit, delete, etc)
90 90
 $action_links = 'function action_formatter(cellvalue, options, rowObject) {
91 91
                          return \'<a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'.
92
-                         '&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;"  href="?sec_token='.$token.'&action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'.
93
-                         '\';
92
+                            '&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;"  href="?sec_token='.$token.'&action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'.
93
+                            '\';
94 94
                  }';
95 95
 ?>
96 96
 <script>
Please login to merge, or discard this patch.
main/admin/access_url_add_usergroup_to_url.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@
 block discarded – undo
87 87
                   <?php
88 88
                     echo Display::get_alphabet_options($firstLetterUserGroup);
89 89
                     echo Display::get_numeric_options(0, 9, $firstLetterUserGroup);
90
-                  ?>
90
+                    ?>
91 91
             </select>
92 92
         </td>
93 93
         <td width="20%">&nbsp;</td>
Please login to merge, or discard this patch.
main/admin/legal_add.php 1 patch
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -18,93 +18,93 @@  discard block
 block discarded – undo
18 18
 
19 19
 $defaults = array();
20 20
 $term_preview = array(
21
-	'type' => 0,
22
-	'content' => '',
23
-	'changes' => '',
21
+    'type' => 0,
22
+    'content' => '',
23
+    'changes' => '',
24 24
 );
25 25
 if ($form->validate()) {
26
-	$check = Security::check_token('post');
27
-	if ($check) {
28
-		$values  = $form->getSubmitValues();
29
-		$lang 	 = $values['language'];
30
-		//language id
31
-		$lang = api_get_language_id($lang);
32
-
33
-		if (isset($values['type'])) {
34
-			$type 	 = $values['type'];
35
-		} else {
36
-			$type = 0;
37
-		}
38
-		if (isset($values['content'])) {
39
-			$content = $values['content'];
40
-		} else {
41
-			$content = '';
42
-		}
43
-		if (isset($values['changes'])) {
44
-			$changes = $values['changes'];
45
-		} else {
46
-			$changes = '';
47
-		}
48
-		$navigator_info = api_get_navigator();
49
-
50
-		if ($navigator_info['name']=='Internet Explorer' &&  $navigator_info['version']=='6') {
51
-			if (isset($values['preview'])) {
52
-				$submit	='preview';
53
-			} elseif (isset($values['save'])) {
54
-				$submit	='save';
55
-			} elseif (isset($values['back'])) {
56
-				$submit	='back';
57
-			}
58
-		} else {
59
-			$submit  = $values['send'];
60
-		}
61
-
62
-		$default['content'] = $content;
63
-		if (isset($values['language'])) {
64
-			if ($submit == 'back') {
65
-				header('Location: legal_add.php');
66
-				exit;
67
-			} elseif ($submit == 'save') {
68
-				$insert_result = LegalManager::add($lang, $content, $type, $changes);
69
-				if ($insert_result ) {
70
-					$message = get_lang('TermAndConditionSaved');
71
-				} else {
72
-					$message = get_lang('TermAndConditionNotSaved');
73
-				}
74
-				Security::clear_token();
75
-				$tok = Security::get_token();
76
-				header('Location: legal_list.php?action=show_message&message='.urlencode($message).'&sec_token='.$tok);
77
-				exit();
78
-			} elseif ($submit=='preview') {
79
-				$defaults['type'] = $type;
80
-				$defaults['content'] = $content;
81
-				$defaults['changes'] = $changes;
82
-				$term_preview = $defaults;
83
-				$term_preview['type'] = intval($_POST['type']);
84
-			} else {
85
-				$my_lang = $_POST['language'];
86
-				if (isset($_POST['language'])){
87
-					$all_langs = api_get_languages();
88
-					if (in_array($my_lang, $all_langs['folder'])){
89
-						$language = api_get_language_id($my_lang);
90
-						$term_preview = LegalManager::get_last_condition($language);
91
-						$defaults = $term_preview;
92
-						if (!$term_preview) {
93
-							// there are not terms and conditions
94
-							$term_preview['type']=-1;
95
-							$defaults['type']=0;
96
-						}
97
-					}
98
-				}
99
-			}
100
-		}
101
-	}
26
+    $check = Security::check_token('post');
27
+    if ($check) {
28
+        $values  = $form->getSubmitValues();
29
+        $lang 	 = $values['language'];
30
+        //language id
31
+        $lang = api_get_language_id($lang);
32
+
33
+        if (isset($values['type'])) {
34
+            $type 	 = $values['type'];
35
+        } else {
36
+            $type = 0;
37
+        }
38
+        if (isset($values['content'])) {
39
+            $content = $values['content'];
40
+        } else {
41
+            $content = '';
42
+        }
43
+        if (isset($values['changes'])) {
44
+            $changes = $values['changes'];
45
+        } else {
46
+            $changes = '';
47
+        }
48
+        $navigator_info = api_get_navigator();
49
+
50
+        if ($navigator_info['name']=='Internet Explorer' &&  $navigator_info['version']=='6') {
51
+            if (isset($values['preview'])) {
52
+                $submit	='preview';
53
+            } elseif (isset($values['save'])) {
54
+                $submit	='save';
55
+            } elseif (isset($values['back'])) {
56
+                $submit	='back';
57
+            }
58
+        } else {
59
+            $submit  = $values['send'];
60
+        }
61
+
62
+        $default['content'] = $content;
63
+        if (isset($values['language'])) {
64
+            if ($submit == 'back') {
65
+                header('Location: legal_add.php');
66
+                exit;
67
+            } elseif ($submit == 'save') {
68
+                $insert_result = LegalManager::add($lang, $content, $type, $changes);
69
+                if ($insert_result ) {
70
+                    $message = get_lang('TermAndConditionSaved');
71
+                } else {
72
+                    $message = get_lang('TermAndConditionNotSaved');
73
+                }
74
+                Security::clear_token();
75
+                $tok = Security::get_token();
76
+                header('Location: legal_list.php?action=show_message&message='.urlencode($message).'&sec_token='.$tok);
77
+                exit();
78
+            } elseif ($submit=='preview') {
79
+                $defaults['type'] = $type;
80
+                $defaults['content'] = $content;
81
+                $defaults['changes'] = $changes;
82
+                $term_preview = $defaults;
83
+                $term_preview['type'] = intval($_POST['type']);
84
+            } else {
85
+                $my_lang = $_POST['language'];
86
+                if (isset($_POST['language'])){
87
+                    $all_langs = api_get_languages();
88
+                    if (in_array($my_lang, $all_langs['folder'])){
89
+                        $language = api_get_language_id($my_lang);
90
+                        $term_preview = LegalManager::get_last_condition($language);
91
+                        $defaults = $term_preview;
92
+                        if (!$term_preview) {
93
+                            // there are not terms and conditions
94
+                            $term_preview['type']=-1;
95
+                            $defaults['type']=0;
96
+                        }
97
+                    }
98
+                }
99
+            }
100
+        }
101
+    }
102 102
 }
103 103
 
104 104
 $form->setDefaults($defaults);
105 105
 
106 106
 if (isset($_POST['send'])) {
107
-	Security::clear_token();
107
+    Security::clear_token();
108 108
 }
109 109
 $token = Security::get_token();
110 110
 
@@ -115,34 +115,34 @@  discard block
 block discarded – undo
115 115
 
116 116
 if (isset($_POST['language'])) {
117 117
 
118
-	$form->addElement('static', Security::remove_XSS($_POST['language']));
119
-	$form->addElement('hidden', 'language',Security::remove_XSS($_POST['language']));
120
-	$form->addHtmlEditor('content', get_lang('Content'), true, false, array('ToolbarSet' => 'terms_and_conditions', 'Width' => '100%', 'Height' => '250'));
118
+    $form->addElement('static', Security::remove_XSS($_POST['language']));
119
+    $form->addElement('hidden', 'language',Security::remove_XSS($_POST['language']));
120
+    $form->addHtmlEditor('content', get_lang('Content'), true, false, array('ToolbarSet' => 'terms_and_conditions', 'Width' => '100%', 'Height' => '250'));
121 121
 
122
-	$form->addElement('radio', 'type', '', get_lang('HTMLText') ,'0');
123
-	$form->addElement('radio', 'type', '', get_lang('PageLink') ,'1');
124
-	$form->addElement('textarea', 'changes', get_lang('ExplainChanges'),array('width'=>'20'));
122
+    $form->addElement('radio', 'type', '', get_lang('HTMLText') ,'0');
123
+    $form->addElement('radio', 'type', '', get_lang('PageLink') ,'1');
124
+    $form->addElement('textarea', 'changes', get_lang('ExplainChanges'),array('width'=>'20'));
125 125
 
126
-	$preview = LegalManager::show_last_condition($term_preview);
126
+    $preview = LegalManager::show_last_condition($term_preview);
127 127
 
128
-	if ($term_preview['type']!=-1) {
129
-		$form->addElement('label', get_lang('Preview'),  $preview);
130
-	}
128
+    if ($term_preview['type']!=-1) {
129
+        $form->addElement('label', get_lang('Preview'),  $preview);
130
+    }
131 131
 
132
-	// Submit & preview button
132
+    // Submit & preview button
133 133
     $navigator_info = api_get_navigator();
134 134
 
135 135
     //ie6 fix
136
-	if ($navigator_info['name']=='Internet Explorer' &&  $navigator_info['version']=='6') {
137
-		$buttons = '<div class="row" align="center">
136
+    if ($navigator_info['name']=='Internet Explorer' &&  $navigator_info['version']=='6') {
137
+        $buttons = '<div class="row" align="center">
138 138
 				<div class="formw">
139 139
 				<input type="submit" name="back"  value="'.get_lang('Back').'"/>
140 140
 				<input type="submit" name="preview"  value="'.get_lang('Preview').'"/>
141 141
 				<input type="submit" name="save"  value="'.get_lang('Save').'"/>
142 142
 				</div>
143 143
 			</div>';
144
-			$form->addElement('html',$buttons);
145
-	} else {
144
+            $form->addElement('html',$buttons);
145
+    } else {
146 146
         $buttons = '<div class="row" align="center">
147 147
 					<div class="formw">
148 148
 					<button type="submit" class="back" 	 name="send" value="back">'.get_lang('Back').'</button>
@@ -150,11 +150,11 @@  discard block
 block discarded – undo
150 150
 					<button type="submit" class="save" 	 name="send" value="save">'.get_lang('Save').'</button>
151 151
 					</div>
152 152
 				</div>';
153
-		$form->addElement('html',$buttons);
154
-	}
153
+        $form->addElement('html',$buttons);
154
+    }
155 155
 } else {
156
-	$form->addElement('select_language', 'language', get_lang('Language'),null,array());
157
-	$form->addElement('button', 'send', get_lang('Load'));
156
+    $form->addElement('select_language', 'language', get_lang('Language'),null,array());
157
+    $form->addElement('button', 'send', get_lang('Load'));
158 158
 
159 159
 }
160 160
 
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
 echo '</div>';
177 177
 
178 178
 if (isset ($_GET['action'])) {
179
-	switch ($_GET['action']) {
180
-		case 'show_message' :
181
-			Display :: display_normal_message(stripslashes($_GET['message']));
182
-			break;
183
-	}
179
+    switch ($_GET['action']) {
180
+        case 'show_message' :
181
+            Display :: display_normal_message(stripslashes($_GET['message']));
182
+            break;
183
+    }
184 184
 }
185 185
 
186 186
 $form->setDefaults($defaults);
Please login to merge, or discard this patch.
main/admin/subscribe_class2course.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
     <select name="firstLetterClass" onchange="javascript:document.formulaire.formSent.value='2'; document.formulaire.submit();">
91 91
      <option value="">--</option>
92 92
      <?php
93
-     echo Display::get_alphabet_options($first_letter_class);
94
-     ?>
93
+        echo Display::get_alphabet_options($first_letter_class);
94
+        ?>
95 95
     </select>
96 96
    </td>
97 97
    <td width="20%">&nbsp;</td>
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
     <select name="firstLetterCourse" onchange="javascript:document.formulaire.formSent.value='2'; document.formulaire.submit();">
103 103
      <option value="">--</option>
104 104
      <?php
105
-     echo Display::get_alphabet_options($first_letter_course);
106
-     ?>
105
+        echo Display::get_alphabet_options($first_letter_course);
106
+        ?>
107 107
     </select>
108 108
    </td>
109 109
   </tr>
Please login to merge, or discard this patch.
main/admin/user_edit.php 1 patch
Indentation   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -157,27 +157,27 @@  discard block
 block discarded – undo
157 157
 $form->addElement('hidden', 'user_id', $user_id);
158 158
 
159 159
 if (api_is_western_name_order()) {
160
-	// Firstname
161
-	$form->addElement('text', 'firstname', get_lang('FirstName'));
162
-	$form->applyFilter('firstname', 'html_filter');
163
-	$form->applyFilter('firstname', 'trim');
164
-	$form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
165
-	// Lastname
166
-	$form->addElement('text', 'lastname', get_lang('LastName'));
167
-	$form->applyFilter('lastname', 'html_filter');
168
-	$form->applyFilter('lastname', 'trim');
169
-	$form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
160
+    // Firstname
161
+    $form->addElement('text', 'firstname', get_lang('FirstName'));
162
+    $form->applyFilter('firstname', 'html_filter');
163
+    $form->applyFilter('firstname', 'trim');
164
+    $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
165
+    // Lastname
166
+    $form->addElement('text', 'lastname', get_lang('LastName'));
167
+    $form->applyFilter('lastname', 'html_filter');
168
+    $form->applyFilter('lastname', 'trim');
169
+    $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
170 170
 } else {
171
-	// Lastname
172
-	$form->addElement('text', 'lastname', get_lang('LastName'));
173
-	$form->applyFilter('lastname', 'html_filter');
174
-	$form->applyFilter('lastname', 'trim');
175
-	$form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
176
-	// Firstname
177
-	$form->addElement('text', 'firstname', get_lang('FirstName'));
178
-	$form->applyFilter('firstname', 'html_filter');
179
-	$form->applyFilter('firstname', 'trim');
180
-	$form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
171
+    // Lastname
172
+    $form->addElement('text', 'lastname', get_lang('LastName'));
173
+    $form->applyFilter('lastname', 'html_filter');
174
+    $form->applyFilter('lastname', 'trim');
175
+    $form->addRule('lastname', get_lang('ThisFieldIsRequired'), 'required');
176
+    // Firstname
177
+    $form->addElement('text', 'firstname', get_lang('FirstName'));
178
+    $form->applyFilter('firstname', 'html_filter');
179
+    $form->applyFilter('firstname', 'trim');
180
+    $form->addRule('firstname', get_lang('ThisFieldIsRequired'), 'required');
181 181
 }
182 182
 
183 183
 // Official code
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 
200 200
 // OpenID
201 201
 if (api_get_setting('openid_authentication') == 'true') {
202
-	$form->addElement('text', 'openid', get_lang('OpenIDURL'));
202
+    $form->addElement('text', 'openid', get_lang('OpenIDURL'));
203 203
 }
204 204
 
205 205
 // Phone
@@ -225,18 +225,18 @@  discard block
 block discarded – undo
225 225
 $form->addHidden('cropResult', '');
226 226
 
227 227
 $form->addRule(
228
-	'picture',
229
-	get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')',
230
-	'filetype',
231
-	$allowed_picture_types
228
+    'picture',
229
+    get_lang('OnlyImagesAllowed').' ('.implode(',', $allowed_picture_types).')',
230
+    'filetype',
231
+    $allowed_picture_types
232 232
 );
233 233
 if (strlen($user_data['picture_uri']) > 0) {
234
-	$form->addElement('checkbox', 'delete_picture', '', get_lang('DelImage'));
234
+    $form->addElement('checkbox', 'delete_picture', '', get_lang('DelImage'));
235 235
 }
236 236
 
237 237
 // Username
238 238
 if (api_get_setting('login_is_email') != 'true') {
239
-	$form->addElement('text', 'username', get_lang('LoginName'), array('maxlength' => USERNAME_MAX_LENGTH));
239
+    $form->addElement('text', 'username', get_lang('LoginName'), array('maxlength' => USERNAME_MAX_LENGTH));
240 240
     $form->addRule('username', get_lang('ThisFieldIsRequired'), 'required');
241 241
     $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
242 242
     $form->addRule('username', get_lang('OnlyLettersAndNumbersAllowed'), 'username');
@@ -308,15 +308,15 @@  discard block
 block discarded – undo
308 308
 
309 309
 // Platform admin
310 310
 if (api_is_platform_admin()) {
311
-	$group = array();
312
-	$group[] =$form->createElement('radio', 'platform_admin', null, get_lang('Yes'), 1);
313
-	$group[] =$form->createElement('radio', 'platform_admin', null, get_lang('No'), 0);
311
+    $group = array();
312
+    $group[] =$form->createElement('radio', 'platform_admin', null, get_lang('Yes'), 1);
313
+    $group[] =$form->createElement('radio', 'platform_admin', null, get_lang('No'), 0);
314 314
 
315
-	$user_data['status'] == 1 ? $display = 'block':$display = 'none';
315
+    $user_data['status'] == 1 ? $display = 'block':$display = 'none';
316 316
 
317
-	$form->addElement('html', '<div id="id_platform_admin" style="display:'.$display.'">');
318
-	$form->addGroup($group, 'admin', get_lang('PlatformAdmin'), null, false);
319
-	$form->addElement('html', '</div>');
317
+    $form->addElement('html', '<div id="id_platform_admin" style="display:'.$display.'">');
318
+    $form->addGroup($group, 'admin', get_lang('PlatformAdmin'), null, false);
319
+    $form->addElement('html', '</div>');
320 320
 }
321 321
 
322 322
 //Language
@@ -334,16 +334,16 @@  discard block
 block discarded – undo
334 334
 $form->addElement('label', get_lang('RegistrationDate'), $date);
335 335
 
336 336
 if (!$user_data['platform_admin']) {
337
-	// Expiration Date
338
-	$form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0);
339
-	$group = array ();
340
-	$group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('Enabled'), 1);
341
-	$group[] = $form->createElement('DateTimePicker', 'expiration_date', null, array('onchange' => 'javascript: enable_expiration_date();'));
342
-	$form->addGroup($group, 'max_member_group', null, '', false);
343
-
344
-	// Active account or inactive account
345
-	$form->addElement('radio', 'active', get_lang('ActiveAccount'), get_lang('Active'), 1);
346
-	$form->addElement('radio', 'active', '', get_lang('Inactive'), 0);
337
+    // Expiration Date
338
+    $form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0);
339
+    $group = array ();
340
+    $group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('Enabled'), 1);
341
+    $group[] = $form->createElement('DateTimePicker', 'expiration_date', null, array('onchange' => 'javascript: enable_expiration_date();'));
342
+    $form->addGroup($group, 'max_member_group', null, '', false);
343
+
344
+    // Active account or inactive account
345
+    $form->addElement('radio', 'active', get_lang('ActiveAccount'), get_lang('Active'), 1);
346
+    $form->addElement('radio', 'active', '', get_lang('Inactive'), 0);
347 347
 }
348 348
 
349 349
 // EXTRA FIELDS
@@ -366,18 +366,18 @@  discard block
 block discarded – undo
366 366
 $expiration_date = $user_data['expiration_date'];
367 367
 
368 368
 if (empty($expiration_date)) {
369
-	$user_data['radio_expiration_date'] = 0;
370
-	$user_data['expiration_date'] = api_get_local_time();
369
+    $user_data['radio_expiration_date'] = 0;
370
+    $user_data['expiration_date'] = api_get_local_time();
371 371
 } else {
372
-	$user_data['radio_expiration_date'] = 1;
373
-	$user_data['expiration_date'] = api_get_local_time($expiration_date);
372
+    $user_data['radio_expiration_date'] = 1;
373
+    $user_data['expiration_date'] = api_get_local_time($expiration_date);
374 374
 }
375 375
 $form->setDefaults($user_data);
376 376
 
377 377
 $error_drh = false;
378 378
 // Validate form
379 379
 if ($form->validate()) {
380
-	$user = $form->getSubmitValues(1);
380
+    $user = $form->getSubmitValues(1);
381 381
     $reset_password = intval($user['reset_password']);
382 382
     if ($reset_password == 2 && empty($user['password'])) {
383 383
         Display::addFlash(Display::return_message(get_lang('PasswordIsTooShort')));
@@ -385,18 +385,18 @@  discard block
 block discarded – undo
385 385
         exit();
386 386
     }
387 387
 
388
-	$is_user_subscribed_in_course = CourseManager::is_user_subscribed_in_course($user['user_id']);
388
+    $is_user_subscribed_in_course = CourseManager::is_user_subscribed_in_course($user['user_id']);
389 389
 
390
-	if ($user['status'] == DRH && $is_user_subscribed_in_course) {
391
-		$error_drh = true;
392
-	} else {
393
-		$picture_element = $form->getElement('picture');
394
-		$picture = $picture_element->getValue();
390
+    if ($user['status'] == DRH && $is_user_subscribed_in_course) {
391
+        $error_drh = true;
392
+    } else {
393
+        $picture_element = $form->getElement('picture');
394
+        $picture = $picture_element->getValue();
395 395
 
396
-		$picture_uri = $user_data['picture_uri'];
397
-		if (isset($user['delete_picture']) && $user['delete_picture']) {
398
-			$picture_uri = UserManager::delete_user_picture($user_id);
399
-		} elseif (!empty($picture['name'])) {
396
+        $picture_uri = $user_data['picture_uri'];
397
+        if (isset($user['delete_picture']) && $user['delete_picture']) {
398
+            $picture_uri = UserManager::delete_user_picture($user_id);
399
+        } elseif (!empty($picture['name'])) {
400 400
             $picture_uri = UserManager::update_user_picture(
401 401
                 $user_id,
402 402
                 $_FILES['picture']['name'],
@@ -404,30 +404,30 @@  discard block
 block discarded – undo
404 404
                 $user['cropResult']
405 405
                     
406 406
             );
407
-		}
407
+        }
408 408
 
409
-		$lastname = $user['lastname'];
410
-		$firstname = $user['firstname'];
409
+        $lastname = $user['lastname'];
410
+        $firstname = $user['firstname'];
411 411
         $password = $user['password'];
412 412
         $auth_source = isset($user['auth_source']) ? $user['auth_source'] : $userInfo['auth_source'];
413
-		$official_code = $user['official_code'];
414
-		$email = $user['email'];
415
-		$phone = $user['phone'];
416
-		$username = isset($user['username']) ? $user['username'] : $userInfo['username'];
417
-		$status = intval($user['status']);
418
-		$platform_admin = intval($user['platform_admin']);
419
-		$send_mail = intval($user['send_mail']);
420
-		$reset_password = intval($user['reset_password']);
421
-		$hr_dept_id = isset($user['hr_dept_id']) ? intval($user['hr_dept_id']) : null;
422
-		$language = $user['language'];
423
-
424
-		if ($user['radio_expiration_date'] == '1' && !$user_data['platform_admin']) {
413
+        $official_code = $user['official_code'];
414
+        $email = $user['email'];
415
+        $phone = $user['phone'];
416
+        $username = isset($user['username']) ? $user['username'] : $userInfo['username'];
417
+        $status = intval($user['status']);
418
+        $platform_admin = intval($user['platform_admin']);
419
+        $send_mail = intval($user['send_mail']);
420
+        $reset_password = intval($user['reset_password']);
421
+        $hr_dept_id = isset($user['hr_dept_id']) ? intval($user['hr_dept_id']) : null;
422
+        $language = $user['language'];
423
+
424
+        if ($user['radio_expiration_date'] == '1' && !$user_data['platform_admin']) {
425 425
             $expiration_date = $user['expiration_date'];
426
-		} else {
427
-			$expiration_date = null;
428
-		}
426
+        } else {
427
+            $expiration_date = null;
428
+        }
429 429
 
430
-		$active = $user_data['platform_admin'] ? 1 : intval($user['active']);
430
+        $active = $user_data['platform_admin'] ? 1 : intval($user['active']);
431 431
 
432 432
         //If the user is set to admin the status will be overwrite by COURSEMANAGER = 1
433 433
         if ($platform_admin == 1) {
@@ -461,31 +461,31 @@  discard block
 block discarded – undo
461 461
             $reset_password
462 462
         );
463 463
 
464
-		if (api_get_setting('openid_authentication') == 'true' && !empty($user['openid'])) {
465
-			$up = UserManager::update_openid($user_id, $user['openid']);
466
-		}
464
+        if (api_get_setting('openid_authentication') == 'true' && !empty($user['openid'])) {
465
+            $up = UserManager::update_openid($user_id, $user['openid']);
466
+        }
467 467
         $currentUserId = api_get_user_id();
468
-		if ($user_id != $currentUserId) {
469
-			if ($platform_admin == 1) {
468
+        if ($user_id != $currentUserId) {
469
+            if ($platform_admin == 1) {
470 470
                 UserManager::add_user_as_admin($user_id);
471
-			} else {
471
+            } else {
472 472
                 UserManager::remove_user_admin($user_id);
473
-			}
474
-		}
473
+            }
474
+        }
475 475
 
476 476
         $extraFieldValue = new ExtraFieldValue('user');
477 477
         $extraFieldValue->saveFieldValues($user);
478 478
 
479
-		$tok = Security::get_token();
480
-		header('Location: user_list.php?action=show_message&message='.urlencode(get_lang('UserUpdated')).'&sec_token='.$tok);
481
-		exit();
482
-	}
479
+        $tok = Security::get_token();
480
+        header('Location: user_list.php?action=show_message&message='.urlencode(get_lang('UserUpdated')).'&sec_token='.$tok);
481
+        exit();
482
+    }
483 483
 }
484 484
 
485 485
 $message = null;
486 486
 if ($error_drh) {
487
-	$err_msg = get_lang('StatusCanNotBeChangedToHumanResourcesManager');
488
-	$message = Display::return_message($err_msg, 'error');
487
+    $err_msg = get_lang('StatusCanNotBeChangedToHumanResourcesManager');
488
+    $message = Display::return_message($err_msg, 'error');
489 489
 }
490 490
 
491 491
 $content = null;
Please login to merge, or discard this patch.
main/admin/add_courses_to_usergroup.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -229,31 +229,31 @@  discard block
 block discarded – undo
229 229
   <td align="center">
230 230
   <div id="content_source">
231 231
       <?php
232
-      if (!($add_type=='multiple')) {
232
+        if (!($add_type=='multiple')) {
233 233
         ?>
234 234
         <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" />
235 235
         <div id="ajax_list_users_single"></div>
236 236
         <?php
237
-      } else {
238
-      ?>
237
+        } else {
238
+        ?>
239 239
       <div id="ajax_list_multiple">
240 240
         <?php echo Display::select('elements_not_in_name', $elements_not_in, '', array('style'=>'width:360px', 'multiple'=>'multiple','id'=>'elements_not_in','size'=>'15px'),false); ?>
241 241
       </div>
242 242
     <?php
243
-      }
244
-     ?>
243
+        }
244
+        ?>
245 245
   </div>
246 246
   </td>
247 247
   <td width="10%" valign="middle" align="center">
248 248
   <?php
249
-  if ($ajax_search) {
250
-  ?>
249
+    if ($ajax_search) {
250
+    ?>
251 251
     <button class="btn bt-default" type="button" onclick="remove_item(document.getElementById('elements_in'))" >
252 252
         <em class="fa fa-arrow-left"></em>
253 253
     </button>
254 254
   <?php
255
-  } else {
256
-  ?>
255
+    } else {
256
+    ?>
257 257
     <button class="btn btn-default" type="button" onclick="moveItem(document.getElementById('elements_not_in'), document.getElementById('elements_in'))" onclick="moveItem(document.getElementById('elements_not_in'), document.getElementById('elements_in'))">
258 258
         <em class="fa fa-arrow-right"></em>
259 259
     </button>
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
         <em class="fa fa-arrow-left"></em>
263 263
     </button>
264 264
     <?php
265
-  }
266
-  ?>
265
+    }
266
+    ?>
267 267
     <br /><br /><br /><br /><br /><br />
268 268
   </td>
269 269
   <td align="center">
Please login to merge, or discard this patch.