Rev 4131 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
<?php
declare(strict_types=1);
namespace LeadersLinked\Controller;
use Laminas\Db\Adapter\AdapterInterface;
use Laminas\Cache\Storage\Adapter\AbstractAdapter;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\Log\LoggerInterface;
use Laminas\View\Model\ViewModel;
use Laminas\View\Model\JsonModel;
use LeadersLinked\Model\Page;
use LeadersLinked\Mapper\NotificationMapper;
use LeadersLinked\Mapper\CompanyMapper;
use LeadersLinked\Mapper\CompanyUserMapper;
use LeadersLinked\Model\Company;
use LeadersLinked\Mapper\PageMapper;
use LeadersLinked\Mapper\MessageMapper;
use LeadersLinked\Mapper\UserMapper;
use LeadersLinked\Mapper\UserProfileMapper;
use LeadersLinked\Mapper\CompanyUserRoleMapper;
use LeadersLinked\Model\Role;
use LeadersLinked\Library\Functions;
use LeadersLinked\Mapper\ConnectionMapper;
use LeadersLinked\Mapper\LocationMapper;
use LeadersLinked\Mapper\PostMapper;
use LeadersLinked\Mapper\ProfileVisitMapper;
use LeadersLinked\Model\Post;
use LeadersLinked\Mapper\UtilMapper;
use LeadersLinked\Mapper\FeedMapper;
use LeadersLinked\Model\Feed;
use LeadersLinked\Model\User;
use LeadersLinked\Model\Connection;
use LeadersLinked\Mapper\NetworkMapper;
class CalendarController extends AbstractActionController
{
/**
*
* @var AdapterInterface
*/
private $adapter;
/**
*
* @var AbstractAdapter
*/
private $cache;
/**
*
* @var LoggerInterface
*/
private $logger;
/**
*
* @var array
*/
private $config;
/**
*
* @param AdapterInterface $adapter
* @param AbstractAdapter $cache
* @param LoggerInterface $logger
* @param array $config
*/
public function __construct($adapter, $cache, $logger, $config)
{
$this->adapter = $adapter;
$this->cache = $cache;
$this->logger = $logger;
$this->config = $config;
}
public function indexAction()
{
$this->layout()->setTemplate('layout/layout.phtml');
$viewModel = new ViewModel();
$viewModel->setTemplate('leaders-linked/calendar/index.phtml');
return $viewModel;
}
public function eventsAction()
{
$textColor = '#000000';
$reservationSameLocation = '#80ff80';
$reservationOtherLocation = '#008000';
$contract = '#8080ff';
$contractDelayed = '#ff0000';
$contractOtherLocation = '#ffc0c0';
$orderRepair = '#c0c0c0';
$start = $this->params()->fromQuery('start');
$end = $this->params()->fromQuery('send');
$events = [];
$dt = new \DateTime();
$dt->add(new \DateInterval('P1D'));
$dt->setTime(9, 0);
$event_start = $dt->format('H-m-d\TH:i:s');
$dt->setTime(12, 30);
$event_end = $dt->format('H-m-d\TH:i:s');
array_push($events,
[
'id' => '001',
'name' => 'Name 001',
'description' => 'Efrain<br>Yanez',
'title' => 'Title 001',
'start' => '2022-12-12T10:30:00-05:00',
'end' => '2022-12-12T12:30:00-05:00',
'url' => 'https://google.com/',
'backgroundColor' => $contract,
'textColor' => $textColor
],
);
return new JsonModel($events);
}
}