本文整理汇总了PHP中Menu::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Menu::delete方法的具体用法?PHP Menu::delete怎么用?PHP Menu::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Menu
的用法示例。
在下文中一共展示了Menu::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_delete
/**
* CRUD controller: DELETE
*/
public function action_delete()
{
$this->auto_render = FALSE;
Menu::delete($this->request->param('id'));
Alert::set(Alert::SUCCESS, __('Menu deleted'));
HTTP::redirect(Route::url('oc-panel', array('controller' => 'menu', 'action' => 'index')));
}
示例2: eliminarAction
public function eliminarAction()
{
$this->view->subtitle = $this->info->sitio->menu->eliminar->titulo;
$item = new Menu();
if ($this->_request->isPost()) {
Zend_Loader::loadClass('Zend_Filter_Alpha');
$filter = new Zend_Filter_Alpha();
$id = (int) $this->_request->getPost('id');
$del = $filter->filter($this->_request->getPost('del'));
if ($del == 'Si' && $id > 0) {
$where = 'id = ' . $id;
$rows_affected = $item->delete($where);
}
} else {
$id = (int) $this->_request->getParam('id');
if ($id > 0) {
$this->view->item = $item->fetchRow('id=' . $id);
if ($this->view->item->id > 0) {
$this->render();
return;
}
}
}
$this->_redirect('/admin/menu/');
}
示例3: delete
function delete($id = FALSE)
{
if ($id) {
$menu = new Menu($id);
$menu->delete_file('uploads/icon/', 'icon');
$menu->delete();
set_notify('success', lang('delete_data_complete'));
}
redirect('menus/admin/menus');
}
示例4: display
public function display()
{
$template = new Template();
if (!isset($_GET['delete'])) {
$template->load("menu_delete");
$template->assign_var("CANCELURL", "javascript:history.back()");
$template->assign_var("DELETEURL", $this->page->GetUrl("menu=" . urlencode($_GET['menu']) . "&delete=true"));
} else {
$template->load("message");
if (Menu::delete(DataBase::Current()->EscapeString($_GET['menu']))) {
$template->assign_var("MESSAGE", Language::DirectTranslate("MENU_DELETED"));
} else {
$template->assign_var("MESSAGE", Language::DirectTranslate("MENU_NOT_DELETED"));
}
}
$template->output();
}
示例5: AdminPage
<?php
require_once "config.php";
$page = new AdminPage();
if (isset($_GET['id'])) {
$menu = new Menu();
$menu->delete($_GET['id']);
}
$referrer = $_SERVER['HTTP_REFERER'];
header("Location: " . $referrer);
示例6: Menu
include '../../../po-library/po-config.php';
include '../../po-component/po-menumanager/includes/config.php';
include '../../po-component/po-menumanager/includes/class.php';
$mod = $_GET[mod];
$act = $_GET[act];
if ($mod == 'menu' and $act == 'add') {
$instance = new Menu();
$instance->add();
} elseif ($mod == 'menu' and $act == 'edit') {
$instance = new Menu();
$instance->edit();
} elseif ($mod == 'menu' and $act == 'save') {
$instance = new Menu();
$instance->save();
} elseif ($mod == 'menu' and $act == 'save_position') {
$instance = new Menu();
$instance->save_position();
} elseif ($mod == 'menu' and $act == 'delete') {
$instance = new Menu();
$instance->delete();
} elseif ($mod == 'menu_group' and $act == 'add') {
$instance = new Menu_group();
$instance->add();
} elseif ($mod == 'menu_group' and $act == 'edit') {
$instance = new Menu_group();
$instance->edit();
} elseif ($mod == 'menu_group' and $act == 'delete') {
$instance = new Menu_group();
$instance->delete();
}
}
示例7: menu_delete_form_submit
function menu_delete_form_submit($data)
{
$menu = new Menu();
$delete = $menu->delete($data['id']);
if ($delete['code'] == 200) {
natural_set_message('Menu has been removed successfully!', 'success');
return $data['id'];
} else {
natural_set_message('Problems loading menu ' . $data['id'], 'error');
return FALSE;
}
}
示例8: Session
<?php
require_once '../model/paths.php';
$session = new Session();
if (!$session->isLogin) {
redirect("../login.php");
}
$database = new Database();
$user = new User();
$menu = new Menu();
$links = new Links();
$pages = new Page();
if (isset($_GET['menuid']) && $_GET['menuid'] != null) {
$menuId = $database->escapeString($_GET['menuid']);
$links->setMenuId($menuId);
$menu->setMenuId($menuId);
// look if this menu is a main menu
$isMain = $menu::getMainMenuId($database);
// delete menu with his links
if ($links->deleteByMenu($database) && $menu->delete($database)) {
// make main menu the next top menu
if ($isMain == $menuId) {
$menu->makeTopMenuToMain($database);
}
redirect("../pages.php?pages=4");
} else {
echo "<h1>Contact your administrator</h1>";
}
} else {
echo "<h1>DELETION FAILED! Go back and try again or contact your administrator</h1>";
}
示例9: editMenu
function editMenu()
{
$mname = $_POST['mname'] ? addslashes($_POST['mname']) : "New Menu";
$murl = $_POST['murl'] ? addslashes($_POST['murl']) : "New URL";
$msub = $_POST['msub'] ? addslashes($_POST['msub']) : "";
$mid = $_POST['mid'] ? addslashes($_POST['mid']) : 0;
$mode = addslashes($_GET['mode']);
$json = array();
$menu = new Menu();
if ($mode == "add") {
$menu->menu_name = $mname;
$menu->menu_link = $murl;
$menu->menu_parent_id = -1;
$menu->menu_submenu_titletext = $msub;
$json['bool'] = $menu->save();
} elseif ($mode == "del") {
$json['bool'] = $menu->delete($mid);
} else {
$menu->getByID($mid);
$menu->menu_name = $mname;
$menu->menu_link = $murl;
$menu->menu_submenu_titletext = $msub;
$menu->load = 1;
$json['bool'] = $menu->save();
}
echo json_encode($json);
}
示例10: Menu
<?php
header("Content-type: application/json; charset=iso-8859-1", true);
require_once '../../lib/php/conn.php';
require_once '../../models/Menu.php';
$data = new Menu();
foreach ($_REQUEST as $key => $value) {
$_REQUEST[$key] = utf8_decode($value);
}
if ($_REQUEST['acao'] == 1 && $_REQUEST['operacao'] == 2) {
if ($data->add()) {
echo json_encode(array('success' => 1));
} else {
echo json_encode(array('success' => 0));
}
} elseif ($_REQUEST['acao'] == 2 && $_REQUEST['operacao'] == 2) {
if ($data->edit()) {
echo json_encode(array('success' => 1));
} else {
echo json_encode(array('success' => 0));
}
} elseif ($_REQUEST['acao'] == 3 && $_REQUEST['operacao'] == 2) {
if ($data->delete()) {
echo json_encode(array('success' => 1));
} else {
echo json_encode(array('success' => 0));
}
}
示例11: delete
public function delete($id)
{
if (permission("menus", "delete")) {
if ($id) {
$data = new Menu($id);
$data->delete();
save_logs('delete', $id);
}
}
redirect("admin/menus");
}
示例12: eliminar
/**
* Método para eliminar
*/
public function eliminar($key)
{
if (!($id = Security::getKey($key, 'eliminar_menu', 'int'))) {
return Redirect::toAction('listar');
}
$menu = new Menu();
if (!$menu->find_first($id)) {
Flash::error('Lo sentimos, pero no se ha podido establecer la información del menú');
return Redirect::toAction('listar');
}
if ($menu->id <= 2) {
Flash::warning('Lo sentimos, pero este menú no se puede eliminar.');
return Redirect::toAction('listar');
}
try {
if ($menu->delete()) {
Flash::valid('El menú se ha eliminado correctamente!');
} else {
Flash::warning('Lo sentimos, pero este menú no se puede eliminar.');
}
} catch (KumbiaException $e) {
Flash::error('Este menú no se puede eliminar porque se encuentra relacionado con otro registro.');
}
return Redirect::toAction('listar');
}
示例13: postProcess
//.........这里部分代码省略.........
case 'manufacturer':
$fieldsRequired = array('id_manufacturer' => 'isUnsignedInt');
if ($this->_fieldsValidate($fieldsRequired)) {
$item->id_item = $id_manufacturer;
$item->type = 'manufacturer';
// $this->l('Manufacturer');
$item->save();
$id = $item->id;
} else {
$this->_errors[] = $this->l('You must enter the required fields');
}
break;
case 'suppliers':
$fieldsRequired = array('title' => 'isGenericName');
if ($this->_fieldsValidate($fieldsRequired)) {
$item->type = 'suppliers';
// $this->l('Suppliers');
$item->save();
$id = $item->id;
} else {
$this->_errors[] = $this->l('You must enter the required fields');
}
break;
case 'supplier':
$fieldsRequired = array('id_supplier' => 'isUnsignedInt');
if ($this->_fieldsValidate($fieldsRequired)) {
$item->id_item = $id_supplier;
$item->type = 'supplier';
// $this->l('Supplier');
$item->save();
$id = $item->id;
} else {
$this->_errors[] = $this->l('You must enter the required fields');
}
break;
case 'link':
$fieldsRequired = array('title' => 'isGenericName', 'link' => 'isCleanHtml');
if ($this->_fieldsValidate($fieldsRequired)) {
$item->type = 'link';
// $this->l('Link');
$item->link = $link;
$item->save();
$id = $item->id;
} else {
$this->_errors[] = $this->l('You must enter the required fields');
}
break;
}
if (isset($id)) {
if (isset($reorder) && is_array($reorder) && !is_null($id_menu)) {
foreach ($reorder as $id_parent) {
Menu::remakePosition(intval($id_parent));
}
}
if ($filename = $this->_getFilename($id)) {
//@unlink($filename);
}
$this->_uploadIcon($id);
Tools::redirectAdmin($currentIndex . '&conf=' . (is_null($id_menu) ? 3 : 4) . '&token=' . $this->token);
}
} else {
if (Tools::isSubmit('up')) {
if (Menu::setUpPosition($id_menu)) {
$this->_displayConfirmation($this->l('ok'));
} else {
$this->_errors[] = $this->l('Unable to up this item.');
}
} else {
if (Tools::isSubmit('down')) {
if (Menu::setDownPosition($id_menu)) {
$this->_displayConfirmation($this->l('ok'));
} else {
$this->_errors[] = $this->l('Unable to down this item.');
}
} else {
if (Tools::isSubmit('delete')) {
$menu = new Menu($id_menu);
$menu->delete();
Tools::redirectAdmin($currentIndex . '&conf=1&token=' . $this->token);
} else {
if (Tools::isSubmit('deleteIcon')) {
$filename = $this->_getFilename($id_menu);
$success = false;
if ($filename) {
if (@unlink($filename)) {
$success = true;
}
}
if ($success) {
Tools::redirectAdmin($currentIndex . '&conf=1&token=' . $this->token);
} else {
$this->_errors[] = $this->l('Unable to delete this icon.');
}
}
}
}
}
}
}
}
示例14: Menu
<?php
include_once 'class/menu.class.php';
// Insert
if (isset($_POST['insert'])) {
$menu = new Menu();
$menu->set_name((string) $_POST['name']);
$menu->set_unit((string) $_POST['unit']);
$menu->set_cost((double) $_POST['cost']);
Menu::save($menu);
die('1');
}
// Update
if (isset($_POST['update'])) {
$menu = new Menu();
$menu->set_id((int) $_POST['id']);
$menu->set_name((string) $_POST['name']);
$menu->set_unit((string) $_POST['unit']);
$menu->set_cost((double) $_POST['cost']);
Menu::save($menu);
die('1');
}
// Delete
if (isset($_POST['delete'])) {
Menu::delete((int) $_POST['id']);
die('1');
}
$menus = Menu::getAll();
$smarty->assign('menus', $menus);
$smarty->display('menu.tpl');
示例15: eliminar
/**
* Método para eliminar
*/
public function eliminar($key)
{
if (!($id = MkcSecurity::isValidKey($key, 'eliminar_menu', 'int'))) {
return MkcRedirect::toAction('listar');
}
$menu = new Menu();
if (!$menu->find_first($id)) {
MkcMessage::get('id_no_found');
return MkcRedirect::toAction('listar');
}
if ($menu->id <= 2) {
MkcMessage::warning('Lo sentimos, pero este menú no se puede eliminar.');
return MkcRedirect::toAction('listar');
}
try {
if ($menu->delete()) {
MkcMessage::valid('El menú se ha eliminado correctamente!');
} else {
MkcMessage::warning('Lo sentimos, pero este menú no se puede eliminar.');
}
} catch (KumbiaException $e) {
MkcMessage::error('Este menú no se puede eliminar porque se encuentra relacionado con otro registro.');
}
return MkcRedirect::toAction('listar');
}