mirror of
https://github.com/Karaka-Management/oms-Profile.git
synced 2026-01-11 15:28:40 +00:00
Fix #7
This commit is contained in:
parent
0416ba3391
commit
18ca02a49d
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -84,30 +84,12 @@ echo $this->getData('nav')->render();
|
|||
</div>
|
||||
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<div class="box wf-100">
|
||||
<table class="table red">
|
||||
<caption><?= $this->getHtml('Media', 'Media') ?></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $this->getHtml('ID', 0, 0); ?>
|
||||
<td class="wf-100"><?= $this->getHtml('Name', 'Media') ?>
|
||||
<td><?= $this->getHtml('Type', 'Media') ?>
|
||||
<td><?= $this->getHtml('Created', 'Media') ?>
|
||||
<tfoot>
|
||||
<tr><td colspan="4"><?= $footerView->render(); ?>
|
||||
<tbody>
|
||||
<?php $c = 0; foreach ([] as $key => $value) : $c++;
|
||||
$url = \phpOMS\Uri\UriFactory::build('{/base}/{/lang}/backend/admin/group/settings?{?}&id=' . $value->getId()); ?>
|
||||
<tr>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getId()); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getNewestHistory()->getPosition()); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getNewestHistory()->getPosition()); ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getNewestStatus()->getStatus()); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php if($c === 0) : ?>
|
||||
<tr><td colspan="4" class="empty"><?= $this->getHtml('Empty', 0, 0); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
<?= $this->getData('medialist')->render([]); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<?= $this->getData('calendar')->render($account->getCalendar()); ?>
|
||||
</div>
|
||||
</div>
|
||||
Loading…
Reference in New Issue
Block a user