Exemplo n.º 1
0
 /**
  * @param Request $request
  * @return array
  */
 private function getListOfUploadsOfFolder(Request $request)
 {
     $uploadBrowseProxy = new UploadBrowseProxy(Auth::getGroupId(), $this->userPerm, $this->dbManager);
     $params = array($request->get('folder'));
     $partQuery = $uploadBrowseProxy->getFolderPartialQuery($params);
     $iTotalRecordsRow = $this->dbManager->getSingleRow("SELECT count(*) FROM {$partQuery}", $params, __METHOD__ . "count.all");
     $iTotalRecords = $iTotalRecordsRow['count'];
     $this->filterParams = $params;
     $filter = $this->getSearchString($request->get('sSearch'));
     $filter .= $this->getIntegerFilter(intval($request->get('assigneeSelected')), 'assignee');
     $filter .= $this->getIntegerFilter(intval($request->get('statusSelected')), 'status_fk');
     $iTotalDisplayRecordsRow = $this->dbManager->getSingleRow("SELECT count(*) FROM {$partQuery} {$filter}", $this->filterParams, __METHOD__ . ".count." . $filter);
     $iTotalDisplayRecords = $iTotalDisplayRecordsRow['count'];
     $orderString = $this->getOrderString();
     $stmt = __METHOD__ . "getFolderContents" . $orderString . $filter;
     $statementString = "SELECT upload.*,upload_clearing.*,uploadtree.ufile_name,uploadtree.ufile_mode,uploadtree.uploadtree_pk" . " FROM {$partQuery} {$filter} {$orderString}";
     $rangedFilterParams = $this->filterParams;
     $rangedFilterParams[] = intval($request->get('iDisplayStart'));
     $statementString .= ' OFFSET $' . count($rangedFilterParams);
     $rangedFilterParams[] = intval($request->get('iDisplayLength'));
     $statementString .= ' LIMIT $' . count($rangedFilterParams);
     $this->dbManager->prepare($stmt, $statementString);
     $result = $this->dbManager->execute($stmt, $rangedFilterParams);
     return array($result, $iTotalDisplayRecords, $iTotalRecords);
 }
 /**
  * @expectedException \Exception
  */
 public function testGetStatusException()
 {
     $uploadBrowseProxy = new UploadBrowseProxy($this->groupId, UserDao::USER, $this->testDb->getDbManager(), false);
     $uploadBrowseProxy->getStatus(-1);
 }
 private function getPermNamesWithReuse($uploadId)
 {
     $permNamesWithReuse = $GLOBALS['PERM_NAMES'];
     try {
         $uploadBrowseProxy = new UploadBrowseProxy(Auth::getGroupId(), Auth::PERM_READ, $this->dbManager);
         $uploadStatus = $uploadBrowseProxy->getStatus($uploadId);
     } catch (\Exception $e) {
         return $permNamesWithReuse;
     }
     if ($uploadStatus == UploadStatus::IN_PROGRESS || $uploadStatus == UploadStatus::CLOSED) {
         foreach ($GLOBALS['PERM_NAMES'] as $perm => $name) {
             $permNamesWithReuse[$perm | self::MOD_REUSE] = $name . _(' with reuse');
         }
     }
     return $permNamesWithReuse;
 }