@@ -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 | { |
@@ -210,7 +210,7 @@ |
||
210 | 210 | $this->category = $res['cat_id']; |
211 | 211 | |
212 | 212 | // Getting the feedback on the work. |
213 | - if ($action == 'viewfeedback' AND $this->id == $_GET['id']) { |
|
213 | + if ($action == 'viewfeedback' and $this->id == $_GET['id']) { |
|
214 | 214 | $feedback2 = array(); |
215 | 215 | $sql = "SELECT * FROM ".Database::get_course_table(TABLE_DROPBOX_FEEDBACK)." |
216 | 216 | WHERE c_id = $course_id AND file_id='".$id."' |
@@ -76,20 +76,20 @@ discard block |
||
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | - /** |
|
80 | - * private function creating a new work object |
|
81 | - * |
|
82 | - * @param int $uploader_id |
|
83 | - * @param string $title |
|
84 | - * @param string $description |
|
85 | - * @param string $author |
|
86 | - * @param string $filename |
|
87 | - * @param int $filesize |
|
88 | - * |
|
89 | - * @todo $author was originally a field but this has now been replaced by the first and lastname of the uploader (to prevent anonymous uploads) |
|
90 | - * As a consequence this parameter can be removed |
|
91 | - */ |
|
92 | - public function _createNewWork($uploader_id, $title, $description, $author, $filename, $filesize) |
|
79 | + /** |
|
80 | + * private function creating a new work object |
|
81 | + * |
|
82 | + * @param int $uploader_id |
|
83 | + * @param string $title |
|
84 | + * @param string $description |
|
85 | + * @param string $author |
|
86 | + * @param string $filename |
|
87 | + * @param int $filesize |
|
88 | + * |
|
89 | + * @todo $author was originally a field but this has now been replaced by the first and lastname of the uploader (to prevent anonymous uploads) |
|
90 | + * As a consequence this parameter can be removed |
|
91 | + */ |
|
92 | + public function _createNewWork($uploader_id, $title, $description, $author, $filename, $filesize) |
|
93 | 93 | { |
94 | 94 | // Fill in the properties |
95 | 95 | $this->uploader_id = intval($uploader_id); |
@@ -104,17 +104,17 @@ discard block |
||
104 | 104 | // Check if object exists already. If it does, the old object is used |
105 | 105 | // with updated information (authors, description, upload_date) |
106 | 106 | $this->isOldWork = false; |
107 | - $sql = "SELECT id, upload_date FROM ".Database::get_course_table(TABLE_DROPBOX_FILE)." |
|
107 | + $sql = "SELECT id, upload_date FROM ".Database::get_course_table(TABLE_DROPBOX_FILE)." |
|
108 | 108 | WHERE c_id = $course_id AND filename = '".Database::escape_string($this->filename)."'"; |
109 | 109 | $result = Database::query($sql); |
110 | - $res = Database::fetch_array($result); |
|
111 | - if ($res) { |
|
112 | - $this->isOldWork = true; |
|
113 | - } |
|
114 | - // Insert or update the dropbox_file table and set the id property |
|
115 | - if ($this->isOldWork) { |
|
116 | - $this->id = $res['id']; |
|
117 | - $this->upload_date = $res['upload_date']; |
|
110 | + $res = Database::fetch_array($result); |
|
111 | + if ($res) { |
|
112 | + $this->isOldWork = true; |
|
113 | + } |
|
114 | + // Insert or update the dropbox_file table and set the id property |
|
115 | + if ($this->isOldWork) { |
|
116 | + $this->id = $res['id']; |
|
117 | + $this->upload_date = $res['upload_date']; |
|
118 | 118 | |
119 | 119 | $params = [ |
120 | 120 | 'filesize' => $this->filesize, |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | $params, |
131 | 131 | ['c_id = ? AND id = ?' => [$course_id, $this->id]] |
132 | 132 | ); |
133 | - } else { |
|
134 | - $this->upload_date = $this->last_upload_date; |
|
135 | - $params = [ |
|
133 | + } else { |
|
134 | + $this->upload_date = $this->last_upload_date; |
|
135 | + $params = [ |
|
136 | 136 | 'c_id' => $course_id, |
137 | 137 | 'uploader_id' => $this->uploader_id, |
138 | 138 | 'filename' => $this->filename, |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | 'last_upload_date' => $this->last_upload_date, |
145 | 145 | 'session_id' => api_get_session_id(), |
146 | 146 | 'cat_id' => 0 |
147 | - ]; |
|
147 | + ]; |
|
148 | 148 | |
149 | - $this->id = Database::insert(Database::get_course_table(TABLE_DROPBOX_FILE), $params); |
|
150 | - if ($this->id) { |
|
151 | - $sql = "UPDATE ".Database::get_course_table(TABLE_DROPBOX_FILE)." SET id = iid WHERE iid = {$this->id}"; |
|
152 | - Database::query($sql); |
|
153 | - } |
|
154 | - } |
|
149 | + $this->id = Database::insert(Database::get_course_table(TABLE_DROPBOX_FILE), $params); |
|
150 | + if ($this->id) { |
|
151 | + $sql = "UPDATE ".Database::get_course_table(TABLE_DROPBOX_FILE)." SET id = iid WHERE iid = {$this->id}"; |
|
152 | + Database::query($sql); |
|
153 | + } |
|
154 | + } |
|
155 | 155 | |
156 | 156 | $sql = "SELECT count(file_id) as count |
157 | 157 | FROM ". Database::get_course_table(TABLE_DROPBOX_PERSON)." |
@@ -165,16 +165,16 @@ discard block |
||
165 | 165 | VALUES ($course_id, ".intval($this->id)." , ".intval($this->uploader_id).")"; |
166 | 166 | Database::query($sql); |
167 | 167 | } |
168 | - } |
|
169 | - |
|
170 | - /** |
|
171 | - * private function creating existing object by retreiving info from db |
|
172 | - * |
|
173 | - * @param int $id |
|
174 | - */ |
|
175 | - public function _createExistingWork($id) |
|
168 | + } |
|
169 | + |
|
170 | + /** |
|
171 | + * private function creating existing object by retreiving info from db |
|
172 | + * |
|
173 | + * @param int $id |
|
174 | + */ |
|
175 | + public function _createExistingWork($id) |
|
176 | 176 | { |
177 | - $course_id = api_get_course_int_id(); |
|
177 | + $course_id = api_get_course_int_id(); |
|
178 | 178 | |
179 | 179 | $action = isset($_GET['action']) ? $_GET['action'] : null; |
180 | 180 | |
@@ -222,12 +222,12 @@ discard block |
||
222 | 222 | } |
223 | 223 | $this->feedback2 = $feedback2; |
224 | 224 | } |
225 | - } |
|
225 | + } |
|
226 | 226 | |
227 | 227 | /** |
228 | 228 | * @return bool |
229 | 229 | */ |
230 | - public function updateFile() |
|
230 | + public function updateFile() |
|
231 | 231 | { |
232 | 232 | $course_id = api_get_course_int_id(); |
233 | 233 | if (empty($this->id) || empty($course_id)) { |
@@ -257,46 +257,46 @@ discard block |
||
257 | 257 | |
258 | 258 | class Dropbox_SentWork extends Dropbox_Work |
259 | 259 | { |
260 | - public $recipients; //array of ['id']['name'] arrays |
|
261 | - |
|
262 | - /** |
|
263 | - * Constructor calls private functions to create a new work or retreive an existing work from DB |
|
264 | - * depending on the number of parameters |
|
265 | - * |
|
266 | - * @param unknown_type $arg1 |
|
267 | - * @param unknown_type $arg2 |
|
268 | - * @param unknown_type $arg3 |
|
269 | - * @param unknown_type $arg4 |
|
270 | - * @param unknown_type $arg5 |
|
271 | - * @param unknown_type $arg6 |
|
272 | - * @param unknown_type $arg7 |
|
273 | - * @return Dropbox_SentWork |
|
274 | - */ |
|
275 | - public function __construct($arg1, $arg2 = null, $arg3 = null, $arg4 = null, $arg5 = null, $arg6 = null, $arg7 = null) |
|
260 | + public $recipients; //array of ['id']['name'] arrays |
|
261 | + |
|
262 | + /** |
|
263 | + * Constructor calls private functions to create a new work or retreive an existing work from DB |
|
264 | + * depending on the number of parameters |
|
265 | + * |
|
266 | + * @param unknown_type $arg1 |
|
267 | + * @param unknown_type $arg2 |
|
268 | + * @param unknown_type $arg3 |
|
269 | + * @param unknown_type $arg4 |
|
270 | + * @param unknown_type $arg5 |
|
271 | + * @param unknown_type $arg6 |
|
272 | + * @param unknown_type $arg7 |
|
273 | + * @return Dropbox_SentWork |
|
274 | + */ |
|
275 | + public function __construct($arg1, $arg2 = null, $arg3 = null, $arg4 = null, $arg5 = null, $arg6 = null, $arg7 = null) |
|
276 | 276 | { |
277 | - if (func_num_args() > 1) { |
|
278 | - $this->_createNewSentWork($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7); |
|
279 | - } else { |
|
280 | - $this->_createExistingSentWork($arg1); |
|
281 | - } |
|
282 | - } |
|
283 | - |
|
284 | - /** |
|
285 | - * private function creating a new SentWork object |
|
286 | - * |
|
287 | - * @param int $uploader_id |
|
288 | - * @param string $title |
|
289 | - * @param string $description |
|
290 | - * @param string $author |
|
291 | - * @param string $filename |
|
292 | - * @param int $filesize |
|
293 | - * @param array $recipient_ids |
|
294 | - */ |
|
295 | - public function _createNewSentWork($uploader_id, $title, $description, $author, $filename, $filesize, $recipient_ids) |
|
277 | + if (func_num_args() > 1) { |
|
278 | + $this->_createNewSentWork($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7); |
|
279 | + } else { |
|
280 | + $this->_createExistingSentWork($arg1); |
|
281 | + } |
|
282 | + } |
|
283 | + |
|
284 | + /** |
|
285 | + * private function creating a new SentWork object |
|
286 | + * |
|
287 | + * @param int $uploader_id |
|
288 | + * @param string $title |
|
289 | + * @param string $description |
|
290 | + * @param string $author |
|
291 | + * @param string $filename |
|
292 | + * @param int $filesize |
|
293 | + * @param array $recipient_ids |
|
294 | + */ |
|
295 | + public function _createNewSentWork($uploader_id, $title, $description, $author, $filename, $filesize, $recipient_ids) |
|
296 | 296 | { |
297 | 297 | $_course = api_get_course_info(); |
298 | 298 | |
299 | - // Call constructor of Dropbox_Work object |
|
299 | + // Call constructor of Dropbox_Work object |
|
300 | 300 | parent::__construct( |
301 | 301 | $uploader_id, |
302 | 302 | $title, |
@@ -306,33 +306,33 @@ discard block |
||
306 | 306 | $filesize |
307 | 307 | ); |
308 | 308 | |
309 | - $course_id = api_get_course_int_id(); |
|
310 | - |
|
311 | - // Do sanity checks on recipient_ids array & property fillin |
|
312 | - // The sanity check for ex-coursemembers is already done in base constructor |
|
313 | - $uploader_id = (int) $uploader_id; |
|
309 | + $course_id = api_get_course_int_id(); |
|
314 | 310 | |
315 | - $justSubmit = false; |
|
316 | - if (is_int($recipient_ids)) { |
|
317 | - $justSubmit = true; |
|
318 | - $recipient_ids = array($recipient_ids + $this->id); |
|
319 | - } elseif (count($recipient_ids) == 0) { |
|
320 | - $justSubmit = true; |
|
321 | - $recipient_ids = array($uploader_id); |
|
322 | - } |
|
311 | + // Do sanity checks on recipient_ids array & property fillin |
|
312 | + // The sanity check for ex-coursemembers is already done in base constructor |
|
313 | + $uploader_id = (int) $uploader_id; |
|
314 | + |
|
315 | + $justSubmit = false; |
|
316 | + if (is_int($recipient_ids)) { |
|
317 | + $justSubmit = true; |
|
318 | + $recipient_ids = array($recipient_ids + $this->id); |
|
319 | + } elseif (count($recipient_ids) == 0) { |
|
320 | + $justSubmit = true; |
|
321 | + $recipient_ids = array($uploader_id); |
|
322 | + } |
|
323 | 323 | |
324 | - if (!is_array($recipient_ids) || count($recipient_ids) == 0) { |
|
325 | - die(get_lang('GeneralError').' (code 209)'); |
|
326 | - } |
|
324 | + if (!is_array($recipient_ids) || count($recipient_ids) == 0) { |
|
325 | + die(get_lang('GeneralError').' (code 209)'); |
|
326 | + } |
|
327 | 327 | |
328 | - foreach ($recipient_ids as $rec) { |
|
329 | - if (empty($rec)) { |
|
330 | - continue; |
|
328 | + foreach ($recipient_ids as $rec) { |
|
329 | + if (empty($rec)) { |
|
330 | + continue; |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | //this check is done when validating submitted data |
334 | - $this->recipients[] = array('id' => $rec); |
|
335 | - } |
|
334 | + $this->recipients[] = array('id' => $rec); |
|
335 | + } |
|
336 | 336 | |
337 | 337 | $table_post = Database::get_course_table(TABLE_DROPBOX_POST); |
338 | 338 | $table_person = Database::get_course_table(TABLE_DROPBOX_PERSON); |
@@ -342,12 +342,12 @@ discard block |
||
342 | 342 | $mailId = get_mail_id_base(); |
343 | 343 | |
344 | 344 | // Insert data in dropbox_post and dropbox_person table for each recipient |
345 | - foreach ($this->recipients as $rec) { |
|
345 | + foreach ($this->recipients as $rec) { |
|
346 | 346 | $file_id = (int) $this->id; |
347 | 347 | $user_id = (int) $rec['id']; |
348 | - $sql = "INSERT INTO $table_post (c_id, file_id, dest_user_id, session_id, feedback_date, cat_id) |
|
348 | + $sql = "INSERT INTO $table_post (c_id, file_id, dest_user_id, session_id, feedback_date, cat_id) |
|
349 | 349 | VALUES ($course_id, $file_id, $user_id, $session_id, '$now', 0)"; |
350 | - Database::query($sql); |
|
350 | + Database::query($sql); |
|
351 | 351 | // If work already exists no error is generated |
352 | 352 | |
353 | 353 | /** |
@@ -364,13 +364,13 @@ discard block |
||
364 | 364 | } |
365 | 365 | } |
366 | 366 | |
367 | - // Update item_property table for each recipient |
|
368 | - if (($ownerid = $this->uploader_id) > $mailId) { |
|
369 | - $ownerid = getUserOwningThisMailing($ownerid); |
|
370 | - } |
|
371 | - if (($recipid = $rec["id"]) > $mailId) { |
|
372 | - $recipid = $ownerid; // mailing file recipient = mailing id, not a person |
|
373 | - } |
|
367 | + // Update item_property table for each recipient |
|
368 | + if (($ownerid = $this->uploader_id) > $mailId) { |
|
369 | + $ownerid = getUserOwningThisMailing($ownerid); |
|
370 | + } |
|
371 | + if (($recipid = $rec["id"]) > $mailId) { |
|
372 | + $recipid = $ownerid; // mailing file recipient = mailing id, not a person |
|
373 | + } |
|
374 | 374 | api_item_property_update( |
375 | 375 | $_course, |
376 | 376 | TOOL_DROPBOX, |
@@ -380,88 +380,88 @@ discard block |
||
380 | 380 | null, |
381 | 381 | $recipid |
382 | 382 | ); |
383 | - } |
|
384 | - } |
|
385 | - |
|
386 | - /** |
|
387 | - * private function creating existing object by retreiving info from db |
|
388 | - * |
|
389 | - * @param int $id |
|
390 | - */ |
|
391 | - public function _createExistingSentWork($id) |
|
383 | + } |
|
384 | + } |
|
385 | + |
|
386 | + /** |
|
387 | + * private function creating existing object by retreiving info from db |
|
388 | + * |
|
389 | + * @param int $id |
|
390 | + */ |
|
391 | + public function _createExistingSentWork($id) |
|
392 | 392 | { |
393 | 393 | $id = intval($id); |
394 | - $course_id = api_get_course_int_id(); |
|
394 | + $course_id = api_get_course_int_id(); |
|
395 | 395 | |
396 | - // Call constructor of Dropbox_Work object |
|
397 | - parent::__construct($id); |
|
396 | + // Call constructor of Dropbox_Work object |
|
397 | + parent::__construct($id); |
|
398 | 398 | |
399 | - // Fill in recipients array |
|
400 | - $this->recipients = array(); |
|
401 | - $sql = "SELECT dest_user_id, feedback_date, feedback |
|
399 | + // Fill in recipients array |
|
400 | + $this->recipients = array(); |
|
401 | + $sql = "SELECT dest_user_id, feedback_date, feedback |
|
402 | 402 | FROM ".Database::get_course_table(TABLE_DROPBOX_POST)." |
403 | 403 | WHERE c_id = $course_id AND file_id = ".intval($id).""; |
404 | 404 | $result = Database::query($sql); |
405 | - while ($res = Database::fetch_array($result, 'ASSOC')) { |
|
406 | - // Check for deleted users |
|
407 | - $dest_user_id = $res['dest_user_id']; |
|
408 | - $user_info = api_get_user_info($dest_user_id); |
|
409 | - if (!$user_info) { |
|
410 | - $this->recipients[] = array('id' => -1, 'name' => get_lang('Unknown', '')); |
|
411 | - } else { |
|
412 | - $this->recipients[] = array( |
|
405 | + while ($res = Database::fetch_array($result, 'ASSOC')) { |
|
406 | + // Check for deleted users |
|
407 | + $dest_user_id = $res['dest_user_id']; |
|
408 | + $user_info = api_get_user_info($dest_user_id); |
|
409 | + if (!$user_info) { |
|
410 | + $this->recipients[] = array('id' => -1, 'name' => get_lang('Unknown', '')); |
|
411 | + } else { |
|
412 | + $this->recipients[] = array( |
|
413 | 413 | 'id' => $dest_user_id, |
414 | 414 | 'name' => $user_info['complete_name'], |
415 | 415 | 'user_id' => $dest_user_id, |
416 | - 'feedback_date' => $res['feedback_date'], |
|
416 | + 'feedback_date' => $res['feedback_date'], |
|
417 | 417 | 'feedback' => $res['feedback'] |
418 | 418 | ); |
419 | - } |
|
420 | - } |
|
421 | - } |
|
419 | + } |
|
420 | + } |
|
421 | + } |
|
422 | 422 | } |
423 | 423 | |
424 | 424 | class Dropbox_Person |
425 | 425 | { |
426 | - // The receivedWork and the sentWork arrays are sorted. |
|
427 | - public $receivedWork; // an array of Dropbox_Work objects |
|
428 | - public $sentWork; // an array of Dropbox_SentWork objects |
|
429 | - |
|
430 | - public $userId = 0; |
|
431 | - public $isCourseAdmin = false; |
|
432 | - public $isCourseTutor = false; |
|
433 | - public $_orderBy = ''; // private property that determines by which field |
|
434 | - |
|
435 | - /** |
|
436 | - * Constructor for recreating the Dropbox_Person object |
|
437 | - * |
|
438 | - * @param int $userId |
|
439 | - * @param bool $isCourseAdmin |
|
440 | - * @param bool $isCourseTutor |
|
441 | - * @return Dropbox_Person |
|
442 | - */ |
|
443 | - public function __construct($userId, $isCourseAdmin, $isCourseTutor) |
|
426 | + // The receivedWork and the sentWork arrays are sorted. |
|
427 | + public $receivedWork; // an array of Dropbox_Work objects |
|
428 | + public $sentWork; // an array of Dropbox_SentWork objects |
|
429 | + |
|
430 | + public $userId = 0; |
|
431 | + public $isCourseAdmin = false; |
|
432 | + public $isCourseTutor = false; |
|
433 | + public $_orderBy = ''; // private property that determines by which field |
|
434 | + |
|
435 | + /** |
|
436 | + * Constructor for recreating the Dropbox_Person object |
|
437 | + * |
|
438 | + * @param int $userId |
|
439 | + * @param bool $isCourseAdmin |
|
440 | + * @param bool $isCourseTutor |
|
441 | + * @return Dropbox_Person |
|
442 | + */ |
|
443 | + public function __construct($userId, $isCourseAdmin, $isCourseTutor) |
|
444 | 444 | { |
445 | - $course_id = api_get_course_int_id(); |
|
445 | + $course_id = api_get_course_int_id(); |
|
446 | 446 | |
447 | - // Fill in properties |
|
447 | + // Fill in properties |
|
448 | 448 | $this->userId = $userId; |
449 | 449 | $this->isCourseAdmin = $isCourseAdmin; |
450 | 450 | $this->isCourseTutor = $isCourseTutor; |
451 | 451 | $this->receivedWork = array(); |
452 | 452 | $this->sentWork = array(); |
453 | 453 | |
454 | - // Note: perhaps include an ex coursemember check to delete old files |
|
454 | + // Note: perhaps include an ex coursemember check to delete old files |
|
455 | 455 | |
456 | - $session_id = api_get_session_id(); |
|
457 | - $condition_session = api_get_session_condition($session_id); |
|
456 | + $session_id = api_get_session_id(); |
|
457 | + $condition_session = api_get_session_condition($session_id); |
|
458 | 458 | |
459 | - $post_tbl = Database::get_course_table(TABLE_DROPBOX_POST); |
|
460 | - $person_tbl = Database::get_course_table(TABLE_DROPBOX_PERSON); |
|
461 | - $file_tbl = Database::get_course_table(TABLE_DROPBOX_FILE); |
|
459 | + $post_tbl = Database::get_course_table(TABLE_DROPBOX_POST); |
|
460 | + $person_tbl = Database::get_course_table(TABLE_DROPBOX_PERSON); |
|
461 | + $file_tbl = Database::get_course_table(TABLE_DROPBOX_FILE); |
|
462 | 462 | |
463 | 463 | // Find all entries where this person is the recipient |
464 | - $sql = "SELECT DISTINCT r.file_id, r.cat_id |
|
464 | + $sql = "SELECT DISTINCT r.file_id, r.cat_id |
|
465 | 465 | FROM $post_tbl r |
466 | 466 | INNER JOIN $person_tbl p |
467 | 467 | ON (r.file_id = p.file_id AND r.c_id = $course_id AND p.c_id = $course_id ) |
@@ -470,12 +470,12 @@ discard block |
||
470 | 470 | r.dest_user_id = ".intval($this->userId)." $condition_session "; |
471 | 471 | |
472 | 472 | $result = Database::query($sql); |
473 | - while ($res = Database::fetch_array($result)) { |
|
474 | - $temp = new Dropbox_Work($res['file_id']); |
|
475 | - $temp->category = $res['cat_id']; |
|
476 | - $this->receivedWork[] = $temp; |
|
477 | - } |
|
478 | - // Find all entries where this person is the sender/uploader |
|
473 | + while ($res = Database::fetch_array($result)) { |
|
474 | + $temp = new Dropbox_Work($res['file_id']); |
|
475 | + $temp->category = $res['cat_id']; |
|
476 | + $this->receivedWork[] = $temp; |
|
477 | + } |
|
478 | + // Find all entries where this person is the sender/uploader |
|
479 | 479 | $sql = "SELECT DISTINCT f.id |
480 | 480 | FROM $file_tbl f |
481 | 481 | INNER JOIN $person_tbl p |
@@ -486,160 +486,160 @@ discard block |
||
486 | 486 | $condition_session |
487 | 487 | "; |
488 | 488 | $result = Database::query($sql); |
489 | - while ($res = Database::fetch_array($result)) { |
|
490 | - $this->sentWork[] = new Dropbox_SentWork($res['id']); |
|
491 | - } |
|
492 | - } |
|
493 | - |
|
494 | - /** |
|
495 | - * Deletes all the received work of this person |
|
496 | - */ |
|
497 | - public function deleteAllReceivedWork() |
|
489 | + while ($res = Database::fetch_array($result)) { |
|
490 | + $this->sentWork[] = new Dropbox_SentWork($res['id']); |
|
491 | + } |
|
492 | + } |
|
493 | + |
|
494 | + /** |
|
495 | + * Deletes all the received work of this person |
|
496 | + */ |
|
497 | + public function deleteAllReceivedWork() |
|
498 | 498 | { |
499 | - $course_id = api_get_course_int_id(); |
|
500 | - // Delete entries in person table concerning received works |
|
501 | - foreach ($this->receivedWork as $w) { |
|
499 | + $course_id = api_get_course_int_id(); |
|
500 | + // Delete entries in person table concerning received works |
|
501 | + foreach ($this->receivedWork as $w) { |
|
502 | 502 | $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_PERSON)." |
503 | 503 | WHERE c_id = $course_id AND user_id='".$this->userId."' AND file_id='".$w->id."'"; |
504 | - Database::query($sql); |
|
505 | - } |
|
504 | + Database::query($sql); |
|
505 | + } |
|
506 | 506 | // Check for unused files |
507 | - removeUnusedFiles(); |
|
508 | - } |
|
509 | - |
|
510 | - /** |
|
511 | - * Deletes all the received categories and work of this person |
|
512 | - * @param integer $id |
|
513 | - */ |
|
514 | - public function deleteReceivedWorkFolder($id) |
|
507 | + removeUnusedFiles(); |
|
508 | + } |
|
509 | + |
|
510 | + /** |
|
511 | + * Deletes all the received categories and work of this person |
|
512 | + * @param integer $id |
|
513 | + */ |
|
514 | + public function deleteReceivedWorkFolder($id) |
|
515 | 515 | { |
516 | 516 | $course_id = api_get_course_int_id(); |
517 | 517 | |
518 | - $id = intval($id); |
|
519 | - $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_FILE)." |
|
518 | + $id = intval($id); |
|
519 | + $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_FILE)." |
|
520 | 520 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
521 | - if (!Database::query($sql)) return false; |
|
522 | - $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_CATEGORY)." |
|
521 | + if (!Database::query($sql)) return false; |
|
522 | + $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_CATEGORY)." |
|
523 | 523 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
524 | - if (!Database::query($sql)) return false; |
|
525 | - $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_POST)." |
|
524 | + if (!Database::query($sql)) return false; |
|
525 | + $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_POST)." |
|
526 | 526 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
527 | - if (!Database::query($sql)) return false; |
|
528 | - return true; |
|
529 | - } |
|
530 | - |
|
531 | - /** |
|
532 | - * Deletes a received dropbox file of this person with id=$id |
|
533 | - * |
|
534 | - * @param integer $id |
|
535 | - */ |
|
536 | - public function deleteReceivedWork($id) |
|
527 | + if (!Database::query($sql)) return false; |
|
528 | + return true; |
|
529 | + } |
|
530 | + |
|
531 | + /** |
|
532 | + * Deletes a received dropbox file of this person with id=$id |
|
533 | + * |
|
534 | + * @param integer $id |
|
535 | + */ |
|
536 | + public function deleteReceivedWork($id) |
|
537 | 537 | { |
538 | - $course_id = api_get_course_int_id(); |
|
539 | - $id = intval($id); |
|
540 | - |
|
541 | - // index check |
|
542 | - $found = false; |
|
543 | - foreach ($this->receivedWork as $w) { |
|
544 | - if ($w->id == $id) { |
|
545 | - $found = true; |
|
546 | - break; |
|
547 | - } |
|
548 | - } |
|
549 | - |
|
550 | - if (!$found) { |
|
551 | - if (!$this->deleteReceivedWorkFolder($id)) { |
|
552 | - die(get_lang('GeneralError').' (code 216)'); |
|
553 | - } |
|
554 | - } |
|
555 | - // Delete entries in person table concerning received works |
|
538 | + $course_id = api_get_course_int_id(); |
|
539 | + $id = intval($id); |
|
540 | + |
|
541 | + // index check |
|
542 | + $found = false; |
|
543 | + foreach ($this->receivedWork as $w) { |
|
544 | + if ($w->id == $id) { |
|
545 | + $found = true; |
|
546 | + break; |
|
547 | + } |
|
548 | + } |
|
549 | + |
|
550 | + if (!$found) { |
|
551 | + if (!$this->deleteReceivedWorkFolder($id)) { |
|
552 | + die(get_lang('GeneralError').' (code 216)'); |
|
553 | + } |
|
554 | + } |
|
555 | + // Delete entries in person table concerning received works |
|
556 | 556 | $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_PERSON)." |
557 | 557 | WHERE c_id = $course_id AND user_id = '".$this->userId."' AND file_id ='".$id."'"; |
558 | - Database::query($sql); |
|
559 | - removeUnusedFiles(); // Check for unused files |
|
560 | - } |
|
561 | - |
|
562 | - /** |
|
563 | - * Deletes all the sent dropbox files of this person |
|
564 | - */ |
|
565 | - public function deleteAllSentWork() |
|
558 | + Database::query($sql); |
|
559 | + removeUnusedFiles(); // Check for unused files |
|
560 | + } |
|
561 | + |
|
562 | + /** |
|
563 | + * Deletes all the sent dropbox files of this person |
|
564 | + */ |
|
565 | + public function deleteAllSentWork() |
|
566 | 566 | { |
567 | - $course_id = api_get_course_int_id(); |
|
568 | - //delete entries in person table concerning sent works |
|
569 | - foreach ($this->sentWork as $w) { |
|
567 | + $course_id = api_get_course_int_id(); |
|
568 | + //delete entries in person table concerning sent works |
|
569 | + foreach ($this->sentWork as $w) { |
|
570 | 570 | $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_PERSON)." |
571 | 571 | WHERE c_id = $course_id AND user_id='".$this->userId."' AND file_id='".$w->id."'"; |
572 | - Database::query($sql); |
|
573 | - removeMoreIfMailing($w->id); |
|
574 | - } |
|
575 | - removeUnusedFiles(); // Check for unused files |
|
576 | - } |
|
577 | - |
|
578 | - /** |
|
579 | - * Deletes a sent dropbox file of this person with id=$id |
|
580 | - * |
|
581 | - * @param int $id |
|
582 | - */ |
|
583 | - public function deleteSentWork($id) |
|
572 | + Database::query($sql); |
|
573 | + removeMoreIfMailing($w->id); |
|
574 | + } |
|
575 | + removeUnusedFiles(); // Check for unused files |
|
576 | + } |
|
577 | + |
|
578 | + /** |
|
579 | + * Deletes a sent dropbox file of this person with id=$id |
|
580 | + * |
|
581 | + * @param int $id |
|
582 | + */ |
|
583 | + public function deleteSentWork($id) |
|
584 | 584 | { |
585 | - $course_id = api_get_course_int_id(); |
|
586 | - |
|
587 | - $id = intval($id); |
|
588 | - |
|
589 | - // index check |
|
590 | - $found = false; |
|
591 | - foreach ($this->sentWork as $w) { |
|
592 | - if ($w->id == $id) { |
|
593 | - $found = true; |
|
594 | - break; |
|
595 | - } |
|
596 | - } |
|
597 | - if (!$found) { |
|
598 | - if (!$this->deleteReceivedWorkFolder($id)) { |
|
599 | - die(get_lang('GeneralError').' (code 219)'); |
|
600 | - } |
|
601 | - } |
|
602 | - //$file_id = $this->sentWork[$index]->id; |
|
603 | - // Delete entries in person table concerning sent works |
|
585 | + $course_id = api_get_course_int_id(); |
|
586 | + |
|
587 | + $id = intval($id); |
|
588 | + |
|
589 | + // index check |
|
590 | + $found = false; |
|
591 | + foreach ($this->sentWork as $w) { |
|
592 | + if ($w->id == $id) { |
|
593 | + $found = true; |
|
594 | + break; |
|
595 | + } |
|
596 | + } |
|
597 | + if (!$found) { |
|
598 | + if (!$this->deleteReceivedWorkFolder($id)) { |
|
599 | + die(get_lang('GeneralError').' (code 219)'); |
|
600 | + } |
|
601 | + } |
|
602 | + //$file_id = $this->sentWork[$index]->id; |
|
603 | + // Delete entries in person table concerning sent works |
|
604 | 604 | $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_PERSON)." |
605 | 605 | WHERE c_id = $course_id AND user_id='".$this->userId."' AND file_id='".$id."'"; |
606 | - Database::query($sql); |
|
607 | - removeMoreIfMailing($id); |
|
608 | - removeUnusedFiles(); // Check for unused files |
|
609 | - } |
|
610 | - |
|
611 | - /** |
|
612 | - * Updates feedback for received work of this person with id=$id |
|
613 | - * |
|
614 | - * @param string $id |
|
615 | - * @param string $text |
|
616 | - */ |
|
617 | - public function updateFeedback($id, $text) |
|
606 | + Database::query($sql); |
|
607 | + removeMoreIfMailing($id); |
|
608 | + removeUnusedFiles(); // Check for unused files |
|
609 | + } |
|
610 | + |
|
611 | + /** |
|
612 | + * Updates feedback for received work of this person with id=$id |
|
613 | + * |
|
614 | + * @param string $id |
|
615 | + * @param string $text |
|
616 | + */ |
|
617 | + public function updateFeedback($id, $text) |
|
618 | 618 | { |
619 | - $course_id = api_get_course_int_id(); |
|
619 | + $course_id = api_get_course_int_id(); |
|
620 | 620 | $_course = api_get_course_info(); |
621 | 621 | $dropbox_cnf = getDropboxConf(); |
622 | 622 | |
623 | - $id = intval($id); |
|
623 | + $id = intval($id); |
|
624 | 624 | |
625 | - // index check |
|
626 | - $found = false; |
|
627 | - $wi = -1; |
|
628 | - foreach ($this->receivedWork as $w) { |
|
629 | - $wi++; |
|
630 | - if ($w->id == $id) { |
|
631 | - $found = true; |
|
632 | - break; |
|
633 | - } // foreach (... as $wi -> $w) gives error 221! (no idea why...) |
|
634 | - } |
|
625 | + // index check |
|
626 | + $found = false; |
|
627 | + $wi = -1; |
|
628 | + foreach ($this->receivedWork as $w) { |
|
629 | + $wi++; |
|
630 | + if ($w->id == $id) { |
|
631 | + $found = true; |
|
632 | + break; |
|
633 | + } // foreach (... as $wi -> $w) gives error 221! (no idea why...) |
|
634 | + } |
|
635 | 635 | |
636 | - if (!$found) { |
|
637 | - return false; |
|
638 | - } |
|
636 | + if (!$found) { |
|
637 | + return false; |
|
638 | + } |
|
639 | 639 | |
640 | - $feedback_date = api_get_utc_datetime(); |
|
641 | - $this->receivedWork[$wi]->feedback_date = $feedback_date; |
|
642 | - $this->receivedWork[$wi]->feedback = $text; |
|
640 | + $feedback_date = api_get_utc_datetime(); |
|
641 | + $this->receivedWork[$wi]->feedback_date = $feedback_date; |
|
642 | + $this->receivedWork[$wi]->feedback = $text; |
|
643 | 643 | |
644 | 644 | $params = [ |
645 | 645 | 'feedback_date' => $feedback_date, |
@@ -657,11 +657,11 @@ discard block |
||
657 | 657 | ] |
658 | 658 | ); |
659 | 659 | |
660 | - // Update item_property table |
|
660 | + // Update item_property table |
|
661 | 661 | $mailId = get_mail_id_base(); |
662 | - if (($ownerid = $this->receivedWork[$wi]->uploader_id) > $mailId) { |
|
663 | - $ownerid = getUserOwningThisMailing($ownerid); |
|
664 | - } |
|
662 | + if (($ownerid = $this->receivedWork[$wi]->uploader_id) > $mailId) { |
|
663 | + $ownerid = getUserOwningThisMailing($ownerid); |
|
664 | + } |
|
665 | 665 | |
666 | 666 | api_item_property_update( |
667 | 667 | $_course, |
@@ -673,33 +673,33 @@ discard block |
||
673 | 673 | $ownerid |
674 | 674 | ); |
675 | 675 | |
676 | - } |
|
676 | + } |
|
677 | 677 | |
678 | - /** |
|
679 | - * Filter the received work |
|
680 | - * @param string $type |
|
681 | - * @param string $value |
|
682 | - */ |
|
683 | - public function filter_received_work($type, $value) |
|
678 | + /** |
|
679 | + * Filter the received work |
|
680 | + * @param string $type |
|
681 | + * @param string $value |
|
682 | + */ |
|
683 | + public function filter_received_work($type, $value) |
|
684 | 684 | { |
685 | 685 | $dropbox_cnf = getDropboxConf(); |
686 | - $new_received_work = array(); |
|
686 | + $new_received_work = array(); |
|
687 | 687 | $mailId = get_mail_id_base(); |
688 | 688 | foreach ($this->receivedWork as $work) { |
689 | - switch ($type) { |
|
690 | - case 'uploader_id': |
|
691 | - if ($work->uploader_id == $value || |
|
692 | - ($work->uploader_id > $mailId && |
|
689 | + switch ($type) { |
|
690 | + case 'uploader_id': |
|
691 | + if ($work->uploader_id == $value || |
|
692 | + ($work->uploader_id > $mailId && |
|
693 | 693 | getUserOwningThisMailing($work->uploader_id) == $value) |
694 | 694 | ) { |
695 | - $new_received_work[] = $work; |
|
696 | - } |
|
697 | - break; |
|
698 | - default: |
|
699 | - $new_received_work[] = $work; |
|
695 | + $new_received_work[] = $work; |
|
696 | + } |
|
700 | 697 | break; |
701 | - } |
|
702 | - } |
|
703 | - $this->receivedWork = $new_received_work; |
|
704 | - } |
|
698 | + default: |
|
699 | + $new_received_work[] = $work; |
|
700 | + break; |
|
701 | + } |
|
702 | + } |
|
703 | + $this->receivedWork = $new_received_work; |
|
704 | + } |
|
705 | 705 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * As a consequence this parameter can be removed |
91 | 91 | */ |
92 | 92 | public function _createNewWork($uploader_id, $title, $description, $author, $filename, $filesize) |
93 | - { |
|
93 | + { |
|
94 | 94 | // Fill in the properties |
95 | 95 | $this->uploader_id = intval($uploader_id); |
96 | 96 | $this->filename = $filename; |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * @param int $id |
174 | 174 | */ |
175 | 175 | public function _createExistingWork($id) |
176 | - { |
|
176 | + { |
|
177 | 177 | $course_id = api_get_course_int_id(); |
178 | 178 | |
179 | 179 | $action = isset($_GET['action']) ? $_GET['action'] : null; |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * @return bool |
229 | 229 | */ |
230 | 230 | public function updateFile() |
231 | - { |
|
231 | + { |
|
232 | 232 | $course_id = api_get_course_int_id(); |
233 | 233 | if (empty($this->id) || empty($course_id)) { |
234 | 234 | return false; |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | * @return Dropbox_SentWork |
274 | 274 | */ |
275 | 275 | public function __construct($arg1, $arg2 = null, $arg3 = null, $arg4 = null, $arg5 = null, $arg6 = null, $arg7 = null) |
276 | - { |
|
276 | + { |
|
277 | 277 | if (func_num_args() > 1) { |
278 | 278 | $this->_createNewSentWork($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7); |
279 | 279 | } else { |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | * @param array $recipient_ids |
294 | 294 | */ |
295 | 295 | public function _createNewSentWork($uploader_id, $title, $description, $author, $filename, $filesize, $recipient_ids) |
296 | - { |
|
296 | + { |
|
297 | 297 | $_course = api_get_course_info(); |
298 | 298 | |
299 | 299 | // Call constructor of Dropbox_Work object |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | * @param int $id |
390 | 390 | */ |
391 | 391 | public function _createExistingSentWork($id) |
392 | - { |
|
392 | + { |
|
393 | 393 | $id = intval($id); |
394 | 394 | $course_id = api_get_course_int_id(); |
395 | 395 | |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | * @return Dropbox_Person |
442 | 442 | */ |
443 | 443 | public function __construct($userId, $isCourseAdmin, $isCourseTutor) |
444 | - { |
|
444 | + { |
|
445 | 445 | $course_id = api_get_course_int_id(); |
446 | 446 | |
447 | 447 | // Fill in properties |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | * Deletes all the received work of this person |
496 | 496 | */ |
497 | 497 | public function deleteAllReceivedWork() |
498 | - { |
|
498 | + { |
|
499 | 499 | $course_id = api_get_course_int_id(); |
500 | 500 | // Delete entries in person table concerning received works |
501 | 501 | foreach ($this->receivedWork as $w) { |
@@ -512,19 +512,25 @@ discard block |
||
512 | 512 | * @param integer $id |
513 | 513 | */ |
514 | 514 | public function deleteReceivedWorkFolder($id) |
515 | - { |
|
515 | + { |
|
516 | 516 | $course_id = api_get_course_int_id(); |
517 | 517 | |
518 | 518 | $id = intval($id); |
519 | 519 | $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_FILE)." |
520 | 520 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
521 | - if (!Database::query($sql)) return false; |
|
521 | + if (!Database::query($sql)) { |
|
522 | + return false; |
|
523 | + } |
|
522 | 524 | $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_CATEGORY)." |
523 | 525 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
524 | - if (!Database::query($sql)) return false; |
|
526 | + if (!Database::query($sql)) { |
|
527 | + return false; |
|
528 | + } |
|
525 | 529 | $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_POST)." |
526 | 530 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
527 | - if (!Database::query($sql)) return false; |
|
531 | + if (!Database::query($sql)) { |
|
532 | + return false; |
|
533 | + } |
|
528 | 534 | return true; |
529 | 535 | } |
530 | 536 | |
@@ -534,7 +540,7 @@ discard block |
||
534 | 540 | * @param integer $id |
535 | 541 | */ |
536 | 542 | public function deleteReceivedWork($id) |
537 | - { |
|
543 | + { |
|
538 | 544 | $course_id = api_get_course_int_id(); |
539 | 545 | $id = intval($id); |
540 | 546 | |
@@ -563,7 +569,7 @@ discard block |
||
563 | 569 | * Deletes all the sent dropbox files of this person |
564 | 570 | */ |
565 | 571 | public function deleteAllSentWork() |
566 | - { |
|
572 | + { |
|
567 | 573 | $course_id = api_get_course_int_id(); |
568 | 574 | //delete entries in person table concerning sent works |
569 | 575 | foreach ($this->sentWork as $w) { |
@@ -581,7 +587,7 @@ discard block |
||
581 | 587 | * @param int $id |
582 | 588 | */ |
583 | 589 | public function deleteSentWork($id) |
584 | - { |
|
590 | + { |
|
585 | 591 | $course_id = api_get_course_int_id(); |
586 | 592 | |
587 | 593 | $id = intval($id); |
@@ -615,7 +621,7 @@ discard block |
||
615 | 621 | * @param string $text |
616 | 622 | */ |
617 | 623 | public function updateFeedback($id, $text) |
618 | - { |
|
624 | + { |
|
619 | 625 | $course_id = api_get_course_int_id(); |
620 | 626 | $_course = api_get_course_info(); |
621 | 627 | $dropbox_cnf = getDropboxConf(); |
@@ -681,7 +687,7 @@ discard block |
||
681 | 687 | * @param string $value |
682 | 688 | */ |
683 | 689 | public function filter_received_work($type, $value) |
684 | - { |
|
690 | + { |
|
685 | 691 | $dropbox_cnf = getDropboxConf(); |
686 | 692 | $new_received_work = array(); |
687 | 693 | $mailId = get_mail_id_base(); |
@@ -9,6 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Validates the imported data. |
12 | + * @param Ddeboer\DataImport\Reader\CsvReader $users_courses |
|
12 | 13 | */ |
13 | 14 | function validate_data($users_courses) |
14 | 15 | { |
@@ -65,6 +66,7 @@ discard block |
||
65 | 66 | |
66 | 67 | /** |
67 | 68 | * Saves imported data. |
69 | + * @param Ddeboer\DataImport\Reader\CsvReader $users_courses |
|
68 | 70 | */ |
69 | 71 | function save_data($users_courses) |
70 | 72 | { |
@@ -133,7 +135,7 @@ discard block |
||
133 | 135 | /** |
134 | 136 | * Reads CSV-file. |
135 | 137 | * @param string $file Path to the CSV-file |
136 | - * @return array All course-information read from the file |
|
138 | + * @return Ddeboer\DataImport\Reader\CsvReader All course-information read from the file |
|
137 | 139 | */ |
138 | 140 | function parse_csv_data($file) |
139 | 141 | { |
@@ -8,6 +8,7 @@ discard block |
||
8 | 8 | */ |
9 | 9 | /** |
10 | 10 | * Validates the imported data. |
11 | + * @param Ddeboer\DataImport\Reader\CsvReader $users_courses |
|
11 | 12 | */ |
12 | 13 | function validate_data($users_courses) |
13 | 14 | { |
@@ -66,6 +67,7 @@ discard block |
||
66 | 67 | |
67 | 68 | /** |
68 | 69 | * Saves imported data. |
70 | + * @param Ddeboer\DataImport\Reader\CsvReader $users_courses |
|
69 | 71 | */ |
70 | 72 | function save_data($users_courses) |
71 | 73 | { |
@@ -134,7 +136,7 @@ discard block |
||
134 | 136 | /** |
135 | 137 | * Reads CSV-file. |
136 | 138 | * @param string $file Path to the CSV-file |
137 | - * @return array All course-information read from the file |
|
139 | + * @return Ddeboer\DataImport\Reader\CsvReader All course-information read from the file |
|
138 | 140 | */ |
139 | 141 | function parse_csv_data($file) |
140 | 142 | { |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Validate the imported data. |
15 | - * @param $skills |
|
15 | + * @param Ddeboer\DataImport\Reader\CsvReader $skills |
|
16 | 16 | * @return array |
17 | 17 | */ |
18 | 18 | function validate_data($skills) |
@@ -50,6 +50,7 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * Save the imported data |
52 | 52 | * @param array List of users |
53 | + * @param Ddeboer\DataImport\Reader\CsvReader $skills |
|
53 | 54 | * @return void |
54 | 55 | * @uses global variable $inserted_in_course, |
55 | 56 | * which returns the list of courses the user was inserted in |
@@ -77,7 +78,7 @@ discard block |
||
77 | 78 | /** |
78 | 79 | * Read the CSV-file |
79 | 80 | * @param string $file Path to the CSV-file |
80 | - * @return array All userinformation read from the file |
|
81 | + * @return Ddeboer\DataImport\Reader\CsvReader All userinformation read from the file |
|
81 | 82 | */ |
82 | 83 | function parse_csv_data($file) |
83 | 84 | { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $oskill = new Skill(); |
71 | 71 | $skill_id = $oskill->add($skill); |
72 | 72 | $parents[$saved_id] = $skill_id; |
73 | - } |
|
73 | + } |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | |
@@ -81,12 +81,12 @@ discard block |
||
81 | 81 | */ |
82 | 82 | function parse_csv_data($file) |
83 | 83 | { |
84 | - $skills = Import :: csvToArray($file); |
|
85 | - foreach ($skills as $index => $skill) { |
|
86 | - $skills[$index] = $skill; |
|
87 | - } |
|
84 | + $skills = Import :: csvToArray($file); |
|
85 | + foreach ($skills as $index => $skill) { |
|
86 | + $skills[$index] = $skill; |
|
87 | + } |
|
88 | 88 | |
89 | - return $skills; |
|
89 | + return $skills; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | */ |
95 | 95 | function element_start($parser, $data) |
96 | 96 | { |
97 | - $data = api_utf8_decode($data); |
|
97 | + $data = api_utf8_decode($data); |
|
98 | 98 | global $skill; |
99 | 99 | global $current_tag; |
100 | 100 | switch ($data) { |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | function element_end($parser, $data) |
113 | 113 | { |
114 | - $data = api_utf8_decode($data); |
|
114 | + $data = api_utf8_decode($data); |
|
115 | 115 | global $skill; |
116 | 116 | global $skills; |
117 | 117 | global $current_value; |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | */ |
131 | 131 | function character_data($parser, $data) |
132 | 132 | { |
133 | - $data = trim(api_utf8_decode($data)); |
|
134 | - global $current_value; |
|
135 | - $current_value = $data; |
|
133 | + $data = trim(api_utf8_decode($data)); |
|
134 | + global $current_value; |
|
135 | + $current_value = $data; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | xml_parse($parser, api_utf8_encode_xml(file_get_contents($file))); |
155 | 155 | xml_parser_free($parser); |
156 | 156 | |
157 | - return $skills; |
|
157 | + return $skills; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | $this_section = SECTION_PLATFORM_ADMIN; |
@@ -277,7 +277,7 @@ |
||
277 | 277 | ); |
278 | 278 | |
279 | 279 | |
280 | -$actions = '<div class="actions">' . $toolbar . '</div>'; |
|
280 | +$actions = '<div class="actions">'.$toolbar.'</div>'; |
|
281 | 281 | |
282 | 282 | echo $actions; |
283 | 283 |
@@ -15,6 +15,9 @@ discard block |
||
15 | 15 | // Set this option to true to enforce strict purification for usenames. |
16 | 16 | $purification_option_for_usernames = false; |
17 | 17 | |
18 | +/** |
|
19 | + * @param Ddeboer\DataImport\Reader\CsvReader $users |
|
20 | + */ |
|
18 | 21 | function validate_data($users) |
19 | 22 | { |
20 | 23 | global $defined_auth_sources; |
@@ -228,7 +231,7 @@ discard block |
||
228 | 231 | /** |
229 | 232 | * Read the CSV-file |
230 | 233 | * @param string $file Path to the CSV-file |
231 | - * @return array All userinformation read from the file |
|
234 | + * @return Ddeboer\DataImport\Reader\CsvReader All userinformation read from the file |
|
232 | 235 | */ |
233 | 236 | function parse_csv_data($file) |
234 | 237 | { |
@@ -464,7 +464,10 @@ |
||
464 | 464 | <blockquote> |
465 | 465 | <pre> |
466 | 466 | <b>UserName</b>;LastName;FirstName;Email;NewUserName;Password;AuthSource;OfficialCode;PhoneNumber;Status;ExpiryDate;Active;Language;Courses;ClassId; |
467 | - xxx;xxx;xxx;xxx;xxx;xxx;xxx;xxx;xxx;user/teacher/drh;YYYY-MM-DD 00:00:00;0/1;xxx;<span style="color:red;"><?php if (count($list_reponse) > 0) echo implode(';', $list_reponse).';'; ?></span>xxx1|xxx2|xxx3;1;<br /> |
|
467 | + xxx;xxx;xxx;xxx;xxx;xxx;xxx;xxx;xxx;user/teacher/drh;YYYY-MM-DD 00:00:00;0/1;xxx;<span style="color:red;"><?php if (count($list_reponse) > 0) { |
|
468 | + echo implode(';', $list_reponse).';'; |
|
469 | +} |
|
470 | +?></span>xxx1|xxx2|xxx3;1;<br /> |
|
468 | 471 | </pre> |
469 | 472 | </blockquote> |
470 | 473 | <p><?php |
@@ -9,6 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Validates imported data. |
12 | + * @param Ddeboer\DataImport\Reader\CsvReader $classes |
|
12 | 13 | */ |
13 | 14 | function validate_data($classes) { |
14 | 15 | $errors = array(); |
@@ -36,7 +37,7 @@ discard block |
||
36 | 37 | /** |
37 | 38 | * Save imported class data to database |
38 | 39 | * |
39 | - * @param $classes |
|
40 | + * @param Ddeboer\DataImport\Reader\CsvReader $classes |
|
40 | 41 | * |
41 | 42 | * @return int |
42 | 43 | */ |
@@ -10,7 +10,8 @@ |
||
10 | 10 | /** |
11 | 11 | * Validates imported data. |
12 | 12 | */ |
13 | -function validate_data($classes) { |
|
13 | +function validate_data($classes) |
|
14 | +{ |
|
14 | 15 | $errors = array(); |
15 | 16 | $usergroup = new UserGroup(); |
16 | 17 | foreach ($classes as $index => $class) { |
@@ -11,6 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | /** |
13 | 13 | * Validates imported data. |
14 | + * @param Ddeboer\DataImport\Reader\CsvReader $user_classes |
|
14 | 15 | */ |
15 | 16 | function validate_data($user_classes) { |
16 | 17 | global $purification_option_for_usernames; |
@@ -66,6 +67,7 @@ discard block |
||
66 | 67 | |
67 | 68 | /** |
68 | 69 | * Saves imported data. |
70 | + * @param Ddeboer\DataImport\Reader\CsvReader $users_classes |
|
69 | 71 | */ |
70 | 72 | function save_data($users_classes, $deleteUsersNotInList = false) { |
71 | 73 | |
@@ -115,7 +117,7 @@ discard block |
||
115 | 117 | /** |
116 | 118 | * Reads a CSV-file. |
117 | 119 | * @param string $file Path to the CSV-file |
118 | - * @return array All course-information read from the file |
|
120 | + * @return Ddeboer\DataImport\Reader\CsvReader All course-information read from the file |
|
119 | 121 | */ |
120 | 122 | function parse_csv_data($file) { |
121 | 123 | $courses = Import::csvToArray($file); |
@@ -12,7 +12,8 @@ discard block |
||
12 | 12 | /** |
13 | 13 | * Validates imported data. |
14 | 14 | */ |
15 | -function validate_data($user_classes) { |
|
15 | +function validate_data($user_classes) |
|
16 | +{ |
|
16 | 17 | global $purification_option_for_usernames; |
17 | 18 | $errors = array(); |
18 | 19 | $classcodes = array(); |
@@ -67,7 +68,8 @@ discard block |
||
67 | 68 | /** |
68 | 69 | * Saves imported data. |
69 | 70 | */ |
70 | -function save_data($users_classes, $deleteUsersNotInList = false) { |
|
71 | +function save_data($users_classes, $deleteUsersNotInList = false) |
|
72 | +{ |
|
71 | 73 | |
72 | 74 | global $purification_option_for_usernames; |
73 | 75 | |
@@ -117,7 +119,8 @@ discard block |
||
117 | 119 | * @param string $file Path to the CSV-file |
118 | 120 | * @return array All course-information read from the file |
119 | 121 | */ |
120 | -function parse_csv_data($file) { |
|
122 | +function parse_csv_data($file) |
|
123 | +{ |
|
121 | 124 | $courses = Import::csvToArray($file); |
122 | 125 | return $courses; |
123 | 126 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | * @param array $data |
39 | 39 | * @param string $filename |
40 | 40 | * |
41 | - * @return mixed csv file | false if no data to export |
|
41 | + * @return false|null csv file | false if no data to export |
|
42 | 42 | */ |
43 | 43 | public static function arrayToCsv($data, $filename = 'export') |
44 | 44 | { |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @param string Name of common tag to place each line in |
161 | 161 | * @param string Name of the root element. A root element should always be given. |
162 | 162 | * @param string Encoding in which the data is provided |
163 | - * @return void Prompts the user for a file download |
|
163 | + * @return boolean Prompts the user for a file download |
|
164 | 164 | */ |
165 | 165 | public static function export_complex_table_xml( |
166 | 166 | $data, |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | * @param string $name |
287 | 287 | * @param string $format |
288 | 288 | * |
289 | - * @return bool |
|
289 | + * @return false|null |
|
290 | 290 | */ |
291 | 291 | public static function htmlToOdt($html, $name, $format = 'odt') |
292 | 292 | { |
@@ -115,13 +115,13 @@ discard block |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
118 | - * Export tabular data to XML-file |
|
119 | - * @param array Simple array of data to put in XML |
|
120 | - * @param string Name of file to be given to the user |
|
121 | - * @param string Name of common tag to place each line in |
|
122 | - * @param string Name of the root element. A root element should always be given. |
|
123 | - * @param string Encoding in which the data is provided |
|
124 | - */ |
|
118 | + * Export tabular data to XML-file |
|
119 | + * @param array Simple array of data to put in XML |
|
120 | + * @param string Name of file to be given to the user |
|
121 | + * @param string Name of common tag to place each line in |
|
122 | + * @param string Name of the root element. A root element should always be given. |
|
123 | + * @param string Encoding in which the data is provided |
|
124 | + */ |
|
125 | 125 | public static function arrayToXml( |
126 | 126 | $data, |
127 | 127 | $filename = 'export', |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | foreach ($data as $row) { |
201 | 201 | $string .= "\n".str_repeat("\t", $level).'<'.$row['name'].'>'; |
202 | 202 | if (is_array($row['value'])) { |
203 | - $string .= self::_export_complex_table_xml_helper($row['value'], $level + 1)."\n"; |
|
203 | + $string .= self::_export_complex_table_xml_helper($row['value'], $level + 1)."\n"; |
|
204 | 204 | $string .= str_repeat("\t", $level).'</'.$row['name'].'>'; |
205 | 205 | } else { |
206 | 206 | $string .= $row['value']; |
@@ -94,12 +94,12 @@ |
||
94 | 94 | */ |
95 | 95 | protected $assignedLastUser; |
96 | 96 | |
97 | - /** |
|
98 | - * @var Status |
|
99 | - * |
|
100 | - * @ORM\ManyToOne(targetEntity="Chamilo\TicketBundle\Entity\Status") |
|
101 | - * @ORM\JoinColumn(name="status_id", referencedColumnName="id") |
|
102 | - **/ |
|
97 | + /** |
|
98 | + * @var Status |
|
99 | + * |
|
100 | + * @ORM\ManyToOne(targetEntity="Chamilo\TicketBundle\Entity\Status") |
|
101 | + * @ORM\JoinColumn(name="status_id", referencedColumnName="id") |
|
102 | + **/ |
|
103 | 103 | protected $status; |
104 | 104 | |
105 | 105 | /** |