commit e4761517845568c52115259423f792b379b7329b 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..9eefb8d --- /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\Profile\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..de3deed --- /dev/null +++ b/Admin/Install/nav.install.json @@ -0,0 +1,63 @@ +[ + { + "id": 1000301001, + "pid": "754a08ddf8bcb1cf22f310f09206dd783d42f7dd", + "type": 2, + "subtype": 1, + "name": "Profiles", + "uri": "/{/lang}/backend/profile/list", + "target": "self", + "icon": null, + "order": 10, + "from": "Profile", + "permission": null, + "parent": 1000201001, + "children": [ + { + "id": 1000302001, + "pid": "722846d6c55f46fd3d372bba7311a150acd1f23c", + "type": 3, + "subtype": 1, + "name": "List", + "uri": "/{/lang}/backend/profile/list", + "target": "self", + "icon": null, + "order": 1, + "from": "Profile", + "permission": null, + "parent": 1000301001, + "children": [] + }, + { + "id": 1000303001, + "pid": "722846d6c55f46fd3d372bba7311a150acd1f23c", + "type": 5, + "subtype": 1, + "name": "Profile", + "uri": "/{/lang}/backend/profile/single/front", + "target": "self", + "icon": null, + "order": 3, + "from": "Profile", + "permission": null, + "parent": 1000301001, + "children": [] + }, + { + "id": 1000303002, + "pid": "722846d6c55f46fd3d372bba7311a150acd1f23c", + "type": 5, + "subtype": 1, + "name": "Settings", + "uri": "/{/lang}/backend/profile/single/settings", + "target": "self", + "icon": null, + "order": 999, + "from": "Profile", + "permission": null, + "parent": 1000301001, + "children": [] + } + ] + } +] diff --git a/Admin/Installer.php b/Admin/Installer.php new file mode 100644 index 0000000..f5b8b22 --- /dev/null +++ b/Admin/Installer.php @@ -0,0 +1,133 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\Profile\Admin; + +use phpOMS\DataStorage\Database\DatabaseType; +use phpOMS\DataStorage\Database\Pool; +use phpOMS\Module\InstallerAbstract; + +/** + * Navigation class. + * + * @category Modules + * @package Framework + * @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: + $dbPool->get('core')->con->prepare( + 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'profile_account` ( + `profile_account_id` int(11) NOT NULL, + `profile_account_begin` datetime NOT NULL, + `profile_account_image` varchar(255) NOT NULL, + `profile_account_cv` text NOT NULL, + `profile_account_account` int(11) DEFAULT NULL, + PRIMARY KEY (`profile_account_id`), + KEY `profile_account_account` (`profile_account_account`) + )ENGINE=InnoDB DEFAULT CHARSET=utf8;' + )->execute(); + + $dbPool->get('core')->con->prepare( + 'ALTER TABLE `' . $dbPool->get('core')->prefix . 'profile_account` + ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'profile_account_ibfk_1` FOREIGN KEY (`profile_account_account`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);' + )->execute(); + + $dbPool->get('core')->con->prepare( + 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'profile_phone` ( + `profile_phone_id` int(11) NOT NULL, + `profile_phone_type` tinyint(2) NOT NULL, + `profile_phone_number` varchar(50) NOT NULL, + `profile_phone_account` int(11) NOT NULL, + PRIMARY KEY (`profile_phone_id`), + KEY `profile_phone_account` (`profile_phone_account`) + )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;' + )->execute(); + + $dbPool->get('core')->con->prepare( + 'ALTER TABLE `' . $dbPool->get('core')->prefix . 'profile_phone` + ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'profile_phone_ibfk_1` FOREIGN KEY (`profile_phone_account`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);' + )->execute(); + + $dbPool->get('core')->con->prepare( + 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'profile_address` ( + `profile_address_id` int(11) NOT NULL, + `profile_address_type` tinyint(2) NOT NULL, + `profile_address_address` varchar(50) NOT NULL, + `profile_address_street` varchar(50) NOT NULL, + `profile_address_city` varchar(50) NOT NULL, + `profile_address_zip` varchar(50) NOT NULL, + `profile_address_country` varchar(50) NOT NULL, + `profile_address_account` int(11) DEFAULT NULL, + PRIMARY KEY (`profile_address_id`), + KEY `profile_address_account` (`profile_address_account`) + )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;' + )->execute(); + + $dbPool->get('core')->con->prepare( + 'ALTER TABLE `' . $dbPool->get('core')->prefix . 'profile_address` + ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'profile_address_ibfk_1` FOREIGN KEY (`profile_address_account`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);' + )->execute(); + + $dbPool->get('core')->con->prepare( + 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'profile_account_relation` ( + `profile_account_relation_id` int(11) NOT NULL, + `profile_account_relation_type` tinyint(2) NOT NULL, + `profile_account_relation_relation` int(11) DEFAULT NULL, + `profile_account_relation_account` int(11) DEFAULT NULL, + PRIMARY KEY (`profile_account_relation_id`), + KEY `profile_account_relation_account` (`profile_account_relation_account`) + )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;' + )->execute(); + + $dbPool->get('core')->con->prepare( + 'ALTER TABLE `' . $dbPool->get('core')->prefix . 'profile_account_relation` + ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'profile_account_relation_ibfk_1` FOREIGN KEY (`profile_account_relation_account`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);' + )->execute(); + + $dbPool->get('core')->con->prepare( + 'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'profile_account_setting` ( + `profile_account_setting_id` int(11) NOT NULL, + `profile_account_setting_module` int(11) NOT NULL, + `profile_account_setting_type` varchar(20) NOT NULL, + `profile_account_setting_value` varchar(32) DEFAULT NULL, + `profile_account_setting_account` int(11) DEFAULT NULL, + PRIMARY KEY (`profile_account_setting_id`), + KEY `profile_account_setting_account` (`profile_account_setting_account`) + )ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;' + )->execute(); + + $dbPool->get('core')->con->prepare( + 'ALTER TABLE `' . $dbPool->get('core')->prefix . 'profile_account_setting` + ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'profile_account_setting_ibfk_1` FOREIGN KEY (`profile_account_setting_account`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);' + )->execute(); + break; + } + } +} diff --git a/Controller.php b/Controller.php new file mode 100644 index 0000000..8480281 --- /dev/null +++ b/Controller.php @@ -0,0 +1,128 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +namespace Modules\Profile; + +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; + +/** + * Profile class. + * + * @category Modules + * @package Modules\Profile + * @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 = 'Profile'; + + /** + * 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/profile/list.*$' => [['dest' => '\Modules\Profile\Controller:viewProfileList', '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 viewProfileList(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface + { + $view = new View($this->app, $request, $response); + $view->setTemplate('/Modules/Profile/Theme/backend/profile-list'); + + 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/README.md b/README.md new file mode 100644 index 0000000..47e5a43 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# Profile # diff --git a/Theme/backend/img/profile-default-small.jpg b/Theme/backend/img/profile-default-small.jpg new file mode 100644 index 0000000..6f07f6d Binary files /dev/null and b/Theme/backend/img/profile-default-small.jpg differ diff --git a/Theme/backend/profile-list.tpl.php b/Theme/backend/profile-list.tpl.php new file mode 100644 index 0000000..94478bd --- /dev/null +++ b/Theme/backend/profile-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 + */ +/** + * @var \phpOMS\Views\View $this + */ + +$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); +?> +
+ + + + + + + + $value) : $count++; ?> + + +
l11n->lang['Profile']['Profiles']; ?>
l11n->lang[0]['ID']; ?> + l11n->lang['Profile']['Name']; ?> + l11n->lang['Profile']['Activity']; ?> +
render(); ?> +
l11n->lang[0]['Empty']; ?> + +
+
diff --git a/Theme/backend/profile-single.tpl.php b/Theme/backend/profile-single.tpl.php new file mode 100644 index 0000000..83b99f2 --- /dev/null +++ b/Theme/backend/profile-single.tpl.php @@ -0,0 +1,102 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +/** + * @var \phpOMS\Views\View $this + */ +$nav = new \Modules\Navigation\Views\NavigationView($this->app, $this->request, $this->response); +$nav->setTemplate('/Modules/Navigation/Theme/backend/mid'); +$nav->setNav($this->getData('nav')); +$nav->setLanguage($this->l11n->language); +$nav->setParent(1000301001); + +$sidenav = new \Modules\Navigation\Views\NavigationView($this->app, $this->request, $this->response); +$sidenav->setTemplate('/Modules/Navigation/Theme/backend/mid-side'); +$sidenav->setNav($this->getData('nav')); +$sidenav->setLanguage($this->l11n->language); +$sidenav->setParent(1000301001); +?> +render(); ?> +
+
+
+
+ +
+
+ render(); ?> +
+
+
+

+ l11n->lang['Profile']['Profile']; ?> + + +

+ +
+ + + + + + + + + + + + + + + + + +
l11n->lang['Profile']['Name']; ?> + Duck, Donald +
l11n->lang['Profile']['Occupation']; ?> + Sailor +
l11n->lang['Profile']['Birthday']; ?> + 06.09.1934 +
l11n->lang['Profile']['Ranks']; ?> + Gosling +
l11n->lang['Profile']['Email']; ?> + donald.duck[at]email.com +
Address + +
Private + SMALLSYS INC
795 E DRAGRAM
TUCSON AZ 85705
USA +
Work + SMALLSYS INC
795 E DRAGRAM
TUCSON AZ 85705
USA +
l11n->lang['Profile']['Phone']; ?> + +
Private + +01 12345-4567 +
Mobile + +01 12345-4567 +
Work + +01 12345-4567 +
l11n->lang['Profile']['Registered']; ?> + 09.06.1934 +
l11n->lang['Profile']['LastLogin']; ?> + 01.04.2015 +
l11n->lang['Profile']['Status']; ?> + Active +
+ +
+
+
+
diff --git a/Theme/lang/api.en.lang.php b/Theme/lang/api.en.lang.php new file mode 100644 index 0000000..d53f90f --- /dev/null +++ b/Theme/lang/api.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[1] = [ + 'i:ModuleInstalled' => 'Installation of the module {$1} was successful.', +]; diff --git a/Theme/lang/backend.en.lang.php b/Theme/lang/backend.en.lang.php new file mode 100644 index 0000000..3359ace --- /dev/null +++ b/Theme/lang/backend.en.lang.php @@ -0,0 +1,34 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +$MODLANG['Profile'] = [ + 'Activity' => 'Activity', + 'Birthday' => 'Birthday', + 'ContactInformation' => 'Contact Information', + 'Community' => 'Community', + 'Email' => 'Email', + 'LastLogin' => 'Last Login', + 'Name' => 'Name', + 'Occupation' => 'Occupation', + 'OFF' => 'OFF', + 'ON' => 'ON', + 'Phone' => 'Phone', + 'Profile' => 'Profile', + 'Profiles' => 'Profiles', + 'Ranks' => 'Ranks', + 'Registered' => 'Registered', + 'Skype' => 'Skype', + 'Status' => 'Status', +]; diff --git a/Theme/lang/nav.backend.en.lang.php b/Theme/lang/nav.backend.en.lang.php new file mode 100644 index 0000000..673a051 --- /dev/null +++ b/Theme/lang/nav.backend.en.lang.php @@ -0,0 +1,20 @@ + + * @author Dennis Eichhorn + * @copyright 2013 Dennis Eichhorn + * @license OMS License 1.0 + * @version 1.0.0 + * @link http://orange-management.com + */ +$MODLANG['Navigation'] = [ + 'List' => 'List', + 'Profile' => 'Profile', + 'Profiles' => 'Profiles', +]; 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..17b50f9 --- /dev/null +++ b/info.json @@ -0,0 +1,51 @@ +{ + "name": { + "id": 1000300000, + "internal": "Profile", + "external": "OMS Profile" + }, + "version": "1.0.0", + "requirements": { + "phpOMS": "1.0.0", + "phpOMS-db": "1.0.0" + }, + "creator": { + "name": "Orange Management", + "website": "www.spl1nes.com" + }, + "description": "The profile module.", + "directory": "Profile", + "dependencies": {}, + "providing": { + "Navigation": "*" + }, + "load": [ + { + "pid": [ + "88a70f9456abff33fda791878b9c0bcbe2cb5bc4" + ], + "type": 4, + "for": "Content", + "file": "Profile", + "from": "Profile" + }, + { + "pid": [ + "88a70f9456abff33fda791878b9c0bcbe2cb5bc4" + ], + "type": 5, + "for": "Content", + "file": "backend", + "from": "Profile" + }, + { + "pid": [ + "754a08ddf8bcb1cf22f310f09206dd783d42f7dd" + ], + "type": 5, + "from": "Profile", + "for": "Navigation", + "file": "nav.backend" + } + ] +}