Proyectos de Subversion LeadersLinked - Backend

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
7308 nelberth 1
<?php
2
declare(strict_types=1);
3
 
4
namespace LeadersLinked\Controller;
5
 
6
use Laminas\Authentication\AuthenticationService;
7
use Laminas\Authentication\Result as AuthResult;
8
use Laminas\Db\Adapter\AdapterInterface;
9
use Laminas\Cache\Storage\Adapter\AbstractAdapter;
10
use Laminas\Mvc\Controller\AbstractActionController;
11
use Laminas\Mvc\I18n\Translator;
12
use Laminas\Log\LoggerInterface;
13
use Laminas\View\Model\ViewModel;
14
use Laminas\View\Model\JsonModel;
15
use LeadersLinked\Hydrator\ObjectPropertyHydrator;
16
 
7339 nelberth 17
use LeadersLinked\Form\CreateFeedForm;
7490 nelberth 18
use LeadersLinked\Form\HighPerformanceTeamsGroupsViewTopicForm;
7321 nelberth 19
use LeadersLinked\Mapper\HighPerformanceTeamsGroupsMapper;
20
use LeadersLinked\Mapper\HighPerformanceTeamsGroupsMembersMapper;
21
 
7322 nelberth 22
use LeadersLinked\Mapper\UserMapper;
23
 
7310 nelberth 24
class HighPerformanceTeamsGroupsViewController extends AbstractActionController
7308 nelberth 25
{
26
    /**
27
     *
28
     * @var AdapterInterface
29
     */
30
    private $adapter;
31
 
32
 
33
    /**
34
     *
35
     * @var AbstractAdapter
36
     */
37
    private $cache;
38
 
39
    /**
40
     *
41
     * @var  LoggerInterface
42
     */
43
    private $logger;
44
 
45
    /**
46
     *
47
     * @var array
48
     */
49
    private $config;
50
 
51
 
52
 
53
    /**
54
     *
55
     * @param AdapterInterface $adapter
56
     * @param AbstractAdapter $cache
57
     * @param LoggerInterface $logger
58
     * @param array $config
59
     */
60
    public function __construct($adapter, $cache , $logger, $config)
61
    {
62
        $this->adapter      = $adapter;
63
        $this->cache        = $cache;
64
        $this->logger       = $logger;
65
        $this->config       = $config;
66
 
67
 
68
    }
7320 nelberth 69
 
7321 nelberth 70
    public function IndexAction()
7308 nelberth 71
    {
7320 nelberth 72
        $currentUserPlugin = $this->plugin('currentUserPlugin');
73
        $currentUser = $currentUserPlugin->getUser();
7339 nelberth 74
        $currentCompany = $currentUserPlugin->getCompany();
7836 nelberth 75
        $group_uuid   = $this->params()->fromRoute('group_uuid');
7835 nelberth 76
        $topic_uuid   = $this->params()->fromRoute('topic_uuid');
77
        if(!isset($topic_uuid)){
78
            $topic_uuid='';
7616 nelberth 79
        }
7339 nelberth 80
 
81
 
82
        $request = $this->getRequest();
83
        if($request->isGet()) {
84
            $headers  = $request->getHeaders();
7320 nelberth 85
 
7339 nelberth 86
            $isJson = false;
87
            if($headers->has('Accept')) {
88
                $accept = $headers->get('Accept');
7320 nelberth 89
 
7339 nelberth 90
                $prioritized = $accept->getPrioritized();
7320 nelberth 91
 
7339 nelberth 92
                foreach($prioritized as $key => $value) {
93
                    $raw = trim($value->getRaw());
7321 nelberth 94
 
7339 nelberth 95
                    if(!$isJson) {
96
                        $isJson = strpos($raw, 'json');
7321 nelberth 97
                    }
7320 nelberth 98
 
99
                }
7321 nelberth 100
            }
101
 
7646 nelberth 102
            $formFeed = new CreateFeedForm($this->adapter);
7490 nelberth 103
            $formTopicNomal = new HighPerformanceTeamsGroupsViewTopicForm($this->adapter);
7339 nelberth 104
            $this->layout()->setTemplate('layout/layout-backend');
105
            $viewModel = new ViewModel();
7344 nelberth 106
            $viewModel->setTemplate('leaders-linked/high-performance-teams-groups-view/index.phtml');
7339 nelberth 107
            $viewModel->setVariables([
7347 nelberth 108
                'formFeed'    =>  $formFeed,
7462 nelberth 109
                'group_uuid'  =>  $group_uuid,
7835 nelberth 110
                'topic_uuid'=>$topic_uuid,
7462 nelberth 111
                'formTopicNormal' => $formTopicNomal
7321 nelberth 112
            ]);
7339 nelberth 113
            return $viewModel ;
7321 nelberth 114
 
115
 
116
        } else {
7339 nelberth 117
            return new JsonModel([
118
                'success' => false,
119
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
7320 nelberth 120
            ]);
121
        }
7339 nelberth 122
 
7321 nelberth 123
 
7320 nelberth 124
    }
7321 nelberth 125
 
7320 nelberth 126
 
127
    /*
128
    public function indexAction()
129
    {
130
        $request = $this->getRequest();
7308 nelberth 131
 
132
        $request = $this->getRequest();
133
        if($request->isGet()) {
134
 
135
            $this->layout()->setTemplate('layout/layout-backend');
136
            $viewModel = new ViewModel();
7310 nelberth 137
            $viewModel->setTemplate('leaders-linked/high-performance-teams-groups-view/index.phtml');
7308 nelberth 138
            return $viewModel ;
139
 
140
 
141
        } else {
142
            return new JsonModel([
143
                'success' => false,
144
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
145
            ]);;
146
        }
7320 nelberth 147
    }*/
7504 nelberth 148
 
7308 nelberth 149
}