Working on refactoring the calendar API
parent
5ee4ed5864
commit
13161696ae
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace BusinessLogic\Calendar;
|
||||||
|
|
||||||
|
|
||||||
|
use DataAccess\Calendar\CalendarGateway;
|
||||||
|
|
||||||
|
class CalendarHandler extends \BaseClass {
|
||||||
|
private $calendarGateway;
|
||||||
|
|
||||||
|
public function __construct(CalendarGateway $calendarGateway) {
|
||||||
|
$this->calendarGateway = $calendarGateway;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getEventsForStaff($startTime, $endTime, $searchEventsFilter, $heskSettings) {
|
||||||
|
return $this->calendarGateway->getEventsForStaff($startTime, $endTime, $searchEventsFilter, $heskSettings);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Controllers\Calendar;
|
||||||
|
|
||||||
|
|
||||||
|
use BusinessLogic\Calendar\CalendarHandler;
|
||||||
|
use BusinessLogic\Calendar\SearchEventsFilter;
|
||||||
|
|
||||||
|
class CalendarController extends \BaseClass {
|
||||||
|
function get() {
|
||||||
|
global $applicationContext, $hesk_settings;
|
||||||
|
|
||||||
|
$startTime = isset($_GET['start']) ? $_GET['start'] : round(microtime(true) * 1000);
|
||||||
|
$endTime = isset($_GET['end']) ? $_GET['end'] : round(microtime(true) * 1000);
|
||||||
|
|
||||||
|
/* @var $calendarHandler CalendarHandler */
|
||||||
|
$calendarHandler = $applicationContext->get(CalendarHandler::clazz());
|
||||||
|
|
||||||
|
$events = $calendarHandler->getEventsForStaff($startTime, $endTime, new SearchEventsFilter(), $hesk_settings);
|
||||||
|
|
||||||
|
return output($events);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue