function delete() { if (!($article = Menu::getById((int) $_GET['id']))) { header("Location:index.php?menu=view&error=articleNotFound"); return; } //! @todo рекурсивное удаление $article->delete(); header("Location:index.php?menu=view&status=articleDeleted"); }
public function create($aPostData) { $aData = $aPostData['page']; $aMenuData = $aPostData['menu']; $content = trim(stripslashes($aData['content'])); if (isset($aData['id'])) { $this->id = $aData['id']; $this->edited = new Doctrine_Expression("now()"); if ($this->content != $content) { $this->backupPage(); } } else { $this->created = new Doctrine_Expression("now()"); $this->edited = new Doctrine_Expression("now()"); } $this->pname = $aData['pname']; $this->link = Webbers_Normalize::Link($aData['pname']); $this->hd_title = $aData['hd_title']; $this->hd_keywords = $aData['hd_keywords']; $this->content = $content; $this->active = $aData['active']; $this->owner = Zend_Auth::getInstance()->getIdentity()->username; $this->template = isset($aData['template']) ? $aData['template'] : null; $this->save(); if ($aData['menuitem'] == '0') { if (is_array($aMenuData) and $aMenuData['mname'] != '0') { $aMenuData['mname'] = $this->pname; $aMenuData['active'] = $aData['active']; $aMenuData['Pages_id'] = $this->id; $aMenuData['link'] = '/pages/' . $this->link; $menu = new Menu(); $menu->updateMenu($aMenuData); } } else { $menu = Menu::getById($aData['menuitem']); if ($menu->Pages_id > 0) { $oldMenu = Menu::getMenusByPageId($this->id); if ($oldMenu) { $oldMenu->Pages_id = $menu->Pages_id; $oldMenu->save(); } } $menu->mname = $this->pname; $menu->active = $aData['active']; $menu->Pages_id = $this->id; $menu->link = '/pages/' . $this->link; $menu->save(); } return $this->id; }
$localidad = Localidad::getByCP($_SESSION['cp']); echo $localidad->getValueEncoded("nombre"); echo "</td></tr>"; echo "<tr><th>Direccion</th><td>" . $_SESSION['direccion'] . "</td></tr>"; echo "<tr><th>Comensales</th><td>" . $_SESSION['comensales'] . "</td></tr>"; ?> <tr> <th>MENU</th> <th></th> </tr> <?php list($platos) = Menu::getByMenu($_SESSION['id_menu']); foreach ($platos as $plato) { echo "<tr><td>" . $plato->getValueEncoded("nombre") . "</td><td></td></tr>"; } $menu = Menu::getById($_SESSION['id_menu']); $_SESSION['precio'] += $menu->getValueEncoded("precio"); $_SESSION['precio'] *= $_SESSION['comensales']; echo "<tr><th>DECORACION</th><th></th></tr>"; $decoracion = Decoracion::getById($_SESSION['id_decoracion']); echo "<tr><td>" . $decoracion->getValueEncoded("nombre") . "</td><td></td></tr>"; echo "<tr><th>VINO</th>\n <th></th>\n\t\t\t\t</tr>"; $bebida = $_SESSION['bebidas']; $cantidad = $_SESSION['cantidad']; $bebidas = Bebida::getById($bebida); echo "<tr><th>Nombre</th><td>" . $bebidas->getValueEncoded("nombre") . "</td></tr>"; echo "<tr><th>Precio</th><td>" . $bebidas->getValueEncoded("precio") . "€</td></tr>"; echo "<tr><th>Cantidad</th><td>" . $cantidad . "</td></tr>"; $_SESSION['precio'] += $bebidas->getValueEncoded("precio") * $cantidad; echo "<tr><th>TOTAL</th>\n <th></th>\n\t\t\t\t</tr>"; echo "<tr><th>" . $_SESSION['precio'] . "€</th><td></td></tr>";