/** * @brief Display the loaded menu and plugins. */ protected function handle(Request $request) { $groupId = Auth::getGroupId(); $gup = $this->dbManager->getSingleRow('SELECT group_perm FROM group_user_member WHERE user_fk=$1 AND group_fk=$2', array(Auth::getUserId(), $groupId), __METHOD__ . '.user_perm'); if (!$gup) { throw new \Exception('You are assigned to wrong group.'); } $this->userPerm = $gup['group_perm']; $uploadId = intval($request->get('uploadId')); if ($uploadId && !$this->uploadDao->isAccessible($uploadId, $groupId)) { throw new \Exception('You cannot access to this upload'); } $columnName = $request->get('columnName'); $statusId = intval($request->get('statusId')); $value = intval($request->get('value')); $moveUpload = intval($request->get("move")); $beyondUpload = intval($request->get("beyond")); $commentText = $request->get('commentText'); $direction = $request->get('direction'); if (!empty($columnName) && !empty($uploadId) && !empty($value)) { $uploadBrowseProxy = new UploadBrowseProxy($groupId, $this->userPerm, $this->dbManager); $uploadBrowseProxy->updateTable($columnName, $uploadId, $value); } else { if (!empty($moveUpload) && !empty($beyondUpload)) { $uploadBrowseProxy = new UploadBrowseProxy($groupId, $this->userPerm, $this->dbManager); $uploadBrowseProxy->moveUploadBeyond($moveUpload, $beyondUpload); } else { if (!empty($uploadId) && !empty($direction)) { $uploadBrowseProxy = new UploadBrowseProxy($groupId, $this->userPerm, $this->dbManager); $uploadBrowseProxy->moveUploadToInfinity($uploadId, $direction == 'top'); } else { if (!empty($uploadId) && !empty($commentText) && !empty($statusId)) { $uploadBrowseProxy = new UploadBrowseProxy($groupId, $this->userPerm, $this->dbManager); $uploadBrowseProxy->setStatusAndComment($uploadId, $statusId, $commentText); } else { return $this->respondFolderGetTableData($request); } } } } return new Response(''); }
public function testGetStatus() { $uploadBrowseProxy = new UploadBrowseProxy($this->groupId, UserDao::USER, $this->testDb->getDbManager()); $uploadId = 1; assertThat($uploadBrowseProxy->getStatus($uploadId), equalTo(UploadStatus::OPEN)); $uploadBrowseProxy->updateTable('status_fk', $uploadId, $newStatus = UploadStatus::IN_PROGRESS); assertThat($uploadBrowseProxy->getStatus($uploadId), equalTo($newStatus)); }