本文整理汇总了PHP中Neuron_Core_Tools::getCountdown方法的典型用法代码示例。如果您正苦于以下问题:PHP Neuron_Core_Tools::getCountdown方法的具体用法?PHP Neuron_Core_Tools::getCountdown怎么用?PHP Neuron_Core_Tools::getCountdown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Neuron_Core_Tools
的用法示例。
在下文中一共展示了Neuron_Core_Tools::getCountdown方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCustomContent
public function getCustomContent($input)
{
$text = Neuron_Core_Text::__getInstance();
$this->aInput = $input;
$sPage = isset($this->aInput['action']) ? $this->aInput['action'] : null;
if ($sPage == 'donate') {
$this->hideGeneralOptions();
return $this->getTradeContent();
}
$page = new Neuron_Core_Template();
// Add the ongoing transfers
$transfers = $this->getOngoingTransfers();
foreach ($transfers as $v) {
if (isset($v['resource'])) {
$type = 'resources';
} else {
if (isset($v['rune'])) {
$type = 'runes';
} else {
if (isset($v['equipment'])) {
$type = 'equipment';
} else {
$type = 'unknown';
}
}
}
$page->addListValue('transfers', array('countdown' => Neuron_Core_Tools::getCountdown($v['receiveddate']), 'type' => $type, 'from' => $v['from']->getDisplayName(), 'to' => $v['to']->getDisplayName(), 'direction' => $v['type']));
}
//return print_r ($transfers, true);
$page->set('overview', parent::getCustomContent($input));
return $page->parse('buildings/market_overview.phpt');
}
示例2: getContent
public function getContent()
{
$server = Neuron_GameServer::getServer();
$page = new Neuron_Core_Template();
if ($server->getEndgameStartDate() > time()) {
$page->set('endgame_start', Neuron_Core_Tools::getCountdown($server->getEndgameStartDate()));
} else {
$page->set('endgame_start', '<strong>already started</strong>');
}
return $page->parse('dolumar/serversettings.phpt');
}
示例3: getContent
public function getContent()
{
$map = $this->getServer()->getMap();
if (!$map instanceof Dolumar_Underworld_Map_Map) {
$this->reloadWindow();
return '<p>Mission is finished.</p>';
}
$mission = $map->getMission();
$sides = $mission->getSides();
$objective = $mission->getObjective();
// Check the victory conditions
$objective->checkVictoryConditions();
if ($objective instanceof Dolumar_Underworld_Models_Objectives_TakeAndHold) {
$out = '<p>Hold the center castle until the counter reaches 0.</p>';
$scores = $objective->getScores();
$out .= '<ul>';
foreach ($scores as $v) {
$timeleft = $objective->getHoldDuration() - $v['score'];
if ($timeleft > 0) {
if ($v['increasing']) {
$timeleft = Neuron_Core_Tools::getCountdown(NOW + $timeleft);
} else {
$timeleft = Neuron_Core_Tools::getDuration($timeleft);
}
} else {
$timeleft = 0;
}
$out .= '<li>' . $v['side']->getDisplayName() . ': ' . $timeleft . '</li>';
}
$out .= '</ul>';
} else {
$out = '<p>Just explore ^^</p>';
}
/*
foreach ($sides as $v)
{
$checkpoints = $objective->getConqueredCheckpoints ($v);
$score = count ($checkpoints);
$out .= '<p>- Team ' . $v->getId () . ': ' . $score . '</p>';
}*/
$out .= '<p>' . Neuron_URLBuilder::getInstance()->getOpenUrl('Battle', 'Battle reports', array()) . '</p>';
return $out;
}
示例4: getChooseUnit
protected function getChooseUnit($building)
{
$building = $this->village->buildings->getBuilding($building);
if (!$building instanceof $this->buildingType) {
return '<p>Invalid input: building not found.</p>';
}
// Count the thieves in this building
$allUnits = $building->getUnits();
$page = new Neuron_Core_Template();
$page->setTextSection('chooseUnit', 'thievery');
$units = array();
foreach ($allUnits as $v) {
$location = $v->getLocation();
$units[] = array('id' => $v->getId(), 'name' => $v->getName(false, true), 'location' => Neuron_Core_Tools::output_varchar($location->getName()), 'location_id' => $location->getId(), 'moving' => $v->isMoving() ? Neuron_Core_Tools::getCountdown($v->getArrivalDate()) : null);
}
$page->set('units', $units);
return $page->parse('thieves/chooseThief.phpt');
}
示例5: getContent
public function getContent()
{
// Fetch thze model
$login = Neuron_Core_Login::__getInstance();
$text = Neuron_Core_Text::__getInstance();
if ($login->isLogin()) {
$player = Neuron_GameServer::getPlayer();
if ($player->isBanned('messages')) {
$end = $player->getBanDuration('messages');
$duration = Neuron_Core_Tools::getCountdown($end);
return '<p class="false">' . Neuron_Core_Tools::putIntoText($text->get('banned', 'messages', 'messages'), array('duration' => $duration)) . '</p>';
} elseif (!$player->isEmailVerified()) {
return '<p class="false">' . $text->get('validateEmail', 'main', 'account') . '</p>';
} else {
$objMessages = new Neuron_Structure_Messages($player);
return $objMessages->getPageHTML($this->getInputData());
}
} else {
$this->throwError($text->get('noLogin', 'main', 'main'));
}
}
示例6: getGeneralContent
public function getGeneralContent($showAll = false)
{
// Fetch thze portal
$portals = Dolumar_Map_Portal::getFromBuilding($this);
/*
if (count ($portals) == 0)
{
return '<p class="false">This portal leads to nowhere...</p>';
}
*/
$targets = array();
foreach ($portals as $v) {
$village = $v->getOtherSide($this->getVillage());
$targets[] = $village->getDisplayName();
}
$page = new Neuron_Core_Template();
$destroydate = $this->getDestroyDate();
if ($destroydate) {
$page->set('timeleft', Neuron_Core_Tools::getCountdown($this->getDestroyDate()));
}
$page->set('targets', $targets);
return $page->parse('buildings/portal.phpt');
}
示例7: getCustomOutput
public function getCustomOutput()
{
$server = Neuron_GameServer::getServer();
$launchdate = null;
if (defined('LAUNCH_DATE')) {
$launchdate = LAUNCH_DATE;
}
// Get launch date in db
$dblaunchdate = $server->getData('launchdate');
if ($dblaunchdate && $dblaunchdate > $launchdate) {
$launchdate = $dblaunchdate;
}
// Check for the Final Countdown!
if (isset($launchdate) && !isset($_GET['DEBUG']) && !isset($_SESSION['debug'])) {
header("Content-Type:text/html;charset=utf-8");
if (isset($_GET['debug'])) {
$_SESSION['debug'] = true;
}
if ($launchdate > time()) {
$page = new Neuron_Core_Template();
$page->set('launchdate', Neuron_Core_Tools::getCountdown($launchdate));
$page->set('name', $server->getData('servername'));
return $page->parse('launchdate.phpt');
}
}
if ($server->getData('gamestate') >= Dolumar_Players_Server::GAMESTATE_ENDGAME_FINISHED) {
header("Content-Type:text/html;charset=utf-8");
$page = new Neuron_Core_Template();
$page->set('name', $server->getData('servername'));
$winner = $this->getWinner();
$page->set('winner', $winner);
return $page->parse('finished.phpt');
}
}
示例8: getMoveBuilding
private function getMoveBuilding()
{
$page = new Neuron_Core_Template();
$input = $this->getInputData();
$player = Neuron_GameServer::getPlayer();
$creditcost = $this->convertCredits(self::COST_MOVEBUILDING);
$village = $player->getMyVillage(isset($input['village']) ? $input['village'] : false);
if ($village) {
// Select building
$building = isset($input['building']) ? $input['building'] : false;
$building = $building ? $village->buildings->getBuilding($building) : false;
$page->set('village', $village->getId());
if ($this->isMoveFree($village)) {
$page->set('freetime', Neuron_Core_Tools::getCountdown($this->getFreeMoveEndDate($village)));
}
if ($building && $building->isMoveable()) {
$page->set('buildingname', $building->getName(false));
$page->set('credits', $creditcost);
$loc = array('x' => isset($input['x']) ? floor($input['x']) : null, 'y' => isset($input['y']) ? floor($input['y']) : null);
if (isset($loc['x']) && isset($loc['y'])) {
// Let's check this location
$chk = $building->checkBuildLocation($village, $loc['x'], $loc['y']);
if ($chk[0]) {
if ($this->isMoveFree($village)) {
// Move thze building
$oldloc = $building->getLocation();
$building->setLocation($loc['x'], $loc['y']);
$page->set('moved', true);
$logs = Dolumar_Players_Logs::getInstance();
$logs->addPremiumMoveBuilding($building, $loc['x'], $loc['y'], $oldloc[0], $oldloc[1]);
$this->reloadLocation($loc['x'], $loc['y']);
$this->reloadLocation($oldloc[0], $oldloc[1]);
} else {
$data = array('village' => $village->getId(), 'action' => 'movebuilding', 'building' => $building->getId(), 'x' => $loc['x'], 'y' => $loc['y']);
// Generate approve URL
$page->set('confirm_url', htmlentities($player->getCreditUseUrl(self::COST_MOVEBUILDING, $data, 'Move building')));
}
} else {
$page->set('error', $chk[1]);
}
}
$page->set('building', $building->getId());
$page->set('locx', $loc['x']);
$page->set('locy', $loc['y']);
return $page->parse('dolumar/premium/selectlocation.phpt');
} else {
// Show a list of all buildings
$buildings = $village->buildings->getBuildings();
foreach ($buildings as $v) {
if ($v->isMoveable()) {
$loc = $v->getLocation();
$page->addListValue('buildings', array('id' => $v->getId(), 'name' => $v->getName(false), 'location' => '[' . $loc[0] . ',' . $loc[1] . ']'));
}
}
return $page->parse('dolumar/premium/selectbuildings.phpt');
}
} else {
$villages = $player->getVillages();
foreach ($villages as $v) {
$page->addListValue('villages', array('id' => $v->getId(), 'name' => Neuron_Core_Tools::output_varchar($v->getName())));
}
$page->set('action', 'movebuilding');
$page->set('village', isset($village) && $village ? $village->getId() : $player->getCurrentVillage()->getId());
return $page->parse('dolumar/premium/selectvillage.phpt');
}
}
示例9: processInput
public function processInput()
{
$login = Neuron_Core_Login::getInstance();
$text = Neuron_Core_Text::getInstance();
$input = $this->getInputData();
if ($login->isLogin()) {
if (isset($input['message'])) {
$message = trim($input['message']);
if (!empty($message)) {
$user = Neuron_GameServer::getPlayer();
if (!$user->isPlaying()) {
$this->alert($text->get('registerfirst'));
} elseif (!$user->isEmailVerified()) {
$this->alert($text->get('validateEmail_short', 'main', 'account'));
} elseif ($user->isBanned('chat')) {
$end = $user->getBanDuration('chat');
$duration = Neuron_Core_Tools::getCountdown($end);
$this->alert(Neuron_Core_Tools::putIntoText($text->get('banned'), array('duration' => $duration)));
} else {
// Post message
$this->postMessage($input['message']);
}
}
}
}
// Check for input: load older messages
if (isset($input['loadprevious'])) {
$before = $input['loadprevious'];
if ($html = $this->getOlderMessages($before)) {
$this->addHtmlToElement('messagecontainer', $html, 'top');
} else {
$this->addHtmlToElement('messagecontainer', '<div></div>', 'top');
}
}
// If not using blocking, we can "safely" process it right now
if (!self::USE_BLOCKING) {
$this->getRefresh();
}
}
示例10: getContent
public function getContent()
{
$this->me = Neuron_GameServer::getPlayer();
if (!$this->me) {
return '<p>Please login.</p>';
}
if (!isset($this->army)) {
return '<p>Army not found.</p>';
}
if (!$this->army->canView($this->me)) {
return $this->getOutsiderView();
}
$action = $this->getInput('action');
switch ($action) {
case 'move':
$this->prcMove();
break;
case 'player':
$this->prcPlayer();
break;
case 'merge':
$this->prcMerge();
break;
case 'attack':
$this->prcAttack();
break;
case 'split':
return $this->prcSplit();
break;
case 'withdraw':
$this->prcWithdraw();
break;
}
$page = new Neuron_Core_Template();
// Show them a list of all squads
$squads = $this->army->getSquads();
foreach ($squads as $v) {
$data = array('name' => $v->getDisplayName(), 'units' => array(), 'owner' => $v->getVillage()->getOwner()->getDisplayName());
foreach ($v->getUnits() as $vv) {
$data['units'][] = array('name' => $vv->getDisplayName(), 'amount' => $vv->getAmount(), 'image' => $vv->getImageUrl(), 'numberedname' => $vv->getAmount() . ' ' . $vv->getDisplayName($vv->getAmount() > 1), 'morale' => $vv->getMorale());
}
$page->addListValue('squads', $data);
}
// Players
$players = $this->army->getPlayers();
foreach ($players as $v) {
$page->addListValue('players', array('status' => $this->army->isLeader($v) ? 'leader' : 'normal', 'id' => $v->getId(), 'name' => $v->getDisplayName(), 'canPromote' => $this->army->canPromote($this->me, $v), 'canDemote' => $this->army->canDemote($this->me, $v)));
$page->sortList('players');
}
$page->set('movepoints', $this->army->getMovepoints());
$nextpoint = $this->army->getNextMovepointDate();
if (isset($nextpoint) && $this->me->isPremium()) {
$page->set('nextpoint', Neuron_Core_Tools::getCountdown($nextpoint));
}
return $page->parse('dolumar/underworld/windows/regiment.phpt');
}
示例11: tryAuth
private function tryAuth()
{
// Check for launch date
if (defined('LAUNCH_DATE')) {
if (LAUNCH_DATE > time()) {
$page = new Neuron_Core_Template();
$page->set('name', '');
$page->set('launchdate', Neuron_Core_Tools::getCountdown(LAUNCH_DATE));
echo $page->parse('launchdate.phpt');
exit;
}
}
$openid = getOpenIDURL();
$consumer = getConsumer();
// Begin the OpenID authentication process.
$auth_request = $consumer->begin($openid);
// No auth request means we can't begin OpenID.
if (!$auth_request) {
displayError("Authentication error; not a valid OpenID:<br />" . $openid);
}
$sreg_request = Auth_OpenID_SRegRequest::build(array(), array('email', 'language', 'country', 'nickname', 'dob', 'gender'));
if ($sreg_request) {
$auth_request->addExtension($sreg_request);
}
// Add AX request for notification URL
$ax = new Auth_OpenID_AX_FetchRequest();
$ax->add(new Auth_OpenID_AX_AttrInfo('http://www.browser-games-hub.org/schema/openid/notify_url.xml', 1, false, 'notify_url'));
$ax->add(new Auth_OpenID_AX_AttrInfo('http://www.browser-games-hub.org/schema/openid/profilebox_url.xml', 1, false, 'profilebox_url'));
$ax->add(new Auth_OpenID_AX_AttrInfo('http://www.browser-games-hub.org/schema/openid/messagebundle_url.xml', 1, false, 'messagebundle_url'));
$ax->add(new Auth_OpenID_AX_AttrInfo('http://www.browser-games-hub.org/schema/openid/fullscreen.xml', 1, false, 'fullscreen'));
$ax->add(new Auth_OpenID_AX_AttrInfo('http://www.browser-games-hub.org/schema/openid/userstats_url.xml', 1, false, 'userstats_url'));
$ax->add(new Auth_OpenID_AX_AttrInfo('http://www.browser-games-hub.org/schema/openid/hide_advertisement.xml', 1, false, 'hide_advertisement'));
$ax->add(new Auth_OpenID_AX_AttrInfo('http://www.browser-games-hub.org/schema/openid/hide_chat.xml', 1, false, 'hide_chat'));
$ax->add(new Auth_OpenID_AX_AttrInfo('http://www.browser-games-hub.org/schema/openid/tracker_url.xml', 1, false, 'tracker_url'));
$ax->add(new Auth_OpenID_AX_AttrInfo('http://www.browser-games-hub.org/schema/openid/welcome_url.xml', 1, false, 'welcome_url'));
$auth_request->addExtension($ax);
/*
$policy_uris = isset ($_GET['policies']) ? $_GET['policies'] : null;
$pape_request = new Auth_OpenID_PAPE_Request($policy_uris);
if ($pape_request)
{
$auth_request->addExtension($pape_request);
}
*/
// Redirect the user to the OpenID server for authentication.
// Store the token for this authentication so we can verify the
// response.
// For OpenID 1, send a redirect. For OpenID 2, use a Javascript
// form to send a POST request to the server.
if ($auth_request->shouldSendRedirect()) {
$redirect_url = $auth_request->redirectURL(getTrustRoot(), getReturnTo());
// If the redirect URL can't be built, display an error
// message.
if (Auth_OpenID::isFailure($redirect_url)) {
displayError("Could not redirect to server: " . $redirect_url->message);
} else {
// Send redirect.
if (!$this->disableredirect) {
header("Location: " . $redirect_url);
}
echo '<html>';
echo '<head><style type="text/css">body { background: black; color: white; }</style><head>';
echo '<body>';
echo '<p>Redirecting to OpenID Gateway...</p>';
if ($this->disableredirect) {
echo '<p><a href="' . $redirect_url . '">Click to continue.</a></p>';
}
echo '</body>';
echo '</html>';
}
} else {
// Generate form markup and render it.
$form_id = 'openid_message';
$form_html = $auth_request->htmlMarkup(getTrustRoot(), getReturnTo(), false, array('id' => $form_id));
// Display an error if the form markup couldn't be generated;
// otherwise, render the HTML.
if (Auth_OpenID::isFailure($form_html)) {
displayError("Could not redirect to server: " . $form_html->message);
} else {
//echo '<p>Redirecting to OpenID Gateway...</p>';
if (!$this->disableredirect) {
print $form_html;
} else {
$form_html = str_replace("onload='document.forms[0].submit();", "", $form_html);
$form_html = str_replace('<script>var elements = document.forms[0].elements;for (var i = 0; i < elements.length; i++) { elements[i].style.display = "none";}</script>', '', $form_html);
print $form_html;
}
}
}
}
示例12: processInput
public function processInput()
{
$text = Neuron_Core_Text::__getInstance();
$text->setFile('chat');
$text->setSection('chat');
$login = Neuron_Core_Login::__getInstance();
$input = $this->getRequestData();
if (!isset($input['channel'])) {
$this->switchChannel($this->getDefaultChannel());
} else {
$this->channel = intval($input['channel']);
}
$input = $this->getInputData();
if ($login->isLogin()) {
if (isset($input['message'])) {
$message = trim($input['message']);
if (!empty($message)) {
$user = Neuron_GameServer::getPlayer();
if (!$user->isPlaying()) {
$this->alert($text->get('registerfirst'));
} elseif (!$user->isEmailVerified()) {
$this->alert($text->get('validateEmail_short', 'main', 'account'));
} elseif ($user->isBanned('chat')) {
$end = $user->getBanDuration('chat');
$duration = Neuron_Core_Tools::getCountdown($end);
$this->alert(Neuron_Core_Tools::putIntoText($text->get('banned'), array('duration' => $duration)));
} else {
// Post message
$this->postMessage($input['message']);
}
}
}
} else {
$this->alert($text->get('login'));
}
}
示例13: addBans
private function addBans($page, $objUser)
{
// Perform thze action
$duration = Neuron_Core_Tools::getInput('_POST', 'duration', 'int');
$action = Neuron_Core_Tools::getInput('_POST', 'action', 'varchar');
$channel = Neuron_Core_Tools::getInput('_GET', 'channel', 'varchar');
$reason = Neuron_Core_Tools::getInput('_POST', 'reason', 'varchar');
if ($channel && $action) {
switch ($action) {
case 'ban':
$objUser->ban($channel, $duration);
$this->addModeratorAction('ban', array('channel' => $channel, 'duration' => $duration), $reason, $objUser, true);
break;
case 'unban':
$objUser->unban($channel);
$this->addModeratorAction('unban', array('channel' => $channel, 'duration' => $duration), $reason, $objUser, true);
break;
}
}
$channels = array('chat' => 'Chat channel', 'messages' => 'Messages');
$bans = array();
foreach ($channels as $k => $v) {
$end = $objUser->getBanDuration($k);
if ($end > time()) {
$duration = Neuron_Core_Tools::getCountdown($end);
} else {
$duration = '-';
}
$bans[] = array('id' => $k, 'channel' => $v, 'url' => $this->getUrl('user', array('id' => $objUser->getId(), 'channel' => $k)), 'duration' => $duration);
}
$page->set('bans', $bans);
}
示例14: showUpgradeContent
private function showUpgradeContent($error = null, $errorA = array())
{
$text = Neuron_Core_Text::__getInstance();
$page = new Neuron_Core_Template();
$input = $this->objWindow->getInputData();
$lvl = $this->getLevel();
if (!empty($error)) {
if ($error == 'unfinished') {
$errorA = array(Neuron_Core_Tools::getCountdown(max($this->data['lastUpgradeDate'], $this->data['readyDate'])));
}
} elseif (!$this->getVillage()->readyToBuild()) {
$error = 'busy';
} elseif (!$this->isFinished()) {
$error = 'unfinished';
$errorA = array(Neuron_Core_Tools::getCountdown(max($this->data['lastUpgradeDate'], $this->data['readyDate'])));
}
if (!empty($error)) {
$txterr = Neuron_Core_Tools::putIntoText($text->get($error, 'upgradeError', 'building'), $errorA);
$jsondata = json_encode(array('page' => 'upgrade', 'queue' => 'true', 'upgrade' => 'confirm', 'runeSelection' => isset($input['runeSelection']) ? $input['runeSelection'] : null));
$page->set('error', $txterr);
$page->set('errorV', $error);
if ($error != 'done' && isset($input['upgrade'])) {
$this->objWindow->dialog($txterr, $text->get('queueUpgrade', 'queue', 'building'), 'windowAction (this, ' . $jsondata . ');', $text->get('okay', 'main', 'main'), 'void(0);');
}
}
$page->set('about', $text->get('about', 'upgrade', 'building'));
$page->set('upgrade', $text->get('upgrade', 'upgrade', 'building'));
$page->set('cost', $text->get('cost', 'upgrade', 'building'));
$page->set('duration', Neuron_Core_Tools::getDurationText($this->getUpgradeTime($this->getVillage())));
$page->set('info', $this->getUpgradeInformation());
$page->set('upgradeAll', Neuron_Core_Tools::putIntoText($text->get('upgradeAll', 'upgrade', 'building'), array($this->getName(true))));
$page->set('upgradeLink', Neuron_Core_Tools::putIntoText($text->get('startUpgrade', 'upgrade', 'building'), array($this->getName(true), $lvl + 1)));
$upgrade = $this->getUpgradeCost_text($this->getVillage(), true);
$page->set('upgradeCost', $upgrade);
$page->set('back', $text->getClickTo($text->get('back', 'building', 'building')));
return $page->parse('buildings/general_upgrade.tpl');
}
示例15: getCounterHTML
private function getCounterHTML()
{
$text = Neuron_Core_Text::getInstance();
// Loop trough the list
$p = '';
$l = '';
$showVillageName = $this->bShowVillageNames;
asort($this->counters);
foreach ($this->counters as $v) {
// Can speed up?
if (isset($v[5])) {
$s = ' <a class="speedup" href="javascript:void(0);" onclick="openWindow(\'Speedup\', ' . htmlentities(json_encode($v[5])) . ');">' . $text->get('speedup', 'status', 'statusbar') . '</a>';
} else {
$s = '';
}
if ($v[0] > time()) {
if ($showVillageName || $v[4]) {
$p .= '<li class="' . $v[3] . '">[' . Neuron_Core_Tools::getCountdown($v[0]) . '] ' . $v[1] . ': ' . $v[2] . $s . '</li>';
} else {
$p .= '<li class="' . $v[3] . '">[' . Neuron_Core_Tools::getCountdown($v[0]) . '] ' . $v[2] . $s . '</li>';
}
} elseif ($v[0] === null) {
if ($showVillageName || $v[4]) {
$l .= '<li class="' . $v[3] . '">' . $v[1] . ': ' . $v[2] . $s . '</li>';
} else {
$l .= '<li class="' . $v[3] . '">' . $v[2] . $s . '</li>';
}
}
}
return '<ul class="statusbar">' . $p . $l . '</ul>';
}