/**
  * @param string[] $permissions
  * @return int[]
  */
 public static function getAccessibleCategoryIDs($permissions = array('canViewCategory'))
 {
     $categoryIDs = array();
     foreach (CategoryHandler::getInstance()->getCategories(self::OBJECT_TYPE_NAME) as $category) {
         $result = true;
         $category = new self($category);
         foreach ($permissions as $permission) {
             $result = $result && $category->getPermission($permission);
         }
         if ($result) {
             $categoryIDs[] = $category->categoryID;
         }
     }
     return $categoryIDs;
 }
Example #2
0
 public function copy($src, $dest)
 {
     if (!$this->isAbsolutePath($dest)) {
         $dest = $this->path . DS . $dest;
     }
     if (!$this->isAbsolutePath($src)) {
         $src = $this->path . DS . $src;
     }
     $dir = new self($src);
     $this->_mkdir($dest, $dir->getPermission());
     if ($items = $dir->getList()) {
         foreach ($items as $item) {
             $destination = $dest . DS . basename($item->getPath());
             if ($item->isFile()) {
                 $item->copyTo($destination);
             } else {
                 $this->copy($item->pwd(), $destination);
             }
         }
     }
 }