| Línea 75... |
Línea 75... |
| 75 |
$isJson = strpos($raw, 'json');
|
75 |
$isJson = strpos($raw, 'json');
|
| 76 |
}
|
76 |
}
|
| 77 |
}
|
77 |
}
|
| 78 |
}
|
78 |
}
|
| Línea 79... |
Línea 79... |
| 79 |
|
79 |
|
| 80 |
//if ($isJson) {
|
80 |
if ($isJson) {
|
| 81 |
$search = $this->params()->fromQuery('search');
|
81 |
$search = $this->params()->fromQuery('search');
|
| 82 |
$search = empty($search['value']) ? '' : filter_var($search['value'], FILTER_SANITIZE_STRING);
|
82 |
$search = empty($search['value']) ? '' : filter_var($search['value'], FILTER_SANITIZE_STRING);
|
| 83 |
$page = intval($this->params()->fromQuery('start', 1), 10);
|
83 |
$page = intval($this->params()->fromQuery('start', 1), 10);
|
| 84 |
$records_x_page = intval($this->params()->fromQuery('length', 10), 10);
|
84 |
$records_x_page = intval($this->params()->fromQuery('length', 10), 10);
|
| 85 |
$order = $this->params()->fromQuery('order', []);
|
85 |
$order = $this->params()->fromQuery('order', []);
|
| 86 |
$order_field = empty($order[0]['column']) ? 99 : intval($order[0]['column'], 10);
|
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));
|
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'];
|
88 |
$fields = ['first_name', 'last_name', 'corporate_email', 'activity'];
|
| Línea 89... |
Línea 89... |
| 89 |
$order_field = isset($fields[$order_field]) ? $fields[$order_field] : 'first_name';
|
89 |
$order_field = isset($fields[$order_field]) ? $fields[$order_field] : 'first_name';
|
| 90 |
|
90 |
|
| 91 |
if (!in_array($order_direction, ['ASC', 'DESC'])) {
|
91 |
if (!in_array($order_direction, ['ASC', 'DESC'])) {
|
| Línea 92... |
Línea 92... |
| 92 |
$order_direction = 'ASC';
|
92 |
$order_direction = 'ASC';
|
| 93 |
}
|
93 |
}
|
| 94 |
|
94 |
|
| 95 |
|
95 |
|
| 96 |
//Quede aqui en el mapper
|
96 |
//Quede aqui en el mapper
|
| 97 |
$discoveryContactMapper = DiscoveryContactLogMapper::getInstance($this->adapter);
|
97 |
$discoveryContactMapper = DiscoveryContactLogMapper::getInstance($this->adapter);
|
| 98 |
$paginator = $discoveryContactMapper->fetchAllDataTableForCompanyIdAndContactId($currentCompany->id, $currentUser->id, $page, $records_x_page);
|
98 |
$paginator = $discoveryContactMapper->fetchAllDataTableForCompanyIdAndContactId($currentCompany->id, $currentUser->id, $page, $records_x_page);
|
| 99 |
$items = [];
|
99 |
$items = [];
|
| 100 |
$records = $paginator->getCurrentItems();
|
100 |
$records = $paginator->getCurrentItems();
|
| 101 |
return new JsonModel([
|
101 |
return new JsonModel([
|
| 102 |
'success' => true,
|
102 |
'success' => true,
|
| Línea 103... |
Línea 103... |
| 103 |
'records' => $records
|
103 |
'records' => $records
|
| 104 |
]);
|
104 |
]);
|
| 105 |
// } else {
|
105 |
} else {
|