From accff67c43a0bcb9bca5f3a6e897a80b8f5b458c Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Wed, 18 May 2016 17:11:15 +0200 Subject: [PATCH] Add AbstractMultiCategoryCondition --- .../AbstractMultiCategoryCondition.class.php | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 wcfsetup/install/files/lib/system/condition/AbstractMultiCategoryCondition.class.php diff --git a/wcfsetup/install/files/lib/system/condition/AbstractMultiCategoryCondition.class.php b/wcfsetup/install/files/lib/system/condition/AbstractMultiCategoryCondition.class.php new file mode 100644 index 0000000000..0b2d42c111 --- /dev/null +++ b/wcfsetup/install/files/lib/system/condition/AbstractMultiCategoryCondition.class.php @@ -0,0 +1,54 @@ + + * @package com.woltlab.wcf + * @subpackage system.condition + * @category Community Framework + * @since 2.2 + */ +abstract class AbstractMultiCategoryCondition extends AbstractMultiSelectCondition { + /** + * name of the category object type + * @var string + */ + public $objectType = ''; + + /** + * name of category node tree class + * @var string + */ + public $nodeTreeClassname = CategoryNodeTree::class; + + /** + * @inheritDoc + */ + protected function getFieldElement() { + $categoryTree = (new $this->nodeTreeClassname($this->objectType))->getIterator(); + $categoryCount = iterator_count($categoryTree); + + $fieldElement = ''; + + return $fieldElement; + } + + /** + * @inheritDoc + */ + protected function getOptions() { + return CategoryHandler::getInstance()->getCategories($this->objectType); + } +} -- 2.20.1