diff --git a/README.md b/README.md index 3051322e72b88f40b40eab0c9f94ae17388f3512..e43af670792d0fd71225ac62a1f95f2beaeeb37f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ FAQ Module ======== - +Frequently Asked Questions +Mit den FAQ Seitentypen ist es einfach FAQ für Ihre Benutzer anzulegen. Paketname: @@ -12,6 +13,8 @@ Paketname: Features (Funktionen) -------- +- FAQ Seitentypen + Installation ------------ diff --git a/composer.json b/composer.json index 5915bf9622ae63d261fb4f5bdc121379b3b12475..dc9b27577f71998de87edcd426113a67f21f4756 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ "autoload": { "psr-0" : { - "QUI" : "lib/" + "QUI" : "src/" } } } diff --git a/events.xml b/events.xml index 6bab462d7929c9d115b37d91110f113b6e5e081a..251016fb53419b9e024e7228affcdf02b604b586 100644 --- a/events.xml +++ b/events.xml @@ -1,4 +1,4 @@ <?xml version="1.0" encoding="UTF-8"?> <events> - <event on="onSiteCreateChild" fire="\QUI\FAQ\Events::onChildCreate" /> + <event on="onSiteCreateChild" fire="\QUI\FAQ\EventsHandler::onChildCreate" /> </events> diff --git a/lib/QUI/FAQ/Events.php b/lib/QUI/FAQ/Events.php deleted file mode 100644 index 684782bb5166e0db19c65209e44776268576c473..0000000000000000000000000000000000000000 --- a/lib/QUI/FAQ/Events.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php - -/** - * This file contains \QUI\FAQ\Events - */ - -namespace QUI\FAQ; - -/** - * FAQ Events - * - * @author www.pcsg.de (Henning Leutz) - */ - -class Events -{ - /** - * event on child create - * - * @param integer $newId - * @param \QUI\Projects\Site\Edit $Parent - */ - static function onChildCreate($newId, $Parent) - { - $type = $Parent->getAttribute( 'type' ); - - if ( $type != 'quiqqer/faq:types/list' && $type != 'quiqqer/faq:types/category' ) { - return; - } - - $Project = $Parent->getProject(); - $Site = new \QUI\Projects\Site\Edit( $Project, $newId ); - - if ( $type == 'quiqqer/faq:types/list' ) { - $Site->setAttribute( 'type', 'quiqqer/faq:types/category' ); - } - - if ( $type == 'quiqqer/faq:types/category' ) { - $Site->setAttribute( 'type', 'quiqqer/faq:types/entry' ); - } - - $Site->save(); - } -} diff --git a/src/QUI/FAQ/EventsHandler.php b/src/QUI/FAQ/EventsHandler.php new file mode 100644 index 0000000000000000000000000000000000000000..98425492fe5f6604646af252a9e13c92f8220ce5 --- /dev/null +++ b/src/QUI/FAQ/EventsHandler.php @@ -0,0 +1,47 @@ +<?php + +/** + * This file contains \QUI\FAQ\Events + */ + +namespace QUI\FAQ; + +use QUI\Projects\Site\Edit; + +/** + * FAQ Events + * + * @author www.pcsg.de (Henning Leutz) + */ +class EventsHandler +{ + /** + * event on child create + * + * @param integer $newId + * @param \QUI\Projects\Site\Edit $Parent + */ + public static function onChildCreate($newId, $Parent) + { + $type = $Parent->getAttribute('type'); + + if ($type != 'quiqqer/faq:types/list' + && $type != 'quiqqer/faq:types/category' + ) { + return; + } + + $Project = $Parent->getProject(); + $Site = new Edit($Project, $newId); + + if ($type == 'quiqqer/faq:types/list') { + $Site->setAttribute('type', 'quiqqer/faq:types/category'); + } + + if ($type == 'quiqqer/faq:types/category') { + $Site->setAttribute('type', 'quiqqer/faq:types/entry'); + } + + $Site->save(); + } +} diff --git a/types/entry.php b/types/entry.php index 52e4f5e045e1e8a66c0f044cb8abb73b7b3c4f41..03332611291deb4e62c3a761bb0c65ced53b5668 100644 --- a/types/entry.php +++ b/types/entry.php @@ -4,7 +4,7 @@ * FAQ Entry */ -$Parent = $Site->getParent(); +$Parent = $Site->getParent(); $parentType = $Parent->getAttribute('type'); if ($parentType == 'quiqqer/faq:types/list' @@ -12,7 +12,7 @@ if ($parentType == 'quiqqer/faq:types/list' ) { QUI::getRewrite()->showErrorHeader( 303, - $Parent->getUrlRewritten().'#faq'.$Site->getId() + $Parent->getUrlRewritten() . '#faq' . $Site->getId() ); exit;