* additional category data
* @var array
*/
- public $additionalData = array();
+ public $additionalData = [];
/**
* tree with the category nodes
- * @var \wcf\data\category\CategoryNodeTree
+ * @var UncachedCategoryNodeTree
*/
public $categoryNodeTree = null;
/**
* category object type object
- * @var \wcf\data\object\type\ObjectType
+ * @var ObjectType
*/
public $objectType = null;
* language item with the page title
* @var string
*/
- public $pageTitle = '';
+ public $pageTitle = 'wcf.category.add';
/**
* id of the parent category id
public $showOrder = 0;
/**
- * @see \wcf\page\AbstractPage::$templateName
+ * @inheritDoc
*/
public $templateName = 'categoryAdd';
/**
- * @see \wcf\page\AbstractPage::__run()
+ * @inheritDoc
*/
public function __run() {
$classNameParts = explode('\\', get_called_class());
// autoset controllers
if (empty($this->addController)) {
- $this->addController = str_replace(array('AddForm', 'EditForm'), 'Add', $className);
+ $this->addController = str_replace(['AddForm', 'EditForm'], 'Add', $className);
}
if (empty($this->editController)) {
- $this->editController = str_replace(array('AddForm', 'EditForm'), 'Edit', $className);
+ $this->editController = str_replace(['AddForm', 'EditForm'], 'Edit', $className);
}
if (empty($this->listController)) {
- $this->listController = str_replace(array('AddForm', 'EditForm'), 'List', $className);
+ $this->listController = str_replace(['AddForm', 'EditForm'], 'List', $className);
}
parent::__run();
}
/**
- * @see \wcf\page\IPage::assignVariables()
+ * @inheritDoc
*/
public function assignVariables() {
parent::assignVariables();
ACLHandler::getInstance()->assignVariables($this->aclObjectTypeID);
}
- WCF::getTPL()->assign(array(
+ WCF::getTPL()->assign([
'aclObjectTypeID' => $this->aclObjectTypeID,
'action' => 'add',
'addController' => $this->addController,
'objectType' => $this->objectType,
'parentCategoryID' => $this->parentCategoryID,
'showOrder' => $this->showOrder
- ));
+ ]);
if ($this->pageTitle) {
WCF::getTPL()->assign('pageTitle', $this->pageTitle);
}
/**
- * @see \wcf\page\IPage::readData()
+ * @inheritDoc
*/
public function readData() {
$this->objectType = CategoryHandler::getInstance()->getObjectTypeByName($this->objectTypeName);
}
/**
- * @see \wcf\page\IForm::readFormParameters()
+ * @inheritDoc
*/
public function readFormParameters() {
parent::readFormParameters();
}
/**
- * @see \wcf\page\IForm::save()
+ * @inheritDoc
*/
public function save() {
parent::save();
- $this->objectAction = new CategoryAction(array(), 'create', array(
- 'data' => array_merge($this->additionalFields, array(
+ $this->objectAction = new CategoryAction([], 'create', [
+ 'data' => array_merge($this->additionalFields, [
'additionalData' => serialize($this->additionalData),
'description' => ($this->objectType->getProcessor()->hasDescription() && I18nHandler::getInstance()->isPlainValue('description')) ? I18nHandler::getInstance()->getValue('description') : '',
'isDisabled' => $this->isDisabled,
'parentCategoryID' => $this->parentCategoryID,
'showOrder' => $this->showOrder > 0 ? $this->showOrder : null,
'title' => I18nHandler::getInstance()->isPlainValue('title') ? I18nHandler::getInstance()->getValue('title') : ''
- ))
- ));
+ ])
+ ]);
$this->objectAction->executeAction();
$returnValues = $this->objectAction->getReturnValues();
if (($this->objectType->getProcessor()->hasDescription() && !I18nHandler::getInstance()->isPlainValue('description')) || !I18nHandler::getInstance()->isPlainValue('title')) {
$categoryID = $returnValues['returnValues']->categoryID;
- $updateData = array();
+ $updateData = [];
if ($this->objectType->getProcessor()->hasDescription() && !I18nHandler::getInstance()->isPlainValue('description')) {
$updateData['description'] = $this->objectType->getProcessor()->getI18nLangVarPrefix().'.description.category'.$categoryID;
I18nHandler::getInstance()->save('description', $updateData['description'], $this->objectType->getProcessor()->getDescriptionLangVarCategory(), $this->packageID);
// reset values
$this->parentCategoryID = 0;
$this->showOrder = 0;
- $this->additionalData = array();
+ $this->additionalData = [];
$this->saved();
}
/**
- * @see \wcf\page\IForm::validate()
+ * @inheritDoc
*/
public function validate() {
parent::validate();
}
/**
- * Validates the parent category.
+ * @inheritDoc
*/
protected function validateParentCategory() {
if ($this->parentCategoryID) {
class AbstractCategoryEditForm extends AbstractCategoryAddForm {
/**
* edited category
- * @var \wcf\data\category\Category
+ * @var Category
*/
public $category = null;
public $categoryID = 0;
/**
- * @see \wcf\page\IPage::assignVariables()
+ * @inheritDoc
+ */
+ public $pageTitle = 'wcf.category.edit';
+
+ /**
+ * @inheritDoc
*/
public function assignVariables() {
parent::assignVariables();
I18nHandler::getInstance()->assignVariables(!empty($_POST));
$availableCategories = new CategoryNodeTree($this->objectType->objectType, 0, true);
- WCF::getTPL()->assign(array(
+ WCF::getTPL()->assign([
'action' => 'edit',
'category' => $this->category,
'availableCategories' => $availableCategories->getIterator()
- ));
+ ]);
}
/**
- * @see \wcf\acp\form\AbstractCategoryAddForm::checkCategoryPermissions()
+ * @inheritDoc
*/
protected function checkCategoryPermissions() {
if (!$this->objectType->getProcessor()->canEditCategory()) {
}
/**
- * @see \wcf\acp\form\AbstractCategoryAddForm::readCategories()
+ * @inheritDoc
*/
protected function readCategories() {
- $this->categoryNodeTree = new CategoryNodeTree($this->objectType->objectType, 0, true, array($this->category->categoryID));
+ $this->categoryNodeTree = new CategoryNodeTree($this->objectType->objectType, 0, true, [$this->category->categoryID]);
}
/**
- * @see \wcf\page\IPage::readParameters()
+ * @inheritDoc
*/
public function readParameters() {
parent::readParameters();
}
/**
- * @see \wcf\page\IPage::readData()
+ * @inheritDoc
*/
public function readData() {
parent::readData();
}
/**
- * @see \wcf\form\IForm::save()
+ * @inheritDoc
*/
public function save() {
AbstractForm::save();
}
// update category
- $this->objectAction = new CategoryAction(array($this->category), 'update', array(
- 'data' => array_merge($this->additionalFields, array(
+ $this->objectAction = new CategoryAction([$this->category], 'update', [
+ 'data' => array_merge($this->additionalFields, [
'additionalData' => serialize($this->additionalData),
'description' => $description,
'isDisabled' => $this->isDisabled,
'parentCategoryID' => $this->parentCategoryID,
'showOrder' => $this->showOrder,
'title' => $title
- ))
- ));
+ ])
+ ]);
$this->objectAction->executeAction();
// update acl
}
/**
- * @see \wcf\acp\form\AbstractCategoryAddForm::validateParentCategory()
+ * @inheritDoc
*/
protected function validateParentCategory() {
parent::validateParentCategory();
/**
* category node tree
- * @var \wcf\data\category\CategoryNodeTree
+ * @var CategoryNodeTree
*/
public $categoryNodeTree = null;
/**
* ids of collapsed categories
- * @var array<integer>
+ * @var integer[]
*/
public $collapsedCategoryIDs = null;
* language item with the page title
* @var string
*/
- public $pageTitle = '';
+ public $pageTitle = 'wcf.category.list';
/**
* category object type object
- * @var \wcf\data\object\type\ObjectType
+ * @var ObjectType
*/
public $objectType = null;
public $objectTypeName = '';
/**
- * @see \wcf\page\AbstractPage::$templateName
+ * @inheritDoc
*/
public $templateName = 'categoryList';
/**
- * @see \wcf\page\AbstractPage::__run()
+ * @inheritDoc
*/
public function __run() {
$classNameParts = explode('\\', get_called_class());
}
/**
- * @see \wcf\page\IPage::assignVariables()
+ * @inheritDoc
*/
public function assignVariables() {
parent::assignVariables();
}
/**
- * @see \wcf\page\IPage::readData()
+ * @inheritDoc
*/
public function readData() {
$this->objectType = CategoryHandler::getInstance()->getObjectTypeByName($this->objectTypeName);