@@ -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 |
@@ -12,7 +12,7 @@ |
||
12 | 12 | |
13 | 13 | require_once '../inc/global.inc.php'; |
14 | 14 | $this_section = SECTION_COURSES; |
15 | -$current_course_tool = TOOL_GROUP; |
|
15 | +$current_course_tool = TOOL_GROUP; |
|
16 | 16 | |
17 | 17 | // Notice for unauthorized people. |
18 | 18 | api_protect_course_script(true); |
@@ -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;"'); |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | require '../inc/global.inc.php'; |
15 | 15 | $this_section = SECTION_COURSES; |
16 | -$current_course_tool = TOOL_GROUP; |
|
16 | +$current_course_tool = TOOL_GROUP; |
|
17 | 17 | |
18 | 18 | // Notice for unauthorized people. |
19 | 19 | api_protect_course_script(true); |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | $current_group = GroupManager :: get_group_properties($group_id); |
23 | 23 | |
24 | 24 | $nameTools = get_lang('EditGroup'); |
25 | -$interbreadcrumb[] = array ('url' => 'group.php?'.api_get_cidreq(), 'name' => get_lang('Groups')); |
|
26 | -$interbreadcrumb[] = array ('url' => 'group_space.php?'.api_get_cidreq(), 'name' => $current_group['name']); |
|
25 | +$interbreadcrumb[] = array('url' => 'group.php?'.api_get_cidreq(), 'name' => get_lang('Groups')); |
|
26 | +$interbreadcrumb[] = array('url' => 'group_space.php?'.api_get_cidreq(), 'name' => $current_group['name']); |
|
27 | 27 | |
28 | 28 | $is_group_member = GroupManager :: is_tutor_of_group(api_get_user_id(), $group_id); |
29 | 29 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | return true; |
105 | 105 | } |
106 | 106 | if (isset($value['max_member']) && isset($value['group_members']) && $value['max_member'] < count($value['group_members'])) { |
107 | - return array ('group_members' => get_lang('GroupTooMuchMembers')); |
|
107 | + return array('group_members' => get_lang('GroupTooMuchMembers')); |
|
108 | 108 | } |
109 | 109 | return true; |
110 | 110 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $form->addText('name', get_lang('GroupName')); |
131 | 131 | |
132 | 132 | // Description |
133 | -$form->addElement('textarea', 'description', get_lang('Description'), array ('rows' => 6)); |
|
133 | +$form->addElement('textarea', 'description', get_lang('Description'), array('rows' => 6)); |
|
134 | 134 | |
135 | 135 | $complete_user_list = GroupManager :: fill_groups_list($current_group['id']); |
136 | 136 | usort($complete_user_list, 'sort_users'); |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | // Group members |
154 | 154 | $group_member_list = GroupManager :: get_subscribed_users($current_group['id']); |
155 | 155 | |
156 | -$selected_users = array (); |
|
156 | +$selected_users = array(); |
|
157 | 157 | foreach ($group_member_list as $index => $user) { |
158 | 158 | $selected_users[] = $user['user_id']; |
159 | 159 | } |
@@ -183,42 +183,42 @@ discard block |
||
183 | 183 | $form->createElement('checkbox', 'self_registration_allowed', get_lang('GroupSelfRegistration'), get_lang('GroupAllowStudentRegistration'), 1), |
184 | 184 | $form->createElement('checkbox', 'self_unregistration_allowed', null, get_lang('GroupAllowStudentUnregistration'), 1) |
185 | 185 | ); |
186 | -$form->addGroup($group, '', Display::return_icon('user.png', get_lang('GroupSelfRegistration') , array(), ICON_SIZE_SMALL).' '.get_lang('GroupSelfRegistration'), '', false); |
|
186 | +$form->addGroup($group, '', Display::return_icon('user.png', get_lang('GroupSelfRegistration'), array(), ICON_SIZE_SMALL).' '.get_lang('GroupSelfRegistration'), '', false); |
|
187 | 187 | |
188 | 188 | // Documents settings |
189 | 189 | $group = array(); |
190 | 190 | $group[] = $form->createElement('radio', 'doc_state', get_lang('GroupDocument'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE); |
191 | 191 | $group[] = $form->createElement('radio', 'doc_state', null, get_lang('Public'), GroupManager::TOOL_PUBLIC); |
192 | 192 | $group[] = $form->createElement('radio', 'doc_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE); |
193 | -$form->addGroup($group, '', Display::return_icon('folder.png', get_lang('GroupDocument') , array(), ICON_SIZE_SMALL).' '.get_lang('GroupDocument'), '', false); |
|
193 | +$form->addGroup($group, '', Display::return_icon('folder.png', get_lang('GroupDocument'), array(), ICON_SIZE_SMALL).' '.get_lang('GroupDocument'), '', false); |
|
194 | 194 | |
195 | 195 | // Work settings |
196 | 196 | $group = array(); |
197 | 197 | $group[] = $form->createElement('radio', 'work_state', get_lang('GroupWork'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE); |
198 | 198 | $group[] = $form->createElement('radio', 'work_state', null, get_lang('Public'), GroupManager::TOOL_PUBLIC); |
199 | 199 | $group[] = $form->createElement('radio', 'work_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE); |
200 | -$form->addGroup($group, '', Display::return_icon('work.png', get_lang('GroupWork') , array(), ICON_SIZE_SMALL).' '.get_lang('GroupWork'), '', false); |
|
200 | +$form->addGroup($group, '', Display::return_icon('work.png', get_lang('GroupWork'), array(), ICON_SIZE_SMALL).' '.get_lang('GroupWork'), '', false); |
|
201 | 201 | |
202 | 202 | // Calendar settings |
203 | 203 | $group = array(); |
204 | 204 | $group[] = $form->createElement('radio', 'calendar_state', get_lang('GroupCalendar'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE); |
205 | 205 | $group[] = $form->createElement('radio', 'calendar_state', null, get_lang('Public'), GroupManager::TOOL_PUBLIC); |
206 | 206 | $group[] = $form->createElement('radio', 'calendar_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE); |
207 | -$form->addGroup($group, '', Display::return_icon('agenda.png', get_lang('GroupCalendar') , array(), ICON_SIZE_SMALL).' '.get_lang('GroupCalendar'), '', false); |
|
207 | +$form->addGroup($group, '', Display::return_icon('agenda.png', get_lang('GroupCalendar'), array(), ICON_SIZE_SMALL).' '.get_lang('GroupCalendar'), '', false); |
|
208 | 208 | |
209 | 209 | // Announcements settings |
210 | 210 | $group = array(); |
211 | 211 | $group[] = $form->createElement('radio', 'announcements_state', get_lang('GroupAnnouncements'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE); |
212 | 212 | $group[] = $form->createElement('radio', 'announcements_state', null, get_lang('Public'), GroupManager::TOOL_PUBLIC); |
213 | 213 | $group[] = $form->createElement('radio', 'announcements_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE); |
214 | -$form->addGroup($group, '', Display::return_icon('announce.png', get_lang('GroupAnnouncements') , array(), ICON_SIZE_SMALL).' '.get_lang('GroupAnnouncements'), '', false); |
|
214 | +$form->addGroup($group, '', Display::return_icon('announce.png', get_lang('GroupAnnouncements'), array(), ICON_SIZE_SMALL).' '.get_lang('GroupAnnouncements'), '', false); |
|
215 | 215 | |
216 | 216 | //Forum settings |
217 | 217 | $group = array(); |
218 | 218 | $group[] = $form->createElement('radio', 'forum_state', get_lang('GroupForum'), get_lang('NotAvailable'), GroupManager::TOOL_NOT_AVAILABLE); |
219 | 219 | $group[] = $form->createElement('radio', 'forum_state', null, get_lang('Public'), GroupManager::TOOL_PUBLIC); |
220 | 220 | $group[] = $form->createElement('radio', 'forum_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE); |
221 | -$form->addGroup($group, '', Display::return_icon('forum.png', get_lang('GroupForum') , array(), ICON_SIZE_SMALL).' '.get_lang('GroupForum'), '', false); |
|
221 | +$form->addGroup($group, '', Display::return_icon('forum.png', get_lang('GroupForum'), array(), ICON_SIZE_SMALL).' '.get_lang('GroupForum'), '', false); |
|
222 | 222 | |
223 | 223 | // Wiki settings |
224 | 224 | $group = array( |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | $form->createElement('radio', 'wiki_state', null, get_lang('Public'), GroupManager::TOOL_PUBLIC), |
227 | 227 | $form->createElement('radio', 'wiki_state', null, get_lang('Private'), GroupManager::TOOL_PRIVATE) |
228 | 228 | ); |
229 | -$form->addGroup($group, '', Display::return_icon('wiki.png', get_lang('GroupWiki') , array(), ICON_SIZE_SMALL).' '.get_lang('GroupWiki'), '', false); |
|
229 | +$form->addGroup($group, '', Display::return_icon('wiki.png', get_lang('GroupWiki'), array(), ICON_SIZE_SMALL).' '.get_lang('GroupWiki'), '', false); |
|
230 | 230 | |
231 | 231 | // Chat settings |
232 | 232 | $group = array( |
@@ -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(); |
@@ -7,12 +7,12 @@ discard block |
||
7 | 7 | |
8 | 8 | require_once '../inc/global.inc.php'; |
9 | 9 | $this_section = SECTION_COURSES; |
10 | -$current_course_tool = TOOL_GROUP; |
|
10 | +$current_course_tool = TOOL_GROUP; |
|
11 | 11 | |
12 | 12 | // Notice for unauthorized people. |
13 | 13 | api_protect_course_script(true); |
14 | 14 | |
15 | -if (!api_is_allowed_to_edit(false,true) || |
|
15 | +if (!api_is_allowed_to_edit(false, true) || |
|
16 | 16 | !(isset ($_GET['id']) || |
17 | 17 | isset ($_POST['id']) || |
18 | 18 | isset ($_GET['action']) || |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | 'groups_per_user' => 1, |
60 | 60 | 'doc_state' => GroupManager::TOOL_PRIVATE, |
61 | 61 | 'work_state' => GroupManager::TOOL_PRIVATE, |
62 | - 'wiki_state' => GroupManager::TOOL_PRIVATE , |
|
62 | + 'wiki_state' => GroupManager::TOOL_PRIVATE, |
|
63 | 63 | 'chat_state' => GroupManager::TOOL_PRIVATE, |
64 | 64 | 'calendar_state' => GroupManager::TOOL_PRIVATE, |
65 | 65 | 'announcements_state'=> GroupManager::TOOL_PRIVATE, |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | // Groups per user |
115 | 115 | $possible_values = array(); |
116 | - for ($i = 1; $i <= 10; $i ++) { |
|
116 | + for ($i = 1; $i <= 10; $i++) { |
|
117 | 117 | $possible_values[$i] = $i; |
118 | 118 | } |
119 | 119 | $possible_values[GroupManager::GROUP_PER_MEMBER_NO_LIMIT] = get_lang('All'); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | $form->addElement('html', '<div class="col-md-6">'); |
140 | 140 | // Description |
141 | - $form->addElement('textarea', 'description', get_lang('Description'), array ('rows' => 6)); |
|
141 | + $form->addElement('textarea', 'description', get_lang('Description'), array('rows' => 6)); |
|
142 | 142 | $form->addElement('html', '</div>'); |
143 | 143 | $form->addElement('html', '</div>'); |
144 | 144 | } else { |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | // actions bar |
287 | 287 | echo '<div class="actions">'; |
288 | 288 | echo '<a href="group.php">'. |
289 | - Display::return_icon('back.png', get_lang('BackToGroupList'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
289 | + Display::return_icon('back.png', get_lang('BackToGroupList'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
290 | 290 | echo '</div>'; |
291 | 291 | |
292 | 292 | $defaults = $category; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | require_once '../inc/global.inc.php'; |
15 | 15 | $this_section = SECTION_COURSES; |
16 | -$current_course_tool = TOOL_GROUP; |
|
16 | +$current_course_tool = TOOL_GROUP; |
|
17 | 17 | |
18 | 18 | // Notice for unauthorized people. |
19 | 19 | api_protect_course_script(true); |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | // Group members |
163 | 163 | $group_member_list = GroupManager::get_subscribed_users($current_group['id']); |
164 | 164 | |
165 | -$selected_users = array (); |
|
165 | +$selected_users = array(); |
|
166 | 166 | if (!empty($group_member_list)) { |
167 | 167 | foreach ($group_member_list as $index => $user) { |
168 | 168 | $selected_users[] = $user['user_id']; |
@@ -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 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | ON (post.file_id = file.id AND post.c_id = $course_id AND file.c_id = $course_id) |
51 | 51 | WHERE |
52 | 52 | post.cat_id = ".intval($_GET['cat_id'])." AND |
53 | - post.dest_user_id = $user_id" ; |
|
53 | + post.dest_user_id = $user_id"; |
|
54 | 54 | } |
55 | 55 | $files_to_download = array(); |
56 | 56 | $result = Database::query($sql); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $_SESSION['_seen'][$_course['id']][TOOL_DROPBOX][] = intval($_GET['id']); |
97 | 97 | |
98 | 98 | $work = new Dropbox_Work($_GET['id']); |
99 | - $path = dropbox_cnf('sysPath') . '/' . $work -> filename; //path to file as stored on server |
|
99 | + $path = dropbox_cnf('sysPath').'/'.$work -> filename; //path to file as stored on server |
|
100 | 100 | |
101 | 101 | if (!Security::check_abs_path($path, dropbox_cnf('sysPath').'/')) { |
102 | 102 | exit; |
@@ -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="', |
@@ -267,7 +267,9 @@ |
||
267 | 267 | break; |
268 | 268 | } |
269 | 269 | } |
270 | - if (!$found) die(get_lang('GeneralError').' (code 415)'); |
|
270 | + if (!$found) { |
|
271 | + die(get_lang('GeneralError').' (code 415)'); |
|
272 | + } |
|
271 | 273 | |
272 | 274 | echo '<form method="post" action="index.php">', "\n", |
273 | 275 | '<input type="hidden" name="feedbackid" value="', |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | */ |
24 | 24 | |
25 | 25 | // the author or description field is empty |
26 | - if (!isset($_POST['authors']) || !isset( $_POST['description'])) { |
|
26 | + if (!isset($_POST['authors']) || !isset($_POST['description'])) { |
|
27 | 27 | $error = true; |
28 | 28 | $errormsg = get_lang('BadFormData'); |
29 | - } elseif (!isset( $_POST['recipients']) || count( $_POST['recipients']) <= 0) { |
|
29 | + } elseif (!isset($_POST['recipients']) || count($_POST['recipients']) <= 0) { |
|
30 | 30 | $error = true; |
31 | 31 | $errormsg = get_lang('NoUserSelected'); |
32 | 32 | } else { |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | // we are doing a mailing but an additional recipient is selected |
51 | - if ($thisIsAMailing && ( count($_POST['recipients']) != 1)) { |
|
51 | + if ($thisIsAMailing && (count($_POST['recipients']) != 1)) { |
|
52 | 52 | $error = true; |
53 | 53 | $errormsg = get_lang('MailingSelectNoOther'); |
54 | 54 | } |
55 | 55 | // we are doing a just upload but an additional recipient is selected. |
56 | - elseif ( $thisIsJustUpload && ( count($_POST['recipients']) != 1)) { |
|
56 | + elseif ($thisIsJustUpload && (count($_POST['recipients']) != 1)) { |
|
57 | 57 | $error = true; |
58 | 58 | $errormsg = get_lang('MailingJustUploadSelectNoOther'); |
59 | 59 | } elseif (empty($_FILES['file']['name'])) { |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | } else { |
127 | 127 | // rename file to login_filename_uniqueId format |
128 | - $dropbox_filename = getLoginFromId( $_user['user_id']) . '_' . $dropbox_filename . '_'.uniqid(''); |
|
128 | + $dropbox_filename = getLoginFromId($_user['user_id']).'_'.$dropbox_filename.'_'.uniqid(''); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | if (!is_dir(dropbox_cnf('sysPath'))) { |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $newWorkRecipients = dropbox_cnf('mailingIdBase'); |
148 | 148 | } else { |
149 | 149 | $error = true; |
150 | - $errormsg = $dropbox_title . ': ' . get_lang('MailingWrongZipfile'); |
|
150 | + $errormsg = $dropbox_title.': '.get_lang('MailingWrongZipfile'); |
|
151 | 151 | } |
152 | 152 | } elseif ($thisIsJustUpload) { |
153 | 153 | $newWorkRecipients = array(); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | // After uploading the file, create the db entries |
172 | 172 | |
173 | 173 | if (!$error) { |
174 | - @move_uploaded_file($dropbox_filetmpname, dropbox_cnf('sysPath') . '/' . $dropbox_filename) |
|
174 | + @move_uploaded_file($dropbox_filetmpname, dropbox_cnf('sysPath').'/'.$dropbox_filename) |
|
175 | 175 | or die(get_lang('UploadError').' (code 407)'); |
176 | 176 | new Dropbox_SentWork($_user['user_id'], $dropbox_title, $_POST['description'], strip_tags($_POST['authors']), $dropbox_filename, $dropbox_filesize, $newWorkRecipients); |
177 | 177 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * - EDIT FEEDBACK |
199 | 199 | */ |
200 | 200 | if (isset($_GET['deleteReceived']) || isset($_GET['deleteSent']) |
201 | - || isset( $_GET['showFeedback']) || isset( $_GET['editFeedback'])) { |
|
201 | + || isset($_GET['showFeedback']) || isset($_GET['editFeedback'])) { |
|
202 | 202 | if ($_GET['mailing']) { |
203 | 203 | getUserOwningThisMailing($_GET['mailing'], $_user['user_id'], '408'); |
204 | 204 | $dropbox_person = new Dropbox_Person($_GET['mailing'], $is_courseAdmin, $is_courseTutor); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | if ($_GET['deleteReceived'] == 'all') { |
224 | 224 | $dropbox_person->deleteAllReceivedWork(); |
225 | 225 | } elseif (is_numeric($_GET['deleteReceived'])) { |
226 | - $dropbox_person->deleteReceivedWork( $_GET['deleteReceived']); |
|
226 | + $dropbox_person->deleteReceivedWork($_GET['deleteReceived']); |
|
227 | 227 | } else { |
228 | 228 | die(get_lang('GeneralError').' (code 409)'); |
229 | 229 | } |
@@ -18,8 +18,8 @@ discard block |
||
18 | 18 | */ |
19 | 19 | $dropbox_cnf['courseId'] = $_cid; |
20 | 20 | //path to dropbox subdir in course containing the uploaded files |
21 | -$dropbox_cnf['sysPath'] = api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/dropbox'; |
|
22 | -$dropbox_cnf['webPath'] = api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/dropbox'; |
|
21 | +$dropbox_cnf['sysPath'] = api_get_path(SYS_COURSE_PATH).$_course['path'].'/dropbox'; |
|
22 | +$dropbox_cnf['webPath'] = api_get_path(WEB_COURSE_PATH).$_course['path'].'/dropbox'; |
|
23 | 23 | |
24 | 24 | //file size limit as imposed by the platform admin (see Chamilo Config Settings on the platform administration section) |
25 | 25 | $dropbox_cnf['maxFilesize'] = api_get_setting('dropbox_max_filesize'); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | // false = no mailing functionality |
35 | 35 | $dropbox_cnf['allowMailing'] = api_string_2_boolean(api_get_setting('dropbox_allow_mailing')); |
36 | -$dropbox_cnf['mailingIdBase'] = 10000000; // bigger than any user_id, |
|
36 | +$dropbox_cnf['mailingIdBase'] = 10000000; // bigger than any user_id, |
|
37 | 37 | // allowing enough space for pseudo_ids as uploader_id, dest_user_id, user_id: |
38 | 38 | // mailing pseudo_id = dropbox_cnf('mailingIdBase') + mailing id |
39 | 39 | $dropbox_cnf['mailingZipRegexp'] = '/^(.*)(STUDENTID|USERID|LOGINNAME)(.*)\.ZIP$/i'; |
@@ -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) { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | // STEP 2: at least one file has to be selected. If not we return an error message |
43 | 43 | $ids = isset($_GET['id']) ? $_GET['id'] : array(); |
44 | - if (count($ids)>0) { |
|
44 | + if (count($ids) > 0) { |
|
45 | 45 | $checked_file_ids = $_POST['id']; |
46 | 46 | } else { |
47 | 47 | foreach ($_POST as $key => $value) { |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | $cat = get_dropbox_category($id); |
136 | - if (count($cat)==0) { |
|
136 | + if (count($cat) == 0) { |
|
137 | 137 | return false; |
138 | 138 | } |
139 | 139 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | WHERE c_id = $course_id AND cat_id='".intval($id)."'"; |
167 | 167 | $result = Database::query($sql); |
168 | 168 | |
169 | - while($row = Database::fetch_array($result)) { |
|
169 | + while ($row = Database::fetch_array($result)) { |
|
170 | 170 | $dropboxfile = new Dropbox_Person($user_id, $is_courseAdmin, $is_courseTutor); |
171 | 171 | if ($action == 'deletereceivedcategory') { |
172 | 172 | $dropboxfile->deleteReceivedWork($row[$id_field]); |
@@ -657,7 +657,7 @@ discard block |
||
657 | 657 | |
658 | 658 | $full_name = $userInfo['complete_name'].$groupNameListToString; |
659 | 659 | $current_user_id = $current_user['user_id']; |
660 | - $options['user_' . $current_user_id] = $full_name; |
|
660 | + $options['user_'.$current_user_id] = $full_name; |
|
661 | 661 | } |
662 | 662 | } |
663 | 663 | } |
@@ -706,11 +706,11 @@ discard block |
||
706 | 706 | |
707 | 707 | $mailingId = $id - dropbox_cnf('mailingIdBase'); |
708 | 708 | if ($mailingId > 0) { |
709 | - return get_lang('MailingAsUsername', '') . $mailingId; |
|
709 | + return get_lang('MailingAsUsername', '').$mailingId; |
|
710 | 710 | } |
711 | 711 | $id = intval($id); |
712 | 712 | $sql = "SELECT ".(api_is_western_name_order() ? "CONCAT(firstname,' ', lastname)" : "CONCAT(lastname,' ', firstname)")." AS name |
713 | - FROM " . $dropbox_cnf['tbl_user'] . " |
|
713 | + FROM " . $dropbox_cnf['tbl_user']." |
|
714 | 714 | WHERE user_id='$id'"; |
715 | 715 | $result = Database::query($sql); |
716 | 716 | $res = Database::fetch_array($result); |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | { |
731 | 731 | $id = intval($id); |
732 | 732 | $sql = "SELECT username |
733 | - FROM " . dropbox_cnf('tbl_user') . " |
|
733 | + FROM " . dropbox_cnf('tbl_user')." |
|
734 | 734 | WHERE user_id='$id'"; |
735 | 735 | $result = Database::query($sql); |
736 | 736 | $res = Database::fetch_array($result); |
@@ -762,8 +762,8 @@ discard block |
||
762 | 762 | |
763 | 763 | // select all files that aren't referenced anymore |
764 | 764 | $sql = "SELECT DISTINCT f.id, f.filename |
765 | - FROM " . dropbox_cnf('tbl_file') . " f |
|
766 | - LEFT JOIN " . dropbox_cnf('tbl_person') . " p |
|
765 | + FROM " . dropbox_cnf('tbl_file')." f |
|
766 | + LEFT JOIN " . dropbox_cnf('tbl_person')." p |
|
767 | 767 | ON (f.id = p.file_id) |
768 | 768 | WHERE p.user_id IS NULL AND |
769 | 769 | f.c_id = $course_id |
@@ -771,14 +771,14 @@ discard block |
||
771 | 771 | $result = Database::query($sql); |
772 | 772 | while ($res = Database::fetch_array($result)) { |
773 | 773 | //delete the selected files from the post and file tables |
774 | - $sql = "DELETE FROM " . dropbox_cnf('tbl_post') . " |
|
775 | - WHERE c_id = $course_id AND file_id = '" . $res['id'] . "'"; |
|
774 | + $sql = "DELETE FROM ".dropbox_cnf('tbl_post')." |
|
775 | + WHERE c_id = $course_id AND file_id = '".$res['id']."'"; |
|
776 | 776 | Database::query($sql); |
777 | - $sql = "DELETE FROM " . dropbox_cnf('tbl_file') . " |
|
778 | - WHERE c_id = $course_id AND id ='" . $res['id'] . "'"; |
|
777 | + $sql = "DELETE FROM ".dropbox_cnf('tbl_file')." |
|
778 | + WHERE c_id = $course_id AND id ='".$res['id']."'"; |
|
779 | 779 | Database::query($sql); |
780 | 780 | //delete file from server |
781 | - @unlink( dropbox_cnf('sysPath') . '/' . $res['filename']); |
|
781 | + @unlink(dropbox_cnf('sysPath').'/'.$res['filename']); |
|
782 | 782 | } |
783 | 783 | } |
784 | 784 | |
@@ -801,11 +801,11 @@ discard block |
||
801 | 801 | |
802 | 802 | $mailingPseudoId = intval($mailingPseudoId); |
803 | 803 | $sql = "SELECT f.uploader_id |
804 | - FROM " . $dropbox_cnf['tbl_file'] . " f |
|
805 | - LEFT JOIN " . $dropbox_cnf['tbl_post'] . " p |
|
804 | + FROM " . $dropbox_cnf['tbl_file']." f |
|
805 | + LEFT JOIN " . $dropbox_cnf['tbl_post']." p |
|
806 | 806 | ON (f.id = p.file_id AND f.c_id = $course_id AND p.c_id = $course_id) |
807 | 807 | WHERE |
808 | - p.dest_user_id = '" . $mailingPseudoId . "' AND |
|
808 | + p.dest_user_id = '".$mailingPseudoId."' AND |
|
809 | 809 | p.c_id = $course_id |
810 | 810 | "; |
811 | 811 | $result = Database::query($sql); |
@@ -832,20 +832,20 @@ discard block |
||
832 | 832 | // for all content files, replace mailingPseudoId by owner as uploader |
833 | 833 | $file_id = intval($file_id); |
834 | 834 | $sql = "SELECT p.dest_user_id |
835 | - FROM " . $dropbox_cnf['tbl_post'] . " p |
|
836 | - WHERE c_id = $course_id AND p.file_id = '" . $file_id . "'"; |
|
835 | + FROM " . $dropbox_cnf['tbl_post']." p |
|
836 | + WHERE c_id = $course_id AND p.file_id = '".$file_id."'"; |
|
837 | 837 | $result = Database::query($sql); |
838 | 838 | |
839 | 839 | if ($res = Database::fetch_array($result)) { |
840 | 840 | $mailingPseudoId = $res['dest_user_id']; |
841 | 841 | if ($mailingPseudoId > dropbox_cnf('mailingIdBase')) { |
842 | - $sql = "DELETE FROM " . dropbox_cnf('tbl_person') . " |
|
843 | - WHERE c_id = $course_id AND user_id='" . $mailingPseudoId . "'"; |
|
842 | + $sql = "DELETE FROM ".dropbox_cnf('tbl_person')." |
|
843 | + WHERE c_id = $course_id AND user_id='".$mailingPseudoId."'"; |
|
844 | 844 | Database::query($sql); |
845 | 845 | |
846 | - $sql = "UPDATE " . dropbox_cnf('tbl_file') ." |
|
847 | - SET uploader_id='" . api_get_user_id() . "' |
|
848 | - WHERE c_id = $course_id AND uploader_id='" . $mailingPseudoId . "'"; |
|
846 | + $sql = "UPDATE ".dropbox_cnf('tbl_file')." |
|
847 | + SET uploader_id='" . api_get_user_id()."' |
|
848 | + WHERE c_id = $course_id AND uploader_id='".$mailingPseudoId."'"; |
|
849 | 849 | Database::query($sql); |
850 | 850 | } |
851 | 851 | } |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | } |
985 | 985 | } |
986 | 986 | } else { // rename file to login_filename_uniqueId format |
987 | - $dropbox_filename = getLoginFromId($_user['user_id']) . "_" . $dropbox_filename . "_".uniqid(''); |
|
987 | + $dropbox_filename = getLoginFromId($_user['user_id'])."_".$dropbox_filename."_".uniqid(''); |
|
988 | 988 | } |
989 | 989 | |
990 | 990 | // creating the array that contains all the users who will receive the file |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | } |
1003 | 1003 | } |
1004 | 1004 | |
1005 | - @move_uploaded_file($dropbox_filetmpname, dropbox_cnf('sysPath') . '/' . $dropbox_filename); |
|
1005 | + @move_uploaded_file($dropbox_filetmpname, dropbox_cnf('sysPath').'/'.$dropbox_filename); |
|
1006 | 1006 | |
1007 | 1007 | $b_send_mail = api_get_course_setting('email_alert_on_new_doc_dropbox'); |
1008 | 1008 | |
@@ -1023,14 +1023,14 @@ discard block |
||
1023 | 1023 | ), |
1024 | 1024 | $recipent_temp['email'], |
1025 | 1025 | get_lang('NewDropboxFileUploaded'), |
1026 | - get_lang('NewDropboxFileUploadedContent').' <a href="'.api_get_path(WEB_CODE_PATH).'dropbox/index.php?' . api_get_cidreq() . '">'.get_lang('SeeFile').'</a>'. |
|
1026 | + get_lang('NewDropboxFileUploadedContent').' <a href="'.api_get_path(WEB_CODE_PATH).'dropbox/index.php?'.api_get_cidreq().'">'.get_lang('SeeFile').'</a>'. |
|
1027 | 1027 | "\n\n". |
1028 | 1028 | api_get_person_name( |
1029 | 1029 | $_user['firstName'], |
1030 | 1030 | $_user['lastName'], |
1031 | 1031 | null, |
1032 | 1032 | PERSON_NAME_EMAIL_ADDRESS |
1033 | - )."\n". get_lang('Email') ." : ".$_user['mail'], |
|
1033 | + )."\n".get_lang('Email')." : ".$_user['mail'], |
|
1034 | 1034 | api_get_person_name( |
1035 | 1035 | $_user['firstName'], |
1036 | 1036 | $_user['lastName'], |
@@ -1308,7 +1308,7 @@ discard block |
||
1308 | 1308 | // Adding the content. |
1309 | 1309 | $return .= "\n<tr>"; |
1310 | 1310 | foreach ($column as $column_key => $column_value) { |
1311 | - if (!in_array($column_value,$dont_show_columns)) { |
|
1311 | + if (!in_array($column_value, $dont_show_columns)) { |
|
1312 | 1312 | $return .= "\n\t<td>"; |
1313 | 1313 | if (in_array($column_value, $make_link)) { |
1314 | 1314 | $return .= '<a href="'.$value[$column_value].'">'.$value[$column_value].'</a>'; |
@@ -1341,7 +1341,7 @@ discard block |
||
1341 | 1341 | WHERE c_id = $course_id GROUP BY file_id"; |
1342 | 1342 | $result = Database::query($sql); |
1343 | 1343 | $return = array(); |
1344 | - while ($row=Database::fetch_array($result)) { |
|
1344 | + while ($row = Database::fetch_array($result)) { |
|
1345 | 1345 | $return[$row['file_id']] = $row['total']; |
1346 | 1346 | } |
1347 | 1347 | return $return; |
@@ -734,7 +734,9 @@ discard block |
||
734 | 734 | WHERE user_id='$id'"; |
735 | 735 | $result = Database::query($sql); |
736 | 736 | $res = Database::fetch_array($result); |
737 | - if (!$res) return false; |
|
737 | + if (!$res) { |
|
738 | + return false; |
|
739 | + } |
|
738 | 740 | |
739 | 741 | return stripslashes($res['username']); |
740 | 742 | } |
@@ -810,10 +812,15 @@ discard block |
||
810 | 812 | "; |
811 | 813 | $result = Database::query($sql); |
812 | 814 | |
813 | - if (!($res = Database::fetch_array($result))) |
|
814 | - die(get_lang('GeneralError').' (code 901)'); |
|
815 | - if ($owner == 0) return $res['uploader_id']; |
|
816 | - if ($res['uploader_id'] == $owner) return true; |
|
815 | + if (!($res = Database::fetch_array($result))) { |
|
816 | + die(get_lang('GeneralError').' (code 901)'); |
|
817 | + } |
|
818 | + if ($owner == 0) { |
|
819 | + return $res['uploader_id']; |
|
820 | + } |
|
821 | + if ($res['uploader_id'] == $owner) { |
|
822 | + return true; |
|
823 | + } |
|
817 | 824 | die(get_lang('GeneralError').' (code '.$or_die.')'); |
818 | 825 | } |
819 | 826 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | /** |
24 | 24 | * This function is a wrapper function for the multiple actions feature. |
25 | -* @return Mixed If there is a problem, return a string message, otherwise nothing |
|
25 | +* @return string|null If there is a problem, return a string message, otherwise nothing |
|
26 | 26 | * @author Patrick Cool <[email protected]>, Ghent University |
27 | 27 | * @version march 2006 |
28 | 28 | */ |
@@ -209,9 +209,9 @@ discard block |
||
209 | 209 | * |
210 | 210 | * @param $id the id of the file we are moving |
211 | 211 | * @param $target the id of the folder we are moving to |
212 | -* @param $part are we moving a received file or a sent file? |
|
212 | +* @param string $part are we moving a received file or a sent file? |
|
213 | 213 | * |
214 | -* @return language string |
|
214 | +* @return string string |
|
215 | 215 | * |
216 | 216 | * @author Patrick Cool <[email protected]>, Ghent University |
217 | 217 | * @version march 2006 |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | * @param $id the unique id of the file |
291 | 291 | * @param $part are we dealing with a sent or with a received file? |
292 | 292 | * |
293 | -* @return html code |
|
293 | +* @return string code |
|
294 | 294 | * |
295 | 295 | * @author Patrick Cool <[email protected]>, Ghent University |
296 | 296 | * @version march 2006 |
@@ -786,6 +786,7 @@ discard block |
||
786 | 786 | } |
787 | 787 | |
788 | 788 | /** |
789 | +* @param string $user_id |
|
789 | 790 | * @return boolean indicating if user with user_id=$user_id is a course member |
790 | 791 | * @todo check if this function is still necessary. There might be a library function for this. |
791 | 792 | */ |
@@ -1147,7 +1148,7 @@ discard block |
||
1147 | 1148 | /** |
1148 | 1149 | * This function returns the html code to display the feedback messages on a given dropbox file |
1149 | 1150 | * @param $feedback_array an array that contains all the feedback messages about the given document. |
1150 | -* @return html code |
|
1151 | +* @return string code |
|
1151 | 1152 | * @todo add the form for adding new comment (if the other party has not deleted it yet). |
1152 | 1153 | * |
1153 | 1154 | * @author Patrick Cool <[email protected]>, Ghent University |
@@ -1164,7 +1165,7 @@ discard block |
||
1164 | 1165 | |
1165 | 1166 | /** |
1166 | 1167 | * this function returns the code for the form for adding a new feedback message to a dropbox file. |
1167 | -* @return html code |
|
1168 | +* @return string code |
|
1168 | 1169 | * |
1169 | 1170 | * @author Patrick Cool <[email protected]>, Ghent University |
1170 | 1171 | * @version march 2006 |
@@ -1225,7 +1226,7 @@ discard block |
||
1225 | 1226 | } |
1226 | 1227 | |
1227 | 1228 | /** |
1228 | -* @return a language string (depending on the success or failure. |
|
1229 | +* @return string language string (depending on the success or failure. |
|
1229 | 1230 | * |
1230 | 1231 | * @author Patrick Cool <[email protected]>, Ghent University |
1231 | 1232 | * @version march 2006 |
@@ -390,7 +390,7 @@ |
||
390 | 390 | * |
391 | 391 | */ |
392 | 392 | public function thematic_advance($action) |
393 | - { |
|
393 | + { |
|
394 | 394 | $thematic = new Thematic(); |
395 | 395 | $attendance = new Attendance(); |
396 | 396 | $data = array(); |
@@ -201,20 +201,20 @@ discard block |
||
201 | 201 | $plan_html = null; |
202 | 202 | if (!empty($data)) { |
203 | 203 | foreach ($data as $plan) { |
204 | - $plan_html .= '<strong>' . $plan['title'] . '</strong><br /> ' . $plan['description'] . '<br />'; |
|
204 | + $plan_html .= '<strong>'.$plan['title'].'</strong><br /> '.$plan['description'].'<br />'; |
|
205 | 205 | } |
206 | 206 | } |
207 | 207 | $data = $thematic->get_thematic_advance_by_thematic_id($theme['id']); |
208 | 208 | $advance_html = null; |
209 | 209 | if (!empty($data)) { |
210 | 210 | foreach ($data as $advance) { |
211 | - $advance_html .= api_convert_and_format_date($advance['start_date'], DATE_FORMAT_LONG) . ' ('.$advance['duration'].' '.get_lang('HourShort').')<br />'.$advance['content'].'<br />'; |
|
211 | + $advance_html .= api_convert_and_format_date($advance['start_date'], DATE_FORMAT_LONG).' ('.$advance['duration'].' '.get_lang('HourShort').')<br />'.$advance['content'].'<br />'; |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | $table[] = array($theme['title'], $plan_html, $advance_html); |
215 | 215 | } |
216 | 216 | $params = array( |
217 | - 'filename' => get_lang('Thematic') . '-' . api_get_local_time(), |
|
217 | + 'filename' => get_lang('Thematic').'-'.api_get_local_time(), |
|
218 | 218 | 'pdf_title' => get_lang('Thematic'), |
219 | 219 | 'add_signatures' => true, |
220 | 220 | 'format' => 'A4-L', |
@@ -311,9 +311,9 @@ discard block |
||
311 | 311 | unset($_SESSION['thematic_plan_token']); |
312 | 312 | $data['message'] = 'ok'; |
313 | 313 | |
314 | - $saveRedirect = api_get_path(WEB_PATH) . 'main/course_progress/index.php?'; |
|
315 | - $saveRedirect.= api_get_cidreq() . '&'; |
|
316 | - $saveRedirect.= 'thematic_plan_save_message=ok'; |
|
314 | + $saveRedirect = api_get_path(WEB_PATH).'main/course_progress/index.php?'; |
|
315 | + $saveRedirect .= api_get_cidreq().'&'; |
|
316 | + $saveRedirect .= 'thematic_plan_save_message=ok'; |
|
317 | 317 | |
318 | 318 | header("Location: $saveRedirect"); |
319 | 319 | exit; |