本文整理汇总了PHP中menu::load方法的典型用法代码示例。如果您正苦于以下问题:PHP menu::load方法的具体用法?PHP menu::load怎么用?PHP menu::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类menu
的用法示例。
在下文中一共展示了menu::load方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
/>
绑定已有模块</td>
<td id="tableTips" colspan="2">请以字母开头,留空将按模块名称拼音</td>
</tr>
<tr class="nobg">
<td class="td80">模块说明:</td>
<td class="rowform"><textarea rows="6" onkeyup="textareasize(this)" name="desc" id="desc" cols="50" class="tarea"><?php
echo $rs['desc'];
?>
</textarea></td>
<td class="tips2" colspan="2">100字以内</td>
</tr>
<tr class="nobg">
<td class="td80">菜单位置:</td>
<td class="rowform"><?php
foreach (menu::load() as $H => $value) {
if ($rs['table'] != $H) {
$rs['position'] == $H && ($checked = ' checked="checked" ');
echo '<span id="pos' . $H . '" class="pos"></span><input type="radio" name="position" class="radio" value="' . $H . '"' . $checked . '/> ' . UI::lang('header_' . $H) . '<br /><br />';
}
}
?>
</td>
<td class="tips2" colspan="2">选择菜单所在位置</td>
</tr>
<thead>
<tr>
<th colspan="4">快捷链接</th>
</tr>
</thead>
<tr class="nobg">
示例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;
}