function changeDIDfilter($smarty, $module_name, $local_templates_dir, $pDB, $arrConf, $credentials) { $jsonObject = new PaloSantoJSON(); $pDID = new paloDidPBX($pDB); $prop["country"] = getParameter("country"); $prop["city"] = getParameter("city"); $listDID = $pDID->getDIDFree($prop); if ($listDID === false) { $jsonObject->set_error(_tr("An error has ocurred to retrieve DID data")); } else { $arrDID = array(); if (count($listDID) > 0) { //debemos quitar de la lista de did aquellos que ya han sido seleccionados $selectDID = getParameter("listDIDOrg"); if (!empty($selectDID)) { $listDIDOrg = explode(",", $selectDID); foreach ($listDID as $value) { if (!in_array($value['id'], $listDIDOrg)) { $arrDID[] = array('id' => $value['id'], 'did' => $value['did'], 'country_code' => $value['country_code'], 'area_code' => $value['area_code']); } } } else { foreach ($listDID as $value) { $arrDID[] = array('id' => $value['id'], 'did' => $value['did'], 'country_code' => $value['country_code'], 'area_code' => $value['area_code']); } } } $jsonObject->set_message($arrDID); } return $jsonObject->createJSON(); }