@@ -149,21 +149,21 @@ |
||
149 | 149 | |
150 | 150 | foreach ($edits as $edit) { |
151 | 151 | switch (strtolower(get_class($edit))) { |
152 | - case 'text_diff_op_copy': |
|
153 | - $output .= $this->_context($edit->orig); |
|
154 | - break; |
|
152 | + case 'text_diff_op_copy': |
|
153 | + $output .= $this->_context($edit->orig); |
|
154 | + break; |
|
155 | 155 | |
156 | - case 'text_diff_op_add': |
|
157 | - $output .= $this->_added($edit->final); |
|
158 | - break; |
|
156 | + case 'text_diff_op_add': |
|
157 | + $output .= $this->_added($edit->final); |
|
158 | + break; |
|
159 | 159 | |
160 | - case 'text_diff_op_delete': |
|
161 | - $output .= $this->_deleted($edit->orig); |
|
162 | - break; |
|
160 | + case 'text_diff_op_delete': |
|
161 | + $output .= $this->_deleted($edit->orig); |
|
162 | + break; |
|
163 | 163 | |
164 | - case 'text_diff_op_change': |
|
165 | - $output .= $this->_changed($edit->orig, $edit->final); |
|
166 | - break; |
|
164 | + case 'text_diff_op_change': |
|
165 | + $output .= $this->_changed($edit->orig, $edit->final); |
|
166 | + break; |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 |
@@ -46,17 +46,17 @@ |
||
46 | 46 | continue; |
47 | 47 | } |
48 | 48 | switch ($line[0]) { |
49 | - case ' ': |
|
50 | - $edits[] = &new Text_Diff_Op_copy(array(substr($line, 1))); |
|
51 | - break; |
|
49 | + case ' ': |
|
50 | + $edits[] = &new Text_Diff_Op_copy(array(substr($line, 1))); |
|
51 | + break; |
|
52 | 52 | |
53 | - case '+': |
|
54 | - $edits[] = &new Text_Diff_Op_add(array(substr($line, 1))); |
|
55 | - break; |
|
53 | + case '+': |
|
54 | + $edits[] = &new Text_Diff_Op_add(array(substr($line, 1))); |
|
55 | + break; |
|
56 | 56 | |
57 | - case '-': |
|
58 | - $edits[] = &new Text_Diff_Op_delete(array(substr($line, 1))); |
|
59 | - break; |
|
57 | + case '-': |
|
58 | + $edits[] = &new Text_Diff_Op_delete(array(substr($line, 1))); |
|
59 | + break; |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 |
@@ -93,29 +93,29 @@ |
||
93 | 93 | } |
94 | 94 | |
95 | 95 | switch ($match[3]) { |
96 | - case 'd': |
|
97 | - // deleted lines |
|
98 | - array_push($edits, |
|
99 | - new Text_Diff_Op_delete( |
|
100 | - $this->_getLines($from_lines, $from_line_no, $match[2]))); |
|
101 | - $to_line_no++; |
|
102 | - break; |
|
103 | - |
|
104 | - case 'c': |
|
105 | - // changed lines |
|
106 | - array_push($edits, |
|
107 | - new Text_Diff_Op_change( |
|
108 | - $this->_getLines($from_lines, $from_line_no, $match[2]), |
|
109 | - $this->_getLines($to_lines, $to_line_no, $match[5]))); |
|
110 | - break; |
|
111 | - |
|
112 | - case 'a': |
|
113 | - // added lines |
|
114 | - array_push($edits, |
|
115 | - new Text_Diff_Op_add( |
|
116 | - $this->_getLines($to_lines, $to_line_no, $match[5]))); |
|
117 | - $from_line_no++; |
|
118 | - break; |
|
96 | + case 'd': |
|
97 | + // deleted lines |
|
98 | + array_push($edits, |
|
99 | + new Text_Diff_Op_delete( |
|
100 | + $this->_getLines($from_lines, $from_line_no, $match[2]))); |
|
101 | + $to_line_no++; |
|
102 | + break; |
|
103 | + |
|
104 | + case 'c': |
|
105 | + // changed lines |
|
106 | + array_push($edits, |
|
107 | + new Text_Diff_Op_change( |
|
108 | + $this->_getLines($from_lines, $from_line_no, $match[2]), |
|
109 | + $this->_getLines($to_lines, $to_line_no, $match[5]))); |
|
110 | + break; |
|
111 | + |
|
112 | + case 'a': |
|
113 | + // added lines |
|
114 | + array_push($edits, |
|
115 | + new Text_Diff_Op_add( |
|
116 | + $this->_getLines($to_lines, $to_line_no, $match[5]))); |
|
117 | + $from_line_no++; |
|
118 | + break; |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 |
@@ -346,19 +346,19 @@ discard block |
||
346 | 346 | } |
347 | 347 | foreach ($option as $opt => $val) { |
348 | 348 | switch ($opt) { |
349 | - case 'color': |
|
350 | - $this->setColors($val); |
|
351 | - break; |
|
352 | - case 'text': |
|
353 | - if (is_array($val)) { |
|
354 | - $this->_text = implode('\n', $val); |
|
355 | - } else { |
|
356 | - $this->_text = $val; |
|
357 | - } |
|
358 | - break; |
|
359 | - default: |
|
360 | - $this->_options[$opt] = $val; |
|
361 | - break; |
|
349 | + case 'color': |
|
350 | + $this->setColors($val); |
|
351 | + break; |
|
352 | + case 'text': |
|
353 | + if (is_array($val)) { |
|
354 | + $this->_text = implode('\n', $val); |
|
355 | + } else { |
|
356 | + $this->_text = $val; |
|
357 | + } |
|
358 | + break; |
|
359 | + default: |
|
360 | + $this->_options[$opt] = $val; |
|
361 | + break; |
|
362 | 362 | } |
363 | 363 | if (isset($reInits[$opt])) { |
364 | 364 | $this->_init = false; |
@@ -511,45 +511,45 @@ discard block |
||
511 | 511 | $image_canvas = false; |
512 | 512 | switch (true) { |
513 | 513 | |
514 | - case (empty($this->_options['canvas'])): |
|
515 | - // Create new image from width && height of the clipping |
|
516 | - $this->_img = imagecreatetruecolor( |
|
517 | - $this->_options['width'], $this->_options['height'] |
|
518 | - ); |
|
519 | - if (!$this->_img) { |
|
520 | - throw new Image_Text_Exception('Could not create image canvas.'); |
|
521 | - } |
|
522 | - break; |
|
514 | + case (empty($this->_options['canvas'])): |
|
515 | + // Create new image from width && height of the clipping |
|
516 | + $this->_img = imagecreatetruecolor( |
|
517 | + $this->_options['width'], $this->_options['height'] |
|
518 | + ); |
|
519 | + if (!$this->_img) { |
|
520 | + throw new Image_Text_Exception('Could not create image canvas.'); |
|
521 | + } |
|
522 | + break; |
|
523 | 523 | |
524 | - case (is_resource($this->_options['canvas']) && |
|
525 | - get_resource_type($this->_options['canvas']) == 'gd'): |
|
526 | - // The canvas is an image resource |
|
527 | - $image_canvas = true; |
|
528 | - $this->_img = $this->_options['canvas']; |
|
529 | - break; |
|
524 | + case (is_resource($this->_options['canvas']) && |
|
525 | + get_resource_type($this->_options['canvas']) == 'gd'): |
|
526 | + // The canvas is an image resource |
|
527 | + $image_canvas = true; |
|
528 | + $this->_img = $this->_options['canvas']; |
|
529 | + break; |
|
530 | 530 | |
531 | - case (is_array($this->_options['canvas']) && |
|
532 | - isset($this->_options['canvas']['width']) && |
|
533 | - isset($this->_options['canvas']['height'])): |
|
531 | + case (is_array($this->_options['canvas']) && |
|
532 | + isset($this->_options['canvas']['width']) && |
|
533 | + isset($this->_options['canvas']['height'])): |
|
534 | 534 | |
535 | - // Canvas must be a width and height measure |
|
536 | - $this->_img = imagecreatetruecolor( |
|
537 | - $this->_options['canvas']['width'], |
|
538 | - $this->_options['canvas']['height'] |
|
539 | - ); |
|
540 | - break; |
|
535 | + // Canvas must be a width and height measure |
|
536 | + $this->_img = imagecreatetruecolor( |
|
537 | + $this->_options['canvas']['width'], |
|
538 | + $this->_options['canvas']['height'] |
|
539 | + ); |
|
540 | + break; |
|
541 | 541 | |
542 | - case (is_array($this->_options['canvas']) && |
|
543 | - isset($this->_options['canvas']['size']) && |
|
544 | - ($this->_options['canvas']['size'] = 'auto')): |
|
542 | + case (is_array($this->_options['canvas']) && |
|
543 | + isset($this->_options['canvas']['size']) && |
|
544 | + ($this->_options['canvas']['size'] = 'auto')): |
|
545 | 545 | |
546 | - case (is_string($this->_options['canvas']) && |
|
547 | - ($this->_options['canvas'] = 'auto')): |
|
548 | - $this->_mode = 'auto'; |
|
549 | - break; |
|
546 | + case (is_string($this->_options['canvas']) && |
|
547 | + ($this->_options['canvas'] = 'auto')): |
|
548 | + $this->_mode = 'auto'; |
|
549 | + break; |
|
550 | 550 | |
551 | - default: |
|
552 | - throw new Image_Text_Exception('Could not create image canvas.'); |
|
551 | + default: |
|
552 | + throw new Image_Text_Exception('Could not create image canvas.'); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | if ($this->_img) { |
@@ -889,19 +889,19 @@ discard block |
||
889 | 889 | $cosR = cos($radians); |
890 | 890 | |
891 | 891 | switch ($this->_options['valign']) { |
892 | - case self::IMAGE_TEXT_ALIGN_TOP: |
|
893 | - $valign_space = 0; |
|
894 | - break; |
|
895 | - case self::IMAGE_TEXT_ALIGN_MIDDLE: |
|
896 | - $valign_space = ($this->_options['height'] |
|
897 | - - $this->_realTextSize['height']) / 2; |
|
898 | - break; |
|
899 | - case self::IMAGE_TEXT_ALIGN_BOTTOM: |
|
900 | - $valign_space = $this->_options['height'] |
|
901 | - - $this->_realTextSize['height']; |
|
902 | - break; |
|
903 | - default: |
|
904 | - $valign_space = 0; |
|
892 | + case self::IMAGE_TEXT_ALIGN_TOP: |
|
893 | + $valign_space = 0; |
|
894 | + break; |
|
895 | + case self::IMAGE_TEXT_ALIGN_MIDDLE: |
|
896 | + $valign_space = ($this->_options['height'] |
|
897 | + - $this->_realTextSize['height']) / 2; |
|
898 | + break; |
|
899 | + case self::IMAGE_TEXT_ALIGN_BOTTOM: |
|
900 | + $valign_space = $this->_options['height'] |
|
901 | + - $this->_realTextSize['height']; |
|
902 | + break; |
|
903 | + default: |
|
904 | + $valign_space = 0; |
|
905 | 905 | } |
906 | 906 | |
907 | 907 | $space = (1 + $line_spacing) * $size; |
@@ -932,18 +932,18 @@ discard block |
||
932 | 932 | // Calc the position using the block width, the current line width and |
933 | 933 | // obviously the angle. That gives us the offset to slide the line. |
934 | 934 | switch ($align) { |
935 | - case self::IMAGE_TEXT_ALIGN_LEFT: |
|
936 | - $hyp = 0; |
|
937 | - break; |
|
938 | - case self::IMAGE_TEXT_ALIGN_RIGHT: |
|
939 | - $hyp = $block_width - $line_width - $left_margin; |
|
940 | - break; |
|
941 | - case self::IMAGE_TEXT_ALIGN_CENTER: |
|
942 | - $hyp = ($block_width - $line_width) / 2 - $left_margin; |
|
943 | - break; |
|
944 | - default: |
|
945 | - $hyp = 0; |
|
946 | - break; |
|
935 | + case self::IMAGE_TEXT_ALIGN_LEFT: |
|
936 | + $hyp = 0; |
|
937 | + break; |
|
938 | + case self::IMAGE_TEXT_ALIGN_RIGHT: |
|
939 | + $hyp = $block_width - $line_width - $left_margin; |
|
940 | + break; |
|
941 | + case self::IMAGE_TEXT_ALIGN_CENTER: |
|
942 | + $hyp = ($block_width - $line_width) / 2 - $left_margin; |
|
943 | + break; |
|
944 | + default: |
|
945 | + $hyp = 0; |
|
946 | + break; |
|
947 | 947 | } |
948 | 948 | |
949 | 949 | $posx = $new_posx + $cosR * $hyp; |
@@ -997,17 +997,17 @@ discard block |
||
997 | 997 | throw new Image_Text_Exception('Header already sent.'); |
998 | 998 | } |
999 | 999 | switch ($this->_options['image_type']) { |
1000 | - case IMAGETYPE_PNG: |
|
1001 | - $imgout = 'imagepng'; |
|
1002 | - break; |
|
1003 | - case IMAGETYPE_JPEG: |
|
1004 | - $imgout = 'imagejpeg'; |
|
1005 | - break; |
|
1006 | - case IMAGETYPE_BMP: |
|
1007 | - $imgout = 'imagebmp'; |
|
1008 | - break; |
|
1009 | - default: |
|
1010 | - throw new Image_Text_Exception('Unsupported image type.'); |
|
1000 | + case IMAGETYPE_PNG: |
|
1001 | + $imgout = 'imagepng'; |
|
1002 | + break; |
|
1003 | + case IMAGETYPE_JPEG: |
|
1004 | + $imgout = 'imagejpeg'; |
|
1005 | + break; |
|
1006 | + case IMAGETYPE_BMP: |
|
1007 | + $imgout = 'imagebmp'; |
|
1008 | + break; |
|
1009 | + default: |
|
1010 | + throw new Image_Text_Exception('Unsupported image type.'); |
|
1011 | 1011 | } |
1012 | 1012 | if ($save) { |
1013 | 1013 | $imgout($this->_img); |
@@ -1048,18 +1048,18 @@ discard block |
||
1048 | 1048 | } |
1049 | 1049 | |
1050 | 1050 | switch ($this->_options['image_type']) { |
1051 | - case IMAGETYPE_PNG: |
|
1052 | - $imgout = 'imagepng'; |
|
1053 | - break; |
|
1054 | - case IMAGETYPE_JPEG: |
|
1055 | - $imgout = 'imagejpeg'; |
|
1056 | - break; |
|
1057 | - case IMAGETYPE_BMP: |
|
1058 | - $imgout = 'imagebmp'; |
|
1059 | - break; |
|
1060 | - default: |
|
1061 | - throw new Image_Text_Exception('Unsupported image type.'); |
|
1062 | - break; |
|
1051 | + case IMAGETYPE_PNG: |
|
1052 | + $imgout = 'imagepng'; |
|
1053 | + break; |
|
1054 | + case IMAGETYPE_JPEG: |
|
1055 | + $imgout = 'imagejpeg'; |
|
1056 | + break; |
|
1057 | + case IMAGETYPE_BMP: |
|
1058 | + $imgout = 'imagebmp'; |
|
1059 | + break; |
|
1060 | + default: |
|
1061 | + throw new Image_Text_Exception('Unsupported image type.'); |
|
1062 | + break; |
|
1063 | 1063 | } |
1064 | 1064 | |
1065 | 1065 | $res = $imgout($this->_img, $destFile); |
@@ -171,28 +171,52 @@ discard block |
||
171 | 171 | } |
172 | 172 | |
173 | 173 | switch ($action) { |
174 | - case 'subscribe_user_with_password': |
|
175 | - $courses_controller->subscribe_user( |
|
176 | - isset($_POST['subscribe_user_with_password']) ? $_POST['subscribe_user_with_password'] : '', |
|
177 | - isset($_POST['search_term']) ? $_POST['search_term'] : '', |
|
178 | - isset($_POST['category_code']) ? $_POST['category_code'] : '' |
|
179 | - ); |
|
180 | - break; |
|
181 | - case 'createcoursecategory': |
|
182 | - $courses_controller->categories_list($action); |
|
183 | - break; |
|
184 | - case 'deletecoursecategory': |
|
185 | - $courses_controller->courses_list($action); |
|
186 | - break; |
|
187 | - case 'sortmycourses': |
|
188 | - $courses_controller->courses_list($action); |
|
189 | - break; |
|
190 | - case 'subscribe': |
|
191 | - if (!$user_can_view_page) { |
|
192 | - api_not_allowed(true); |
|
193 | - } |
|
194 | - |
|
195 | - if (!CoursesAndSessionsCatalog::is(CATALOG_SESSIONS)) { |
|
174 | + case 'subscribe_user_with_password': |
|
175 | + $courses_controller->subscribe_user( |
|
176 | + isset($_POST['subscribe_user_with_password']) ? $_POST['subscribe_user_with_password'] : '', |
|
177 | + isset($_POST['search_term']) ? $_POST['search_term'] : '', |
|
178 | + isset($_POST['category_code']) ? $_POST['category_code'] : '' |
|
179 | + ); |
|
180 | + break; |
|
181 | + case 'createcoursecategory': |
|
182 | + $courses_controller->categories_list($action); |
|
183 | + break; |
|
184 | + case 'deletecoursecategory': |
|
185 | + $courses_controller->courses_list($action); |
|
186 | + break; |
|
187 | + case 'sortmycourses': |
|
188 | + $courses_controller->courses_list($action); |
|
189 | + break; |
|
190 | + case 'subscribe': |
|
191 | + if (!$user_can_view_page) { |
|
192 | + api_not_allowed(true); |
|
193 | + } |
|
194 | + |
|
195 | + if (!CoursesAndSessionsCatalog::is(CATALOG_SESSIONS)) { |
|
196 | + $courses_controller->courses_categories( |
|
197 | + $action, |
|
198 | + $categoryCode, |
|
199 | + null, |
|
200 | + null, |
|
201 | + null, |
|
202 | + $limit |
|
203 | + ); |
|
204 | + } else { |
|
205 | + header('Location: ' . api_get_self()); |
|
206 | + } |
|
207 | + break; |
|
208 | + case 'display_random_courses': |
|
209 | + if (!$user_can_view_page) { |
|
210 | + api_not_allowed(true); |
|
211 | + } |
|
212 | + |
|
213 | + $courses_controller->courses_categories($action); |
|
214 | + break; |
|
215 | + case 'display_courses': |
|
216 | + if (!$user_can_view_page) { |
|
217 | + api_not_allowed(true); |
|
218 | + } |
|
219 | + |
|
196 | 220 | $courses_controller->courses_categories( |
197 | 221 | $action, |
198 | 222 | $categoryCode, |
@@ -201,126 +225,102 @@ discard block |
||
201 | 225 | null, |
202 | 226 | $limit |
203 | 227 | ); |
204 | - } else { |
|
205 | - header('Location: ' . api_get_self()); |
|
206 | - } |
|
207 | - break; |
|
208 | - case 'display_random_courses': |
|
209 | - if (!$user_can_view_page) { |
|
210 | - api_not_allowed(true); |
|
211 | - } |
|
212 | - |
|
213 | - $courses_controller->courses_categories($action); |
|
214 | - break; |
|
215 | - case 'display_courses': |
|
216 | - if (!$user_can_view_page) { |
|
217 | - api_not_allowed(true); |
|
218 | - } |
|
219 | - |
|
220 | - $courses_controller->courses_categories( |
|
221 | - $action, |
|
222 | - $categoryCode, |
|
223 | - null, |
|
224 | - null, |
|
225 | - null, |
|
226 | - $limit |
|
227 | - ); |
|
228 | - break; |
|
229 | - case 'display_sessions': |
|
230 | - if (!$user_can_view_page) { |
|
231 | - api_not_allowed(true); |
|
232 | - } |
|
233 | - |
|
234 | - $courses_controller->sessionsList($action, $nameTools, $limit); |
|
235 | - break; |
|
236 | - case 'subscribe_to_session': |
|
237 | - if (!$user_can_view_page) { |
|
238 | - api_not_allowed(true); |
|
239 | - } |
|
240 | - |
|
241 | - $userId = api_get_user_id(); |
|
242 | - $confirmed = isset($_GET['confirm']); |
|
243 | - $sessionId = intval($_GET['session_id']); |
|
244 | - |
|
245 | - if (empty($userId)) { |
|
246 | - api_not_allowed(); |
|
247 | - exit; |
|
248 | - } |
|
249 | - |
|
250 | - if (!$confirmed) { |
|
251 | - $template = new Template(null, false, false, false, false, false); |
|
252 | - $template->assign('session_id', $sessionId); |
|
253 | - |
|
254 | - $layout = $template->get_template('auth/confirm_session_subscription.tpl'); |
|
255 | - |
|
256 | - echo $template->fetch($layout); |
|
257 | - exit; |
|
258 | - } |
|
259 | - |
|
260 | - $registrationAllowed = api_get_setting('catalog_allow_session_auto_subscription'); |
|
261 | - if ($registrationAllowed === 'true') { |
|
262 | - $entityManager = Database::getManager(); |
|
263 | - $repository = $entityManager->getRepository('ChamiloCoreBundle:SequenceResource'); |
|
264 | - |
|
265 | - $sequences = $repository->getRequirements( |
|
266 | - $sessionId, |
|
267 | - SequenceResource::SESSION_TYPE |
|
268 | - ); |
|
228 | + break; |
|
229 | + case 'display_sessions': |
|
230 | + if (!$user_can_view_page) { |
|
231 | + api_not_allowed(true); |
|
232 | + } |
|
233 | + |
|
234 | + $courses_controller->sessionsList($action, $nameTools, $limit); |
|
235 | + break; |
|
236 | + case 'subscribe_to_session': |
|
237 | + if (!$user_can_view_page) { |
|
238 | + api_not_allowed(true); |
|
239 | + } |
|
240 | + |
|
241 | + $userId = api_get_user_id(); |
|
242 | + $confirmed = isset($_GET['confirm']); |
|
243 | + $sessionId = intval($_GET['session_id']); |
|
269 | 244 | |
270 | - if (count($sequences) > 0) { |
|
271 | - $requirementsData = SequenceResourceManager::checkRequirementsForUser( |
|
272 | - $sequences, |
|
273 | - SequenceResource::SESSION_TYPE, |
|
274 | - $userId |
|
245 | + if (empty($userId)) { |
|
246 | + api_not_allowed(); |
|
247 | + exit; |
|
248 | + } |
|
249 | + |
|
250 | + if (!$confirmed) { |
|
251 | + $template = new Template(null, false, false, false, false, false); |
|
252 | + $template->assign('session_id', $sessionId); |
|
253 | + |
|
254 | + $layout = $template->get_template('auth/confirm_session_subscription.tpl'); |
|
255 | + |
|
256 | + echo $template->fetch($layout); |
|
257 | + exit; |
|
258 | + } |
|
259 | + |
|
260 | + $registrationAllowed = api_get_setting('catalog_allow_session_auto_subscription'); |
|
261 | + if ($registrationAllowed === 'true') { |
|
262 | + $entityManager = Database::getManager(); |
|
263 | + $repository = $entityManager->getRepository('ChamiloCoreBundle:SequenceResource'); |
|
264 | + |
|
265 | + $sequences = $repository->getRequirements( |
|
266 | + $sessionId, |
|
267 | + SequenceResource::SESSION_TYPE |
|
275 | 268 | ); |
276 | 269 | |
277 | - $continueWithSubscription = SequenceResourceManager::checkSequenceAreCompleted($requirementsData); |
|
270 | + if (count($sequences) > 0) { |
|
271 | + $requirementsData = SequenceResourceManager::checkRequirementsForUser( |
|
272 | + $sequences, |
|
273 | + SequenceResource::SESSION_TYPE, |
|
274 | + $userId |
|
275 | + ); |
|
276 | + |
|
277 | + $continueWithSubscription = SequenceResourceManager::checkSequenceAreCompleted($requirementsData); |
|
278 | 278 | |
279 | - if (!$continueWithSubscription) { |
|
280 | - header('Location: ' . api_get_path(WEB_CODE_PATH) . 'auth/courses.php'); |
|
281 | - exit; |
|
279 | + if (!$continueWithSubscription) { |
|
280 | + header('Location: ' . api_get_path(WEB_CODE_PATH) . 'auth/courses.php'); |
|
281 | + exit; |
|
282 | + } |
|
282 | 283 | } |
283 | - } |
|
284 | 284 | |
285 | - SessionManager::suscribe_users_to_session( |
|
286 | - $_GET['session_id'], |
|
287 | - array($userId), |
|
288 | - SESSION_VISIBLE_READ_ONLY, |
|
289 | - false |
|
290 | - ); |
|
285 | + SessionManager::suscribe_users_to_session( |
|
286 | + $_GET['session_id'], |
|
287 | + array($userId), |
|
288 | + SESSION_VISIBLE_READ_ONLY, |
|
289 | + false |
|
290 | + ); |
|
291 | 291 | |
292 | - $coursesList = SessionManager::get_course_list_by_session_id($_GET['session_id']); |
|
293 | - $count = count($coursesList); |
|
294 | - $url = ''; |
|
295 | - |
|
296 | - if ($count <= 0) { |
|
297 | - // no course in session -> return to catalog |
|
298 | - $url = api_get_path(WEB_CODE_PATH) . 'auth/courses.php'; |
|
299 | - } elseif ($count == 1) { |
|
300 | - // only one course, so redirect directly to this course |
|
301 | - foreach ($coursesList as $course) { |
|
302 | - $url = api_get_path(WEB_COURSE_PATH) . $course['directory'] . '/index.php?id_session=' . intval($_GET['session_id']); |
|
292 | + $coursesList = SessionManager::get_course_list_by_session_id($_GET['session_id']); |
|
293 | + $count = count($coursesList); |
|
294 | + $url = ''; |
|
295 | + |
|
296 | + if ($count <= 0) { |
|
297 | + // no course in session -> return to catalog |
|
298 | + $url = api_get_path(WEB_CODE_PATH) . 'auth/courses.php'; |
|
299 | + } elseif ($count == 1) { |
|
300 | + // only one course, so redirect directly to this course |
|
301 | + foreach ($coursesList as $course) { |
|
302 | + $url = api_get_path(WEB_COURSE_PATH) . $course['directory'] . '/index.php?id_session=' . intval($_GET['session_id']); |
|
303 | + } |
|
304 | + } else { |
|
305 | + $url = api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . intval($_GET['session_id']); |
|
303 | 306 | } |
304 | - } else { |
|
305 | - $url = api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . intval($_GET['session_id']); |
|
307 | + header('Location: ' . $url); |
|
308 | + exit; |
|
306 | 309 | } |
307 | - header('Location: ' . $url); |
|
308 | - exit; |
|
309 | - } |
|
310 | - //else show error message? |
|
311 | - break; |
|
312 | - case 'search_tag': |
|
313 | - if (!$user_can_view_page) { |
|
314 | - api_not_allowed(true); |
|
315 | - } |
|
316 | - |
|
317 | - $courses_controller->sessionsListByCoursesTag($limit); |
|
318 | - break; |
|
319 | - case 'search_session': |
|
320 | - if (!$user_can_view_page) { |
|
321 | - api_not_allowed(true); |
|
322 | - } |
|
323 | - |
|
324 | - $courses_controller->sessionListBySearch($limit); |
|
325 | - break; |
|
310 | + //else show error message? |
|
311 | + break; |
|
312 | + case 'search_tag': |
|
313 | + if (!$user_can_view_page) { |
|
314 | + api_not_allowed(true); |
|
315 | + } |
|
316 | + |
|
317 | + $courses_controller->sessionsListByCoursesTag($limit); |
|
318 | + break; |
|
319 | + case 'search_session': |
|
320 | + if (!$user_can_view_page) { |
|
321 | + api_not_allowed(true); |
|
322 | + } |
|
323 | + |
|
324 | + $courses_controller->sessionListBySearch($limit); |
|
325 | + break; |
|
326 | 326 | } |