2018-02-04 09:41:46 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
include_once __DIR__.'/../../../core.php';
|
|
|
|
|
|
|
|
switch ($resource) {
|
2020-08-14 09:55:05 +02:00
|
|
|
/*
|
|
|
|
* Opzioni utilizzate:
|
|
|
|
* - matricola
|
|
|
|
*/
|
2018-02-04 09:41:46 +01:00
|
|
|
case 'componenti':
|
|
|
|
if (isset($superselect['marticola'])) {
|
|
|
|
$query = 'SELECT id, nome AS descrizione, contenuto FROM my_impianto_componenti |where| ORDER BY id';
|
|
|
|
|
|
|
|
foreach ($elements as $element) {
|
2019-05-17 19:17:12 +02:00
|
|
|
$filter[] = 'id='.prepare($element);
|
2018-02-04 09:41:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$temp = [];
|
|
|
|
$impianti = explode(',', $superselect['marticola']);
|
|
|
|
foreach ($impianti as $key => $idimpianto) {
|
|
|
|
$temp[] = 'idimpianto='.prepare($idimpianto);
|
|
|
|
}
|
|
|
|
$where[] = '('.implode(' OR ', $temp).')';
|
|
|
|
|
|
|
|
if (!empty($search)) {
|
|
|
|
$search_fields[] = 'nome LIKE '.prepare('%'.$search.'%');
|
|
|
|
}
|
|
|
|
|
|
|
|
$custom['contenuto'] = 'contenuto';
|
|
|
|
|
2019-02-22 10:37:37 +01:00
|
|
|
$results = AJAX::selectResults($query, $where, $filter, $search, $limit, $custom);
|
2019-05-17 18:58:37 +02:00
|
|
|
$data = $results['results'];
|
|
|
|
foreach ($data as $key => $value) {
|
2018-02-04 09:41:46 +01:00
|
|
|
$matricola = \Util\Ini::getValue($r['contenuto'], 'Matricola');
|
|
|
|
|
2019-05-17 18:58:37 +02:00
|
|
|
$data[$key]['text'] = (empty($matricola) ? '' : $matricola.' - ').$data[$key]['text'];
|
2018-02-04 09:41:46 +01:00
|
|
|
|
2019-05-17 18:58:37 +02:00
|
|
|
unset($data[$key]['content']);
|
2018-02-04 09:41:46 +01:00
|
|
|
}
|
2019-05-17 18:58:37 +02:00
|
|
|
|
|
|
|
$results['results'] = $data;
|
2018-02-04 09:41:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|