mirror of
https://github.com/devcode-it/openstamanager.git
synced 2024-12-29 09:11:11 +01:00
39 lines
1.2 KiB
PHP
39 lines
1.2 KiB
PHP
<?php
|
|
|
|
include_once __DIR__.'/../../../core.php';
|
|
|
|
switch ($resource) {
|
|
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) {
|
|
$filter[] = 'idimpianto='.prepare($element);
|
|
}
|
|
|
|
$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';
|
|
|
|
$results = AJAX::completeResults($query, $where, $filter, $search, $custom);
|
|
foreach ($results as $key => $value) {
|
|
$matricola = \Util\Ini::getValue($r['contenuto'], 'Matricola');
|
|
|
|
$results[$key]['text'] = (empty($matricola) ? '' : $matricola.' - ').$results[$key]['text'];
|
|
|
|
unset($results[$key]['content']);
|
|
}
|
|
}
|
|
|
|
break;
|
|
}
|