Example #1
0
 public function askDelBuilding($request)
 {
     $db = ezcDbInstance::get();
     $lang = R3Locale::getLanguageID();
     $id = forceInteger($request['id'], 0, false, '.');
     $name = $db->query("SELECT bu_name_{$lang} FROM building WHERE bu_id={$id}")->fetchColumn();
     $hasEnergyMeter = R3EcoGisHelper::hasEnergyMeter('BUILDING', $id);
     $hasDocument = R3EcoGisHelper::hasDocument('BUILDING', $id);
     if (!$hasEnergyMeter && !$hasDocument && $this->tryDeleteData($id)) {
         return array('status' => R3_AJAX_NO_ERROR, 'confirm' => sprintf(_("Sei sicuro di voler cancellare l'edificio \"%s\"?"), $name));
     } else {
         return array('status' => R3_AJAX_NO_ERROR, 'alert' => _('Impossibile cancellare questo edificio poichè vi sono dei dati ad esso legati'));
     }
 }
Example #2
0
 /**
  * Return the UDM
  * @param array $request    the request
  * @return array            the result data
  */
 public function confirmDeleteStreetLighting($request)
 {
     $db = ezcDbInstance::get();
     $lang = R3Locale::getLanguageID();
     $id = (int) $request['id'];
     $name = $db->query("SELECT sl_full_name_{$lang} AS sw_title FROM street_lighting_data WHERE sl_id={$id}")->fetchColumn();
     $hasEnergyMeter = R3EcoGisHelper::hasEnergyMeter('STREET_LIGHTING', $id);
     $hasDocument = R3EcoGisHelper::hasDocument('STREET_LIGHTING', $id);
     if (!$hasEnergyMeter && !$hasDocument && $this->tryDeleteData($id)) {
         return array('status' => R3_AJAX_NO_ERROR, 'confirm' => sprintf(_('Sei sicuro di voler cancellare il tratto "%s"?'), $name));
     }
     return array('status' => R3_AJAX_NO_ERROR, 'alert' => sprintf(_('Impossibile cancellare il tratto "%s", poichè vi sono dei dati ad esso associati'), $name));
 }