Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 15681 | Rev 15683 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 15681 Rev 15682
Línea 2... Línea 2...
2
 
2
 
Línea 3... Línea 3...
3
declare(strict_types=1);
3
declare(strict_types=1);
Línea 4... Línea -...
4
 
-
 
5
namespace LeadersLinked\Controller;
-
 
6
 
4
 
-
 
5
namespace LeadersLinked\Controller;
-
 
6
 
-
 
7
use Laminas\View\Model\JsonModel;
Línea 7... Línea 8...
7
use Laminas\Mvc\Controller\AbstractActionController;
8
use Laminas\View\Model\ViewModel;
8
use Laminas\View\Model\ViewModel;
9
use LeadersLinked\Mapper\DiscoveryContactLogMapper;
9
use Laminas\View\Model\JsonModel;
10
use Laminas\Mvc\Controller\AbstractActionController;
-
 
11
 
-
 
12
// Create an action controller.
-
 
13
class DiscoveryContactProgressController extends AbstractActionController
-
 
14
{
-
 
15
    /**
-
 
16
     *
-
 
17
     * @var AdapterInterface
-
 
18
     */
-
 
19
    private $adapter;
-
 
20
 
-
 
21
 
-
 
22
    /**
-
 
23
     *
-
 
24
     * @var AbstractAdapter
-
 
25
     */
-
 
26
    private $cache;
-
 
27
 
-
 
28
    /**
-
 
29
     *
-
 
30
     * @var  LoggerInterface
-
 
31
     */
-
 
32
    private $logger;
-
 
33
 
-
 
34
    /**
-
 
35
     *
-
 
36
     * @var array
-
 
37
     */
-
 
38
    private $config;
-
 
39
 
-
 
40
    /**
-
 
41
     *
-
 
42
     * @param AdapterInterface $adapter
-
 
43
     * @param AbstractAdapter $cache
-
 
44
     * @param LoggerInterface $logger
-
 
45
     * @param array $config
-
 
46
     */
-
 
47
    public function __construct($adapter, $cache, $logger, $config)
-
 
48
    {
-
 
49
        $this->adapter      = $adapter;
-
 
50
        $this->cache        = $cache;
10
 
51
        $this->logger       = $logger;
11
// Create an action controller.
52
        $this->config       = $config;
12
class DiscoveryContactProgressController extends AbstractActionController
53
    }
13
{
54
 
14
    // Define an action "world".
55
    // Define an action "world".
Línea 35... Línea 76...
35
                    }
76
                    }
36
                }
77
                }
37
            }
78
            }
Línea 38... Línea 79...
38
 
79
 
-
 
80
            if ($isJson) {
-
 
81
                search = $this->params()->fromQuery('search');
-
 
82
                $search = empty($search['value']) ? '' : filter_var($search['value'], FILTER_SANITIZE_STRING);
-
 
83
                $page               = intval($this->params()->fromQuery('start', 1), 10);
-
 
84
                $records_x_page     = intval($this->params()->fromQuery('length', 10), 10);
-
 
85
                $order =  $this->params()->fromQuery('order', []);
-
 
86
                $order_field        = empty($order[0]['column']) ? 99 :  intval($order[0]['column'], 10);
-
 
87
                $order_direction    = empty($order[0]['dir']) ? 'ASC' : strtoupper(filter_var($order[0]['dir'], FILTER_SANITIZE_STRING));
-
 
88
                $fields =  ['first_name', 'last_name', 'corporate_email', 'activity'];
-
 
89
                $order_field = isset($fields[$order_field]) ? $fields[$order_field] : 'first_name';
-
 
90
 
-
 
91
                if (!in_array($order_direction, ['ASC', 'DESC'])) {
-
 
92
                    $order_direction = 'ASC';
-
 
93
                }
-
 
94
 
-
 
95
                //Quede aqui en el mapper
-
 
96
                $discoveryContactMapper = DiscoveryContactLogMapper::getInstance($this->adapter);
39
            if ($isJson) {
97
                $paginator = $discoveryContactMapper->fetchAllDataTableForCompanyIdAndContactId($search, $currentCompany->id, $page, $records_x_page, $order_field, $order_direction);
40
            } else {
98
            } else {
Línea 41... Línea 99...
41
            }
99
            }
42
 
100
 
43
 
101
 
44
            return new JsonModel([
102
            return new JsonModel([
45
                'success' => true,
103
                'success' => true,
46
                'message' => $headers
104
                'message' => $currentCompany
47
            ]);
105
            ]);
48
        }
106
        }