From 6032dfd5c20b07934eb5bc1b834d4e0230b69cb2 Mon Sep 17 00:00:00 2001 From: Henning Leutz <leutz@pcsg.de> Date: Thu, 21 Jan 2016 16:27:56 +0100 Subject: [PATCH] psr2 --- README.md | 5 +++- composer.json | 2 +- events.xml | 2 +- lib/QUI/FAQ/Events.php | 44 -------------------------------- src/QUI/FAQ/EventsHandler.php | 47 +++++++++++++++++++++++++++++++++++ types/entry.php | 4 +-- 6 files changed, 55 insertions(+), 49 deletions(-) delete mode 100644 lib/QUI/FAQ/Events.php create mode 100644 src/QUI/FAQ/EventsHandler.php diff --git a/README.md b/README.md index 3051322..e43af67 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 5915bf9..dc9b275 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 6bab462..251016f 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 684782b..0000000 --- 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 0000000..9842549 --- /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 52e4f5e..0333261 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; -- GitLab