@@ -1,8 +1,8 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | /* For licensing terms, see /license.txt */ |
| 3 | 3 | /** |
| 4 | - * @package chamilo.dropbox |
|
| 5 | - */ |
|
| 4 | + * @package chamilo.dropbox |
|
| 5 | + */ |
|
| 6 | 6 | |
| 7 | 7 | // including the basic Chamilo initialisation file |
| 8 | 8 | require_once '../inc/global.inc.php'; |
@@ -89,7 +89,7 @@ discard block |
||
| 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 |
@@ -77,20 +77,20 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * private function creating a new work object |
|
| 82 | - * |
|
| 83 | - * @param int $uploader_id |
|
| 84 | - * @param string $title |
|
| 85 | - * @param string $description |
|
| 86 | - * @param string $author |
|
| 87 | - * @param string $filename |
|
| 88 | - * @param int $filesize |
|
| 89 | - * |
|
| 90 | - * @todo $author was originally a field but this has now been replaced by the first and lastname of the uploader (to prevent anonymous uploads) |
|
| 91 | - * As a consequence this parameter can be removed |
|
| 92 | - */ |
|
| 93 | - public function _createNewWork($uploader_id, $title, $description, $author, $filename, $filesize) |
|
| 80 | + /** |
|
| 81 | + * private function creating a new work object |
|
| 82 | + * |
|
| 83 | + * @param int $uploader_id |
|
| 84 | + * @param string $title |
|
| 85 | + * @param string $description |
|
| 86 | + * @param string $author |
|
| 87 | + * @param string $filename |
|
| 88 | + * @param int $filesize |
|
| 89 | + * |
|
| 90 | + * @todo $author was originally a field but this has now been replaced by the first and lastname of the uploader (to prevent anonymous uploads) |
|
| 91 | + * As a consequence this parameter can be removed |
|
| 92 | + */ |
|
| 93 | + public function _createNewWork($uploader_id, $title, $description, $author, $filename, $filesize) |
|
| 94 | 94 | { |
| 95 | 95 | $dropbox_cnf = getDropboxConf(); |
| 96 | 96 | |
@@ -108,17 +108,17 @@ discard block |
||
| 108 | 108 | // Check if object exists already. If it does, the old object is used |
| 109 | 109 | // with updated information (authors, description, upload_date) |
| 110 | 110 | $this->isOldWork = false; |
| 111 | - $sql = "SELECT id, upload_date FROM ".$dropbox_cnf['tbl_file']." |
|
| 111 | + $sql = "SELECT id, upload_date FROM ".$dropbox_cnf['tbl_file']." |
|
| 112 | 112 | WHERE c_id = $course_id AND filename = '".Database::escape_string($this->filename)."'"; |
| 113 | 113 | $result = Database::query($sql); |
| 114 | - $res = Database::fetch_array($result); |
|
| 115 | - if ($res) { |
|
| 116 | - $this->isOldWork = true; |
|
| 117 | - } |
|
| 118 | - // Insert or update the dropbox_file table and set the id property |
|
| 119 | - if ($this->isOldWork) { |
|
| 120 | - $this->id = $res['id']; |
|
| 121 | - $this->upload_date = $res['upload_date']; |
|
| 114 | + $res = Database::fetch_array($result); |
|
| 115 | + if ($res) { |
|
| 116 | + $this->isOldWork = true; |
|
| 117 | + } |
|
| 118 | + // Insert or update the dropbox_file table and set the id property |
|
| 119 | + if ($this->isOldWork) { |
|
| 120 | + $this->id = $res['id']; |
|
| 121 | + $this->upload_date = $res['upload_date']; |
|
| 122 | 122 | |
| 123 | 123 | $params = [ |
| 124 | 124 | 'filesize' => $this->filesize, |
@@ -135,9 +135,9 @@ discard block |
||
| 135 | 135 | ['c_id = ? AND id = ?' => [$course_id, $this->id]] |
| 136 | 136 | ); |
| 137 | 137 | |
| 138 | - } else { |
|
| 139 | - $this->upload_date = $this->last_upload_date; |
|
| 140 | - $params = [ |
|
| 138 | + } else { |
|
| 139 | + $this->upload_date = $this->last_upload_date; |
|
| 140 | + $params = [ |
|
| 141 | 141 | 'c_id' => $course_id, |
| 142 | 142 | 'uploader_id' => $this->uploader_id, |
| 143 | 143 | 'filename' => $this->filename, |
@@ -148,14 +148,14 @@ discard block |
||
| 148 | 148 | 'upload_date' => $this->upload_date, |
| 149 | 149 | 'last_upload_date' => $this->last_upload_date, |
| 150 | 150 | 'session_id' => api_get_session_id(), |
| 151 | - ]; |
|
| 152 | - $this->id = Database::insert($dropbox_cnf['tbl_file'], $params); |
|
| 151 | + ]; |
|
| 152 | + $this->id = Database::insert($dropbox_cnf['tbl_file'], $params); |
|
| 153 | 153 | |
| 154 | - if ($this->id) { |
|
| 155 | - $sql = "UPDATE ".$dropbox_cnf['tbl_file']." SET id = iid WHERE iid = {$this->id}"; |
|
| 156 | - Database::query($sql); |
|
| 157 | - } |
|
| 158 | - } |
|
| 154 | + if ($this->id) { |
|
| 155 | + $sql = "UPDATE ".$dropbox_cnf['tbl_file']." SET id = iid WHERE iid = {$this->id}"; |
|
| 156 | + Database::query($sql); |
|
| 157 | + } |
|
| 158 | + } |
|
| 159 | 159 | |
| 160 | 160 | $sql = "SELECT count(file_id) as count |
| 161 | 161 | FROM ".$dropbox_cnf['tbl_person']." |
@@ -169,16 +169,16 @@ discard block |
||
| 169 | 169 | VALUES ($course_id, ".intval($this->id)." , ".intval($this->uploader_id).")"; |
| 170 | 170 | Database::query($sql); |
| 171 | 171 | } |
| 172 | - } |
|
| 173 | - |
|
| 174 | - /** |
|
| 175 | - * private function creating existing object by retreiving info from db |
|
| 176 | - * |
|
| 177 | - * @param int $id |
|
| 178 | - */ |
|
| 179 | - public function _createExistingWork($id) |
|
| 172 | + } |
|
| 173 | + |
|
| 174 | + /** |
|
| 175 | + * private function creating existing object by retreiving info from db |
|
| 176 | + * |
|
| 177 | + * @param int $id |
|
| 178 | + */ |
|
| 179 | + public function _createExistingWork($id) |
|
| 180 | 180 | { |
| 181 | - $course_id = api_get_course_int_id(); |
|
| 181 | + $course_id = api_get_course_int_id(); |
|
| 182 | 182 | $dropbox_cnf = getDropboxConf(); |
| 183 | 183 | |
| 184 | 184 | $action = isset($_GET['action']) ? $_GET['action'] : null; |
@@ -228,52 +228,52 @@ discard block |
||
| 228 | 228 | } |
| 229 | 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 |
|
| 237 | - |
|
| 238 | - /** |
|
| 239 | - * Constructor calls private functions to create a new work or retreive an existing work from DB |
|
| 240 | - * depending on the number of parameters |
|
| 241 | - * |
|
| 242 | - * @param unknown_type $arg1 |
|
| 243 | - * @param unknown_type $arg2 |
|
| 244 | - * @param unknown_type $arg3 |
|
| 245 | - * @param unknown_type $arg4 |
|
| 246 | - * @param unknown_type $arg5 |
|
| 247 | - * @param unknown_type $arg6 |
|
| 248 | - * @param unknown_type $arg7 |
|
| 249 | - * @return Dropbox_SentWork |
|
| 250 | - */ |
|
| 251 | - function Dropbox_SentWork($arg1, $arg2 = null, $arg3 = null, $arg4 = null, $arg5 = null, $arg6 = null, $arg7 = null) |
|
| 236 | + public $recipients; //array of ['id']['name'] arrays |
|
| 237 | + |
|
| 238 | + /** |
|
| 239 | + * Constructor calls private functions to create a new work or retreive an existing work from DB |
|
| 240 | + * depending on the number of parameters |
|
| 241 | + * |
|
| 242 | + * @param unknown_type $arg1 |
|
| 243 | + * @param unknown_type $arg2 |
|
| 244 | + * @param unknown_type $arg3 |
|
| 245 | + * @param unknown_type $arg4 |
|
| 246 | + * @param unknown_type $arg5 |
|
| 247 | + * @param unknown_type $arg6 |
|
| 248 | + * @param unknown_type $arg7 |
|
| 249 | + * @return Dropbox_SentWork |
|
| 250 | + */ |
|
| 251 | + function Dropbox_SentWork($arg1, $arg2 = null, $arg3 = null, $arg4 = null, $arg5 = null, $arg6 = null, $arg7 = null) |
|
| 252 | 252 | { |
| 253 | - if (func_num_args() > 1) { |
|
| 254 | - $this->_createNewSentWork($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7); |
|
| 255 | - } else { |
|
| 256 | - $this->_createExistingSentWork($arg1); |
|
| 257 | - } |
|
| 258 | - } |
|
| 259 | - |
|
| 260 | - /** |
|
| 261 | - * private function creating a new SentWork object |
|
| 262 | - * |
|
| 263 | - * @param int $uploader_id |
|
| 264 | - * @param string $title |
|
| 265 | - * @param string $description |
|
| 266 | - * @param string $author |
|
| 267 | - * @param string $filename |
|
| 268 | - * @param int $filesize |
|
| 269 | - * @param array $recipient_ids |
|
| 270 | - */ |
|
| 271 | - public function _createNewSentWork($uploader_id, $title, $description, $author, $filename, $filesize, $recipient_ids) |
|
| 253 | + if (func_num_args() > 1) { |
|
| 254 | + $this->_createNewSentWork($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7); |
|
| 255 | + } else { |
|
| 256 | + $this->_createExistingSentWork($arg1); |
|
| 257 | + } |
|
| 258 | + } |
|
| 259 | + |
|
| 260 | + /** |
|
| 261 | + * private function creating a new SentWork object |
|
| 262 | + * |
|
| 263 | + * @param int $uploader_id |
|
| 264 | + * @param string $title |
|
| 265 | + * @param string $description |
|
| 266 | + * @param string $author |
|
| 267 | + * @param string $filename |
|
| 268 | + * @param int $filesize |
|
| 269 | + * @param array $recipient_ids |
|
| 270 | + */ |
|
| 271 | + public function _createNewSentWork($uploader_id, $title, $description, $author, $filename, $filesize, $recipient_ids) |
|
| 272 | 272 | { |
| 273 | 273 | $dropbox_cnf = getDropboxConf(); |
| 274 | 274 | $_course = api_get_course_info(); |
| 275 | 275 | |
| 276 | - // Call constructor of Dropbox_Work object |
|
| 276 | + // Call constructor of Dropbox_Work object |
|
| 277 | 277 | $this->Dropbox_Work( |
| 278 | 278 | $uploader_id, |
| 279 | 279 | $title, |
@@ -283,44 +283,44 @@ discard block |
||
| 283 | 283 | $filesize |
| 284 | 284 | ); |
| 285 | 285 | |
| 286 | - $course_id = api_get_course_int_id(); |
|
| 287 | - |
|
| 288 | - // Do sanity checks on recipient_ids array & property fillin |
|
| 289 | - // The sanity check for ex-coursemembers is already done in base constructor |
|
| 290 | - settype($uploader_id, 'integer') or die(get_lang('GeneralError').' (code 208)'); // Set $uploader_id to correct type |
|
| 286 | + $course_id = api_get_course_int_id(); |
|
| 291 | 287 | |
| 292 | - $justSubmit = false; |
|
| 293 | - if ( is_int($recipient_ids)) { |
|
| 294 | - $justSubmit = true; |
|
| 295 | - $recipient_ids = array($recipient_ids + $this->id); |
|
| 296 | - } elseif ( count($recipient_ids) == 0) { |
|
| 297 | - $justSubmit = true; |
|
| 298 | - $recipient_ids = array($uploader_id); |
|
| 299 | - } |
|
| 288 | + // Do sanity checks on recipient_ids array & property fillin |
|
| 289 | + // The sanity check for ex-coursemembers is already done in base constructor |
|
| 290 | + settype($uploader_id, 'integer') or die(get_lang('GeneralError').' (code 208)'); // Set $uploader_id to correct type |
|
| 291 | + |
|
| 292 | + $justSubmit = false; |
|
| 293 | + if ( is_int($recipient_ids)) { |
|
| 294 | + $justSubmit = true; |
|
| 295 | + $recipient_ids = array($recipient_ids + $this->id); |
|
| 296 | + } elseif ( count($recipient_ids) == 0) { |
|
| 297 | + $justSubmit = true; |
|
| 298 | + $recipient_ids = array($uploader_id); |
|
| 299 | + } |
|
| 300 | 300 | |
| 301 | - if (! is_array($recipient_ids) || count($recipient_ids) == 0) { |
|
| 302 | - die(get_lang('GeneralError').' (code 209)'); |
|
| 303 | - } |
|
| 301 | + if (! is_array($recipient_ids) || count($recipient_ids) == 0) { |
|
| 302 | + die(get_lang('GeneralError').' (code 209)'); |
|
| 303 | + } |
|
| 304 | 304 | |
| 305 | - foreach ($recipient_ids as $rec) { |
|
| 306 | - if (empty($rec)) die(get_lang('GeneralError').' (code 210)'); |
|
| 307 | - //if (!isCourseMember($rec)) die(); //cannot sent document to someone outside of course |
|
| 308 | - //this check is done when validating submitted data |
|
| 309 | - $this->recipients[] = array('id' => $rec, 'name' => getUserNameFromId($rec)); |
|
| 310 | - } |
|
| 305 | + foreach ($recipient_ids as $rec) { |
|
| 306 | + if (empty($rec)) die(get_lang('GeneralError').' (code 210)'); |
|
| 307 | + //if (!isCourseMember($rec)) die(); //cannot sent document to someone outside of course |
|
| 308 | + //this check is done when validating submitted data |
|
| 309 | + $this->recipients[] = array('id' => $rec, 'name' => getUserNameFromId($rec)); |
|
| 310 | + } |
|
| 311 | 311 | |
| 312 | 312 | $table_post = $dropbox_cnf['tbl_post']; |
| 313 | 313 | $table_person = $dropbox_cnf['tbl_person']; |
| 314 | 314 | $session_id = api_get_session_id(); |
| 315 | 315 | $uploader_id = $this->uploader_id; |
| 316 | 316 | $user = api_get_user_id(); |
| 317 | - // Insert data in dropbox_post and dropbox_person table for each recipient |
|
| 318 | - foreach ($this->recipients as $rec) { |
|
| 317 | + // Insert data in dropbox_post and dropbox_person table for each recipient |
|
| 318 | + foreach ($this->recipients as $rec) { |
|
| 319 | 319 | $file_id = (int)$this->id; |
| 320 | 320 | $user_id = (int)$rec['id']; |
| 321 | - $sql = "INSERT INTO $table_post (c_id, file_id, dest_user_id, session_id) |
|
| 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 | - Database::query($sql); |
|
| 323 | + Database::query($sql); |
|
| 324 | 324 | // If work already exists no error is generated |
| 325 | 325 | |
| 326 | 326 | /** |
@@ -337,13 +337,13 @@ discard block |
||
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - // Update item_property table for each recipient |
|
| 341 | - if (($ownerid = $this->uploader_id) > $dropbox_cnf['mailingIdBase']) { |
|
| 342 | - $ownerid = getUserOwningThisMailing($ownerid); |
|
| 343 | - } |
|
| 344 | - if (($recipid = $rec["id"]) > $dropbox_cnf['mailingIdBase']) { |
|
| 345 | - $recipid = $ownerid; // mailing file recipient = mailing id, not a person |
|
| 346 | - } |
|
| 340 | + // Update item_property table for each recipient |
|
| 341 | + if (($ownerid = $this->uploader_id) > $dropbox_cnf['mailingIdBase']) { |
|
| 342 | + $ownerid = getUserOwningThisMailing($ownerid); |
|
| 343 | + } |
|
| 344 | + if (($recipid = $rec["id"]) > $dropbox_cnf['mailingIdBase']) { |
|
| 345 | + $recipid = $ownerid; // mailing file recipient = mailing id, not a person |
|
| 346 | + } |
|
| 347 | 347 | api_item_property_update( |
| 348 | 348 | $_course, |
| 349 | 349 | TOOL_DROPBOX, |
@@ -353,92 +353,92 @@ discard block |
||
| 353 | 353 | null, |
| 354 | 354 | $recipid |
| 355 | 355 | ); |
| 356 | - } |
|
| 357 | - } |
|
| 358 | - |
|
| 359 | - /** |
|
| 360 | - * private function creating existing object by retreiving info from db |
|
| 361 | - * |
|
| 362 | - * @param unknown_type $id |
|
| 363 | - */ |
|
| 364 | - function _createExistingSentWork($id) |
|
| 356 | + } |
|
| 357 | + } |
|
| 358 | + |
|
| 359 | + /** |
|
| 360 | + * private function creating existing object by retreiving info from db |
|
| 361 | + * |
|
| 362 | + * @param unknown_type $id |
|
| 363 | + */ |
|
| 364 | + function _createExistingSentWork($id) |
|
| 365 | 365 | { |
| 366 | 366 | $dropbox_cnf = getDropboxConf(); |
| 367 | 367 | $id = intval($id); |
| 368 | 368 | |
| 369 | - $course_id = api_get_course_int_id(); |
|
| 369 | + $course_id = api_get_course_int_id(); |
|
| 370 | 370 | |
| 371 | - // Call constructor of Dropbox_Work object |
|
| 372 | - $this->Dropbox_Work($id); |
|
| 371 | + // Call constructor of Dropbox_Work object |
|
| 372 | + $this->Dropbox_Work($id); |
|
| 373 | 373 | |
| 374 | - // Fill in recipients array |
|
| 375 | - $this->recipients = array(); |
|
| 376 | - $sql = "SELECT dest_user_id, feedback_date, feedback |
|
| 374 | + // Fill in recipients array |
|
| 375 | + $this->recipients = array(); |
|
| 376 | + $sql = "SELECT dest_user_id, feedback_date, feedback |
|
| 377 | 377 | FROM ".$dropbox_cnf['tbl_post']." |
| 378 | 378 | WHERE c_id = $course_id AND file_id = ".intval($id).""; |
| 379 | 379 | $result = Database::query($sql); |
| 380 | - while ($res = Database::fetch_array($result, 'ASSOC')) { |
|
| 381 | - |
|
| 382 | - // Check for deleted users |
|
| 383 | - $dest_user_id = $res['dest_user_id']; |
|
| 384 | - $user_info = api_get_user_info($dest_user_id); |
|
| 385 | - //$this->category = $res['cat_id']; |
|
| 386 | - if (!$user_info) { |
|
| 387 | - $this->recipients[] = array('id' => -1, 'name' => get_lang('Unknown', '')); |
|
| 388 | - } else { |
|
| 389 | - $this->recipients[] = array( |
|
| 380 | + while ($res = Database::fetch_array($result, 'ASSOC')) { |
|
| 381 | + |
|
| 382 | + // Check for deleted users |
|
| 383 | + $dest_user_id = $res['dest_user_id']; |
|
| 384 | + $user_info = api_get_user_info($dest_user_id); |
|
| 385 | + //$this->category = $res['cat_id']; |
|
| 386 | + if (!$user_info) { |
|
| 387 | + $this->recipients[] = array('id' => -1, 'name' => get_lang('Unknown', '')); |
|
| 388 | + } else { |
|
| 389 | + $this->recipients[] = array( |
|
| 390 | 390 | 'id' => $dest_user_id, |
| 391 | 391 | 'name' => $user_info['complete_name'], |
| 392 | 392 | 'user_id' => $dest_user_id, |
| 393 | - 'feedback_date' => $res['feedback_date'], |
|
| 393 | + 'feedback_date' => $res['feedback_date'], |
|
| 394 | 394 | 'feedback' => $res['feedback'] |
| 395 | 395 | ); |
| 396 | - } |
|
| 397 | - } |
|
| 398 | - } |
|
| 396 | + } |
|
| 397 | + } |
|
| 398 | + } |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | class Dropbox_Person |
| 402 | 402 | { |
| 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 |
|
| 406 | - |
|
| 407 | - public $userId = 0; |
|
| 408 | - public $isCourseAdmin = false; |
|
| 409 | - public $isCourseTutor = false; |
|
| 410 | - public $_orderBy = ''; // private property that determines by which field |
|
| 411 | - |
|
| 412 | - /** |
|
| 413 | - * Constructor for recreating the Dropbox_Person object |
|
| 414 | - * |
|
| 415 | - * @param int $userId |
|
| 416 | - * @param bool $isCourseAdmin |
|
| 417 | - * @param bool $isCourseTutor |
|
| 418 | - * @return Dropbox_Person |
|
| 419 | - */ |
|
| 420 | - function Dropbox_Person($userId, $isCourseAdmin, $isCourseTutor) |
|
| 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 |
|
| 406 | + |
|
| 407 | + public $userId = 0; |
|
| 408 | + public $isCourseAdmin = false; |
|
| 409 | + public $isCourseTutor = false; |
|
| 410 | + public $_orderBy = ''; // private property that determines by which field |
|
| 411 | + |
|
| 412 | + /** |
|
| 413 | + * Constructor for recreating the Dropbox_Person object |
|
| 414 | + * |
|
| 415 | + * @param int $userId |
|
| 416 | + * @param bool $isCourseAdmin |
|
| 417 | + * @param bool $isCourseTutor |
|
| 418 | + * @return Dropbox_Person |
|
| 419 | + */ |
|
| 420 | + function Dropbox_Person($userId, $isCourseAdmin, $isCourseTutor) |
|
| 421 | 421 | { |
| 422 | - $course_id = api_get_course_int_id(); |
|
| 422 | + $course_id = api_get_course_int_id(); |
|
| 423 | 423 | |
| 424 | - // Fill in properties |
|
| 424 | + // Fill in properties |
|
| 425 | 425 | $this->userId = $userId; |
| 426 | 426 | $this->isCourseAdmin = $isCourseAdmin; |
| 427 | 427 | $this->isCourseTutor = $isCourseTutor; |
| 428 | 428 | $this->receivedWork = array(); |
| 429 | 429 | $this->sentWork = array(); |
| 430 | 430 | |
| 431 | - // Note: perhaps include an ex coursemember check to delete old files |
|
| 431 | + // Note: perhaps include an ex coursemember check to delete old files |
|
| 432 | 432 | |
| 433 | - $session_id = api_get_session_id(); |
|
| 434 | - $condition_session = api_get_session_condition($session_id); |
|
| 433 | + $session_id = api_get_session_id(); |
|
| 434 | + $condition_session = api_get_session_condition($session_id); |
|
| 435 | 435 | |
| 436 | - $post_tbl = Database::get_course_table(TABLE_DROPBOX_POST); |
|
| 437 | - $person_tbl = Database::get_course_table(TABLE_DROPBOX_PERSON); |
|
| 438 | - $file_tbl = Database::get_course_table(TABLE_DROPBOX_FILE); |
|
| 436 | + $post_tbl = Database::get_course_table(TABLE_DROPBOX_POST); |
|
| 437 | + $person_tbl = Database::get_course_table(TABLE_DROPBOX_PERSON); |
|
| 438 | + $file_tbl = Database::get_course_table(TABLE_DROPBOX_FILE); |
|
| 439 | 439 | |
| 440 | 440 | // Find all entries where this person is the recipient |
| 441 | - $sql = "SELECT DISTINCT r.file_id, r.cat_id |
|
| 441 | + $sql = "SELECT DISTINCT r.file_id, r.cat_id |
|
| 442 | 442 | FROM $post_tbl r |
| 443 | 443 | INNER JOIN $person_tbl p |
| 444 | 444 | ON (r.file_id = p.file_id AND r.c_id = $course_id AND p.c_id = $course_id ) |
@@ -447,12 +447,12 @@ discard block |
||
| 447 | 447 | r.dest_user_id = ".intval($this->userId)." $condition_session "; |
| 448 | 448 | |
| 449 | 449 | $result = Database::query($sql); |
| 450 | - while ($res = Database::fetch_array($result)) { |
|
| 451 | - $temp = new Dropbox_Work($res['file_id']); |
|
| 452 | - $temp->category = $res['cat_id']; |
|
| 453 | - $this->receivedWork[] = $temp; |
|
| 454 | - } |
|
| 455 | - // Find all entries where this person is the sender/uploader |
|
| 450 | + while ($res = Database::fetch_array($result)) { |
|
| 451 | + $temp = new Dropbox_Work($res['file_id']); |
|
| 452 | + $temp->category = $res['cat_id']; |
|
| 453 | + $this->receivedWork[] = $temp; |
|
| 454 | + } |
|
| 455 | + // Find all entries where this person is the sender/uploader |
|
| 456 | 456 | $sql = "SELECT DISTINCT f.id |
| 457 | 457 | FROM $file_tbl f |
| 458 | 458 | INNER JOIN $person_tbl p |
@@ -463,260 +463,260 @@ discard block |
||
| 463 | 463 | $condition_session |
| 464 | 464 | "; |
| 465 | 465 | $result = Database::query($sql); |
| 466 | - while ($res = Database::fetch_array($result)) { |
|
| 467 | - $this->sentWork[] = new Dropbox_SentWork($res['id']); |
|
| 468 | - } |
|
| 469 | - } |
|
| 470 | - |
|
| 471 | - /** |
|
| 472 | - * This private method is used by the usort function in the |
|
| 473 | - * orderSentWork and orderReceivedWork methods. |
|
| 474 | - * It compares 2 work-objects by 1 of the properties of that object, dictated by the |
|
| 475 | - * private property _orderBy |
|
| 476 | - * |
|
| 477 | - * @param unknown_type $a |
|
| 478 | - * @param unknown_type $b |
|
| 479 | - * @return -1, 0 or 1 dependent of the result of the comparison. |
|
| 480 | - */ |
|
| 481 | - function _cmpWork($a, $b) |
|
| 466 | + while ($res = Database::fetch_array($result)) { |
|
| 467 | + $this->sentWork[] = new Dropbox_SentWork($res['id']); |
|
| 468 | + } |
|
| 469 | + } |
|
| 470 | + |
|
| 471 | + /** |
|
| 472 | + * This private method is used by the usort function in the |
|
| 473 | + * orderSentWork and orderReceivedWork methods. |
|
| 474 | + * It compares 2 work-objects by 1 of the properties of that object, dictated by the |
|
| 475 | + * private property _orderBy |
|
| 476 | + * |
|
| 477 | + * @param unknown_type $a |
|
| 478 | + * @param unknown_type $b |
|
| 479 | + * @return -1, 0 or 1 dependent of the result of the comparison. |
|
| 480 | + */ |
|
| 481 | + function _cmpWork($a, $b) |
|
| 482 | 482 | { |
| 483 | - $sort = $this->_orderBy; |
|
| 484 | - $aval = $a->$sort; |
|
| 485 | - $bval = $b->$sort; |
|
| 486 | - if ($sort == 'recipients') { |
|
| 487 | - // The recipients property is an array so we do the comparison based |
|
| 488 | - // on the first item of the recipients array |
|
| 489 | - $aval = $aval[0]['name']; |
|
| 490 | - $bval = $bval[0]['name']; |
|
| 491 | - } |
|
| 492 | - if ($sort == 'filesize') { // Filesize is not a string, so we use other comparison technique |
|
| 493 | - return $aval < $bval ? -1 : 1; |
|
| 494 | - } elseif ($sort == 'title') { // Natural order for sorting titles is more "human-friendly" |
|
| 495 | - return api_strnatcmp($aval, $bval); |
|
| 496 | - } else { |
|
| 497 | - return api_strcasecmp($aval, $bval); |
|
| 498 | - } |
|
| 499 | - } |
|
| 500 | - |
|
| 501 | - /** |
|
| 502 | - * A method that sorts the objects in the sentWork array, dependent on the $sort parameter. |
|
| 503 | - * $sort can be lastDate, firstDate, title, size, ... |
|
| 504 | - * |
|
| 505 | - * @param unknown_type $sort |
|
| 506 | - */ |
|
| 507 | - function orderSentWork($sort) |
|
| 483 | + $sort = $this->_orderBy; |
|
| 484 | + $aval = $a->$sort; |
|
| 485 | + $bval = $b->$sort; |
|
| 486 | + if ($sort == 'recipients') { |
|
| 487 | + // The recipients property is an array so we do the comparison based |
|
| 488 | + // on the first item of the recipients array |
|
| 489 | + $aval = $aval[0]['name']; |
|
| 490 | + $bval = $bval[0]['name']; |
|
| 491 | + } |
|
| 492 | + if ($sort == 'filesize') { // Filesize is not a string, so we use other comparison technique |
|
| 493 | + return $aval < $bval ? -1 : 1; |
|
| 494 | + } elseif ($sort == 'title') { // Natural order for sorting titles is more "human-friendly" |
|
| 495 | + return api_strnatcmp($aval, $bval); |
|
| 496 | + } else { |
|
| 497 | + return api_strcasecmp($aval, $bval); |
|
| 498 | + } |
|
| 499 | + } |
|
| 500 | + |
|
| 501 | + /** |
|
| 502 | + * A method that sorts the objects in the sentWork array, dependent on the $sort parameter. |
|
| 503 | + * $sort can be lastDate, firstDate, title, size, ... |
|
| 504 | + * |
|
| 505 | + * @param unknown_type $sort |
|
| 506 | + */ |
|
| 507 | + function orderSentWork($sort) |
|
| 508 | 508 | { |
| 509 | - switch($sort) { |
|
| 510 | - case 'lastDate': |
|
| 511 | - $this->_orderBy = 'last_upload_date'; |
|
| 512 | - break; |
|
| 513 | - case 'firstDate': |
|
| 514 | - $this->_orderBy = 'upload_date'; |
|
| 515 | - break; |
|
| 516 | - case 'title': |
|
| 517 | - $this->_orderBy = 'title'; |
|
| 518 | - break; |
|
| 519 | - case 'size': |
|
| 520 | - $this->_orderBy = 'filesize'; |
|
| 521 | - break; |
|
| 522 | - case 'author': |
|
| 523 | - $this->_orderBy = 'author'; |
|
| 524 | - break; |
|
| 525 | - case 'recipient': |
|
| 526 | - $this->_orderBy = 'recipients'; |
|
| 527 | - break; |
|
| 528 | - default: |
|
| 529 | - $this->_orderBy = 'last_upload_date'; |
|
| 530 | - } |
|
| 531 | - |
|
| 532 | - usort($this->sentWork, array($this, '_cmpWork')); |
|
| 533 | - } |
|
| 534 | - |
|
| 535 | - /** |
|
| 536 | - * method that sorts the objects in the receivedWork array, dependent on the $sort parameter. |
|
| 537 | - * $sort can be lastDate, firstDate, title, size, ... |
|
| 538 | - * @param unknown_type $sort |
|
| 539 | - */ |
|
| 540 | - function orderReceivedWork($sort) |
|
| 509 | + switch($sort) { |
|
| 510 | + case 'lastDate': |
|
| 511 | + $this->_orderBy = 'last_upload_date'; |
|
| 512 | + break; |
|
| 513 | + case 'firstDate': |
|
| 514 | + $this->_orderBy = 'upload_date'; |
|
| 515 | + break; |
|
| 516 | + case 'title': |
|
| 517 | + $this->_orderBy = 'title'; |
|
| 518 | + break; |
|
| 519 | + case 'size': |
|
| 520 | + $this->_orderBy = 'filesize'; |
|
| 521 | + break; |
|
| 522 | + case 'author': |
|
| 523 | + $this->_orderBy = 'author'; |
|
| 524 | + break; |
|
| 525 | + case 'recipient': |
|
| 526 | + $this->_orderBy = 'recipients'; |
|
| 527 | + break; |
|
| 528 | + default: |
|
| 529 | + $this->_orderBy = 'last_upload_date'; |
|
| 530 | + } |
|
| 531 | + |
|
| 532 | + usort($this->sentWork, array($this, '_cmpWork')); |
|
| 533 | + } |
|
| 534 | + |
|
| 535 | + /** |
|
| 536 | + * method that sorts the objects in the receivedWork array, dependent on the $sort parameter. |
|
| 537 | + * $sort can be lastDate, firstDate, title, size, ... |
|
| 538 | + * @param unknown_type $sort |
|
| 539 | + */ |
|
| 540 | + function orderReceivedWork($sort) |
|
| 541 | 541 | { |
| 542 | - switch($sort) { |
|
| 543 | - case 'lastDate': |
|
| 544 | - $this->_orderBy = 'last_upload_date'; |
|
| 545 | - break; |
|
| 546 | - case 'firstDate': |
|
| 547 | - $this->_orderBy = 'upload_date'; |
|
| 548 | - break; |
|
| 549 | - case 'title': |
|
| 550 | - $this->_orderBy = 'title'; |
|
| 551 | - break; |
|
| 552 | - case 'size': |
|
| 553 | - $this->_orderBy = 'filesize'; |
|
| 554 | - break; |
|
| 555 | - case 'author': |
|
| 556 | - $this->_orderBy = 'author'; |
|
| 557 | - break; |
|
| 558 | - case 'sender': |
|
| 559 | - $this->_orderBy = 'uploaderName'; |
|
| 560 | - break; |
|
| 561 | - default: |
|
| 562 | - $this->_orderBy = 'last_upload_date'; |
|
| 563 | - } |
|
| 564 | - |
|
| 565 | - usort($this->receivedWork, array($this, '_cmpWork')); |
|
| 566 | - } |
|
| 567 | - |
|
| 568 | - /** |
|
| 569 | - * Deletes all the received work of this person |
|
| 570 | - */ |
|
| 571 | - function deleteAllReceivedWork() |
|
| 542 | + switch($sort) { |
|
| 543 | + case 'lastDate': |
|
| 544 | + $this->_orderBy = 'last_upload_date'; |
|
| 545 | + break; |
|
| 546 | + case 'firstDate': |
|
| 547 | + $this->_orderBy = 'upload_date'; |
|
| 548 | + break; |
|
| 549 | + case 'title': |
|
| 550 | + $this->_orderBy = 'title'; |
|
| 551 | + break; |
|
| 552 | + case 'size': |
|
| 553 | + $this->_orderBy = 'filesize'; |
|
| 554 | + break; |
|
| 555 | + case 'author': |
|
| 556 | + $this->_orderBy = 'author'; |
|
| 557 | + break; |
|
| 558 | + case 'sender': |
|
| 559 | + $this->_orderBy = 'uploaderName'; |
|
| 560 | + break; |
|
| 561 | + default: |
|
| 562 | + $this->_orderBy = 'last_upload_date'; |
|
| 563 | + } |
|
| 564 | + |
|
| 565 | + usort($this->receivedWork, array($this, '_cmpWork')); |
|
| 566 | + } |
|
| 567 | + |
|
| 568 | + /** |
|
| 569 | + * Deletes all the received work of this person |
|
| 570 | + */ |
|
| 571 | + function deleteAllReceivedWork() |
|
| 572 | 572 | { |
| 573 | - $course_id = api_get_course_int_id(); |
|
| 573 | + $course_id = api_get_course_int_id(); |
|
| 574 | 574 | $dropbox_cnf = getDropboxConf(); |
| 575 | - // Delete entries in person table concerning received works |
|
| 576 | - foreach ($this->receivedWork as $w) { |
|
| 575 | + // Delete entries in person table concerning received works |
|
| 576 | + foreach ($this->receivedWork as $w) { |
|
| 577 | 577 | $sql = "DELETE FROM ".$dropbox_cnf['tbl_person']." |
| 578 | 578 | WHERE c_id = $course_id AND user_id='".$this->userId."' AND file_id='".$w->id."'"; |
| 579 | - Database::query($sql); |
|
| 580 | - } |
|
| 579 | + Database::query($sql); |
|
| 580 | + } |
|
| 581 | 581 | // Check for unused files |
| 582 | - removeUnusedFiles(); |
|
| 583 | - } |
|
| 582 | + removeUnusedFiles(); |
|
| 583 | + } |
|
| 584 | 584 | |
| 585 | - /** |
|
| 586 | - * Deletes all the received categories and work of this person |
|
| 587 | - */ |
|
| 588 | - function deleteReceivedWorkFolder($id) |
|
| 585 | + /** |
|
| 586 | + * Deletes all the received categories and work of this person |
|
| 587 | + */ |
|
| 588 | + function deleteReceivedWorkFolder($id) |
|
| 589 | 589 | { |
| 590 | 590 | $dropbox_cnf = getDropboxConf(); |
| 591 | 591 | $course_id = api_get_course_int_id(); |
| 592 | 592 | |
| 593 | - $id = intval($id); |
|
| 594 | - $sql = "DELETE FROM ".$dropbox_cnf['tbl_file']." |
|
| 593 | + $id = intval($id); |
|
| 594 | + $sql = "DELETE FROM ".$dropbox_cnf['tbl_file']." |
|
| 595 | 595 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
| 596 | - if (!Database::query($sql)) return false; |
|
| 597 | - $sql = "DELETE FROM ".$dropbox_cnf['tbl_category']." |
|
| 596 | + if (!Database::query($sql)) return false; |
|
| 597 | + $sql = "DELETE FROM ".$dropbox_cnf['tbl_category']." |
|
| 598 | 598 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
| 599 | - if (!Database::query($sql)) return false; |
|
| 600 | - $sql = "DELETE FROM ".$dropbox_cnf['tbl_post']." |
|
| 599 | + if (!Database::query($sql)) return false; |
|
| 600 | + $sql = "DELETE FROM ".$dropbox_cnf['tbl_post']." |
|
| 601 | 601 | WHERE c_id = $course_id AND cat_id = '".$id."' "; |
| 602 | - if (!Database::query($sql)) return false; |
|
| 603 | - return true; |
|
| 604 | - } |
|
| 605 | - |
|
| 606 | - /** |
|
| 607 | - * Deletes a received dropbox file of this person with id=$id |
|
| 608 | - * |
|
| 609 | - * @param integer $id |
|
| 610 | - */ |
|
| 611 | - function deleteReceivedWork($id) |
|
| 602 | + if (!Database::query($sql)) return false; |
|
| 603 | + return true; |
|
| 604 | + } |
|
| 605 | + |
|
| 606 | + /** |
|
| 607 | + * Deletes a received dropbox file of this person with id=$id |
|
| 608 | + * |
|
| 609 | + * @param integer $id |
|
| 610 | + */ |
|
| 611 | + function deleteReceivedWork($id) |
|
| 612 | 612 | { |
| 613 | - $course_id = api_get_course_int_id(); |
|
| 613 | + $course_id = api_get_course_int_id(); |
|
| 614 | 614 | $dropbox_cnf = getDropboxConf(); |
| 615 | - $id = intval($id); |
|
| 616 | - |
|
| 617 | - // index check |
|
| 618 | - $found = false; |
|
| 619 | - foreach ($this->receivedWork as $w) { |
|
| 620 | - if ($w->id == $id) { |
|
| 621 | - $found = true; |
|
| 622 | - break; |
|
| 623 | - } |
|
| 624 | - } |
|
| 625 | - |
|
| 626 | - if (!$found) { |
|
| 627 | - if (!$this->deleteReceivedWorkFolder($id)) { |
|
| 628 | - die(get_lang('GeneralError').' (code 216)'); |
|
| 629 | - } |
|
| 630 | - } |
|
| 631 | - // Delete entries in person table concerning received works |
|
| 615 | + $id = intval($id); |
|
| 616 | + |
|
| 617 | + // index check |
|
| 618 | + $found = false; |
|
| 619 | + foreach ($this->receivedWork as $w) { |
|
| 620 | + if ($w->id == $id) { |
|
| 621 | + $found = true; |
|
| 622 | + break; |
|
| 623 | + } |
|
| 624 | + } |
|
| 625 | + |
|
| 626 | + if (!$found) { |
|
| 627 | + if (!$this->deleteReceivedWorkFolder($id)) { |
|
| 628 | + die(get_lang('GeneralError').' (code 216)'); |
|
| 629 | + } |
|
| 630 | + } |
|
| 631 | + // Delete entries in person table concerning received works |
|
| 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 | - Database::query($sql); |
|
| 635 | - removeUnusedFiles(); // Check for unused files |
|
| 636 | - } |
|
| 637 | - |
|
| 638 | - /** |
|
| 639 | - * Deletes all the sent dropbox files of this person |
|
| 640 | - */ |
|
| 641 | - function deleteAllSentWork() |
|
| 634 | + Database::query($sql); |
|
| 635 | + removeUnusedFiles(); // Check for unused files |
|
| 636 | + } |
|
| 637 | + |
|
| 638 | + /** |
|
| 639 | + * Deletes all the sent dropbox files of this person |
|
| 640 | + */ |
|
| 641 | + function deleteAllSentWork() |
|
| 642 | 642 | { |
| 643 | - $course_id = api_get_course_int_id(); |
|
| 643 | + $course_id = api_get_course_int_id(); |
|
| 644 | 644 | $dropbox_cnf = getDropboxConf(); |
| 645 | - //delete entries in person table concerning sent works |
|
| 646 | - foreach ($this->sentWork as $w) { |
|
| 645 | + //delete entries in person table concerning sent works |
|
| 646 | + foreach ($this->sentWork as $w) { |
|
| 647 | 647 | $sql = "DELETE FROM ".$dropbox_cnf['tbl_person']." |
| 648 | 648 | WHERE c_id = $course_id AND user_id='".$this->userId."' AND file_id='".$w->id."'"; |
| 649 | - Database::query($sql); |
|
| 650 | - removeMoreIfMailing($w->id); |
|
| 651 | - } |
|
| 652 | - removeUnusedFiles(); // Check for unused files |
|
| 653 | - } |
|
| 654 | - |
|
| 655 | - /** |
|
| 656 | - * Deletes a sent dropbox file of this person with id=$id |
|
| 657 | - * |
|
| 658 | - * @param unknown_type $id |
|
| 659 | - */ |
|
| 660 | - function deleteSentWork($id) |
|
| 649 | + Database::query($sql); |
|
| 650 | + removeMoreIfMailing($w->id); |
|
| 651 | + } |
|
| 652 | + removeUnusedFiles(); // Check for unused files |
|
| 653 | + } |
|
| 654 | + |
|
| 655 | + /** |
|
| 656 | + * Deletes a sent dropbox file of this person with id=$id |
|
| 657 | + * |
|
| 658 | + * @param unknown_type $id |
|
| 659 | + */ |
|
| 660 | + function deleteSentWork($id) |
|
| 661 | 661 | { |
| 662 | - $course_id = api_get_course_int_id(); |
|
| 662 | + $course_id = api_get_course_int_id(); |
|
| 663 | 663 | $dropbox_cnf = getDropboxConf(); |
| 664 | 664 | |
| 665 | - $id = intval($id); |
|
| 666 | - |
|
| 667 | - // index check |
|
| 668 | - $found = false; |
|
| 669 | - foreach ($this->sentWork as $w) { |
|
| 670 | - if ($w->id == $id) { |
|
| 671 | - $found = true; |
|
| 672 | - break; |
|
| 673 | - } |
|
| 674 | - } |
|
| 675 | - if (!$found) { |
|
| 676 | - if (!$this->deleteReceivedWorkFolder($id)) { |
|
| 677 | - die(get_lang('GeneralError').' (code 219)'); |
|
| 678 | - } |
|
| 679 | - } |
|
| 680 | - //$file_id = $this->sentWork[$index]->id; |
|
| 681 | - // Delete entries in person table concerning sent works |
|
| 665 | + $id = intval($id); |
|
| 666 | + |
|
| 667 | + // index check |
|
| 668 | + $found = false; |
|
| 669 | + foreach ($this->sentWork as $w) { |
|
| 670 | + if ($w->id == $id) { |
|
| 671 | + $found = true; |
|
| 672 | + break; |
|
| 673 | + } |
|
| 674 | + } |
|
| 675 | + if (!$found) { |
|
| 676 | + if (!$this->deleteReceivedWorkFolder($id)) { |
|
| 677 | + die(get_lang('GeneralError').' (code 219)'); |
|
| 678 | + } |
|
| 679 | + } |
|
| 680 | + //$file_id = $this->sentWork[$index]->id; |
|
| 681 | + // Delete entries in person table concerning sent works |
|
| 682 | 682 | $sql = "DELETE FROM ".$dropbox_cnf['tbl_person']." |
| 683 | 683 | WHERE c_id = $course_id AND user_id='".$this->userId."' AND file_id='".$id."'"; |
| 684 | - Database::query($sql); |
|
| 685 | - removeMoreIfMailing($id); |
|
| 686 | - removeUnusedFiles(); // Check for unused files |
|
| 687 | - } |
|
| 688 | - |
|
| 689 | - /** |
|
| 690 | - * Updates feedback for received work of this person with id=$id |
|
| 691 | - * |
|
| 692 | - * @param string $id |
|
| 693 | - * @param string $text |
|
| 694 | - */ |
|
| 695 | - function updateFeedback($id, $text) |
|
| 684 | + Database::query($sql); |
|
| 685 | + removeMoreIfMailing($id); |
|
| 686 | + removeUnusedFiles(); // Check for unused files |
|
| 687 | + } |
|
| 688 | + |
|
| 689 | + /** |
|
| 690 | + * Updates feedback for received work of this person with id=$id |
|
| 691 | + * |
|
| 692 | + * @param string $id |
|
| 693 | + * @param string $text |
|
| 694 | + */ |
|
| 695 | + function updateFeedback($id, $text) |
|
| 696 | 696 | { |
| 697 | - $course_id = api_get_course_int_id(); |
|
| 697 | + $course_id = api_get_course_int_id(); |
|
| 698 | 698 | $_course = api_get_course_info(); |
| 699 | 699 | $dropbox_cnf = getDropboxConf(); |
| 700 | 700 | |
| 701 | - $id = intval($id); |
|
| 702 | - |
|
| 703 | - // index check |
|
| 704 | - $found = false; |
|
| 705 | - $wi = -1; |
|
| 706 | - foreach ($this->receivedWork as $w) { |
|
| 707 | - $wi++; |
|
| 708 | - if ($w->id == $id){ |
|
| 709 | - $found = true; |
|
| 710 | - break; |
|
| 711 | - } // foreach (... as $wi -> $w) gives error 221! (no idea why...) |
|
| 712 | - } |
|
| 713 | - if (!$found) { |
|
| 714 | - die(get_lang('GeneralError').' (code 221)'); |
|
| 715 | - } |
|
| 716 | - |
|
| 717 | - $feedback_date = api_get_utc_datetime(); |
|
| 718 | - $this->receivedWork[$wi]->feedback_date = $feedback_date; |
|
| 719 | - $this->receivedWork[$wi]->feedback = $text; |
|
| 701 | + $id = intval($id); |
|
| 702 | + |
|
| 703 | + // index check |
|
| 704 | + $found = false; |
|
| 705 | + $wi = -1; |
|
| 706 | + foreach ($this->receivedWork as $w) { |
|
| 707 | + $wi++; |
|
| 708 | + if ($w->id == $id){ |
|
| 709 | + $found = true; |
|
| 710 | + break; |
|
| 711 | + } // foreach (... as $wi -> $w) gives error 221! (no idea why...) |
|
| 712 | + } |
|
| 713 | + if (!$found) { |
|
| 714 | + die(get_lang('GeneralError').' (code 221)'); |
|
| 715 | + } |
|
| 716 | + |
|
| 717 | + $feedback_date = api_get_utc_datetime(); |
|
| 718 | + $this->receivedWork[$wi]->feedback_date = $feedback_date; |
|
| 719 | + $this->receivedWork[$wi]->feedback = $text; |
|
| 720 | 720 | |
| 721 | 721 | $params = [ |
| 722 | 722 | 'feedback_date' => $feedback_date, |
@@ -734,11 +734,11 @@ discard block |
||
| 734 | 734 | ] |
| 735 | 735 | ); |
| 736 | 736 | |
| 737 | - // Update item_property table |
|
| 737 | + // Update item_property table |
|
| 738 | 738 | |
| 739 | - if (($ownerid = $this->receivedWork[$wi]->uploader_id) > $dropbox_cnf['mailingIdBase']) { |
|
| 740 | - $ownerid = getUserOwningThisMailing($ownerid); |
|
| 741 | - } |
|
| 739 | + if (($ownerid = $this->receivedWork[$wi]->uploader_id) > $dropbox_cnf['mailingIdBase']) { |
|
| 740 | + $ownerid = getUserOwningThisMailing($ownerid); |
|
| 741 | + } |
|
| 742 | 742 | api_item_property_update( |
| 743 | 743 | $_course, |
| 744 | 744 | TOOL_DROPBOX, |
@@ -749,31 +749,31 @@ discard block |
||
| 749 | 749 | $ownerid |
| 750 | 750 | ); |
| 751 | 751 | |
| 752 | - } |
|
| 752 | + } |
|
| 753 | 753 | |
| 754 | - /** |
|
| 755 | - * Filter the received work |
|
| 756 | - * @param string $type |
|
| 757 | - * @param string $value |
|
| 758 | - */ |
|
| 759 | - function filter_received_work($type, $value) |
|
| 754 | + /** |
|
| 755 | + * Filter the received work |
|
| 756 | + * @param string $type |
|
| 757 | + * @param string $value |
|
| 758 | + */ |
|
| 759 | + function filter_received_work($type, $value) |
|
| 760 | 760 | { |
| 761 | 761 | $dropbox_cnf = getDropboxConf(); |
| 762 | - $new_received_work = array(); |
|
| 763 | - foreach ($this->receivedWork as $work) { |
|
| 764 | - switch ($type) { |
|
| 765 | - case 'uploader_id': |
|
| 766 | - if ($work->uploader_id == $value || |
|
| 767 | - ($work->uploader_id > $dropbox_cnf['mailingIdBase'] && |
|
| 762 | + $new_received_work = array(); |
|
| 763 | + foreach ($this->receivedWork as $work) { |
|
| 764 | + switch ($type) { |
|
| 765 | + case 'uploader_id': |
|
| 766 | + if ($work->uploader_id == $value || |
|
| 767 | + ($work->uploader_id > $dropbox_cnf['mailingIdBase'] && |
|
| 768 | 768 | getUserOwningThisMailing($work->uploader_id) == $value) |
| 769 | 769 | ) { |
| 770 | - $new_received_work[] = $work; |
|
| 771 | - } |
|
| 772 | - break; |
|
| 773 | - default: |
|
| 774 | - $new_received_work[] = $work; |
|
| 775 | - } |
|
| 776 | - } |
|
| 777 | - $this->receivedWork = $new_received_work; |
|
| 778 | - } |
|
| 770 | + $new_received_work[] = $work; |
|
| 771 | + } |
|
| 772 | + break; |
|
| 773 | + default: |
|
| 774 | + $new_received_work[] = $work; |
|
| 775 | + } |
|
| 776 | + } |
|
| 777 | + $this->receivedWork = $new_received_work; |
|
| 778 | + } |
|
| 779 | 779 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | // STEP 2: at least one file has to be selected. If not we return an error message |
| 43 | 43 | $ids = isset($_GET['id']) ? $_GET['id'] : array(); |
| 44 | - if (count($ids)>0) { |
|
| 44 | + if (count($ids) > 0) { |
|
| 45 | 45 | $checked_file_ids = $_POST['id']; |
| 46 | 46 | } else { |
| 47 | 47 | foreach ($_POST as $key => $value) { |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | $cat = get_dropbox_category($id); |
| 136 | - if (count($cat)==0) { |
|
| 136 | + if (count($cat) == 0) { |
|
| 137 | 137 | return false; |
| 138 | 138 | } |
| 139 | 139 | |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | WHERE c_id = $course_id AND cat_id='".intval($id)."'"; |
| 167 | 167 | $result = Database::query($sql); |
| 168 | 168 | |
| 169 | - while($row = Database::fetch_array($result)) { |
|
| 169 | + while ($row = Database::fetch_array($result)) { |
|
| 170 | 170 | $dropboxfile = new Dropbox_Person($user_id, $is_courseAdmin, $is_courseTutor); |
| 171 | 171 | if ($action == 'deletereceivedcategory') { |
| 172 | 172 | $dropboxfile->deleteReceivedWork($row[$id_field]); |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | |
| 658 | 658 | $full_name = $userInfo['complete_name'].$groupNameListToString; |
| 659 | 659 | $current_user_id = $current_user['user_id']; |
| 660 | - $options['user_' . $current_user_id] = $full_name; |
|
| 660 | + $options['user_'.$current_user_id] = $full_name; |
|
| 661 | 661 | } |
| 662 | 662 | } |
| 663 | 663 | } |
@@ -706,11 +706,11 @@ discard block |
||
| 706 | 706 | |
| 707 | 707 | $mailingId = $id - dropbox_cnf('mailingIdBase'); |
| 708 | 708 | if ($mailingId > 0) { |
| 709 | - return get_lang('MailingAsUsername', '') . $mailingId; |
|
| 709 | + return get_lang('MailingAsUsername', '').$mailingId; |
|
| 710 | 710 | } |
| 711 | 711 | $id = intval($id); |
| 712 | 712 | $sql = "SELECT ".(api_is_western_name_order() ? "CONCAT(firstname,' ', lastname)" : "CONCAT(lastname,' ', firstname)")." AS name |
| 713 | - FROM " . $dropbox_cnf['tbl_user'] . " |
|
| 713 | + FROM " . $dropbox_cnf['tbl_user']." |
|
| 714 | 714 | WHERE user_id='$id'"; |
| 715 | 715 | $result = Database::query($sql); |
| 716 | 716 | $res = Database::fetch_array($result); |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | { |
| 731 | 731 | $id = intval($id); |
| 732 | 732 | $sql = "SELECT username |
| 733 | - FROM " . dropbox_cnf('tbl_user') . " |
|
| 733 | + FROM " . dropbox_cnf('tbl_user')." |
|
| 734 | 734 | WHERE user_id='$id'"; |
| 735 | 735 | $result = Database::query($sql); |
| 736 | 736 | $res = Database::fetch_array($result); |
@@ -762,8 +762,8 @@ discard block |
||
| 762 | 762 | |
| 763 | 763 | // select all files that aren't referenced anymore |
| 764 | 764 | $sql = "SELECT DISTINCT f.id, f.filename |
| 765 | - FROM " . dropbox_cnf('tbl_file') . " f |
|
| 766 | - LEFT JOIN " . dropbox_cnf('tbl_person') . " p |
|
| 765 | + FROM " . dropbox_cnf('tbl_file')." f |
|
| 766 | + LEFT JOIN " . dropbox_cnf('tbl_person')." p |
|
| 767 | 767 | ON (f.id = p.file_id) |
| 768 | 768 | WHERE p.user_id IS NULL AND |
| 769 | 769 | f.c_id = $course_id |
@@ -771,14 +771,14 @@ discard block |
||
| 771 | 771 | $result = Database::query($sql); |
| 772 | 772 | while ($res = Database::fetch_array($result)) { |
| 773 | 773 | //delete the selected files from the post and file tables |
| 774 | - $sql = "DELETE FROM " . dropbox_cnf('tbl_post') . " |
|
| 775 | - WHERE c_id = $course_id AND file_id = '" . $res['id'] . "'"; |
|
| 774 | + $sql = "DELETE FROM ".dropbox_cnf('tbl_post')." |
|
| 775 | + WHERE c_id = $course_id AND file_id = '".$res['id']."'"; |
|
| 776 | 776 | Database::query($sql); |
| 777 | - $sql = "DELETE FROM " . dropbox_cnf('tbl_file') . " |
|
| 778 | - WHERE c_id = $course_id AND id ='" . $res['id'] . "'"; |
|
| 777 | + $sql = "DELETE FROM ".dropbox_cnf('tbl_file')." |
|
| 778 | + WHERE c_id = $course_id AND id ='".$res['id']."'"; |
|
| 779 | 779 | Database::query($sql); |
| 780 | 780 | //delete file from server |
| 781 | - @unlink( dropbox_cnf('sysPath') . '/' . $res['filename']); |
|
| 781 | + @unlink(dropbox_cnf('sysPath').'/'.$res['filename']); |
|
| 782 | 782 | } |
| 783 | 783 | } |
| 784 | 784 | |
@@ -801,11 +801,11 @@ discard block |
||
| 801 | 801 | |
| 802 | 802 | $mailingPseudoId = intval($mailingPseudoId); |
| 803 | 803 | $sql = "SELECT f.uploader_id |
| 804 | - FROM " . $dropbox_cnf['tbl_file'] . " f |
|
| 805 | - LEFT JOIN " . $dropbox_cnf['tbl_post'] . " p |
|
| 804 | + FROM " . $dropbox_cnf['tbl_file']." f |
|
| 805 | + LEFT JOIN " . $dropbox_cnf['tbl_post']." p |
|
| 806 | 806 | ON (f.id = p.file_id AND f.c_id = $course_id AND p.c_id = $course_id) |
| 807 | 807 | WHERE |
| 808 | - p.dest_user_id = '" . $mailingPseudoId . "' AND |
|
| 808 | + p.dest_user_id = '".$mailingPseudoId."' AND |
|
| 809 | 809 | p.c_id = $course_id |
| 810 | 810 | "; |
| 811 | 811 | $result = Database::query($sql); |
@@ -832,20 +832,20 @@ discard block |
||
| 832 | 832 | // for all content files, replace mailingPseudoId by owner as uploader |
| 833 | 833 | $file_id = intval($file_id); |
| 834 | 834 | $sql = "SELECT p.dest_user_id |
| 835 | - FROM " . $dropbox_cnf['tbl_post'] . " p |
|
| 836 | - WHERE c_id = $course_id AND p.file_id = '" . $file_id . "'"; |
|
| 835 | + FROM " . $dropbox_cnf['tbl_post']." p |
|
| 836 | + WHERE c_id = $course_id AND p.file_id = '".$file_id."'"; |
|
| 837 | 837 | $result = Database::query($sql); |
| 838 | 838 | |
| 839 | 839 | if ($res = Database::fetch_array($result)) { |
| 840 | 840 | $mailingPseudoId = $res['dest_user_id']; |
| 841 | 841 | if ($mailingPseudoId > dropbox_cnf('mailingIdBase')) { |
| 842 | - $sql = "DELETE FROM " . dropbox_cnf('tbl_person') . " |
|
| 843 | - WHERE c_id = $course_id AND user_id='" . $mailingPseudoId . "'"; |
|
| 842 | + $sql = "DELETE FROM ".dropbox_cnf('tbl_person')." |
|
| 843 | + WHERE c_id = $course_id AND user_id='".$mailingPseudoId."'"; |
|
| 844 | 844 | Database::query($sql); |
| 845 | 845 | |
| 846 | - $sql = "UPDATE " . dropbox_cnf('tbl_file') ." |
|
| 847 | - SET uploader_id='" . api_get_user_id() . "' |
|
| 848 | - WHERE c_id = $course_id AND uploader_id='" . $mailingPseudoId . "'"; |
|
| 846 | + $sql = "UPDATE ".dropbox_cnf('tbl_file')." |
|
| 847 | + SET uploader_id='" . api_get_user_id()."' |
|
| 848 | + WHERE c_id = $course_id AND uploader_id='".$mailingPseudoId."'"; |
|
| 849 | 849 | Database::query($sql); |
| 850 | 850 | } |
| 851 | 851 | } |
@@ -984,7 +984,7 @@ discard block |
||
| 984 | 984 | } |
| 985 | 985 | } |
| 986 | 986 | } else { // rename file to login_filename_uniqueId format |
| 987 | - $dropbox_filename = getLoginFromId($_user['user_id']) . "_" . $dropbox_filename . "_".uniqid(''); |
|
| 987 | + $dropbox_filename = getLoginFromId($_user['user_id'])."_".$dropbox_filename."_".uniqid(''); |
|
| 988 | 988 | } |
| 989 | 989 | |
| 990 | 990 | // creating the array that contains all the users who will receive the file |
@@ -1002,7 +1002,7 @@ discard block |
||
| 1002 | 1002 | } |
| 1003 | 1003 | } |
| 1004 | 1004 | |
| 1005 | - @move_uploaded_file($dropbox_filetmpname, dropbox_cnf('sysPath') . '/' . $dropbox_filename); |
|
| 1005 | + @move_uploaded_file($dropbox_filetmpname, dropbox_cnf('sysPath').'/'.$dropbox_filename); |
|
| 1006 | 1006 | |
| 1007 | 1007 | $b_send_mail = api_get_course_setting('email_alert_on_new_doc_dropbox'); |
| 1008 | 1008 | |
@@ -1023,14 +1023,14 @@ discard block |
||
| 1023 | 1023 | ), |
| 1024 | 1024 | $recipent_temp['email'], |
| 1025 | 1025 | get_lang('NewDropboxFileUploaded'), |
| 1026 | - get_lang('NewDropboxFileUploadedContent').' <a href="'.api_get_path(WEB_CODE_PATH).'dropbox/index.php?' . api_get_cidreq() . '">'.get_lang('SeeFile').'</a>'. |
|
| 1026 | + get_lang('NewDropboxFileUploadedContent').' <a href="'.api_get_path(WEB_CODE_PATH).'dropbox/index.php?'.api_get_cidreq().'">'.get_lang('SeeFile').'</a>'. |
|
| 1027 | 1027 | "\n\n". |
| 1028 | 1028 | api_get_person_name( |
| 1029 | 1029 | $_user['firstName'], |
| 1030 | 1030 | $_user['lastName'], |
| 1031 | 1031 | null, |
| 1032 | 1032 | PERSON_NAME_EMAIL_ADDRESS |
| 1033 | - )."\n". get_lang('Email') ." : ".$_user['mail'], |
|
| 1033 | + )."\n".get_lang('Email')." : ".$_user['mail'], |
|
| 1034 | 1034 | api_get_person_name( |
| 1035 | 1035 | $_user['firstName'], |
| 1036 | 1036 | $_user['lastName'], |
@@ -1308,7 +1308,7 @@ discard block |
||
| 1308 | 1308 | // Adding the content. |
| 1309 | 1309 | $return .= "\n<tr>"; |
| 1310 | 1310 | foreach ($column as $column_key => $column_value) { |
| 1311 | - if (!in_array($column_value,$dont_show_columns)) { |
|
| 1311 | + if (!in_array($column_value, $dont_show_columns)) { |
|
| 1312 | 1312 | $return .= "\n\t<td>"; |
| 1313 | 1313 | if (in_array($column_value, $make_link)) { |
| 1314 | 1314 | $return .= '<a href="'.$value[$column_value].'">'.$value[$column_value].'</a>'; |
@@ -1341,7 +1341,7 @@ discard block |
||
| 1341 | 1341 | WHERE c_id = $course_id GROUP BY file_id"; |
| 1342 | 1342 | $result = Database::query($sql); |
| 1343 | 1343 | $return = array(); |
| 1344 | - while ($row=Database::fetch_array($result)) { |
|
| 1344 | + while ($row = Database::fetch_array($result)) { |
|
| 1345 | 1345 | $return[$row['file_id']] = $row['total']; |
| 1346 | 1346 | } |
| 1347 | 1347 | return $return; |
@@ -734,7 +734,9 @@ discard block |
||
| 734 | 734 | WHERE user_id='$id'"; |
| 735 | 735 | $result = Database::query($sql); |
| 736 | 736 | $res = Database::fetch_array($result); |
| 737 | - if (!$res) return false; |
|
| 737 | + if (!$res) { |
|
| 738 | + return false; |
|
| 739 | + } |
|
| 738 | 740 | |
| 739 | 741 | return stripslashes($res['username']); |
| 740 | 742 | } |
@@ -810,10 +812,15 @@ discard block |
||
| 810 | 812 | "; |
| 811 | 813 | $result = Database::query($sql); |
| 812 | 814 | |
| 813 | - if (!($res = Database::fetch_array($result))) |
|
| 814 | - die(get_lang('GeneralError').' (code 901)'); |
|
| 815 | - if ($owner == 0) return $res['uploader_id']; |
|
| 816 | - if ($res['uploader_id'] == $owner) return true; |
|
| 815 | + if (!($res = Database::fetch_array($result))) { |
|
| 816 | + die(get_lang('GeneralError').' (code 901)'); |
|
| 817 | + } |
|
| 818 | + if ($owner == 0) { |
|
| 819 | + return $res['uploader_id']; |
|
| 820 | + } |
|
| 821 | + if ($res['uploader_id'] == $owner) { |
|
| 822 | + return true; |
|
| 823 | + } |
|
| 817 | 824 | die(get_lang('GeneralError').' (code '.$or_die.')'); |
| 818 | 825 | } |
| 819 | 826 | |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | $result = Database::query($sql); |
| 34 | 34 | |
| 35 | 35 | if (Database::num_rows($result)) { |
| 36 | - $files = Database::store_result($result); |
|
| 36 | + $files = Database::store_result($result); |
|
| 37 | 37 | $rows = array(); |
| 38 | 38 | foreach ($files as $file) { |
| 39 | 39 | //Check if I have this file: |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | //sentArray keeps list of all files still available in the sent files list |
| 222 | 222 | //of the user. |
| 223 | 223 | //This is used to show or hide the overwrite file-radio button of the upload form |
| 224 | - $javascript .= " |
|
| 224 | + $javascript .= " |
|
| 225 | 225 | var sentArray = new Array("; |
| 226 | 226 | if (isset($dropbox_person)) { |
| 227 | 227 | for ($i = 0; $i < count($dropbox_person->sentWork); $i++) { |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | $javascript .= "'".$dropbox_person->sentWork[$i]->title."'"; |
| 232 | 232 | } |
| 233 | 233 | } |
| 234 | - $javascript .= "); |
|
| 234 | + $javascript .= "); |
|
| 235 | 235 | |
| 236 | 236 | function checkfile(str) |
| 237 | 237 | { |
@@ -296,12 +296,12 @@ discard block |
||
| 296 | 296 | |
| 297 | 297 | $checked_files = false; |
| 298 | 298 | if (!$view || $view == 'received') { |
| 299 | - $part = 'received'; |
|
| 299 | + $part = 'received'; |
|
| 300 | 300 | } elseif ($view = 'sent') { |
| 301 | - $part = 'sent'; |
|
| 301 | + $part = 'sent'; |
|
| 302 | 302 | } else { |
| 303 | - header('location: index.php?view='.$view.'&error=Error'); |
|
| 304 | - exit; |
|
| 303 | + header('location: index.php?view='.$view.'&error=Error'); |
|
| 304 | + exit; |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | if (($postAction == 'download_received' || $postAction == 'download_sent') and !$_POST['store_feedback']) { |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | } else { |
| 326 | 326 | api_not_allowed(); |
| 327 | 327 | } |
| 328 | - exit(); |
|
| 328 | + exit(); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | /* BREADCRUMBS */ |
@@ -335,45 +335,45 @@ discard block |
||
| 335 | 335 | 'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?'.api_get_cidreq(), |
| 336 | 336 | 'name' => get_lang('Dropbox', ''), |
| 337 | 337 | ); |
| 338 | - $nameTools = get_lang('ReceivedFiles'); |
|
| 338 | + $nameTools = get_lang('ReceivedFiles'); |
|
| 339 | 339 | |
| 340 | - if ($action == 'addreceivedcategory') { |
|
| 340 | + if ($action == 'addreceivedcategory') { |
|
| 341 | 341 | $interbreadcrumb[] = array( |
| 342 | 342 | 'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?view=received&'.api_get_cidreq(), |
| 343 | 343 | 'name' => get_lang('ReceivedFiles'), |
| 344 | 344 | ); |
| 345 | - $nameTools = get_lang('AddNewCategory'); |
|
| 346 | - } |
|
| 345 | + $nameTools = get_lang('AddNewCategory'); |
|
| 346 | + } |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | if ($view == 'sent' || empty($view)) { |
| 350 | 350 | $interbreadcrumb[] = array( |
| 351 | 351 | 'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?'.api_get_cidreq(), |
| 352 | - 'name' => get_lang('Dropbox') |
|
| 352 | + 'name' => get_lang('Dropbox') |
|
| 353 | 353 | ); |
| 354 | - $nameTools = get_lang('SentFiles'); |
|
| 355 | - |
|
| 356 | - if ($action == 'addsentcategory') { |
|
| 357 | - $interbreadcrumb[] = array( |
|
| 358 | - 'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?view=sent&'.api_get_cidreq(), |
|
| 359 | - 'name' => get_lang('SentFiles'), |
|
| 360 | - ); |
|
| 361 | - $nameTools = get_lang('AddNewCategory'); |
|
| 362 | - } |
|
| 363 | - if ($action == 'add') { |
|
| 364 | - $interbreadcrumb[] = array( |
|
| 365 | - 'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?view=sent&'.api_get_cidreq(), |
|
| 366 | - 'name' => get_lang('SentFiles'), |
|
| 367 | - ); |
|
| 368 | - $nameTools = get_lang('UploadNewFile'); |
|
| 369 | - } |
|
| 354 | + $nameTools = get_lang('SentFiles'); |
|
| 355 | + |
|
| 356 | + if ($action == 'addsentcategory') { |
|
| 357 | + $interbreadcrumb[] = array( |
|
| 358 | + 'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?view=sent&'.api_get_cidreq(), |
|
| 359 | + 'name' => get_lang('SentFiles'), |
|
| 360 | + ); |
|
| 361 | + $nameTools = get_lang('AddNewCategory'); |
|
| 362 | + } |
|
| 363 | + if ($action == 'add') { |
|
| 364 | + $interbreadcrumb[] = array( |
|
| 365 | + 'url' => api_get_path(WEB_CODE_PATH).'dropbox/index.php?view=sent&'.api_get_cidreq(), |
|
| 366 | + 'name' => get_lang('SentFiles'), |
|
| 367 | + ); |
|
| 368 | + $nameTools = get_lang('UploadNewFile'); |
|
| 369 | + } |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | /* HEADER & TITLE */ |
| 373 | 373 | |
| 374 | 374 | if (isset($origin) && $origin == 'learnpath') { |
| 375 | 375 | $htmlHeadXtra[] = $javascript; |
| 376 | - Display::display_reduced_header($nameTools, 'Dropbox'); |
|
| 376 | + Display::display_reduced_header($nameTools, 'Dropbox'); |
|
| 377 | 377 | } else { |
| 378 | 378 | Display::display_header($nameTools, 'Dropbox'); |
| 379 | 379 | } |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $is_courseTutor = api_is_course_tutor(); |
| 127 | 127 | $is_courseAdmin = api_is_course_admin(); |
| 128 | 128 | |
| 129 | -$current_course_tool = TOOL_DROPBOX; |
|
| 129 | +$current_course_tool = TOOL_DROPBOX; |
|
| 130 | 130 | |
| 131 | 131 | // the dropbox configuration parameters |
| 132 | 132 | $dropbox_cnf = require_once 'dropbox_config.inc.php'; |
@@ -278,10 +278,10 @@ discard block |
||
| 278 | 278 | $javascript .= " |
| 279 | 279 | </script>"; |
| 280 | 280 | $htmlHeadXtra[] = $javascript; |
| 281 | -$htmlHeadXtra[] ="<script> |
|
| 281 | +$htmlHeadXtra[] = "<script> |
|
| 282 | 282 | function confirmation (name) |
| 283 | 283 | { |
| 284 | - if (confirm(\" ". get_lang("AreYouSureToDeleteJS") ." \"+ name + \" ?\")) |
|
| 284 | + if (confirm(\" ". get_lang("AreYouSureToDeleteJS")." \"+ name + \" ?\")) |
|
| 285 | 285 | {return true;} |
| 286 | 286 | else |
| 287 | 287 | {return false;} |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | |
| 322 | 322 | if ((!$is_allowed_in_course || !$is_course_member) && !api_is_allowed_to_edit(null, true)) { |
| 323 | 323 | if ($origin != 'learnpath') { |
| 324 | - api_not_allowed(true);//print headers/footers |
|
| 324 | + api_not_allowed(true); //print headers/footers |
|
| 325 | 325 | } else { |
| 326 | 326 | api_not_allowed(); |
| 327 | 327 | } |
@@ -7,12 +7,12 @@ discard block |
||
| 7 | 7 | $last_access = ''; |
| 8 | 8 | // get the last time the user accessed the tool |
| 9 | 9 | if (isset($_SESSION[$_course['id']]) && $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX] == '') { |
| 10 | - $last_access = get_last_tool_access(TOOL_DROPBOX); |
|
| 11 | - $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX] = $last_access; |
|
| 10 | + $last_access = get_last_tool_access(TOOL_DROPBOX); |
|
| 11 | + $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX] = $last_access; |
|
| 12 | 12 | } else { |
| 13 | - if (isset($_SESSION[$_course['id']])) { |
|
| 14 | - $last_access = $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX]; |
|
| 15 | - } |
|
| 13 | + if (isset($_SESSION[$_course['id']])) { |
|
| 14 | + $last_access = $_SESSION[$_course['id']]['last_access'][TOOL_DROPBOX]; |
|
| 15 | + } |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | $postAction = isset($_POST['action']) ? $_POST['action'] : null; |
@@ -49,9 +49,9 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | // Display the form for adding a new dropbox item. |
| 51 | 51 | if ($action == 'add') { |
| 52 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
| 53 | - api_not_allowed(); |
|
| 54 | - } |
|
| 52 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
| 53 | + api_not_allowed(); |
|
| 54 | + } |
|
| 55 | 55 | display_add_form( |
| 56 | 56 | $dropbox_unid, |
| 57 | 57 | $viewReceivedCategory, |
@@ -61,59 +61,59 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | if (isset($_POST['submitWork'])) { |
| 64 | - $check = Security::check_token(); |
|
| 65 | - if ($check) { |
|
| 64 | + $check = Security::check_token(); |
|
| 65 | + if ($check) { |
|
| 66 | 66 | $message = store_add_dropbox(); |
| 67 | 67 | if (!empty($message)) { |
| 68 | 68 | Display :: display_confirmation_message($message); |
| 69 | 69 | } |
| 70 | - } |
|
| 70 | + } |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // Display the form for adding a category |
| 74 | 74 | if ($action == 'addreceivedcategory' || $action == 'addsentcategory') { |
| 75 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
| 76 | - api_not_allowed(); |
|
| 77 | - } |
|
| 78 | - $categoryName = isset($_POST['category_name']) ? $_POST['category_name'] : ''; |
|
| 79 | - display_addcategory_form($categoryName, '', $_GET['action']); |
|
| 75 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
| 76 | + api_not_allowed(); |
|
| 77 | + } |
|
| 78 | + $categoryName = isset($_POST['category_name']) ? $_POST['category_name'] : ''; |
|
| 79 | + display_addcategory_form($categoryName, '', $_GET['action']); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | // Editing a category: displaying the form |
| 83 | 83 | if ($action == 'editcategory' && isset($_GET['id'])) { |
| 84 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
| 85 | - api_not_allowed(); |
|
| 86 | - } |
|
| 87 | - if (!$_POST) { |
|
| 88 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
| 89 | - api_not_allowed(); |
|
| 90 | - } |
|
| 91 | - display_addcategory_form('', $_GET['id'], 'editcategory'); |
|
| 92 | - } |
|
| 84 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
| 85 | + api_not_allowed(); |
|
| 86 | + } |
|
| 87 | + if (!$_POST) { |
|
| 88 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
| 89 | + api_not_allowed(); |
|
| 90 | + } |
|
| 91 | + display_addcategory_form('', $_GET['id'], 'editcategory'); |
|
| 92 | + } |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // Storing a new or edited category |
| 96 | 96 | if (isset($_POST['StoreCategory'])) { |
| 97 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
| 98 | - api_not_allowed(); |
|
| 99 | - } |
|
| 100 | - $return_information = store_addcategory(); |
|
| 101 | - if ($return_information['type'] == 'confirmation') { |
|
| 102 | - Display :: display_confirmation_message($return_information['message']); |
|
| 103 | - } |
|
| 104 | - if ($return_information['type'] == 'error') { |
|
| 105 | - Display :: display_error_message(get_lang('FormHasErrorsPleaseComplete').'<br />'.$return_information['message']); |
|
| 106 | - display_addcategory_form($_POST['category_name'], $_POST['edit_id'], $postAction); |
|
| 107 | - } |
|
| 97 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
| 98 | + api_not_allowed(); |
|
| 99 | + } |
|
| 100 | + $return_information = store_addcategory(); |
|
| 101 | + if ($return_information['type'] == 'confirmation') { |
|
| 102 | + Display :: display_confirmation_message($return_information['message']); |
|
| 103 | + } |
|
| 104 | + if ($return_information['type'] == 'error') { |
|
| 105 | + Display :: display_error_message(get_lang('FormHasErrorsPleaseComplete').'<br />'.$return_information['message']); |
|
| 106 | + display_addcategory_form($_POST['category_name'], $_POST['edit_id'], $postAction); |
|
| 107 | + } |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | |
| 111 | 111 | // Move a File |
| 112 | 112 | if (($action == 'movesent' || $action == 'movereceived') AND isset($_GET['move_id'])) { |
| 113 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
| 114 | - api_not_allowed(); |
|
| 115 | - } |
|
| 116 | - display_move_form( |
|
| 113 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
| 114 | + api_not_allowed(); |
|
| 115 | + } |
|
| 116 | + display_move_form( |
|
| 117 | 117 | str_replace('move', '', $action), |
| 118 | 118 | $_GET['move_id'], |
| 119 | 119 | get_dropbox_categories(str_replace('move', '', $action)), |
@@ -124,33 +124,33 @@ discard block |
||
| 124 | 124 | ); |
| 125 | 125 | } |
| 126 | 126 | if (isset($_POST['do_move'])) { |
| 127 | - Display :: display_confirmation_message(store_move($_POST['id'], $_POST['move_target'], $_POST['part'])); |
|
| 127 | + Display :: display_confirmation_message(store_move($_POST['id'], $_POST['move_target'], $_POST['part'])); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | // Delete a file |
| 131 | 131 | if (($action == 'deletereceivedfile' || $action == 'deletesentfile') AND isset($_GET['id']) AND is_numeric($_GET['id'])) { |
| 132 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
| 133 | - api_not_allowed(); |
|
| 134 | - } |
|
| 135 | - $dropboxfile = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor); |
|
| 136 | - if ($action == 'deletereceivedfile') { |
|
| 137 | - $dropboxfile->deleteReceivedWork($_GET['id']); |
|
| 138 | - $message = get_lang('ReceivedFileDeleted'); |
|
| 139 | - } |
|
| 140 | - if ($action == 'deletesentfile') { |
|
| 141 | - $dropboxfile->deleteSentWork($_GET['id']); |
|
| 142 | - $message = get_lang('SentFileDeleted'); |
|
| 143 | - } |
|
| 144 | - Display :: display_confirmation_message($message); |
|
| 132 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
| 133 | + api_not_allowed(); |
|
| 134 | + } |
|
| 135 | + $dropboxfile = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor); |
|
| 136 | + if ($action == 'deletereceivedfile') { |
|
| 137 | + $dropboxfile->deleteReceivedWork($_GET['id']); |
|
| 138 | + $message = get_lang('ReceivedFileDeleted'); |
|
| 139 | + } |
|
| 140 | + if ($action == 'deletesentfile') { |
|
| 141 | + $dropboxfile->deleteSentWork($_GET['id']); |
|
| 142 | + $message = get_lang('SentFileDeleted'); |
|
| 143 | + } |
|
| 144 | + Display :: display_confirmation_message($message); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | // Delete a category |
| 148 | 148 | if (($action == 'deletereceivedcategory' || $action == 'deletesentcategory') AND isset($_GET['id']) AND is_numeric($_GET['id'])) { |
| 149 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
| 150 | - api_not_allowed(); |
|
| 151 | - } |
|
| 152 | - $message = delete_category($action, $_GET['id']); |
|
| 153 | - Display :: display_confirmation_message($message); |
|
| 149 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
| 150 | + api_not_allowed(); |
|
| 151 | + } |
|
| 152 | + $message = delete_category($action, $_GET['id']); |
|
| 153 | + Display :: display_confirmation_message($message); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | // Do an action on multiple files |
@@ -165,27 +165,27 @@ discard block |
||
| 165 | 165 | $postAction == 'delete_sent' || |
| 166 | 166 | $postAction == 'download_sent') |
| 167 | 167 | ) { |
| 168 | - $display_message = handle_multiple_actions(); |
|
| 169 | - Display :: display_normal_message($display_message); |
|
| 168 | + $display_message = handle_multiple_actions(); |
|
| 169 | + Display :: display_normal_message($display_message); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | // Store Feedback |
| 173 | 173 | |
| 174 | 174 | if (isset($_POST['feedback'])) { |
| 175 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
| 176 | - api_not_allowed(); |
|
| 177 | - } |
|
| 178 | - $check = Security::check_token(); |
|
| 179 | - if ($check) { |
|
| 180 | - $display_message = store_feedback(); |
|
| 181 | - Display :: display_normal_message($display_message); |
|
| 182 | - Security::check_token(); |
|
| 183 | - } |
|
| 175 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
| 176 | + api_not_allowed(); |
|
| 177 | + } |
|
| 178 | + $check = Security::check_token(); |
|
| 179 | + if ($check) { |
|
| 180 | + $display_message = store_feedback(); |
|
| 181 | + Display :: display_normal_message($display_message); |
|
| 182 | + Security::check_token(); |
|
| 183 | + } |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | // Error Message |
| 187 | 187 | if (isset($_GET['error']) AND !empty($_GET['error'])) { |
| 188 | - Display :: display_normal_message(get_lang($_GET['error'])); |
|
| 188 | + Display :: display_normal_message(get_lang($_GET['error'])); |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | $dropbox_data_sent = array(); |
@@ -193,96 +193,96 @@ discard block |
||
| 193 | 193 | $dropbox_data_recieved = array(); |
| 194 | 194 | |
| 195 | 195 | if ($action != 'add') { |
| 196 | - // Getting all the categories in the dropbox for the given user |
|
| 197 | - $dropbox_categories = get_dropbox_categories(); |
|
| 198 | - // Greating the arrays with the categories for the received files and for the sent files |
|
| 199 | - foreach ($dropbox_categories as $category) { |
|
| 200 | - if ($category['received'] == '1') { |
|
| 201 | - $dropbox_received_category[] = $category; |
|
| 202 | - } |
|
| 203 | - if ($category['sent'] == '1') { |
|
| 204 | - $dropbox_sent_category[] = $category; |
|
| 205 | - } |
|
| 206 | - } |
|
| 207 | - |
|
| 208 | - // ACTIONS |
|
| 209 | - if ($view == 'received' || !$dropbox_cnf['sent_received_tabs']) { |
|
| 210 | - //echo '<h3>'.get_lang('ReceivedFiles').'</h3>'; |
|
| 211 | - |
|
| 212 | - // This is for the categories |
|
| 213 | - if (isset($viewReceivedCategory) AND $viewReceivedCategory != '') { |
|
| 214 | - $view_dropbox_category_received = $viewReceivedCategory; |
|
| 215 | - } else { |
|
| 216 | - $view_dropbox_category_received = 0; |
|
| 217 | - } |
|
| 218 | - |
|
| 219 | - /* Menu Received */ |
|
| 220 | - |
|
| 221 | - if (api_get_session_id() == 0) { |
|
| 222 | - echo '<div class="actions">'; |
|
| 223 | - if ($view_dropbox_category_received != 0 && api_is_allowed_to_session_edit(false, true)) { |
|
| 224 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
| 225 | - echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_received]['cat_name']).'</strong> '; |
|
| 226 | - $movelist[0] = 'Root'; // move_received selectbox content |
|
| 227 | - } else { |
|
| 228 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
| 229 | - } |
|
| 230 | - echo '</div>'; |
|
| 231 | - } else { |
|
| 232 | - if (api_is_allowed_to_session_edit(false, true)) { |
|
| 233 | - echo '<div class="actions">'; |
|
| 234 | - if ($view_dropbox_category_received != 0 && api_is_allowed_to_session_edit(false, true)) { |
|
| 235 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
| 236 | - echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_received]['cat_name']).'</strong> '; |
|
| 237 | - $movelist[0] = 'Root'; // move_received selectbox content |
|
| 238 | - } else { |
|
| 239 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
| 240 | - } |
|
| 241 | - echo '</div>'; |
|
| 242 | - } |
|
| 243 | - } |
|
| 244 | - } |
|
| 245 | - |
|
| 246 | - if (!$view || $view == 'sent' || !$dropbox_cnf['sent_received_tabs']) { |
|
| 247 | - // This is for the categories |
|
| 248 | - if (isset($viewSentCategory) AND $viewSentCategory != '') { |
|
| 249 | - $view_dropbox_category_sent = $viewSentCategory; |
|
| 250 | - } else { |
|
| 251 | - $view_dropbox_category_sent = 0; |
|
| 252 | - } |
|
| 253 | - |
|
| 254 | - /* Menu Sent */ |
|
| 255 | - |
|
| 256 | - if (api_get_session_id() == 0) { |
|
| 257 | - echo '<div class="actions">'; |
|
| 258 | - if ($view_dropbox_category_sent != 0) { |
|
| 259 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
| 260 | - echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> '; |
|
| 261 | - } else { |
|
| 262 | - echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM)."</a>\n"; |
|
| 263 | - } |
|
| 264 | - if (empty($viewSentCategory)) { |
|
| 265 | - echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
| 266 | - } |
|
| 267 | - echo '</div>'; |
|
| 268 | - } else { |
|
| 269 | - if (api_is_allowed_to_session_edit(false, true)) { |
|
| 270 | - echo '<div class="actions">'; |
|
| 271 | - if ($view_dropbox_category_sent != 0) { |
|
| 272 | - echo get_lang('CurrentlySeeing').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> '; |
|
| 273 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
| 274 | - } else { |
|
| 275 | - echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM)."</a>\n"; |
|
| 276 | - } |
|
| 277 | - if (empty($viewSentCategory)) { |
|
| 278 | - echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
| 279 | - } |
|
| 280 | - echo '</div>'; |
|
| 281 | - } |
|
| 282 | - } |
|
| 283 | - } |
|
| 284 | - /* THE MENU TABS */ |
|
| 285 | - if ($dropbox_cnf['sent_received_tabs']) { |
|
| 196 | + // Getting all the categories in the dropbox for the given user |
|
| 197 | + $dropbox_categories = get_dropbox_categories(); |
|
| 198 | + // Greating the arrays with the categories for the received files and for the sent files |
|
| 199 | + foreach ($dropbox_categories as $category) { |
|
| 200 | + if ($category['received'] == '1') { |
|
| 201 | + $dropbox_received_category[] = $category; |
|
| 202 | + } |
|
| 203 | + if ($category['sent'] == '1') { |
|
| 204 | + $dropbox_sent_category[] = $category; |
|
| 205 | + } |
|
| 206 | + } |
|
| 207 | + |
|
| 208 | + // ACTIONS |
|
| 209 | + if ($view == 'received' || !$dropbox_cnf['sent_received_tabs']) { |
|
| 210 | + //echo '<h3>'.get_lang('ReceivedFiles').'</h3>'; |
|
| 211 | + |
|
| 212 | + // This is for the categories |
|
| 213 | + if (isset($viewReceivedCategory) AND $viewReceivedCategory != '') { |
|
| 214 | + $view_dropbox_category_received = $viewReceivedCategory; |
|
| 215 | + } else { |
|
| 216 | + $view_dropbox_category_received = 0; |
|
| 217 | + } |
|
| 218 | + |
|
| 219 | + /* Menu Received */ |
|
| 220 | + |
|
| 221 | + if (api_get_session_id() == 0) { |
|
| 222 | + echo '<div class="actions">'; |
|
| 223 | + if ($view_dropbox_category_received != 0 && api_is_allowed_to_session_edit(false, true)) { |
|
| 224 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
| 225 | + echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_received]['cat_name']).'</strong> '; |
|
| 226 | + $movelist[0] = 'Root'; // move_received selectbox content |
|
| 227 | + } else { |
|
| 228 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
| 229 | + } |
|
| 230 | + echo '</div>'; |
|
| 231 | + } else { |
|
| 232 | + if (api_is_allowed_to_session_edit(false, true)) { |
|
| 233 | + echo '<div class="actions">'; |
|
| 234 | + if ($view_dropbox_category_received != 0 && api_is_allowed_to_session_edit(false, true)) { |
|
| 235 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
| 236 | + echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_received]['cat_name']).'</strong> '; |
|
| 237 | + $movelist[0] = 'Root'; // move_received selectbox content |
|
| 238 | + } else { |
|
| 239 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
| 240 | + } |
|
| 241 | + echo '</div>'; |
|
| 242 | + } |
|
| 243 | + } |
|
| 244 | + } |
|
| 245 | + |
|
| 246 | + if (!$view || $view == 'sent' || !$dropbox_cnf['sent_received_tabs']) { |
|
| 247 | + // This is for the categories |
|
| 248 | + if (isset($viewSentCategory) AND $viewSentCategory != '') { |
|
| 249 | + $view_dropbox_category_sent = $viewSentCategory; |
|
| 250 | + } else { |
|
| 251 | + $view_dropbox_category_sent = 0; |
|
| 252 | + } |
|
| 253 | + |
|
| 254 | + /* Menu Sent */ |
|
| 255 | + |
|
| 256 | + if (api_get_session_id() == 0) { |
|
| 257 | + echo '<div class="actions">'; |
|
| 258 | + if ($view_dropbox_category_sent != 0) { |
|
| 259 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
| 260 | + echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> '; |
|
| 261 | + } else { |
|
| 262 | + echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM)."</a>\n"; |
|
| 263 | + } |
|
| 264 | + if (empty($viewSentCategory)) { |
|
| 265 | + echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
| 266 | + } |
|
| 267 | + echo '</div>'; |
|
| 268 | + } else { |
|
| 269 | + if (api_is_allowed_to_session_edit(false, true)) { |
|
| 270 | + echo '<div class="actions">'; |
|
| 271 | + if ($view_dropbox_category_sent != 0) { |
|
| 272 | + echo get_lang('CurrentlySeeing').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> '; |
|
| 273 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
| 274 | + } else { |
|
| 275 | + echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM)."</a>\n"; |
|
| 276 | + } |
|
| 277 | + if (empty($viewSentCategory)) { |
|
| 278 | + echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
| 279 | + } |
|
| 280 | + echo '</div>'; |
|
| 281 | + } |
|
| 282 | + } |
|
| 283 | + } |
|
| 284 | + /* THE MENU TABS */ |
|
| 285 | + if ($dropbox_cnf['sent_received_tabs']) { |
|
| 286 | 286 | ?> |
| 287 | 287 | <ul class="nav nav-tabs"> |
| 288 | 288 | <li <?php if (!$view || $view == 'sent') { echo 'class="active"'; } ?> > |
@@ -296,150 +296,150 @@ discard block |
||
| 296 | 296 | </li> |
| 297 | 297 | </ul> |
| 298 | 298 | <?php |
| 299 | - } |
|
| 299 | + } |
|
| 300 | 300 | /* RECEIVED FILES */ |
| 301 | - if ($view == 'received' || !$dropbox_cnf['sent_received_tabs']) { |
|
| 302 | - // This is for the categories |
|
| 303 | - if (isset($viewReceivedCategory) AND $viewReceivedCategory != '') { |
|
| 304 | - $view_dropbox_category_received = $viewReceivedCategory; |
|
| 305 | - } else { |
|
| 306 | - $view_dropbox_category_received = 0; |
|
| 307 | - } |
|
| 308 | - |
|
| 309 | - // Object initialisation |
|
| 310 | - $dropbox_person = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor); |
|
| 311 | - // note: are the $is_courseAdmin and $is_courseTutor parameters needed???? |
|
| 312 | - |
|
| 313 | - // Constructing the array that contains the total number of feedback messages per document. |
|
| 314 | - $number_feedback = get_total_number_feedback(); |
|
| 315 | - |
|
| 316 | - // Sorting and paging options |
|
| 317 | - $sorting_options = array(); |
|
| 318 | - $paging_options = array(); |
|
| 319 | - |
|
| 320 | - // The headers of the sortable tables |
|
| 321 | - $column_header = array(); |
|
| 322 | - $column_header[] = array('', false, ''); |
|
| 323 | - $column_header[] = array(get_lang('Type'), true, 'style="width:40px"', 'style="text-align:center"'); |
|
| 324 | - $column_header[] = array(get_lang('ReceivedTitle'), true, ''); |
|
| 325 | - $column_header[] = array(get_lang('Size'), true, ''); |
|
| 326 | - $column_header[] = array(get_lang('Authors'), true, ''); |
|
| 327 | - $column_header[] = array(get_lang('LastResent'), true); |
|
| 328 | - |
|
| 329 | - if (api_get_session_id() == 0) { |
|
| 330 | - $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
| 331 | - } elseif (api_is_allowed_to_session_edit(false,true)) { |
|
| 332 | - $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
| 333 | - } |
|
| 334 | - |
|
| 335 | - $column_header[] = array('RealDate', true); |
|
| 336 | - $column_header[] = array('RealSize', true); |
|
| 337 | - |
|
| 338 | - // An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide |
|
| 339 | - $column_show[] = 1; |
|
| 340 | - $column_show[] = 1; |
|
| 341 | - $column_show[] = 1; |
|
| 342 | - $column_show[] = 1; |
|
| 343 | - $column_show[] = 1; |
|
| 344 | - $column_show[] = 1; |
|
| 345 | - |
|
| 346 | - if (api_get_session_id() == 0) { |
|
| 347 | - $column_show[] = 1; |
|
| 348 | - } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
| 349 | - $column_show[] = 1; |
|
| 350 | - } |
|
| 351 | - $column_show[] = 0; |
|
| 352 | - |
|
| 353 | - // Here we change the way how the columns are going to be sort |
|
| 354 | - // in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate |
|
| 355 | - // because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48" |
|
| 356 | - |
|
| 357 | - $column_order[3] = 8; |
|
| 358 | - $column_order[5] = 7; |
|
| 359 | - |
|
| 360 | - // The content of the sortable table = the received files |
|
| 361 | - foreach ($dropbox_person -> receivedWork as $dropbox_file) { |
|
| 362 | - $dropbox_file_data = array(); |
|
| 363 | - if ($view_dropbox_category_received == $dropbox_file->category) { |
|
| 301 | + if ($view == 'received' || !$dropbox_cnf['sent_received_tabs']) { |
|
| 302 | + // This is for the categories |
|
| 303 | + if (isset($viewReceivedCategory) AND $viewReceivedCategory != '') { |
|
| 304 | + $view_dropbox_category_received = $viewReceivedCategory; |
|
| 305 | + } else { |
|
| 306 | + $view_dropbox_category_received = 0; |
|
| 307 | + } |
|
| 308 | + |
|
| 309 | + // Object initialisation |
|
| 310 | + $dropbox_person = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor); |
|
| 311 | + // note: are the $is_courseAdmin and $is_courseTutor parameters needed???? |
|
| 312 | + |
|
| 313 | + // Constructing the array that contains the total number of feedback messages per document. |
|
| 314 | + $number_feedback = get_total_number_feedback(); |
|
| 315 | + |
|
| 316 | + // Sorting and paging options |
|
| 317 | + $sorting_options = array(); |
|
| 318 | + $paging_options = array(); |
|
| 319 | + |
|
| 320 | + // The headers of the sortable tables |
|
| 321 | + $column_header = array(); |
|
| 322 | + $column_header[] = array('', false, ''); |
|
| 323 | + $column_header[] = array(get_lang('Type'), true, 'style="width:40px"', 'style="text-align:center"'); |
|
| 324 | + $column_header[] = array(get_lang('ReceivedTitle'), true, ''); |
|
| 325 | + $column_header[] = array(get_lang('Size'), true, ''); |
|
| 326 | + $column_header[] = array(get_lang('Authors'), true, ''); |
|
| 327 | + $column_header[] = array(get_lang('LastResent'), true); |
|
| 328 | + |
|
| 329 | + if (api_get_session_id() == 0) { |
|
| 330 | + $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
| 331 | + } elseif (api_is_allowed_to_session_edit(false,true)) { |
|
| 332 | + $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
| 333 | + } |
|
| 334 | + |
|
| 335 | + $column_header[] = array('RealDate', true); |
|
| 336 | + $column_header[] = array('RealSize', true); |
|
| 337 | + |
|
| 338 | + // An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide |
|
| 339 | + $column_show[] = 1; |
|
| 340 | + $column_show[] = 1; |
|
| 341 | + $column_show[] = 1; |
|
| 342 | + $column_show[] = 1; |
|
| 343 | + $column_show[] = 1; |
|
| 344 | + $column_show[] = 1; |
|
| 345 | + |
|
| 346 | + if (api_get_session_id() == 0) { |
|
| 347 | + $column_show[] = 1; |
|
| 348 | + } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
| 349 | + $column_show[] = 1; |
|
| 350 | + } |
|
| 351 | + $column_show[] = 0; |
|
| 352 | + |
|
| 353 | + // Here we change the way how the columns are going to be sort |
|
| 354 | + // in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate |
|
| 355 | + // because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48" |
|
| 356 | + |
|
| 357 | + $column_order[3] = 8; |
|
| 358 | + $column_order[5] = 7; |
|
| 359 | + |
|
| 360 | + // The content of the sortable table = the received files |
|
| 361 | + foreach ($dropbox_person -> receivedWork as $dropbox_file) { |
|
| 362 | + $dropbox_file_data = array(); |
|
| 363 | + if ($view_dropbox_category_received == $dropbox_file->category) { |
|
| 364 | 364 | // we only display the files that are in the category that we are in. |
| 365 | - $dropbox_file_data[] = $dropbox_file->id; |
|
| 365 | + $dropbox_file_data[] = $dropbox_file->id; |
|
| 366 | 366 | |
| 367 | - if (!is_array($_SESSION['_seen'][$_course['id']][TOOL_DROPBOX])) { |
|
| 368 | - $_SESSION['_seen'][$_course['id']][TOOL_DROPBOX] = array(); |
|
| 369 | - } |
|
| 367 | + if (!is_array($_SESSION['_seen'][$_course['id']][TOOL_DROPBOX])) { |
|
| 368 | + $_SESSION['_seen'][$_course['id']][TOOL_DROPBOX] = array(); |
|
| 369 | + } |
|
| 370 | 370 | |
| 371 | - // New icon |
|
| 372 | - $new_icon = ''; |
|
| 373 | - if ($dropbox_file->last_upload_date > $last_access && |
|
| 371 | + // New icon |
|
| 372 | + $new_icon = ''; |
|
| 373 | + if ($dropbox_file->last_upload_date > $last_access && |
|
| 374 | 374 | !in_array($dropbox_file->id, $_SESSION['_seen'][$_course['id']][TOOL_DROPBOX]) |
| 375 | 375 | ) { |
| 376 | - $new_icon = ' '.Display::return_icon('new_dropbox_message.png', get_lang('New'),'',ICON_SIZE_SMALL); |
|
| 377 | - } |
|
| 376 | + $new_icon = ' '.Display::return_icon('new_dropbox_message.png', get_lang('New'),'',ICON_SIZE_SMALL); |
|
| 377 | + } |
|
| 378 | 378 | |
| 379 | - $link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">'; |
|
| 380 | - $dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>'; |
|
| 381 | - $dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'. |
|
| 379 | + $link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">'; |
|
| 380 | + $dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>'; |
|
| 381 | + $dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'. |
|
| 382 | 382 | Display::return_icon('save.png', get_lang('Download'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$dropbox_file->title.'</a>'.$new_icon.'<br />'.$dropbox_file->description; |
| 383 | - $file_size = $dropbox_file->filesize; |
|
| 384 | - $dropbox_file_data[] = format_file_size($file_size); |
|
| 385 | - $dropbox_file_data[] = $dropbox_file->author; |
|
| 383 | + $file_size = $dropbox_file->filesize; |
|
| 384 | + $dropbox_file_data[] = format_file_size($file_size); |
|
| 385 | + $dropbox_file_data[] = $dropbox_file->author; |
|
| 386 | 386 | |
| 387 | - $last_upload_date = api_get_local_time($dropbox_file->last_upload_date); |
|
| 388 | - $dropbox_file_data[] = date_to_str_ago($last_upload_date).'<br /><span class="dropbox_date">'. |
|
| 387 | + $last_upload_date = api_get_local_time($dropbox_file->last_upload_date); |
|
| 388 | + $dropbox_file_data[] = date_to_str_ago($last_upload_date).'<br /><span class="dropbox_date">'. |
|
| 389 | 389 | api_format_date($last_upload_date).'</span>'; |
| 390 | 390 | |
| 391 | - $action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').' |
|
| 391 | + $action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').' |
|
| 392 | 392 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=viewfeedback&id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('discuss.png', get_lang('Comment'),'',ICON_SIZE_SMALL).'</a> |
| 393 | 393 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=movereceived&move_id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('move.png', get_lang('Move'),'',ICON_SIZE_SMALL).'</a> |
| 394 | 394 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletereceivedfile&id='.$dropbox_file->id.'&'.$sort_params.'" onclick="javascript: return confirmation(\''.$dropbox_file->title.'\');">'. |
| 395 | 395 | Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
| 396 | 396 | |
| 397 | - // This is a hack to have an additional row in a sortable table |
|
| 398 | - |
|
| 399 | - if ($action == 'viewfeedback' AND isset($_GET['id']) and is_numeric($_GET['id']) AND $dropbox_file->id == $_GET['id']) { |
|
| 400 | - $action_icons .= "</td></tr>"; // Ending the normal row of the sortable table |
|
| 401 | - $action_icons .= '<tr><td colspan="2"><a href="'.api_get_path(WEB_CODE_PATH).'dropbox/index.php?"'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory."&view_sent_category=".$viewSentCategory."&view=".$view.'&'.$sort_params."\">".get_lang('CloseFeedback')."</a></td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td></tr>"; |
|
| 402 | - } |
|
| 403 | - if (api_get_session_id() == 0) { |
|
| 404 | - $dropbox_file_data[] = $action_icons; |
|
| 405 | - } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
| 406 | - $dropbox_file_data[] = $action_icons; |
|
| 407 | - } |
|
| 408 | - $action_icons = ''; |
|
| 409 | - $dropbox_file_data[] = $last_upload_date; |
|
| 410 | - $dropbox_file_data[] = $file_size; |
|
| 411 | - $dropbox_data_recieved[] = $dropbox_file_data; |
|
| 412 | - } |
|
| 413 | - } |
|
| 414 | - |
|
| 415 | - // The content of the sortable table = the categories (if we are not in the root) |
|
| 416 | - if ($view_dropbox_category_received == 0) { |
|
| 417 | - foreach ($dropbox_categories as $category) { |
|
| 418 | - /* Note: This can probably be shortened since the categories |
|
| 397 | + // This is a hack to have an additional row in a sortable table |
|
| 398 | + |
|
| 399 | + if ($action == 'viewfeedback' AND isset($_GET['id']) and is_numeric($_GET['id']) AND $dropbox_file->id == $_GET['id']) { |
|
| 400 | + $action_icons .= "</td></tr>"; // Ending the normal row of the sortable table |
|
| 401 | + $action_icons .= '<tr><td colspan="2"><a href="'.api_get_path(WEB_CODE_PATH).'dropbox/index.php?"'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory."&view_sent_category=".$viewSentCategory."&view=".$view.'&'.$sort_params."\">".get_lang('CloseFeedback')."</a></td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td></tr>"; |
|
| 402 | + } |
|
| 403 | + if (api_get_session_id() == 0) { |
|
| 404 | + $dropbox_file_data[] = $action_icons; |
|
| 405 | + } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
| 406 | + $dropbox_file_data[] = $action_icons; |
|
| 407 | + } |
|
| 408 | + $action_icons = ''; |
|
| 409 | + $dropbox_file_data[] = $last_upload_date; |
|
| 410 | + $dropbox_file_data[] = $file_size; |
|
| 411 | + $dropbox_data_recieved[] = $dropbox_file_data; |
|
| 412 | + } |
|
| 413 | + } |
|
| 414 | + |
|
| 415 | + // The content of the sortable table = the categories (if we are not in the root) |
|
| 416 | + if ($view_dropbox_category_received == 0) { |
|
| 417 | + foreach ($dropbox_categories as $category) { |
|
| 418 | + /* Note: This can probably be shortened since the categories |
|
| 419 | 419 | for the received files are already in the |
| 420 | 420 | $dropbox_received_category array;*/ |
| 421 | - $dropbox_category_data = array(); |
|
| 422 | - if ($category['received'] == '1') { |
|
| 423 | - $movelist[$category['cat_id']] = $category['cat_name']; |
|
| 421 | + $dropbox_category_data = array(); |
|
| 422 | + if ($category['received'] == '1') { |
|
| 423 | + $movelist[$category['cat_id']] = $category['cat_name']; |
|
| 424 | 424 | // This is where the checkbox icon for the files appear |
| 425 | - $dropbox_category_data[] = $category['cat_id']; |
|
| 426 | - // The icon of the category |
|
| 427 | - $link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$category['cat_id'].'&view_sent_category='.$viewSentCategory.'&view='.$view.'">'; |
|
| 428 | - $dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', $category['cat_name']).'</a>'; |
|
| 429 | - $dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=received">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$category['cat_name'].'</a>'; |
|
| 430 | - $dropbox_category_data[] = ''; |
|
| 431 | - $dropbox_category_data[] = ''; |
|
| 432 | - $dropbox_category_data[] = ''; |
|
| 433 | - $dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a> |
|
| 425 | + $dropbox_category_data[] = $category['cat_id']; |
|
| 426 | + // The icon of the category |
|
| 427 | + $link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$category['cat_id'].'&view_sent_category='.$viewSentCategory.'&view='.$view.'">'; |
|
| 428 | + $dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', $category['cat_name']).'</a>'; |
|
| 429 | + $dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=received">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$category['cat_name'].'</a>'; |
|
| 430 | + $dropbox_category_data[] = ''; |
|
| 431 | + $dropbox_category_data[] = ''; |
|
| 432 | + $dropbox_category_data[] = ''; |
|
| 433 | + $dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a> |
|
| 434 | 434 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletereceivedcategory&id='.$category['cat_id'].'" onclick="javascript: return confirmation(\''.Security::remove_XSS($category['cat_name']).'\');">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
| 435 | - } |
|
| 436 | - if (is_array($dropbox_category_data) && count($dropbox_category_data) > 0) { |
|
| 437 | - $dropbox_data_recieved[] = $dropbox_category_data; |
|
| 438 | - } |
|
| 439 | - } |
|
| 440 | - } |
|
| 441 | - |
|
| 442 | - // Displaying the table |
|
| 435 | + } |
|
| 436 | + if (is_array($dropbox_category_data) && count($dropbox_category_data) > 0) { |
|
| 437 | + $dropbox_data_recieved[] = $dropbox_category_data; |
|
| 438 | + } |
|
| 439 | + } |
|
| 440 | + } |
|
| 441 | + |
|
| 442 | + // Displaying the table |
|
| 443 | 443 | $additional_get_parameters = array( |
| 444 | 444 | 'view' => $view, |
| 445 | 445 | 'view_received_category' => $viewReceivedCategory, |
@@ -450,15 +450,15 @@ discard block |
||
| 450 | 450 | 'download_received' => get_lang('Download') |
| 451 | 451 | ); |
| 452 | 452 | |
| 453 | - if (is_array($movelist)) { |
|
| 454 | - foreach ($movelist as $catid => $catname){ |
|
| 455 | - $selectlist['move_received_'.$catid] = get_lang('Move') . '->'. Security::remove_XSS($catname); |
|
| 456 | - } |
|
| 457 | - } |
|
| 453 | + if (is_array($movelist)) { |
|
| 454 | + foreach ($movelist as $catid => $catname){ |
|
| 455 | + $selectlist['move_received_'.$catid] = get_lang('Move') . '->'. Security::remove_XSS($catname); |
|
| 456 | + } |
|
| 457 | + } |
|
| 458 | 458 | |
| 459 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
| 460 | - $selectlist = array(); |
|
| 461 | - } |
|
| 459 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
| 460 | + $selectlist = array(); |
|
| 461 | + } |
|
| 462 | 462 | echo '<div class="files-table">'; |
| 463 | 463 | Display::display_sortable_config_table( |
| 464 | 464 | 'dropbox', |
@@ -472,153 +472,153 @@ discard block |
||
| 472 | 472 | $selectlist |
| 473 | 473 | ); |
| 474 | 474 | echo '</div>'; |
| 475 | - } |
|
| 476 | - |
|
| 477 | - /* SENT FILES */ |
|
| 478 | - |
|
| 479 | - if (!$view || $view == 'sent' || !$dropbox_cnf['sent_received_tabs']) { |
|
| 480 | - // This is for the categories |
|
| 481 | - if (isset($viewSentCategory) AND $viewSentCategory != '') { |
|
| 482 | - $view_dropbox_category_sent = $viewSentCategory; |
|
| 483 | - } else { |
|
| 484 | - $view_dropbox_category_sent = 0; |
|
| 485 | - } |
|
| 486 | - |
|
| 487 | - // Object initialisation |
|
| 488 | - $dropbox_person = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor); |
|
| 489 | - |
|
| 490 | - // Constructing the array that contains the total number of feedback messages per document. |
|
| 491 | - $number_feedback = get_total_number_feedback(); |
|
| 492 | - |
|
| 493 | - // Sorting and paging options |
|
| 494 | - $sorting_options = array(); |
|
| 495 | - $paging_options = array(); |
|
| 496 | - |
|
| 497 | - // The headers of the sortable tables |
|
| 498 | - $column_header = array(); |
|
| 499 | - |
|
| 500 | - $column_header[] = array('', false, ''); |
|
| 501 | - $column_header[] = array(get_lang('Type'), true, 'style="width:40px"', 'style="text-align:center"'); |
|
| 502 | - $column_header[] = array(get_lang('SentTitle'), true, ''); |
|
| 503 | - $column_header[] = array(get_lang('Size'), true, ''); |
|
| 504 | - $column_header[] = array(get_lang('SentTo'), true, ''); |
|
| 505 | - $column_header[] = array(get_lang('LastResent'), true, ''); |
|
| 506 | - |
|
| 507 | - if (api_get_session_id() == 0) { |
|
| 508 | - $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
| 509 | - } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
| 510 | - $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
| 511 | - } |
|
| 512 | - |
|
| 513 | - $column_header[] = array('RealDate', true); |
|
| 514 | - $column_header[] = array('RealSize', true); |
|
| 515 | - |
|
| 516 | - $column_show = array(); |
|
| 517 | - $column_order = array(); |
|
| 518 | - |
|
| 519 | - // An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide |
|
| 520 | - $column_show[] = 1; |
|
| 521 | - $column_show[] = 1; |
|
| 522 | - $column_show[] = 1; |
|
| 523 | - $column_show[] = 1; |
|
| 524 | - $column_show[] = 1; |
|
| 525 | - $column_show[] = 1; |
|
| 526 | - if (api_get_session_id() == 0) { |
|
| 527 | - $column_show[] = 1; |
|
| 528 | - } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
| 529 | - $column_show[] = 1; |
|
| 530 | - } |
|
| 531 | - $column_show[] = 0; |
|
| 532 | - |
|
| 533 | - // Here we change the way how the colums are going to be sort |
|
| 534 | - // in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate |
|
| 535 | - // because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48" |
|
| 536 | - |
|
| 537 | - $column_order[3] = 8; |
|
| 538 | - $column_order[5] = 7; |
|
| 539 | - |
|
| 540 | - // The content of the sortable table = the received files |
|
| 541 | - foreach ($dropbox_person->sentWork as $dropbox_file) { |
|
| 542 | - $dropbox_file_data = array(); |
|
| 543 | - |
|
| 544 | - if ($view_dropbox_category_sent == $dropbox_file->category) { |
|
| 545 | - $dropbox_file_data[] = $dropbox_file->id; |
|
| 546 | - $link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">'; |
|
| 547 | - $dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>'; |
|
| 548 | - $dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'. |
|
| 475 | + } |
|
| 476 | + |
|
| 477 | + /* SENT FILES */ |
|
| 478 | + |
|
| 479 | + if (!$view || $view == 'sent' || !$dropbox_cnf['sent_received_tabs']) { |
|
| 480 | + // This is for the categories |
|
| 481 | + if (isset($viewSentCategory) AND $viewSentCategory != '') { |
|
| 482 | + $view_dropbox_category_sent = $viewSentCategory; |
|
| 483 | + } else { |
|
| 484 | + $view_dropbox_category_sent = 0; |
|
| 485 | + } |
|
| 486 | + |
|
| 487 | + // Object initialisation |
|
| 488 | + $dropbox_person = new Dropbox_Person(api_get_user_id(), $is_courseAdmin, $is_courseTutor); |
|
| 489 | + |
|
| 490 | + // Constructing the array that contains the total number of feedback messages per document. |
|
| 491 | + $number_feedback = get_total_number_feedback(); |
|
| 492 | + |
|
| 493 | + // Sorting and paging options |
|
| 494 | + $sorting_options = array(); |
|
| 495 | + $paging_options = array(); |
|
| 496 | + |
|
| 497 | + // The headers of the sortable tables |
|
| 498 | + $column_header = array(); |
|
| 499 | + |
|
| 500 | + $column_header[] = array('', false, ''); |
|
| 501 | + $column_header[] = array(get_lang('Type'), true, 'style="width:40px"', 'style="text-align:center"'); |
|
| 502 | + $column_header[] = array(get_lang('SentTitle'), true, ''); |
|
| 503 | + $column_header[] = array(get_lang('Size'), true, ''); |
|
| 504 | + $column_header[] = array(get_lang('SentTo'), true, ''); |
|
| 505 | + $column_header[] = array(get_lang('LastResent'), true, ''); |
|
| 506 | + |
|
| 507 | + if (api_get_session_id() == 0) { |
|
| 508 | + $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
| 509 | + } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
| 510 | + $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
|
| 511 | + } |
|
| 512 | + |
|
| 513 | + $column_header[] = array('RealDate', true); |
|
| 514 | + $column_header[] = array('RealSize', true); |
|
| 515 | + |
|
| 516 | + $column_show = array(); |
|
| 517 | + $column_order = array(); |
|
| 518 | + |
|
| 519 | + // An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide |
|
| 520 | + $column_show[] = 1; |
|
| 521 | + $column_show[] = 1; |
|
| 522 | + $column_show[] = 1; |
|
| 523 | + $column_show[] = 1; |
|
| 524 | + $column_show[] = 1; |
|
| 525 | + $column_show[] = 1; |
|
| 526 | + if (api_get_session_id() == 0) { |
|
| 527 | + $column_show[] = 1; |
|
| 528 | + } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
| 529 | + $column_show[] = 1; |
|
| 530 | + } |
|
| 531 | + $column_show[] = 0; |
|
| 532 | + |
|
| 533 | + // Here we change the way how the colums are going to be sort |
|
| 534 | + // in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate |
|
| 535 | + // because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48" |
|
| 536 | + |
|
| 537 | + $column_order[3] = 8; |
|
| 538 | + $column_order[5] = 7; |
|
| 539 | + |
|
| 540 | + // The content of the sortable table = the received files |
|
| 541 | + foreach ($dropbox_person->sentWork as $dropbox_file) { |
|
| 542 | + $dropbox_file_data = array(); |
|
| 543 | + |
|
| 544 | + if ($view_dropbox_category_sent == $dropbox_file->category) { |
|
| 545 | + $dropbox_file_data[] = $dropbox_file->id; |
|
| 546 | + $link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">'; |
|
| 547 | + $dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>'; |
|
| 548 | + $dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'. |
|
| 549 | 549 | Display::return_icon('save.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$dropbox_file->title.'</a><br />'.$dropbox_file->description; |
| 550 | - $file_size = $dropbox_file->filesize; |
|
| 551 | - $dropbox_file_data[] = format_file_size($file_size); |
|
| 550 | + $file_size = $dropbox_file->filesize; |
|
| 551 | + $dropbox_file_data[] = format_file_size($file_size); |
|
| 552 | 552 | $receivers_celldata = null; |
| 553 | - foreach ($dropbox_file->recipients as $recipient) { |
|
| 554 | - $userInfo = api_get_user_info($recipient['user_id']); |
|
| 555 | - $receivers_celldata = UserManager::getUserProfileLink($userInfo).', '.$receivers_celldata; |
|
| 556 | - } |
|
| 557 | - $receivers_celldata = trim(trim($receivers_celldata), ','); // Removing the trailing comma. |
|
| 558 | - $dropbox_file_data[] = $receivers_celldata; |
|
| 559 | - $last_upload_date = api_get_local_time($dropbox_file->last_upload_date); |
|
| 560 | - $dropbox_file_data[] = date_to_str_ago($last_upload_date).'<br /><span class="dropbox_date">'.api_format_date($last_upload_date).'</span>'; |
|
| 561 | - |
|
| 562 | - //$dropbox_file_data[] = $dropbox_file->author; |
|
| 563 | - $receivers_celldata = ''; |
|
| 564 | - |
|
| 565 | - $action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').' |
|
| 553 | + foreach ($dropbox_file->recipients as $recipient) { |
|
| 554 | + $userInfo = api_get_user_info($recipient['user_id']); |
|
| 555 | + $receivers_celldata = UserManager::getUserProfileLink($userInfo).', '.$receivers_celldata; |
|
| 556 | + } |
|
| 557 | + $receivers_celldata = trim(trim($receivers_celldata), ','); // Removing the trailing comma. |
|
| 558 | + $dropbox_file_data[] = $receivers_celldata; |
|
| 559 | + $last_upload_date = api_get_local_time($dropbox_file->last_upload_date); |
|
| 560 | + $dropbox_file_data[] = date_to_str_ago($last_upload_date).'<br /><span class="dropbox_date">'.api_format_date($last_upload_date).'</span>'; |
|
| 561 | + |
|
| 562 | + //$dropbox_file_data[] = $dropbox_file->author; |
|
| 563 | + $receivers_celldata = ''; |
|
| 564 | + |
|
| 565 | + $action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').' |
|
| 566 | 566 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=viewfeedback&id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('discuss.png', get_lang('Comment'),'',ICON_SIZE_SMALL).'</a> |
| 567 | 567 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=movesent&move_id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('move.png', get_lang('Move'),'',ICON_SIZE_SMALL).'</a> |
| 568 | 568 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletesentfile&id='.$dropbox_file->id.'&'.$sort_params.'" onclick="javascript: return confirmation(\''.$dropbox_file->title.'\');">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
| 569 | - // This is a hack to have an additional row in a sortable table |
|
| 570 | - if ($action == 'viewfeedback' && isset($_GET['id']) && is_numeric($_GET['id']) && $dropbox_file->id == $_GET['id']) { |
|
| 571 | - $action_icons .= "</td></tr>\n"; // ending the normal row of the sortable table |
|
| 572 | - $action_icons .= "<tr><td colspan=\"2\">"; |
|
| 573 | - $action_icons .= "<a href=\"".api_get_path(WEB_CODE_PATH)."dropbox/index.php?".api_get_cidreq()."&view_received_category=".$viewReceivedCategory."&view_sent_category=".$viewSentCategory."&view=".$view.'&'.$sort_params."\">".get_lang('CloseFeedback')."</a>"; |
|
| 574 | - $action_icons .= "</td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td></tr>"; |
|
| 575 | - } |
|
| 576 | - $dropbox_file_data[] = $action_icons; |
|
| 577 | - $dropbox_file_data[] = $last_upload_date; |
|
| 578 | - $dropbox_file_data[] = $file_size; |
|
| 579 | - $action_icons = ''; |
|
| 580 | - $dropbox_data_sent[] = $dropbox_file_data; |
|
| 581 | - } |
|
| 582 | - } |
|
| 569 | + // This is a hack to have an additional row in a sortable table |
|
| 570 | + if ($action == 'viewfeedback' && isset($_GET['id']) && is_numeric($_GET['id']) && $dropbox_file->id == $_GET['id']) { |
|
| 571 | + $action_icons .= "</td></tr>\n"; // ending the normal row of the sortable table |
|
| 572 | + $action_icons .= "<tr><td colspan=\"2\">"; |
|
| 573 | + $action_icons .= "<a href=\"".api_get_path(WEB_CODE_PATH)."dropbox/index.php?".api_get_cidreq()."&view_received_category=".$viewReceivedCategory."&view_sent_category=".$viewSentCategory."&view=".$view.'&'.$sort_params."\">".get_lang('CloseFeedback')."</a>"; |
|
| 574 | + $action_icons .= "</td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td></tr>"; |
|
| 575 | + } |
|
| 576 | + $dropbox_file_data[] = $action_icons; |
|
| 577 | + $dropbox_file_data[] = $last_upload_date; |
|
| 578 | + $dropbox_file_data[] = $file_size; |
|
| 579 | + $action_icons = ''; |
|
| 580 | + $dropbox_data_sent[] = $dropbox_file_data; |
|
| 581 | + } |
|
| 582 | + } |
|
| 583 | 583 | |
| 584 | 584 | $moveList = array(); |
| 585 | - // The content of the sortable table = the categories (if we are not in the root) |
|
| 586 | - if ($view_dropbox_category_sent == 0) { |
|
| 587 | - foreach ($dropbox_categories as $category) { |
|
| 588 | - $dropbox_category_data = array(); |
|
| 585 | + // The content of the sortable table = the categories (if we are not in the root) |
|
| 586 | + if ($view_dropbox_category_sent == 0) { |
|
| 587 | + foreach ($dropbox_categories as $category) { |
|
| 588 | + $dropbox_category_data = array(); |
|
| 589 | 589 | |
| 590 | - if ($category['sent'] == '1') { |
|
| 590 | + if ($category['sent'] == '1') { |
|
| 591 | 591 | |
| 592 | 592 | $moveList[$category['cat_id']] = $category['cat_name']; |
| 593 | - $dropbox_category_data[] = $category['cat_id']; |
|
| 594 | - // This is where the checkbox icon for the files appear. |
|
| 595 | - $link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$category['cat_id'].'&view='.$view.'">'; |
|
| 596 | - $dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', Security::remove_XSS($category['cat_name'])).'</a>'; |
|
| 597 | - $dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=sent">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.Security::remove_XSS($category['cat_name']).'</a>'; |
|
| 598 | - //$dropbox_category_data[] = ''; |
|
| 599 | - $dropbox_category_data[] = ''; |
|
| 600 | - //$dropbox_category_data[] = ''; |
|
| 601 | - $dropbox_category_data[] = ''; |
|
| 602 | - $dropbox_category_data[] = ''; |
|
| 603 | - $dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'. |
|
| 593 | + $dropbox_category_data[] = $category['cat_id']; |
|
| 594 | + // This is where the checkbox icon for the files appear. |
|
| 595 | + $link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$category['cat_id'].'&view='.$view.'">'; |
|
| 596 | + $dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', Security::remove_XSS($category['cat_name'])).'</a>'; |
|
| 597 | + $dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=sent">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.Security::remove_XSS($category['cat_name']).'</a>'; |
|
| 598 | + //$dropbox_category_data[] = ''; |
|
| 599 | + $dropbox_category_data[] = ''; |
|
| 600 | + //$dropbox_category_data[] = ''; |
|
| 601 | + $dropbox_category_data[] = ''; |
|
| 602 | + $dropbox_category_data[] = ''; |
|
| 603 | + $dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'. |
|
| 604 | 604 | Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a> |
| 605 | 605 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletesentcategory&id='.$category['cat_id'].'" onclick="javascript: return confirmation(\''.Security::remove_XSS($category['cat_name']).'\');">'. |
| 606 | 606 | Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
| 607 | - } |
|
| 608 | - if (is_array($dropbox_category_data) && count($dropbox_category_data) > 0) { |
|
| 609 | - $dropbox_data_sent[] = $dropbox_category_data; |
|
| 610 | - } |
|
| 611 | - } |
|
| 612 | - } |
|
| 613 | - |
|
| 614 | - // Displaying the table |
|
| 615 | - $additional_get_parameters = array( |
|
| 607 | + } |
|
| 608 | + if (is_array($dropbox_category_data) && count($dropbox_category_data) > 0) { |
|
| 609 | + $dropbox_data_sent[] = $dropbox_category_data; |
|
| 610 | + } |
|
| 611 | + } |
|
| 612 | + } |
|
| 613 | + |
|
| 614 | + // Displaying the table |
|
| 615 | + $additional_get_parameters = array( |
|
| 616 | 616 | 'view' => $view, |
| 617 | 617 | 'view_received_category' => $viewReceivedCategory, |
| 618 | 618 | 'view_sent_category' => $viewSentCategory |
| 619 | 619 | ); |
| 620 | 620 | |
| 621 | - $selectlist = array( |
|
| 621 | + $selectlist = array( |
|
| 622 | 622 | 'delete_received' => get_lang('Delete'), |
| 623 | 623 | 'download_received' => get_lang('Download') |
| 624 | 624 | ); |
@@ -629,12 +629,12 @@ discard block |
||
| 629 | 629 | } |
| 630 | 630 | } |
| 631 | 631 | |
| 632 | - if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
| 633 | - $selectlist = array('download_received' => get_lang('Download')); |
|
| 634 | - } |
|
| 632 | + if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { |
|
| 633 | + $selectlist = array('download_received' => get_lang('Download')); |
|
| 634 | + } |
|
| 635 | 635 | |
| 636 | 636 | echo '<div class="files-table">'; |
| 637 | - Display::display_sortable_config_table( |
|
| 637 | + Display::display_sortable_config_table( |
|
| 638 | 638 | 'dropbox', |
| 639 | 639 | $column_header, |
| 640 | 640 | $dropbox_data_sent, |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | $selectlist |
| 647 | 647 | ); |
| 648 | 648 | echo '</div>'; |
| 649 | - } |
|
| 649 | + } |
|
| 650 | 650 | } |
| 651 | 651 | |
| 652 | 652 | Display::display_footer(); |
@@ -220,23 +220,23 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | if (api_get_session_id() == 0) { |
| 222 | 222 | echo '<div class="actions">'; |
| 223 | - if ($view_dropbox_category_received != 0 && api_is_allowed_to_session_edit(false, true)) { |
|
| 224 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
| 223 | + if ($view_dropbox_category_received != 0 && api_is_allowed_to_session_edit(false, true)) { |
|
| 224 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'), '', ICON_SIZE_MEDIUM)."</a>"; |
|
| 225 | 225 | echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_received]['cat_name']).'</strong> '; |
| 226 | 226 | $movelist[0] = 'Root'; // move_received selectbox content |
| 227 | 227 | } else { |
| 228 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
| 228 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 229 | 229 | } |
| 230 | 230 | echo '</div>'; |
| 231 | 231 | } else { |
| 232 | 232 | if (api_is_allowed_to_session_edit(false, true)) { |
| 233 | 233 | echo '<div class="actions">'; |
| 234 | 234 | if ($view_dropbox_category_received != 0 && api_is_allowed_to_session_edit(false, true)) { |
| 235 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
| 235 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&view_sent_category='.$viewSentCategory.'&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'), '', ICON_SIZE_MEDIUM)."</a>"; |
|
| 236 | 236 | echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_received]['cat_name']).'</strong> '; |
| 237 | 237 | $movelist[0] = 'Root'; // move_received selectbox content |
| 238 | 238 | } else { |
| 239 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
| 239 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory&view='.$view.'">'.Display::return_icon('new_folder.png', get_lang('AddNewCategory'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
| 240 | 240 | } |
| 241 | 241 | echo '</div>'; |
| 242 | 242 | } |
@@ -256,13 +256,13 @@ discard block |
||
| 256 | 256 | if (api_get_session_id() == 0) { |
| 257 | 257 | echo '<div class="actions">'; |
| 258 | 258 | if ($view_dropbox_category_sent != 0) { |
| 259 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
| 259 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'), '', ICON_SIZE_MEDIUM)."</a>"; |
|
| 260 | 260 | echo get_lang('Category').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> '; |
| 261 | 261 | } else { |
| 262 | - echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM)."</a>\n"; |
|
| 262 | + echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'), '', ICON_SIZE_MEDIUM)."</a>\n"; |
|
| 263 | 263 | } |
| 264 | 264 | if (empty($viewSentCategory)) { |
| 265 | - echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
| 265 | + echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'), '', ICON_SIZE_MEDIUM)."</a>"; |
|
| 266 | 266 | } |
| 267 | 267 | echo '</div>'; |
| 268 | 268 | } else { |
@@ -270,12 +270,12 @@ discard block |
||
| 270 | 270 | echo '<div class="actions">'; |
| 271 | 271 | if ($view_dropbox_category_sent != 0) { |
| 272 | 272 | echo get_lang('CurrentlySeeing').': <strong>'.Security::remove_XSS($dropbox_categories[$view_dropbox_category_sent]['cat_name']).'</strong> '; |
| 273 | - echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
| 273 | + echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category=0&view='.$view.'">'.Display::return_icon('folder_up.png', get_lang('Up').' '.get_lang('Root'), '', ICON_SIZE_MEDIUM)."</a>"; |
|
| 274 | 274 | } else { |
| 275 | - echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'),'',ICON_SIZE_MEDIUM)."</a>\n"; |
|
| 275 | + echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=addsentcategory\">".Display::return_icon('new_folder.png', get_lang('AddNewCategory'), '', ICON_SIZE_MEDIUM)."</a>\n"; |
|
| 276 | 276 | } |
| 277 | 277 | if (empty($viewSentCategory)) { |
| 278 | - echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'),'',ICON_SIZE_MEDIUM)."</a>"; |
|
| 278 | + echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$view."&action=add\">".Display::return_icon('upload_file.png', get_lang('UploadNewFile'), '', ICON_SIZE_MEDIUM)."</a>"; |
|
| 279 | 279 | } |
| 280 | 280 | echo '</div>'; |
| 281 | 281 | } |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | |
| 329 | 329 | if (api_get_session_id() == 0) { |
| 330 | 330 | $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
| 331 | - } elseif (api_is_allowed_to_session_edit(false,true)) { |
|
| 331 | + } elseif (api_is_allowed_to_session_edit(false, true)) { |
|
| 332 | 332 | $column_header[] = array(get_lang('Modify'), false, '', 'nowrap style="text-align: right"'); |
| 333 | 333 | } |
| 334 | 334 | |
@@ -373,13 +373,13 @@ discard block |
||
| 373 | 373 | if ($dropbox_file->last_upload_date > $last_access && |
| 374 | 374 | !in_array($dropbox_file->id, $_SESSION['_seen'][$_course['id']][TOOL_DROPBOX]) |
| 375 | 375 | ) { |
| 376 | - $new_icon = ' '.Display::return_icon('new_dropbox_message.png', get_lang('New'),'',ICON_SIZE_SMALL); |
|
| 376 | + $new_icon = ' '.Display::return_icon('new_dropbox_message.png', get_lang('New'), '', ICON_SIZE_SMALL); |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | $link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">'; |
| 380 | 380 | $dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>'; |
| 381 | 381 | $dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'. |
| 382 | - Display::return_icon('save.png', get_lang('Download'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$dropbox_file->title.'</a>'.$new_icon.'<br />'.$dropbox_file->description; |
|
| 382 | + Display::return_icon('save.png', get_lang('Download'), array('style' => 'float:right;'), ICON_SIZE_SMALL).'</a>'.$link_open.$dropbox_file->title.'</a>'.$new_icon.'<br />'.$dropbox_file->description; |
|
| 383 | 383 | $file_size = $dropbox_file->filesize; |
| 384 | 384 | $dropbox_file_data[] = format_file_size($file_size); |
| 385 | 385 | $dropbox_file_data[] = $dropbox_file->author; |
@@ -389,10 +389,10 @@ discard block |
||
| 389 | 389 | api_format_date($last_upload_date).'</span>'; |
| 390 | 390 | |
| 391 | 391 | $action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').' |
| 392 | - <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=viewfeedback&id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('discuss.png', get_lang('Comment'),'',ICON_SIZE_SMALL).'</a> |
|
| 393 | - <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=movereceived&move_id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('move.png', get_lang('Move'),'',ICON_SIZE_SMALL).'</a> |
|
| 392 | + <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=viewfeedback&id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('discuss.png', get_lang('Comment'), '', ICON_SIZE_SMALL).'</a> |
|
| 393 | + <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=movereceived&move_id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('move.png', get_lang('Move'), '', ICON_SIZE_SMALL).'</a> |
|
| 394 | 394 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletereceivedfile&id='.$dropbox_file->id.'&'.$sort_params.'" onclick="javascript: return confirmation(\''.$dropbox_file->title.'\');">'. |
| 395 | - Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
|
| 395 | + Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 396 | 396 | |
| 397 | 397 | // This is a hack to have an additional row in a sortable table |
| 398 | 398 | |
@@ -426,12 +426,12 @@ discard block |
||
| 426 | 426 | // The icon of the category |
| 427 | 427 | $link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$category['cat_id'].'&view_sent_category='.$viewSentCategory.'&view='.$view.'">'; |
| 428 | 428 | $dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', $category['cat_name']).'</a>'; |
| 429 | - $dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=received">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$category['cat_name'].'</a>'; |
|
| 429 | + $dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=received">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'), ICON_SIZE_SMALL).'</a>'.$link_open.$category['cat_name'].'</a>'; |
|
| 430 | 430 | $dropbox_category_data[] = ''; |
| 431 | 431 | $dropbox_category_data[] = ''; |
| 432 | 432 | $dropbox_category_data[] = ''; |
| 433 | - $dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a> |
|
| 434 | - <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletereceivedcategory&id='.$category['cat_id'].'" onclick="javascript: return confirmation(\''.Security::remove_XSS($category['cat_name']).'\');">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
|
| 433 | + $dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a> |
|
| 434 | + <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletereceivedcategory&id='.$category['cat_id'].'" onclick="javascript: return confirmation(\''.Security::remove_XSS($category['cat_name']).'\');">'.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 435 | 435 | } |
| 436 | 436 | if (is_array($dropbox_category_data) && count($dropbox_category_data) > 0) { |
| 437 | 437 | $dropbox_data_recieved[] = $dropbox_category_data; |
@@ -451,8 +451,8 @@ discard block |
||
| 451 | 451 | ); |
| 452 | 452 | |
| 453 | 453 | if (is_array($movelist)) { |
| 454 | - foreach ($movelist as $catid => $catname){ |
|
| 455 | - $selectlist['move_received_'.$catid] = get_lang('Move') . '->'. Security::remove_XSS($catname); |
|
| 454 | + foreach ($movelist as $catid => $catname) { |
|
| 455 | + $selectlist['move_received_'.$catid] = get_lang('Move').'->'.Security::remove_XSS($catname); |
|
| 456 | 456 | } |
| 457 | 457 | } |
| 458 | 458 | |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | $link_open = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">'; |
| 547 | 547 | $dropbox_file_data[] = $link_open.DocumentManager::build_document_icon_tag('file', $dropbox_file->title).'</a>'; |
| 548 | 548 | $dropbox_file_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&action=download">'. |
| 549 | - Display::return_icon('save.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.$dropbox_file->title.'</a><br />'.$dropbox_file->description; |
|
| 549 | + Display::return_icon('save.png', get_lang('Save'), array('style' => 'float:right;'), ICON_SIZE_SMALL).'</a>'.$link_open.$dropbox_file->title.'</a><br />'.$dropbox_file->description; |
|
| 550 | 550 | $file_size = $dropbox_file->filesize; |
| 551 | 551 | $dropbox_file_data[] = format_file_size($file_size); |
| 552 | 552 | $receivers_celldata = null; |
@@ -563,9 +563,9 @@ discard block |
||
| 563 | 563 | $receivers_celldata = ''; |
| 564 | 564 | |
| 565 | 565 | $action_icons = check_number_feedback($dropbox_file->id, $number_feedback).' '.get_lang('Feedback').' |
| 566 | - <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=viewfeedback&id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('discuss.png', get_lang('Comment'),'',ICON_SIZE_SMALL).'</a> |
|
| 567 | - <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=movesent&move_id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('move.png', get_lang('Move'),'',ICON_SIZE_SMALL).'</a> |
|
| 568 | - <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletesentfile&id='.$dropbox_file->id.'&'.$sort_params.'" onclick="javascript: return confirmation(\''.$dropbox_file->title.'\');">'.Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
|
| 566 | + <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=viewfeedback&id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('discuss.png', get_lang('Comment'), '', ICON_SIZE_SMALL).'</a> |
|
| 567 | + <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=movesent&move_id='.$dropbox_file->id.'&'.$sort_params.'">'.Display::return_icon('move.png', get_lang('Move'), '', ICON_SIZE_SMALL).'</a> |
|
| 568 | + <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletesentfile&id='.$dropbox_file->id.'&'.$sort_params.'" onclick="javascript: return confirmation(\''.$dropbox_file->title.'\');">'.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 569 | 569 | // This is a hack to have an additional row in a sortable table |
| 570 | 570 | if ($action == 'viewfeedback' && isset($_GET['id']) && is_numeric($_GET['id']) && $dropbox_file->id == $_GET['id']) { |
| 571 | 571 | $action_icons .= "</td></tr>\n"; // ending the normal row of the sortable table |
@@ -594,16 +594,16 @@ discard block |
||
| 594 | 594 | // This is where the checkbox icon for the files appear. |
| 595 | 595 | $link_open = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$category['cat_id'].'&view='.$view.'">'; |
| 596 | 596 | $dropbox_category_data[] = $link_open.DocumentManager::build_document_icon_tag('folder', Security::remove_XSS($category['cat_name'])).'</a>'; |
| 597 | - $dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=sent">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'),ICON_SIZE_SMALL).'</a>'.$link_open.Security::remove_XSS($category['cat_name']).'</a>'; |
|
| 597 | + $dropbox_category_data[] = '<a href="'.api_get_path(WEB_CODE_PATH).'dropbox/dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&action=downloadcategory&sent_received=sent">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'), ICON_SIZE_SMALL).'</a>'.$link_open.Security::remove_XSS($category['cat_name']).'</a>'; |
|
| 598 | 598 | //$dropbox_category_data[] = ''; |
| 599 | 599 | $dropbox_category_data[] = ''; |
| 600 | 600 | //$dropbox_category_data[] = ''; |
| 601 | 601 | $dropbox_category_data[] = ''; |
| 602 | 602 | $dropbox_category_data[] = ''; |
| 603 | 603 | $dropbox_category_data[] = '<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=editcategory&id='.$category['cat_id'].'">'. |
| 604 | - Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a> |
|
| 604 | + Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a> |
|
| 605 | 605 | <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$viewReceivedCategory.'&view_sent_category='.$viewSentCategory.'&view='.$view.'&action=deletesentcategory&id='.$category['cat_id'].'" onclick="javascript: return confirmation(\''.Security::remove_XSS($category['cat_name']).'\');">'. |
| 606 | - Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'; |
|
| 606 | + Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'; |
|
| 607 | 607 | } |
| 608 | 608 | if (is_array($dropbox_category_data) && count($dropbox_category_data) > 0) { |
| 609 | 609 | $dropbox_data_sent[] = $dropbox_category_data; |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | |
| 626 | 626 | if (!empty($moveList)) { |
| 627 | 627 | foreach ($moveList as $catid => $catname) { |
| 628 | - $selectlist['move_sent_'.$catid] = get_lang('Move') . '->'. Security::remove_XSS($catname); |
|
| 628 | + $selectlist['move_sent_'.$catid] = get_lang('Move').'->'.Security::remove_XSS($catname); |
|
| 629 | 629 | } |
| 630 | 630 | } |
| 631 | 631 | |
@@ -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 | } |