@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | */ |
16 | 16 | require_once '../inc/global.inc.php'; |
17 | 17 | $this_section = SECTION_COURSES; |
18 | -$current_course_tool = TOOL_GROUP; |
|
18 | +$current_course_tool = TOOL_GROUP; |
|
19 | 19 | |
20 | 20 | // Notice for unauthorized people. |
21 | 21 | api_protect_course_script(true); |
@@ -85,29 +85,29 @@ discard block |
||
85 | 85 | Display::return_icon('add.png', get_lang('NewGroupCreate'), '', ICON_SIZE_MEDIUM).'</a>'; |
86 | 86 | |
87 | 87 | if (api_get_setting('allow_group_categories') == 'true') { |
88 | - $actions.= '<a href="group_category.php?'.api_get_cidreq().'&action=add_category">'. |
|
88 | + $actions .= '<a href="group_category.php?'.api_get_cidreq().'&action=add_category">'. |
|
89 | 89 | Display::return_icon('new_folder.png', get_lang('AddCategory'), '', ICON_SIZE_MEDIUM).'</a>'; |
90 | 90 | } else { |
91 | - $actions.= '<a href="group_category.php?'.api_get_cidreq().'&id=2">'. |
|
91 | + $actions .= '<a href="group_category.php?'.api_get_cidreq().'&id=2">'. |
|
92 | 92 | Display::return_icon('settings.png', get_lang('PropModify'), '', ICON_SIZE_MEDIUM).'</a>'; |
93 | 93 | } |
94 | - $actions.= '<a href="import.php?'.api_get_cidreq().'&action=import">'. |
|
94 | + $actions .= '<a href="import.php?'.api_get_cidreq().'&action=import">'. |
|
95 | 95 | Display::return_icon('import_csv.png', get_lang('Import'), '', ICON_SIZE_MEDIUM).'</a>'; |
96 | 96 | |
97 | - $actions.= '<a href="group_overview.php?'.api_get_cidreq().'&action=export_all&type=csv">'. |
|
97 | + $actions .= '<a href="group_overview.php?'.api_get_cidreq().'&action=export_all&type=csv">'. |
|
98 | 98 | Display::return_icon('export_csv.png', get_lang('Export'), '', ICON_SIZE_MEDIUM).'</a>'; |
99 | 99 | |
100 | - $actions.= '<a href="group_overview.php?'.api_get_cidreq().'&action=export&type=xls">'. |
|
100 | + $actions .= '<a href="group_overview.php?'.api_get_cidreq().'&action=export&type=xls">'. |
|
101 | 101 | Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a>'; |
102 | 102 | |
103 | - $actions.= '<a href="group_overview.php?'.api_get_cidreq().'&action=export_pdf">'. |
|
103 | + $actions .= '<a href="group_overview.php?'.api_get_cidreq().'&action=export_pdf">'. |
|
104 | 104 | Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a>'; |
105 | 105 | |
106 | - $actions.= '<a href="group.php?'.api_get_cidreq().'">'. |
|
107 | - Display::return_icon('group.png', get_lang('Groups'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
106 | + $actions .= '<a href="group.php?'.api_get_cidreq().'">'. |
|
107 | + Display::return_icon('group.png', get_lang('Groups'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
108 | 108 | |
109 | 109 | |
110 | - $actions.= '<a href="../user/user.php?'.api_get_cidreq().'">'. |
|
110 | + $actions .= '<a href="../user/user.php?'.api_get_cidreq().'">'. |
|
111 | 111 | Display::return_icon('user.png', get_lang('GoTo').' '.get_lang('Users'), '', ICON_SIZE_MEDIUM).'</a>'; |
112 | 112 | |
113 | 113 | // Action links |
@@ -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 @@ discard block |
||
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); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $form->addGroup( |
82 | 82 | $group, |
83 | 83 | '', |
84 | - Display::return_icon('user.png', get_lang('GroupSelfRegistration')) . '<span>' . get_lang('GroupSelfRegistration') . '</span>', |
|
84 | + Display::return_icon('user.png', get_lang('GroupSelfRegistration')).'<span>'.get_lang('GroupSelfRegistration').'</span>', |
|
85 | 85 | null, |
86 | 86 | false |
87 | 87 | ); |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $form->addGroup( |
96 | 96 | $group, |
97 | 97 | '', |
98 | - Display::return_icon('folder.png', get_lang('GroupDocument')) . '<span>' . get_lang('GroupDocument') . '</span>', |
|
98 | + Display::return_icon('folder.png', get_lang('GroupDocument')).'<span>'.get_lang('GroupDocument').'</span>', |
|
99 | 99 | null, |
100 | 100 | false |
101 | 101 | ); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $form->addGroup( |
110 | 110 | $group, |
111 | 111 | '', |
112 | - Display::return_icon('works.png', get_lang('GroupWork')) . '<span>' . get_lang('GroupWork') . '</span>', |
|
112 | + Display::return_icon('works.png', get_lang('GroupWork')).'<span>'.get_lang('GroupWork').'</span>', |
|
113 | 113 | null, |
114 | 114 | false |
115 | 115 | ); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $form->addGroup( |
124 | 124 | $group, |
125 | 125 | '', |
126 | - Display::return_icon('agenda.png', get_lang('GroupCalendar')) . '<span>' . get_lang('GroupCalendar') . '</span>', |
|
126 | + Display::return_icon('agenda.png', get_lang('GroupCalendar')).'<span>'.get_lang('GroupCalendar').'</span>', |
|
127 | 127 | null, |
128 | 128 | false |
129 | 129 | ); |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | $form->addGroup( |
141 | 141 | $group, |
142 | 142 | '', |
143 | - Display::return_icon('announce.png', get_lang('GroupAnnouncements')) . '<span>' . get_lang('GroupAnnouncements') . '</span>', |
|
143 | + Display::return_icon('announce.png', get_lang('GroupAnnouncements')).'<span>'.get_lang('GroupAnnouncements').'</span>', |
|
144 | 144 | null, |
145 | 145 | false |
146 | 146 | ); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $form->addGroup( |
155 | 155 | $group, |
156 | 156 | '', |
157 | - Display::return_icon('forum.png', get_lang('GroupForum')) . '<span>' . get_lang('GroupForum') . '</span>', |
|
157 | + Display::return_icon('forum.png', get_lang('GroupForum')).'<span>'.get_lang('GroupForum').'</span>', |
|
158 | 158 | null, |
159 | 159 | false |
160 | 160 | ); |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $form->addGroup( |
182 | 182 | $group, |
183 | 183 | '', |
184 | - Display::return_icon('chat.png', get_lang('Chat')) . '<span>' . get_lang('Chat') . '</span>', |
|
184 | + Display::return_icon('chat.png', get_lang('Chat')).'<span>'.get_lang('Chat').'</span>', |
|
185 | 185 | null, |
186 | 186 | false |
187 | 187 | ); |
@@ -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_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); |
@@ -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'); |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | // Group members |
160 | 160 | $group_member_list = GroupManager :: get_subscribed_users($current_group['id']); |
161 | 161 | |
162 | -$selected_users = array (); |
|
162 | +$selected_users = array(); |
|
163 | 163 | foreach ($group_member_list as $index => $user) { |
164 | 164 | $selected_users[] = $user['user_id']; |
165 | 165 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $form->addGroup( |
199 | 199 | $group, |
200 | 200 | '', |
201 | - Display::return_icon('user.png', get_lang('GroupSelfRegistration')) . ' ' . get_lang('GroupSelfRegistration'), |
|
201 | + Display::return_icon('user.png', get_lang('GroupSelfRegistration')).' '.get_lang('GroupSelfRegistration'), |
|
202 | 202 | null, |
203 | 203 | false |
204 | 204 | ); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | $form->addGroup( |
225 | 225 | $group, |
226 | 226 | '', |
227 | - Display::return_icon('work.png', get_lang('GroupWork')) . ' ' . get_lang('GroupWork'), |
|
227 | + Display::return_icon('work.png', get_lang('GroupWork')).' '.get_lang('GroupWork'), |
|
228 | 228 | null, |
229 | 229 | false |
230 | 230 | ); |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | $form->addGroup( |
238 | 238 | $group, |
239 | 239 | '', |
240 | - Display::return_icon('agenda.png', get_lang('GroupCalendar')) . ' ' . get_lang('GroupCalendar'), |
|
240 | + Display::return_icon('agenda.png', get_lang('GroupCalendar')).' '.get_lang('GroupCalendar'), |
|
241 | 241 | null, |
242 | 242 | false |
243 | 243 | ); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $form->addGroup( |
251 | 251 | $group, |
252 | 252 | '', |
253 | - Display::return_icon('announce.png', get_lang('GroupAnnouncements')) . ' ' . get_lang('GroupAnnouncements'), |
|
253 | + Display::return_icon('announce.png', get_lang('GroupAnnouncements')).' '.get_lang('GroupAnnouncements'), |
|
254 | 254 | null, |
255 | 255 | false |
256 | 256 | ); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | $form->addGroup( |
264 | 264 | $group, |
265 | 265 | '', |
266 | - Display::return_icon('forum.png', get_lang('GroupForum')) . ' ' . get_lang('GroupForum'), |
|
266 | + Display::return_icon('forum.png', get_lang('GroupForum')).' '.get_lang('GroupForum'), |
|
267 | 267 | null, |
268 | 268 | false |
269 | 269 | ); |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | $form->addGroup( |
278 | 278 | $group, |
279 | 279 | '', |
280 | - Display::return_icon('wiki.png', get_lang('GroupWiki')) . ' ' . get_lang('GroupWiki'), |
|
280 | + Display::return_icon('wiki.png', get_lang('GroupWiki')).' '.get_lang('GroupWiki'), |
|
281 | 281 | null, |
282 | 282 | false |
283 | 283 | ); |
@@ -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 { |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $form->addGroup( |
159 | 159 | $group, |
160 | 160 | '', |
161 | - Display::return_icon('user.png', get_lang('GroupSelfRegistration')) . ' ' . get_lang('GroupSelfRegistration'), |
|
161 | + Display::return_icon('user.png', get_lang('GroupSelfRegistration')).' '.get_lang('GroupSelfRegistration'), |
|
162 | 162 | null, |
163 | 163 | false |
164 | 164 | ); |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $form->addGroup( |
173 | 173 | $group, |
174 | 174 | '', |
175 | - Display::return_icon('folder.png', get_lang('GroupDocument')) . ' ' . get_lang('GroupDocument'), |
|
175 | + Display::return_icon('folder.png', get_lang('GroupDocument')).' '.get_lang('GroupDocument'), |
|
176 | 176 | null, |
177 | 177 | false |
178 | 178 | ); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $form->addGroup( |
187 | 187 | $group, |
188 | 188 | '', |
189 | - Display::return_icon('work.png', get_lang('GroupWork'), array(), ICON_SIZE_SMALL) . ' ' . get_lang('GroupWork'), |
|
189 | + Display::return_icon('work.png', get_lang('GroupWork'), array(), ICON_SIZE_SMALL).' '.get_lang('GroupWork'), |
|
190 | 190 | '', |
191 | 191 | false); |
192 | 192 | |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $form->addGroup( |
200 | 200 | $group, |
201 | 201 | '', |
202 | - Display::return_icon('agenda.png', get_lang('GroupCalendar')) . ' ' . get_lang('GroupCalendar'), |
|
202 | + Display::return_icon('agenda.png', get_lang('GroupCalendar')).' '.get_lang('GroupCalendar'), |
|
203 | 203 | null, |
204 | 204 | false |
205 | 205 | ); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $form->addGroup( |
217 | 217 | $group, |
218 | 218 | '', |
219 | - Display::return_icon('announce.png', get_lang('GroupAnnouncements')) . ' ' . get_lang('GroupAnnouncements'), |
|
219 | + Display::return_icon('announce.png', get_lang('GroupAnnouncements')).' '.get_lang('GroupAnnouncements'), |
|
220 | 220 | null, |
221 | 221 | false |
222 | 222 | ); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $form->addGroup( |
231 | 231 | $group, |
232 | 232 | '', |
233 | - Display::return_icon('forum.png', get_lang('GroupForum')) . ' ' . get_lang('GroupForum'), |
|
233 | + Display::return_icon('forum.png', get_lang('GroupForum')).' '.get_lang('GroupForum'), |
|
234 | 234 | null, |
235 | 235 | false |
236 | 236 | ); |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | $form->addGroup( |
245 | 245 | $group, |
246 | 246 | '', |
247 | - Display::return_icon('wiki.png', get_lang('GroupWiki')) . ' ' . get_lang('GroupWiki'), |
|
247 | + Display::return_icon('wiki.png', get_lang('GroupWiki')).' '.get_lang('GroupWiki'), |
|
248 | 248 | null, |
249 | 249 | false |
250 | 250 | ); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | $form->addGroup( |
259 | 259 | $group, |
260 | 260 | '', |
261 | - Display::return_icon('chat.png', get_lang('Chat')) . ' ' . get_lang('Chat'), |
|
261 | + Display::return_icon('chat.png', get_lang('Chat')).' '.get_lang('Chat'), |
|
262 | 262 | null, |
263 | 263 | false |
264 | 264 | ); |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | // actions bar |
334 | 334 | echo '<div class="actions">'; |
335 | 335 | echo '<a href="group.php">'. |
336 | - Display::return_icon('back.png', get_lang('BackToGroupList'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
336 | + Display::return_icon('back.png', get_lang('BackToGroupList'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
337 | 337 | echo '</div>'; |
338 | 338 | |
339 | 339 | $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; |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $action = isset($_GET['action']) ? $_GET['action'] : null; |
185 | 185 | |
186 | 186 | // Do some sanity checks |
187 | - $id = intval($id); |
|
187 | + $id = intval($id); |
|
188 | 188 | |
189 | 189 | // Get the data from DB |
190 | 190 | $sql = "SELECT uploader_id, filename, filesize, title, description, author, upload_date, last_upload_date, cat_id |
@@ -226,14 +226,14 @@ discard block |
||
226 | 226 | $row_feedback['feedback'] = Security::remove_XSS($row_feedback['feedback']); |
227 | 227 | $feedback2[] = $row_feedback; |
228 | 228 | } |
229 | - $this->feedback2= $feedback2; |
|
229 | + $this->feedback2 = $feedback2; |
|
230 | 230 | } |
231 | 231 | } |
232 | 232 | } |
233 | 233 | |
234 | 234 | class Dropbox_SentWork extends Dropbox_Work |
235 | 235 | { |
236 | - public $recipients; //array of ['id']['name'] arrays |
|
236 | + public $recipients; //array of ['id']['name'] arrays |
|
237 | 237 | |
238 | 238 | /** |
239 | 239 | * Constructor calls private functions to create a new work or retreive an existing work from DB |
@@ -290,15 +290,15 @@ discard block |
||
290 | 290 | settype($uploader_id, 'integer') or die(get_lang('GeneralError').' (code 208)'); // Set $uploader_id to correct type |
291 | 291 | |
292 | 292 | $justSubmit = false; |
293 | - if ( is_int($recipient_ids)) { |
|
293 | + if (is_int($recipient_ids)) { |
|
294 | 294 | $justSubmit = true; |
295 | 295 | $recipient_ids = array($recipient_ids + $this->id); |
296 | - } elseif ( count($recipient_ids) == 0) { |
|
296 | + } elseif (count($recipient_ids) == 0) { |
|
297 | 297 | $justSubmit = true; |
298 | 298 | $recipient_ids = array($uploader_id); |
299 | 299 | } |
300 | 300 | |
301 | - if (! is_array($recipient_ids) || count($recipient_ids) == 0) { |
|
301 | + if (!is_array($recipient_ids) || count($recipient_ids) == 0) { |
|
302 | 302 | die(get_lang('GeneralError').' (code 209)'); |
303 | 303 | } |
304 | 304 | |
@@ -313,11 +313,11 @@ discard block |
||
313 | 313 | $table_person = $dropbox_cnf['tbl_person']; |
314 | 314 | $session_id = api_get_session_id(); |
315 | 315 | $uploader_id = $this->uploader_id; |
316 | - $user = api_get_user_id(); |
|
316 | + $user = api_get_user_id(); |
|
317 | 317 | // Insert data in dropbox_post and dropbox_person table for each recipient |
318 | 318 | foreach ($this->recipients as $rec) { |
319 | - $file_id = (int)$this->id; |
|
320 | - $user_id = (int)$rec['id']; |
|
319 | + $file_id = (int) $this->id; |
|
320 | + $user_id = (int) $rec['id']; |
|
321 | 321 | $sql = "INSERT INTO $table_post (c_id, file_id, dest_user_id, session_id) |
322 | 322 | VALUES ($course_id, $file_id, $user_id, $session_id)"; |
323 | 323 | Database::query($sql); |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | |
334 | 334 | // Do not add recipient in person table if mailing zip or just upload. |
335 | 335 | if (!$justSubmit) { |
336 | - Database::query($sql); // If work already exists no error is generated |
|
336 | + Database::query($sql); // If work already exists no error is generated |
|
337 | 337 | } |
338 | 338 | } |
339 | 339 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | $ownerid = getUserOwningThisMailing($ownerid); |
343 | 343 | } |
344 | 344 | if (($recipid = $rec["id"]) > $dropbox_cnf['mailingIdBase']) { |
345 | - $recipid = $ownerid; // mailing file recipient = mailing id, not a person |
|
345 | + $recipid = $ownerid; // mailing file recipient = mailing id, not a person |
|
346 | 346 | } |
347 | 347 | api_item_property_update( |
348 | 348 | $_course, |
@@ -401,13 +401,13 @@ discard block |
||
401 | 401 | class Dropbox_Person |
402 | 402 | { |
403 | 403 | // The receivedWork and the sentWork arrays are sorted. |
404 | - public $receivedWork; // an array of Dropbox_Work objects |
|
405 | - public $sentWork; // an array of Dropbox_SentWork objects |
|
404 | + public $receivedWork; // an array of Dropbox_Work objects |
|
405 | + public $sentWork; // an array of Dropbox_SentWork objects |
|
406 | 406 | |
407 | 407 | public $userId = 0; |
408 | 408 | public $isCourseAdmin = false; |
409 | 409 | public $isCourseTutor = false; |
410 | - public $_orderBy = ''; // private property that determines by which field |
|
410 | + public $_orderBy = ''; // private property that determines by which field |
|
411 | 411 | |
412 | 412 | /** |
413 | 413 | * Constructor for recreating the Dropbox_Person object |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | */ |
507 | 507 | function orderSentWork($sort) |
508 | 508 | { |
509 | - switch($sort) { |
|
509 | + switch ($sort) { |
|
510 | 510 | case 'lastDate': |
511 | 511 | $this->_orderBy = 'last_upload_date'; |
512 | 512 | break; |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | */ |
540 | 540 | function orderReceivedWork($sort) |
541 | 541 | { |
542 | - switch($sort) { |
|
542 | + switch ($sort) { |
|
543 | 543 | case 'lastDate': |
544 | 544 | $this->_orderBy = 'last_upload_date'; |
545 | 545 | break; |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | $sql = "DELETE FROM ".$dropbox_cnf['tbl_person']." |
633 | 633 | WHERE c_id = $course_id AND user_id = '".$this->userId."' AND file_id ='".$id."'"; |
634 | 634 | Database::query($sql); |
635 | - removeUnusedFiles(); // Check for unused files |
|
635 | + removeUnusedFiles(); // Check for unused files |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | /** |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | Database::query($sql); |
650 | 650 | removeMoreIfMailing($w->id); |
651 | 651 | } |
652 | - removeUnusedFiles(); // Check for unused files |
|
652 | + removeUnusedFiles(); // Check for unused files |
|
653 | 653 | } |
654 | 654 | |
655 | 655 | /** |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | WHERE c_id = $course_id AND user_id='".$this->userId."' AND file_id='".$id."'"; |
684 | 684 | Database::query($sql); |
685 | 685 | removeMoreIfMailing($id); |
686 | - removeUnusedFiles(); // Check for unused files |
|
686 | + removeUnusedFiles(); // Check for unused files |
|
687 | 687 | } |
688 | 688 | |
689 | 689 | /** |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | $wi = -1; |
706 | 706 | foreach ($this->receivedWork as $w) { |
707 | 707 | $wi++; |
708 | - if ($w->id == $id){ |
|
708 | + if ($w->id == $id) { |
|
709 | 709 | $found = true; |
710 | 710 | break; |
711 | 711 | } // foreach (... as $wi -> $w) gives error 221! (no idea why...) |
@@ -303,7 +303,9 @@ discard block |
||
303 | 303 | } |
304 | 304 | |
305 | 305 | foreach ($recipient_ids as $rec) { |
306 | - if (empty($rec)) die(get_lang('GeneralError').' (code 210)'); |
|
306 | + if (empty($rec)) { |
|
307 | + die(get_lang('GeneralError').' (code 210)'); |
|
308 | + } |
|
307 | 309 | //if (!isCourseMember($rec)) die(); //cannot sent document to someone outside of course |
308 | 310 | //this check is done when validating submitted data |
309 | 311 | $this->recipients[] = array('id' => $rec, 'name' => getUserNameFromId($rec)); |
@@ -593,13 +595,19 @@ discard block |
||
593 | 595 | $id = intval($id); |
594 | 596 | $sql = "DELETE FROM ".$dropbox_cnf['tbl_file']." |
595 | 597 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
596 | - if (!Database::query($sql)) return false; |
|
598 | + if (!Database::query($sql)) { |
|
599 | + return false; |
|
600 | + } |
|
597 | 601 | $sql = "DELETE FROM ".$dropbox_cnf['tbl_category']." |
598 | 602 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
599 | - if (!Database::query($sql)) return false; |
|
603 | + if (!Database::query($sql)) { |
|
604 | + return false; |
|
605 | + } |
|
600 | 606 | $sql = "DELETE FROM ".$dropbox_cnf['tbl_post']." |
601 | 607 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
602 | - if (!Database::query($sql)) return false; |
|
608 | + if (!Database::query($sql)) { |
|
609 | + return false; |
|
610 | + } |
|
603 | 611 | return true; |
604 | 612 | } |
605 | 613 |
@@ -267,7 +267,7 @@ |
||
267 | 267 | * @param string $author |
268 | 268 | * @param string $filename |
269 | 269 | * @param int $filesize |
270 | - * @param array $recipient_ids |
|
270 | + * @param unknown_type|null $recipient_ids |
|
271 | 271 | */ |
272 | 272 | public function _createNewSentWork($uploader_id, $title, $description, $author, $filename, $filesize, $recipient_ids) |
273 | 273 | { |
@@ -78,20 +78,20 @@ discard block |
||
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | - /** |
|
82 | - * private function creating a new work object |
|
83 | - * |
|
84 | - * @param int $uploader_id |
|
85 | - * @param string $title |
|
86 | - * @param string $description |
|
87 | - * @param string $author |
|
88 | - * @param string $filename |
|
89 | - * @param int $filesize |
|
90 | - * |
|
91 | - * @todo $author was originally a field but this has now been replaced by the first and lastname of the uploader (to prevent anonymous uploads) |
|
92 | - * As a consequence this parameter can be removed |
|
93 | - */ |
|
94 | - public function _createNewWork($uploader_id, $title, $description, $author, $filename, $filesize) |
|
81 | + /** |
|
82 | + * private function creating a new work object |
|
83 | + * |
|
84 | + * @param int $uploader_id |
|
85 | + * @param string $title |
|
86 | + * @param string $description |
|
87 | + * @param string $author |
|
88 | + * @param string $filename |
|
89 | + * @param int $filesize |
|
90 | + * |
|
91 | + * @todo $author was originally a field but this has now been replaced by the first and lastname of the uploader (to prevent anonymous uploads) |
|
92 | + * As a consequence this parameter can be removed |
|
93 | + */ |
|
94 | + public function _createNewWork($uploader_id, $title, $description, $author, $filename, $filesize) |
|
95 | 95 | { |
96 | 96 | $dropbox_cnf = getDropboxConf(); |
97 | 97 | |
@@ -109,17 +109,17 @@ discard block |
||
109 | 109 | // Check if object exists already. If it does, the old object is used |
110 | 110 | // with updated information (authors, description, upload_date) |
111 | 111 | $this->isOldWork = false; |
112 | - $sql = "SELECT id, upload_date FROM ".$dropbox_cnf['tbl_file']." |
|
112 | + $sql = "SELECT id, upload_date FROM ".$dropbox_cnf['tbl_file']." |
|
113 | 113 | WHERE c_id = $course_id AND filename = '".Database::escape_string($this->filename)."'"; |
114 | 114 | $result = Database::query($sql); |
115 | - $res = Database::fetch_array($result); |
|
116 | - if ($res) { |
|
117 | - $this->isOldWork = true; |
|
118 | - } |
|
119 | - // Insert or update the dropbox_file table and set the id property |
|
120 | - if ($this->isOldWork) { |
|
121 | - $this->id = $res['id']; |
|
122 | - $this->upload_date = $res['upload_date']; |
|
115 | + $res = Database::fetch_array($result); |
|
116 | + if ($res) { |
|
117 | + $this->isOldWork = true; |
|
118 | + } |
|
119 | + // Insert or update the dropbox_file table and set the id property |
|
120 | + if ($this->isOldWork) { |
|
121 | + $this->id = $res['id']; |
|
122 | + $this->upload_date = $res['upload_date']; |
|
123 | 123 | |
124 | 124 | $params = [ |
125 | 125 | 'filesize' => $this->filesize, |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | ['c_id = ? AND id = ?' => [$course_id, $this->id]] |
137 | 137 | ); |
138 | 138 | |
139 | - } else { |
|
140 | - $this->upload_date = $this->last_upload_date; |
|
141 | - $params = [ |
|
139 | + } else { |
|
140 | + $this->upload_date = $this->last_upload_date; |
|
141 | + $params = [ |
|
142 | 142 | 'c_id' => $course_id, |
143 | 143 | 'uploader_id' => $this->uploader_id, |
144 | 144 | 'filename' => $this->filename, |
@@ -150,14 +150,14 @@ discard block |
||
150 | 150 | 'last_upload_date' => $this->last_upload_date, |
151 | 151 | 'session_id' => api_get_session_id(), |
152 | 152 | 'cat_id' => 0 |
153 | - ]; |
|
153 | + ]; |
|
154 | 154 | |
155 | - $this->id = Database::insert($dropbox_cnf['tbl_file'], $params); |
|
156 | - if ($this->id) { |
|
157 | - $sql = "UPDATE ".$dropbox_cnf['tbl_file']." SET id = iid WHERE iid = {$this->id}"; |
|
158 | - Database::query($sql); |
|
159 | - } |
|
160 | - } |
|
155 | + $this->id = Database::insert($dropbox_cnf['tbl_file'], $params); |
|
156 | + if ($this->id) { |
|
157 | + $sql = "UPDATE ".$dropbox_cnf['tbl_file']." SET id = iid WHERE iid = {$this->id}"; |
|
158 | + Database::query($sql); |
|
159 | + } |
|
160 | + } |
|
161 | 161 | |
162 | 162 | $sql = "SELECT count(file_id) as count |
163 | 163 | FROM ".$dropbox_cnf['tbl_person']." |
@@ -171,16 +171,16 @@ discard block |
||
171 | 171 | VALUES ($course_id, ".intval($this->id)." , ".intval($this->uploader_id).")"; |
172 | 172 | Database::query($sql); |
173 | 173 | } |
174 | - } |
|
175 | - |
|
176 | - /** |
|
177 | - * private function creating existing object by retreiving info from db |
|
178 | - * |
|
179 | - * @param int $id |
|
180 | - */ |
|
181 | - public function _createExistingWork($id) |
|
174 | + } |
|
175 | + |
|
176 | + /** |
|
177 | + * private function creating existing object by retreiving info from db |
|
178 | + * |
|
179 | + * @param int $id |
|
180 | + */ |
|
181 | + public function _createExistingWork($id) |
|
182 | 182 | { |
183 | - $course_id = api_get_course_int_id(); |
|
183 | + $course_id = api_get_course_int_id(); |
|
184 | 184 | $dropbox_cnf = getDropboxConf(); |
185 | 185 | |
186 | 186 | $action = isset($_GET['action']) ? $_GET['action'] : null; |
@@ -231,52 +231,52 @@ discard block |
||
231 | 231 | } |
232 | 232 | $this->feedback2= $feedback2; |
233 | 233 | } |
234 | - } |
|
234 | + } |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | class Dropbox_SentWork extends Dropbox_Work |
238 | 238 | { |
239 | - public $recipients; //array of ['id']['name'] arrays |
|
240 | - |
|
241 | - /** |
|
242 | - * Constructor calls private functions to create a new work or retreive an existing work from DB |
|
243 | - * depending on the number of parameters |
|
244 | - * |
|
245 | - * @param unknown_type $arg1 |
|
246 | - * @param unknown_type $arg2 |
|
247 | - * @param unknown_type $arg3 |
|
248 | - * @param unknown_type $arg4 |
|
249 | - * @param unknown_type $arg5 |
|
250 | - * @param unknown_type $arg6 |
|
251 | - * @param unknown_type $arg7 |
|
252 | - * @return Dropbox_SentWork |
|
253 | - */ |
|
254 | - public function __construct($arg1, $arg2 = null, $arg3 = null, $arg4 = null, $arg5 = null, $arg6 = null, $arg7 = null) |
|
239 | + public $recipients; //array of ['id']['name'] arrays |
|
240 | + |
|
241 | + /** |
|
242 | + * Constructor calls private functions to create a new work or retreive an existing work from DB |
|
243 | + * depending on the number of parameters |
|
244 | + * |
|
245 | + * @param unknown_type $arg1 |
|
246 | + * @param unknown_type $arg2 |
|
247 | + * @param unknown_type $arg3 |
|
248 | + * @param unknown_type $arg4 |
|
249 | + * @param unknown_type $arg5 |
|
250 | + * @param unknown_type $arg6 |
|
251 | + * @param unknown_type $arg7 |
|
252 | + * @return Dropbox_SentWork |
|
253 | + */ |
|
254 | + public function __construct($arg1, $arg2 = null, $arg3 = null, $arg4 = null, $arg5 = null, $arg6 = null, $arg7 = null) |
|
255 | 255 | { |
256 | - if (func_num_args() > 1) { |
|
257 | - $this->_createNewSentWork($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7); |
|
258 | - } else { |
|
259 | - $this->_createExistingSentWork($arg1); |
|
260 | - } |
|
261 | - } |
|
262 | - |
|
263 | - /** |
|
264 | - * private function creating a new SentWork object |
|
265 | - * |
|
266 | - * @param int $uploader_id |
|
267 | - * @param string $title |
|
268 | - * @param string $description |
|
269 | - * @param string $author |
|
270 | - * @param string $filename |
|
271 | - * @param int $filesize |
|
272 | - * @param array $recipient_ids |
|
273 | - */ |
|
274 | - public function _createNewSentWork($uploader_id, $title, $description, $author, $filename, $filesize, $recipient_ids) |
|
256 | + if (func_num_args() > 1) { |
|
257 | + $this->_createNewSentWork($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7); |
|
258 | + } else { |
|
259 | + $this->_createExistingSentWork($arg1); |
|
260 | + } |
|
261 | + } |
|
262 | + |
|
263 | + /** |
|
264 | + * private function creating a new SentWork object |
|
265 | + * |
|
266 | + * @param int $uploader_id |
|
267 | + * @param string $title |
|
268 | + * @param string $description |
|
269 | + * @param string $author |
|
270 | + * @param string $filename |
|
271 | + * @param int $filesize |
|
272 | + * @param array $recipient_ids |
|
273 | + */ |
|
274 | + public function _createNewSentWork($uploader_id, $title, $description, $author, $filename, $filesize, $recipient_ids) |
|
275 | 275 | { |
276 | 276 | $dropbox_cnf = getDropboxConf(); |
277 | 277 | $_course = api_get_course_info(); |
278 | 278 | |
279 | - // Call constructor of Dropbox_Work object |
|
279 | + // Call constructor of Dropbox_Work object |
|
280 | 280 | parent::__construct( |
281 | 281 | $uploader_id, |
282 | 282 | $title, |
@@ -286,31 +286,31 @@ discard block |
||
286 | 286 | $filesize |
287 | 287 | ); |
288 | 288 | |
289 | - $course_id = api_get_course_int_id(); |
|
290 | - |
|
291 | - // Do sanity checks on recipient_ids array & property fillin |
|
292 | - // The sanity check for ex-coursemembers is already done in base constructor |
|
293 | - settype($uploader_id, 'integer') or die(get_lang('GeneralError').' (code 208)'); // Set $uploader_id to correct type |
|
289 | + $course_id = api_get_course_int_id(); |
|
294 | 290 | |
295 | - $justSubmit = false; |
|
296 | - if ( is_int($recipient_ids)) { |
|
297 | - $justSubmit = true; |
|
298 | - $recipient_ids = array($recipient_ids + $this->id); |
|
299 | - } elseif ( count($recipient_ids) == 0) { |
|
300 | - $justSubmit = true; |
|
301 | - $recipient_ids = array($uploader_id); |
|
302 | - } |
|
291 | + // Do sanity checks on recipient_ids array & property fillin |
|
292 | + // The sanity check for ex-coursemembers is already done in base constructor |
|
293 | + settype($uploader_id, 'integer') or die(get_lang('GeneralError').' (code 208)'); // Set $uploader_id to correct type |
|
294 | + |
|
295 | + $justSubmit = false; |
|
296 | + if ( is_int($recipient_ids)) { |
|
297 | + $justSubmit = true; |
|
298 | + $recipient_ids = array($recipient_ids + $this->id); |
|
299 | + } elseif ( count($recipient_ids) == 0) { |
|
300 | + $justSubmit = true; |
|
301 | + $recipient_ids = array($uploader_id); |
|
302 | + } |
|
303 | 303 | |
304 | - if (! is_array($recipient_ids) || count($recipient_ids) == 0) { |
|
305 | - die(get_lang('GeneralError').' (code 209)'); |
|
306 | - } |
|
304 | + if (! is_array($recipient_ids) || count($recipient_ids) == 0) { |
|
305 | + die(get_lang('GeneralError').' (code 209)'); |
|
306 | + } |
|
307 | 307 | |
308 | - foreach ($recipient_ids as $rec) { |
|
309 | - if (empty($rec)) die(get_lang('GeneralError').' (code 210)'); |
|
310 | - //if (!isCourseMember($rec)) die(); //cannot sent document to someone outside of course |
|
311 | - //this check is done when validating submitted data |
|
312 | - $this->recipients[] = array('id' => $rec, 'name' => getUserNameFromId($rec)); |
|
313 | - } |
|
308 | + foreach ($recipient_ids as $rec) { |
|
309 | + if (empty($rec)) die(get_lang('GeneralError').' (code 210)'); |
|
310 | + //if (!isCourseMember($rec)) die(); //cannot sent document to someone outside of course |
|
311 | + //this check is done when validating submitted data |
|
312 | + $this->recipients[] = array('id' => $rec, 'name' => getUserNameFromId($rec)); |
|
313 | + } |
|
314 | 314 | |
315 | 315 | $table_post = $dropbox_cnf['tbl_post']; |
316 | 316 | $table_person = $dropbox_cnf['tbl_person']; |
@@ -319,13 +319,13 @@ discard block |
||
319 | 319 | $user = api_get_user_id(); |
320 | 320 | $now = api_get_utc_datetime(); |
321 | 321 | |
322 | - // Insert data in dropbox_post and dropbox_person table for each recipient |
|
323 | - foreach ($this->recipients as $rec) { |
|
322 | + // Insert data in dropbox_post and dropbox_person table for each recipient |
|
323 | + foreach ($this->recipients as $rec) { |
|
324 | 324 | $file_id = (int)$this->id; |
325 | 325 | $user_id = (int)$rec['id']; |
326 | - $sql = "INSERT INTO $table_post (c_id, file_id, dest_user_id, session_id, feedback_date, cat_id) |
|
326 | + $sql = "INSERT INTO $table_post (c_id, file_id, dest_user_id, session_id, feedback_date, cat_id) |
|
327 | 327 | VALUES ($course_id, $file_id, $user_id, $session_id, '$now', 0)"; |
328 | - Database::query($sql); |
|
328 | + Database::query($sql); |
|
329 | 329 | // If work already exists no error is generated |
330 | 330 | |
331 | 331 | /** |
@@ -342,13 +342,13 @@ discard block |
||
342 | 342 | } |
343 | 343 | } |
344 | 344 | |
345 | - // Update item_property table for each recipient |
|
346 | - if (($ownerid = $this->uploader_id) > $dropbox_cnf['mailingIdBase']) { |
|
347 | - $ownerid = getUserOwningThisMailing($ownerid); |
|
348 | - } |
|
349 | - if (($recipid = $rec["id"]) > $dropbox_cnf['mailingIdBase']) { |
|
350 | - $recipid = $ownerid; // mailing file recipient = mailing id, not a person |
|
351 | - } |
|
345 | + // Update item_property table for each recipient |
|
346 | + if (($ownerid = $this->uploader_id) > $dropbox_cnf['mailingIdBase']) { |
|
347 | + $ownerid = getUserOwningThisMailing($ownerid); |
|
348 | + } |
|
349 | + if (($recipid = $rec["id"]) > $dropbox_cnf['mailingIdBase']) { |
|
350 | + $recipid = $ownerid; // mailing file recipient = mailing id, not a person |
|
351 | + } |
|
352 | 352 | api_item_property_update( |
353 | 353 | $_course, |
354 | 354 | TOOL_DROPBOX, |
@@ -358,91 +358,91 @@ discard block |
||
358 | 358 | null, |
359 | 359 | $recipid |
360 | 360 | ); |
361 | - } |
|
362 | - } |
|
363 | - |
|
364 | - /** |
|
365 | - * private function creating existing object by retreiving info from db |
|
366 | - * |
|
367 | - * @param unknown_type $id |
|
368 | - */ |
|
369 | - public function _createExistingSentWork($id) |
|
361 | + } |
|
362 | + } |
|
363 | + |
|
364 | + /** |
|
365 | + * private function creating existing object by retreiving info from db |
|
366 | + * |
|
367 | + * @param unknown_type $id |
|
368 | + */ |
|
369 | + public function _createExistingSentWork($id) |
|
370 | 370 | { |
371 | 371 | $dropbox_cnf = getDropboxConf(); |
372 | 372 | $id = intval($id); |
373 | 373 | |
374 | - $course_id = api_get_course_int_id(); |
|
374 | + $course_id = api_get_course_int_id(); |
|
375 | 375 | |
376 | - // Call constructor of Dropbox_Work object |
|
377 | - parent::__construct($id); |
|
376 | + // Call constructor of Dropbox_Work object |
|
377 | + parent::__construct($id); |
|
378 | 378 | |
379 | - // Fill in recipients array |
|
380 | - $this->recipients = array(); |
|
381 | - $sql = "SELECT dest_user_id, feedback_date, feedback |
|
379 | + // Fill in recipients array |
|
380 | + $this->recipients = array(); |
|
381 | + $sql = "SELECT dest_user_id, feedback_date, feedback |
|
382 | 382 | FROM ".$dropbox_cnf['tbl_post']." |
383 | 383 | WHERE c_id = $course_id AND file_id = ".intval($id).""; |
384 | 384 | $result = Database::query($sql); |
385 | - while ($res = Database::fetch_array($result, 'ASSOC')) { |
|
386 | - // Check for deleted users |
|
387 | - $dest_user_id = $res['dest_user_id']; |
|
388 | - $user_info = api_get_user_info($dest_user_id); |
|
389 | - //$this->category = $res['cat_id']; |
|
390 | - if (!$user_info) { |
|
391 | - $this->recipients[] = array('id' => -1, 'name' => get_lang('Unknown', '')); |
|
392 | - } else { |
|
393 | - $this->recipients[] = array( |
|
385 | + while ($res = Database::fetch_array($result, 'ASSOC')) { |
|
386 | + // Check for deleted users |
|
387 | + $dest_user_id = $res['dest_user_id']; |
|
388 | + $user_info = api_get_user_info($dest_user_id); |
|
389 | + //$this->category = $res['cat_id']; |
|
390 | + if (!$user_info) { |
|
391 | + $this->recipients[] = array('id' => -1, 'name' => get_lang('Unknown', '')); |
|
392 | + } else { |
|
393 | + $this->recipients[] = array( |
|
394 | 394 | 'id' => $dest_user_id, |
395 | 395 | 'name' => $user_info['complete_name'], |
396 | 396 | 'user_id' => $dest_user_id, |
397 | - 'feedback_date' => $res['feedback_date'], |
|
397 | + 'feedback_date' => $res['feedback_date'], |
|
398 | 398 | 'feedback' => $res['feedback'] |
399 | 399 | ); |
400 | - } |
|
401 | - } |
|
402 | - } |
|
400 | + } |
|
401 | + } |
|
402 | + } |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | class Dropbox_Person |
406 | 406 | { |
407 | - // The receivedWork and the sentWork arrays are sorted. |
|
408 | - public $receivedWork; // an array of Dropbox_Work objects |
|
409 | - public $sentWork; // an array of Dropbox_SentWork objects |
|
410 | - |
|
411 | - public $userId = 0; |
|
412 | - public $isCourseAdmin = false; |
|
413 | - public $isCourseTutor = false; |
|
414 | - public $_orderBy = ''; // private property that determines by which field |
|
415 | - |
|
416 | - /** |
|
417 | - * Constructor for recreating the Dropbox_Person object |
|
418 | - * |
|
419 | - * @param int $userId |
|
420 | - * @param bool $isCourseAdmin |
|
421 | - * @param bool $isCourseTutor |
|
422 | - * @return Dropbox_Person |
|
423 | - */ |
|
424 | - public function __construct($userId, $isCourseAdmin, $isCourseTutor) |
|
407 | + // The receivedWork and the sentWork arrays are sorted. |
|
408 | + public $receivedWork; // an array of Dropbox_Work objects |
|
409 | + public $sentWork; // an array of Dropbox_SentWork objects |
|
410 | + |
|
411 | + public $userId = 0; |
|
412 | + public $isCourseAdmin = false; |
|
413 | + public $isCourseTutor = false; |
|
414 | + public $_orderBy = ''; // private property that determines by which field |
|
415 | + |
|
416 | + /** |
|
417 | + * Constructor for recreating the Dropbox_Person object |
|
418 | + * |
|
419 | + * @param int $userId |
|
420 | + * @param bool $isCourseAdmin |
|
421 | + * @param bool $isCourseTutor |
|
422 | + * @return Dropbox_Person |
|
423 | + */ |
|
424 | + public function __construct($userId, $isCourseAdmin, $isCourseTutor) |
|
425 | 425 | { |
426 | - $course_id = api_get_course_int_id(); |
|
426 | + $course_id = api_get_course_int_id(); |
|
427 | 427 | |
428 | - // Fill in properties |
|
428 | + // Fill in properties |
|
429 | 429 | $this->userId = $userId; |
430 | 430 | $this->isCourseAdmin = $isCourseAdmin; |
431 | 431 | $this->isCourseTutor = $isCourseTutor; |
432 | 432 | $this->receivedWork = array(); |
433 | 433 | $this->sentWork = array(); |
434 | 434 | |
435 | - // Note: perhaps include an ex coursemember check to delete old files |
|
435 | + // Note: perhaps include an ex coursemember check to delete old files |
|
436 | 436 | |
437 | - $session_id = api_get_session_id(); |
|
438 | - $condition_session = api_get_session_condition($session_id); |
|
437 | + $session_id = api_get_session_id(); |
|
438 | + $condition_session = api_get_session_condition($session_id); |
|
439 | 439 | |
440 | - $post_tbl = Database::get_course_table(TABLE_DROPBOX_POST); |
|
441 | - $person_tbl = Database::get_course_table(TABLE_DROPBOX_PERSON); |
|
442 | - $file_tbl = Database::get_course_table(TABLE_DROPBOX_FILE); |
|
440 | + $post_tbl = Database::get_course_table(TABLE_DROPBOX_POST); |
|
441 | + $person_tbl = Database::get_course_table(TABLE_DROPBOX_PERSON); |
|
442 | + $file_tbl = Database::get_course_table(TABLE_DROPBOX_FILE); |
|
443 | 443 | |
444 | 444 | // Find all entries where this person is the recipient |
445 | - $sql = "SELECT DISTINCT r.file_id, r.cat_id |
|
445 | + $sql = "SELECT DISTINCT r.file_id, r.cat_id |
|
446 | 446 | FROM $post_tbl r |
447 | 447 | INNER JOIN $person_tbl p |
448 | 448 | ON (r.file_id = p.file_id AND r.c_id = $course_id AND p.c_id = $course_id ) |
@@ -451,12 +451,12 @@ discard block |
||
451 | 451 | r.dest_user_id = ".intval($this->userId)." $condition_session "; |
452 | 452 | |
453 | 453 | $result = Database::query($sql); |
454 | - while ($res = Database::fetch_array($result)) { |
|
455 | - $temp = new Dropbox_Work($res['file_id']); |
|
456 | - $temp->category = $res['cat_id']; |
|
457 | - $this->receivedWork[] = $temp; |
|
458 | - } |
|
459 | - // Find all entries where this person is the sender/uploader |
|
454 | + while ($res = Database::fetch_array($result)) { |
|
455 | + $temp = new Dropbox_Work($res['file_id']); |
|
456 | + $temp->category = $res['cat_id']; |
|
457 | + $this->receivedWork[] = $temp; |
|
458 | + } |
|
459 | + // Find all entries where this person is the sender/uploader |
|
460 | 460 | $sql = "SELECT DISTINCT f.id |
461 | 461 | FROM $file_tbl f |
462 | 462 | INNER JOIN $person_tbl p |
@@ -467,261 +467,261 @@ discard block |
||
467 | 467 | $condition_session |
468 | 468 | "; |
469 | 469 | $result = Database::query($sql); |
470 | - while ($res = Database::fetch_array($result)) { |
|
471 | - $this->sentWork[] = new Dropbox_SentWork($res['id']); |
|
472 | - } |
|
473 | - } |
|
474 | - |
|
475 | - /** |
|
476 | - * This private method is used by the usort function in the |
|
477 | - * orderSentWork and orderReceivedWork methods. |
|
478 | - * It compares 2 work-objects by 1 of the properties of that object, dictated by the |
|
479 | - * private property _orderBy |
|
480 | - * |
|
481 | - * @param unknown_type $a |
|
482 | - * @param unknown_type $b |
|
483 | - * @return int -1, 0 or 1 dependent of the result of the comparison. |
|
484 | - */ |
|
485 | - function _cmpWork($a, $b) |
|
470 | + while ($res = Database::fetch_array($result)) { |
|
471 | + $this->sentWork[] = new Dropbox_SentWork($res['id']); |
|
472 | + } |
|
473 | + } |
|
474 | + |
|
475 | + /** |
|
476 | + * This private method is used by the usort function in the |
|
477 | + * orderSentWork and orderReceivedWork methods. |
|
478 | + * It compares 2 work-objects by 1 of the properties of that object, dictated by the |
|
479 | + * private property _orderBy |
|
480 | + * |
|
481 | + * @param unknown_type $a |
|
482 | + * @param unknown_type $b |
|
483 | + * @return int -1, 0 or 1 dependent of the result of the comparison. |
|
484 | + */ |
|
485 | + function _cmpWork($a, $b) |
|
486 | 486 | { |
487 | - $sort = $this->_orderBy; |
|
488 | - $aval = $a->$sort; |
|
489 | - $bval = $b->$sort; |
|
490 | - if ($sort == 'recipients') { |
|
491 | - // The recipients property is an array so we do the comparison based |
|
492 | - // on the first item of the recipients array |
|
493 | - $aval = $aval[0]['name']; |
|
494 | - $bval = $bval[0]['name']; |
|
495 | - } |
|
496 | - if ($sort == 'filesize') { // Filesize is not a string, so we use other comparison technique |
|
497 | - return $aval < $bval ? -1 : 1; |
|
498 | - } elseif ($sort == 'title') { // Natural order for sorting titles is more "human-friendly" |
|
499 | - return api_strnatcmp($aval, $bval); |
|
500 | - } else { |
|
501 | - return api_strcasecmp($aval, $bval); |
|
502 | - } |
|
503 | - } |
|
504 | - |
|
505 | - /** |
|
506 | - * A method that sorts the objects in the sentWork array, dependent on the $sort parameter. |
|
507 | - * $sort can be lastDate, firstDate, title, size, ... |
|
508 | - * |
|
509 | - * @param unknown_type $sort |
|
510 | - */ |
|
511 | - function orderSentWork($sort) |
|
487 | + $sort = $this->_orderBy; |
|
488 | + $aval = $a->$sort; |
|
489 | + $bval = $b->$sort; |
|
490 | + if ($sort == 'recipients') { |
|
491 | + // The recipients property is an array so we do the comparison based |
|
492 | + // on the first item of the recipients array |
|
493 | + $aval = $aval[0]['name']; |
|
494 | + $bval = $bval[0]['name']; |
|
495 | + } |
|
496 | + if ($sort == 'filesize') { // Filesize is not a string, so we use other comparison technique |
|
497 | + return $aval < $bval ? -1 : 1; |
|
498 | + } elseif ($sort == 'title') { // Natural order for sorting titles is more "human-friendly" |
|
499 | + return api_strnatcmp($aval, $bval); |
|
500 | + } else { |
|
501 | + return api_strcasecmp($aval, $bval); |
|
502 | + } |
|
503 | + } |
|
504 | + |
|
505 | + /** |
|
506 | + * A method that sorts the objects in the sentWork array, dependent on the $sort parameter. |
|
507 | + * $sort can be lastDate, firstDate, title, size, ... |
|
508 | + * |
|
509 | + * @param unknown_type $sort |
|
510 | + */ |
|
511 | + function orderSentWork($sort) |
|
512 | 512 | { |
513 | - switch($sort) { |
|
514 | - case 'lastDate': |
|
515 | - $this->_orderBy = 'last_upload_date'; |
|
516 | - break; |
|
517 | - case 'firstDate': |
|
518 | - $this->_orderBy = 'upload_date'; |
|
519 | - break; |
|
520 | - case 'title': |
|
521 | - $this->_orderBy = 'title'; |
|
522 | - break; |
|
523 | - case 'size': |
|
524 | - $this->_orderBy = 'filesize'; |
|
525 | - break; |
|
526 | - case 'author': |
|
527 | - $this->_orderBy = 'author'; |
|
528 | - break; |
|
529 | - case 'recipient': |
|
530 | - $this->_orderBy = 'recipients'; |
|
531 | - break; |
|
532 | - default: |
|
533 | - $this->_orderBy = 'last_upload_date'; |
|
534 | - } |
|
535 | - |
|
536 | - usort($this->sentWork, array($this, '_cmpWork')); |
|
537 | - } |
|
538 | - |
|
539 | - /** |
|
540 | - * method that sorts the objects in the receivedWork array, dependent on the $sort parameter. |
|
541 | - * $sort can be lastDate, firstDate, title, size, ... |
|
542 | - * @param unknown_type $sort |
|
543 | - */ |
|
544 | - function orderReceivedWork($sort) |
|
513 | + switch($sort) { |
|
514 | + case 'lastDate': |
|
515 | + $this->_orderBy = 'last_upload_date'; |
|
516 | + break; |
|
517 | + case 'firstDate': |
|
518 | + $this->_orderBy = 'upload_date'; |
|
519 | + break; |
|
520 | + case 'title': |
|
521 | + $this->_orderBy = 'title'; |
|
522 | + break; |
|
523 | + case 'size': |
|
524 | + $this->_orderBy = 'filesize'; |
|
525 | + break; |
|
526 | + case 'author': |
|
527 | + $this->_orderBy = 'author'; |
|
528 | + break; |
|
529 | + case 'recipient': |
|
530 | + $this->_orderBy = 'recipients'; |
|
531 | + break; |
|
532 | + default: |
|
533 | + $this->_orderBy = 'last_upload_date'; |
|
534 | + } |
|
535 | + |
|
536 | + usort($this->sentWork, array($this, '_cmpWork')); |
|
537 | + } |
|
538 | + |
|
539 | + /** |
|
540 | + * method that sorts the objects in the receivedWork array, dependent on the $sort parameter. |
|
541 | + * $sort can be lastDate, firstDate, title, size, ... |
|
542 | + * @param unknown_type $sort |
|
543 | + */ |
|
544 | + function orderReceivedWork($sort) |
|
545 | 545 | { |
546 | - switch($sort) { |
|
547 | - case 'lastDate': |
|
548 | - $this->_orderBy = 'last_upload_date'; |
|
549 | - break; |
|
550 | - case 'firstDate': |
|
551 | - $this->_orderBy = 'upload_date'; |
|
552 | - break; |
|
553 | - case 'title': |
|
554 | - $this->_orderBy = 'title'; |
|
555 | - break; |
|
556 | - case 'size': |
|
557 | - $this->_orderBy = 'filesize'; |
|
558 | - break; |
|
559 | - case 'author': |
|
560 | - $this->_orderBy = 'author'; |
|
561 | - break; |
|
562 | - case 'sender': |
|
563 | - $this->_orderBy = 'uploaderName'; |
|
564 | - break; |
|
565 | - default: |
|
566 | - $this->_orderBy = 'last_upload_date'; |
|
567 | - } |
|
568 | - |
|
569 | - usort($this->receivedWork, array($this, '_cmpWork')); |
|
570 | - } |
|
571 | - |
|
572 | - /** |
|
573 | - * Deletes all the received work of this person |
|
574 | - */ |
|
575 | - public function deleteAllReceivedWork() |
|
546 | + switch($sort) { |
|
547 | + case 'lastDate': |
|
548 | + $this->_orderBy = 'last_upload_date'; |
|
549 | + break; |
|
550 | + case 'firstDate': |
|
551 | + $this->_orderBy = 'upload_date'; |
|
552 | + break; |
|
553 | + case 'title': |
|
554 | + $this->_orderBy = 'title'; |
|
555 | + break; |
|
556 | + case 'size': |
|
557 | + $this->_orderBy = 'filesize'; |
|
558 | + break; |
|
559 | + case 'author': |
|
560 | + $this->_orderBy = 'author'; |
|
561 | + break; |
|
562 | + case 'sender': |
|
563 | + $this->_orderBy = 'uploaderName'; |
|
564 | + break; |
|
565 | + default: |
|
566 | + $this->_orderBy = 'last_upload_date'; |
|
567 | + } |
|
568 | + |
|
569 | + usort($this->receivedWork, array($this, '_cmpWork')); |
|
570 | + } |
|
571 | + |
|
572 | + /** |
|
573 | + * Deletes all the received work of this person |
|
574 | + */ |
|
575 | + public function deleteAllReceivedWork() |
|
576 | 576 | { |
577 | - $course_id = api_get_course_int_id(); |
|
577 | + $course_id = api_get_course_int_id(); |
|
578 | 578 | $dropbox_cnf = getDropboxConf(); |
579 | - // Delete entries in person table concerning received works |
|
580 | - foreach ($this->receivedWork as $w) { |
|
579 | + // Delete entries in person table concerning received works |
|
580 | + foreach ($this->receivedWork as $w) { |
|
581 | 581 | $sql = "DELETE FROM ".$dropbox_cnf['tbl_person']." |
582 | 582 | WHERE c_id = $course_id AND user_id='".$this->userId."' AND file_id='".$w->id."'"; |
583 | - Database::query($sql); |
|
584 | - } |
|
583 | + Database::query($sql); |
|
584 | + } |
|
585 | 585 | // Check for unused files |
586 | - removeUnusedFiles(); |
|
587 | - } |
|
588 | - |
|
589 | - /** |
|
590 | - * Deletes all the received categories and work of this person |
|
591 | - * @param integer $id |
|
592 | - */ |
|
593 | - public function deleteReceivedWorkFolder($id) |
|
586 | + removeUnusedFiles(); |
|
587 | + } |
|
588 | + |
|
589 | + /** |
|
590 | + * Deletes all the received categories and work of this person |
|
591 | + * @param integer $id |
|
592 | + */ |
|
593 | + public function deleteReceivedWorkFolder($id) |
|
594 | 594 | { |
595 | 595 | $dropbox_cnf = getDropboxConf(); |
596 | 596 | $course_id = api_get_course_int_id(); |
597 | 597 | |
598 | - $id = intval($id); |
|
599 | - $sql = "DELETE FROM ".$dropbox_cnf['tbl_file']." |
|
598 | + $id = intval($id); |
|
599 | + $sql = "DELETE FROM ".$dropbox_cnf['tbl_file']." |
|
600 | 600 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
601 | - if (!Database::query($sql)) return false; |
|
602 | - $sql = "DELETE FROM ".$dropbox_cnf['tbl_category']." |
|
601 | + if (!Database::query($sql)) return false; |
|
602 | + $sql = "DELETE FROM ".$dropbox_cnf['tbl_category']." |
|
603 | 603 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
604 | - if (!Database::query($sql)) return false; |
|
605 | - $sql = "DELETE FROM ".$dropbox_cnf['tbl_post']." |
|
604 | + if (!Database::query($sql)) return false; |
|
605 | + $sql = "DELETE FROM ".$dropbox_cnf['tbl_post']." |
|
606 | 606 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
607 | - if (!Database::query($sql)) return false; |
|
608 | - return true; |
|
609 | - } |
|
610 | - |
|
611 | - /** |
|
612 | - * Deletes a received dropbox file of this person with id=$id |
|
613 | - * |
|
614 | - * @param integer $id |
|
615 | - */ |
|
616 | - public function deleteReceivedWork($id) |
|
607 | + if (!Database::query($sql)) return false; |
|
608 | + return true; |
|
609 | + } |
|
610 | + |
|
611 | + /** |
|
612 | + * Deletes a received dropbox file of this person with id=$id |
|
613 | + * |
|
614 | + * @param integer $id |
|
615 | + */ |
|
616 | + public function deleteReceivedWork($id) |
|
617 | 617 | { |
618 | - $course_id = api_get_course_int_id(); |
|
618 | + $course_id = api_get_course_int_id(); |
|
619 | 619 | $dropbox_cnf = getDropboxConf(); |
620 | - $id = intval($id); |
|
621 | - |
|
622 | - // index check |
|
623 | - $found = false; |
|
624 | - foreach ($this->receivedWork as $w) { |
|
625 | - if ($w->id == $id) { |
|
626 | - $found = true; |
|
627 | - break; |
|
628 | - } |
|
629 | - } |
|
630 | - |
|
631 | - if (!$found) { |
|
632 | - if (!$this->deleteReceivedWorkFolder($id)) { |
|
633 | - die(get_lang('GeneralError').' (code 216)'); |
|
634 | - } |
|
635 | - } |
|
636 | - // Delete entries in person table concerning received works |
|
620 | + $id = intval($id); |
|
621 | + |
|
622 | + // index check |
|
623 | + $found = false; |
|
624 | + foreach ($this->receivedWork as $w) { |
|
625 | + if ($w->id == $id) { |
|
626 | + $found = true; |
|
627 | + break; |
|
628 | + } |
|
629 | + } |
|
630 | + |
|
631 | + if (!$found) { |
|
632 | + if (!$this->deleteReceivedWorkFolder($id)) { |
|
633 | + die(get_lang('GeneralError').' (code 216)'); |
|
634 | + } |
|
635 | + } |
|
636 | + // Delete entries in person table concerning received works |
|
637 | 637 | $sql = "DELETE FROM ".$dropbox_cnf['tbl_person']." |
638 | 638 | WHERE c_id = $course_id AND user_id = '".$this->userId."' AND file_id ='".$id."'"; |
639 | - Database::query($sql); |
|
640 | - removeUnusedFiles(); // Check for unused files |
|
641 | - } |
|
642 | - |
|
643 | - /** |
|
644 | - * Deletes all the sent dropbox files of this person |
|
645 | - */ |
|
646 | - public function deleteAllSentWork() |
|
639 | + Database::query($sql); |
|
640 | + removeUnusedFiles(); // Check for unused files |
|
641 | + } |
|
642 | + |
|
643 | + /** |
|
644 | + * Deletes all the sent dropbox files of this person |
|
645 | + */ |
|
646 | + public function deleteAllSentWork() |
|
647 | 647 | { |
648 | - $course_id = api_get_course_int_id(); |
|
648 | + $course_id = api_get_course_int_id(); |
|
649 | 649 | $dropbox_cnf = getDropboxConf(); |
650 | - //delete entries in person table concerning sent works |
|
651 | - foreach ($this->sentWork as $w) { |
|
650 | + //delete entries in person table concerning sent works |
|
651 | + foreach ($this->sentWork as $w) { |
|
652 | 652 | $sql = "DELETE FROM ".$dropbox_cnf['tbl_person']." |
653 | 653 | WHERE c_id = $course_id AND user_id='".$this->userId."' AND file_id='".$w->id."'"; |
654 | - Database::query($sql); |
|
655 | - removeMoreIfMailing($w->id); |
|
656 | - } |
|
657 | - removeUnusedFiles(); // Check for unused files |
|
658 | - } |
|
659 | - |
|
660 | - /** |
|
661 | - * Deletes a sent dropbox file of this person with id=$id |
|
662 | - * |
|
663 | - * @param unknown_type $id |
|
664 | - */ |
|
665 | - public function deleteSentWork($id) |
|
654 | + Database::query($sql); |
|
655 | + removeMoreIfMailing($w->id); |
|
656 | + } |
|
657 | + removeUnusedFiles(); // Check for unused files |
|
658 | + } |
|
659 | + |
|
660 | + /** |
|
661 | + * Deletes a sent dropbox file of this person with id=$id |
|
662 | + * |
|
663 | + * @param unknown_type $id |
|
664 | + */ |
|
665 | + public function deleteSentWork($id) |
|
666 | 666 | { |
667 | - $course_id = api_get_course_int_id(); |
|
667 | + $course_id = api_get_course_int_id(); |
|
668 | 668 | $dropbox_cnf = getDropboxConf(); |
669 | 669 | |
670 | - $id = intval($id); |
|
671 | - |
|
672 | - // index check |
|
673 | - $found = false; |
|
674 | - foreach ($this->sentWork as $w) { |
|
675 | - if ($w->id == $id) { |
|
676 | - $found = true; |
|
677 | - break; |
|
678 | - } |
|
679 | - } |
|
680 | - if (!$found) { |
|
681 | - if (!$this->deleteReceivedWorkFolder($id)) { |
|
682 | - die(get_lang('GeneralError').' (code 219)'); |
|
683 | - } |
|
684 | - } |
|
685 | - //$file_id = $this->sentWork[$index]->id; |
|
686 | - // Delete entries in person table concerning sent works |
|
670 | + $id = intval($id); |
|
671 | + |
|
672 | + // index check |
|
673 | + $found = false; |
|
674 | + foreach ($this->sentWork as $w) { |
|
675 | + if ($w->id == $id) { |
|
676 | + $found = true; |
|
677 | + break; |
|
678 | + } |
|
679 | + } |
|
680 | + if (!$found) { |
|
681 | + if (!$this->deleteReceivedWorkFolder($id)) { |
|
682 | + die(get_lang('GeneralError').' (code 219)'); |
|
683 | + } |
|
684 | + } |
|
685 | + //$file_id = $this->sentWork[$index]->id; |
|
686 | + // Delete entries in person table concerning sent works |
|
687 | 687 | $sql = "DELETE FROM ".$dropbox_cnf['tbl_person']." |
688 | 688 | WHERE c_id = $course_id AND user_id='".$this->userId."' AND file_id='".$id."'"; |
689 | - Database::query($sql); |
|
690 | - removeMoreIfMailing($id); |
|
691 | - removeUnusedFiles(); // Check for unused files |
|
692 | - } |
|
693 | - |
|
694 | - /** |
|
695 | - * Updates feedback for received work of this person with id=$id |
|
696 | - * |
|
697 | - * @param string $id |
|
698 | - * @param string $text |
|
699 | - */ |
|
700 | - public function updateFeedback($id, $text) |
|
689 | + Database::query($sql); |
|
690 | + removeMoreIfMailing($id); |
|
691 | + removeUnusedFiles(); // Check for unused files |
|
692 | + } |
|
693 | + |
|
694 | + /** |
|
695 | + * Updates feedback for received work of this person with id=$id |
|
696 | + * |
|
697 | + * @param string $id |
|
698 | + * @param string $text |
|
699 | + */ |
|
700 | + public function updateFeedback($id, $text) |
|
701 | 701 | { |
702 | - $course_id = api_get_course_int_id(); |
|
702 | + $course_id = api_get_course_int_id(); |
|
703 | 703 | $_course = api_get_course_info(); |
704 | 704 | $dropbox_cnf = getDropboxConf(); |
705 | 705 | |
706 | - $id = intval($id); |
|
707 | - |
|
708 | - // index check |
|
709 | - $found = false; |
|
710 | - $wi = -1; |
|
711 | - foreach ($this->receivedWork as $w) { |
|
712 | - $wi++; |
|
713 | - if ($w->id == $id){ |
|
714 | - $found = true; |
|
715 | - break; |
|
716 | - } // foreach (... as $wi -> $w) gives error 221! (no idea why...) |
|
717 | - } |
|
718 | - if (!$found) { |
|
719 | - die(get_lang('GeneralError').' (code 221)'); |
|
720 | - } |
|
721 | - |
|
722 | - $feedback_date = api_get_utc_datetime(); |
|
723 | - $this->receivedWork[$wi]->feedback_date = $feedback_date; |
|
724 | - $this->receivedWork[$wi]->feedback = $text; |
|
706 | + $id = intval($id); |
|
707 | + |
|
708 | + // index check |
|
709 | + $found = false; |
|
710 | + $wi = -1; |
|
711 | + foreach ($this->receivedWork as $w) { |
|
712 | + $wi++; |
|
713 | + if ($w->id == $id){ |
|
714 | + $found = true; |
|
715 | + break; |
|
716 | + } // foreach (... as $wi -> $w) gives error 221! (no idea why...) |
|
717 | + } |
|
718 | + if (!$found) { |
|
719 | + die(get_lang('GeneralError').' (code 221)'); |
|
720 | + } |
|
721 | + |
|
722 | + $feedback_date = api_get_utc_datetime(); |
|
723 | + $this->receivedWork[$wi]->feedback_date = $feedback_date; |
|
724 | + $this->receivedWork[$wi]->feedback = $text; |
|
725 | 725 | |
726 | 726 | $params = [ |
727 | 727 | 'feedback_date' => $feedback_date, |
@@ -739,11 +739,11 @@ discard block |
||
739 | 739 | ] |
740 | 740 | ); |
741 | 741 | |
742 | - // Update item_property table |
|
742 | + // Update item_property table |
|
743 | 743 | |
744 | - if (($ownerid = $this->receivedWork[$wi]->uploader_id) > $dropbox_cnf['mailingIdBase']) { |
|
745 | - $ownerid = getUserOwningThisMailing($ownerid); |
|
746 | - } |
|
744 | + if (($ownerid = $this->receivedWork[$wi]->uploader_id) > $dropbox_cnf['mailingIdBase']) { |
|
745 | + $ownerid = getUserOwningThisMailing($ownerid); |
|
746 | + } |
|
747 | 747 | api_item_property_update( |
748 | 748 | $_course, |
749 | 749 | TOOL_DROPBOX, |
@@ -754,31 +754,31 @@ discard block |
||
754 | 754 | $ownerid |
755 | 755 | ); |
756 | 756 | |
757 | - } |
|
757 | + } |
|
758 | 758 | |
759 | - /** |
|
760 | - * Filter the received work |
|
761 | - * @param string $type |
|
762 | - * @param string $value |
|
763 | - */ |
|
764 | - public function filter_received_work($type, $value) |
|
759 | + /** |
|
760 | + * Filter the received work |
|
761 | + * @param string $type |
|
762 | + * @param string $value |
|
763 | + */ |
|
764 | + public function filter_received_work($type, $value) |
|
765 | 765 | { |
766 | 766 | $dropbox_cnf = getDropboxConf(); |
767 | - $new_received_work = array(); |
|
768 | - foreach ($this->receivedWork as $work) { |
|
769 | - switch ($type) { |
|
770 | - case 'uploader_id': |
|
771 | - if ($work->uploader_id == $value || |
|
772 | - ($work->uploader_id > $dropbox_cnf['mailingIdBase'] && |
|
767 | + $new_received_work = array(); |
|
768 | + foreach ($this->receivedWork as $work) { |
|
769 | + switch ($type) { |
|
770 | + case 'uploader_id': |
|
771 | + if ($work->uploader_id == $value || |
|
772 | + ($work->uploader_id > $dropbox_cnf['mailingIdBase'] && |
|
773 | 773 | getUserOwningThisMailing($work->uploader_id) == $value) |
774 | 774 | ) { |
775 | - $new_received_work[] = $work; |
|
776 | - } |
|
777 | - break; |
|
778 | - default: |
|
779 | - $new_received_work[] = $work; |
|
780 | - } |
|
781 | - } |
|
782 | - $this->receivedWork = $new_received_work; |
|
783 | - } |
|
775 | + $new_received_work[] = $work; |
|
776 | + } |
|
777 | + break; |
|
778 | + default: |
|
779 | + $new_received_work[] = $work; |
|
780 | + } |
|
781 | + } |
|
782 | + $this->receivedWork = $new_received_work; |
|
783 | + } |
|
784 | 784 | } |
@@ -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'; |