diff --git a/Admin/Installer.php b/Admin/Installer.php index c4ff20d..18efaae 100644 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -46,16 +46,19 @@ class Installer extends InstallerAbstract `profile_account_image` int(11) DEFAULT NULL, `profile_account_birthday` datetime DEFAULT NULL, `profile_account_account` int(11) NOT NULL, + `profile_account_calendar` int(11) NOT NULL, PRIMARY KEY (`profile_account_id`), KEY `profile_account_image` (`profile_account_image`), - KEY `profile_account_account` (`profile_account_account`) + KEY `profile_account_account` (`profile_account_account`), + KEY `profile_account_calendar` (`profile_account_calendar`) )ENGINE=InnoDB DEFAULT CHARSET=utf8;' )->execute(); $dbPool->get()->con->prepare( 'ALTER TABLE `' . $dbPool->get()->prefix . 'profile_account` ADD CONSTRAINT `' . $dbPool->get()->prefix . 'profile_account_ibfk_1` FOREIGN KEY (`profile_account_image`) REFERENCES `' . $dbPool->get()->prefix . 'media` (`media_id`), - ADD CONSTRAINT `' . $dbPool->get()->prefix . 'profile_account_ibfk_2` FOREIGN KEY (`profile_account_account`) REFERENCES `' . $dbPool->get()->prefix . 'account` (`account_id`);' + ADD CONSTRAINT `' . $dbPool->get()->prefix . 'profile_account_ibfk_2` FOREIGN KEY (`profile_account_account`) REFERENCES `' . $dbPool->get()->prefix . 'account` (`account_id`), + ADD CONSTRAINT `' . $dbPool->get()->prefix . 'profile_account_ibfk_3` FOREIGN KEY (`profile_account_calendar`) REFERENCES `' . $dbPool->get()->prefix . 'calendar` (`calendar_id`);' )->execute(); // real contacts that you also save in your email contact list. this is to store other accounts diff --git a/Controller.php b/Controller.php index 5b29215..abca572 100644 --- a/Controller.php +++ b/Controller.php @@ -121,10 +121,22 @@ class Controller extends ModuleAbstract implements WebInterface */ public function viewProfileSingle(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable { + /** @var Head $head */ + $head = $response->get('Content')->getData('head'); + $head->addAsset(AssetType::CSS, $request->getUri()->getBase() . 'Modules/Calendar/Theme/Backend/css/styles.css'); + $view = new View($this->app, $request, $response); $view->setTemplate('/Modules/Profile/Theme/Backend/profile-single'); $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000301001, $request, $response)); + $mediaListView = new \Modules\Media\Theme\Backend\Components\Media\BaseView($this->app, $request, $response); + $mediaListView->setTemplate('/Modules/Media/Theme/Backend/Components/Media/list'); + $view->addData('medialist', $mediaListView); + + $calendarView = new \Modules\Calendar\Theme\Backend\Components\Calendar\BaseView($this->app, $request, $response); + $calendarView->setTemplate('/Modules/Calendar/Theme/Backend/Components/Calendar/mini'); + $view->addData('calendar', $calendarView); + $view->setData('account', ProfileMapper::getFor($request->getData('id'), 'account')); return $view; diff --git a/Models/Profile.php b/Models/Profile.php index dd50d31..1b02ac2 100644 --- a/Models/Profile.php +++ b/Models/Profile.php @@ -18,6 +18,7 @@ use Modules\Admin\Models\Account; use Modules\Admin\Models\NullAccount; use Modules\Media\Models\Media; use Modules\Media\Models\NullMedia; +use Modules\Calendar\Models\Calendar; /** * Account class. @@ -40,11 +41,14 @@ class Profile private $location = []; + private $calendar = null; + public function __construct() { $this->image = new NullMedia(); $this->birthday = new \DateTime('now'); $this->account = new Account(); + $this->calendar = new Calendar(); } public function getId() : int @@ -62,6 +66,11 @@ class Profile $this->location[] = $location; } + public function getCalendar() + { + return $this->calendar; + } + public function getImage() : Media { return $this->image; diff --git a/Models/ProfileMapper.php b/Models/ProfileMapper.php index 5e3ff48..948d1e5 100644 --- a/Models/ProfileMapper.php +++ b/Models/ProfileMapper.php @@ -21,6 +21,7 @@ use phpOMS\DataStorage\Database\Query\Column; use phpOMS\DataStorage\Database\RelationType; use Modules\Admin\Models\Account; use Modules\Admin\Models\AccountMapper; +use Modules\Calendar\Models\CalendarMapper; class ProfileMapper extends DataMapperAbstract { @@ -35,6 +36,7 @@ class ProfileMapper extends DataMapperAbstract 'profile_account_image' => ['name' => 'profile_account_image', 'type' => 'int', 'internal' => 'image'], 'profile_account_birthday' => ['name' => 'profile_account_birthday', 'type' => 'DateTime', 'internal' => 'birthday'], 'profile_account_account' => ['name' => 'profile_account_account', 'type' => 'int', 'internal' => 'account'], + 'profile_account_calendar' => ['name' => 'profile_account_calendar', 'type' => 'int', 'internal' => 'calendar'], ]; /** @@ -52,6 +54,10 @@ class ProfileMapper extends DataMapperAbstract 'mapper' => MediaMapper::class, 'src' => 'profile_account_image', ], + 'calendar' => [ + 'mapper' => CalendarMapper::class, + 'src' => 'profile_account_calendar', + ], ]; /** diff --git a/Theme/Backend/profile-single.tpl.php b/Theme/Backend/profile-single.tpl.php index ddcfe98..24b8106 100644 --- a/Theme/Backend/profile-single.tpl.php +++ b/Theme/Backend/profile-single.tpl.php @@ -84,30 +84,12 @@ echo $this->getData('nav')->render();
-
- - - - - - - $value) : $c++; - $url = \phpOMS\Uri\UriFactory::build('{/base}/{/lang}/backend/admin/group/settings?{?}&id=' . $value->getId()); ?> - -
getHtml('Media', 'Media') ?>
getHtml('ID', 0, 0); ?> - getHtml('Name', 'Media') ?> - getHtml('Type', 'Media') ?> - getHtml('Created', 'Media') ?> -
render(); ?> -
printHtml($value->getId()); ?> - printHtml($value->getNewestHistory()->getPosition()); ?> - printHtml($value->getNewestHistory()->getPosition()); ?> - printHtml($value->getNewestStatus()->getStatus()); ?> - - -
getHtml('Empty', 0, 0); ?> - -
-
+ getData('medialist')->render([]); ?>
+ +
+
+ getData('calendar')->render($account->getCalendar()); ?> +
+
\ No newline at end of file diff --git a/info.json b/info.json index 58281a0..cfc4984 100644 --- a/info.json +++ b/info.json @@ -18,6 +18,7 @@ "directory": "Profile", "dependencies": { "Admin" : "1.0.0", + "Calendar" : "1.0.0", "Media" : "1.0.0" }, "providing": {