示例#1
0
 public function listFiles($fileIdArray, $userPermsObj, $dataDir, $showCheckBox = false, $rejectpage = false)
 {
     if (sizeof($fileIdArray) == 0 or !isset($fileIdArray[0])) {
         echo '<div class="row"><i class="fa fa-exclamation-triangle fa-2x"></i>No Files Found</div>';
         return -1;
     }
     foreach ($fileIdArray as $fileid) {
         if (is_array($fileid)) {
             foreach ($fileid as $file) {
                 $fileObj = new Document_Model($file);
                 $createdDate = $this->globalFunctions->fixDate($fileObj->getCreatedDate());
                 $deptName = $fileObj->getDepartmentName();
                 $realName = $fileObj->getRealname();
                 $location = $fileObj->getLocation();
                 $fileExt = $fileObj->getExt();
                 //Get the file size in bytes.
                 $fileSize = $this->globalFunctions->displayFilesize($dataDir . $location);
                 $size = array('B', 'MB', 'KB', 'K', 'GB', 'M');
                 $repSize = '';
                 $fileSizeNoStr = str_ireplace($size, $repSize, $fileSize);
                 $fileListArr[] = array('id' => $file, 'fileName' => $realName, 'createdDate' => $createdDate, 'deptName' => $deptName, 'fileSize' => $fileSizeNoStr, 'rejectPage' => $rejectpage, 'location' => $location, 'ext' => $fileExt);
             }
         }
     }
     return json_encode($fileListArr);
 }