本文整理汇总了PHP中Framework::TPL方法的典型用法代码示例。如果您正苦于以下问题:PHP Framework::TPL方法的具体用法?PHP Framework::TPL怎么用?PHP Framework::TPL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Framework
的用法示例。
在下文中一共展示了Framework::TPL方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
// check if logged in session is valid, if not redir to main page
if (!isset($_SESSION['loginHash'])) {
Framework::Redir("site/index");
die;
}
$activeSession = R::findOne('session', ' hash = ? AND ip = ? AND expires > ?', array($_SESSION['loginHash'], $_SERVER['REMOTE_ADDR'], time()));
if (!$activeSession) {
unset($_SESSION['loginHash']);
Framework::Redir("site/index/main/session_expired");
die;
}
$activeSession->expires = time() + SESSION_MAX_AGE * 2;
R::store($activeSession);
$this->session = $activeSession;
$this->user = R::load('user', $this->session->user->getId());
Framework::TPL()->assign('user_premium', $this->user->hasPremium());
// check needed rights if any
foreach ($this->_rights as $r) {
if (!$this->user->hasRight($r)) {
Framework::Redir("game/index");
die;
}
}
}
示例2: show_Main
public function show_Main()
{
$charImg = array();
for ($i = 1; $i <= HIGHEST_CHAR_IMG; $i++) {
$charImg[] = array("id" => $i, "name" => $i < 10 ? "0" . $i : $i);
}
Framework::TPL()->assign('charImg', $charImg);
}
示例3: show_Error
public function show_Error()
{
Framework::TPL()->assign('status', 'error');
if (is_numeric($this->get(1))) {
$id = $this->get(1);
} else {
$id = -1;
}
Framework::TPL()->assign('error', $id);
}
示例4: __destruct
public function __destruct()
{
$this->_use_scripts[] = "game";
$this->_use_scripts = Framework::bundleJavaScripts($this->_use_scripts);
$this->regenerateSecureHash();
Framework::TPL()->assign("fSecureHash", $this->_secureHash);
Framework::TPL()->assign("User", $this->user);
Framework::TPL()->assign("js_scripts", $this->_use_scripts);
Framework::TPL()->assign("template", $this->_use_tpl);
Framework::TPL()->display("game.html");
}
示例5: show_Main
public function show_Main()
{
if (!ALLOW_REGISTER) {
Framework::TPL()->assign('no_register', true);
return;
}
$refed_by = $this->get(1);
if (is_numeric($refed_by)) {
Framework::TPL()->assign('by', $refed_by);
} else {
Framework::TPL()->assign('by', -1);
}
}
示例6: show_Main
public function show_Main()
{
$poker_player = R::relatedOne($this->user, 'poker_player');
if ($poker_player == null) {
$poker_player = R::dispense('poker_player');
$poker_player->status = 'view';
$poker_player->cards = '';
$poker_player->bid = 0;
$poker_player->all_in = false;
$poker_player->all_in_amount = 0;
R::store($poker_player);
R::associate($poker_player, $this->user);
}
if ($poker_player->status == 'view') {
Framework::TPL()->assign('can_join', true);
}
}
示例7: show_Main
public function show_Main()
{
$usersPerPage = 20;
$totalUsers = R::getCell('SELECT count(id) FROM user');
$pages = ceil($totalUsers / $usersPerPage);
$currentPage = is_numeric($this->get(1)) && $this->get(1) > 0 && $this->get(1) <= $pages ? $this->get(1) : 1;
$players = array();
$dbP = R::find('user', ' 1=1 ORDER BY xp DESC LIMIT ?,?', array(($currentPage - 1) * $usersPerPage, $usersPerPage));
$i = $usersPerPage * ($currentPage - 1) + 1;
foreach ($dbP as $p) {
$players[] = array("rank" => $i, "username" => $p->username, "level" => $p->level, "xp" => formatCash($p->xp), "premium" => $p->hasPremium());
$i++;
}
Framework::TPL()->assign('players', $players);
Framework::TPL()->assign('currentPage', $currentPage);
Framework::TPL()->assign('pages', $pages);
}
示例8: show_Buy
public function show_Buy()
{
$this->_use_tpl = 'game/game_premium_buy.html';
$prices = Config::getConfig('premium_price');
$rows = array();
foreach ($prices as $points => $cost) {
$row = array('points' => $points, 'cost' => number_format($cost, 2, ',', '.'), 'ebank' => self::PaymentWindowUrl($cost * 100, 'ebank2pay', $points, $this->user->id));
if ($cost < 15) {
$row['call'] = self::PaymentWindowUrl($cost * 100, 'call2pay', $points, $this->user->id);
} else {
$row['call'] = '';
}
if ($cost < 5) {
$row['handy'] = self::PaymentWindowUrl($cost * 100, 'handypay', $points, $this->user->id);
} else {
$row['handy'] = '';
}
$rows[] = $row;
}
Framework::TPL()->assign('pRows', $rows);
}
示例9: show_Main
public function show_Main()
{
if ($this->get(1) == "login") {
Framework::TPL()->assign('first_login', true);
} else {
Framework::TPL()->assign('first_login', false);
}
$session_expired = false;
if ($this->get(1) == "session_expired") {
$session_expired = true;
}
Framework::TPL()->assign('session_expired', $session_expired);
$count = R::getCell('select count(id) from user');
Framework::TPL()->assign("playercount", $count);
// assign news
$news = array();
$dbNews = R::find('homepage_posts', ' 1=1 ORDER BY id DESC LIMIT 3');
foreach ($dbNews as $n) {
$author = R::relatedOne($n, 'user');
$news[] = array('id' => $n->id, 'title' => $n->title, 'author' => $author->username, 'time' => $n->time);
}
Framework::TPL()->assign("news", $news);
}
示例10: __destruct
public function __destruct()
{
Framework::TPL()->assign("js_scripts", $this->_use_scripts);
Framework::TPL()->assign("template", $this->_use_tpl);
Framework::TPL()->display("site.html", $this->cacheID);
}
示例11: show_Forgot
public function show_Forgot()
{
Framework::TPL()->assign('acc_type', 'forgot');
$this->_use_tpl = 'site/site_account_forgot.html';
$this->_use_scripts[] = 'site/site_account_forgot';
}
示例12: show_Main
public function show_Main()
{
$link = APP_WEBSITE . APP_DIR . "site/register/main/" . $this->user->getID();
Framework::TPL()->assign('ref_link', $link);
Framework::TPL()->assign('refed_players', R::getAll('SELECT username, referee_awarded FROM user WHERE referee_id = ?', array($this->user->getID())));
}
示例13: switchTable
private function switchTable()
{
if (isset($_POST['switchTable'])) {
$_SESSION['currentTable'] = $_POST['switchTable'];
Framework::Redir("game/db_admin");
}
if (!isset($_SESSION['currentTable']) || !in_array($_SESSION['currentTable'], array_keys($this->dbTables))) {
$_SESSION['currentTable'] = 'map_object';
}
$this->currentTable = $_SESSION['currentTable'];
Framework::TPL()->assign('currentTable', $this->currentTable);
Framework::TPL()->assign('dbTables', $this->dbTables);
}