本文整理汇总了PHP中Neuron_Core_Tools::getDurationText方法的典型用法代码示例。如果您正苦于以下问题:PHP Neuron_Core_Tools::getDurationText方法的具体用法?PHP Neuron_Core_Tools::getDurationText怎么用?PHP Neuron_Core_Tools::getDurationText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Neuron_Core_Tools
的用法示例。
在下文中一共展示了Neuron_Core_Tools::getDurationText方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSpeedUpBuilding
private function getSpeedUpBuilding($data)
{
$text = Neuron_Core_Text::getInstance();
$inputData = $this->getInputData();
$id = isset($data['building']) ? $data['building'] : null;
$building = Dolumar_Buildings_Building::getFromId($id);
if (!$building) {
return '<p>Invalid input: building not found: ' . $id . '</p>';
}
$price = PREMIUM_SPEEDUP_BUILDINGS_PRICE;
$unit = PREMIUM_SPEEDUP_BUILDINGS_UNIT;
if (isset($inputData['duration'])) {
$selected = abs(intval($inputData['duration']));
$desc = Neuron_Core_Tools::putIntoText($text->get('confdesc_building', 'speedup', 'statusbar'), array('building' => $building->getName(), 'amount' => Neuron_Core_Tools::getDurationText($selected * $unit)));
return $this->getConfirm($price, $unit, $selected, $desc);
}
$time = $building->getTimeLeft();
return $this->getSpeedUpHTML('building', $time, $price, $unit);
}
示例2: getContent
public function getContent()
{
$text = Neuron_Core_Text::__getInstance();
$text->setSection('profile');
$text->setFile('account');
if ($this->player->isFound()) {
$page = new Neuron_Core_Template();
$page->set('playerProfile', $text->get('playerProfile'));
$page->set('creation', $text->get('creation'));
$page->set('removal', $text->get('removal'));
$page->set('lastRef', $text->get('lastRef'));
$page->set('id', $this->player->getId());
$page->set('player', Neuron_Core_Tools::output_varchar($this->player->getNickname()));
// Date values
$creation = $this->player->getCreationDate();
if ($creation > 0) {
$page->set('creation_value', date(DATETIME, $creation));
}
// Removal
$removal = $this->player->getRemovalDate();
if ($removal > 0) {
$page->set('removal_value', date(DATETIME, $removal));
}
// Online now
$online = null;
$lastRefresh = $this->player->getLastRefresh();
if ($lastRefresh > time() - 60 * 5) {
$online = $text->get('onlineNow');
} else {
$online = Neuron_Core_Tools::putIntoText($text->get('onlineAgo'), array(Neuron_Core_Tools::getDurationText(time() - $lastRefresh)));
}
$page->set('lastRef_value', $online);
$iv = 0;
foreach ($this->player->getVillages() as $v) {
$page->addListValue('villages', array(Neuron_Core_Tools::output_varchar($v->getName()), $v->getId()));
$iv++;
}
$page->set('villages', $text->get($iv > 1 ? 'villages' : 'village'));
$page->set('clans', $text->get('clans'));
// Add status field
$page->set('status', $text->get('status'));
if (!$this->player->isPlaying()) {
$status = $text->get('removed');
} elseif ($this->player->inVacationMode()) {
$status = $text->get('vacation');
} elseif ($this->player->isOnline()) {
$status = $text->get('online');
} else {
$status = $text->get('offline');
}
$page->set('status_value', $status);
$me = Neuron_GameServer::getPlayer();
if ($me && $me->isModerator()) {
$page->set('admin_url', Neuron_Core_Tools::output_varchar(Neuron_GameServer_Pages_Admin_Page::getUrl('user', array('id' => $this->player->getId()))));
}
// Fetch clans
foreach ($this->player->getClans() as $v) {
$page->addListValue('clans', array('id' => $v->getId(), 'name' => Neuron_Core_Tools::output_varchar($v->getName())));
}
$out = $page->parse('playerProfile.tpl');
foreach ($this->player->getVillages() as $v) {
$out .= $this->getVillageProfile($v);
}
return $out;
}
}
示例3: getDescription
public function getDescription($data = array())
{
return parent::getDescription(array('delay' => Neuron_Core_Tools::getDurationText($this->getBonusFromLevel(), false)));
}
示例4: getHistoryText
private function getHistoryText($action, $data)
{
$name = $action;
switch ($action) {
case 'unban':
case 'ban':
$name = $data['channel'] . ' ' . $name;
break;
}
// I want to go again, mommy!
switch ($action) {
case 'ban':
$name .= ' ' . Neuron_Core_Tools::getDurationText($data['duration']);
break;
}
return $name;
}
示例5: 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');
}
示例6: getType_text
public function getType_text()
{
$text = Neuron_Core_Text::__getInstance();
$type = $this->getType();
switch ($type) {
case 'battle':
case 'instant':
return $text->get($type, 'types', 'effects');
break;
case 'boost':
return Neuron_Core_Tools::putIntoText($text->get($type, 'types', 'effects'), array('duration' => Neuron_Core_Tools::getDurationText($this->getDuration(), true)));
break;
}
}