From: Marcel Werk Date: Wed, 22 Jun 2016 15:05:35 +0000 (+0200) Subject: Added condition to filter article box by category X-Git-Tag: 3.0.0_Beta_1~1376^2~2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c223bf63b1e3b904cdaeafefaa15ea3448a33b4f;p=GitHub%2FWoltLab%2FWCF.git Added condition to filter article box by category --- diff --git a/com.woltlab.wcf/box.xml b/com.woltlab.wcf/box.xml index 0762f43ecf..0c67a873cc 100644 --- a/com.woltlab.wcf/box.xml +++ b/com.woltlab.wcf/box.xml @@ -22,97 +22,67 @@ - - Letzte Aktivitäten (Sidebar) - Recent Activities (Sidebar) + + Registrierungs-Button + Register Button system - com.woltlab.wcf.recentActivityList + com.woltlab.wcf.registerButton sidebarRight 1 0 + boxInfo com.woltlab.wcf.Dashboard - 10 - Letzte Aktivitäten - - - Recent Activities - - - - - Bezahlte Mitgliedschaften - Paid Subscriptions - system - com.woltlab.wcf.paidSubscriptions - contentBottom - 1 - 0 - - - Bezahlte Mitgliedschaften + Registrierung - Paid Subscriptions + Registration - - Bezahlte Mitgliedschaften (Sidebar) - Paid Subscriptions (Sidebar) + + Angemeldet als + Signed In As system - com.woltlab.wcf.paidSubscriptions + com.woltlab.wcf.signedInAs sidebarRight - 1 + 0 0 + + com.woltlab.wcf.Dashboard + - Bezahlte Mitgliedschaften + Angemeldet als - Paid Subscriptions + Signed In As - - Registrierungs-Button - Register Button + + Team-Mitglieder online + Staff-Members Online system - com.woltlab.wcf.registerButton + com.woltlab.wcf.staffOnlineList sidebarRight 1 0 - boxInfo com.woltlab.wcf.Dashboard - Registrierung + Team-Mitglieder online - Registration + Staff-Members Online - - Angemeldet als - Signed In As - system - com.woltlab.wcf.signedInAs - sidebarRight - 0 - 0 - - com.woltlab.wcf.Dashboard - - - - - Statistiken Statistics @@ -141,6 +111,9 @@ sidebarRight 1 0 + + com.woltlab.wcf.MembersList + registrationDate DESC @@ -160,6 +133,9 @@ sidebarRight 1 0 + + com.woltlab.wcf.MembersList + activityPoints DESC @@ -171,25 +147,6 @@ - - Mitglieder mit den meisten Likes - Most Liked Members - system - com.woltlab.wcf.userList - sidebarRight - 1 - 0 - likesReceived - DESC - - - Mitglieder mit den meisten Likes - - - Most Liked Members - - - Heutige Geburtstage Today’s Birthdays @@ -198,6 +155,9 @@ sidebarRight 1 0 + + com.woltlab.wcf.MembersList + Heutige Geburtstage @@ -206,19 +166,7 @@ Today’s Birthdays - - - Heutige Geburtstage von Nutzern, denen der Nutzer folgt - Today’s Birthdays of Users the User Follows - system - com.woltlab.wcf.todaysFollowingBirthdays - sidebarRight - 1 - 0 - - - - + Benutzer online Users Online @@ -236,53 +184,6 @@ - - Benutzer online (Sidebar) - Users Online (Sidebar) - system - com.woltlab.wcf.userOnlineList - sidebarRight - 1 - 0 - - - Benutzer online - - - Users Online - - - - - Team-Mitglieder online - Staff-Members Online - system - com.woltlab.wcf.staffOnlineList - sidebarRight - 1 - 0 - - - Team-Mitglieder online - - - Staff-Members Online - - - - - Benutzer online, denen der Nutzer folgt - Users Online the User Follows - system - com.woltlab.wcf.followingsOnline - sidebarRight - 1 - 0 - 10 - - - - Seiten-Kommentare Page Comments diff --git a/com.woltlab.wcf/objectType.xml b/com.woltlab.wcf/objectType.xml index 1ab32cde25..434855c361 100644 --- a/com.woltlab.wcf/objectType.xml +++ b/com.woltlab.wcf/objectType.xml @@ -1031,6 +1031,14 @@ + + + com.woltlab.wcf.articleCategory + com.woltlab.wcf.box.articleList.condition + wcf\system\condition\article\ArticleCategoryCondition + + + com.woltlab.wcf.page.controller diff --git a/com.woltlab.wcf/objectTypeDefinition.xml b/com.woltlab.wcf/objectTypeDefinition.xml index 26c32bbeef..2ec0b03738 100644 --- a/com.woltlab.wcf/objectTypeDefinition.xml +++ b/com.woltlab.wcf/objectTypeDefinition.xml @@ -208,6 +208,13 @@ wcf\system\box\IBoxController + + + com.woltlab.wcf.box.articleList.condition + wcf\system\condition\IObjectListCondition + + + com.woltlab.wcf.page diff --git a/wcfsetup/install/files/lib/system/box/ArticleListBoxController.class.php b/wcfsetup/install/files/lib/system/box/ArticleListBoxController.class.php index b9fdf18761..3dd0d4efed 100644 --- a/wcfsetup/install/files/lib/system/box/ArticleListBoxController.class.php +++ b/wcfsetup/install/files/lib/system/box/ArticleListBoxController.class.php @@ -28,6 +28,11 @@ class ArticleListBoxController extends AbstractDatabaseObjectListBoxController { */ public $defaultLimit = 3; + /** + * @inheritDoc + */ + protected $conditionDefinition = 'com.woltlab.wcf.box.articleList.condition'; + /** * @inheritDoc */ @@ -61,9 +66,6 @@ class ArticleListBoxController extends AbstractDatabaseObjectListBoxController { case 'views': $objectList->getConditionBuilder()->add('article.views > ?', [0]); break; - case 'cumulativeLikes': - $objectList->getConditionBuilder()->add('article.cumulativeLikes > ?', [0]); - break; } return $objectList; diff --git a/wcfsetup/install/files/lib/system/condition/article/ArticleCategoryCondition.class.php b/wcfsetup/install/files/lib/system/condition/article/ArticleCategoryCondition.class.php new file mode 100644 index 0000000000..439d58bc2c --- /dev/null +++ b/wcfsetup/install/files/lib/system/condition/article/ArticleCategoryCondition.class.php @@ -0,0 +1,43 @@ + + * @package WoltLabSuite\Core\System\Condition\Article + * @since 3.0 + */ +class ArticleCategoryCondition extends AbstractMultiCategoryCondition implements IObjectListCondition { + /** + * @inheritDoc + */ + public $objectType = 'com.woltlab.wcf.article.category'; + + /** + * @inheritDoc + */ + protected $fieldName = 'articleCategoryIDs'; + + /** + * @inheritDoc + */ + protected $label = 'wcf.acp.article.category'; + + /** + * @inheritDoc + */ + public function addObjectListCondition(DatabaseObjectList $objectList, array $conditionData) { + if (!($objectList instanceof ArticleList)) { + throw new \InvalidArgumentException("Object list is no instance of '".ArticleList::class."', instance of '".get_class($objectList)."' given."); + } + + $objectList->getConditionBuilder()->add('article.categoryID IN (?)', [$conditionData[$this->fieldName]]); + } +}