mirror of
https://github.com/Karaka-Management/oms-Calendar.git
synced 2026-02-15 16:08:41 +00:00
Bulkl path fix
This commit is contained in:
parent
f4b38df23c
commit
2a7af88cef
|
|
@ -1,44 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar\Admin;
|
|
||||||
|
|
||||||
|
|
||||||
use phpOMS\DataStorage\Database\DatabasePool;
|
|
||||||
use phpOMS\Module\ActivateAbstract;
|
|
||||||
use phpOMS\Module\InfoManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 Activate extends ActivateAbstract
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public static function activate(DatabasePool $dbPool, InfoManager $info)
|
|
||||||
{
|
|
||||||
parent::activate($dbPool, $info);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar\Admin;
|
|
||||||
|
|
||||||
|
|
||||||
use phpOMS\DataStorage\Database\DatabasePool;
|
|
||||||
use phpOMS\Module\DeactivateAbstract;
|
|
||||||
use phpOMS\Module\InfoManager;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 Deactivate extends DeactivateAbstract
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public static function deactivate(DatabasePool $dbPool, InfoManager $info)
|
|
||||||
{
|
|
||||||
parent::deactivate($dbPool, $info);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
[
|
|
||||||
{
|
|
||||||
"id": 1000901001,
|
|
||||||
"pid": "754a08ddf8bcb1cf22f310f09206dd783d42f7dd",
|
|
||||||
"type": 1,
|
|
||||||
"subtype": 1,
|
|
||||||
"name": "Calendar",
|
|
||||||
"uri": "/{/lang}/backend/calendar/dashboard?{?}",
|
|
||||||
"target": "self",
|
|
||||||
"icon": "fa fa-calendar",
|
|
||||||
"order": 10,
|
|
||||||
"from": "Calendar",
|
|
||||||
"permission": null,
|
|
||||||
"parent": 1000201001,
|
|
||||||
"children": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id": 1000901002,
|
|
||||||
"pid": "754a08ddf8bcb1cf22f310f09206dd783d42f7dd",
|
|
||||||
"type": 2,
|
|
||||||
"subtype": 1,
|
|
||||||
"name": "Calendar",
|
|
||||||
"uri": "/{/lang}/backend/calendar/dashboard?{?}",
|
|
||||||
"target": "self",
|
|
||||||
"icon": null,
|
|
||||||
"order": 30,
|
|
||||||
"from": "Calendar",
|
|
||||||
"permission": null,
|
|
||||||
"parent": 1000201001,
|
|
||||||
"children": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar\Admin\Install;
|
|
||||||
use phpOMS\DataStorage\Database\DatabasePool;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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(string $path, DatabasePool $dbPool)
|
|
||||||
{
|
|
||||||
$navData = json_decode(file_get_contents(__DIR__ . '/Navigation.install.json'), true);
|
|
||||||
|
|
||||||
$class = '\\Modules\\Navigation\\Admin\\Installer';
|
|
||||||
/** @var $class \Modules\Navigation\Admin\Installer */
|
|
||||||
$class::installExternal($dbPool, $navData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,152 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar\Admin;
|
|
||||||
|
|
||||||
use phpOMS\DataStorage\Database\DatabaseType;
|
|
||||||
use phpOMS\DataStorage\Database\DatabasePool;
|
|
||||||
use phpOMS\Module\InfoManager;
|
|
||||||
use phpOMS\Module\InstallerAbstract;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calendar install class.
|
|
||||||
*
|
|
||||||
* @category Modules
|
|
||||||
* @package Modules\Calendar
|
|
||||||
* @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(string $path, DatabasePool $dbPool, InfoManager $info)
|
|
||||||
{
|
|
||||||
parent::install($path, $dbPool, $info);
|
|
||||||
|
|
||||||
switch ($dbPool->get('core')->getType()) {
|
|
||||||
case DatabaseType::MYSQL:
|
|
||||||
$dbPool->get('core')->con->prepare(
|
|
||||||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'calendar` (
|
|
||||||
`calendar_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`calendar_name` varchar(25) NOT NULL,
|
|
||||||
`calendar_password` varchar(64) DEFAULT NULL,
|
|
||||||
`calendar_description` varchar(255) NOT NULL,
|
|
||||||
`calendar_created_by` int(11) NOT NULL,
|
|
||||||
`calendar_created_at` datetime NOT NULL,
|
|
||||||
PRIMARY KEY (`calendar_id`),
|
|
||||||
KEY `calendar_created_by` (`calendar_created_by`)
|
|
||||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
|
||||||
)->execute();
|
|
||||||
|
|
||||||
$dbPool->get('core')->con->prepare(
|
|
||||||
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'calendar`
|
|
||||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'calendar_ibfk_1` FOREIGN KEY (`calendar_created_by`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);'
|
|
||||||
)->execute();
|
|
||||||
|
|
||||||
$dbPool->get('core')->con->prepare(
|
|
||||||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'calendar_permission` (
|
|
||||||
`calendar_permission_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`calendar_permission_type` tinyint(1) NOT NULL,
|
|
||||||
`calendar_permission_ref` int(11) NOT NULL,
|
|
||||||
`calendar_permission_calendar` int(11) NOT NULL,
|
|
||||||
`calendar_permission_permission` tinyint(2) NOT NULL,
|
|
||||||
PRIMARY KEY (`calendar_permission_id`),
|
|
||||||
KEY `calendar_permission_calendar` (`calendar_permission_calendar`)
|
|
||||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
|
||||||
)->execute();
|
|
||||||
|
|
||||||
$dbPool->get('core')->con->prepare(
|
|
||||||
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'calendar_permission`
|
|
||||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'calendar_permission_ibfk_1` FOREIGN KEY (`calendar_permission_calendar`) REFERENCES `' . $dbPool->get('core')->prefix . 'calendar` (`calendar_id`);'
|
|
||||||
)->execute();
|
|
||||||
|
|
||||||
$dbPool->get('core')->con->prepare(
|
|
||||||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'schedule` (
|
|
||||||
`schedule_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`schedule_uid` varchar(255) NOT NULL,
|
|
||||||
`schedule_status` tinyint(1) NOT NULL,
|
|
||||||
`schedule_freq_type` tinyint(1) NOT NULL,
|
|
||||||
`schedule_freq_interval` smallint(4) NOT NULL,
|
|
||||||
`schedule_freq_interval_type` tinyint(1) NOT NULL,
|
|
||||||
`schedule_freq_relative_interval` tinyint(3) NOT NULL,
|
|
||||||
`schedule_freq_recurrence_factor` int(11) NOT NULL,
|
|
||||||
`schedule_start` datetime NOT NULL,
|
|
||||||
`schedule_duration` int(11) NOT NULL,
|
|
||||||
`schedule_end` datetime DEFAULT NULL,
|
|
||||||
`schedule_created_at` datetime NOT NULL,
|
|
||||||
`schedule_created_by` int(11) NOT NULL,
|
|
||||||
PRIMARY KEY (`schedule_id`),
|
|
||||||
KEY `schedule_created_by` (`schedule_created_by`)
|
|
||||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
|
||||||
)->execute();
|
|
||||||
|
|
||||||
$dbPool->get('core')->con->prepare(
|
|
||||||
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'schedule`
|
|
||||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'schedule_ibfk_1` FOREIGN KEY (`schedule_created_by`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);'
|
|
||||||
)->execute();
|
|
||||||
|
|
||||||
$dbPool->get('core')->con->prepare(
|
|
||||||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'calendar_event` (
|
|
||||||
`calendar_event_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`calendar_event_name` varchar(25) NOT NULL,
|
|
||||||
`calendar_event_description` varchar(255) NOT NULL,
|
|
||||||
`calendar_event_status` tinyint(1) NOT NULL,
|
|
||||||
`calendar_event_type` tinyint(1) NOT NULL,
|
|
||||||
`calendar_event_location` varchar(511) NOT NULL,
|
|
||||||
`calendar_event_created_by` int(11) NOT NULL,
|
|
||||||
`calendar_event_created_at` datetime NOT NULL,
|
|
||||||
`calendar_event_schedule` int(11) NOT NULL,
|
|
||||||
`calendar_event_calendar` int(11) DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`calendar_event_id`),
|
|
||||||
KEY `calendar_event_created_by` (`calendar_event_created_by`),
|
|
||||||
KEY `calendar_event_schedule` (`calendar_event_schedule`),
|
|
||||||
KEY `calendar_event_calendar` (`calendar_event_calendar`)
|
|
||||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
|
||||||
)->execute();
|
|
||||||
|
|
||||||
$dbPool->get('core')->con->prepare(
|
|
||||||
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'calendar_event`
|
|
||||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'calendar_event_ibfk_1` FOREIGN KEY (`calendar_event_created_by`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`),
|
|
||||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'calendar_event_ibfk_2` FOREIGN KEY (`calendar_event_schedule`) REFERENCES `' . $dbPool->get('core')->prefix . 'schedule` (`schedule_id`),
|
|
||||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'calendar_event_ibfk_3` FOREIGN KEY (`calendar_event_calendar`) REFERENCES `' . $dbPool->get('core')->prefix . 'calendar` (`calendar_id`);'
|
|
||||||
)->execute();
|
|
||||||
|
|
||||||
$dbPool->get('core')->con->prepare(
|
|
||||||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'calendar_event_participant` (
|
|
||||||
`calendar_event_participant_id` int(11) NOT NULL AUTO_INCREMENT,
|
|
||||||
`calendar_event_participant_event` int(11) NOT NULL,
|
|
||||||
`calendar_event_participant_person` int(11) NOT NULL,
|
|
||||||
`calendar_event_participant_status` tinyint(1) NOT NULL,
|
|
||||||
PRIMARY KEY (`calendar_event_participant_id`),
|
|
||||||
KEY `calendar_event_participant_event` (`calendar_event_participant_event`),
|
|
||||||
KEY `calendar_event_participant_person` (`calendar_event_participant_person`)
|
|
||||||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
|
||||||
)->execute();
|
|
||||||
|
|
||||||
$dbPool->get('core')->con->prepare(
|
|
||||||
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'calendar_event_participant`
|
|
||||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'calendar_event_participant_ibfk_1` FOREIGN KEY (`calendar_event_participant_event`) REFERENCES `' . $dbPool->get('core')->prefix . 'calendar_event` (`calendar_event_id`),
|
|
||||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'calendar_event_participant_ibfk_2` FOREIGN KEY (`calendar_event_participant_person`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);'
|
|
||||||
)->execute();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
use phpOMS\Router\RouteVerb;
|
|
||||||
|
|
||||||
return [
|
|
||||||
'^.*/backend/calendar/dashboard.*$' => [
|
|
||||||
[
|
|
||||||
'dest' => '\Modules\Calendar\Controller:viewCalendarDashboard',
|
|
||||||
'verb' => RouteVerb::GET,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
$moduleRoutes = [];
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
$moduleRoutes = [];
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar\Admin;
|
|
||||||
|
|
||||||
|
|
||||||
use phpOMS\DataStorage\Database\DatabasePool;
|
|
||||||
use phpOMS\DataStorage\Database\Schema\Builder;
|
|
||||||
use phpOMS\Module\UninstallAbstract;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 Uninstall extends UninstallAbstract
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public static function uninstall(DatabasePool $dbPool, InfoManager $info)
|
|
||||||
{
|
|
||||||
parent::uninstall($dbPool, $info);
|
|
||||||
|
|
||||||
$query = new Builder($dbPool->get());
|
|
||||||
|
|
||||||
$query->prefix($dbPool->get('core')->getPrefix())->drop(
|
|
||||||
'calendar_event_participant',
|
|
||||||
'calendar_event',
|
|
||||||
'schedule',
|
|
||||||
'calendar_permission',
|
|
||||||
'calendar'
|
|
||||||
);
|
|
||||||
|
|
||||||
$dbPool->get()->con->prepare($query->toSql())->execute();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar\Admin;
|
|
||||||
|
|
||||||
|
|
||||||
use phpOMS\DataStorage\Database\DatabasePool;
|
|
||||||
use phpOMS\Module\UpdateAbstract;
|
|
||||||
use phpOMS\System\File\Directory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 Update extends UpdateAbstract
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public static function update(DatabasePool $dbPool, array $info)
|
|
||||||
{
|
|
||||||
Directory::deletePath(__DIR__ . '/Update');
|
|
||||||
mkdir('Update');
|
|
||||||
parent::update($dbPool, $info);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
108
Controller.php
108
Controller.php
|
|
@ -1,108 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar;
|
|
||||||
|
|
||||||
use Modules\Calendar\Models\CalendarMapper;
|
|
||||||
use Modules\Navigation\Models\Navigation;
|
|
||||||
use Modules\Navigation\Views\NavigationView;
|
|
||||||
use phpOMS\Contract\RenderableInterface;
|
|
||||||
use phpOMS\Datatypes\SmartDateTime;
|
|
||||||
use phpOMS\Message\RequestAbstract;
|
|
||||||
use phpOMS\Message\ResponseAbstract;
|
|
||||||
use phpOMS\Module\ModuleAbstract;
|
|
||||||
use phpOMS\Module\WebInterface;
|
|
||||||
use phpOMS\Views\View;
|
|
||||||
use phpOMS\Views\ViewLayout;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calendar controller class.
|
|
||||||
*
|
|
||||||
* @category Modules
|
|
||||||
* @package Modules\Calendar
|
|
||||||
* @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 path.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
/* public */ const MODULE_PATH = __DIR__;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module version.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
/* public */ const MODULE_VERSION = '1.0.0';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Module name.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
/* public */ const MODULE_NAME = 'Calendar';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Providing.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
protected static $providing = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dependencies.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
protected static $dependencies = [
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param RequestAbstract $request Request
|
|
||||||
* @param ResponseAbstract $response Response
|
|
||||||
* @param mixed $data Generic data
|
|
||||||
*
|
|
||||||
* @return \Serializable
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function viewCalendarDashboard(RequestAbstract $request, ResponseAbstract $response, $data = null) : \Serializable
|
|
||||||
{
|
|
||||||
$view = new View($this->app, $request, $response);
|
|
||||||
$view->setTemplate('/Modules/Calendar/Theme/Backend/calendar-dashboard');
|
|
||||||
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1001201001, $request, $response));
|
|
||||||
|
|
||||||
$calendar = CalendarMapper::get(1);
|
|
||||||
$calendar->setDate(new SmartDateTime($request->getData('date') ?? 'now'));
|
|
||||||
$view->addData('calendar', $calendar);
|
|
||||||
|
|
||||||
return $view;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar\Models;
|
|
||||||
|
|
||||||
use phpOMS\Datatypes\Enum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Accept status enum.
|
|
||||||
*
|
|
||||||
* @category Calendar
|
|
||||||
* @package Modules
|
|
||||||
* @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
|
|
||||||
*/
|
|
||||||
abstract class AcceptStatus extends Enum
|
|
||||||
{
|
|
||||||
/* public */ const ACCEPTED = 0;
|
|
||||||
|
|
||||||
/* public */ const DENIED = 1;
|
|
||||||
}
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar\Models;
|
|
||||||
|
|
||||||
use phpOMS\Datatypes\Enum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Available status enum.
|
|
||||||
*
|
|
||||||
* @category Calendar
|
|
||||||
* @package Modules
|
|
||||||
* @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
|
|
||||||
*/
|
|
||||||
abstract class AvailableStatus extends Enum
|
|
||||||
{
|
|
||||||
/* public */ const AVAILABLE = 0;
|
|
||||||
|
|
||||||
/* public */ const BUSY = 1;
|
|
||||||
|
|
||||||
/* public */ const AWAY = 2;
|
|
||||||
}
|
|
||||||
|
|
@ -1,340 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar\Models;
|
|
||||||
|
|
||||||
use phpOMS\Datatypes\SmartDateTime;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calendar class.
|
|
||||||
*
|
|
||||||
* @category Calendar
|
|
||||||
* @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 Calendar
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calendar ID.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $id = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Name.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $name = '';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $description = '';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created at.
|
|
||||||
*
|
|
||||||
* @var \Datetime
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $createdAt = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $createdBy = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Current date of the calendar.
|
|
||||||
*
|
|
||||||
* @var SmartDateTime
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $date = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Password
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $password = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Events.
|
|
||||||
*
|
|
||||||
* @var \Modules\Calendar\Models\Event[]
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $events = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->createdAt = new \DateTime('now');
|
|
||||||
$this->date = new SmartDateTime('now');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getId() : int
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getName() : string
|
|
||||||
{
|
|
||||||
return $this->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $name Calendar name/title
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function setName(string $name)
|
|
||||||
{
|
|
||||||
$this->name = $name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getPassword()
|
|
||||||
{
|
|
||||||
return $this->password;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $password Calendar password/title
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function setPassword($password)
|
|
||||||
{
|
|
||||||
$this->password = $password;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getDescription() : string
|
|
||||||
{
|
|
||||||
return $this->description;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $desc Calendar description
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function setDescription(string $desc)
|
|
||||||
{
|
|
||||||
$this->description = $desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Event $event Calendar event
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function addEvent(Event $event) : int
|
|
||||||
{
|
|
||||||
$this->events[] = $event;
|
|
||||||
|
|
||||||
end($this->events);
|
|
||||||
$key = key($this->events);
|
|
||||||
reset($this->events);
|
|
||||||
|
|
||||||
return $key;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Event[]
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getEvents() : array
|
|
||||||
{
|
|
||||||
return $this->events;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $id Event id
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function removeEvent(int $id) : bool
|
|
||||||
{
|
|
||||||
if (isset($this->events[$id])) {
|
|
||||||
unset($this->events[$id]);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $id Event id
|
|
||||||
*
|
|
||||||
* @return Event
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getEvent(int $id) : Event
|
|
||||||
{
|
|
||||||
return $this->events[$id] ?? new NullEvent();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \DateTime
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getCreatedAt() : \DateTime
|
|
||||||
{
|
|
||||||
return $this->createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param \DateTime $createdAt Calendar created at
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function setCreatedAt(\DateTime $createdAt)
|
|
||||||
{
|
|
||||||
$this->createdAt = $createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getCreatedBy() : int
|
|
||||||
{
|
|
||||||
return $this->createdBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $createdBy Creator
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function setCreatedBy(int $createdBy)
|
|
||||||
{
|
|
||||||
$this->createdBy = $createdBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get current date
|
|
||||||
*
|
|
||||||
* @return \DateTime
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getDate() : \DateTime
|
|
||||||
{
|
|
||||||
return $this->date;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set current date
|
|
||||||
*
|
|
||||||
* @param \DateTime $date Current date
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function setDate(\DateTime $date)
|
|
||||||
{
|
|
||||||
$this->date = $date;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get event by date
|
|
||||||
*
|
|
||||||
* @param \DateTime $date Date of the event
|
|
||||||
*
|
|
||||||
* @return Event[]
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getEventByDate(\DateTime $date) : array
|
|
||||||
{
|
|
||||||
$events = [];
|
|
||||||
foreach ($this->events as $event) {
|
|
||||||
if ($event->getCreatedAt()->format('Y-m-d') === $date->format('Y-m-d')) {
|
|
||||||
$events[] = $event;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $events;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,156 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar\Models;
|
|
||||||
|
|
||||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
|
||||||
use phpOMS\DataStorage\Database\Query\Builder;
|
|
||||||
use phpOMS\DataStorage\Database\Query\Column;
|
|
||||||
use phpOMS\DataStorage\Database\RelationType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Mapper class.
|
|
||||||
*
|
|
||||||
* @category Calendar
|
|
||||||
* @package Modules
|
|
||||||
* @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 CalendarMapper extends DataMapperAbstract
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Class name.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
protected static $CLASS = __CLASS__;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Columns.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
protected static $columns = [
|
|
||||||
'calendar_id' => ['name' => 'calendar_id', 'type' => 'int', 'internal' => 'id'],
|
|
||||||
'calendar_name' => ['name' => 'calendar_name', 'type' => 'string', 'internal' => 'name'],
|
|
||||||
'calendar_password' => ['name' => 'calendar_password', 'type' => 'string', 'internal' => 'password'],
|
|
||||||
'calendar_description' => ['name' => 'calendar_description', 'type' => 'string', 'internal' => 'description'],
|
|
||||||
'calendar_created_by' => ['name' => 'calendar_created_by', 'type' => 'int', 'internal' => 'createdBy'],
|
|
||||||
'calendar_created_at' => ['name' => 'calendar_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'],
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Has many relation.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
protected static $hasMany = [
|
|
||||||
'events' => [
|
|
||||||
'mapper' => EventMapper::class,
|
|
||||||
'table' => 'calendar_event',
|
|
||||||
'dst' => 'calendar_event_calendar',
|
|
||||||
'src' => null,
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Primary table.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
protected static $table = 'calendar';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created at.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
protected static $createdAt = 'calendar_created_at';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Primary field name.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
protected static $primaryField = 'calendar_id';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create object.
|
|
||||||
*
|
|
||||||
* @param mixed $obj Object
|
|
||||||
* @param int $relations Behavior for relations creation
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public static function create($obj, int $relations = RelationType::ALL)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$objId = parent::create($obj, $relations);
|
|
||||||
$query = new Builder(self::$db);
|
|
||||||
$query->prefix(self::$db->getPrefix())
|
|
||||||
->insert(
|
|
||||||
'account_permission_account',
|
|
||||||
'account_permission_from',
|
|
||||||
'account_permission_for',
|
|
||||||
'account_permission_id1',
|
|
||||||
'account_permission_id2',
|
|
||||||
'account_permission_r',
|
|
||||||
'account_permission_w',
|
|
||||||
'account_permission_m',
|
|
||||||
'account_permission_d',
|
|
||||||
'account_permission_p'
|
|
||||||
)
|
|
||||||
->into('account_permission')
|
|
||||||
->values($obj->getCreatedBy(), 'calendar', 'calendar', 1, $objId, 1, 1, 1, 1, 1);
|
|
||||||
|
|
||||||
self::$db->con->prepare($query->toSql())->execute();
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $objId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find.
|
|
||||||
*
|
|
||||||
* @param array $columns Columns to select
|
|
||||||
*
|
|
||||||
* @return Builder
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public static function find(...$columns) : Builder
|
|
||||||
{
|
|
||||||
return parent::find(...$columns)->from('account_permission')
|
|
||||||
->where('account_permission.account_permission_for', '=', 'calendar')
|
|
||||||
->where('account_permission.account_permission_id1', '=', 1)
|
|
||||||
->where('calendar.calendar_id', '=', new Column('account_permission.account_permission_id2'))
|
|
||||||
->where('account_permission.account_permission_r', '=', 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
381
Models/Event.php
381
Models/Event.php
|
|
@ -1,381 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar\Models;
|
|
||||||
|
|
||||||
use phpOMS\Account\Account;
|
|
||||||
use phpOMS\Account\NullAccount;
|
|
||||||
use phpOMS\Datatypes\Location;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Event class.
|
|
||||||
*
|
|
||||||
* @category Calendar
|
|
||||||
* @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 Event
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calendar ID.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $id = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 $createdAt = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creator.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $createdBy = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Event type.
|
|
||||||
*
|
|
||||||
* Single event or a template (templates have a repeating)
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $type = EventType::SINGLE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Event status.
|
|
||||||
*
|
|
||||||
* Active, inactive etc.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $status = EventStatus::ACTIVE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Schedule
|
|
||||||
*
|
|
||||||
* @var Schedule
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $schedule = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Location of the event.
|
|
||||||
*
|
|
||||||
* @var Location
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $location = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calendar
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $calendar = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* People.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $people = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->createdAt = new \DateTime('now');
|
|
||||||
$this->location = new Location();
|
|
||||||
$this->schedule = new Schedule();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getId() : int
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getName() : string
|
|
||||||
{
|
|
||||||
return $this->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Account[]
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getPeople() : array
|
|
||||||
{
|
|
||||||
return $this->people;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $id Account id
|
|
||||||
*
|
|
||||||
* @return Account
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getPerson(int $id) : Account
|
|
||||||
{
|
|
||||||
return $this->people[$id] ?? new NullAccount();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Account $person Person to add
|
|
||||||
*
|
|
||||||
* @return int Account id/position
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function addPerson(Account $person)
|
|
||||||
{
|
|
||||||
$this->people[] = $person;
|
|
||||||
|
|
||||||
end($this->people);
|
|
||||||
$key = key($this->people);
|
|
||||||
reset($this->people);
|
|
||||||
|
|
||||||
return $key;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove Element from list.
|
|
||||||
*
|
|
||||||
* @param int $id Task element
|
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function removePerson(int $id) : bool
|
|
||||||
{
|
|
||||||
if (isset($this->people[$id])) {
|
|
||||||
unset($this->people[$id]);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $name Event name/title
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function setName(string $name)
|
|
||||||
{
|
|
||||||
$this->name = $name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getDescription() : string
|
|
||||||
{
|
|
||||||
return $this->description;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $desc Event description
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function setDescription(string $desc)
|
|
||||||
{
|
|
||||||
$this->description = $desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \DateTime
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getCreatedAt() : \DateTime
|
|
||||||
{
|
|
||||||
return $this->createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param \DateTime $createdAt Event created at
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function setCreatedAt(\DateTime $createdAt)
|
|
||||||
{
|
|
||||||
$this->createdAt = $createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getCreatedBy() : int
|
|
||||||
{
|
|
||||||
return $this->createdBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $createdBy Creator
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function setCreatedBy(int $createdBy)
|
|
||||||
{
|
|
||||||
$this->createdBy = $createdBy;
|
|
||||||
$this->schedule->setCreatedBy($this->createdBy);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Location $location Event location
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function setLocation(Location $location)
|
|
||||||
{
|
|
||||||
$this->location = $location;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Location
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getLocation() : Location
|
|
||||||
{
|
|
||||||
return $this->location;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getCalendar() : int
|
|
||||||
{
|
|
||||||
return $this->calendar;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getType() : int
|
|
||||||
{
|
|
||||||
return $this->type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getStatus() : int
|
|
||||||
{
|
|
||||||
return $this->status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $calendar Calendar
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function setCalendar(int $calendar)
|
|
||||||
{
|
|
||||||
$this->calendar = $calendar;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Schedule
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getSchedule() : Schedule
|
|
||||||
{
|
|
||||||
return $this->schedule;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,154 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar\Models;
|
|
||||||
|
|
||||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
|
||||||
use phpOMS\DataStorage\Database\Query\Builder;
|
|
||||||
use phpOMS\DataStorage\Database\Query\Column;
|
|
||||||
use phpOMS\DataStorage\Database\RelationType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Mapper class.
|
|
||||||
*
|
|
||||||
* @category Calendar
|
|
||||||
* @package Modules
|
|
||||||
* @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 EventMapper extends DataMapperAbstract
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Columns.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
protected static $columns = [
|
|
||||||
'calendar_event_id' => ['name' => 'calendar_event_id', 'type' => 'int', 'internal' => 'id'],
|
|
||||||
'calendar_event_name' => ['name' => 'calendar_event_name', 'type' => 'string', 'internal' => 'name'],
|
|
||||||
'calendar_event_description' => ['name' => 'calendar_event_description', 'type' => 'string', 'internal' => 'description'],
|
|
||||||
'calendar_event_location' => ['name' => 'calendar_event_location', 'type' => 'Serializable', 'internal' => 'location'],
|
|
||||||
'calendar_event_type' => ['name' => 'calendar_event_type', 'type' => 'int', 'internal' => 'type'],
|
|
||||||
'calendar_event_status' => ['name' => 'calendar_event_status', 'type' => 'int', 'internal' => 'status'],
|
|
||||||
'calendar_event_schedule' => ['name' => 'calendar_event_schedule', 'type' => 'int', 'internal' => 'schedule'],
|
|
||||||
'calendar_event_calendar' => ['name' => 'calendar_event_calendar', 'type' => 'int', 'internal' => 'calendar'],
|
|
||||||
'calendar_event_created_by' => ['name' => 'calendar_event_created_by', 'type' => 'int', 'internal' => 'createdBy'],
|
|
||||||
'calendar_event_created_at' => ['name' => 'calendar_event_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'],
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Has one relation.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
protected static $ownsOne = [
|
|
||||||
'schedule' => [
|
|
||||||
'mapper' => ScheduleMapper::class,
|
|
||||||
'src' => 'calendar_event_schedule',
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Primary table.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
protected static $table = 'calendar_event';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created at.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
protected static $createdAt = 'calendar_event_created_at';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Primary field name.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
protected static $primaryField = 'calendar_event_id';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create object.
|
|
||||||
*
|
|
||||||
* @param mixed $obj Object
|
|
||||||
* @param int $relations Behavior for relations creation
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public static function create($obj, int $relations = RelationType::ALL)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$objId = parent::create($obj, $relations);
|
|
||||||
$query = new Builder(self::$db);
|
|
||||||
|
|
||||||
$query->prefix(self::$db->getPrefix())
|
|
||||||
->insert(
|
|
||||||
'account_permission_account',
|
|
||||||
'account_permission_from',
|
|
||||||
'account_permission_for',
|
|
||||||
'account_permission_id1',
|
|
||||||
'account_permission_id2',
|
|
||||||
'account_permission_r',
|
|
||||||
'account_permission_w',
|
|
||||||
'account_permission_m',
|
|
||||||
'account_permission_d',
|
|
||||||
'account_permission_p'
|
|
||||||
)
|
|
||||||
->into('account_permission')
|
|
||||||
->values($obj->getCreatedBy(), 'calendar_event', 'calendar_event', 1, $objId, 1, 1, 1, 1, 1);
|
|
||||||
|
|
||||||
self::$db->con->prepare($query->toSql())->execute();
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
var_dump($e->getMessage());
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $objId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find.
|
|
||||||
*
|
|
||||||
* @param array $columns Columns to select
|
|
||||||
*
|
|
||||||
* @return Builder
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public static function find(...$columns) : Builder
|
|
||||||
{
|
|
||||||
return parent::find(...$columns)->from('account_permission')
|
|
||||||
->where('account_permission.account_permission_for', '=', 'calendar_event')
|
|
||||||
->where('account_permission.account_permission_id1', '=', 1)
|
|
||||||
->where('calendar_event.calendar_event_id', '=', new Column('account_permission.account_permission_id2'))
|
|
||||||
->where('account_permission.account_permission_r', '=', 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar\Models;
|
|
||||||
|
|
||||||
use phpOMS\Datatypes\Enum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Event type enum.
|
|
||||||
*
|
|
||||||
* @category Calendar
|
|
||||||
* @package Modules
|
|
||||||
* @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
|
|
||||||
*/
|
|
||||||
abstract class EventStatus extends Enum
|
|
||||||
{
|
|
||||||
/* public */ const ACTIVE = 1;
|
|
||||||
}
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar\Models;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Event template class.
|
|
||||||
*
|
|
||||||
* @category Calendar
|
|
||||||
* @package Modules
|
|
||||||
* @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 EventTemplate extends Event
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Type.
|
|
||||||
*
|
|
||||||
* @var EventType
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $type = EventType::TEMPLATE;
|
|
||||||
}
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar\Models;
|
|
||||||
|
|
||||||
use phpOMS\Datatypes\Enum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Event type enum.
|
|
||||||
*
|
|
||||||
* @category Calendar
|
|
||||||
* @package Modules
|
|
||||||
* @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
|
|
||||||
*/
|
|
||||||
abstract class EventType extends Enum
|
|
||||||
{
|
|
||||||
/* public */ const TEMPLATE = 1;
|
|
||||||
|
|
||||||
/* public */ const SINGLE = 2;
|
|
||||||
}
|
|
||||||
|
|
@ -1,43 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar\Models;
|
|
||||||
|
|
||||||
use phpOMS\Datatypes\Enum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Frequency interval type enum.
|
|
||||||
*
|
|
||||||
* @category Calendar
|
|
||||||
* @package Modules
|
|
||||||
* @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
|
|
||||||
*/
|
|
||||||
abstract class FrequencyInterval extends Enum
|
|
||||||
{
|
|
||||||
/* public */ const SUNDAY = 1;
|
|
||||||
/* public */ const MONDAY = 2;
|
|
||||||
/* public */ const TUESDAY = 4;
|
|
||||||
/* public */ const WEDNESDAY = 8;
|
|
||||||
/* public */ const THURSDAY = 16;
|
|
||||||
/* public */ const FRIDAY = 32;
|
|
||||||
/* public */ const SATURDAY = 64;
|
|
||||||
/* public */ const DAY = 128;
|
|
||||||
/* public */ const WEEKDAY = 256;
|
|
||||||
/* public */ const WEEKENDDAY = 512;
|
|
||||||
}
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar\Models;
|
|
||||||
|
|
||||||
use phpOMS\Datatypes\Enum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Frequency relative type enum.
|
|
||||||
*
|
|
||||||
* @category Calendar
|
|
||||||
* @package Modules
|
|
||||||
* @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
|
|
||||||
*/
|
|
||||||
abstract class FrequencyRelative extends Enum
|
|
||||||
{
|
|
||||||
/* public */ const FIRST = 1;
|
|
||||||
|
|
||||||
/* public */ const SECOND = 2;
|
|
||||||
|
|
||||||
/* public */ const THIRD = 4;
|
|
||||||
|
|
||||||
/* public */ const FOURTH = 8;
|
|
||||||
|
|
||||||
/* public */ const LAST = 64;
|
|
||||||
}
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar\Models;
|
|
||||||
|
|
||||||
use phpOMS\Datatypes\Enum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Frequency type enum.
|
|
||||||
*
|
|
||||||
* @category Calendar
|
|
||||||
* @package Modules
|
|
||||||
* @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
|
|
||||||
*/
|
|
||||||
abstract class FrequencyType extends Enum
|
|
||||||
{
|
|
||||||
/* public */ const ONCE = 1;
|
|
||||||
|
|
||||||
/* public */ const DAILY = 2;
|
|
||||||
|
|
||||||
/* public */ const WEEKLY = 4;
|
|
||||||
|
|
||||||
/* public */ const MONTHLY = 8;
|
|
||||||
|
|
||||||
/* public */ const YEARLY = 16;
|
|
||||||
}
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar\Models;
|
|
||||||
|
|
||||||
use phpOMS\Datatypes\Enum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interval type type enum.
|
|
||||||
*
|
|
||||||
* @category Calendar
|
|
||||||
* @package Modules
|
|
||||||
* @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
|
|
||||||
*/
|
|
||||||
abstract class IntervalType extends Enum
|
|
||||||
{
|
|
||||||
/* public */ const ABSOLUTE = 1;
|
|
||||||
|
|
||||||
/* public */ const RELATIVE = 2;
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar\Models;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calendar class.
|
|
||||||
*
|
|
||||||
* @category Calendar
|
|
||||||
* @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 NullCalendar extends Calendar
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar\Models;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Null event class.
|
|
||||||
*
|
|
||||||
* @category Calendar
|
|
||||||
* @package Modules
|
|
||||||
* @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 NullEvent extends Event
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,31 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @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\Calendar\Models;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Schedule class.
|
|
||||||
*
|
|
||||||
* @category Calendar
|
|
||||||
* @package Modules
|
|
||||||
* @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 NullSchedule extends Schedule
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
@ -1,445 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar\Models;
|
|
||||||
|
|
||||||
use phpOMS\Datatypes\Exception\InvalidEnumValue;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Schedule class.
|
|
||||||
*
|
|
||||||
* @category Calendar
|
|
||||||
* @package Modules
|
|
||||||
* @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 Schedule
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Schedule ID.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $id = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Calendar uid.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $uid = '';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Schedule status.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $status = ScheduleStatus::ACTIVE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Frequency type.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $freqType = FrequencyType::ONCE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Frequency interval.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $freqInterval = FrequencyInterval::DAY;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Frequency relative.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $relativeInternal = FrequencyRelative::FIRST;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Interval type.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $intervalType = IntervalType::ABSOLUTE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Recurrence factor.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $recurrenceFactor = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start.
|
|
||||||
*
|
|
||||||
* @var \DateTime
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $start = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Duration.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $duration = 3600;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* End.
|
|
||||||
*
|
|
||||||
* @var \DateTime
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $end = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created at.
|
|
||||||
*
|
|
||||||
* @var \DateTime
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $createdAt = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by.
|
|
||||||
*
|
|
||||||
* @var int
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
private $createdBy = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->createdAt = new \DateTime('now');
|
|
||||||
$this->start = new \DateTime('now');
|
|
||||||
$this->end = new \DateTime('now');
|
|
||||||
$this->end->setTimestamp($this->end->getTimestamp() + $this->duration);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getId() : int
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getStatus() : int
|
|
||||||
{
|
|
||||||
return $this->status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $status Schedule status
|
|
||||||
*
|
|
||||||
* @return $this
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function setStatus(int $status)
|
|
||||||
{
|
|
||||||
if (!ScheduleStatus::isValidValue($status)) {
|
|
||||||
throw new InvalidEnumValue($status);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->status = $status;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getFreqType() : int
|
|
||||||
{
|
|
||||||
return $this->freqType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $freqType Frequency type
|
|
||||||
*
|
|
||||||
* @return $this
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function setFreqType(int $freqType)
|
|
||||||
{
|
|
||||||
if (!FrequencyType::isValidValue($freqType)) {
|
|
||||||
throw new InvalidEnumValue($freqType);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->freqType = $freqType;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getIntervalType() : int
|
|
||||||
{
|
|
||||||
return $this->intervalType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $intervalType Interval type
|
|
||||||
*
|
|
||||||
* @return $this
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function setIntervalType(int $intervalType)
|
|
||||||
{
|
|
||||||
if (!IntervalType::isValidValue($intervalType)) {
|
|
||||||
throw new InvalidEnumValue($intervalType);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->intervalType = $intervalType;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getFrequencyRelative() : int
|
|
||||||
{
|
|
||||||
return $this->relativeInternal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $relativeInterval Relative interval
|
|
||||||
*
|
|
||||||
* @return $this
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function setFrequencyRelative(int $relativeInterval)
|
|
||||||
{
|
|
||||||
if (!FrequencyRelative::isValidValue($relativeInterval)) {
|
|
||||||
throw new InvalidEnumValue($relativeInterval);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->relativeInternal = $relativeInterval;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $freqInterval Frequency interval
|
|
||||||
*
|
|
||||||
* @return $this
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function setFreqInterval(int $freqInterval)
|
|
||||||
{
|
|
||||||
if (!FrequencyInterval::isValidValue($freqInterval)) {
|
|
||||||
throw new InvalidEnumValue($freqInterval);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->freqInterval = $freqInterval;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getFreqInterval() : int
|
|
||||||
{
|
|
||||||
return $this->freqInterval;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getRecurrenceFactor() : int
|
|
||||||
{
|
|
||||||
return $this->recurrenceFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $recurrence Recurrence
|
|
||||||
*
|
|
||||||
* @return $this
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function setRecurrenceFactor(int $recurrence)
|
|
||||||
{
|
|
||||||
$this->recurrenceFactor = $recurrence;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \DateTime
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getStart() : \DateTime
|
|
||||||
{
|
|
||||||
return $this->start;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param \DateTime $start Schedule start
|
|
||||||
*
|
|
||||||
* @return $this
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function setStart(\DateTime $start)
|
|
||||||
{
|
|
||||||
$this->start = $start;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getDuration() : int
|
|
||||||
{
|
|
||||||
return $this->duration;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $duration Duration
|
|
||||||
*
|
|
||||||
* @return $this
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function setDuration(int $duration)
|
|
||||||
{
|
|
||||||
if ($duration < 1) {
|
|
||||||
throw new \InvalidArgumentException($duration);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->duration = $duration;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \DateTime
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getEnd() : \DateTime
|
|
||||||
{
|
|
||||||
return $this->end;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param \DateTime $end Schedule end
|
|
||||||
*
|
|
||||||
* @return $this
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function setEnd(\DateTime $end)
|
|
||||||
{
|
|
||||||
$this->end = $end;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $creator Creator
|
|
||||||
*
|
|
||||||
* @return $this
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function setCreatedBy(int $creator)
|
|
||||||
{
|
|
||||||
$this->createdBy = $creator;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public function getCreatedBy() : int
|
|
||||||
{
|
|
||||||
return $this->createdBy;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,143 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar\Models;
|
|
||||||
|
|
||||||
use phpOMS\DataStorage\Database\DataMapperAbstract;
|
|
||||||
use phpOMS\DataStorage\Database\Query\Builder;
|
|
||||||
use phpOMS\DataStorage\Database\Query\Column;
|
|
||||||
use phpOMS\DataStorage\Database\RelationType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Mapper class.
|
|
||||||
*
|
|
||||||
* @category Calendar
|
|
||||||
* @package Modules
|
|
||||||
* @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 ScheduleMapper extends DataMapperAbstract
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Columns.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
protected static $columns = [
|
|
||||||
'schedule_id' => ['name' => 'schedule_id', 'type' => 'int', 'internal' => 'id'],
|
|
||||||
'schedule_uid' => ['name' => 'schedule_uid', 'type' => 'string', 'internal' => 'uid'],
|
|
||||||
'schedule_status' => ['name' => 'schedule_status', 'type' => 'int', 'internal' => 'status'],
|
|
||||||
'schedule_freq_type' => ['name' => 'schedule_freq_type', 'type' => 'int', 'internal' => 'freqType'],
|
|
||||||
'schedule_freq_interval' => ['name' => 'schedule_freq_interval', 'type' => 'int', 'internal' => 'freqInterval'],
|
|
||||||
'schedule_freq_interval_type' => ['name' => 'schedule_freq_interval_type', 'type' => 'int', 'internal' => 'intervalType'],
|
|
||||||
'schedule_freq_relative_interval' => ['name' => 'schedule_freq_relative_interval', 'type' => 'int', 'internal' => 'relativeInternal'],
|
|
||||||
'schedule_freq_recurrence_factor' => ['name' => 'schedule_freq_recurrence_factor', 'type' => 'int', 'internal' => 'recurrenceFactor'],
|
|
||||||
'schedule_start' => ['name' => 'schedule_start', 'type' => 'DateTime', 'internal' => 'start'],
|
|
||||||
'schedule_duration' => ['name' => 'schedule_duration', 'type' => 'int', 'internal' => 'duration'],
|
|
||||||
'schedule_end' => ['name' => 'schedule_end', 'type' => 'DateTime', 'internal' => 'end'],
|
|
||||||
'schedule_created_at' => ['name' => 'schedule_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'],
|
|
||||||
'schedule_created_by' => ['name' => 'schedule_created_by', 'type' => 'int', 'internal' => 'createdBy'],
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Primary table.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
protected static $table = 'schedule';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created at.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
protected static $createdAt = 'schedule_created_at';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Primary field name.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
protected static $primaryField = 'schedule_id';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create object.
|
|
||||||
*
|
|
||||||
* @param mixed $obj Object
|
|
||||||
* @param int $relations Behavior for relations creation
|
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public static function create($obj, int $relations = RelationType::ALL)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
$objId = parent::create($obj, $relations);
|
|
||||||
$query = new Builder(self::$db);
|
|
||||||
$query->prefix(self::$db->getPrefix())
|
|
||||||
->insert(
|
|
||||||
'account_permission_account',
|
|
||||||
'account_permission_from',
|
|
||||||
'account_permission_for',
|
|
||||||
'account_permission_id1',
|
|
||||||
'account_permission_id2',
|
|
||||||
'account_permission_r',
|
|
||||||
'account_permission_w',
|
|
||||||
'account_permission_m',
|
|
||||||
'account_permission_d',
|
|
||||||
'account_permission_p'
|
|
||||||
)
|
|
||||||
->into('account_permission')
|
|
||||||
->values($obj->getCreatedBy(), 'schedule', 'schedule', 1, $objId, 1, 1, 1, 1, 1);
|
|
||||||
|
|
||||||
self::$db->con->prepare($query->toSql())->execute();
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
var_dump($e->getMessage());
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $objId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Find.
|
|
||||||
*
|
|
||||||
* @param array $columns Columns to select
|
|
||||||
*
|
|
||||||
* @return Builder
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
*/
|
|
||||||
public static function find(...$columns) : Builder
|
|
||||||
{
|
|
||||||
return parent::find(...$columns)->from('account_permission')
|
|
||||||
->where('account_permission.account_permission_for', '=', 'calendar')
|
|
||||||
->where('account_permission.account_permission_id1', '=', 1)
|
|
||||||
->where('calendar.calendar_id', '=', new Column('account_permission.account_permission_id2'))
|
|
||||||
->where('account_permission.account_permission_r', '=', 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
namespace Modules\Calendar\Models;
|
|
||||||
|
|
||||||
use phpOMS\Datatypes\Enum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Schedule status enum.
|
|
||||||
*
|
|
||||||
* @category Calendar
|
|
||||||
* @package Modules
|
|
||||||
* @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
|
|
||||||
*/
|
|
||||||
abstract class ScheduleStatus extends Enum
|
|
||||||
{
|
|
||||||
/* public */ const ACTIVE = 1;
|
|
||||||
/* public */ const INACTIVE = 1;
|
|
||||||
}
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
return ['Navigation' => [
|
|
||||||
'Calendar' => 'Calendar',
|
|
||||||
]];
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
$MODLANG[1] = [
|
|
||||||
];
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
return ['Calendar' => [
|
|
||||||
'Blocks' => 'Blocks',
|
|
||||||
'Day' => 'Day',
|
|
||||||
'Interval' => 'Interval',
|
|
||||||
'Layout' => 'Layout',
|
|
||||||
'List' => 'List',
|
|
||||||
'Month' => 'Month',
|
|
||||||
'NewEvent' => 'New Event',
|
|
||||||
'Settings' => 'Settings',
|
|
||||||
'Timeline' => 'Timeline',
|
|
||||||
'Week' => 'Week',
|
|
||||||
'Year' => 'Year',
|
|
||||||
]];
|
|
||||||
|
|
@ -1,104 +0,0 @@
|
||||||
<?php
|
|
||||||
$calendar = $this->getData('calendar');
|
|
||||||
?>
|
|
||||||
<section class="wf-75 floatLeft">
|
|
||||||
<div class="box w-100">
|
|
||||||
<ul class="btns floatLeft">
|
|
||||||
<li><a href="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/backend/calendar/dashboard?date=' . $calendar->getDate()->createModify(0, -1, 0)->format('Y-m-d')) ?>"><i class="fa fa-arrow-left"></i></a>
|
|
||||||
<li><a href="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/backend/calendar/dashboard?date=' . $calendar->getDate()->createModify(0, 1, 0)->format('Y-m-d')) ?>"><i class="fa fa-arrow-right"></i></a>
|
|
||||||
</ul>
|
|
||||||
<ul class="btns floatRight">
|
|
||||||
<li><a href=""><?= $this->getText('Day') ?></a>
|
|
||||||
<li><a href=""><?= $this->getText('Week') ?></a>
|
|
||||||
<li><a href=""><?= $this->getText('Month') ?></a>
|
|
||||||
<li><a href=""><?= $this->getText('Year') ?></a>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="box w-100">
|
|
||||||
<div class="m-calendar-month">
|
|
||||||
<?php $current = new \phpOMS\Datatypes\SmartDateTime($calendar->getDate()->format('Y') . '-' . $calendar->getDate()->format('m') . '-' . '01'); for($i = 0; $i < 6; $i++) : ?>
|
|
||||||
<div class="wf-100">
|
|
||||||
<?php for($j = 0; $j < 7; $j++) : ?>
|
|
||||||
<div contextmenu="calendar-day-menu" style="display: inline-block; box-sizing: border-box; width: 13.0%; height: 100px; border: 1px solid #000; margin: 0; padding: 3px; overflow: hidden">
|
|
||||||
<?php if($calendar->getDate()->getFirstDayOfMonth() <= $i*7+$j+1 && $calendar->getDate()->getDaysOfMonth() >= $i*7+$j+1) {
|
|
||||||
echo ($i*7+$j+1) . ' ' . jddayofweek($j, 1);
|
|
||||||
} else {
|
|
||||||
echo $current->createModify(0, 0, -2)->format('d') . ' ' . jddayofweek($j, 1);
|
|
||||||
} ?>
|
|
||||||
<ul>
|
|
||||||
<?php
|
|
||||||
$events = $calendar->getEventByDate($current);
|
|
||||||
$current->smartModify(0, 0, 1);
|
|
||||||
foreach($events as $event) : ?>
|
|
||||||
<li><span class="tag purple" style="white-space: nowrap;"><?= $event->getName(); ?></span>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<?php endfor; ?>
|
|
||||||
</div>
|
|
||||||
<?php endfor;?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="wf-25 floatLeft">
|
|
||||||
<section class="box w-100">
|
|
||||||
<header><h1>Title</h1></header>
|
|
||||||
|
|
||||||
<div class="inner">
|
|
||||||
<form>
|
|
||||||
<table class="layout wf-100">
|
|
||||||
<tr>
|
|
||||||
<td><label>Layout</label>
|
|
||||||
<tr>
|
|
||||||
<td><select>
|
|
||||||
<option>
|
|
||||||
</select>
|
|
||||||
</table>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="box w-100">
|
|
||||||
<header><h1>Calendars</h1></header>
|
|
||||||
|
|
||||||
<div class="inner">
|
|
||||||
<ul class="boxed">
|
|
||||||
<li><i class="fa fa-times warning"></i> <span class="check"><input type="checkbox" id="iDefault" checked><label for="iDefault">Default</label></span><i class="fa fa-cogs floatRight"></i>
|
|
||||||
</ul>
|
|
||||||
<div class="spacer"></div>
|
|
||||||
<button><i class="fa fa-calendar-plus-o"></i> <?= $this->getText('Add', 0, 0); ?></button> <button><i class="fa fa-calendar-check-o"></i> <?= $this->getText('Create', 0, 0); ?></button>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<menu type="context" id="calendar-day-menu">
|
|
||||||
<menuitem label="<?= $this->getText('NewEvent') ?>"></menuitem>
|
|
||||||
</menu>
|
|
||||||
|
|
||||||
<menu type="context" id="calendar-event-menu">
|
|
||||||
<menuitem label="Edit"></menuitem>
|
|
||||||
<menuitem label="Accept" disabled></menuitem>
|
|
||||||
<menuitem label="Re-Schedule"></menuitem>
|
|
||||||
<menuitem label="Decline"></menuitem>
|
|
||||||
<menuitem label="Delete"></menuitem>
|
|
||||||
</menu>
|
|
||||||
|
|
||||||
<div class="hidden">
|
|
||||||
<section class="box">
|
|
||||||
<div class="inner">
|
|
||||||
<form>
|
|
||||||
<table class="layout">
|
|
||||||
<tr><td><label for="iTitle">Title</label>
|
|
||||||
<tr><td><input type="text" id="">
|
|
||||||
<tr><td><label for="iTitle">Description</label>
|
|
||||||
<tr><td><textarea></textarea>
|
|
||||||
<tr><td><label for="iTitle">To</label>
|
|
||||||
<tr><td><input type="text" id="">
|
|
||||||
<tr><td><label for="iTitle">Files</label>
|
|
||||||
<tr><td><input type="text" id="">
|
|
||||||
</table>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
<section>
|
|
||||||
Calendar
|
|
||||||
</section>
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
return ['Navigation' => [
|
|
||||||
'Calendar' => 'Calendar',
|
|
||||||
]];
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
$MODLANG[1] = [
|
|
||||||
];
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Orange Management
|
|
||||||
*
|
|
||||||
* PHP Version 7.1
|
|
||||||
*
|
|
||||||
* @category TBD
|
|
||||||
* @package TBD
|
|
||||||
* @author OMS Development Team <dev@oms.com>
|
|
||||||
* @author Dennis Eichhorn <d.eichhorn@oms.com>
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link http://orange-management.com
|
|
||||||
*/
|
|
||||||
return ['Calendar' => [
|
|
||||||
'Blocks' => 'Blocks',
|
|
||||||
'Day' => 'Day',
|
|
||||||
'Interval' => 'Interval',
|
|
||||||
'Layout' => 'Layout',
|
|
||||||
'List' => 'List',
|
|
||||||
'Month' => 'Month',
|
|
||||||
'NewEvent' => 'New Event',
|
|
||||||
'Settings' => 'Settings',
|
|
||||||
'Timeline' => 'Timeline',
|
|
||||||
'Week' => 'Week',
|
|
||||||
'Year' => 'Year',
|
|
||||||
]];
|
|
||||||
|
|
@ -1,104 +0,0 @@
|
||||||
<?php
|
|
||||||
$calendar = $this->getData('calendar');
|
|
||||||
?>
|
|
||||||
<section class="wf-75 floatLeft">
|
|
||||||
<div class="box w-100">
|
|
||||||
<ul class="btns floatLeft">
|
|
||||||
<li><a href="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/backend/calendar/dashboard?date=' . $calendar->getDate()->createModify(0, -1, 0)->format('Y-m-d')) ?>"><i class="fa fa-arrow-left"></i></a>
|
|
||||||
<li><a href="<?= \phpOMS\Uri\UriFactory::build('/{/lang}/backend/calendar/dashboard?date=' . $calendar->getDate()->createModify(0, 1, 0)->format('Y-m-d')) ?>"><i class="fa fa-arrow-right"></i></a>
|
|
||||||
</ul>
|
|
||||||
<ul class="btns floatRight">
|
|
||||||
<li><a href=""><?= $this->getText('Day') ?></a>
|
|
||||||
<li><a href=""><?= $this->getText('Week') ?></a>
|
|
||||||
<li><a href=""><?= $this->getText('Month') ?></a>
|
|
||||||
<li><a href=""><?= $this->getText('Year') ?></a>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div class="box w-100">
|
|
||||||
<div class="m-calendar-month">
|
|
||||||
<?php $current = new \phpOMS\Datatypes\SmartDateTime($calendar->getDate()->format('Y') . '-' . $calendar->getDate()->format('m') . '-' . '01'); for($i = 0; $i < 6; $i++) : ?>
|
|
||||||
<div class="wf-100">
|
|
||||||
<?php for($j = 0; $j < 7; $j++) : ?>
|
|
||||||
<div contextmenu="calendar-day-menu" style="display: inline-block; box-sizing: border-box; width: 13.0%; height: 100px; border: 1px solid #000; margin: 0; padding: 3px; overflow: hidden">
|
|
||||||
<?php if($calendar->getDate()->getFirstDayOfMonth() <= $i*7+$j+1 && $calendar->getDate()->getDaysOfMonth() >= $i*7+$j+1) {
|
|
||||||
echo ($i*7+$j+1) . ' ' . jddayofweek($j, 1);
|
|
||||||
} else {
|
|
||||||
echo $current->createModify(0, 0, -2)->format('d') . ' ' . jddayofweek($j, 1);
|
|
||||||
} ?>
|
|
||||||
<ul>
|
|
||||||
<?php
|
|
||||||
$events = $calendar->getEventByDate($current);
|
|
||||||
$current->smartModify(0, 0, 1);
|
|
||||||
foreach($events as $event) : ?>
|
|
||||||
<li><span class="tag purple" style="white-space: nowrap;"><?= $event->getName(); ?></span>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<?php endfor; ?>
|
|
||||||
</div>
|
|
||||||
<?php endfor;?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="wf-25 floatLeft">
|
|
||||||
<section class="box w-100">
|
|
||||||
<header><h1>Title</h1></header>
|
|
||||||
|
|
||||||
<div class="inner">
|
|
||||||
<form>
|
|
||||||
<table class="layout wf-100">
|
|
||||||
<tr>
|
|
||||||
<td><label>Layout</label>
|
|
||||||
<tr>
|
|
||||||
<td><select>
|
|
||||||
<option>
|
|
||||||
</select>
|
|
||||||
</table>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="box w-100">
|
|
||||||
<header><h1>Calendars</h1></header>
|
|
||||||
|
|
||||||
<div class="inner">
|
|
||||||
<ul class="boxed">
|
|
||||||
<li><i class="fa fa-times warning"></i> <span class="check"><input type="checkbox" id="iDefault" checked><label for="iDefault">Default</label></span><i class="fa fa-cogs floatRight"></i>
|
|
||||||
</ul>
|
|
||||||
<div class="spacer"></div>
|
|
||||||
<button><i class="fa fa-calendar-plus-o"></i> <?= $this->getText('Add', 0, 0); ?></button> <button><i class="fa fa-calendar-check-o"></i> <?= $this->getText('Create', 0, 0); ?></button>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<menu type="context" id="calendar-day-menu">
|
|
||||||
<menuitem label="<?= $this->getText('NewEvent') ?>"></menuitem>
|
|
||||||
</menu>
|
|
||||||
|
|
||||||
<menu type="context" id="calendar-event-menu">
|
|
||||||
<menuitem label="Edit"></menuitem>
|
|
||||||
<menuitem label="Accept" disabled></menuitem>
|
|
||||||
<menuitem label="Re-Schedule"></menuitem>
|
|
||||||
<menuitem label="Decline"></menuitem>
|
|
||||||
<menuitem label="Delete"></menuitem>
|
|
||||||
</menu>
|
|
||||||
|
|
||||||
<div class="hidden">
|
|
||||||
<section class="box">
|
|
||||||
<div class="inner">
|
|
||||||
<form>
|
|
||||||
<table class="layout">
|
|
||||||
<tr><td><label for="iTitle">Title</label>
|
|
||||||
<tr><td><input type="text" id="">
|
|
||||||
<tr><td><label for="iTitle">Description</label>
|
|
||||||
<tr><td><textarea></textarea>
|
|
||||||
<tr><td><label for="iTitle">To</label>
|
|
||||||
<tr><td><input type="text" id="">
|
|
||||||
<tr><td><label for="iTitle">Files</label>
|
|
||||||
<tr><td><input type="text" id="">
|
|
||||||
</table>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
</div>
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 48 KiB |
44
info.json
44
info.json
|
|
@ -1,44 +0,0 @@
|
||||||
{
|
|
||||||
"name": {
|
|
||||||
"id": 1000900000,
|
|
||||||
"internal": "Calendar",
|
|
||||||
"external": "OMS Calendar"
|
|
||||||
},
|
|
||||||
"version": "1.0.0",
|
|
||||||
"requirements": {
|
|
||||||
"phpOMS": "1.0.0",
|
|
||||||
"phpOMS-db": "1.0.0"
|
|
||||||
},
|
|
||||||
"creator": {
|
|
||||||
"name": "Orange Management",
|
|
||||||
"website": "www.spl1nes.com"
|
|
||||||
},
|
|
||||||
"description": "Calendar module.",
|
|
||||||
"directory": "Calendar",
|
|
||||||
"dependencies": {
|
|
||||||
"Admin" : "1.0.0"
|
|
||||||
},
|
|
||||||
"providing": {
|
|
||||||
"Navigation": "*"
|
|
||||||
},
|
|
||||||
"load": [
|
|
||||||
{
|
|
||||||
"pid": [
|
|
||||||
"fb78d7e421e4178d31a384fb394dcf2369fff309"
|
|
||||||
],
|
|
||||||
"type": 4,
|
|
||||||
"for": "Content",
|
|
||||||
"from": "Calendar",
|
|
||||||
"file": "Calendar"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"pid": [
|
|
||||||
"754a08ddf8bcb1cf22f310f09206dd783d42f7dd"
|
|
||||||
],
|
|
||||||
"type": 5,
|
|
||||||
"from": "Calendar",
|
|
||||||
"for": "Navigation",
|
|
||||||
"file": "Navigation"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
(function (omsModule, undefined) {
|
|
||||||
omsModule.Calendar = function () {
|
|
||||||
this.layout = omsModule.Calendar.layout.BLOCKS;
|
|
||||||
this.interval = null;
|
|
||||||
this.selectedElement = null;
|
|
||||||
this.subCalendars = [];
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
omsModule.Calendar.prototype.render = function () {
|
|
||||||
};
|
|
||||||
|
|
||||||
omsModule.Calendar.prototype.renderBlocks = function () {
|
|
||||||
};
|
|
||||||
|
|
||||||
omsModule.Calendar.prototype.renderList = function () {
|
|
||||||
};
|
|
||||||
|
|
||||||
omsModule.Calendar.prototype.renderTimeline = function () {
|
|
||||||
};
|
|
||||||
}(window.omsModule = window.omsModule || {}));
|
|
||||||
Loading…
Reference in New Issue
Block a user