commit c062cce91db404fe155b0abc232aa70f60019415 Author: Dennis Eichhorn Date: Sun Nov 29 21:57:18 2015 +0100 Init diff --git a/Admin/Install/Navigation.php b/Admin/Install/Navigation.php new file mode 100644 index 0000000..83afac9 --- /dev/null +++ b/Admin/Install/Navigation.php @@ -0,0 +1,38 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\Surveys\Admin\Install; + +/** + * Navigation class. + * + * @category Modules + * @package Modules\Admin + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class Navigation +{ + public static function install($dbPool) + { + $navData = json_decode(file_get_contents(__DIR__ . '/nav.install.json'), true); + + $class = '\\Modules\\Navigation\\Admin\\Installer'; + $class::installExternal($dbPool, $navData); + } +} diff --git a/Admin/Install/nav.install.json b/Admin/Install/nav.install.json new file mode 100644 index 0000000..f93da26 --- /dev/null +++ b/Admin/Install/nav.install.json @@ -0,0 +1,48 @@ +[ + { + "id": 1000801001, + "pid": "754a08ddf8bcb1cf22f310f09206dd783d42f7dd", + "type": 2, + "subtype": 1, + "name": "Surveys", + "uri": "/{/lang}/backend/survey/list", + "target": "self", + "icon": null, + "order": 50, + "from": "Surveys", + "permission": null, + "parent": 1003301001, + "children": [ + { + "id": 1000802001, + "pid": "6c941ab5b60c49df3c7d50b935fd213c060a6664", + "type": 3, + "subtype": 1, + "name": "List", + "uri": "/{/lang}/backend/survey/list", + "target": "self", + "icon": null, + "order": 1, + "from": "Surveys", + "permission": null, + "parent": 1000801001, + "children": [] + }, + { + "id": 1000803001, + "pid": "6c941ab5b60c49df3c7d50b935fd213c060a6664", + "type": 3, + "subtype": 1, + "name": "Create", + "uri": "/{/lang}/backend/survey/create", + "target": "self", + "icon": null, + "order": 5, + "from": "Surveys", + "permission": null, + "parent": 1000801001, + "children": [] + } + ] + } +] diff --git a/Admin/Installer.php b/Admin/Installer.php new file mode 100644 index 0000000..7a66706 --- /dev/null +++ b/Admin/Installer.php @@ -0,0 +1,49 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\Surveys\Admin; + +use phpOMS\DataStorage\Database\DatabaseType; +use phpOMS\DataStorage\Database\Pool; +use phpOMS\Module\InstallerAbstract; + +/** + * Surveys install class. + * + * @category Modules + * @package Modules\Surveys + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class Installer extends InstallerAbstract +{ + + /** + * {@inheritdoc} + */ + public static function install(Pool $dbPool, array $info) + { + parent::install($dbPool, $info); + + switch ($dbPool->get('core')->getType()) { + case DatabaseType::MYSQL: + + break; + } + } +} diff --git a/Controller.php b/Controller.php new file mode 100644 index 0000000..c189ed9 --- /dev/null +++ b/Controller.php @@ -0,0 +1,169 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\Surveys; + +use Modules\Navigation\Models\Navigation; +use Modules\Navigation\Views\NavigationView; +use phpOMS\Contract\RenderableInterface; +use phpOMS\Message\RequestAbstract; +use phpOMS\Message\RequestDestination; +use phpOMS\Message\ResponseAbstract; +use phpOMS\Module\ModuleAbstract; +use phpOMS\Module\WebInterface; +use phpOMS\Views\View; +use phpOMS\Views\ViewLayout; + +/** + * Surveys controller class. + * + * @category Modules + * @package Modules\Surveys + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class Controller extends ModuleAbstract implements WebInterface +{ + + /** + * Module name. + * + * @var \string + * @since 1.0.0 + */ + protected static $module = 'Surveys'; + + /** + * Localization files. + * + * @var \string + * @since 1.0.0 + */ + protected static $localization = [ + RequestDestination::BACKEND => ['backend'], + ]; + + /** + * Providing. + * + * @var \string + * @since 1.0.0 + */ + protected static $providing = [ + 'Content', + ]; + + /** + * Dependencies. + * + * @var \string + * @since 1.0.0 + */ + protected static $dependencies = []; + + /** + * Routing elements. + * + * @var array + * @since 1.0.0 + */ + protected static $routes = [ + '^.*/backend/survey/list.*$' => [['dest' => '\Modules\Surveys\Controller:viewSurveysList', 'method' => 'GET', 'type' => ViewLayout::MAIN],], + '^.*/backend/survey/create.*$' => [['dest' => '\Modules\Surveys\Controller:viewSurveysCreate', 'method' => 'GET', 'type' => ViewLayout::MAIN],], + '^.*/backend/survey/profile.*$' => [['dest' => '\Modules\Surveys\Controller:viewSurveysProfile', 'method' => 'GET', 'type' => ViewLayout::MAIN],], + ]; + + /** + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param mixed $data Generic data + * + * @return RenderableInterface + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function viewSurveysList(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface + { + $view = new View($this->app, $request, $response); + $view->setTemplate('/Modules/Surveys/Theme/backend/surveys-list'); + $view->addData('nav', $this->createNavigation(1000801001, $request, $response)); + + return $view; + } + + /** + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param mixed $data Generic data + * + * @return RenderableInterface + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function viewSurveysCreate(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface + { + $view = new View($this->app, $request, $response); + $view->setTemplate('/Modules/Surveys/Theme/backend/surveys-create'); + $view->addData('nav', $this->createNavigation(1000801001, $request, $response)); + + return $view; + } + + /** + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * @param mixed $data Generic data + * + * @return RenderableInterface + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function viewSurveysProfile(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface + { + $view = new View($this->app, $request, $response); + $view->setTemplate('/Modules/Surveys/Theme/backend/surveys-profile'); + $view->addData('nav', $this->createNavigation(1000801001, $request, $response)); + + return $view; + } + + /** + * @param int $pageId Page/parent Id for navigation + * @param RequestAbstract $request Request + * @param ResponseAbstract $response Response + * + * @return RenderableInterface + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + private function createNavigation(\int $pageId, RequestAbstract $request, ResponseAbstract $response) + { + $nav = Navigation::getInstance($request, $this->app->dbPool); + $navView = new NavigationView($this->app, $request, $response); + $navView->setTemplate('/Modules/Navigation/Theme/backend/mid'); + $navView->setNav($nav->getNav()); + $navView->setLanguage($request->getL11n()->language); + $navView->setParent($pageId); + + return $navView; + } +} diff --git a/Models/Answer.php b/Models/Answer.php new file mode 100644 index 0000000..ad5312c --- /dev/null +++ b/Models/Answer.php @@ -0,0 +1,146 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\Surveys; + +use phpOMS\Pattern\Multition; + +/** + * Answer class. + * + * @category Surveys + * @package Framework + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class Answer implements Multition +{ + + /** + * ID. + * + * @var \int + * @since 1.0.0 + */ + private $id = ''; + + /** + * Name. + * + * @var \string + * @since 1.0.0 + */ + private $name = ''; + + /** + * Description. + * + * @var \string + * @since 1.0.0 + */ + private $description = ''; + + private static $instances = []; + + public function __construct($id) + { + } + + public function getInstance($id) + { + if (!isset(self::$instances[$id])) { + self::$instances[$id] = new self($id); + } + + return self::$instances[$id]; + } + + /** + * {@inheritdoc} + */ + public function init($id) + { + } + + /** + * {@inheritdoc} + */ + public function __clone() + { + } + + public function getId() + { + return $this->id; + } + + public function getName() + { + return $this->name; + } + + public function setName($name) + { + $this->name = $name; + } + + public function getDescription() + { + return $this->description; + } + + public function setDescription($desc) + { + $this->description = $desc; + } + + /** + * {@inheritdoc} + */ + public function delete() + { + } + + /** + * {@inheritdoc} + */ + public function create() + { + } + + /** + * {@inheritdoc} + */ + public function update() + { + } + + /** + * {@inheritdoc} + */ + public function serialize() + { + } + + /** + * {@inheritdoc} + */ + public function unserialize($data) + { + } +} diff --git a/Models/Question.php b/Models/Question.php new file mode 100644 index 0000000..095ff0a --- /dev/null +++ b/Models/Question.php @@ -0,0 +1,146 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\Surveys; + +use phpOMS\Pattern\Multition; + +/** + * Question class. + * + * @category Surveys + * @package Framework + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class Question implements Multition +{ + + /** + * ID. + * + * @var \int + * @since 1.0.0 + */ + private $id = ''; + + /** + * Name. + * + * @var \string + * @since 1.0.0 + */ + private $name = ''; + + /** + * Description. + * + * @var \string + * @since 1.0.0 + */ + private $description = ''; + + private static $instances = []; + + public function __construct($id) + { + } + + public function getInstance($id) + { + if (!isset(self::$instances[$id])) { + self::$instances[$id] = new self($id); + } + + return self::$instances[$id]; + } + + /** + * {@inheritdoc} + */ + public function init($id) + { + } + + /** + * {@inheritdoc} + */ + public function __clone() + { + } + + public function getId() + { + return $this->id; + } + + public function getName() + { + return $this->name; + } + + public function setName($name) + { + $this->name = $name; + } + + public function getDescription() + { + return $this->description; + } + + public function setDescription($desc) + { + $this->description = $desc; + } + + /** + * {@inheritdoc} + */ + public function delete() + { + } + + /** + * {@inheritdoc} + */ + public function create() + { + } + + /** + * {@inheritdoc} + */ + public function update() + { + } + + /** + * {@inheritdoc} + */ + public function serialize() + { + } + + /** + * {@inheritdoc} + */ + public function unserialize($data) + { + } +} diff --git a/Models/Section.php b/Models/Section.php new file mode 100644 index 0000000..1b56fcc --- /dev/null +++ b/Models/Section.php @@ -0,0 +1,160 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\Surveys; + +use phpOMS\Pattern\Multition; + +/** + * Section class. + * + * @category Surveys + * @package Framework + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class Section implements Multition +{ + + /** + * ID. + * + * @var \int + * @since 1.0.0 + */ + private $id = ''; + + /** + * Name. + * + * @var \string + * @since 1.0.0 + */ + private $name = ''; + + /** + * Description. + * + * @var \string + * @since 1.0.0 + */ + private $description = ''; + + private static $instances = []; + + public function __construct($id) + { + } + + public function getInstance($id) + { + if (!isset(self::$instances[$id])) { + self::$instances[$id] = new self($id); + } + + return self::$instances[$id]; + } + + public function getId() + { + return $this->id; + } + + public function getName() + { + return $this->name; + } + + public function setName($name) + { + $this->name = $name; + } + + public function getDescription() + { + return $this->description; + } + + public function setDescription($desc) + { + $this->description = $desc; + } + + /** + * {@inheritdoc} + */ + public function delete() + { + } + + /** + * {@inheritdoc} + */ + public function create() + { + } + + /** + * {@inheritdoc} + */ + public function update() + { + } + + /** + * {@inheritdoc} + */ + public function serialize() + { + } + + /** + * {@inheritdoc} + */ + public function unserialize($data) + { + } + + /** + * Init object by ID. + * + * This usually happens from DB or cache + * + * @param \int $id Object ID + * + * @return void + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function init($id) + { + // TODO: Implement init() method. + } + + /** + * Overwriting clone in order to maintain singleton pattern. + * + * @since 1.0.0 + * @author Dennis Eichhorn + */ + public function __clone() + { + // TODO: Implement __clone() method. + } +} diff --git a/Models/Survey.php b/Models/Survey.php new file mode 100644 index 0000000..3a9b908 --- /dev/null +++ b/Models/Survey.php @@ -0,0 +1,182 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\Surveys; + +use phpOMS\Pattern\Multition; + +/** + * Survey class. + * + * @category Surveys + * @package Framework + * @author OMS Development Team + * @author Dennis Eichhorn + * @license OMS License 1.0 + * @link http://orange-management.com + * @since 1.0.0 + */ +class Survey implements Multition +{ + + /** + * ID. + * + * @var \int + * @since 1.0.0 + */ + private $id = ''; + + /** + * Name. + * + * @var \string + * @since 1.0.0 + */ + private $name = ''; + + /** + * Description. + * + * @var \string + * @since 1.0.0 + */ + private $description = ''; + + /** + * Created. + * + * @var datetime + * @since 1.0.0 + */ + private $created = null; + + /** + * Creator. + * + * @var \int + * @since 1.0.0 + */ + private $creator = null; + + private static $instances = []; + + public function __construct($id) + { + } + + public function getInstance($id) + { + if (!isset(self::$instances[$id])) { + self::$instances[$id] = new self($id); + } + + return self::$instances[$id]; + } + + /** + * {@inheritdoc} + */ + public function init($id) + { + } + + /** + * {@inheritdoc} + */ + public function __clone() + { + } + + public function getId() + { + return $this->id; + } + + public function getName() + { + return $this->name; + } + + public function setName($name) + { + $this->name = $name; + } + + public function getDescription() + { + return $this->description; + } + + public function setDescription($desc) + { + $this->description = $desc; + } + + public function getCreated() + { + return $this->created; + } + + public function setCreated($created) + { + $this->created = $created; + } + + public function getCreator() + { + return $this->creator; + } + + public function setCreator($creator) + { + $this->creator = $creator; + } + + /** + * {@inheritdoc} + */ + public function delete() + { + } + + /** + * {@inheritdoc} + */ + public function create() + { + } + + /** + * {@inheritdoc} + */ + public function update() + { + } + + /** + * {@inheritdoc} + */ + public function serialize() + { + } + + /** + * {@inheritdoc} + */ + public function unserialize($data) + { + } +} diff --git a/README.md b/README.md new file mode 100644 index 0000000..2cfcb33 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Surveys # diff --git a/Theme/backend/surveys-create.tpl.php b/Theme/backend/surveys-create.tpl.php new file mode 100644 index 0000000..452cd75 --- /dev/null +++ b/Theme/backend/surveys-create.tpl.php @@ -0,0 +1,78 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +echo $this->getData('nav')->render(); ?> + +
+

l11n->lang['Surveys']['Survey'] ?>

+
+
+ +
+
+
+
+
+
+
+
+
+
+
+ +
+

l11n->lang['Surveys']['Section'] ?>

+
+
+ +
+
+
+
+
+
+
+
+ + +
+

l11n->lang['Surveys']['Question'] ?>

+
+
+ +
+
+
+
+
+
+
+
diff --git a/Theme/backend/surveys-list.tpl.php b/Theme/backend/surveys-list.tpl.php new file mode 100644 index 0000000..843945c --- /dev/null +++ b/Theme/backend/surveys-list.tpl.php @@ -0,0 +1,43 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ + +$footerView = new \Web\Views\Lists\PaginationView($this->app, $this->request, $this->response); +$footerView->setTemplate('/Web/Templates/Lists/Footer/PaginationBig'); +$footerView->setPages(20); +$footerView->setPage(1); + +echo $this->getData('nav')->render(); ?> + +
+ + + + + + + + $value) : $count++; ?> + + +
l11n->lang['Surveys']['Surveys'] ?>
l11n->lang['Surveys']['Status']; ?> + l11n->lang['Surveys']['Title']; ?> + l11n->lang['Surveys']['Created']; ?> + l11n->lang['Surveys']['Creator']; ?> +
render(); ?> +
l11n->lang[0]['Empty']; ?> + +
+
diff --git a/Theme/backend/surveys-profile.tpl.php b/Theme/backend/surveys-profile.tpl.php new file mode 100644 index 0000000..8e3880e --- /dev/null +++ b/Theme/backend/surveys-profile.tpl.php @@ -0,0 +1,17 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +echo $this->getData('nav')->render(); ?> + diff --git a/Theme/lang/api.en.lang.php b/Theme/lang/api.en.lang.php new file mode 100644 index 0000000..eea62f6 --- /dev/null +++ b/Theme/lang/api.en.lang.php @@ -0,0 +1,17 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +$MODLANG[1] = [ +]; diff --git a/Theme/lang/backend.en.lang.php b/Theme/lang/backend.en.lang.php new file mode 100644 index 0000000..0c753e1 --- /dev/null +++ b/Theme/lang/backend.en.lang.php @@ -0,0 +1,50 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +$MODLANG['Surveys'] = [ + 'Additional' => 'Additional', + 'Answer' => 'Answer', + 'Checkbox' => 'Checkbox', + 'CoreData' => 'Core Data', + 'Created' => 'Created', + 'Creator' => 'Creator', + 'Date' => 'Date', + 'Description' => 'Description', + 'Dropdown' => 'Dropdown', + 'End' => 'End', + 'Group' => 'Group', + 'Question' => 'Question', + 'Questions' => 'Questions', + 'Manager' => 'Manager', + 'Name' => 'Name', + 'Number' => 'Number', + 'Questionee' => 'Questionee', + 'Radio' => 'Radio', + 'Receiver' => 'Receiver', + 'Reference' => 'Reference', + 'Responsibility' => 'Responsibility', + 'Result' => 'Result', + 'ResultPublic' => 'Result public?', + 'Section' => 'Section', + 'Start' => 'Start', + 'Status' => 'Status', + 'Survey' => 'Survey', + 'Surveys' => 'Surveys', + 'Text' => 'Text', + 'Title' => 'Title', + 'Type' => 'Type', + 'User' => 'User', + 'UserGroup' => 'User/Group', +]; diff --git a/Theme/lang/nav.backend.en.lang.php b/Theme/lang/nav.backend.en.lang.php new file mode 100644 index 0000000..5349da1 --- /dev/null +++ b/Theme/lang/nav.backend.en.lang.php @@ -0,0 +1,18 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +$MODLANG['Navigation'] = [ + 'Surveys' => 'Surveys', +]; diff --git a/img/module_teaser_small.png b/img/module_teaser_small.png new file mode 100644 index 0000000..f56e6ff Binary files /dev/null and b/img/module_teaser_small.png differ diff --git a/info.json b/info.json new file mode 100644 index 0000000..b359043 --- /dev/null +++ b/info.json @@ -0,0 +1,51 @@ +{ + "name": { + "id": 1000800000, + "internal": "Survys", + "external": "OMS Surveys" + }, + "version": "1.0.0", + "requirements": { + "phpOMS": "1.0.0", + "phpOMS-db": "1.0.0" + }, + "creator": { + "name": "Orange Management", + "website": "www.spl1nes.com" + }, + "description": "Surveys module.", + "directory": "Surveys", + "dependencies": {}, + "providing": { + "Navigation": "*" + }, + "load": [ + { + "pid": [ + "6c941ab5b60c49df3c7d50b935fd213c060a6664" + ], + "type": 4, + "for": 0, + "from": "Surveys", + "file": "Surveys" + }, + { + "pid": [ + "754a08ddf8bcb1cf22f310f09206dd783d42f7dd" + ], + "type": 5, + "from": "Surveys", + "for": "Navigation", + "file": "nav.backend" + }, + { + "pid": [ + "6c941ab5b60c49df3c7d50b935fd213c060a6664" + ], + "type": 5, + "for": "Content", + "file": "backend", + "from": "Surveys" + } + ] +}