/**
  * @see	\wcf\system\cache\builder\AbstractCacheBuilder::rebuild()
  */
 public function rebuild(array $parameters)
 {
     $list = new ACLOptionCategoryList();
     $list->readObjects();
     $data = array();
     foreach ($list as $aclOptionCategory) {
         if (!isset($data[$aclOptionCategory->objectTypeID])) {
             $data[$aclOptionCategory->objectTypeID] = array();
         }
         $data[$aclOptionCategory->objectTypeID][$aclOptionCategory->categoryName] = $aclOptionCategory;
     }
     return $data;
 }
Exemplo n.º 2
0
 /**
  * Returns a list of permissions by object type id.
  * 
  * @param	integer		$objectTypeID
  * @param	array		$objectIDs
  * @param	string		$categoryName
  * @param	boolean		$settingsView
  * @return	array
  */
 public function getPermissions($objectTypeID, array $objectIDs, $categoryName = '', $settingsView = false)
 {
     $optionList = $this->getOptions($objectTypeID, $categoryName);
     $data = array('options' => $optionList, 'group' => array(), 'user' => array());
     if (!empty($objectIDs)) {
         $this->getValues($optionList, 'group', $objectIDs, $data, $settingsView);
         $this->getValues($optionList, 'user', $objectIDs, $data, $settingsView);
     }
     // use alternative data structure for settings
     if ($settingsView) {
         $objectType = ObjectTypeCache::getInstance()->getObjectType($objectTypeID);
         $data['options'] = array();
         $data['categories'] = array();
         if (count($optionList)) {
             $categoryNames = array();
             foreach ($optionList as $option) {
                 $data['options'][$option->optionID] = array('categoryName' => $option->categoryName, 'label' => WCF::getLanguage()->get('wcf.acl.option.' . $objectType->objectType . '.' . $option->optionName), 'optionName' => $option->optionName);
                 if (!in_array($option->categoryName, $categoryNames)) {
                     $categoryNames[] = $option->categoryName;
                 }
             }
             // load categories
             $categoryList = new ACLOptionCategoryList();
             $categoryList->getConditionBuilder()->add("acl_option_category.categoryName IN (?)", array($categoryNames));
             $categoryList->getConditionBuilder()->add("acl_option_category.objectTypeID = ?", array($objectTypeID));
             $categoryList->readObjects();
             foreach ($categoryList as $category) {
                 $data['categories'][$category->categoryName] = WCF::getLanguage()->get('wcf.acl.option.category.' . $objectType->objectType . '.' . $category->categoryName);
             }
         }
     }
     return $data;
 }