@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | $i=1; |
21 | 21 | echo '<div class="actions" style="margin-bottom:30px">'; |
22 | 22 | echo '<a href="index.php?'.api_get_cidreq().'">'. |
23 | - Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ToolCourseDescription'),'',ICON_SIZE_MEDIUM). |
|
24 | - '</a>'; |
|
23 | + Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ToolCourseDescription'),'',ICON_SIZE_MEDIUM). |
|
24 | + '</a>'; |
|
25 | 25 | ksort($categories); |
26 | 26 | foreach ($categories as $id => $title) { |
27 | 27 | if ($i == ADD_BLOCK) { |
@@ -38,14 +38,14 @@ discard block |
||
38 | 38 | |
39 | 39 | // error messages |
40 | 40 | if (isset($error) && intval($error) == 1) { |
41 | - Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false); |
|
41 | + Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | // default header title form |
45 | 45 | $header = ''; |
46 | 46 | $description_type = intval($description_type); |
47 | 47 | if ($description_type >= ADD_BLOCK) { |
48 | - $header = $default_description_titles[ADD_BLOCK]; |
|
48 | + $header = $default_description_titles[ADD_BLOCK]; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | // display form |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | |
74 | 74 | // display default questions |
75 | 75 | if (isset ($question[$description_type])) { |
76 | - $message = '<strong>'.get_lang('QuestionPlan').'</strong><br />'; |
|
77 | - $message .= $question[$description_type]; |
|
78 | - Display::display_normal_message($message, false); |
|
76 | + $message = '<strong>'.get_lang('QuestionPlan').'</strong><br />'; |
|
77 | + $message .= $question[$description_type]; |
|
78 | + Display::display_normal_message($message, false); |
|
79 | 79 | } |
80 | 80 | $form->display(); |
@@ -41,180 +41,180 @@ discard block |
||
41 | 41 | $safe_task_description = isset($_POST['task_description']) ? Security::remove_XSS($_POST['task_description']) : null; |
42 | 42 | |
43 | 43 | if (!empty($_POST['new_post_submit'])) { |
44 | - Blog:: create_post( |
|
45 | - $_POST['title'], |
|
46 | - $_POST['full_text'], |
|
47 | - $_POST['post_file_comment'], |
|
48 | - $blog_id |
|
49 | - ); |
|
50 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogAdded')); |
|
44 | + Blog:: create_post( |
|
45 | + $_POST['title'], |
|
46 | + $_POST['full_text'], |
|
47 | + $_POST['post_file_comment'], |
|
48 | + $blog_id |
|
49 | + ); |
|
50 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogAdded')); |
|
51 | 51 | } |
52 | 52 | if (!empty($_POST['edit_post_submit'])) { |
53 | - Blog:: edit_post( |
|
54 | - $_POST['post_id'], |
|
55 | - $_POST['title'], |
|
56 | - $_POST['full_text'], |
|
57 | - $blog_id |
|
58 | - ); |
|
59 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogEdited')); |
|
53 | + Blog:: edit_post( |
|
54 | + $_POST['post_id'], |
|
55 | + $_POST['title'], |
|
56 | + $_POST['full_text'], |
|
57 | + $blog_id |
|
58 | + ); |
|
59 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogEdited')); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | if (!empty($_POST['new_comment_submit'])) { |
63 | - Blog:: create_comment( |
|
64 | - $_POST['title'], |
|
65 | - $_POST['comment'], |
|
66 | - $_POST['post_file_comment'], |
|
67 | - $blog_id, |
|
68 | - $_GET['post_id'], |
|
69 | - $_POST['comment_parent_id'] |
|
70 | - ); |
|
71 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('CommentAdded')); |
|
63 | + Blog:: create_comment( |
|
64 | + $_POST['title'], |
|
65 | + $_POST['comment'], |
|
66 | + $_POST['post_file_comment'], |
|
67 | + $blog_id, |
|
68 | + $_GET['post_id'], |
|
69 | + $_POST['comment_parent_id'] |
|
70 | + ); |
|
71 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('CommentAdded')); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | if (!empty($_POST['new_task_submit'])) { |
75 | - Blog:: create_task( |
|
76 | - $blog_id, |
|
77 | - $safe_task_name, |
|
78 | - $safe_task_description, |
|
79 | - (isset($_POST['chkArticleDelete']) ? $_POST['chkArticleDelete'] : null), |
|
80 | - (isset($_POST['chkArticleEdit']) ? $_POST['chkArticleEdit'] : null), |
|
81 | - (isset($_POST['chkCommentsDelete']) ? $_POST['chkCommentsDelete'] : null), |
|
82 | - (isset($_POST['task_color']) ? $_POST['task_color'] : null) |
|
83 | - ); |
|
84 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskCreated')); |
|
75 | + Blog:: create_task( |
|
76 | + $blog_id, |
|
77 | + $safe_task_name, |
|
78 | + $safe_task_description, |
|
79 | + (isset($_POST['chkArticleDelete']) ? $_POST['chkArticleDelete'] : null), |
|
80 | + (isset($_POST['chkArticleEdit']) ? $_POST['chkArticleEdit'] : null), |
|
81 | + (isset($_POST['chkCommentsDelete']) ? $_POST['chkCommentsDelete'] : null), |
|
82 | + (isset($_POST['task_color']) ? $_POST['task_color'] : null) |
|
83 | + ); |
|
84 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskCreated')); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | if (isset($_POST['edit_task_submit'])) { |
88 | - Blog:: edit_task( |
|
89 | - $_POST['blog_id'], |
|
90 | - $_POST['task_id'], |
|
91 | - $safe_task_name, |
|
92 | - $safe_task_description, |
|
93 | - $_POST['chkArticleDelete'], |
|
94 | - $_POST['chkArticleEdit'], |
|
95 | - $_POST['chkCommentsDelete'], |
|
96 | - $_POST['task_color'] |
|
97 | - ); |
|
98 | - $return_message = array( |
|
99 | - 'type' => 'confirmation', |
|
100 | - 'message' => get_lang('TaskEdited') |
|
101 | - ); |
|
88 | + Blog:: edit_task( |
|
89 | + $_POST['blog_id'], |
|
90 | + $_POST['task_id'], |
|
91 | + $safe_task_name, |
|
92 | + $safe_task_description, |
|
93 | + $_POST['chkArticleDelete'], |
|
94 | + $_POST['chkArticleEdit'], |
|
95 | + $_POST['chkCommentsDelete'], |
|
96 | + $_POST['task_color'] |
|
97 | + ); |
|
98 | + $return_message = array( |
|
99 | + 'type' => 'confirmation', |
|
100 | + 'message' => get_lang('TaskEdited') |
|
101 | + ); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | if (!empty($_POST['assign_task_submit'])) { |
105 | - Blog:: assign_task( |
|
106 | - $blog_id, |
|
107 | - $_POST['task_user_id'], |
|
108 | - $_POST['task_task_id'], |
|
109 | - $_POST['task_day'] |
|
110 | - ); |
|
111 | - $return_message = array( |
|
112 | - 'type' => 'confirmation', |
|
113 | - 'message' => get_lang('TaskAssigned') |
|
114 | - ); |
|
105 | + Blog:: assign_task( |
|
106 | + $blog_id, |
|
107 | + $_POST['task_user_id'], |
|
108 | + $_POST['task_task_id'], |
|
109 | + $_POST['task_day'] |
|
110 | + ); |
|
111 | + $return_message = array( |
|
112 | + 'type' => 'confirmation', |
|
113 | + 'message' => get_lang('TaskAssigned') |
|
114 | + ); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | if (isset($_POST['assign_task_edit_submit'])) { |
118 | - Blog:: edit_assigned_task( |
|
119 | - $blog_id, |
|
120 | - $_POST['task_user_id'], |
|
121 | - $_POST['task_task_id'], |
|
122 | - $_POST['task_day'], |
|
123 | - $_POST['old_user_id'], |
|
124 | - $_POST['old_task_id'], |
|
125 | - $_POST['old_target_date'] |
|
126 | - ); |
|
127 | - $return_message = array( |
|
128 | - 'type' => 'confirmation', |
|
129 | - 'message' => get_lang('AssignedTaskEdited') |
|
130 | - ); |
|
118 | + Blog:: edit_assigned_task( |
|
119 | + $blog_id, |
|
120 | + $_POST['task_user_id'], |
|
121 | + $_POST['task_task_id'], |
|
122 | + $_POST['task_day'], |
|
123 | + $_POST['old_user_id'], |
|
124 | + $_POST['old_task_id'], |
|
125 | + $_POST['old_target_date'] |
|
126 | + ); |
|
127 | + $return_message = array( |
|
128 | + 'type' => 'confirmation', |
|
129 | + 'message' => get_lang('AssignedTaskEdited') |
|
130 | + ); |
|
131 | 131 | } |
132 | 132 | if (!empty($_POST['new_task_execution_submit'])) { |
133 | - Blog:: create_comment( |
|
134 | - $safe_comment_title, |
|
135 | - $safe_comment_text, |
|
136 | - $blog_id, |
|
137 | - (int)$_GET['post_id'], |
|
138 | - $_POST['comment_parent_id'], |
|
139 | - $_POST['task_id'] |
|
140 | - ); |
|
141 | - $return_message = array( |
|
142 | - 'type' => 'confirmation', |
|
143 | - 'message' => get_lang('CommentCreated') |
|
144 | - ); |
|
133 | + Blog:: create_comment( |
|
134 | + $safe_comment_title, |
|
135 | + $safe_comment_text, |
|
136 | + $blog_id, |
|
137 | + (int)$_GET['post_id'], |
|
138 | + $_POST['comment_parent_id'], |
|
139 | + $_POST['task_id'] |
|
140 | + ); |
|
141 | + $return_message = array( |
|
142 | + 'type' => 'confirmation', |
|
143 | + 'message' => get_lang('CommentCreated') |
|
144 | + ); |
|
145 | 145 | } |
146 | 146 | if (!empty($_POST['register'])) { |
147 | - if (is_array($_POST['user'])) { |
|
148 | - foreach ($_POST['user'] as $index => $user_id) { |
|
149 | - Blog :: set_user_subscribed((int)$_GET['blog_id'], $user_id); |
|
150 | - } |
|
151 | - } |
|
147 | + if (is_array($_POST['user'])) { |
|
148 | + foreach ($_POST['user'] as $index => $user_id) { |
|
149 | + Blog :: set_user_subscribed((int)$_GET['blog_id'], $user_id); |
|
150 | + } |
|
151 | + } |
|
152 | 152 | } |
153 | 153 | if (!empty($_POST['unregister'])) { |
154 | - if (is_array($_POST['user'])) { |
|
155 | - foreach ($_POST['user'] as $index => $user_id) { |
|
156 | - Blog :: set_user_unsubscribed((int)$_GET['blog_id'], $user_id); |
|
157 | - } |
|
158 | - } |
|
154 | + if (is_array($_POST['user'])) { |
|
155 | + foreach ($_POST['user'] as $index => $user_id) { |
|
156 | + Blog :: set_user_unsubscribed((int)$_GET['blog_id'], $user_id); |
|
157 | + } |
|
158 | + } |
|
159 | 159 | } |
160 | 160 | if (!empty($_GET['register'])) { |
161 | - Blog :: set_user_subscribed((int)$_GET['blog_id'], (int)$_GET['user_id']); |
|
162 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('UserRegistered')); |
|
163 | - $flag = 1; |
|
161 | + Blog :: set_user_subscribed((int)$_GET['blog_id'], (int)$_GET['user_id']); |
|
162 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('UserRegistered')); |
|
163 | + $flag = 1; |
|
164 | 164 | } |
165 | 165 | if (!empty($_GET['unregister'])) { |
166 | - Blog :: set_user_unsubscribed((int)$_GET['blog_id'], (int)$_GET['user_id']); |
|
166 | + Blog :: set_user_unsubscribed((int)$_GET['blog_id'], (int)$_GET['user_id']); |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | if (isset($_GET['action']) && $_GET['action'] == 'manage_tasks') { |
170 | - if (isset($_GET['do']) && $_GET['do'] == 'delete') { |
|
171 | - Blog :: delete_task($blog_id, (int)$_GET['task_id']); |
|
172 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskDeleted')); |
|
173 | - } |
|
174 | - |
|
175 | - if (isset($_GET['do']) && $_GET['do'] == 'delete_assignment') { |
|
176 | - Blog :: delete_assigned_task($blog_id, intval($_GET['task_id']), intval($_GET['user_id'])); |
|
177 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskAssignmentDeleted')); |
|
178 | - } |
|
170 | + if (isset($_GET['do']) && $_GET['do'] == 'delete') { |
|
171 | + Blog :: delete_task($blog_id, (int)$_GET['task_id']); |
|
172 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskDeleted')); |
|
173 | + } |
|
174 | + |
|
175 | + if (isset($_GET['do']) && $_GET['do'] == 'delete_assignment') { |
|
176 | + Blog :: delete_assigned_task($blog_id, intval($_GET['task_id']), intval($_GET['user_id'])); |
|
177 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('TaskAssignmentDeleted')); |
|
178 | + } |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | if (isset($_GET['action']) && $_GET['action'] == 'view_post') { |
182 | - $task_id = (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) ? $_GET['task_id'] : 0; |
|
183 | - |
|
184 | - if (isset($_GET['do']) && $_GET['do'] == 'delete_comment') { |
|
185 | - if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_delete', $task_id)) { |
|
186 | - Blog :: delete_comment($blog_id, (int)$_GET['post_id'],(int)$_GET['comment_id']); |
|
187 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('CommentDeleted')); |
|
188 | - } else { |
|
189 | - $error = true; |
|
190 | - $message = get_lang('ActionNotAllowed'); |
|
191 | - } |
|
192 | - } |
|
193 | - |
|
194 | - if (isset($_GET['do']) && $_GET['do'] == 'delete_article') { |
|
195 | - if (api_is_allowed('BLOG_'.$blog_id, 'article_delete', $task_id)) { |
|
196 | - Blog :: delete_post($blog_id, (int)$_GET['article_id']); |
|
197 | - $action = ''; // Article is gone, go to blog home |
|
198 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogDeleted')); |
|
199 | - } else { |
|
200 | - $error = true; |
|
201 | - $message = get_lang('ActionNotAllowed'); |
|
202 | - } |
|
203 | - } |
|
204 | - if (isset($_GET['do']) && $_GET['do'] == 'rate') { |
|
205 | - if (isset($_GET['type']) && $_GET['type'] == 'post') { |
|
206 | - if (api_is_allowed('BLOG_'.$blog_id, 'article_rate')) { |
|
207 | - Blog :: add_rating('post', $blog_id, (int)$_GET['post_id'], (int)$_GET['rating']); |
|
208 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded')); |
|
209 | - } |
|
210 | - } |
|
211 | - if (isset($_GET['type']) && $_GET['type'] == 'comment') { |
|
212 | - if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_add')) { |
|
213 | - Blog :: add_rating('comment', $blog_id, (int)$_GET['comment_id'], (int)$_GET['rating']); |
|
214 | - $return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded')); |
|
215 | - } |
|
216 | - } |
|
217 | - } |
|
182 | + $task_id = (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) ? $_GET['task_id'] : 0; |
|
183 | + |
|
184 | + if (isset($_GET['do']) && $_GET['do'] == 'delete_comment') { |
|
185 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_delete', $task_id)) { |
|
186 | + Blog :: delete_comment($blog_id, (int)$_GET['post_id'],(int)$_GET['comment_id']); |
|
187 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('CommentDeleted')); |
|
188 | + } else { |
|
189 | + $error = true; |
|
190 | + $message = get_lang('ActionNotAllowed'); |
|
191 | + } |
|
192 | + } |
|
193 | + |
|
194 | + if (isset($_GET['do']) && $_GET['do'] == 'delete_article') { |
|
195 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_delete', $task_id)) { |
|
196 | + Blog :: delete_post($blog_id, (int)$_GET['article_id']); |
|
197 | + $action = ''; // Article is gone, go to blog home |
|
198 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('BlogDeleted')); |
|
199 | + } else { |
|
200 | + $error = true; |
|
201 | + $message = get_lang('ActionNotAllowed'); |
|
202 | + } |
|
203 | + } |
|
204 | + if (isset($_GET['do']) && $_GET['do'] == 'rate') { |
|
205 | + if (isset($_GET['type']) && $_GET['type'] == 'post') { |
|
206 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_rate')) { |
|
207 | + Blog :: add_rating('post', $blog_id, (int)$_GET['post_id'], (int)$_GET['rating']); |
|
208 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded')); |
|
209 | + } |
|
210 | + } |
|
211 | + if (isset($_GET['type']) && $_GET['type'] == 'comment') { |
|
212 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_comments_add')) { |
|
213 | + Blog :: add_rating('comment', $blog_id, (int)$_GET['comment_id'], (int)$_GET['rating']); |
|
214 | + $return_message = array('type' => 'confirmation', 'message' => get_lang('RatingAdded')); |
|
215 | + } |
|
216 | + } |
|
217 | + } |
|
218 | 218 | } |
219 | 219 | /* |
220 | 220 | DISPLAY |
@@ -222,67 +222,67 @@ discard block |
||
222 | 222 | |
223 | 223 | // Set breadcrumb |
224 | 224 | switch ($action) { |
225 | - case 'new_post' : |
|
226 | - $nameTools = get_lang('NewPost'); |
|
225 | + case 'new_post' : |
|
226 | + $nameTools = get_lang('NewPost'); |
|
227 | 227 | $interbreadcrumb[] = array( |
228 | 228 | 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), |
229 | 229 | "name" => Blog:: get_blog_title($blog_id), |
230 | 230 | ); |
231 | - Display :: display_header($nameTools, 'Blogs'); |
|
232 | - break; |
|
233 | - case 'manage_tasks' : |
|
234 | - $nameTools = get_lang('TaskManager'); |
|
231 | + Display :: display_header($nameTools, 'Blogs'); |
|
232 | + break; |
|
233 | + case 'manage_tasks' : |
|
234 | + $nameTools = get_lang('TaskManager'); |
|
235 | 235 | $interbreadcrumb[] = array( |
236 | 236 | 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), |
237 | 237 | "name" => Blog:: get_blog_title($blog_id), |
238 | 238 | ); |
239 | - Display :: display_header($nameTools, 'Blogs'); |
|
240 | - break; |
|
241 | - case 'manage_members' : |
|
242 | - $nameTools = get_lang('MemberManager'); |
|
239 | + Display :: display_header($nameTools, 'Blogs'); |
|
240 | + break; |
|
241 | + case 'manage_members' : |
|
242 | + $nameTools = get_lang('MemberManager'); |
|
243 | 243 | $interbreadcrumb[] = array( |
244 | 244 | 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), |
245 | 245 | "name" => Blog:: get_blog_title($blog_id), |
246 | 246 | ); |
247 | - Display :: display_header($nameTools, 'Blogs'); |
|
248 | - break; |
|
249 | - case 'manage_rights' : |
|
250 | - $nameTools = get_lang('RightsManager'); |
|
247 | + Display :: display_header($nameTools, 'Blogs'); |
|
248 | + break; |
|
249 | + case 'manage_rights' : |
|
250 | + $nameTools = get_lang('RightsManager'); |
|
251 | 251 | $interbreadcrumb[] = array( |
252 | 252 | 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), |
253 | 253 | 'name' => Blog:: get_blog_title($blog_id), |
254 | 254 | ); |
255 | - Display :: display_header($nameTools, 'Blogs'); |
|
256 | - break; |
|
257 | - case 'view_search_result' : |
|
258 | - $nameTools = get_lang('SearchResults'); |
|
255 | + Display :: display_header($nameTools, 'Blogs'); |
|
256 | + break; |
|
257 | + case 'view_search_result' : |
|
258 | + $nameTools = get_lang('SearchResults'); |
|
259 | 259 | $interbreadcrumb[] = array( |
260 | 260 | 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), |
261 | 261 | 'name' => Blog:: get_blog_title($blog_id), |
262 | 262 | ); |
263 | - Display :: display_header($nameTools, 'Blogs'); |
|
264 | - break; |
|
265 | - case 'execute_task' : |
|
266 | - $nameTools = get_lang('ExecuteThisTask'); |
|
263 | + Display :: display_header($nameTools, 'Blogs'); |
|
264 | + break; |
|
265 | + case 'execute_task' : |
|
266 | + $nameTools = get_lang('ExecuteThisTask'); |
|
267 | 267 | $interbreadcrumb[] = array( |
268 | 268 | 'url' => "blog.php?blog_id=$blog_id&".api_get_cidreq(), |
269 | 269 | 'name' => Blog:: get_blog_title($blog_id), |
270 | 270 | ); |
271 | - Display :: display_header($nameTools, 'Blogs'); |
|
272 | - break; |
|
273 | - default : |
|
274 | - $nameTools = Blog :: get_blog_title($blog_id); |
|
275 | - Display :: display_header($nameTools, 'Blogs'); |
|
271 | + Display :: display_header($nameTools, 'Blogs'); |
|
272 | + break; |
|
273 | + default : |
|
274 | + $nameTools = Blog :: get_blog_title($blog_id); |
|
275 | + Display :: display_header($nameTools, 'Blogs'); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | // feedback messages |
279 | 279 | if (!empty($return_message)) { |
280 | - if ($return_message['type'] == 'confirmation') { |
|
281 | - Display::display_confirmation_message($return_message['message']); |
|
282 | - } |
|
283 | - if ($return_message['type'] == 'error') { |
|
284 | - Display::display_error_message($return_message['message']); |
|
285 | - } |
|
280 | + if ($return_message['type'] == 'confirmation') { |
|
281 | + Display::display_confirmation_message($return_message['message']); |
|
282 | + } |
|
283 | + if ($return_message['type'] == 'error') { |
|
284 | + Display::display_error_message($return_message['message']); |
|
285 | + } |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | // actions |
@@ -349,12 +349,12 @@ discard block |
||
349 | 349 | <?php |
350 | 350 | |
351 | 351 | if (isset($error)) { |
352 | - Display :: display_error_message($message); |
|
352 | + Display :: display_error_message($message); |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | if (isset($flag) && $flag == '1') { |
356 | - $action = "manage_tasks"; |
|
357 | - Blog :: display_assign_task_form($blog_id); |
|
356 | + $action = "manage_tasks"; |
|
357 | + Blog :: display_assign_task_form($blog_id); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | $user_task = false; |
@@ -362,12 +362,12 @@ discard block |
||
362 | 362 | $course_id = api_get_course_int_id(); |
363 | 363 | |
364 | 364 | if (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) { |
365 | - $task_id = (int)$_GET['task_id']; |
|
365 | + $task_id = (int)$_GET['task_id']; |
|
366 | 366 | } else { |
367 | - $task_id = 0; |
|
368 | - $tbl_blogs_tasks_rel_user = Database :: get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
367 | + $task_id = 0; |
|
368 | + $tbl_blogs_tasks_rel_user = Database :: get_course_table(TABLE_BLOGS_TASKS_REL_USER); |
|
369 | 369 | |
370 | - $sql = "SELECT COUNT(*) as number |
|
370 | + $sql = "SELECT COUNT(*) as number |
|
371 | 371 | FROM ".$tbl_blogs_tasks_rel_user." |
372 | 372 | WHERE |
373 | 373 | c_id = $course_id AND |
@@ -375,120 +375,120 @@ discard block |
||
375 | 375 | user_id = ".api_get_user_id()." AND |
376 | 376 | task_id = ".$task_id; |
377 | 377 | |
378 | - $result = Database::query($sql); |
|
379 | - $row = Database::fetch_array($result); |
|
378 | + $result = Database::query($sql); |
|
379 | + $row = Database::fetch_array($result); |
|
380 | 380 | |
381 | - if ($row['number'] == 1) |
|
382 | - $user_task = true; |
|
381 | + if ($row['number'] == 1) |
|
382 | + $user_task = true; |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | switch ($action) { |
386 | - case 'new_post': |
|
387 | - if (api_is_allowed('BLOG_'.$blog_id, 'article_add', $user_task ? $task_id : 0)) { |
|
388 | - // we show the form if |
|
389 | - // 1. no post data |
|
390 | - // 2. there is post data and the required field is empty |
|
391 | - if (!$_POST OR (!empty($_POST) AND empty($_POST['title']))) { |
|
392 | - // if there is post data there is certainly an error in the form |
|
393 | - if ($_POST) { |
|
394 | - Display::display_error_message(get_lang('FormHasErrorsPleaseComplete')); |
|
395 | - } |
|
396 | - Blog :: display_form_new_post($blog_id); |
|
397 | - } else { |
|
398 | - if (isset($_GET['filter']) && !empty($_GET['filter'])) { |
|
399 | - Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter'])); |
|
400 | - } else { |
|
401 | - Blog :: display_blog_posts($blog_id); |
|
402 | - } |
|
403 | - } |
|
404 | - } else { |
|
405 | - api_not_allowed(); |
|
406 | - } |
|
407 | - break; |
|
408 | - case 'view_post' : |
|
409 | - Blog :: display_post($blog_id, intval($_GET['post_id'])); |
|
410 | - break; |
|
411 | - case 'edit_post' : |
|
412 | - $task_id = (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) ? $_GET['task_id'] : 0; |
|
413 | - |
|
414 | - if (api_is_allowed('BLOG_'.$blog_id, 'article_edit', $task_id)) { |
|
415 | - // we show the form if |
|
416 | - // 1. no post data |
|
417 | - // 2. there is post data and the required field is empty |
|
418 | - if (!$_POST OR (!empty($_POST) AND empty($_POST['post_title']))) { |
|
419 | - // if there is post data there is certainly an error in the form |
|
420 | - if ($_POST) { |
|
421 | - Display::display_error_message(get_lang('FormHasErrorsPleaseComplete')); |
|
422 | - } |
|
386 | + case 'new_post': |
|
387 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_add', $user_task ? $task_id : 0)) { |
|
388 | + // we show the form if |
|
389 | + // 1. no post data |
|
390 | + // 2. there is post data and the required field is empty |
|
391 | + if (!$_POST OR (!empty($_POST) AND empty($_POST['title']))) { |
|
392 | + // if there is post data there is certainly an error in the form |
|
393 | + if ($_POST) { |
|
394 | + Display::display_error_message(get_lang('FormHasErrorsPleaseComplete')); |
|
395 | + } |
|
396 | + Blog :: display_form_new_post($blog_id); |
|
397 | + } else { |
|
398 | + if (isset($_GET['filter']) && !empty($_GET['filter'])) { |
|
399 | + Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter'])); |
|
400 | + } else { |
|
401 | + Blog :: display_blog_posts($blog_id); |
|
402 | + } |
|
403 | + } |
|
404 | + } else { |
|
405 | + api_not_allowed(); |
|
406 | + } |
|
407 | + break; |
|
408 | + case 'view_post' : |
|
409 | + Blog :: display_post($blog_id, intval($_GET['post_id'])); |
|
410 | + break; |
|
411 | + case 'edit_post' : |
|
412 | + $task_id = (isset ($_GET['task_id']) && is_numeric($_GET['task_id'])) ? $_GET['task_id'] : 0; |
|
413 | + |
|
414 | + if (api_is_allowed('BLOG_'.$blog_id, 'article_edit', $task_id)) { |
|
415 | + // we show the form if |
|
416 | + // 1. no post data |
|
417 | + // 2. there is post data and the required field is empty |
|
418 | + if (!$_POST OR (!empty($_POST) AND empty($_POST['post_title']))) { |
|
419 | + // if there is post data there is certainly an error in the form |
|
420 | + if ($_POST) { |
|
421 | + Display::display_error_message(get_lang('FormHasErrorsPleaseComplete')); |
|
422 | + } |
|
423 | 423 | Blog :: display_form_edit_post($blog_id, intval($_GET['post_id'])); |
424 | - } else { |
|
425 | - if (isset ($_GET['filter']) && !empty ($_GET['filter'])) { |
|
426 | - Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter'])); |
|
427 | - } else { |
|
428 | - Blog :: display_blog_posts($blog_id); |
|
429 | - } |
|
430 | - } |
|
431 | - } else { |
|
432 | - api_not_allowed(); |
|
433 | - } |
|
434 | - |
|
435 | - break; |
|
436 | - case 'manage_members' : |
|
437 | - if (api_is_allowed('BLOG_'.$blog_id, 'member_management')) { |
|
438 | - Blog :: display_form_user_subscribe($blog_id); |
|
439 | - echo '<br /><br />'; |
|
440 | - Blog :: display_form_user_unsubscribe($blog_id); |
|
441 | - } else { |
|
442 | - api_not_allowed(); |
|
424 | + } else { |
|
425 | + if (isset ($_GET['filter']) && !empty ($_GET['filter'])) { |
|
426 | + Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter'])); |
|
427 | + } else { |
|
428 | + Blog :: display_blog_posts($blog_id); |
|
429 | + } |
|
430 | + } |
|
431 | + } else { |
|
432 | + api_not_allowed(); |
|
433 | + } |
|
434 | + |
|
435 | + break; |
|
436 | + case 'manage_members' : |
|
437 | + if (api_is_allowed('BLOG_'.$blog_id, 'member_management')) { |
|
438 | + Blog :: display_form_user_subscribe($blog_id); |
|
439 | + echo '<br /><br />'; |
|
440 | + Blog :: display_form_user_unsubscribe($blog_id); |
|
441 | + } else { |
|
442 | + api_not_allowed(); |
|
443 | 443 | } |
444 | 444 | |
445 | - break; |
|
446 | - case 'manage_rights' : |
|
447 | - Blog :: display_form_user_rights($blog_id); |
|
448 | - break; |
|
449 | - case 'manage_tasks' : |
|
450 | - if (api_is_allowed('BLOG_'.$blog_id, 'task_management')) { |
|
451 | - if (isset($_GET['do']) && $_GET['do'] == 'add') { |
|
452 | - Blog:: display_new_task_form($blog_id); |
|
453 | - } |
|
454 | - if (isset($_GET['do']) && $_GET['do'] == 'assign') { |
|
455 | - Blog:: display_assign_task_form($blog_id); |
|
456 | - } |
|
457 | - if (isset($_GET['do']) && $_GET['do'] == 'edit') { |
|
458 | - Blog:: display_edit_task_form( |
|
459 | - $blog_id, |
|
460 | - intval($_GET['task_id']) |
|
461 | - ); |
|
462 | - } |
|
463 | - if (isset($_GET['do']) && $_GET['do'] == 'edit_assignment') { |
|
464 | - Blog :: display_edit_assigned_task_form($blog_id, intval($_GET['task_id']), intval($_GET['user_id'])); |
|
465 | - } |
|
466 | - Blog :: display_task_list($blog_id); |
|
467 | - echo '<br /><br />'; |
|
468 | - Blog :: display_assigned_task_list($blog_id); |
|
469 | - echo '<br /><br />'; |
|
445 | + break; |
|
446 | + case 'manage_rights' : |
|
447 | + Blog :: display_form_user_rights($blog_id); |
|
448 | + break; |
|
449 | + case 'manage_tasks' : |
|
450 | + if (api_is_allowed('BLOG_'.$blog_id, 'task_management')) { |
|
451 | + if (isset($_GET['do']) && $_GET['do'] == 'add') { |
|
452 | + Blog:: display_new_task_form($blog_id); |
|
453 | + } |
|
454 | + if (isset($_GET['do']) && $_GET['do'] == 'assign') { |
|
455 | + Blog:: display_assign_task_form($blog_id); |
|
456 | + } |
|
457 | + if (isset($_GET['do']) && $_GET['do'] == 'edit') { |
|
458 | + Blog:: display_edit_task_form( |
|
459 | + $blog_id, |
|
460 | + intval($_GET['task_id']) |
|
461 | + ); |
|
462 | + } |
|
463 | + if (isset($_GET['do']) && $_GET['do'] == 'edit_assignment') { |
|
464 | + Blog :: display_edit_assigned_task_form($blog_id, intval($_GET['task_id']), intval($_GET['user_id'])); |
|
465 | + } |
|
466 | + Blog :: display_task_list($blog_id); |
|
467 | + echo '<br /><br />'; |
|
468 | + Blog :: display_assigned_task_list($blog_id); |
|
469 | + echo '<br /><br />'; |
|
470 | 470 | } else { |
471 | 471 | api_not_allowed(); |
472 | 472 | } |
473 | 473 | |
474 | - break; |
|
475 | - case 'execute_task' : |
|
474 | + break; |
|
475 | + case 'execute_task' : |
|
476 | 476 | if (isset ($_GET['post_id'])) { |
477 | 477 | Blog:: display_post($blog_id, intval($_GET['post_id'])); |
478 | 478 | } else { |
479 | 479 | Blog:: display_select_task_post($blog_id, intval($_GET['task_id'])); |
480 | 480 | } |
481 | - break; |
|
482 | - case 'view_search_result' : |
|
483 | - Blog :: display_search_results($blog_id, Database::escape_string($_GET['q'])); |
|
484 | - break; |
|
481 | + break; |
|
482 | + case 'view_search_result' : |
|
483 | + Blog :: display_search_results($blog_id, Database::escape_string($_GET['q'])); |
|
484 | + break; |
|
485 | 485 | case '': |
486 | 486 | default: |
487 | - if (isset ($_GET['filter']) && !empty ($_GET['filter'])) { |
|
488 | - Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter'])); |
|
489 | - } else { |
|
490 | - Blog :: display_blog_posts($blog_id); |
|
491 | - } |
|
487 | + if (isset ($_GET['filter']) && !empty ($_GET['filter'])) { |
|
488 | + Blog :: display_day_results($blog_id, Database::escape_string($_GET['filter'])); |
|
489 | + } else { |
|
490 | + Blog :: display_blog_posts($blog_id); |
|
491 | + } |
|
492 | 492 | break; |
493 | 493 | } |
494 | 494 | ?> |
@@ -9,8 +9,8 @@ discard block |
||
9 | 9 | */ |
10 | 10 | class LinkAddEditForm extends FormValidator |
11 | 11 | { |
12 | - const TYPE_ADD = 1; |
|
13 | - const TYPE_EDIT = 2; |
|
12 | + const TYPE_ADD = 1; |
|
13 | + const TYPE_EDIT = 2; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Constructor |
@@ -188,5 +188,5 @@ discard block |
||
188 | 188 | |
189 | 189 | // set default values |
190 | 190 | $this->setDefaults($defaults); |
191 | - } |
|
191 | + } |
|
192 | 192 | } |
@@ -10,47 +10,47 @@ discard block |
||
10 | 10 | */ |
11 | 11 | class ScoreDisplayForm extends FormValidator |
12 | 12 | { |
13 | - /** |
|
14 | - * @param $form_name |
|
15 | - * @param null $action |
|
16 | - */ |
|
17 | - public function __construct($form_name, $action= null) |
|
18 | - { |
|
19 | - parent :: __construct($form_name, 'post', $action); |
|
20 | - $displayscore = ScoreDisplay :: instance(); |
|
21 | - $customdisplays = $displayscore->get_custom_score_display_settings(); |
|
22 | - |
|
23 | - $nr_items = (count($customdisplays)!='0') ? count($customdisplays) : '1'; |
|
24 | - $this->setDefaults(array ( |
|
13 | + /** |
|
14 | + * @param $form_name |
|
15 | + * @param null $action |
|
16 | + */ |
|
17 | + public function __construct($form_name, $action= null) |
|
18 | + { |
|
19 | + parent :: __construct($form_name, 'post', $action); |
|
20 | + $displayscore = ScoreDisplay :: instance(); |
|
21 | + $customdisplays = $displayscore->get_custom_score_display_settings(); |
|
22 | + |
|
23 | + $nr_items = (count($customdisplays)!='0') ? count($customdisplays) : '1'; |
|
24 | + $this->setDefaults(array ( |
|
25 | 25 | 'scorecolpercent' => $displayscore->get_color_split_value() |
26 | - )); |
|
26 | + )); |
|
27 | 27 | |
28 | - $this->addElement('hidden', 'maxvalue', '100'); |
|
29 | - $this->addElement('hidden', 'minvalue', '0'); |
|
30 | - $counter= 1; |
|
28 | + $this->addElement('hidden', 'maxvalue', '100'); |
|
29 | + $this->addElement('hidden', 'minvalue', '0'); |
|
30 | + $counter= 1; |
|
31 | 31 | |
32 | - //setting the default values |
|
32 | + //setting the default values |
|
33 | 33 | |
34 | - if(is_array($customdisplays)) { |
|
35 | - foreach ($customdisplays as $customdisplay) { |
|
36 | - $this->setDefaults(array ( |
|
37 | - 'endscore[' . $counter . ']' => $customdisplay['score'], |
|
38 | - 'displaytext[' . $counter . ']' => $customdisplay['display'] |
|
39 | - )); |
|
40 | - $counter++; |
|
41 | - } |
|
42 | - } |
|
43 | - $scorecol = array(); |
|
34 | + if(is_array($customdisplays)) { |
|
35 | + foreach ($customdisplays as $customdisplay) { |
|
36 | + $this->setDefaults(array ( |
|
37 | + 'endscore[' . $counter . ']' => $customdisplay['score'], |
|
38 | + 'displaytext[' . $counter . ']' => $customdisplay['display'] |
|
39 | + )); |
|
40 | + $counter++; |
|
41 | + } |
|
42 | + } |
|
43 | + $scorecol = array(); |
|
44 | 44 | |
45 | - //settings for the colored score |
|
46 | - $this->addElement('header', get_lang('ScoreEdit')); |
|
45 | + //settings for the colored score |
|
46 | + $this->addElement('header', get_lang('ScoreEdit')); |
|
47 | 47 | |
48 | 48 | if ($displayscore->is_coloring_enabled()) { |
49 | 49 | $this->addElement('html', '<b>' . get_lang('ScoreColor') . '</b>'); |
50 | 50 | $this->addElement('text', 'scorecolpercent', array(get_lang('Below'), get_lang('WillColorRed'), '%'), array( |
51 | 51 | 'size' => 5, |
52 | 52 | 'maxlength' => 5, |
53 | - 'input-size' => 2 |
|
53 | + 'input-size' => 2 |
|
54 | 54 | )); |
55 | 55 | |
56 | 56 | if (api_get_setting('teachers_can_change_score_settings') != 'true') { |
@@ -62,25 +62,25 @@ discard block |
||
62 | 62 | $this->addRule(array('scorecolpercent','minvalue'), get_lang('UnderMin'), 'compare', '>'); |
63 | 63 | } |
64 | 64 | |
65 | - //Settings for the scoring system |
|
65 | + //Settings for the scoring system |
|
66 | 66 | |
67 | - if ($displayscore->is_custom()) { |
|
67 | + if ($displayscore->is_custom()) { |
|
68 | 68 | $this->addElement('html', '<br /><b>' . get_lang('ScoringSystem') . '</b>'); |
69 | - $this->addElement('static', null, null, get_lang('ScoreInfo')); |
|
70 | - $this->setDefaults(array( |
|
71 | - 'beginscore' => '0' |
|
72 | - )); |
|
73 | - $this->addElement('text', 'beginscore', array(get_lang('Between'), null, '%'), array( |
|
74 | - 'size' => 5, |
|
75 | - 'maxlength' => 5, |
|
76 | - 'disabled' => 'disabled', |
|
77 | - 'input-size' => 2 |
|
78 | - )); |
|
79 | - |
|
80 | - for ($counter= 1; $counter <= 20; $counter++) { |
|
81 | - $renderer =& $this->defaultRenderer(); |
|
82 | - $elementTemplateTwoLabel = |
|
83 | - '<div id=' . $counter . ' style="display: '.(($counter<=$nr_items)?'inline':'none').';"> |
|
69 | + $this->addElement('static', null, null, get_lang('ScoreInfo')); |
|
70 | + $this->setDefaults(array( |
|
71 | + 'beginscore' => '0' |
|
72 | + )); |
|
73 | + $this->addElement('text', 'beginscore', array(get_lang('Between'), null, '%'), array( |
|
74 | + 'size' => 5, |
|
75 | + 'maxlength' => 5, |
|
76 | + 'disabled' => 'disabled', |
|
77 | + 'input-size' => 2 |
|
78 | + )); |
|
79 | + |
|
80 | + for ($counter= 1; $counter <= 20; $counter++) { |
|
81 | + $renderer =& $this->defaultRenderer(); |
|
82 | + $elementTemplateTwoLabel = |
|
83 | + '<div id=' . $counter . ' style="display: '.(($counter<=$nr_items)?'inline':'none').';"> |
|
84 | 84 | |
85 | 85 | <!-- BEGIN required --><span class="form_required">*</span> <!-- END required --> |
86 | 86 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | '; |
107 | 107 | |
108 | - $elementTemplateTwoLabel2 =' |
|
108 | + $elementTemplateTwoLabel2 =' |
|
109 | 109 | <div class="col-sm-2"> |
110 | 110 | <!-- BEGIN error --><span class="form_error">{error}</span> |
111 | 111 | <!-- END error --> |
@@ -120,34 +120,34 @@ discard block |
||
120 | 120 | </div> |
121 | 121 | </div>'; |
122 | 122 | |
123 | - $scorebetw = array(); |
|
124 | - $this->addElement('text', 'endscore[' . $counter . ']', null, array ( |
|
125 | - 'size' => 5, |
|
126 | - 'maxlength' => 5, |
|
127 | - 'id' => 'txta-'.$counter, |
|
128 | - 'input-size' => 2 |
|
129 | - )); |
|
130 | - |
|
131 | - $this->addElement('text', 'displaytext[' . $counter . ']', null,array ( |
|
132 | - 'size' => 40, |
|
133 | - 'maxlength' => 40, |
|
134 | - 'id' => 'txtb-'.$counter |
|
135 | - )); |
|
136 | - $renderer->setElementTemplate($elementTemplateTwoLabel, 'endscore[' . $counter . ']'); |
|
137 | - $renderer->setElementTemplate($elementTemplateTwoLabel2, 'displaytext[' . $counter . ']'); |
|
138 | - $this->addRule('endscore[' . $counter . ']', get_lang('OnlyNumbers'), 'numeric'); |
|
139 | - $this->addRule(array ('endscore[' . $counter . ']', 'maxvalue'), get_lang('Over100'), 'compare', '<='); |
|
140 | - $this->addRule(array ('endscore[' . $counter . ']', 'minvalue'), get_lang('UnderMin'), 'compare', '>'); |
|
141 | - } |
|
142 | - } |
|
123 | + $scorebetw = array(); |
|
124 | + $this->addElement('text', 'endscore[' . $counter . ']', null, array ( |
|
125 | + 'size' => 5, |
|
126 | + 'maxlength' => 5, |
|
127 | + 'id' => 'txta-'.$counter, |
|
128 | + 'input-size' => 2 |
|
129 | + )); |
|
130 | + |
|
131 | + $this->addElement('text', 'displaytext[' . $counter . ']', null,array ( |
|
132 | + 'size' => 40, |
|
133 | + 'maxlength' => 40, |
|
134 | + 'id' => 'txtb-'.$counter |
|
135 | + )); |
|
136 | + $renderer->setElementTemplate($elementTemplateTwoLabel, 'endscore[' . $counter . ']'); |
|
137 | + $renderer->setElementTemplate($elementTemplateTwoLabel2, 'displaytext[' . $counter . ']'); |
|
138 | + $this->addRule('endscore[' . $counter . ']', get_lang('OnlyNumbers'), 'numeric'); |
|
139 | + $this->addRule(array ('endscore[' . $counter . ']', 'maxvalue'), get_lang('Over100'), 'compare', '<='); |
|
140 | + $this->addRule(array ('endscore[' . $counter . ']', 'minvalue'), get_lang('UnderMin'), 'compare', '>'); |
|
141 | + } |
|
142 | + } |
|
143 | 143 | |
144 | 144 | if ($displayscore->is_custom()) { |
145 | - $this->addButtonSave(get_lang('Ok')); |
|
146 | - } |
|
147 | - } |
|
145 | + $this->addButtonSave(get_lang('Ok')); |
|
146 | + } |
|
147 | + } |
|
148 | 148 | |
149 | - public function validate() |
|
149 | + public function validate() |
|
150 | 150 | { |
151 | - return parent :: validate(); |
|
152 | - } |
|
151 | + return parent :: validate(); |
|
152 | + } |
|
153 | 153 | } |
@@ -113,7 +113,7 @@ |
||
113 | 113 | foreach ($data_array as $item) { |
114 | 114 | $row = array (); |
115 | 115 | if ($this->iscourse == '1') { |
116 | - $row[] = $item['result_id']; |
|
116 | + $row[] = $item['result_id']; |
|
117 | 117 | } |
118 | 118 | if ($is_western_name_order) { |
119 | 119 | $row[] = $item['firstname']; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | isset ($_GET['action']) || |
19 | 19 | isset ($_POST['action'])) |
20 | 20 | ) { |
21 | - api_not_allowed(); |
|
21 | + api_not_allowed(); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -86,30 +86,30 @@ discard block |
||
86 | 86 | |
87 | 87 | // Build the form |
88 | 88 | if (isset($_GET['id'])) { |
89 | - // Update settings of existing category |
|
90 | - $action = 'update_settings'; |
|
89 | + // Update settings of existing category |
|
90 | + $action = 'update_settings'; |
|
91 | 91 | $form = new FormValidator( |
92 | 92 | 'group_category', |
93 | 93 | 'post', |
94 | 94 | api_get_self().'?id='.$category['id'].'&'.api_get_cidreq() |
95 | 95 | ); |
96 | - $form->addElement('hidden', 'id'); |
|
96 | + $form->addElement('hidden', 'id'); |
|
97 | 97 | } else { |
98 | 98 | // Checks if the field was created in the table Category. It creates it if is neccesary |
99 | 99 | $table_category = Database :: get_course_table(TABLE_GROUP_CATEGORY); |
100 | 100 | if (!Database::query("SELECT wiki_state FROM $table_category WHERE c_id = $course_id")) { |
101 | 101 | Database::query("ALTER TABLE $table_category ADD wiki_state tinyint(3) UNSIGNED NOT NULL default '1' WHERE c_id = $course_id"); |
102 | 102 | } |
103 | - // Create a new category |
|
104 | - $action = 'add_category'; |
|
105 | - $form = new FormValidator('group_category'); |
|
103 | + // Create a new category |
|
104 | + $action = 'add_category'; |
|
105 | + $form = new FormValidator('group_category'); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | // If categories allowed, show title & description field |
109 | 109 | if (api_get_setting('allow_group_categories') == 'true') { |
110 | 110 | $form->addElement('header', $nameTools); |
111 | 111 | $form->addElement('html', '<div class="row"><div class="col-md-6">'); |
112 | - $form->addText('title', get_lang('Title')); |
|
112 | + $form->addText('title', get_lang('Title')); |
|
113 | 113 | |
114 | 114 | // Groups per user |
115 | 115 | $possible_values = array(); |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | $form->addElement('html', '</div>'); |
143 | 143 | $form->addElement('html', '</div>'); |
144 | 144 | } else { |
145 | - $form->addElement('hidden', 'title'); |
|
146 | - $form->addElement('hidden', 'description'); |
|
145 | + $form->addElement('hidden', 'title'); |
|
146 | + $form->addElement('hidden', 'description'); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | $form->addElement('header', get_lang('DefaultSettingsForNewGroups')); |
@@ -79,10 +79,10 @@ discard block |
||
79 | 79 | if (isset($_POST['number_of_groups'])) { |
80 | 80 | if (!is_numeric($_POST['number_of_groups']) || intval($_POST['number_of_groups']) < 1) { |
81 | 81 | Display :: display_error_message( |
82 | - get_lang('PleaseEnterValidNumber').'<br /><br /> |
|
82 | + get_lang('PleaseEnterValidNumber').'<br /><br /> |
|
83 | 83 | <a href="group_creation.php?'.api_get_cidreq().'">« '.get_lang('Back').'</a>', |
84 | - false |
|
85 | - ); |
|
84 | + false |
|
85 | + ); |
|
86 | 86 | } else { |
87 | 87 | $number_of_groups = intval($_POST['number_of_groups']); |
88 | 88 | if ($number_of_groups > 1) { |
@@ -120,20 +120,20 @@ discard block |
||
120 | 120 | } |
121 | 121 | </script> |
122 | 122 | <?php |
123 | - } |
|
124 | - $group_categories = GroupManager::get_categories(); |
|
125 | - $group_id = GroupManager :: get_number_of_groups() + 1; |
|
126 | - $cat_options = []; |
|
127 | - foreach ($group_categories as $index => $category) { |
|
128 | - $cat_options[$category['id']] = $category['title']; |
|
129 | - } |
|
123 | + } |
|
124 | + $group_categories = GroupManager::get_categories(); |
|
125 | + $group_id = GroupManager :: get_number_of_groups() + 1; |
|
126 | + $cat_options = []; |
|
127 | + foreach ($group_categories as $index => $category) { |
|
128 | + $cat_options[$category['id']] = $category['title']; |
|
129 | + } |
|
130 | 130 | $form = new FormValidator('create_groups_step2', 'POST', api_get_self().'?'.api_get_cidreq()); |
131 | 131 | |
132 | - // Modify the default templates |
|
133 | - $renderer = $form->defaultRenderer(); |
|
134 | - $form_template = "<form {attributes}>\n<div class='create-groups'>\n<table>\n{content}\n</table>\n</div>\n</form>"; |
|
135 | - $renderer->setFormTemplate($form_template); |
|
136 | - $element_template = <<<EOT |
|
132 | + // Modify the default templates |
|
133 | + $renderer = $form->defaultRenderer(); |
|
134 | + $form_template = "<form {attributes}>\n<div class='create-groups'>\n<table>\n{content}\n</table>\n</div>\n</form>"; |
|
135 | + $renderer->setFormTemplate($form_template); |
|
136 | + $element_template = <<<EOT |
|
137 | 137 | <tr class="separate"> |
138 | 138 | <td> |
139 | 139 | <!-- BEGIN required --> |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $form->setDefaults($defaults); |
226 | 226 | $form->addButtonCreate(get_lang('CreateGroup'), 'submit'); |
227 | 227 | $form->display(); |
228 | - } |
|
228 | + } |
|
229 | 229 | } else { |
230 | 230 | /* |
231 | 231 | * Show form to generate new groups |
@@ -267,11 +267,11 @@ |
||
267 | 267 | $coachName = api_get_person_name($userResult['firstname'], $userResult['lastname']); |
268 | 268 | } |
269 | 269 | |
270 | - $courses[] = array( |
|
271 | - 'id' => $courseId, |
|
272 | - 'name' => $course['title'], |
|
273 | - 'coachName' => $coachName, |
|
274 | - ); |
|
270 | + $courses[] = array( |
|
271 | + 'id' => $courseId, |
|
272 | + 'name' => $course['title'], |
|
273 | + 'coachName' => $coachName, |
|
274 | + ); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | echo json_encode($courses); |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $add_type = 'unique'; |
39 | 39 | |
40 | 40 | if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') { |
41 | - $add_type = Security::remove_XSS($_REQUEST['add_type']); |
|
41 | + $add_type = Security::remove_XSS($_REQUEST['add_type']); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | $page = isset($_GET['page']) ? Security::remove_XSS($_GET['page']) : null; |
@@ -426,8 +426,8 @@ discard block |
||
426 | 426 | |
427 | 427 | if ($use_extra_fields) { |
428 | 428 | $final_result = array(); |
429 | - if (count($extra_field_result)>1) { |
|
430 | - for($i=0;$i<count($extra_field_result)-1;$i++) { |
|
429 | + if (count($extra_field_result)>1) { |
|
430 | + for($i=0;$i<count($extra_field_result)-1;$i++) { |
|
431 | 431 | if (is_array($extra_field_result[$i+1])) { |
432 | 432 | $final_result = array_intersect($extra_field_result[$i],$extra_field_result[$i+1]); |
433 | 433 | } |
@@ -547,12 +547,12 @@ discard block |
||
547 | 547 | } |
548 | 548 | |
549 | 549 | if ($add_type == 'multiple') { |
550 | - $link_add_type_unique = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.$addProcess.'&add_type=unique">'. |
|
550 | + $link_add_type_unique = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.$addProcess.'&add_type=unique">'. |
|
551 | 551 | Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>'; |
552 | - $link_add_type_multiple = Display::url(Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple'), ''); |
|
552 | + $link_add_type_multiple = Display::url(Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple'), ''); |
|
553 | 553 | } else { |
554 | - $link_add_type_unique = Display::url(Display::return_icon('single.gif').get_lang('SessionAddTypeUnique'), ''); |
|
555 | - $link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.$addProcess.'&add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>'; |
|
554 | + $link_add_type_unique = Display::url(Display::return_icon('single.gif').get_lang('SessionAddTypeUnique'), ''); |
|
555 | + $link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.$addProcess.'&add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>'; |
|
556 | 556 | } |
557 | 557 | $link_add_group = Display::url( |
558 | 558 | Display::return_icon('multiple.gif',get_lang('RegistrationByUsersGroups')).get_lang('RegistrationByUsersGroups'), |
@@ -580,17 +580,17 @@ discard block |
||
580 | 580 | <?php echo '<legend>'.$tool_name.' ('.$session_info['name'].') </legend>'; ?> |
581 | 581 | <?php |
582 | 582 | if ($add_type=='multiple') { |
583 | - if (is_array($extra_field_list)) { |
|
584 | - if (is_array($new_field_list) && count($new_field_list)>0 ) { |
|
585 | - echo '<h3>'.get_lang('FilterUsers').'</h3>'; |
|
586 | - foreach ($new_field_list as $new_field) { |
|
587 | - echo $new_field['name']; |
|
588 | - $varname = 'field_'.$new_field['variable']; |
|
583 | + if (is_array($extra_field_list)) { |
|
584 | + if (is_array($new_field_list) && count($new_field_list)>0 ) { |
|
585 | + echo '<h3>'.get_lang('FilterUsers').'</h3>'; |
|
586 | + foreach ($new_field_list as $new_field) { |
|
587 | + echo $new_field['name']; |
|
588 | + $varname = 'field_'.$new_field['variable']; |
|
589 | 589 | $fieldtype = $new_field['type']; |
590 | - echo ' <select name="'.$varname.'">'; |
|
591 | - echo '<option value="0">--'.get_lang('Select').'--</option>'; |
|
592 | - foreach ($new_field['data'] as $option) { |
|
593 | - $checked=''; |
|
590 | + echo ' <select name="'.$varname.'">'; |
|
591 | + echo '<option value="0">--'.get_lang('Select').'--</option>'; |
|
592 | + foreach ($new_field['data'] as $option) { |
|
593 | + $checked=''; |
|
594 | 594 | if ($fieldtype == ExtraField::FIELD_TYPE_TAG) { |
595 | 595 | if (isset($_POST[$varname])) { |
596 | 596 | if ($_POST[$varname] == $option['tag']) { |
@@ -611,11 +611,11 @@ discard block |
||
611 | 611 | $extraHidden = $fieldtype == ExtraField::FIELD_TYPE_TAG ? '<input type="hidden" name="field_id" value="'.$option['field_id'].'" />' : ''; |
612 | 612 | echo $extraHidden; |
613 | 613 | echo ' '; |
614 | - } |
|
615 | - echo '<input type="button" value="'.get_lang('Filter').'" onclick="validate_filter()" />'; |
|
616 | - echo '<br /><br />'; |
|
617 | - } |
|
618 | - } |
|
614 | + } |
|
615 | + echo '<input type="button" value="'.get_lang('Filter').'" onclick="validate_filter()" />'; |
|
616 | + echo '<br /><br />'; |
|
617 | + } |
|
618 | + } |
|
619 | 619 | } |
620 | 620 | ?> |
621 | 621 | <input type="hidden" name="form_sent" value="1" /> |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | |
624 | 624 | <?php |
625 | 625 | if (!empty($errorMsg)) { |
626 | - Display::display_normal_message($errorMsg); //main API |
|
626 | + Display::display_normal_message($errorMsg); //main API |
|
627 | 627 | } |
628 | 628 | ?> |
629 | 629 | <div id="multiple-add-session" class="row"> |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | <label><?php echo get_lang('UserListInPlatform') ?> </label> |
633 | 633 | <?php |
634 | 634 | if (!($add_type=='multiple')) { |
635 | - ?> |
|
635 | + ?> |
|
636 | 636 | <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" class="form-control" /> |
637 | 637 | <div id="ajax_list_users_single" class="select-list-ajax"></div> |
638 | 638 | <?php |
@@ -641,21 +641,21 @@ discard block |
||
641 | 641 | <div id="ajax_list_users_multiple"> |
642 | 642 | <select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" class="form-control"> |
643 | 643 | <?php |
644 | - foreach ($nosessionUsersList as $uid => $enreg) { |
|
645 | - ?> |
|
644 | + foreach ($nosessionUsersList as $uid => $enreg) { |
|
645 | + ?> |
|
646 | 646 | <option value="<?php echo $uid; ?>" <?php if(in_array($uid,$UserList)) echo 'selected="selected"'; ?>> |
647 | 647 | <?php |
648 | - $personName = api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].') '.$enreg['official_code']; |
|
649 | - if ($showOfficialCode) { |
|
650 | - $officialCode = !empty($enreg['official_code']) ? $enreg['official_code'].' - ' : '? - '; |
|
651 | - $personName = $officialCode.api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].')'; |
|
652 | - } |
|
653 | - echo $personName; |
|
654 | - ?> |
|
648 | + $personName = api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].') '.$enreg['official_code']; |
|
649 | + if ($showOfficialCode) { |
|
650 | + $officialCode = !empty($enreg['official_code']) ? $enreg['official_code'].' - ' : '? - '; |
|
651 | + $personName = $officialCode.api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].')'; |
|
652 | + } |
|
653 | + echo $personName; |
|
654 | + ?> |
|
655 | 655 | </option> |
656 | 656 | <?php |
657 | - } |
|
658 | - ?> |
|
657 | + } |
|
658 | + ?> |
|
659 | 659 | </select> |
660 | 660 | </div> |
661 | 661 | <input type="checkbox" onchange="checked_in_no_session(this.checked);" name="user_with_any_session" id="user_with_any_session_id"> |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | <?php |
664 | 664 | } |
665 | 665 | unset($nosessionUsersList); |
666 | - ?> |
|
666 | + ?> |
|
667 | 667 | </div> |
668 | 668 | </div> |
669 | 669 | |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | <?php |
708 | 708 | } |
709 | 709 | if (!empty($addProcess)) { |
710 | - echo '<button class="btn btn-success" type="button" value="" onclick="valide()" >'.get_lang('FinishSessionCreation').'</button>'; |
|
710 | + echo '<button class="btn btn-success" type="button" value="" onclick="valide()" >'.get_lang('FinishSessionCreation').'</button>'; |
|
711 | 711 | } else { |
712 | 712 | echo '<button class="btn btn-success" type="button" value="" onclick="valide()" >'.get_lang('SubscribeUsersToSession').'</button>'; |
713 | 713 | } |