/**
  * Generic list of all packages available on the local filesystem
  * @return string
  * @permissions view
  * @autoTestable
  */
 protected function actionOpenFolder()
 {
     if (validateSystemid(class_module_system_setting::getConfigValue("_packageserver_repo_id_"))) {
         if ($this->getSystemid() == "") {
             $this->setSystemid(class_module_system_setting::getConfigValue("_packageserver_repo_id_"));
         }
         $objIterator = new class_array_section_iterator(class_module_mediamanager_file::getFileCount($this->getSystemid(), false, false, true));
         $objIterator->setPageNumber($this->getParam("pv"));
         $objIterator->setArraySection(class_module_mediamanager_file::loadFilesDB($this->getSystemid(), false, false, $objIterator->calculateStartPos(), $objIterator->calculateEndPos(), true));
     } else {
         $objIterator = new class_array_section_iterator(class_module_mediamanager_file::getFlatPackageListCount(false, false));
         $objIterator->setPageNumber($this->getParam("pv"));
         $objIterator->setArraySection(class_module_mediamanager_file::getFlatPackageList(false, false, $objIterator->calculateStartPos(), $objIterator->calculateEndPos()));
     }
     return $this->renderList($objIterator);
 }
 /**
  * Internal helper, loads all files available including a traversal
  * of the nested folders.
  *
  * @param $strParentId
  * @param int|bool $strCategoryFilter
  * @param int $intStart
  * @param int $intEnd
  * @param bool $strNameFilter
  *
  * @return class_module_mediamanager_file[]
  */
 private function getAllPackages($strParentId, $strCategoryFilter = false, $intStart = null, $intEnd = null, $strNameFilter = false)
 {
     $arrReturn = array();
     if (validateSystemid($strParentId)) {
         $arrSubfiles = class_module_mediamanager_file::loadFilesDB($strParentId, false, true, null, null, true);
         foreach ($arrSubfiles as $objOneFile) {
             if ($objOneFile->getIntType() == class_module_mediamanager_file::$INT_TYPE_FILE) {
                 //filename based check if the file should be included
                 if ($strNameFilter !== false) {
                     if (uniStrpos($strNameFilter, ",") !== false) {
                         if (in_array($objOneFile->getStrName(), explode(",", $strNameFilter))) {
                             $arrReturn[] = $objOneFile;
                         }
                     } else {
                         if (uniSubstr($objOneFile->getStrName(), 0, uniStrlen($strNameFilter)) == $strNameFilter) {
                             $arrReturn[] = $objOneFile;
                         }
                     }
                 } else {
                     $arrReturn[] = $objOneFile;
                 }
             } else {
                 $arrReturn = array_merge($arrReturn, $this->getAllPackages($objOneFile->getSystemid()));
             }
         }
         if ($intStart !== null && $intEnd !== null && $intStart > 0 && $intEnd > $intStart) {
             if ($intEnd > count($arrReturn)) {
                 $intEnd = count($arrReturn);
             }
             $arrTemp = array();
             for ($intI = $intStart; $intI <= $intEnd; $intI++) {
                 $arrTemp[] = $arrReturn[$intI];
             }
             $arrReturn = $arrTemp;
         }
         //sort them by filename
         usort($arrReturn, function (class_module_mediamanager_file $objA, class_module_mediamanager_file $objB) {
             return strcmp($objA->getStrName(), $objB->getStrName());
         });
     } else {
         $arrReturn = class_module_mediamanager_file::getFlatPackageList($strCategoryFilter, true, $intStart, $intEnd, $strNameFilter);
     }
     return $arrReturn;
 }