本文整理汇总了PHP中Menu::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP Menu::getById方法的具体用法?PHP Menu::getById怎么用?PHP Menu::getById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu::getById方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
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");
}
示例2: create
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;
}
示例3: list
$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>";