Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 4113 | Rev 4141 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
4113 efrain 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace LeadersLinked\Controller;
6
 
7
use Laminas\Db\Adapter\AdapterInterface;
8
use Laminas\Cache\Storage\Adapter\AbstractAdapter;
9
use Laminas\Mvc\Controller\AbstractActionController;
10
use Laminas\Log\LoggerInterface;
11
use Laminas\View\Model\ViewModel;
12
use Laminas\View\Model\JsonModel;
13
use LeadersLinked\Mapper\UserMapper;
4131 efrain 14
use LeadersLinked\Mapper\ChatUserMapper;
15
use LeadersLinked\Mapper\ChatGroupMapper;
16
use LeadersLinked\Mapper\ChatGroupUserMapper;
4113 efrain 17
 
4131 efrain 18
 
4113 efrain 19
class CalendarController extends AbstractActionController
20
{
21
    /**
22
     *
23
     * @var AdapterInterface
24
     */
25
    private $adapter;
26
 
27
 
28
    /**
29
     *
30
     * @var AbstractAdapter
31
     */
32
    private $cache;
33
 
34
    /**
35
     *
36
     * @var  LoggerInterface
37
     */
38
    private $logger;
39
 
40
 
41
    /**
42
     *
43
     * @var array
44
     */
45
    private $config;
46
 
47
    /**
48
     *
49
     * @param AdapterInterface $adapter
50
     * @param AbstractAdapter $cache
51
     * @param LoggerInterface $logger
52
     * @param array $config
53
     */
54
    public function __construct($adapter, $cache, $logger,  $config)
55
    {
56
        $this->adapter      = $adapter;
57
        $this->cache        = $cache;
58
        $this->logger       = $logger;
59
        $this->config       = $config;
60
    }
61
 
62
 
63
 
64
    public function indexAction()
65
    {
4131 efrain 66
        $currentUserPlugin = $this->plugin('currentUserPlugin');
67
        $currentUser = $currentUserPlugin->getUser();
68
 
4113 efrain 69
 
70
 
71
        $this->layout()->setTemplate('layout/layout.phtml');
72
        $viewModel = new ViewModel();
73
        $viewModel->setTemplate('leaders-linked/calendar/index.phtml');
4131 efrain 74
 
4113 efrain 75
        return $viewModel;
76
    }
77
 
78
 
79
 
80
 
81
    public function eventsAction()
82
    {
83
 
84
        $textColor = '#000000';
85
        $reservationSameLocation = '#80ff80';
86
        $reservationOtherLocation = '#008000';
87
        $contract = '#8080ff';
88
        $contractDelayed = '#ff0000';
89
        $contractOtherLocation = '#ffc0c0';
90
        $orderRepair = '#c0c0c0';
91
 
92
        $start  = $this->params()->fromQuery('start');
93
        $end    = $this->params()->fromQuery('send');
94
 
95
 
96
        $events = [];
97
 
98
        $dt = new \DateTime();
99
        $dt->add(new \DateInterval('P1D'));
100
        $dt->setTime(9, 0);
101
 
102
        $event_start = $dt->format('H-m-d\TH:i:s');
103
 
104
        $dt->setTime(12, 30);
105
 
106
        $event_end = $dt->format('H-m-d\TH:i:s');
107
 
108
 
109
 
110
 
111
        array_push($events,
112
            [
113
                'id' => '001',
114
                'name' => 'Name 001',
115
                'description' => 'Efrain<br>Yanez',
116
                'title' =>  'Title 001',
117
                'start' =>  '2022-12-12T10:30:00-05:00',
118
                'end' => '2022-12-12T12:30:00-05:00',
119
                'url' =>  'https://google.com/',
120
                'backgroundColor' =>   $contract,
121
                'textColor' =>  $textColor
122
            ],
123
 
124
        );
125
 
126
 
127
        return new JsonModel($events);
128
    }
129
 
130
 
131
 
132
 
133
}