当前位置: 首页>>代码示例>>PHP>>正文


PHP Game::get_list方法代码示例

本文整理汇总了PHP中Game::get_list方法的典型用法代码示例。如果您正苦于以下问题:PHP Game::get_list方法的具体用法?PHP Game::get_list怎么用?PHP Game::get_list使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Game的用法示例。


在下文中一共展示了Game::get_list方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: catch

        Flash::store('Admin Update Successfull', true);
        // redirect kills form resubmission
    } catch (MyException $e) {
        Flash::store('Admin Update FAILED !', true);
        // redirect kills form resubmission
    }
}
$meta['title'] = GAME_NAME . ' Administration';
$meta['head_data'] = '
	<script type="text/javascript" src="scripts/admin.js"></script>
';
$hints = array('Here you can administrate your ' . GAME_NAME . ' installation.', 'Click anywhere on a row to mark that row for action.');
$contents = '';
// grab the lists
$player_list = GamePlayer::get_list();
$game_list = Game::get_list();
// go through the player list and remove the root admin and ourselves
foreach ($player_list as $key => $player) {
    if ($GLOBALS['_ROOT_ADMIN'] == $player['username']) {
        unset($player_list[$key]);
    }
    if ($_SESSION['player_id'] == $player['player_id']) {
        unset($player_list[$key]);
    }
}
$table_meta = array('sortable' => true, 'no_data' => '<p>There are no players to show</p><!-- NO_PLAYERS -->', 'caption' => 'Players');
$table_format = array(array('ID', 'player_id'), array('Player', 'username'), array('First Name', 'first_name'), array('Last Name', 'last_name'), array('Email', 'email'), array('Admin', '###(([[[full_admin]]] | [[[half_admin]]]) ? \'<span class="notice">Yes</span>\' : \'No\')'), array('Approved', '###(([[[is_approved]]]) ? \'Yes\' : \'<span class="notice">No</span>\')'), array('Last Online', '###date(Settings::read(\'long_date\'), strtotime(\'[[[last_online]]]\'))', null, ' class="date"'), array('<input type="checkbox" id="player_all" />', '<input type="checkbox" name="ids[]" value="[[[player_id]]]" class="player_box" />', 'false', 'class="edit"'));
$table = get_table($table_format, $player_list, $table_meta);
if (false === strpos($table, 'NO_PLAYERS')) {
    $contents .= '
		<form method="post" action="' . $_SERVER['REQUEST_URI'] . '"><div class="action">
开发者ID:benjamw,项目名称:quarto,代码行数:31,代码来源:admin.php

示例2: array

$message_count = (int) Message::check_new($_SESSION['player_id']);
$turn_count = (int) Game::check_turns($_SESSION['player_id']);
$turn_msg_count = $message_count + $turn_count;
$meta['title'] = 'Game List';
$meta['head_data'] = '
	<script type="text/javascript" src="scripts/jquery.jplayer.min.js"></script>
	<script type="text/javascript" src="scripts/index.js"></script>
	<script type="text/javascript">//<![CDATA[
		var turn_msg_count = ' . $turn_msg_count . ';
	//]]></script>
';
$meta['foot_data'] = '
	<div id="sounds"></div>
';
// grab the list of games
$list = Game::get_list($_SESSION['player_id']);
$contents = '';
$table_meta = array('sortable' => true, 'no_data' => '<p>There are no games to show</p>', 'caption' => 'Current Games');
$table_format = array(array('SPECIAL_HTML', 'true', 'id="g[[[game_id]]]"'), array('SPECIAL_CLASS', '(1 == \'[[[highlight]]]\')', 'highlight'), array('ID', 'game_id'), array('Name', 'clean_name'), array('State', '###(([[[paused]]]) ? \'Paused\' : ((\'Waiting\' == \'[[[state]]]\') ? ((\'\' != \'[[[password]]]\') ? \'<span class="highlight password">[[[state]]]</span>\' : \'<span class="highlight">[[[state]]]</span>\') : \'[[[state]]]\'))'), array('Current Player', '###((\'\' == \'[[[username]]]\') ? \'[[[hostname]]]\' : \'[[[username]]]\')'), array('Extra Info', '<abbr title="Fortify: [[[get_fortify]]] | Kamikaze: [[[get_kamikaze]]] | Warmonger: [[[get_warmonger]]] | FoW Armies: [[[get_fog_of_war_armies]]] | FoW Colors: [[[get_fog_of_war_colors]]] | Conquer Limit: [[[get_conquer_limit]]] | Custom Rules: [[[clean_custom_rules]]]">Hover</abbr>'), array('Players', '[[[players]]] / [[[capacity]]]'), array('Last Move', '###ldate(Settings::read(\'long_date\'), strtotime(\'[[[last_move]]]\'))', null, ' class="date"'));
$contents .= '
	<div class="tableholder">
		' . get_table($table_format, $list, $table_meta) . '
	</div>';
// create the lobby
$Chat = new Chat($_SESSION['player_id'], 0);
$chat_data = $Chat->get_box_list();
// temp storage for gravatar imgs
$gravatars = array();
$lobby = '
	<div id="lobby">
		<div class="caption">Lobby</div>
开发者ID:studywithyou,项目名称:webrisk,代码行数:31,代码来源:index.php

示例3: get_header

/** function get_header
 *		Generate the HTML header portion of the page
 *
 * @param array [optional] meta variables
 *   @option string 'title' the page title
 *   @option string 'head_data' any HTML to be inserted in the head tag
 *   @option array 'menu_data' the data for the counts in the menu
 *   @option array 'game_data' the game data for my game list under the menu
 *   @option bool 'show_menu' show the menu
 *   @option string 'file_name' becomes the body id with _page appended
 * @return string HTML header for page
 */
function get_header($meta = null)
{
    if (!defined('GAME_NAME')) {
        define('GAME_NAME', 'Game');
    }
    $title = !empty($meta['title']) ? GAME_NAME . ' :: ' . $meta['title'] : GAME_NAME;
    $show_menu = isset($meta['show_menu']) ? (bool) $meta['show_menu'] : true;
    $show_nav_links = isset($meta['show_nav_links']) ? (bool) $meta['show_nav_links'] : true;
    $menu_data = isset($meta['menu_data']) ? $meta['menu_data'] : false;
    $head_data = isset($meta['head_data']) ? $meta['head_data'] : '';
    $file_name = isset($meta['file_name']) ? $meta['file_name'] : basename($_SERVER['SCRIPT_NAME']);
    $file_name = substr($file_name, 0, strrpos($file_name, '.'));
    // make sure we have these
    $GLOBALS['_&_DEBUG_QUERY'] = !empty($GLOBALS['_&_DEBUG_QUERY']) ? $GLOBALS['_&_DEBUG_QUERY'] : '';
    $GLOBALS['_?_DEBUG_QUERY'] = !empty($GLOBALS['_?_DEBUG_QUERY']) ? $GLOBALS['_?_DEBUG_QUERY'] : (defined('DEBUG') && DEBUG ? '?' : '');
    $flash = '';
    if (class_exists('Flash')) {
        $flash = Flash::retrieve();
    }
    if ($show_menu) {
        if (!$menu_data) {
            $menu_data = array('my_turn' => 0, 'my_games' => 0, 'games' => 0, 'in_vites' => 0, 'out_vites' => 0, 'open_vites' => 0, 'new_msgs' => 0, 'msgs' => 0);
            list($menu_data['games'], ) = Game::get_count();
            list($menu_data['setups'], $menu_data['my_setups']) = Setup::get_count($_SESSION['player_id']);
            list($menu_data['my_games'], $menu_data['my_turn']) = Game::get_my_count($_SESSION['player_id']);
            list($menu_data['in_vites'], $menu_data['out_vites'], $menu_data['open_vites']) = Game::get_invite_count($_SESSION['player_id']);
            $messages = Message::get_count($_SESSION['player_id']);
            $menu_data['msgs'] = (int) @$messages[0];
            $menu_data['new_msgs'] = (int) @$messages[1];
            $allow_blink = 'index.php' == basename($_SERVER['PHP_SELF']);
        }
        // highlight the important menu values
        foreach ($menu_data as $key => $value) {
            switch ($key) {
                case 'my_turn':
                case 'new_msgs':
                case 'in_vites':
                    if (0 < $value) {
                        $menu_data[$key] = '<span class="notice">' . $value . '</span>';
                    }
                    break;
                default:
                    // do nothing
                    break;
            }
        }
        $game_data = isset($meta['game_data']) ? $meta['game_data'] : Game::get_list($_SESSION['player_id'], false);
    }
    // if we are admin logged in as someone else, let us know
    $admin_css = $admin_div = '';
    if (isset($_SESSION['admin_id']) && isset($_SESSION['player_id']) && $_SESSION['player_id'] != $_SESSION['admin_id']) {
        $admin_css = '
			<style type="text/css">
				html { border: 5px solid red; }
				#admin_username {
					background: red;
					color: black;
					position: fixed;
					top: 0;
					left: 50%;
					z-index: 99999;
					width: 200px;
					margin-left: -100px;
					text-align: center;
					font-weight: bold;
					font-size: larger;
					padding: 3px;
				}
			</style>';
        $admin_div = '<div id="admin_username">' . $GLOBALS['Player']->username . ' [ ' . $GLOBALS['Player']->id . ' ]</div>';
    }
    $query_strings = 'var debug_query_ = "' . $GLOBALS['_&_DEBUG_QUERY'] . '"; var debug_query = "' . $GLOBALS['_?_DEBUG_QUERY'] . '";';
    $debug_string = defined('DEBUG') && DEBUG ? 'var debug = true;' : 'var debug = false;';
    $nav_links = '';
    if ($show_nav_links && class_exists('Settings') && Settings::test()) {
        $nav_links = Settings::read('nav_links');
    }
    $GAME_NAME = GAME_NAME;
    $html = <<<EOF
<!DOCTYPE html>
<html lang="en-us">
<head>

\t<title>{$title}</title>

\t<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

\t<script type="text/javascript">
//.........这里部分代码省略.........
开发者ID:benjamw,项目名称:pharaoh,代码行数:101,代码来源:html.general.php

示例4: get_header

/** function get_header
 *		Generate the HTML header portion of the page
 *
 * @param array [optional] meta variables
 *   @option string 'title' the page title
 *   @option string 'head_data' any HTML to be inserted in the head tag
 *   @option array 'menu_data' the data for the counts in the menu
 *   @option array 'game_data' the game data for my game list under the menu
 *   @option bool 'show_menu' show the menu
 *   @option string 'file_name' becomes the body id with _page appended
 * @return string HTML header for page
 */
function get_header($meta = null)
{
    if (!defined('GAME_NAME')) {
        define('GAME_NAME', 'Game');
    }
    $title = !empty($meta['title']) ? GAME_NAME . ' :: ' . $meta['title'] : GAME_NAME;
    $show_menu = isset($meta['show_menu']) ? (bool) $meta['show_menu'] : true;
    $show_nav_links = isset($meta['show_nav_links']) ? (bool) $meta['show_nav_links'] : true;
    $menu_data = isset($meta['menu_data']) ? $meta['menu_data'] : false;
    $head_data = isset($meta['head_data']) ? $meta['head_data'] : '';
    $file_name = isset($meta['file_name']) ? $meta['file_name'] : basename($_SERVER['SCRIPT_NAME']);
    $file_name = substr($file_name, 0, strrpos($file_name, '.'));
    // make sure we have these
    $GLOBALS['_&_DEBUG_QUERY'] = isset($GLOBALS['_&_DEBUG_QUERY']) ? $GLOBALS['_&_DEBUG_QUERY'] : '';
    $GLOBALS['_?_DEBUG_QUERY'] = isset($GLOBALS['_?_DEBUG_QUERY']) ? $GLOBALS['_?_DEBUG_QUERY'] : '';
    $flash = '';
    if (class_exists('Flash')) {
        $flash = Flash::retrieve();
    }
    if ($show_menu) {
        if (!$menu_data) {
            $menu_data = array('my_turn' => 0, 'my_games' => 0, 'games' => 0, 'new_msgs' => 0, 'msgs' => 0, 'in_vites' => 0, 'out_vites' => 0);
            $list = Game::get_list($_SESSION['player_id']);
            $invites = Game::get_invites($_SESSION['player_id']);
            if (is_array($list)) {
                foreach ($list as $game) {
                    ++$menu_data['games'];
                    if ($game['in_game'] && !in_array($game['state'], array('Finished', 'Draw'))) {
                        ++$menu_data['my_games'];
                    }
                    if ($game['my_turn'] && 'Placing' != $game['state']) {
                        ++$menu_data['my_turn'];
                    }
                }
            }
            if (is_array($invites)) {
                foreach ($invites as $game) {
                    if ($game['invite']) {
                        ++$menu_data['in_vites'];
                    } else {
                        ++$menu_data['out_vites'];
                    }
                }
            }
            $messages = Message::get_count($_SESSION['player_id']);
            $menu_data['msgs'] = (int) @$messages[0];
            $menu_data['new_msgs'] = (int) @$messages[1];
            $allow_blink = 'index.php' == basename($_SERVER['PHP_SELF']);
        }
        // highlight the important menu values
        foreach ($menu_data as $key => $value) {
            switch ($key) {
                case 'my_turn':
                case 'new_msgs':
                case 'in_vites':
                    if (0 < $value) {
                        $menu_data[$key] = '<span class="notice">' . $value . '</span>';
                    }
                    break;
                default:
                    // do nothing
                    break;
            }
        }
        $game_data = isset($meta['game_data']) ? $meta['game_data'] : Game::get_list($_SESSION['player_id'], false);
    }
    // if we are admin logged in as someone else, let us know
    $admin_css = $admin_div = '';
    if (isset($_SESSION['admin_id']) && isset($_SESSION['player_id']) && $_SESSION['player_id'] != $_SESSION['admin_id']) {
        $admin_css = '
			<style type="text/css">
				html { border: 5px solid red; }
				#admin_username {
					background: red;
					color: black;
					position: fixed;
					top: 0;
					left: 50%;
					width: 200px;
					margin-left: -100px;
					text-align: center;
					font-weight: bold;
					font-size: larger;
					padding: 3px;
				}
			</style>';
        $admin_div = '<div id="admin_username">' . $GLOBALS['Player']->username . ' [ ' . $GLOBALS['Player']->id . ' ]</div>';
    }
//.........这里部分代码省略.........
开发者ID:benjamw,项目名称:quarto,代码行数:101,代码来源:html.general.php


注:本文中的Game::get_list方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。