@@ -28,11 +28,11 @@ discard block |
||
28 | 28 | |
29 | 29 | // COURSES WITH CATEGORIES |
30 | 30 | if (!empty($user_course_categories)) { |
31 | - foreach ($user_course_categories as $row) { |
|
32 | - echo Display::page_subheader($row['title']); |
|
33 | - echo '<a name="category'.$row['id'].'"></a>'; |
|
31 | + foreach ($user_course_categories as $row) { |
|
32 | + echo Display::page_subheader($row['title']); |
|
33 | + echo '<a name="category'.$row['id'].'"></a>'; |
|
34 | 34 | |
35 | - if (isset($_GET['categoryid']) && $_GET['categoryid'] == $row['id']) { ?> |
|
35 | + if (isset($_GET['categoryid']) && $_GET['categoryid'] == $row['id']) { ?> |
|
36 | 36 | <!-- We display the edit form for the category --> |
37 | 37 | |
38 | 38 | <form name="edit_course_category" method="post" action="courses.php?action=<?php echo $action; ?>"> |
@@ -243,15 +243,15 @@ discard block |
||
243 | 243 | </a> |
244 | 244 | <?php } else { |
245 | 245 | echo Display::display_icon('up_na.png', get_lang('Up'),'',22); |
246 | - } |
|
246 | + } |
|
247 | 247 | |
248 | - if ($key < $number_of_courses - 1) { ?> |
|
248 | + if ($key < $number_of_courses - 1) { ?> |
|
249 | 249 | <a href="courses.php?action=<?php echo $action; ?>&move=down&course=<?php echo $course['code']; ?>&category=<?php echo $course['user_course_cat']; ?>&sec_token=<?php echo $stok; ?>"> |
250 | 250 | <?php echo Display::display_icon('down.png', get_lang('Down'),'',22); ?> |
251 | 251 | </a> |
252 | 252 | <?php } else { |
253 | 253 | echo Display::display_icon('down_na.png', get_lang('Down'),'',22); |
254 | - }?> |
|
254 | + }?> |
|
255 | 255 | </div> |
256 | 256 | <div style="float:left; margin-right:10px;"> |
257 | 257 | <!-- cancel subscrioption--> |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | </div> |
270 | 270 | <?php } |
271 | 271 | } |
272 | - ?> |
|
272 | + ?> |
|
273 | 273 | </td> |
274 | 274 | </tr> |
275 | 275 | <?php |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | exit; |
53 | 53 | break; |
54 | 54 | case 'create_subgroups': |
55 | - GroupManager::create_subgroups( |
|
56 | - $_POST['base_group'], |
|
57 | - $_POST['number_of_groups'] |
|
58 | - ); |
|
55 | + GroupManager::create_subgroups( |
|
56 | + $_POST['base_group'], |
|
57 | + $_POST['number_of_groups'] |
|
58 | + ); |
|
59 | 59 | Display::addFlash(Display::return_message(get_lang('GroupsAdded'))); |
60 | 60 | header("Location: ".$currentUrl); |
61 | 61 | exit; |
@@ -80,10 +80,10 @@ discard block |
||
80 | 80 | if (isset($_POST['number_of_groups'])) { |
81 | 81 | if (!is_numeric($_POST['number_of_groups']) || intval($_POST['number_of_groups']) < 1) { |
82 | 82 | Display :: display_error_message( |
83 | - get_lang('PleaseEnterValidNumber').'<br /><br /> |
|
83 | + get_lang('PleaseEnterValidNumber').'<br /><br /> |
|
84 | 84 | <a href="group_creation.php?'.api_get_cidreq().'">« '.get_lang('Back').'</a>', |
85 | - false |
|
86 | - ); |
|
85 | + false |
|
86 | + ); |
|
87 | 87 | } else { |
88 | 88 | $number_of_groups = intval($_POST['number_of_groups']); |
89 | 89 | if ($number_of_groups > 1) { |
@@ -121,20 +121,20 @@ discard block |
||
121 | 121 | } |
122 | 122 | </script> |
123 | 123 | <?php |
124 | - } |
|
125 | - $group_categories = GroupManager::get_categories(); |
|
126 | - $group_id = GroupManager :: get_number_of_groups() + 1; |
|
127 | - $cat_options = []; |
|
128 | - foreach ($group_categories as $index => $category) { |
|
129 | - $cat_options[$category['id']] = $category['title']; |
|
130 | - } |
|
124 | + } |
|
125 | + $group_categories = GroupManager::get_categories(); |
|
126 | + $group_id = GroupManager :: get_number_of_groups() + 1; |
|
127 | + $cat_options = []; |
|
128 | + foreach ($group_categories as $index => $category) { |
|
129 | + $cat_options[$category['id']] = $category['title']; |
|
130 | + } |
|
131 | 131 | $form = new FormValidator('create_groups_step2', 'POST', api_get_self().'?'.api_get_cidreq()); |
132 | 132 | |
133 | - // Modify the default templates |
|
134 | - $renderer = $form->defaultRenderer(); |
|
135 | - $form_template = "<form {attributes}>\n<div class='create-groups'>\n<table>\n{content}\n</table>\n</div>\n</form>"; |
|
136 | - $renderer->setFormTemplate($form_template); |
|
137 | - $element_template = <<<EOT |
|
133 | + // Modify the default templates |
|
134 | + $renderer = $form->defaultRenderer(); |
|
135 | + $form_template = "<form {attributes}>\n<div class='create-groups'>\n<table>\n{content}\n</table>\n</div>\n</form>"; |
|
136 | + $renderer->setFormTemplate($form_template); |
|
137 | + $element_template = <<<EOT |
|
138 | 138 | <tr class="separate"> |
139 | 139 | <td> |
140 | 140 | <!-- BEGIN required --> |
@@ -147,149 +147,149 @@ discard block |
||
147 | 147 | </tr> |
148 | 148 | |
149 | 149 | EOT; |
150 | - $renderer->setCustomElementTemplate($element_template); |
|
150 | + $renderer->setCustomElementTemplate($element_template); |
|
151 | 151 | $form->addElement('header', $nameTools); |
152 | - $form->addElement('hidden', 'action'); |
|
153 | - $form->addElement('hidden', 'number_of_groups'); |
|
154 | - $defaults = array(); |
|
155 | - // Table heading |
|
156 | - $group_el = array(); |
|
157 | - $group_el[] = $form->createElement('static', null, null, '<b>'.get_lang('GroupName').'</b>'); |
|
152 | + $form->addElement('hidden', 'action'); |
|
153 | + $form->addElement('hidden', 'number_of_groups'); |
|
154 | + $defaults = array(); |
|
155 | + // Table heading |
|
156 | + $group_el = array(); |
|
157 | + $group_el[] = $form->createElement('static', null, null, '<b>'.get_lang('GroupName').'</b>'); |
|
158 | 158 | |
159 | - if (api_get_setting('allow_group_categories') == 'true') { |
|
160 | - $group_el[] = $form->createElement('static', null, null, '<b>'.get_lang('GroupCategory').'</b>'); |
|
161 | - } |
|
162 | - $group_el[] = $form->createElement('static', null, null, '<b>'.get_lang('GroupPlacesThis').'</b>'); |
|
163 | - $form->addGroup($group_el, 'groups', null, "</td><td>", false); |
|
164 | - // Checkboxes |
|
165 | - if ($_POST['number_of_groups'] > 1) { |
|
166 | - $group_el = array (); |
|
167 | - $group_el[] = $form->createElement('static', null, null, ' '); |
|
168 | - if (api_get_setting('allow_group_categories') == 'true') { |
|
169 | - $group_el[] = $form->createElement('checkbox', 'same_category', null, get_lang('SameForAll'), array('onclick' => "javascript: switch_state('category');")); |
|
170 | - } |
|
171 | - $group_el[] = $form->createElement('checkbox', 'same_places', null, get_lang('SameForAll'), array ('onclick' => "javascript: switch_state('places');")); |
|
172 | - $form->addGroup($group_el, 'groups', null, '</td><td>', false); |
|
173 | - } |
|
174 | - // Properties for all groups |
|
175 | - for ($group_number = 0; $group_number < $_POST['number_of_groups']; $group_number ++) { |
|
176 | - $group_el = array(); |
|
177 | - $group_el[] = $form->createElement('text', 'group_'.$group_number.'_name'); |
|
178 | - if (api_get_setting('allow_group_categories') == 'true') { |
|
179 | - $group_el[] = $form->createElement('select', 'group_'.$group_number.'_category', null, $cat_options, array('id' => 'category_'.$group_number)); |
|
180 | - } |
|
181 | - $group_el[] = $form->createElement('text', 'group_'.$group_number.'_places', null, array('class' => 'span1', 'id' => 'places_'.$group_number)); |
|
159 | + if (api_get_setting('allow_group_categories') == 'true') { |
|
160 | + $group_el[] = $form->createElement('static', null, null, '<b>'.get_lang('GroupCategory').'</b>'); |
|
161 | + } |
|
162 | + $group_el[] = $form->createElement('static', null, null, '<b>'.get_lang('GroupPlacesThis').'</b>'); |
|
163 | + $form->addGroup($group_el, 'groups', null, "</td><td>", false); |
|
164 | + // Checkboxes |
|
165 | + if ($_POST['number_of_groups'] > 1) { |
|
166 | + $group_el = array (); |
|
167 | + $group_el[] = $form->createElement('static', null, null, ' '); |
|
168 | + if (api_get_setting('allow_group_categories') == 'true') { |
|
169 | + $group_el[] = $form->createElement('checkbox', 'same_category', null, get_lang('SameForAll'), array('onclick' => "javascript: switch_state('category');")); |
|
170 | + } |
|
171 | + $group_el[] = $form->createElement('checkbox', 'same_places', null, get_lang('SameForAll'), array ('onclick' => "javascript: switch_state('places');")); |
|
172 | + $form->addGroup($group_el, 'groups', null, '</td><td>', false); |
|
173 | + } |
|
174 | + // Properties for all groups |
|
175 | + for ($group_number = 0; $group_number < $_POST['number_of_groups']; $group_number ++) { |
|
176 | + $group_el = array(); |
|
177 | + $group_el[] = $form->createElement('text', 'group_'.$group_number.'_name'); |
|
178 | + if (api_get_setting('allow_group_categories') == 'true') { |
|
179 | + $group_el[] = $form->createElement('select', 'group_'.$group_number.'_category', null, $cat_options, array('id' => 'category_'.$group_number)); |
|
180 | + } |
|
181 | + $group_el[] = $form->createElement('text', 'group_'.$group_number.'_places', null, array('class' => 'span1', 'id' => 'places_'.$group_number)); |
|
182 | 182 | |
183 | - if ($_POST['number_of_groups'] < 10000) { |
|
184 | - if ($group_id < 10) { |
|
185 | - $prev = '000'; |
|
186 | - } elseif ($group_id < 100) { |
|
187 | - $prev = '00'; |
|
188 | - } elseif ($group_id<1000) { |
|
189 | - $prev = '0'; |
|
190 | - } else { |
|
191 | - $prev = ''; |
|
192 | - } |
|
193 | - } |
|
183 | + if ($_POST['number_of_groups'] < 10000) { |
|
184 | + if ($group_id < 10) { |
|
185 | + $prev = '000'; |
|
186 | + } elseif ($group_id < 100) { |
|
187 | + $prev = '00'; |
|
188 | + } elseif ($group_id<1000) { |
|
189 | + $prev = '0'; |
|
190 | + } else { |
|
191 | + $prev = ''; |
|
192 | + } |
|
193 | + } |
|
194 | 194 | |
195 | - $defaults['group_'.$group_number.'_name'] = get_lang('GroupSingle').' '.$prev.$group_id ++; |
|
196 | - $form->addGroup($group_el, 'group_'.$group_number, null, '</td><td>', false); |
|
197 | - } |
|
198 | - $defaults['action'] = 'create_groups'; |
|
199 | - $defaults['number_of_groups'] = intval($_POST['number_of_groups']); |
|
200 | - $form->setDefaults($defaults); |
|
201 | - $form->addButtonCreate(get_lang('CreateGroup'), 'submit'); |
|
195 | + $defaults['group_'.$group_number.'_name'] = get_lang('GroupSingle').' '.$prev.$group_id ++; |
|
196 | + $form->addGroup($group_el, 'group_'.$group_number, null, '</td><td>', false); |
|
197 | + } |
|
198 | + $defaults['action'] = 'create_groups'; |
|
199 | + $defaults['number_of_groups'] = intval($_POST['number_of_groups']); |
|
200 | + $form->setDefaults($defaults); |
|
201 | + $form->addButtonCreate(get_lang('CreateGroup'), 'submit'); |
|
202 | 202 | $form->display(); |
203 | - } |
|
203 | + } |
|
204 | 204 | } else { |
205 | - /* |
|
205 | + /* |
|
206 | 206 | * Show form to generate new groups |
207 | 207 | */ |
208 | 208 | |
209 | - $create_groups_form = new FormValidator('create_groups', 'post', api_get_self().'?'.api_get_cidreq()); |
|
210 | - $create_groups_form->addElement('header', $nameTools); |
|
211 | - /* $group_el = array (); |
|
209 | + $create_groups_form = new FormValidator('create_groups', 'post', api_get_self().'?'.api_get_cidreq()); |
|
210 | + $create_groups_form->addElement('header', $nameTools); |
|
211 | + /* $group_el = array (); |
|
212 | 212 | $group_el[] = $create_groups_form->createElement('text', 'number_of_groups', array(get_lang('Create'), '1')); |
213 | 213 | $group_el[] = $create_groups_form->addButtonCreate(get_lang('ProceedToCreateGroup'), 'submit', true); |
214 | 214 | $create_groups_form->addGroup($group_el, 'create_groups', get_lang('NumberOfGroupsToCreate'), ' ', false); |
215 | 215 | */ |
216 | 216 | $create_groups_form->addText('number_of_groups',get_lang('NumberOfGroupsToCreate'),null,array('value'=>'1')); |
217 | 217 | $create_groups_form->addButton('submit', get_lang('ProceedToCreateGroup'),'plus','primary'); |
218 | - $defaults = array(); |
|
219 | - $defaults['number_of_groups'] = 1; |
|
220 | - $create_groups_form->setDefaults($defaults); |
|
221 | - $create_groups_form->display(); |
|
218 | + $defaults = array(); |
|
219 | + $defaults['number_of_groups'] = 1; |
|
220 | + $create_groups_form->setDefaults($defaults); |
|
221 | + $create_groups_form->display(); |
|
222 | 222 | |
223 | - /* |
|
223 | + /* |
|
224 | 224 | * Show form to generate subgroups |
225 | 225 | */ |
226 | - if (api_get_setting('allow_group_categories') == 'true' && count(GroupManager :: get_group_list()) > 0) { |
|
227 | - $base_group_options = array (); |
|
228 | - $groups = GroupManager :: get_group_list(); |
|
229 | - foreach ($groups as $index => $group) { |
|
230 | - $number_of_students = GroupManager :: number_of_students($group['id']); |
|
231 | - if ($number_of_students > 0) { |
|
232 | - $base_group_options[$group['id']] = $group['name'].' ('.$number_of_students.' '.get_lang('Users').')'; |
|
233 | - } |
|
234 | - } |
|
235 | - if (count($base_group_options) > 0) { |
|
236 | - $create_subgroups_form = new FormValidator('create_subgroups', 'post', api_get_self().'?'.api_get_cidreq()); |
|
226 | + if (api_get_setting('allow_group_categories') == 'true' && count(GroupManager :: get_group_list()) > 0) { |
|
227 | + $base_group_options = array (); |
|
228 | + $groups = GroupManager :: get_group_list(); |
|
229 | + foreach ($groups as $index => $group) { |
|
230 | + $number_of_students = GroupManager :: number_of_students($group['id']); |
|
231 | + if ($number_of_students > 0) { |
|
232 | + $base_group_options[$group['id']] = $group['name'].' ('.$number_of_students.' '.get_lang('Users').')'; |
|
233 | + } |
|
234 | + } |
|
235 | + if (count($base_group_options) > 0) { |
|
236 | + $create_subgroups_form = new FormValidator('create_subgroups', 'post', api_get_self().'?'.api_get_cidreq()); |
|
237 | 237 | $create_subgroups_form->addElement('header', get_lang('CreateSubgroups')); |
238 | 238 | $create_subgroups_form->addElement('html', get_lang('CreateSubgroupsInfo')); |
239 | - $create_subgroups_form->addElement('hidden', 'action'); |
|
240 | - $group_el = array(); |
|
241 | - $group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('CreateNumberOfGroups')); |
|
242 | - $group_el[] = $create_subgroups_form->createElement('text', 'number_of_groups', null, array('size' => 3)); |
|
243 | - $group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('WithUsersFrom')); |
|
244 | - $group_el[] = $create_subgroups_form->createElement('select', 'base_group', null, $base_group_options); |
|
245 | - $group_el[] = $create_subgroups_form->createElement('button', 'submit', get_lang('Ok')); |
|
246 | - $create_subgroups_form->addGroup($group_el, 'create_groups', null, ' ', false); |
|
247 | - $defaults = array(); |
|
248 | - $defaults['action'] = 'create_subgroups'; |
|
249 | - $create_subgroups_form->setDefaults($defaults); |
|
250 | - $create_subgroups_form->display(); |
|
251 | - } |
|
252 | - } |
|
239 | + $create_subgroups_form->addElement('hidden', 'action'); |
|
240 | + $group_el = array(); |
|
241 | + $group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('CreateNumberOfGroups')); |
|
242 | + $group_el[] = $create_subgroups_form->createElement('text', 'number_of_groups', null, array('size' => 3)); |
|
243 | + $group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('WithUsersFrom')); |
|
244 | + $group_el[] = $create_subgroups_form->createElement('select', 'base_group', null, $base_group_options); |
|
245 | + $group_el[] = $create_subgroups_form->createElement('button', 'submit', get_lang('Ok')); |
|
246 | + $create_subgroups_form->addGroup($group_el, 'create_groups', null, ' ', false); |
|
247 | + $defaults = array(); |
|
248 | + $defaults['action'] = 'create_subgroups'; |
|
249 | + $create_subgroups_form->setDefaults($defaults); |
|
250 | + $create_subgroups_form->display(); |
|
251 | + } |
|
252 | + } |
|
253 | 253 | |
254 | - /* |
|
254 | + /* |
|
255 | 255 | * Show form to generate groups from classes subscribed to the course |
256 | 256 | */ |
257 | 257 | $options['where'] = array(" usergroup.course_id = ? " => api_get_real_course_id()); |
258 | 258 | $obj = new UserGroup(); |
259 | 259 | $classes = $obj->getUserGroupInCourse($options); |
260 | - if (count($classes) > 0) { |
|
261 | - echo '<b>'.get_lang('GroupsFromClasses').'</b>'; |
|
262 | - echo '<blockquote>'; |
|
263 | - echo '<p>'.get_lang('GroupsFromClassesInfo').'</p>'; |
|
264 | - echo '<ul>'; |
|
265 | - foreach ($classes as $index => $class) { |
|
266 | - $number_of_users = count($obj->get_users_by_usergroup($class['id'])); |
|
267 | - echo '<li>'; |
|
268 | - echo $class['name']; |
|
269 | - echo ' ('.$number_of_users.' '.get_lang('Users').')'; |
|
270 | - echo '</li>'; |
|
271 | - } |
|
272 | - echo '</ul>'; |
|
260 | + if (count($classes) > 0) { |
|
261 | + echo '<b>'.get_lang('GroupsFromClasses').'</b>'; |
|
262 | + echo '<blockquote>'; |
|
263 | + echo '<p>'.get_lang('GroupsFromClassesInfo').'</p>'; |
|
264 | + echo '<ul>'; |
|
265 | + foreach ($classes as $index => $class) { |
|
266 | + $number_of_users = count($obj->get_users_by_usergroup($class['id'])); |
|
267 | + echo '<li>'; |
|
268 | + echo $class['name']; |
|
269 | + echo ' ('.$number_of_users.' '.get_lang('Users').')'; |
|
270 | + echo '</li>'; |
|
271 | + } |
|
272 | + echo '</ul>'; |
|
273 | 273 | |
274 | - $create_class_groups_form = new FormValidator('create_class_groups_form', 'post', api_get_self().'?'.api_get_cidreq()); |
|
275 | - $create_class_groups_form->addElement('hidden', 'action'); |
|
276 | - if (api_get_setting('allow_group_categories') == 'true') { |
|
277 | - $group_categories = GroupManager :: get_categories(); |
|
278 | - $cat_options = array(); |
|
279 | - foreach ($group_categories as $index => $category) { |
|
280 | - $cat_options[$category['id']] = $category['title']; |
|
281 | - } |
|
282 | - $create_class_groups_form->addElement('select', 'group_category', null, $cat_options); |
|
283 | - } else { |
|
284 | - $create_class_groups_form->addElement('hidden', 'group_category'); |
|
285 | - } |
|
286 | - $create_class_groups_form->addElement('submit', 'submit', get_lang('Ok')); |
|
287 | - $defaults['group_category'] = GroupManager::DEFAULT_GROUP_CATEGORY; |
|
288 | - $defaults['action'] = 'create_class_groups'; |
|
289 | - $create_class_groups_form->setDefaults($defaults); |
|
290 | - $create_class_groups_form->display(); |
|
291 | - echo '</blockquote>'; |
|
292 | - } |
|
274 | + $create_class_groups_form = new FormValidator('create_class_groups_form', 'post', api_get_self().'?'.api_get_cidreq()); |
|
275 | + $create_class_groups_form->addElement('hidden', 'action'); |
|
276 | + if (api_get_setting('allow_group_categories') == 'true') { |
|
277 | + $group_categories = GroupManager :: get_categories(); |
|
278 | + $cat_options = array(); |
|
279 | + foreach ($group_categories as $index => $category) { |
|
280 | + $cat_options[$category['id']] = $category['title']; |
|
281 | + } |
|
282 | + $create_class_groups_form->addElement('select', 'group_category', null, $cat_options); |
|
283 | + } else { |
|
284 | + $create_class_groups_form->addElement('hidden', 'group_category'); |
|
285 | + } |
|
286 | + $create_class_groups_form->addElement('submit', 'submit', get_lang('Ok')); |
|
287 | + $defaults['group_category'] = GroupManager::DEFAULT_GROUP_CATEGORY; |
|
288 | + $defaults['action'] = 'create_class_groups'; |
|
289 | + $create_class_groups_form->setDefaults($defaults); |
|
290 | + $create_class_groups_form->display(); |
|
291 | + echo '</blockquote>'; |
|
292 | + } |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | Display :: display_footer(); |
@@ -60,7 +60,7 @@ |
||
60 | 60 | break; |
61 | 61 | } |
62 | 62 | break; |
63 | - } |
|
63 | + } |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | /* Header */ |
@@ -3,7 +3,7 @@ |
||
3 | 3 | |
4 | 4 | /** |
5 | 5 | * This script displays an area where teachers can edit the group properties and member list. |
6 | - * |
|
6 | + * |
|
7 | 7 | * @author various contributors |
8 | 8 | * @author Roan Embrechts (VUB), partial code cleanup, initial virtual course support |
9 | 9 | * @package chamilo.group |
@@ -161,9 +161,9 @@ |
||
161 | 161 | // possible : number_groups_left > 0 and is group member |
162 | 162 | $possible_users = array(); |
163 | 163 | foreach ($complete_user_list as $index => $user) { |
164 | - if ($user['number_groups_left'] > 0 || in_array($user['user_id'], $selected_users)) { |
|
164 | + if ($user['number_groups_left'] > 0 || in_array($user['user_id'], $selected_users)) { |
|
165 | 165 | $possible_users[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; |
166 | - } |
|
166 | + } |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | $group_members_element = $form->addElement('advmultiselect', 'group_members', get_lang('GroupMembers'), $possible_users, 'style="width: 280px;"'); |
@@ -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')); |
@@ -228,17 +228,17 @@ discard block |
||
228 | 228 | if ($form->validate()) { |
229 | 229 | $values = $form->exportValues(); |
230 | 230 | if ($values['max_member_no_limit'] == GroupManager::MEMBER_PER_GROUP_NO_LIMIT) { |
231 | - $max_member = GroupManager::MEMBER_PER_GROUP_NO_LIMIT; |
|
232 | - } else { |
|
233 | - $max_member = $values['max_member']; |
|
234 | - } |
|
231 | + $max_member = GroupManager::MEMBER_PER_GROUP_NO_LIMIT; |
|
232 | + } else { |
|
233 | + $max_member = $values['max_member']; |
|
234 | + } |
|
235 | 235 | |
236 | - $self_reg_allowed = isset($values['self_reg_allowed']) ? $values['self_reg_allowed'] : 0; |
|
237 | - $self_unreg_allowed = isset($values['self_unreg_allowed']) ? $values['self_unreg_allowed'] : 0; |
|
236 | + $self_reg_allowed = isset($values['self_reg_allowed']) ? $values['self_reg_allowed'] : 0; |
|
237 | + $self_unreg_allowed = isset($values['self_unreg_allowed']) ? $values['self_unreg_allowed'] : 0; |
|
238 | 238 | |
239 | - switch ($values['action']) { |
|
240 | - case 'update_settings': |
|
241 | - GroupManager::update_category( |
|
239 | + switch ($values['action']) { |
|
240 | + case 'update_settings': |
|
241 | + GroupManager::update_category( |
|
242 | 242 | $values['id'], |
243 | 243 | $values['title'], |
244 | 244 | $values['description'], |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | Display::addFlash(Display::return_message(get_lang('GroupPropertiesModified'))); |
258 | 258 | header("Location: ".$currentUrl."&category=".$values['id']); |
259 | 259 | exit; |
260 | - case 'add_category': |
|
261 | - GroupManager :: create_category( |
|
260 | + case 'add_category': |
|
261 | + GroupManager :: create_category( |
|
262 | 262 | $values['title'], |
263 | 263 | $values['description'], |
264 | 264 | $values['doc_state'], |
@@ -276,8 +276,8 @@ discard block |
||
276 | 276 | Display::addFlash(Display::return_message(get_lang('CategoryCreated'))); |
277 | 277 | header("Location: ".$currentUrl); |
278 | 278 | exit; |
279 | - break; |
|
280 | - } |
|
279 | + break; |
|
280 | + } |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | // Else display the form |
@@ -292,10 +292,10 @@ discard block |
||
292 | 292 | $defaults = $category; |
293 | 293 | $defaults['action'] = $action; |
294 | 294 | if ($defaults['max_student'] == GroupManager::MEMBER_PER_GROUP_NO_LIMIT) { |
295 | - $defaults['max_member_no_limit'] = GroupManager::MEMBER_PER_GROUP_NO_LIMIT; |
|
295 | + $defaults['max_member_no_limit'] = GroupManager::MEMBER_PER_GROUP_NO_LIMIT; |
|
296 | 296 | } else { |
297 | - $defaults['max_member_no_limit'] = 1; |
|
298 | - $defaults['max_member'] = $defaults['max_student']; |
|
297 | + $defaults['max_member_no_limit'] = 1; |
|
298 | + $defaults['max_member'] = $defaults['max_student']; |
|
299 | 299 | } |
300 | 300 | $form->setDefaults($defaults); |
301 | 301 | $form->display(); |
@@ -89,7 +89,7 @@ |
||
89 | 89 | 'error' |
90 | 90 | ) |
91 | 91 | ); |
92 | - exit; |
|
92 | + exit; |
|
93 | 93 | } else { |
94 | 94 | /* DOWNLOAD THE FILE */ |
95 | 95 | // the user is allowed to download the file |
@@ -33,21 +33,21 @@ discard block |
||
33 | 33 | $thisIsAMailing = false; |
34 | 34 | $thisIsJustUpload = false; |
35 | 35 | |
36 | - foreach ($_POST['recipients'] as $rec) { |
|
36 | + foreach ($_POST['recipients'] as $rec) { |
|
37 | 37 | if ($rec == 'mailing') { |
38 | - $thisIsAMailing = true; |
|
38 | + $thisIsAMailing = true; |
|
39 | 39 | } elseif ($rec == 'upload') { |
40 | - $thisIsJustUpload = true; |
|
40 | + $thisIsJustUpload = true; |
|
41 | 41 | } elseif (strpos($rec, 'user_') === 0 && !isCourseMember(substr($rec, strlen('user_')))) { |
42 | - echo '401'; |
|
43 | - die(get_lang('BadFormData').' (code 401)'); |
|
44 | - } elseif (strpos($rec, 'group_') !== 0 && strpos($rec, 'user_') !== 0) { |
|
45 | - echo '402'; |
|
46 | - die(get_lang('BadFormData').' (code 402)'); |
|
47 | - } |
|
42 | + echo '401'; |
|
43 | + die(get_lang('BadFormData').' (code 401)'); |
|
44 | + } elseif (strpos($rec, 'group_') !== 0 && strpos($rec, 'user_') !== 0) { |
|
45 | + echo '402'; |
|
46 | + die(get_lang('BadFormData').' (code 402)'); |
|
47 | + } |
|
48 | 48 | } |
49 | 49 | |
50 | - // we are doing a mailing but an additional recipient is selected |
|
50 | + // we are doing a mailing but an additional recipient is selected |
|
51 | 51 | if ($thisIsAMailing && ( count($_POST['recipients']) != 1)) { |
52 | 52 | $error = true; |
53 | 53 | $errormsg = get_lang('MailingSelectNoOther'); |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
65 | - //check if $_POST['cb_overwrite'] is true or false |
|
66 | - $dropbox_overwrite = false; |
|
67 | - if (isset($_POST['cb_overwrite']) && $_POST['cb_overwrite']) { |
|
68 | - $dropbox_overwrite = true; |
|
69 | - } |
|
65 | + //check if $_POST['cb_overwrite'] is true or false |
|
66 | + $dropbox_overwrite = false; |
|
67 | + if (isset($_POST['cb_overwrite']) && $_POST['cb_overwrite']) { |
|
68 | + $dropbox_overwrite = true; |
|
69 | + } |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * FORM SUBMIT : UPLOAD NEW FILE |
@@ -168,13 +168,13 @@ discard block |
||
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
171 | - // After uploading the file, create the db entries |
|
171 | + // After uploading the file, create the db entries |
|
172 | 172 | |
173 | - if (!$error) { |
|
174 | - @move_uploaded_file($dropbox_filetmpname, dropbox_cnf('sysPath') . '/' . $dropbox_filename) |
|
175 | - or die(get_lang('UploadError').' (code 407)'); |
|
176 | - new Dropbox_SentWork($_user['user_id'], $dropbox_title, $_POST['description'], strip_tags($_POST['authors']), $dropbox_filename, $dropbox_filesize, $newWorkRecipients); |
|
177 | - } |
|
173 | + if (!$error) { |
|
174 | + @move_uploaded_file($dropbox_filetmpname, dropbox_cnf('sysPath') . '/' . $dropbox_filename) |
|
175 | + or die(get_lang('UploadError').' (code 407)'); |
|
176 | + new Dropbox_SentWork($_user['user_id'], $dropbox_title, $_POST['description'], strip_tags($_POST['authors']), $dropbox_filename, $dropbox_filesize, $newWorkRecipients); |
|
177 | + } |
|
178 | 178 | } |
179 | 179 | } |
180 | 180 | } //end if(!$error) |
@@ -183,9 +183,9 @@ discard block |
||
183 | 183 | * SUBMIT FORM RESULTMESSAGE |
184 | 184 | */ |
185 | 185 | if (!$error) { |
186 | - $return_message = get_lang('FileUploadSucces'); |
|
186 | + $return_message = get_lang('FileUploadSucces'); |
|
187 | 187 | } else { |
188 | - $return_message = $errormsg; |
|
188 | + $return_message = $errormsg; |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | |
@@ -199,25 +199,25 @@ discard block |
||
199 | 199 | */ |
200 | 200 | if (isset($_GET['deleteReceived']) || isset($_GET['deleteSent']) |
201 | 201 | || isset( $_GET['showFeedback']) || isset( $_GET['editFeedback'])) { |
202 | - if ($_GET['mailing']) { |
|
203 | - getUserOwningThisMailing($_GET['mailing'], $_user['user_id'], '408'); |
|
204 | - $dropbox_person = new Dropbox_Person($_GET['mailing'], $is_courseAdmin, $is_courseTutor); |
|
205 | - } else { |
|
206 | - $dropbox_person = new Dropbox_Person($_user['user_id'], $is_courseAdmin, $is_courseTutor); |
|
202 | + if ($_GET['mailing']) { |
|
203 | + getUserOwningThisMailing($_GET['mailing'], $_user['user_id'], '408'); |
|
204 | + $dropbox_person = new Dropbox_Person($_GET['mailing'], $is_courseAdmin, $is_courseTutor); |
|
205 | + } else { |
|
206 | + $dropbox_person = new Dropbox_Person($_user['user_id'], $is_courseAdmin, $is_courseTutor); |
|
207 | 207 | } |
208 | 208 | |
209 | - if (isset($_SESSION['sentOrder'])) { |
|
210 | - $dropbox_person->orderSentWork($_SESSION['sentOrder']); |
|
211 | - } |
|
212 | - if (isset($_SESSION['receivedOrder'])) { |
|
213 | - $dropbox_person->orderReceivedWork($_SESSION['receivedOrder']); |
|
214 | - } |
|
209 | + if (isset($_SESSION['sentOrder'])) { |
|
210 | + $dropbox_person->orderSentWork($_SESSION['sentOrder']); |
|
211 | + } |
|
212 | + if (isset($_SESSION['receivedOrder'])) { |
|
213 | + $dropbox_person->orderReceivedWork($_SESSION['receivedOrder']); |
|
214 | + } |
|
215 | 215 | |
216 | - /*if (!$dropbox_person->isCourseAdmin || ! $dropbox_person->isCourseTutor) { |
|
216 | + /*if (!$dropbox_person->isCourseAdmin || ! $dropbox_person->isCourseTutor) { |
|
217 | 217 | die(get_lang('GeneralError').' (code 408)'); |
218 | 218 | }*/ |
219 | 219 | |
220 | - $tellUser = get_lang('FileDeleted'); |
|
220 | + $tellUser = get_lang('FileDeleted'); |
|
221 | 221 | |
222 | 222 | if (isset($_GET['deleteReceived'])) { |
223 | 223 | if ($_GET['deleteReceived'] == 'all') { |
@@ -236,20 +236,20 @@ discard block |
||
236 | 236 | die(get_lang('GeneralError').' (code 410)'); |
237 | 237 | } |
238 | 238 | } elseif (isset($_GET['showFeedback'])) { |
239 | - $w = new Dropbox_SentWork($id = $_GET['showFeedback']); |
|
239 | + $w = new Dropbox_SentWork($id = $_GET['showFeedback']); |
|
240 | 240 | |
241 | - if ($w->uploader_id != $_user['user_id']) { |
|
242 | - getUserOwningThisMailing($w->uploader_id, $_user['user_id'], '411'); |
|
243 | - } |
|
241 | + if ($w->uploader_id != $_user['user_id']) { |
|
242 | + getUserOwningThisMailing($w->uploader_id, $_user['user_id'], '411'); |
|
243 | + } |
|
244 | 244 | |
245 | - foreach ($w -> recipients as $r) { |
|
246 | - if (($fb = $r['feedback'])) { |
|
247 | - $fbarray[$r['feedback_date'].$r['name']] = $r['name'].' '.get_lang('SentOn', '').' '.$r['feedback_date'].":\n".$fb; |
|
248 | - } |
|
249 | - } |
|
245 | + foreach ($w -> recipients as $r) { |
|
246 | + if (($fb = $r['feedback'])) { |
|
247 | + $fbarray[$r['feedback_date'].$r['name']] = $r['name'].' '.get_lang('SentOn', '').' '.$r['feedback_date'].":\n".$fb; |
|
248 | + } |
|
249 | + } |
|
250 | 250 | |
251 | - if ($fbarray) { |
|
252 | - krsort($fbarray); |
|
251 | + if ($fbarray) { |
|
252 | + krsort($fbarray); |
|
253 | 253 | echo '<textarea class="dropbox_feedbacks">', |
254 | 254 | htmlspecialchars(implode("\n\n", $fbarray), ENT_QUOTES, api_get_system_encoding()), '</textarea>', "\n"; |
255 | 255 | } else { |
@@ -261,13 +261,13 @@ discard block |
||
261 | 261 | } else { // if ( isset( $_GET['editFeedback'])) { |
262 | 262 | $id = $_GET['editFeedback']; |
263 | 263 | $found = false; |
264 | - foreach ($dropbox_person->receivedWork as $w) { |
|
265 | - if ($w->id == $id) { |
|
266 | - $found = true; |
|
267 | - break; |
|
268 | - } |
|
269 | - } |
|
270 | - if (!$found) die(get_lang('GeneralError').' (code 415)'); |
|
264 | + foreach ($dropbox_person->receivedWork as $w) { |
|
265 | + if ($w->id == $id) { |
|
266 | + $found = true; |
|
267 | + break; |
|
268 | + } |
|
269 | + } |
|
270 | + if (!$found) die(get_lang('GeneralError').' (code 415)'); |
|
271 | 271 | |
272 | 272 | echo '<form method="post" action="index.php">', "\n", |
273 | 273 | '<input type="hidden" name="feedbackid" value="', |
@@ -83,11 +83,11 @@ |
||
83 | 83 | if (strstr($_POST['action'], 'move_')) { |
84 | 84 | // check move_received_n or move_sent_n command |
85 | 85 | if (strstr($_POST['action'], 'received')) { |
86 | - $part = 'received'; |
|
87 | - $to_cat_id = str_replace('move_received_', '', $_POST['action']); |
|
86 | + $part = 'received'; |
|
87 | + $to_cat_id = str_replace('move_received_', '', $_POST['action']); |
|
88 | 88 | } else { |
89 | - $part = 'sent'; |
|
90 | - $to_cat_id = str_replace('move_sent_', '', $_POST['action']); |
|
89 | + $part = 'sent'; |
|
90 | + $to_cat_id = str_replace('move_sent_', '', $_POST['action']); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | foreach ($checked_file_ids as $value) { |