Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev Autor Línea Nro. Línea
15670 anderson 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace LeadersLinked\Controller;
6
 
7
use Laminas\Mvc\Controller\AbstractActionController;
8
use Laminas\View\Model\ViewModel;
15673 anderson 9
use Laminas\View\Model\JsonModel;
15670 anderson 10
 
11
// Create an action controller.
12
class DiscoveryContactProgressController extends AbstractActionController
13
{
14
    // Define an action "world".
15
    public function indexAction()
16
    {
15674 anderson 17
        $currentUserPlugin = $this->plugin('currentUserPlugin');
18
        $currentUser = $currentUserPlugin->getUser();
19
        $currentCompany = $currentUserPlugin->getCompany();
15670 anderson 20
 
15674 anderson 21
        $request = $this->getRequest();
22
        if ($request->isGet()) {
15677 anderson 23
            $headers  = $request->getHeaders();
24
            $isJson = false;
15678 anderson 25
 
15680 anderson 26
            if ($headers->has('Accept')) {
27
                $accept = $headers->get('Accept');
28
                $prioritized = $accept->getPrioritized();
15679 anderson 29
 
15680 anderson 30
                foreach ($prioritized as $key => $value) {
31
                    $raw = trim($value->getRaw());
15679 anderson 32
 
15680 anderson 33
                    if (!$isJson) {
34
                        $isJson = strpos($raw, 'json');
35
                    }
15679 anderson 36
                }
37
            }
38
 
39
 
15677 anderson 40
            return new JsonModel([
41
                'success' => true,
15678 anderson 42
                'message' => $headers
15677 anderson 43
            ]);
15675 anderson 44
        }
15673 anderson 45
        return new JsonModel([
46
            'success' => true,
15676 anderson 47
            'message' => $currentUser
15673 anderson 48
        ]);
15670 anderson 49
    }
50
}