本文整理汇总了PHP中MenuItem::update方法的典型用法代码示例。如果您正苦于以下问题:PHP MenuItem::update方法的具体用法?PHP MenuItem::update怎么用?PHP MenuItem::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MenuItem
的用法示例。
在下文中一共展示了MenuItem::update方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
require 'templates/sidebar.php';
$alert = array();
if (isset($_POST['submit'])) {
// FIRSTLY SET ALL THE MENU ITEMS AS UNAVAILABLE
$db = Database::getInstance();
if (!$db->handle->query("UPDATE menu_item SET available = 0")) {
die("ERROR!");
}
// UPDATE ALL THE MENU ITEMS RETURNED MAKING AVAILABLE 1
if (isset($_POST['final_menu'])) {
$selectedItems = $_POST['final_menu'];
$itemObj = new MenuItem();
foreach ($selectedItems as $key => $value) {
$itemObj->id = $value;
$itemObj->available = 1;
$itemObj->update();
}
}
}
if (isset($_GET['success']) && $_GET['success'] == 'edit') {
$alert['success'] = "The menu item was successfully updated.";
}
?>
<div class="row" style="margin-right: 0">
<div class="col-md-6 col-md-offset-3 page-wrapper">
<h2>View Menu Item(s)</h2>
<hr>
<form action="menu.view.php" method="post">
<h3>Today's Menu<a class="btn btn-default btn-sm pull-right" onclick="toggleAll('today-menu',this)">Expand All</a></h3>
<hr>
示例2: updateItem
public function updateItem($parentID, $item)
{
$menuItemData = new MenuItem();
$menuIndex = new MenuItemIndex();
$menuItemData->update(array('MID_Style' => $item['Style'], 'MID_Show' => $item['MID_Show'], 'MID_Secured' => $item['menuItemSecured'], 'MID_Image' => $item['menuImage'], 'MID_loadImage' => $item['loadImage'], 'MID_ImgAndTitle' => $item['menuImgAndTitle']), $this->_db->quoteInto('MID_ID = ?', $parentID));
$where = array();
$where[] = $this->_db->quoteInto('MII_MenuItemDataID = ?', $parentID);
$where[] = $this->_db->quoteInto('MII_LanguageID = ?', $item['languageID']);
$row = $menuIndex->fetchRow($where);
if ($row) {
// $menuItemData->update(
// array('MID_Style' => $item['Style']),
// $this->_db->quoteInto('MID_ID = ?', $parentID)
// );
$menuIndex->update(array('MII_Title' => $item['Title'], 'MII_Link' => !empty($item['Link']) ? $item['Link'] : '', 'MII_PageID' => !empty($item['PageID']) ? $item['PageID'] : '-1', 'MII_Placeholder' => $item['Placeholder']), $where);
} else {
$menuIndex->insert(array('MII_Title' => $item['Title'], 'MII_Link' => !empty($item['Link']) ? $item['Link'] : '', 'MII_PageID' => !empty($item['PageID']) ? $item['PageID'] : '-1', 'MII_Placeholder' => $item['Placeholder'], 'MII_MenuItemDataID' => $parentID, 'MII_LanguageID' => $item['languageID']));
}
}
示例3: updateMenuItem
function updateMenuItem($menu_item)
{
return MenuItem::update($menu_item);
}
示例4: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update(MenuItem $menuItem)
{
// define rules
$rules = array('name' => array('required'), 'position' => array('required'));
// pass input to validator
$validator = Validator::make(Input::all(), $rules);
// test if input fails
/* @TODO : Faire fonctionner le Validator de l'Update !! (a priori, problème avec méthode Edit également) */
if ($validator->fails()) {
return Redirect::route('admin.menu.edit', $id)->withErrors($validator)->withInput();
}
$name = Input::get('name');
$route = Input::get('route');
$position = Input::get('position');
$menuItem->name = $name;
$menuItem->route = $route;
$menuItem->position = $position;
$menuItem->update();
return Redirect::route('admin.menu.edit')->withMessage("L'article a été modifié");
}
示例5: MenuItem
<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL | E_STRICT);
require 'config.php';
require 'models/menu-item.class.php';
$menuItem = new MenuItem();
if (isset($_POST["delete_id"])) {
$id = $_POST['delete_id'];
$menuItem->delete($id);
} else {
if (isset($_POST['id'])) {
$name = $_POST['name'];
$description = $_POST['description'];
$price = $_POST['price'];
$id = $_POST['id'];
$menuItem->update($id, $name, $description, $price, 'lunch');
} else {
if (isset($_POST['add'])) {
$name = $_POST['name'];
$description = $_POST['description'];
$price = $_POST['price'];
$menuItem->create($name, $description, $price, 'lunch');
}
}
}
示例6: array
require_once '../includes/functions.php';
require 'templates/header.php';
$header = "menu";
$page = "edit";
require 'templates/navbar.php';
require 'templates/sidebar.php';
$alert = array();
if (isset($_POST['submit'])) {
$menu_item = new MenuItem();
$menu_item->instantiate($_POST);
if (isset($_POST['halfs'])) {
$menu_item->halfs = true;
} else {
$menu_item->halfs = false;
}
if ($menu_item->update()) {
redirect_to('menu.view.php?success=edit');
} else {
redirect_to('menu.view.php?error=edit');
}
}
if (isset($_GET['id'])) {
$id = intval($_GET['id']);
$menu_item = MenuItem::select(array('id' => $id));
if (!is_object($menu_item)) {
redirect_to('menu.view.php');
}
?>
<div class="row" style="margin-right: 0">
<div class="col-md-6 col-md-offset-3 page-wrapper">
<h2>Add New Menu Item</h2>