本文整理汇总了PHP中Core::getTPL方法的典型用法代码示例。如果您正苦于以下问题:PHP Core::getTPL方法的具体用法?PHP Core::getTPL怎么用?PHP Core::getTPL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core
的用法示例。
在下文中一共展示了Core::getTPL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pageAction
/**
* Displays the profile page for an user.
*
* @param integer $user_id
*
* @return Bengine_Game_Controller_Profile
*/
protected function pageAction($user_id)
{
$user = Game::getModel("game/user")->load($user_id);
$profile = Game::getCollection("game/profile");
$profile->addUserFilter($user_id)->addSortIndex()->addListFilter();
$avatar = Game::getModel("game/profile")->loadByCode("AVATAR", $user_id);
$about = Game::getModel("game/profile")->loadByCode("ABOUT_ME", $user_id);
$this->assign("user", $user);
$this->assign("aboutMe", $about->getData());
$this->assign("avatar", $avatar->getData());
$this->assign("username", $user->getUsername());
$this->assign("points", $user->getFormattedPoints());
$this->assign("status", $user->getStatusString());
$this->assign("rank", $user->getFormattedRank());
$this->assign("regdate", $user->getFormattedRegDate());
$this->assign("pm", $user->getPmLink());
$this->assign("moderate", $user->getModerateLink());
$this->assign("addToBuddylist", $user->getFriendLink());
$this->assign("pm", $user->getPmLink());
$this->assign("allianceName", $user->getAid() ? $user->getAlliance()->getPageLink() : " ");
Core::getTPL()->addLoop("profile", $profile);
$this->assign("canEdit", Core::getUser()->get("userid") == $user_id || Core::getUser()->ifPermissions(array("CAN_EDIT_PROFILES")));
$this->assign("editLink", Link::get("game/" . SID . "/Profile/Edit/" . $user_id, Core::getLang()->get("EDIT_PROFILE")));
Core::getLang()->assign("profileUsername", $user->getUsername());
return $this;
}
示例2: indexAction
/**
* Index action.
*
* @return Bengine_Game_Controller_Friends
*/
protected function indexAction()
{
Core::getLanguage()->load(array("Statistics", "Buddylist"));
if ($this->isPost()) {
if ($this->getParam("delete")) {
$this->remove($this->getParam("remove", array()));
}
if ($this->getParam("accept")) {
$this->acceptRequest($this->getParam("relid"));
}
}
$bl = array();
$select = array("b.relid", "b.friend1", "b.friend2", "b.accepted", "u1.username as user1", "u1.points as points1", "u1.last as lastlogin1", "u2.points as points2", "u2.username as user2", "u2.last as lastlogin2", "a1.tag as ally1", "a1.aid as allyid1", "a2.tag as ally2", "a2.aid as allyid2", "g1.galaxy as gala1", "g1.system as sys1", "g1.position as pos1", "g2.galaxy as gala2", "g2.system as sys2", "g2.position as pos2");
$joins = "LEFT JOIN " . PREFIX . "user u1 ON (u1.userid = b.friend1)";
$joins .= "LEFT JOIN " . PREFIX . "user u2 ON (u2.userid = b.friend2)";
$joins .= "LEFT JOIN " . PREFIX . "galaxy g1 ON (g1.planetid = u1.hp)";
$joins .= "LEFT JOIN " . PREFIX . "galaxy g2 ON (g2.planetid = u2.hp)";
$joins .= "LEFT JOIN " . PREFIX . "user2ally u2a1 ON (u2a1.userid = b.friend1)";
$joins .= "LEFT JOIN " . PREFIX . "user2ally u2a2 ON (u2a2.userid = b.friend2)";
$joins .= "LEFT JOIN " . PREFIX . "alliance a1 ON (a1.aid = u2a1.aid)";
$joins .= "LEFT JOIN " . PREFIX . "alliance a2 ON (a2.aid = u2a2.aid)";
$result = Core::getQuery()->select("buddylist b", $select, $joins, Core::getDB()->quoteInto("b.friend1 = ? OR b.friend2 = ?", Core::getUser()->get("userid")), "u1.points DESC, u2.points DESC, u1.username ASC, u2.username ASC");
foreach ($result->fetchAll() as $row) {
Hook::event("ShowBuddyFirst", array(&$row));
if ($row["friend1"] == Core::getUser()->get("userid")) {
if ($row["lastlogin2"] > TIME - 900) {
$status = Image::getImage("on.gif", getTimeTerm(TIME - $row["lastlogin2"]));
} else {
$status = Image::getImage("off.gif", getTimeTerm(TIME - $row["lastlogin2"]));
}
$username = Link::get("game/" . SID . "/MSG/Write/" . rawurlencode($row["user2"]), Image::getImage("pm.gif", Core::getLanguage()->getItem("WRITE_MESSAGE"))) . " " . Link::get("game/" . SID . "/Profile/Page/" . $row["friend2"], $row["user2"]);
$points = $row["points2"];
$position = getCoordLink($row["gala2"], $row["sys2"], $row["pos2"]);
$ally = Link::get("game/" . SID . "/Alliance/Page/" . $row["allyid2"], $row["ally2"]);
} else {
if ($row["lastlogin1"] > TIME - 900) {
$status = Image::getImage("on.gif", getTimeTerm(TIME - $row["lastlogin1"]));
} else {
$status = Image::getImage("off.gif", getTimeTerm(TIME - $row["lastlogin1"]));
}
$username = Link::get("game/" . SID . "/MSG/Write/" . rawurlencode($row["user1"]), Image::getImage("pm.gif", Core::getLanguage()->getItem("WRITE_MESSAGE"))) . " " . Link::get("game/" . SID . "/Profile/Page/" . $row["friend1"], $row["user1"]);
$points = $row["points1"];
$position = getCoordLink($row["gala1"], $row["sys1"], $row["pos1"]);
$ally = Link::get("game/" . SID . "/Alliance/Page/" . $row["allyid1"], $row["ally1"]);
}
$bl[$row["relid"]]["f1"] = $row["friend1"];
$bl[$row["relid"]]["f2"] = $row["friend2"];
$bl[$row["relid"]]["relid"] = $row["relid"];
$bl[$row["relid"]]["username"] = $username;
$bl[$row["relid"]]["accepted"] = $row["accepted"];
$bl[$row["relid"]]["points"] = fNumber($points);
$bl[$row["relid"]]["status"] = $status;
$bl[$row["relid"]]["position"] = $position;
$bl[$row["relid"]]["ally"] = $ally;
Hook::event("ShowBuddyLast", array($row, &$bl));
}
$result->closeCursor();
Core::getTPL()->addLoop("buddylist", $bl);
return $this;
}
示例3: editAction
/**
* @param integer $groupid
* @return Bengine_Admin_Controller_Usergroups
*/
protected function editAction($groupid)
{
if ($this->isPost() && $this->getParam("save_usergroup")) {
$this->save($this->getParam("groupid"), $this->getParam("grouptitle"), $this->getParam("permissions", array()));
}
$permissions = array();
$result = Core::getQuery()->select("group2permission g2p", array("g2p.permissionid", "g2p.value", "g.grouptitle"), "LEFT JOIN " . PREFIX . "usergroup g ON (g.usergroupid = g2p.groupid)", Core::getDB()->quoteInto("g2p.groupid = ?", $groupid));
foreach ($result->fetchAll() as $row) {
$grouptitle = $row["grouptitle"];
if ($row["value"]) {
$permissions[] = $row["permissionid"];
}
}
if (empty($grouptitle)) {
$grouptitle = "";
$result = Core::getQuery()->select("usergroup", "grouptitle", "", Core::getDB()->quoteInto("usergroupid = ?", $groupid));
if ($row = $result->fetchRow()) {
$grouptitle = $row["grouptitle"];
}
}
Core::getTPL()->assign("grouptitle", $grouptitle);
Core::getTPL()->assign("perms", $permissions);
Admin::rebuildCache("perm");
return $this;
}
示例4: reportAction
/**
* Combat report action.
*
* @return Bengine_Comm_Controller_Combat
*/
public function reportAction()
{
if (!defined("SID")) {
define("SID", "");
}
Core::getLanguage()->load(array("info", "AssaultReport"));
Core::getTPL()->clearHTMLHeaderFiles();
Core::getTPL()->addHTMLHeaderFile("game.css", "css");
Core::getTPL()->addHTMLHeaderFile("lib/jquery.js", "js");
$select = new Recipe_Database_Select();
$select->from(array("a" => "assault"))->join(array("p" => "planet"), "p.planetid = a.planetid")->attributes(array("a" => array("report"), "p" => array("planetname")))->where(array("a" => "assaultid"), $this->getParam("1"))->where(array("a" => "key"), $this->getParam("2"));
$result = $select->getStatement();
$row = $result->fetchRow();
if ($row) {
$report = $row["report"];
$report = preg_replace_callback("/\\{lang}([^\"]+)\\{\\/lang}/siU", function ($matches) {
return Core::getLanguage()->getItem($matches[1]);
}, $report);
$report = preg_replace_callback("/\\{embedded\\[([^\"]+)]}(.*)\\{\\/embedded}/siU", function ($matches) {
return sprintf(Core::getLanguage()->getItem($matches[1]), $matches[2]);
}, $report);
Hook::event("ShowCombatReport", array(&$report, &$row));
$this->assign("report", $report);
$this->assign("planetName", $row["planetname"]);
$this->setIsAjax();
} else {
$this->setNoDisplay(true);
}
return $this;
}
示例5: pageAction
/**
* Alliance page action.
*
* @return Bengine_Comm_Controller_Alliance
*/
public function pageAction()
{
Core::getLanguage()->load("Alliance");
Core::getTPL()->clearHTMLHeaderFiles();
Core::getTPL()->addHTMLHeaderFile("game.css", "css");
Core::getTPL()->addHTMLHeaderFile("lib/jquery.js", "js");
$tag = $this->getParam("1");
$fNumber = array("member", "points", "rpoints", "fpoints", "dpoints");
$attr = array("a.aid", "a.name", "a.tag", "a.logo", "a.textextern", "a.homepage", "a.showhomepage", "COUNT(u2a.userid) AS member", "SUM(u.points) AS points", "SUM(u.rpoints) AS rpoints", "SUM(u.fpoints) AS fpoints", "SUM(u.dpoints) AS dpoints");
$joins = "LEFT JOIN " . PREFIX . "user2ally u2a ON (u2a.aid = a.aid) ";
$joins .= "LEFT JOIN " . PREFIX . "user u ON (u2a.userid = u.userid) ";
$result = Core::getQuery()->select("alliance a", $attr, $joins, Core::getDB()->quoteInto("tag = ?", $tag), "", 1, "a.aid");
$row = $result->fetchRow();
if ($row) {
foreach ($fNumber as $field) {
$row[$field] = fNumber($row[$field]);
}
$parser = new Bengine_Game_Alliance_Page_Parser($row["aid"]);
if (Str::length(strip_tags($row["textextern"])) > 0) {
$row["textextern"] = $parser->startParser($row["textextern"]);
} else {
$row["textextern"] = Core::getLang()->get("WELCOME");
}
$row["homepage"] = $row["homepage"] != "" ? Link::get($row["homepage"], $row["homepage"], $row["homepage"]) : "";
$row["logo"] = $row["logo"] != "" ? Image::getImage($row["logo"], "") : "";
Hook::event("ShowPublicAlliancePage", array(&$row));
$this->assign($row);
$this->setIsAjax();
} else {
$this->setNoDisplay(true);
}
return $this;
}
示例6: dieMessage
/**
* Displays a message and shut program down.
*
* @param string $message Message to log
* @param string $mode Log mode
*
* @return void
*/
public static function dieMessage($message, $mode = "error")
{
Core::getLanguage()->load("error");
$message = Core::getLanguage()->getItem($message);
Core::getTPL()->addLogMessage("<div class=\"" . $mode . "\">" . $message . "</div>");
Core::getTemplate()->display("error");
exit;
}
示例7: atomAction
/**
* Shows the pillory as Atom feed.
*
* @return Bengine_Comm_Controller_Pillory
*/
public function atomAction()
{
$this->assign("selfUrl", BASE_URL . "pillory/atom");
$this->assign("alternateUrl", BASE_URL . "pillory");
$this->assign("title", Core::getLang()->get("PILLORY"));
Core::getTPL()->addLoop("feed", $this->getBans(0, self::MAX_FEED_ITEMS));
$this->setTemplate("atom");
return $this;
}
示例8: _sendRemoteRequest
/**
* Sends a remote request.
*
* @param string $url Universe url
* @param string $username Username
* @param string $password Password
* @param string $email E-Mail address
*
* @return Bengine_Comm_Controller_Password
*/
protected function _sendRemoteRequest($url, $username, $password, $email)
{
$url .= Core::getLang()->getOpt("langcode") . "/signup/checkuser";
$request = new Recipe_HTTP_Request($url, "Curl");
$request->getSession()->setRequestType("POST")->setPostArgs(array("username" => $username, "password" => $password, "email" => $email));
Core::getTPL()->sendHeader();
terminate($request->getResponse());
return $this;
}
示例9: forwardToLogin
/**
* Forward to login page.
*
* @param string $errorid Error id to output
*
* @return void
*/
function forwardToLogin($errorid)
{
if (LOGIN_REQUIRED) {
$login = BASE_URL . "?error=" . $errorid;
Hook::event("ForwardToLoginPage", array(&$login, $errorid));
doHeaderRedirection($login, false);
}
Logger::addMessage($errorid);
Core::getTPL()->display("login");
return;
}
示例10: run
/**
* Runs the community application.
*
* @return void
*/
public function run()
{
parent::run();
Core::getUser()->removeTheme();
Core::getTPL()->addHTMLHeaderFile("admin.css", "css");
Core::getLang()->load(array("AI_Global"));
$menu = new Bengine_Admin_Menu();
Core::getTPL()->addLoop("menu", $menu->getMenu());
$this->dispatch();
return;
}
示例11: indexAction
/**
* @return Bengine_Admin_Controller_Permissions
*/
protected function indexAction()
{
if ($this->getParam("add_permission")) {
$this->add($this->getParam("permission"));
} else {
if ($this->getParam("update_permission")) {
$this->update($this->getParam("delete"), $this->getParam("perm"));
}
}
$perms = Core::getQuery()->select("permissions", array("permissionid", "permission"), "", "", "permission ASC");
Core::getTPL()->addLoop("perms", $perms->fetchAll());
return $this;
}
示例12: indexAction
/**
* Index action.
*
* @return Bengine_Game_Controller_Resource
*/
protected function indexAction()
{
Hook::event("ShowResourcesBefore", array($this));
Core::getTPL()->addLoop("data", $this->data);
$productFactor = (double) Core::getConfig()->get("PRODUCTION_FACTOR");
$isMoon = (bool) Game::getPlanet()->getData("ismoon");
// Basic prod
$basicMetal = $isMoon ? 0 : Core::getOptions()->get("METAL_BASIC_PROD");
Core::getTPL()->assign("basicMetal", fNumber($basicMetal * $productFactor));
$basicSilicon = $isMoon ? 0 : Core::getOptions()->get("SILICON_BASIC_PROD");
Core::getTPL()->assign("basicSilicon", fNumber($basicSilicon * $productFactor));
$basicHydrogen = $isMoon ? 0 : Core::getOptions()->get("HYDROGEN_BASIC_PROD");
Core::getTPL()->assign("basicHydrogen", fNumber($basicHydrogen * $productFactor));
Core::getTPL()->assign("sats", Game::getPlanet()->getBuilding(Bengine_Game_Planet::SOLAR_SAT_ID));
if (Game::getPlanet()->getBuilding(Bengine_Game_Planet::SOLAR_SAT_ID) > 0) {
Core::getTPL()->assign("satsNum", fNumber(Game::getPlanet()->getBuilding(Bengine_Game_Planet::SOLAR_SAT_ID)));
$solarSatProduction = Game::getPlanet()->getBuildingProd("energy", Bengine_Game_Planet::SOLAR_SAT_ID);
Core::getTPL()->assign("satsProd", fNumber($solarSatProduction));
Core::getLang()->assign("prodPerSat", floor($solarSatProduction / Game::getPlanet()->getBuilding(Bengine_Game_Planet::SOLAR_SAT_ID)));
Core::getTPL()->assign("solar_satellite_prod", Game::getPlanet()->getData("solar_satellite_prod"));
}
// Storage capacity
Core::getTPL()->assign("storageMetal", fNumber(Game::getPlanet()->getStorage("metal") / 1000) . "k");
Core::getTPL()->assign("storageSilicon", fNumber(Game::getPlanet()->getStorage("silicon") / 1000) . "k");
Core::getTPL()->assign("sotrageHydrogen", fNumber(Game::getPlanet()->getStorage("hydrogen") / 1000) . "k");
// Total prod
Core::getTPL()->assign("totalMetal", fNumber(Game::getPlanet()->getProd("metal")));
Core::getTPL()->assign("totalSilicon", fNumber(Game::getPlanet()->getProd("silicon")));
Core::getTPL()->assign("totalHydrogen", fNumber(Game::getPlanet()->getProd("hydrogen")));
Core::getTPL()->assign("totalEnergy", fNumber(Game::getPlanet()->getEnergy()));
// Daily prod
Core::getTPL()->assign("dailyMetal", fNumber(Game::getPlanet()->getProd("metal") * 24));
Core::getTPL()->assign("dailySilicon", fNumber(Game::getPlanet()->getProd("silicon") * 24));
Core::getTPL()->assign("dailyHydrogen", fNumber(Game::getPlanet()->getProd("hydrogen") * 24));
// Weekly prod
Core::getTPL()->assign("weeklyMetal", fNumber(Game::getPlanet()->getProd("metal") * 168));
Core::getTPL()->assign("weeklySilicon", fNumber(Game::getPlanet()->getProd("silicon") * 168));
Core::getTPL()->assign("weeklyHydrogen", fNumber(Game::getPlanet()->getProd("hydrogen") * 168));
// Monthly prod
Core::getTPL()->assign("monthlyMetal", fNumber(Game::getPlanet()->getProd("metal") * 720));
Core::getTPL()->assign("monthlySilicon", fNumber(Game::getPlanet()->getProd("silicon") * 720));
Core::getTPL()->assign("monthlyHydrogen", fNumber(Game::getPlanet()->getProd("hydrogen") * 720));
$selectBox = "";
for ($i = 10; $i >= 0; $i--) {
$selectBox .= createOption($i * 10, $i * 10, 0);
}
Core::getTPL()->assign("selectProd", $selectBox);
Hook::event("ShowResourcesAfter");
$this->assign("updateAction", BASE_URL . "game/" . SID . "/Resource/Update");
return $this;
}
示例13: indexAction
/**
* Index action.
*
* @return Bengine_Game_Controller_Changelog
*/
protected function indexAction()
{
Core::getLang()->load("Main");
$meta = Game::getMeta();
define("BENGINE_REVISION", $meta["packages"]["bengine"]["game"]["revision"]);
$ip = rawurlencode($_SERVER["SERVER_ADDR"]);
$host = rawurlencode(HTTP_HOST);
// Fetching changelog data from remote server
$json = file_get_contents(VERSION_CHECK_PAGE . "?ip=" . $ip . "&host=" . $host . "&vers=" . Game::getVersion());
$data = json_decode($json, true);
$latestVersion = $data["releases"][0]["versionNumber"];
$latestRevision = $data["releases"][0]["versionCode"];
Core::getTPL()->assign("latestVersion", $latestVersion);
Core::getTPL()->assign("latestRevision", $latestRevision);
Core::getTPL()->addLoop("releases", $data["releases"]);
Core::getTPL()->assign("languageKey", Core::getLang()->getOpt("langcode"));
return $this;
}
示例14: indexAction
/**
* Index action.
*
* @return Bengine_Game_Controller_Statistics
*/
protected function indexAction()
{
Hook::event("StatisticsStart");
$this->loadTotalUnits(Bengine_Game_Controller_Shipyard::FLEET_CONSTRUCTION_TYPE);
$this->loadTotalUnits(Bengine_Game_Controller_Shipyard::DEFENSE_CONSTRUCTION_TYPE);
$statistics = array("totalMetal" => $this->fetchTotalMetal(), "totalSilicon" => $this->fetchTotalSilicon(), "totalHydrogen" => $this->fetchTotalHydrogen(), "totalPlayers" => fNumber($this->fetchTotalPlayers()), "totalPlanets" => fNumber($this->fetchTotalPlanets()), "totalMoons" => fNumber($this->fetchTotalPlanets(1)), "totalOnline" => fNumber($this->fetchOnlinePlayers()), "totalDebrisFields" => fNumber($this->fetchDebrisFields()), "totalRecentAssaults" => fNumber($this->fetchRecentAssaults()));
$totalRessources = $statistics["totalSilicon"] + $statistics["totalHydrogen"] + $statistics["totalMetal"];
$statistics["percentMetal"] = fNumber($statistics["totalMetal"] / $totalRessources * 100, 2);
$statistics["percentSilicon"] = fNumber($statistics["totalSilicon"] / $totalRessources * 100, 2);
$statistics["percentHydrogen"] = fNumber($statistics["totalHydrogen"] / $totalRessources * 100, 2);
$statistics["totalMetal"] = fNumber($statistics["totalMetal"] / 1000000, 2);
$statistics["totalSilicon"] = fNumber($statistics["totalSilicon"] / 1000000, 2);
$statistics["totalHydrogen"] = fNumber($statistics["totalHydrogen"] / 1000000, 2);
Hook::event("StatisticsFinished", array(&$statistics));
Core::getTPL()->assign($statistics);
Core::getTPL()->addLoop("ships", $this->unitCount);
return $this;
}
示例15: run
/**
* Starts the application.
*
* @return void
*/
public function run()
{
Hook::event("PreRun");
self::loadMeta();
Core::getTPL()->assign("charset", CHARACTER_SET);
Core::getTPL()->assign("langcode", Core::getLang()->getOpt("langcode"));
Core::getTPL()->assign("formaction", Core::getRequest()->getRequestedUrl());
$pageTitle = array();
if ($titlePrefix = Core::getConfig()->get("TITLE_PREFIX")) {
$pageTitle[] = $titlePrefix;
}
$pageTitle[] = Core::getConfig()->get("pagetitle");
if ($titleSuffix = Core::getConfig()->get("TITLE_SUFFIX")) {
$pageTitle[] = $titleSuffix;
}
Core::getTPL()->assign("pageTitle", implode(Core::getConfig()->get("TITLE_GLUE"), $pageTitle));
Hook::event("PostRun");
return;
}