function getFormElement($id) { if ($e = $this->query('form' . ($id ? '[@id="' . $id . '"]' : null))->item(0)) { $xml = new xml(null, null, false); return $xml->appendChild($xml->importNode($e)); } }
function getForm($id, $isSettingsForm = false) { if (($xml = $this->getDataXML()) && ($e = $xml->query('//form[@id="' . $id . '"]')->item(0))) { $xml = new xml(null, null, false); $form = new form($xml->appendChild($xml->importNode($e))); $mysql = new mysql(); $sec = $this->getSection(); $form->replaceURI(array('TABLE' => $mysql->getTableName($this->table), 'MODULE' => $this->getId(), 'CONFIG_MODULE' => $this->getConf('module'), 'SECTION' => $sec->getId(), 'ROW' => $isSettingsForm ? null : $this->getRow(), 'PATH_DATA_FILE_CLIENT' => ABS_PATH_DATA_CLIENT . ap::id($sec->getId()) . '.xml', 'PATH_DATA_FILE_AP' => ABS_PATH_DATA_AP . ap::id($sec->getId()) . '.xml', 'PATH_SITE' => ABS_PATH_SITE)); return $form; } }
function deleteRow($row) { if ($row && ($rl = $this->getList())) { if (!is_array($row)) { $row = array($row); } $form = $this->getForm('edit'); foreach ($row as $id) { $xml = new xml(); $f = new formGallery($xml->appendChild($xml->importNode($form->getRootElement()->cloneNode(true)))); $f->replaceURI(array('ID' => $id, 'TABLE' => $rl->getTableName(), 'SECTION' => $this->getSection()->getId())); $f->deleteImages($id); $rl->deleteRow($id); } return true; } }
static function ajaxResponse($val, $message = null) { if ($val instanceof xml) { $xml = $val; } elseif ($val instanceof DOMElement) { $xml = new xml(); $xml->appendChild($xml->importNode($val)); } else { $xml = new xml(null, 'response', false); $xml->de()->appendChild($xml->createElement('value', null, $val)); if ($message) { $xml->de()->appendChild($xml->createElement('message', null, $message)); } } if ($xml) { header('Content-Type: text/xml; charset=utf-8'); echo $xml; } die; }