Beispiel #1
0
 /**
  * @see	\wcf\page\IPage::readData()
  */
 public function readData()
 {
     $this->labelGroupList = new LabelGroupList();
     $this->labelGroupList->sqlOrderBy = 'label_group.groupName';
     $this->labelGroupList->readObjects();
     parent::readData();
 }
 /**
  * @see	\wcf\system\cache\builder\AbstractCacheBuilder::rebuild()
  */
 protected function rebuild(array $parameters)
 {
     $data = array('options' => array(), 'groups' => array());
     // get label groups
     $groupList = new LabelGroupList();
     $groupList->readObjects();
     $groups = $groupList->getObjects();
     foreach ($groups as &$group) {
         $data['groups'][$group->groupID] = new ViewableLabelGroup($group);
     }
     unset($group);
     // get permissions for groups
     $permissions = ACLHandler::getInstance()->getPermissions(ACLHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.label'), array_keys($data['groups']));
     // store options
     $data['options'] = $permissions['options']->getObjects();
     // assign permissions for each label group
     foreach ($data['groups'] as $groupID => $group) {
         // group permissions
         if (isset($permissions['group'][$groupID])) {
             $group->setGroupPermissions($permissions['group'][$groupID]);
         }
         // user permissions
         if (isset($permissions['user'][$groupID])) {
             $group->setUserPermissions($permissions['user'][$groupID]);
         }
     }
     if (count($groupList)) {
         // get labels
         $labelList = new LabelList();
         $labelList->sqlOrderBy = 'label';
         $labelList->readObjects();
         foreach ($labelList as $label) {
             $data['groups'][$label->groupID]->addLabel($label);
         }
     }
     return $data;
 }