/**
  * Delete Menu Item
  */
 public function ajaxDeleteAction()
 {
     $menuId = (int) $this->_getParam('menuId');
     if ($menuId === 0) {
         $msg = __("Deleting root menu is not allowed!");
     } else {
         // TODO: execute deletion of menu id, temporarily placed it here
         //       since ORM DELETE is not fully implemented
         $objMenu = new MenuItem();
         $objMenu->menuId = $menuId;
         if ($objMenu->delete()) {
             $msg = __("Successfully deleted Menu Item: {$menuId}");
         } else {
             $msg = __("Failed to deleted Menu Item: {$menuId}");
         }
     }
     $data = array('msg' => $msg);
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct($data);
 }
예제 #2
0
 /**
  * Deletes self and passes the call to parent class
  * @see solidbase/lib/MenuItem#delete()
  */
 function delete()
 {
     global $DB;
     if ($this->mayI(DELETE)) {
         $DB->metadata->delete($this->ID);
         $DB->content->delete($this->ID, false);
         $DB->spine->delete($this->ID);
         return parent::delete();
     } else {
         return false;
     }
 }
예제 #3
0
<?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');
        }
    }
}
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(MenuItem $menuItem)
 {
     /*$menuItem = MenuItem::findOrFail($id);*/
     $menuItem->delete();
     return Redirect::route('admin.menu.index')->withMessage("L'onglet a été supprimé");
 }
예제 #5
0
$consoleObj = new ConsoleOption($mysqli);
$member = new Member($mysqli);
$member->select($_SESSION['btUsername']);
$menuCatObj = new MenuCategory($mysqli);
$menuItemObj = new MenuItem($mysqli);
$cID = $consoleObj->findConsoleIDByName("Manage Menu Items");
$consoleObj->select($cID);
$_GET['cID'] = $cID;
if ($member->authorizeLogin($_SESSION['btPassword'])) {
    $memberInfo = $member->get_info_filtered();
    if ($member->hasAccess($consoleObj) && $menuItemObj->select($_POST['itemID'])) {
        $menuItemInfo = $menuItemObj->get_info_filtered();
        if ($_POST['confirm'] == "1") {
            $menuCatObj->select($menuItemInfo['menucategory_id']);
            $refreshSection = $menuCatObj->get_info("section");
            $menuItemObj->delete();
            $menuItemObj->resortOrder();
            include "include/menuitemlist.php";
            /*
            echo "
            
            	<script type='text/javascript'>
            
            		$(document).ready(function() {
            		
            			$.post('".$MAIN_ROOT."themes/_refreshmenus.php', { refreshSectionID: '".$refreshSection."' }, function(data) {
            				$('#menuSection_".$refreshSection."').html(data);		
            			});
            		
            		});