本文整理汇总了PHP中menu::createMenu方法的典型用法代码示例。如果您正苦于以下问题:PHP menu::createMenu方法的具体用法?PHP menu::createMenu怎么用?PHP menu::createMenu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类menu
的用法示例。
在下文中一共展示了menu::createMenu方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
<?php
/**
* File: create_menu_sample.php
* Created by humooo.
* Email: humooo@outlook.com
* Date: 15-7-5
* Time: 下午1:57
*/
include_once "conf.global.php";
include_once "conf.local.php";
include_once 'com/menu.class.php';
include_once 'com/com.function.php';
$menu_data = array('button' => array(array('name' => '查询', 'sub_button' => array(array('type' => 'click', 'name' => '查询', 'key' => 'MENU_CX'), array('type' => 'view', 'name' => '百度', 'url' => 'http://www.baidu.com')))));
$menu = new menu();
$menu->createMenu($menu_data);
示例2: menu
$IBcat = new menu();
$TOK = new Menu();
$TOK->initArray();
$IBcat->initArray();
$TOK->pushtoArray("TOK", "ids");
$TOK->pushtoArray("TOK and Extended Essay", "items");
$TOK->pushtoArray("essay.png", "urlList");
$TOK->pushtoArray("./ibcalculator/tokextendedessay.php", "url");
$IBcat->pushtoArray("World|Lang|Individual|Sciences|Math2", "ids");
$IBcat->pushtoArray("Group 1 - World Languages|Group 2 - Languages and Literature|Group 3 - Individuals and Society|Group 4 - Sciences| Group 5 - Mathematics", "items");
$IBcat->pushtoArray("Globe.png|Language.png|Government.jpg|Science.png|Math.png", "urlList");
echo '<div class="content" id="IBcat" style="display:none">';
echo "<img src='./images/return.png' alt='return' class='return' onclick='retur(\"IBcat\");'>";
echo '<h2 style="width: 60%; margin-left: -20px;">Please Select Option</h2>';
$TOK->createMenu($TOK->ids, $TOK->urlList, $TOK->items, $TOK->url);
$IBcat->createMenu($IBcat->ids, $IBcat->urlList, $IBcat->items, $IBcat->url);
echo '</div>';
//$IBcat->createMenuCat("IBcat");
$ACTcat = new menu();
$ACTcat->initArray();
$ACTcat->pushtoArray("ACT2|SAT|PSAT", "ids");
$ACTcat->pushtoArray("ACT|SAT|PSAT", "items");
$ACTcat->pushtoArray("ACT.jpg|SAT.png|PSAT.jpg", "urlList");
$ACTcat->pushtoArray("./calculator/ACT.php|./calculator/SAT.php|./calculator/PSAT.php", "url");
$ACTcat->createMenuCat("ACTcat");
$ACTcat->changeIconWidth();
$SATScat = new menu();
$SATScat->initArray();
$SATScat->pushtoArray("ScienceM|Histo|Langu", "ids");
$SATScat->pushtoArray("Science and Math|History|Language", "items");
$SATScat->pushtoArray("Science.png|History.png|Language.png", "urlList");
示例3: buildMenu
private function buildMenu()
{
global $config;
global $user;
global $db;
$menuFile = $this->theme . 'templates/menu.php';
if (!file_exists($menuFile)) {
parent::assign('menu', 'No menu file found.');
return;
}
include $menuFile;
$menu = new menu();
parent::assign('menu', $menu->createMenu());
unset($menu);
parent::assign('date', date('Y-m-d H:i:s T'));
/*
if ($config->getValue('debugSQL'))
{
$this->assign('MSG', 'Used menu: ' . $menuFile);
}
*/
// count online players on match servers
// run the update script:
// >/dev/null pipes output to nowhere
// & lets the script run in the background
exec('php ' . dirname(dirname(__FILE__)) . '/cli/servertracker_query_backend.php >/dev/null &');
// build sum from list of servers
$query = 'SELECT SUM(`cur_players_total`) AS `cur_players_total`' . ' FROM `servertracker`' . ' ORDER BY `id`';
$result = $db->SQL($query, __FILE__);
while ($row = $db->fetchRow($result)) {
if (intval($row['cur_players_total']) === 1) {
parent::assign('onlinePlayers', '1 player');
} else {
parent::assign('onlinePlayers', strval($row['cur_players_total']) . ' players');
}
}
// remove expired sessions from the list of online users
$query = 'SELECT `userid`, `last_activity` FROM `online_users`';
$query = $db->SQL($query);
$rows = $db->fetchAll($query);
$n = count($rows);
if ($n > 0) {
for ($i = 0; $i < $n; $i++) {
$saved_timestamp = $rows[$i]['last_activity'];
$old_timestamp = strtotime($saved_timestamp);
$now = (int) strtotime("now");
// is entry more than two hours old? (60*60*2)
// FIXME: would need to set session expiration date directly inside code
// FIXME: and not in the webserver setting
if ($now - $old_timestamp > 60 * 60 * 2) {
$query = $db->prepare('DELETE LOW_PRIORITY FROM `online_users` WHERE `last_activity`=?');
$db->execute($query, $saved_timestamp);
}
}
}
// count active sessions
$query = 'SELECT count(`userid`) AS `num_players` FROM `online_users`';
$result = $db->SQL($query, __FILE__);
$n_users = $db->fetchRow($result);
if (intval($n_users['num_players']) === 1) {
parent::assign('onlineUsers', '1 user');
} else {
parent::assign('onlineUsers', $n_users['num_players'] . ' users');
}
// user is logged in -> show logout option
if (user::getCurrentUserLoggedIn()) {
/* parent::assign('LOGOUT'); */
parent::assign('logoutURL', $config->getValue('baseaddress') . 'Logout/');
}
}