Add trophy category management
authorJoshua Rüsweg <josh@bastelstu.be>
Sat, 1 Jul 2017 20:36:02 +0000 (22:36 +0200)
committerJoshua Rüsweg <josh@bastelstu.be>
Sat, 1 Jul 2017 20:36:02 +0000 (22:36 +0200)
See #2315

com.woltlab.wcf/acpMenu.xml
wcfsetup/install/files/lib/acp/form/TrophyCategoryAddForm.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/acp/form/TrophyCategoryEditForm.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/acp/page/TrophyCategoryListPage.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/category/TrophyCategoryType.class.php [new file with mode: 0644]
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index d5ce451e710fa7eae1d9e0b003a7d1526b84f621..7e221ac89d136ddfdfc386f9dba0d02a0c115ff8 100644 (file)
                                <options>module_paid_subscription</options>
                        </acpmenuitem>
                        <!-- /paid subscription -->
+                       
+                       <!-- trophy -->
+                       <acpmenuitem name="wcf.acp.menu.link.trophy">
+                               <parent>wcf.acp.menu.link.user</parent>
+                               <showorder>7</showorder>
+                       </acpmenuitem>
+                       <acpmenuitem name="wcf.acp.menu.link.trophy.category.list">
+                               <controller>wcf\acp\page\TrophyCategoryListPage</controller>
+                               <parent>wcf.acp.menu.link.trophy</parent>
+                               <permissions>admin.trophy.canManageTrophy</permissions>
+                               <options>module_trophy</options>
+                       </acpmenuitem>
+                       <acpmenuitem name="wcf.acp.menu.link.trophy.category.add">
+                               <controller>wcf\acp\form\TrophyCategoryAddForm</controller>
+                               <parent>wcf.acp.menu.link.trophy.category.list</parent>
+                               <permissions>admin.trophy.canManageTrophy</permissions>
+                               <options>module_trophy</options>
+                               <icon>fa-plus</icon>
+                       </acpmenuitem>
+                       <!-- /trophy -->
                
                <!-- /user -->
                
diff --git a/wcfsetup/install/files/lib/acp/form/TrophyCategoryAddForm.class.php b/wcfsetup/install/files/lib/acp/form/TrophyCategoryAddForm.class.php
new file mode 100644 (file)
index 0000000..dc2c313
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+namespace wcf\acp\form;
+
+/**
+ * Represents the trophy category add form.
+ *
+ * @author     Joshua Ruesweg
+ * @copyright  2001-2017 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    WoltLabSuite\Core\Acp\Form
+ * @since      3.1
+ */
+class TrophyCategoryAddForm extends AbstractCategoryAddForm {
+       /**
+        * @inheritDoc
+        */
+       public $activeMenuItem = 'wcf.acp.menu.link.trophy.category.add';
+       
+       /**
+        * @inheritDoc
+        */
+       public $objectTypeName = 'com.woltlab.wcf.trophy.category';
+       
+       /**
+        * @inheritDoc
+        */
+       public $neededModules = ['MODULE_TROPHY'];
+       
+       /**
+        * @inheritDoc
+        */
+       public $neededPermissions = ['admin.trophy.canManageTrophy'];
+}
diff --git a/wcfsetup/install/files/lib/acp/form/TrophyCategoryEditForm.class.php b/wcfsetup/install/files/lib/acp/form/TrophyCategoryEditForm.class.php
new file mode 100644 (file)
index 0000000..1d59fbf
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+namespace wcf\acp\form;
+
+/**
+ * Represents the trophy category edit form.
+ *
+ * @author     Joshua Ruesweg
+ * @copyright  2001-2017 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    WoltLabSuite\Core\Acp\Form
+ * @since      3.1
+ */
+class TrophyCategoryEditForm extends AbstractCategoryEditForm {
+       /**
+        * @inheritDoc
+        */
+       public $activeMenuItem = 'wcf.acp.menu.link.trophy';
+       
+       /**
+        * @inheritDoc
+        */
+       public $objectTypeName = 'com.woltlab.wcf.trophy.category';
+       
+       /**
+        * @inheritDoc
+        */
+       public $neededModules = ['MODULE_TROPHY'];
+       
+       /**
+        * @inheritDoc
+        */
+       public $neededPermissions = ['admin.trophy.canManageTrophy'];
+}
diff --git a/wcfsetup/install/files/lib/acp/page/TrophyCategoryListPage.class.php b/wcfsetup/install/files/lib/acp/page/TrophyCategoryListPage.class.php
new file mode 100644 (file)
index 0000000..5fd0b26
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+namespace wcf\acp\page;
+
+/**
+ * Represents the trophy category list page.
+ *
+ * @author     Joshua Ruesweg
+ * @copyright  2001-2017 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    WoltLabSuite\Core\Acp\Form
+ * @since      3.1
+ */
+class TrophyCategoryListPage extends AbstractCategoryListPage {
+       /**
+        * @inheritDoc
+        */
+       public $activeMenuItem = 'wcf.acp.menu.link.trophy.category.list';
+       
+       /**
+        * @inheritDoc
+        */
+       public $objectTypeName = 'com.woltlab.wcf.trophy.category';
+       
+       /**
+        * @inheritDoc
+        */
+       public $neededModules = ['MODULE_TROPHY'];
+       
+       /**
+        * @inheritDoc
+        */
+       public $neededPermissions = ['admin.trophy.canManageTrophy'];
+}
diff --git a/wcfsetup/install/files/lib/system/category/TrophyCategoryType.class.php b/wcfsetup/install/files/lib/system/category/TrophyCategoryType.class.php
new file mode 100644 (file)
index 0000000..6946941
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+namespace wcf\system\category;
+use wcf\system\WCF;
+
+/**
+ * Trophy category type.
+ *
+ * @author     Joshua Ruesweg
+ * @copyright  2001-2017 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    WoltLabSuite\Core\System\Category
+ * @since      3.1
+ */
+class TrophyCategoryType extends AbstractCategoryType {
+       /**
+        * @inheritDoc
+        */
+       protected $langVarPrefix = 'wcf.trophy.category';
+       
+       /**
+        * @inheritDoc
+        */
+       protected $maximumNestingLevel = 0;
+       
+       /** @noinspection PhpMissingParentCallCommonInspection */
+       /**
+        * @inheritDoc
+        */
+       public function canAddCategory() {
+               return $this->canEditCategory();
+       }
+       
+       /** @noinspection PhpMissingParentCallCommonInspection */
+       /**
+        * @inheritDoc
+        */
+       public function canDeleteCategory() {
+               return $this->canEditCategory();
+       }
+       
+       /** @noinspection PhpMissingParentCallCommonInspection */
+       /**
+        * @inheritDoc
+        */
+       public function canEditCategory() {
+               return WCF::getSession()->getPermission('admin.trophy.canManageTrophy');
+       }
+}
index 1084eeb615cc8d9857ec74b7ee94571299c9b450..479de0d8fd6686bfa024d0955f6014c701fb5b74 100644 (file)
                <item name="wcf.acp.menu.link.other"><![CDATA[Sonstiges]]></item>
                <item name="wcf.acp.menu.item.pageObjectID.error.invalid"><![CDATA[Die eingetragene ID ist ungültig.]]></item>
                <item name="wcf.acp.menu.link.contact.settings"><![CDATA[Kontakt-Formular]]></item>
+               <item name="wcf.acp.menu.link.trophy"><![CDATA[Trophäen]]></item>
+               <item name="wcf.acp.menu.link.trophy.category.list"><![CDATA[Kategorien]]></item>
+               <item name="wcf.acp.menu.link.trophy.category.add"><![CDATA[Kategorie hinzufügen]]></item>
        </category>
        
        <category name="wcf.acp.notice">
index 1f39f930969684c1414398a01d0cb0ae0850126c..7f26692d27bde392192739f47ad061e033ebddbb 100644 (file)
                <item name="wcf.acp.menu.link.other"><![CDATA[Other]]></item>
                <item name="wcf.acp.menu.item.pageObjectID.error.invalid"><![CDATA[ID is invalid.]]></item>
                <item name="wcf.acp.menu.link.contact.settings"><![CDATA[Contact Form]]></item>
+               <item name="wcf.acp.menu.link.trophy"><![CDATA[Trophies]]></item>
+               <item name="wcf.acp.menu.link.trophy.category.list"><![CDATA[Categories]]></item>
+               <item name="wcf.acp.menu.link.trophy.category.add"><![CDATA[Add Category]]></item>
        </category>
        
        <category name="wcf.acp.notice">