本文整理汇总了PHP中Setup::get_list方法的典型用法代码示例。如果您正苦于以下问题:PHP Setup::get_list方法的具体用法?PHP Setup::get_list怎么用?PHP Setup::get_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Setup
的用法示例。
在下文中一共展示了Setup::get_list方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unset
$contents .= '
<form method="post" action="' . $_SERVER['REQUEST_URI'] . '"><div class="action">
<input type="hidden" name="token" value="' . $_SESSION['token'] . '" />
' . $table . '
<select name="game_action" id="game_action">
<option value="">With Selected:</option>
<option value="pause">Pause</option>
<option value="unpause">Unpause</option>
<option value="delete">Delete</option>
</select>
</div></form>';
} else {
$contents .= $table;
}
// get the setups
$setup_list = Setup::get_list();
// go through the setups list and remove any that currently have games
foreach ($setup_list as $key => $setup) {
if ($setup['current_games']) {
unset($setup_list[$key]);
}
}
$table_meta = array('sortable' => true, 'no_data' => '<p>There are no setups to show</p><!-- NO_GAMES -->', 'caption' => 'Setups');
$table_format = array(array('SPECIAL_CLASS', '(0 != [[[current_games]]])', 'lowlight'), array('Setup', 'name'), array('Used', 'used'), array('Horus', '###(([[[has_horus]]]) ? \'Yes\' : \'No\')'), array('Reflection', 'reflection'), array('Created', '###date(Settings::read(\'long_date\'), strtotime(\'[[[created]]]\'))', null, ' class="date"'), array('Creator', '###((0 == [[[created_by]]]) ? \'Admin\' : $GLOBALS[\'_PLAYERS\'][[[[created_by]]]])'), array('<input type="checkbox" id="setup_all" />', '<input type="checkbox" name="ids[]" value="[[[setup_id]]]" class="setup_box" />', 'false', 'class="edit"'));
$table = get_table($table_format, $setup_list, $table_meta);
if (false === strpos($table, 'NO_GAMES')) {
$contents .= '
<form method="post" action="' . $_SERVER['REQUEST_URI'] . '"><div class="action">
<input type="hidden" name="token" value="' . $_SESSION['token'] . '" />
' . $table . '
<select name="setup_action" id="setup_action">
示例2: array_diff
$players = array_diff($invite_players, $players_maxed);
$opponent_selection = '';
$opponent_selection .= '<option value="">-- Open --</option>';
foreach ($players_full as $player) {
if ($_SESSION['player_id'] == $player['player_id']) {
continue;
}
if (in_array($player['player_id'], $players)) {
$opponent_selection .= '
<option value="' . $player['player_id'] . '">' . $player['username'] . '</option>';
}
}
$groups = array('Normal' => array(0, 0), 'Eye of Horus' => array(0, 1), 'Sphynx' => array(1, 0), 'Sphynx & Horus' => array(1, 1));
$group_names = array_keys($groups);
$group_markers = array_values($groups);
$setups = Setup::get_list();
$setup_selection = '<option value="0">Random</option>';
$setup_javascript = '';
$cur_group = false;
$group_open = false;
foreach ($setups as $setup) {
$marker = array((int) $setup['has_sphynx'], (int) $setup['has_horus']);
$group_index = array_search($marker, $group_markers, true);
if ($cur_group !== $group_names[$group_index]) {
if ($group_open) {
$setup_selection .= '</optgroup>';
$group_open = false;
}
$cur_group = $group_names[$group_index];
$setup_selection .= '<optgroup label="' . $cur_group . '">';
$group_open = true;
示例3: get_setup_stats_list
/** static public function get_setup_stats_list
* Gets the list of all the setups with
* additional stats included in the list
*
* @param void
* @return array setups
*/
public static function get_setup_stats_list()
{
$Mysql = Mysql::get_instance();
$setups = Setup::get_list(true);
if ($setups) {
// add some more stats
$query = "\n\t\t\t\tSELECT o.setup_id\n\t\t\t\t\t, COUNT(ww.win) AS white_wins\n\t\t\t\t\t, COUNT(bw.win) AS black_wins\n\t\t\t\t\t, COUNT(d.win) AS draws\n\t\t\t\tFROM " . self::GAME_STATS_TABLE . " AS o\n\t\t\t\t\tLEFT JOIN " . self::GAME_STATS_TABLE . " AS ww\n\t\t\t\t\t\tON (o.setup_id = ww.setup_id\n\t\t\t\t\t\t\tAND o.game_id = ww.game_id\n\t\t\t\t\t\t\tAND ww.win = 1\n\t\t\t\t\t\t\tAND ww.color = 'white')\n\t\t\t\t\tLEFT JOIN " . self::GAME_STATS_TABLE . " AS bw\n\t\t\t\t\t\tON (o.setup_id = bw.setup_id\n\t\t\t\t\t\t\tAND o.game_id = bw.game_id\n\t\t\t\t\t\t\tAND bw.win = 1\n\t\t\t\t\t\t\tAND bw.color = 'black')\n\t\t\t\t\tLEFT JOIN " . self::GAME_STATS_TABLE . " AS d\n\t\t\t\t\t\tON (o.setup_id = d.setup_id\n\t\t\t\t\t\t\tAND o.game_id = d.game_id\n\t\t\t\t\t\t\tAND d.win = 0\n\t\t\t\t\t\t\tAND d.color = 'white')\n\t\t\t\tGROUP BY o.player_id\n\t\t\t";
$results = $Mysql->fetch_array($query);
$stats = array();
foreach ($results as $stat) {
$stats[$stat['setup_id']] = $stat;
}
$empty = array('white_wins' => 0, 'black_wins' => 0, 'draws' => 0);
foreach ($setups as &$setup) {
// be careful with the reference
if (isset($stats[$setup['setup_id']])) {
$setup = array_merge($setup, $stats[$setup['setup_id']]);
} else {
$setup = array_merge($setup, $empty);
}
}
unset($setup);
// kill the reference
}
return $setups;
}