本文整理汇总了PHP中menu::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP menu::delete方法的具体用法?PHP menu::delete怎么用?PHP menu::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类menu
的用法示例。
在下文中一共展示了menu::delete方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
function delete($id)
{
$menu = new menu($id);
//delete bannercat
$menuitem = new menuitem();
$menuitem->where('menu_id', $id);
$menuitem->get_iterated();
if ($menuitem->result_count() > 0) {
flash_message('error', 'Không thể xóa menu gốc, vui lòng xóa menu con trước');
} else {
$menu->delete();
flash_message('success', 'Menu đã được xóa');
}
redirect($this->admin . 'menus/list_all/');
}
示例2: run
function run()
{
global $user;
global $layout;
global $DB;
$out = '';
$item = new menu();
switch ($_REQUEST['act']) {
case 'json':
case 1:
// json data retrieval & operations
switch ($_REQUEST['oper']) {
case 'del':
// remove rows
$ids = $_REQUEST['ids'];
foreach ($ids as $id) {
$item->load($id);
$item->delete();
}
echo json_encode(true);
break;
default:
// list or search
$page = intval($_REQUEST['page']);
$max = intval($_REQUEST['rows']);
$offset = ($page - 1) * $max;
$orderby = $_REQUEST['sidx'] . ' ' . $_REQUEST['sord'];
$where = " 1=1 ";
if ($_REQUEST['_search'] == 'true' || isset($_REQUEST['quicksearch'])) {
if (isset($_REQUEST['quicksearch'])) {
$where .= $item->quicksearch($_REQUEST['quicksearch']);
} else {
if (isset($_REQUEST['filters'])) {
$where .= navitable::jqgridsearch($_REQUEST['filters']);
} else {
// single search
$where .= ' AND ' . navitable::jqgridcompare($_REQUEST['searchField'], $_REQUEST['searchOper'], $_REQUEST['searchString']);
}
}
}
$DB->queryLimit('id,lid,codename,icon,enabled', 'nv_menus', $where, $orderby, $offset, $max);
$dataset = $DB->result();
$total = $DB->foundRows();
//echo $DB->get_last_error();
$out = array();
for ($i = 0; $i < count($dataset); $i++) {
$out[$i] = array(0 => $dataset[$i]['id'], 1 => $dataset[$i]['codename'], 2 => '<img src="' . NAVIGATE_URL . '/' . $dataset[$i]['icon'] . '" />', 3 => '[' . $dataset[$i]['lid'] . '] ' . t($dataset[$i]['lid'], $dataset[$i]['lid']), 4 => $dataset[$i]['enabled'] == 1 ? '<img src="img/icons/silk/accept.png" />' : '<img src="img/icons/silk/cancel.png" />');
}
navitable::jqgridJson($out, $page, $offset, $max, $total);
break;
}
session_write_close();
exit;
break;
case 'edit':
case 2:
// edit/new form
if (!empty($_REQUEST['id'])) {
$item->load(intval($_REQUEST['id']));
}
if (isset($_REQUEST['form-sent'])) {
$item->load_from_post();
try {
$item->save();
$layout->navigate_notification(t(53, "Data saved successfully."), false, false, 'fa fa-check');
} catch (Exception $e) {
$layout->navigate_notification($e->getMessage(), true, true);
}
}
$out = functions_form($item);
break;
case 'delete':
case 4:
// remove
if (!empty($_REQUEST['id'])) {
$item->load(intval($_REQUEST['id']));
if ($item->delete() > 0) {
$layout->navigate_notification(t(55, 'Item removed successfully.'), false);
$out = functions_list();
} else {
$layout->navigate_notification(t(56, 'Unexpected error.'), false);
$out = functions_form($item);
}
}
break;
case 'list':
case 0:
// list / search result
// list / search result
default:
$out = functions_list();
break;
}
return $out;
}
示例3: __construct
<?php
header('Content-Type: text/html; charset=UTF-8');
require_once 'accessToken.php';
$accessToken = new accessToken();
$ACCESS_TOKEN = $accessToken->access_token();
$menu = new menu($ACCESS_TOKEN);
switch ($_GET["action"]) {
case 'create':
$menu->create();
break;
case 'get':
$menu->get();
break;
case 'delete':
$menu->delete();
break;
}
class menu
{
private $menu;
private $MENU_CREATE_URL;
private $MENU_GET_URL;
private $MENU_DELETE_URL;
public function __construct($ACCESS_TOKEN)
{
if (isset($_SERVER["HTTP_APPNAME"])) {
$storage = new SaeStorage();
$domain = "xycn";
$filename = "menu.json";
$this->menu = $storage->read($domain, $filename);
示例4: menu
<?php
require_once './view/html.php';
$menu = new menu();
$permiso = new Permiso();
$menu->setOrder(" ORDER BY orden");
if ($_GET['op'] == 'insert') {
$menu->setVer($_POST['nombre']);
$menu->insert();
}
if ($_GET['op'] == 'delete') {
$menu->delete($_GET['id']);
}
?>
<!DOCTYPE html>
<html>
<head>
<?php
head_html();
?>
<script type="text/javascript">
var nameTable='menu';
function cargarmenues(id) {
window.frames.subwin.location.href = "./submenu.php?id="+id;
}
</script>
</head>
<body>
<nav>
<?php
nav_html();