/** * @see wcf\page\IPage::readData() */ public function readData() { $this->objectType = CategoryHandler::getInstance()->getObjectTypeByName($this->objectTypeName); if ($this->objectType === null) { throw new SystemException("Unknown category object type with name '".$this->objectTypeName."'"); } // check permissions $this->checkCategoryPermissions(); $this->readCategories(); // note that the implementation of wcf\system\category\ICategoryType // needs to support a object type of the pseudo definition // 'com.woltlab.wcf.collapsibleContent.acp' which has to be registered // during package installation as a 'com.woltlab.wcf.collapsibleContent' // object type if you want to support collapsible categories in the // acp; the pseudo object type is used to distinguish between // collapsible categories in the frontend and the acp $collapsibleObjectTypeName = $this->objectType->getProcessor()->getObjectTypeName('com.woltlab.wcf.collapsibleContent.acp'); if ($collapsibleObjectTypeName) { $this->collapsibleObjectTypeID = UserCollapsibleContentHandler::getInstance()->getObjectTypeID($collapsibleObjectTypeName); // get ids of collapsed category if ($this->collapsibleObjectTypeID !== null) { $this->collapsedCategoryIDs = UserCollapsibleContentHandler::getInstance()->getCollapsedContent($this->collapsibleObjectTypeID); $this->collapsedCategoryIDs = array_flip($this->collapsedCategoryIDs); } } parent::readData(); }
/** * Validates the parent category. */ protected function validateParentCategory() { if ($this->parentCategoryID) { if (!$this->objectType->getProcessor()->getMaximumNestingLevel()) { $this->parentCategoryID = 0; return; } if (CategoryHandler::getInstance()->getCategory($this->parentCategoryID) === null) { throw new UserInputException('parentCategoryID', 'invalid'); } if ($this->objectType->getProcessor()->getMaximumNestingLevel() != -1) { foreach ($this->categoryNodeList as $category) { if ($category->categoryID == $this->parentCategoryID) { if ($this->categoryNodeList->getDepth() > $this->objectType->getProcessor()->getMaximumNestingLevel() - 1) { throw new UserInputException('parentCategoryID', 'invalid'); } break; } } } } }