本文整理汇总了PHP中Menu::updateMenu方法的典型用法代码示例。如果您正苦于以下问题:PHP Menu::updateMenu方法的具体用法?PHP Menu::updateMenu怎么用?PHP Menu::updateMenu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu::updateMenu方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: updateQuickEdit
public function updateQuickEdit()
{
$arrReturn = ['status' => 'error'];
$id = (int) Input::get('pk');
$name = (string) Input::get('name');
$value = Input::get('value');
try {
$page = Page::findorFail($id);
if ($name == 'active') {
$page->active = (int) $value;
$page = Menu::updateMenu($page, 'add');
} else {
if ($name == 'on_menu') {
$type = $value ? 'add' : 'delete';
$page = Menu::updateMenu($page, $type);
} else {
$page->{$name} = $value;
}
}
} catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
return App::abort(404);
}
$pass = $page->valid();
if ($pass->passes()) {
$page->save();
$arrReturn = ['status' => 'ok'];
$arrReturn['message'] = $page->name . ' has been saved';
} else {
$arrReturn['message'] = '';
$arrErr = $pass->messages()->all();
foreach ($arrErr as $value) {
$arrReturn['message'] .= "{$value}\n";
}
}
$response = Response::json($arrReturn);
$response->header('Content-Type', 'application/json');
return $response;
}
示例3: array
$url = ADMIN_URL . "/menu_manager/edit.php";
$general->redirectUrl($url, $num);
exit;
} else {
if ($_REQUEST['order'] == "") {
$_SESSION['msg'] = 'Please enter order.';
$num = 'danger';
$num .= '&id=' . $_REQUEST['id'];
$url = ADMIN_URL . "/menu_manager/edit.php";
$general->redirectUrl($url, $num);
exit;
}
}
$cond = array("id" => $_REQUEST['id']);
$fieldvalues = array('name' => $_REQUEST['name'], 'order_index' => $_REQUEST['order'], 'is_dashboard_icon' => $_REQUEST['dashboard']);
$updated = $Menu->updateMenu($fieldvalues, $cond);
if ($updated) {
$general->addLogAction($_SESSION['adm_user_id'], 'Edited', $_REQUEST['id'], 'Menu Management', $_SESSION['adm_status']);
$error = 'success';
$_SESSION['msg'] = 'Record updated successfully.';
} else {
$error = 'danger';
$_SESSION['msg'] = 'Error updating record.';
}
$url = ADMIN_URL . "/menu_manager/index.php";
$general->redirectUrl($url, $error);
exit;
}
/*************************************************************************************/
if (isset($_REQUEST['FLAG']) && $_REQUEST['FLAG'] == 'DELETE') {
$id = $_REQUEST['id'];
示例4: menuaddAction
public function menuaddAction()
{
$form = $this->formPages('menuadd');
$error = false;
if (!$this->getRequest()->isPost()) {
$this->_flash('/admin/pages', 'Błędne odowołanie siŧ do strony!');
return;
}
if (!$_POST or !$form->isValid($_POST)) {
$this->view->message = $form->getMessages();
$error = true;
} else {
$menu = new Menu();
try {
$menu->updateMenu($_POST);
} catch (Exception $e) {
$error = true;
$this->view->message = $e->getMessage();
}
}
if ($error) {
$this->_flash('/admin/pages', $this->view->message);
return;
}
$this->_flash('/admin/pages', 'Poprawnie dodano element menu!');
}
示例5: Menu
<?php
session_start();
require_once '../classes/connection.class.php';
require_once '../classes/menu.class.php';
require_once '../classes/locate.class.php';
if (isset($_POST['submit'])) {
$menu_id = $_POST['menu_id'];
$menu_category = $_POST['menu_category'];
$menu_title = $_POST['menu_title'];
$menu_price = $_POST['menu_price'];
//$category_title=$_POST['category_title'];
}
$updateMenuObj = new Menu();
$updateMenuObj->setMenuID($menu_id);
$updateMenuObj->setMenuCategory($menu_category);
$updateMenuObj->setMenuTitle($menu_title);
$updateMenuObj->setMenuPrice($menu_price);
//$updateMenuObj->setCategoryTitle($category_title);
$flag = $updateMenuObj->updateMenu();
/*echo '<pre>';
print_r($flag);
echo '</pre>';
exit;*/
if ($flag) {
$_SESSION['update_menu'] = "The menu successfully updated";
new Locate('../index.php?page=menu&action=view');
} else {
$_SESSION['update_not_menu'] = "The menu couldn't be updated";
new Locate('../index.php?page=menu&action=view');
}
示例6: Menu
<?php
//Get from textbox
$name = $_POST['menu_name'];
$desc = $_POST['menu_description'];
$price = $_POST['menu_price'];
$id = $_POST['menu_id'];
//Instances of Classes
include '../classes/class.menu.php';
//assigning of values from Instance
$p = new Menu();
$p->menu_id = $id;
$p->menu_name = $name;
$p->menu_description = $desc;
$p->menu_price = $price;
//calling of method Save
if ($p->updateMenu()) {
header('Location:../public/menu_2.php');
} else {
echo Database::$conn->error;
}