public function deleteAction() { $id = $this->getEvent()->getRouteMatch()->getParam('id'); if ($this->getRequest()->isXmlHttpRequest()) { $aRow = $this->getCreateUpdateTable()->getRow($id); if ($aRow) { $this->getCreateUpdateTable()->deleteRow($id); } $xml = Info::setXMLInfo(array('status' => 1, 'error' => 'ok')); $this->getResponse()->getHeaders()->addHeaders(array('Content-type' => 'text/xml')); return $this->getResponse()->setContent($xml); } }
public function deleteAction() { if ($this->getRequest()->isXmlHttpRequest()) { $id_slownika = $this->getEvent()->getRouteMatch()->getParam('id_slownika'); $id = $this->getEvent()->getRouteMatch()->getParam('id'); $aSlownik = \My\Tools\Lista::ListaWhere('import_slo', 'id', $id_slownika); if ($aSlownik) { $aWartosci = \My\Tools\Lista::ListaWhere($aSlownik['nazwa'], 'id', $id); if ($aWartosci) { $bUpdate = \My\Tools\Lista::Update($aSlownik['nazwa'], array('deleted' => 1), $id); if ($bUpdate) { $danexml = \My\Dhtmlx\Info::setXMLInfo(array('status' => 1, 'error' => '')); } else { $danexml = \My\Dhtmlx\Info::setXMLInfo(array('status' => 0, 'error' => 'Błąd podczas dodania danych do słownika.')); } } } $this->getResponse()->getHeaders()->addHeaders(array('Content-type' => 'text/xml')); return $this->getResponse()->setContent($danexml); } }
public function addAction() { if ($this->getRequest()->isXmlHttpRequest()) { $sm = $this->getServiceLocator(); $oFormModel = $sm->get('FormsElementTable'); $oForm = new \My\Dhtmlx\Form(); $request = $this->getRequest(); $id_slownika = $this->getEvent()->getRouteMatch()->getParam('id_slownika'); $aSlownik = \My\Tools\Lista::ListaWhere('import_slo', 'id', $id_slownika); if ($request->isPost()) { $oPost = $request->getPost(); try { $bInsert = \My\Tools\Lista::Insert($aSlownik['nazwa'], $oPost->toArray()); if ($bInsert) { $danexml = \My\Dhtmlx\Info::setXMLInfo(array('status' => 1, 'error' => '')); } else { $danexml = \My\Dhtmlx\Info::setXMLInfo(array('status' => 0, 'error' => 'Błąd podczas dodania danych do słownika.')); } } catch (Exception $e) { $danexml = \My\Dhtmlx\Info::setXMLInfo(array('status' => 0, 'error' => 'Błąd danych. Błąd ' . $e->getMessage())); } } else { $danexml = '<?xml version="1.0"?><items>'; $label = "Add"; $danexml .= '<item type="fieldset" name="krok1" className="formstyle" label="' . $label . '" width="500"> <item type="settings" position="label-left" labelAlign="right"/>'; $aKolumny = \My\Tools\Lista::Kolumny($aSlownik['nazwa']); $aSlownikListAvailable = explode(',', $aSlownik['column_list']); $width_pola = 250; $width_label = 150; $styl = $oForm->getStyle(); $aColumnNameSlo = explode(',', $aSlownik['column_mapping_list']); $i = 0; foreach ($aKolumny as $sKey => $column) { $sKolumna = $sKey; if ($sKolumna != 'id' && in_array($column->getName(), $aSlownikListAvailable)) { $danexml .= '<item type="input" required="1" name="' . $column->getName() . '" value="" label="' . $aColumnNameSlo[$i] . ':" inputWidth="' . $width_pola . '" labelWidth="' . $width_label . '" tolltip="tre" style="' . $styl . '">'; $danexml .= '<note>' . $column->getDataType() . ' ' . $column->getCharacterMaximumLength() . '</note>'; $danexml .= '</item>'; $i++; } } $danexml .= '</item>'; $danexml .= '<item type="button" name="save" offsetLeft="350" width="150" value="Save"/>'; $danexml .= '</items>'; } $this->getResponse()->getHeaders()->addHeaders(array('Content-type' => 'text/xml')); return $this->getResponse()->setContent($danexml); } }
public function calculeslabAction() { $fOneMeterToInch = 39.37; $fMeterToInch = 10.76; if ($this->getRequest()->isXmlHttpRequest()) { $lenghtInch = $this->getEvent()->getRouteMatch()->getParam('lenght'); $widthInch = $this->getEvent()->getRouteMatch()->getParam('width'); $fSqftPrice = $this->getEvent()->getRouteMatch()->getParam('sqft_price'); //post przelicza metry z forma calcule $lenghtMeter = number_format($lenghtInch / $fOneMeterToInch, 2); $widthMeter = number_format($widthInch / $fOneMeterToInch, 2); $fSlabPrice = round($fSqftPrice * $fMeterToInch * ($lenghtMeter * $widthMeter), 2); $xml = Info::setXMLInfo(array('status' => 1, 'length' => $lenghtInch, 'width' => $widthInch, 'sqft_price' => $fSqftPrice, 'slab_price' => $fSlabPrice)); $this->getResponse()->getHeaders()->addHeaders(array('Content-type' => 'text/xml')); return $this->getResponse()->setContent($xml); } }