本文整理汇总了PHP中menu类的典型用法代码示例。如果您正苦于以下问题:PHP menu类的具体用法?PHP menu怎么用?PHP menu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了menu类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_power
function check_power()
{
global $global;
$flag = 0;
if ($global['admin_id']) {
$obj = new admin();
$obj->set_where('adm_id = ' . $global['admin_id']);
$one = $obj->get_one();
if ($one['adm_power'] == 'all') {
$flag = 1;
} elseif ($one['adm_power'] != '') {
$val = $global['channel'] . '/mod-' . $global['mod'];
$urls = explode('|', $one['adm_power']);
for ($i = 0; $i < count($urls); $i++) {
if ($urls[$i] == '/' . $val . '/') {
$flag = 1;
break;
}
}
if ($flag == 0) {
$obj = new menu();
$obj->set_where('');
$obj->set_where("men_url like '%" . $val . "%'");
if ($obj->get_count() == 0) {
$flag = 1;
}
}
}
}
return $flag;
}
示例2: active
function active($id = 0, $value)
{
$menu = new menu($id);
if (!$menu->exists()) {
show_404();
}
$menu->active = ($menu->active + 1) % 2;
$menu->save();
flash_message('success', "Kích hoạt thành công.");
redirect($this->admin . 'menus/list_all/');
}
示例3: get_power_arr
function get_power_arr()
{
$arr = array();
$obj = new menu();
$obj->set_where('');
$obj->set_where("left(men_type,6) = 'admin_'");
$list = $obj->get_list();
for ($i = 0; $i < count($list); $i++) {
$arr[$i]['name'] = $list[$i]['men_name'];
$arr[$i]['url'] = '/' . $list[$i]['men_url'];
$arr[$i]['set'] = 0;
}
return $arr;
}
示例4: add_nav
function add_nav()
{
global $smarty, $lang;
$type = post('type');
$word = post('word');
$link = post('link');
$obj = new menu();
$obj->set_value('men_type', $type);
$obj->set_value('men_name', $word);
$obj->set_value('men_url', $link);
$obj->add();
$smarty->assign('info_text', '添加导航成功');
$smarty->assign('link_text', $lang['return_list']);
$smarty->assign('link_href', url(array('channel' => 'super', 'mod' => 'nav_list')));
}
示例5: module_footer
function module_footer()
{
global $smarty;
$obj = new menu();
$obj->set_where("men_type = 'footer'");
$smarty->assign('footer_nav', $obj->get_list());
$obj = new varia();
$site['domain'] = $obj->get_value('site_domain');
$site['record'] = $obj->get_value('site_record');
$site['record_url'] = $obj->get_value('site_record_url');
$site['tech'] = $obj->get_value('site_tech');
$site['tech_url'] = $obj->get_value('site_tech_url');
$site['statistical_code'] = im_filter($obj->get_value('statistical_code', true));
$smarty->assign('site', $site);
}
示例6: save
function save($object = '', $related_field = '')
{
if (!$this->exists()) {
$o = new menu();
$o->select_max('position');
$o->get();
if (count($o->all) != 0) {
$max = $o->position + 1;
$this->position = $max;
} else {
$this->postion = 1;
}
}
return parent::save($object, $related_field);
}
示例7: mainpage
function mainpage($mydata)
{
$this->data['mytitle'] = 'Monitoring website';
$this->data['diagnostic'] = $diagnostic;
foreach ($mydata as $key => $variable) {
$this->data[$key] = $variable;
}
//here's the menu class
$fred = new menu();
$this->load->library('session');
$mysess = $this->session->userdata('session_id');
if (isset($this->status) && $this->status > 0) {
$this->data['menu'] = $fred->show_menu($this->status);
}
$this->load->view('basic_view', $this->data);
}
示例8: mainpage
function mainpage($mydata)
{
Display();
$this->data['title'] = 'Monitoring website';
foreach ($mydata as $key => $variable) {
$this->data[$key] = $variable;
}
/*here's the menu class we looked at in Chapter 3*/
$fred = new menu();
$this->load->library('session');
$mysess = $this->session->userdata('session_id');
if (isset($this->status) && $this->status > 0) {
$this->data['menu'] = $fred->show_menu($this->status);
}
$this->load->view('header.tpl.php', $this->data);
}
示例9: module_nav_list
function module_nav_list()
{
global $smarty;
$obj = new varia();
$obj->set_where("left(var_name,10) = 'nav_stage_'");
$arr = $obj->get_list();
for ($i = 0; $i < count($arr); $i++) {
$name = substr($arr[$i]['var_name'], 10);
$obj = new menu();
$obj->set_where("men_type = '{$name}'");
$list[$name] = $obj->get_list();
$nav[$i]['type'] = $name;
$nav[$i]['name'] = $arr[$i]['var_value'];
}
$smarty->assign('nav', $nav);
$smarty->assign('list', $list);
}
示例10: actionAddUser
function actionAddUser($view)
{
$view->menu = menu::getDataMenu();
$userDataArray = array();
$userDataArray['login'] = $_POST['login'];
$userDataArray['password'] = $_POST['password'];
$userDataArray['dblPassword'] = $_POST['dblPassword'];
$userDataArray['email'] = $_POST['email'];
$userDataArray['user_name'] = $_POST['user_name'];
$userDataArray['user_surname'] = $_POST['user_surname'];
if ($userDataArray['password'] !== $userDataArray['dblPassword']) {
$view->userDataArray = $userDataArray;
$view->message = " Пароли не совпадают !";
echo $view->render('registration.php');
return false;
}
if (!$userDataArray['login'] || !$userDataArray['password'] || !$userDataArray['dblPassword'] || !$userDataArray['email'] || !$userDataArray['user_name'] || !$userDataArray['user_surname']) {
$view->userDataArray = $userDataArray;
$view->message = " Введены не все данные !";
echo $view->render('registration.php');
return false;
}
$userDataArray = checkClass::checkAll($userDataArray);
$query = "SELECT user_id FROM user WHERE user.user_login =" . $userDataArray['login'] . ";";
if (getDataBase::getData($query, 1)) {
$view->userDataArray = $userDataArray;
$view->message = " Данный логи занят";
echo $view->render('registration.php');
return false;
}
$query = "INSERT INTO `maket`.`user` (`user_id` ,`user_login` ,`user_password` ,`user_status` ,`user_block`)\r\n VALUES (NULL , '" . $userDataArray['login'] . "','" . $userDataArray['dblPassword'] . "', 'student', '0');";
if (!self::addData($query)) {
$view->userDataArray = $userDataArray;
$view->message = " Регистрация не удалась, попробуйте позже";
echo $view->render('registration.php');
return false;
}
$query = "SELECT user_id FROM user WHERE user.user_login =" . $userDataArray['login'] . ";";
$id = getDataBase::getData($query, 1);
if (!$id) {
$view->userDataArray = $userDataArray;
$view->message = " Регистрация не удалась, попробуйте позже";
echo $view->render('registration.php');
return false;
}
$query = "INSERT INTO `maket`.`user_data` (`user_data_id`, `user_id`, `user_data_name`, `user_data_surname`,\r\n `user_data_email`, `user_data_secret_w`, `user_data_secret_a`, `user_data_cantry`, `user_data_sity`)\r\n VALUES (NULL, '" . $id . "', '" . $userDataArray['user_name'] . "', '" . $userDataArray['user_surname'] . "',\r\n '" . $userDataArray['email'] . "', \\'апап\\', \\'апа\\', \\'Беларусь\\', \\'Минск\\');";
if (!self::addData($query)) {
$view->userDataArray = $userDataArray;
$view->message = " Регистрация не удалась, попробуйте позже";
echo $view->render('registration.php');
return false;
}
$view->message = " Регистрация не удалась, попробуйте позже";
echo $view->render('addUser.php');
}
示例11: getData
public function getData($cnd = " = 0")
{
$data = array();
foreach (menu::model()->findAll('parent_id' . $cnd) as $model) {
$row['text'] = $model->title;
$row['id'] = $model->id;
$row['children'] = Menu::getData(' =' . $model->id);
$data[] = $row;
}
return $data;
}
示例12: addItem
public function addItem()
{
$output = "<div class='col-md-8 col-md-offset-2'>\n <div class='alert alert-danger'>\n <p>This function is still in development.</p>\n </div>\n </div>";
try {
// $beer = new beer('Bud Light');
$menu = new menu($this->registry->db);
$beerList = $menu->getJSON();
$this->registry->template->menuItems = $beerList;
$this->registry->template->error = $output;
$this->registry->template->show('dashboard');
/*
} else {
$this->registry->template->body = "An error occurred";
$this->registry->template->show('index');
} */
} catch (Exception $e) {
$this->registry->template->body = "An error occurred {$e->getMessage()}";
$this->registry->template->show('dashboard');
}
}
示例13: module_header
function module_header()
{
global $smarty;
$obj = new varia();
$obj->set_where("var_name = 'languages'");
$list = $obj->get_list();
for ($i = 0; $i < count($list); $i++) {
$arr = explode('{v}', $list[$i]['var_value']);
$list[$i]['pack_name'] = $arr[0];
$list[$i]['index_entrance'] = $arr[1];
$list[$i]['admin_entrance'] = $arr[2];
$list[$i]['chinese_name'] = $arr[3];
$list[$i]['foreign_name'] = $arr[4];
}
$smarty->assign('lang_pack', $list);
$obj = new menu();
$obj->set_where("men_type = 'header'");
$obj->set_field('men_name,men_url');
$smarty->assign('nav', $obj->get_list());
}
示例14: index
function index()
{
$usuario = new usuario();
$adm = $usuario->esAdm();
$this->registry->template->adm = $adm;
$series = new series();
$this->registry->template->seccion = $series->obtenerSeccionDeParaCajas();
$this->registry->template->exp_id = "";
$this->registry->template->ete_id = "";
$menu = new menu();
$liMenu = $menu->imprimirMenu(VAR1, $_SESSION['USU_ID']);
$this->registry->template->men_titulo = $liMenu;
$this->registry->template->PATH_WEB = PATH_WEB;
$this->registry->template->PATH_DOMAIN = PATH_DOMAIN;
$this->registry->template->PATH_EVENT = "view";
$this->registry->template->GRID_SW = "false";
$this->registry->template->PATH_J = "jquery";
$this->registry->template->show('headerG');
$this->registry->template->show('etiexpediente/tab_etiqexpedienteg.tpl');
$this->registry->template->show('footer');
}
示例15: initMenu
function initMenu($menuname, $skipCache = false)
{
global $_GROUPS, $_TABLES, $_USER;
$menu = NULL;
$cacheInstance = 'menuobject_' . $menuname . '_' . CACHE_security_hash() . '__data';
if ($skipCache == false) {
$retval = CACHE_check_instance($cacheInstance, 0);
if ($retval) {
$menu = unserialize($retval);
return $menu;
}
}
$mbadmin = SEC_hasRights('menu.admin');
$root = SEC_inGroup('Root');
if (COM_isAnonUser()) {
$uid = 1;
} else {
$uid = $_USER['uid'];
}
$result = DB_query("SELECT * FROM {$_TABLES['menu']} WHERE menu_active=1 AND menu_name='" . DB_escapeString($menuname) . "'", 1);
$menuRow = DB_fetchArray($result);
if ($menuRow) {
$menu = new menu();
$menu->id = $menuRow['id'];
$menu->name = $menuRow['menu_name'];
$menu->type = $menuRow['menu_type'];
$menu->active = $menuRow['menu_active'];
$menu->group_id = $menuRow['group_id'];
if ($mbadmin || $root) {
$menu->permission = 3;
} else {
if ($menuRow['group_id'] == 998) {
if (COM_isAnonUser()) {
$menu->permission = 3;
} else {
$menu->permission = 0;
return NULL;
}
} else {
if (in_array($menuRow['group_id'], $_GROUPS)) {
$menu->permission = 3;
} else {
return NULL;
}
}
}
$menu->getElements();
$cacheMenu = serialize($menu);
CACHE_create_instance($cacheInstance, $cacheMenu, 0);
}
return $menu;
}