This commit is contained in:
Dennis Eichhorn 2015-11-29 21:57:18 +01:00
commit e476151784
13 changed files with 631 additions and 0 deletions

View File

@ -0,0 +1,38 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @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 <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @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);
}
}

View File

@ -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": []
}
]
}
]

133
Admin/Installer.php Normal file
View File

@ -0,0 +1,133 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @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 <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @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;
}
}
}

128
Controller.php Normal file
View File

@ -0,0 +1,128 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @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 <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @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 <d.eichhorn@oms.com>
*/
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 <d.eichhorn@oms.com>
*/
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;
}
}

1
README.md Normal file
View File

@ -0,0 +1 @@
# Profile #

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

View File

@ -0,0 +1,43 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @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);
?>
<section class="box">
<table class="table">
<caption><?= $this->l11n->lang['Profile']['Profiles']; ?></caption>
<thead>
<tr>
<td><?= $this->l11n->lang[0]['ID']; ?>
<td class="wf-100"><?= $this->l11n->lang['Profile']['Name']; ?>
<td><?= $this->l11n->lang['Profile']['Activity']; ?>
<tfoot>
<tr>
<td colspan="3"><?= $footerView->render(); ?>
<tbody>
<?php $count = 0; foreach([] as $key => $value) : $count++; ?>
<?php endforeach; ?>
<?php if($count === 0) : ?>
<tr><td colspan="3" class="empty"><?= $this->l11n->lang[0]['Empty']; ?>
<?php endif; ?>
</table>
</section>

View File

@ -0,0 +1,102 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @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);
?>
<?= $nav->render(); ?>
<div itemscope itemtype="http://schema.org/Person">
<div class="b-7" id="i3-2-1">
<div class="b-5" id="i3-2-4">
<div class="bc-1">
<img src="/Modules/Profile/Theme/backend/img/profile-default-small.jpg" itemprop="image">
</div>
</div>
<?= $sidenav->render(); ?>
</div>
<div class="b-6" id="i3-2-2">
<div class="b b-2 c3-2 c3" id="i3-2-3">
<h1>
<?= $this->l11n->lang['Profile']['Profile']; ?>
<i class="fa fa-minus min"></i>
<i class="fa fa-plus max vh"></i>
</h1>
<div class="bc-1">
<!-- @formatter:off -->
<table class="tc-1">
<tr>
<th><?= $this->l11n->lang['Profile']['Name']; ?>
<td><span itemprop="familyName">Duck</span>, <span itemprop="givenName">Donald</span>
<tr>
<th><?= $this->l11n->lang['Profile']['Occupation']; ?>
<td itemprop="jobTitle">Sailor
<tr>
<th><?= $this->l11n->lang['Profile']['Birthday']; ?>
<td itemprop="birthDate">06.09.1934
<tr>
<th><?= $this->l11n->lang['Profile']['Ranks']; ?>
<td itemprop="memberOf">Gosling
<tr>
<th><?= $this->l11n->lang['Profile']['Email']; ?>
<td itemprop="email"><a href="mailto:>donald.duck@email.com<">donald.duck[at]email.com</a>
<tr>
<th>Address
<td>
<tr>
<th class="vT">Private
<td itemprop="address">SMALLSYS INC<br>795 E DRAGRAM<br>TUCSON AZ 85705<br>USA
<tr>
<th class="vT">Work
<td itemprop="address">SMALLSYS INC<br>795 E DRAGRAM<br>TUCSON AZ 85705<br>USA
<tr>
<th><?= $this->l11n->lang['Profile']['Phone']; ?>
<td>
<tr>
<th>Private
<td itemprop="telephone">+01 12345-4567
<tr>
<th>Mobile
<td itemprop="telephone">+01 12345-4567
<tr>
<th>Work
<td itemprop="telephone">+01 12345-4567
<tr>
<th><?= $this->l11n->lang['Profile']['Registered']; ?>
<td>09.06.1934
<tr>
<th><?= $this->l11n->lang['Profile']['LastLogin']; ?>
<td>01.04.2015
<tr>
<th><?= $this->l11n->lang['Profile']['Status']; ?>
<td><span class="green">Active</span>
</table>
<!-- @formatter:on -->
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,18 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @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.',
];

View File

@ -0,0 +1,34 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @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',
];

View File

@ -0,0 +1,20 @@
<?php
/**
* Orange Management
*
* PHP Version 7.0
*
* @category TBD
* @package TBD
* @author OMS Development Team <dev@oms.com>
* @author Dennis Eichhorn <d.eichhorn@oms.com>
* @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',
];

BIN
img/module_teaser_small.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

51
info.json Normal file
View File

@ -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"
}
]
}