当前位置: 首页>>代码示例>>PHP>>正文


PHP Neuron_Core_Tools::splitInPages方法代码示例

本文整理汇总了PHP中Neuron_Core_Tools::splitInPages方法的典型用法代码示例。如果您正苦于以下问题:PHP Neuron_Core_Tools::splitInPages方法的具体用法?PHP Neuron_Core_Tools::splitInPages怎么用?PHP Neuron_Core_Tools::splitInPages使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Neuron_Core_Tools的用法示例。


在下文中一共展示了Neuron_Core_Tools::splitInPages方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getContent

 public function getContent()
 {
     $text = Neuron_Core_Text::__getInstance();
     $player = Neuron_GameServer::getPlayer();
     if (!$player) {
         return $this->throwError($text->get('login', 'login', 'account'));
     }
     $input = $this->getInputData();
     $request = $this->getRequestData();
     $mapper = Neuron_GameServer_Mappers_BlockingChatMapper::getInstance();
     $total = $mapper->countPrivateMessages($player);
     if (isset($input['page'])) {
         $current = $input['page'];
         $request['page'] = $current;
         $this->updateRequestData($request);
     } else {
         $current = isset($request['page']) ? $request['page'] : 0;
     }
     $perpage = 10;
     $page = new Neuron_Core_Template();
     $pages = Neuron_Core_Tools::splitInPages($page, $total, $current, $perpage);
     $messages = $mapper->getPrivateChats($player, $pages['start'], $pages['perpage']);
     $page->set('messages', $messages);
     return $page->parse('gameserver/chat/privatemessages.phpt');
 }
开发者ID:catlabinteractive,项目名称:dolumar-engine,代码行数:25,代码来源:Messages.php

示例2: getContent

 public function getContent()
 {
     if (!$this->objVillage) {
         $text = Neuron_Core_Text::__getInstance();
         return '<p class="false">' . $text->get('login', 'login', 'account') . '</p>';
     }
     $input = $this->getInputData();
     // Get logs from this village
     $objLogs = Dolumar_Players_Logs::__getInstance();
     $iPage = isset($input['page']) ? $input['page'] : 0;
     $page = new Neuron_Core_Template();
     // Split in pages
     $limit = Neuron_Core_Tools::splitInPages($page, $objLogs->countLogs($this->objVillage), $iPage, 10);
     $objLogs->addMyVillage($this->objVillage);
     $logs = $objLogs->getLogs($this->objVillage, $limit['start'], $limit['perpage'], 'DESC');
     return $this->getLogHTML($page, $objLogs, $logs);
 }
开发者ID:Toxicat,项目名称:dolumar,代码行数:17,代码来源:Logbook.php

示例3: getResults

 private function getResults()
 {
     $input = $this->getInputData();
     if (isset($input['search']) && $input['search'] == 'result') {
         $db = Neuron_DB_Database::getInstance();
         $count = $this->getCountQuery();
         if (empty($count)) {
             $text = Neuron_Core_Text::getInstance();
             $this->alert($text->get('notEnoughFields', 'form', 'search'));
             return false;
         }
         $amount = $db->query($count);
         $total = $amount[0]['amount'];
         $page = new Neuron_Core_Template();
         $limit = Neuron_Core_Tools::splitInPages($page, $total, isset($input['page']) ? $input['page'] : 0, $this->perpage, 10, $input, 'searchplayers');
         $query = $this->getSearchQuery($limit);
         $this->printResults($page, $db->query($query));
         return $page->parse('search/results.phpt');
     }
     return false;
 }
开发者ID:Toxicat,项目名称:dolumar,代码行数:21,代码来源:Search.php

示例4: getBody

 public function getBody()
 {
     $timeframe = Neuron_Core_Tools::getInput('_GET', 'timeframe', 'int', 60 * 60 * 48);
     $page = new Neuron_Core_Template();
     $page->set('timeframe', $timeframe);
     $objLogs = Dolumar_Players_Logs::getInstance();
     $objLogs->setTimeInterval(NOW - $timeframe, NOW);
     $pageid = Neuron_Core_Tools::getInput('_GET', 'page', 'int', 1);
     $limit = Neuron_Core_Tools::splitInPages($page, $objLogs->getSuspiciousLogsCounter(), $pageid, self::SUSPICIOUS_TRANSACTIONS_PERPAGE, 7, array('timeframe' => $timeframe), 'multis');
     //print_r ($limit);
     //$logs = $objLogs->getSuspiciousLogs ();
     $logs = $objLogs->getSuspiciousLogs($limit['start'], $limit['perpage'], 'DESC');
     foreach ($logs as $v) {
         $player = Dolumar_Players_Village::getFromId($v['village'])->getOwner();
         $page->addListValue('logs', array('action' => $objLogs->getLogText($v, false), 'date' => date(DATETIME, $v['timestamp']), 'player' => $player->getDisplayName()));
     }
     // Output the shizzle
     $html = $page->parse('dolumar/pages/admin/multis/dangeroustransactions.phpt');
     $html .= parent::getBody();
     return $html;
 }
开发者ID:Toxicat,项目名称:dolumar,代码行数:21,代码来源:Multis.php

示例5: getContent

 public function getContent()
 {
     $player = Neuron_GameServer::getPlayer();
     $input = $this->getInputData();
     if (!$player) {
         return false;
     }
     $page = new Neuron_Core_Template();
     $clans = $player->getClans();
     if (count($clans) > 0) {
         $objlogs = Dolumar_Players_ClanLogs::getInstance();
         $iPage = isset($input['page']) ? $input['page'] : 0;
         // Split in pages
         $limit = Neuron_Core_Tools::splitInPages($page, $objlogs->countClanLogs($clans), $iPage, 10);
         $objlogs->clearMyVillages();
         foreach ($player->getVillages() as $village) {
             $objlogs->addMyVillage($village);
         }
         $logs = $objlogs->getClanLogs($clans, $limit['start'], $limit['perpage'], 'DESC');
         return $this->getLogHTML($page, $objlogs, $logs);
     }
     return false;
 }
开发者ID:Toxicat,项目名称:dolumar,代码行数:23,代码来源:Clanlogs.php

示例6: getVillageRanking

 public function getVillageRanking()
 {
     $text = Neuron_Core_Text::__getInstance();
     $db = Neuron_Core_Database::__getInstance();
     $input = $this->getInputData();
     $page = new Neuron_Core_Template();
     $text->setFile('ranking');
     $text->setSection('ranking');
     $page->set('title', $text->get('villageRating'));
     $page->set('village', $text->get('village'));
     $page->set('value', $text->get('value'));
     $data = $this->getRequestData();
     $perPage = 25;
     $myDefaultPage = 1;
     if (isset($data['village'])) {
         $village = Dolumar_Players_Village::getVillageFromId($data['village']);
         $myVillageId = $data['village'];
         $myRank = $village->getRank();
         $myDefaultPage = floor($myRank[0] / $perPage) + 1;
     } else {
         $myVillageId = 0;
         // Load "main village" from this user
         $myself = Neuron_GameServer::getPlayer();
         if ($myself) {
             $village = $myself->getMainVillage();
             if ($village) {
                 $myVillageId = $village->getId();
                 $myRank = $village->getRank();
                 $myDefaultPage = floor($myRank[0] / $perPage) + 1;
             }
         }
     }
     $currentPage = isset($input['page']) ? $input['page'] : $myDefaultPage;
     $limit = Neuron_Core_Tools::splitInPages($page, Dolumar_Players_Ranking::countRanking(), $currentPage, $perPage, 6);
     $l = Dolumar_Players_Ranking::getRanking($limit['start'], $limit['perpage']);
     // Get my villages
     $myself = Neuron_GameServer::getPlayer();
     if ($myself && $myself->isPremium()) {
         $distances = $myself->getVillages();
     } else {
         $distances = array();
     }
     $i = $limit['start'];
     foreach ($l as $v) {
         $i++;
         // Calcualte the distances
         $w_distances = array();
         foreach ($distances as $k => $vv) {
             $w_distances[$k] = Neuron_Core_Tools::output_distance(Dolumar_Map_Map::getDistanceBetweenVillages($vv, $v), true, true);
         }
         $page->addListValue('ranking', array($i, Neuron_Core_Tools::output_varchar($v->getName()), $v->getId(), $v->getNetworth(), $v->getId() == $myVillageId, $w_distances));
         //$v->__destruct ();
     }
     // Add the footnote
     $t_distances = array();
     foreach ($distances as $k => $v) {
         $t_distances[$k] = Neuron_Core_Tools::output_varchar($v->getName());
     }
     $page->set('distances', $t_distances);
     return $page->parse('ranking/ranking.tpl');
 }
开发者ID:Toxicat,项目名称:dolumar,代码行数:61,代码来源:Ranking.php

示例7: getBattleOverview

 private function getBattleOverview()
 {
     //$db = Neuron_Core_Database::__getInstance ();
     $text = Neuron_Core_Text::__getInstance();
     $text->setSection('overview');
     $text->setFile('battle');
     $input = $this->getInputData();
     // Get logs from this village
     $objLogs = Dolumar_Players_Logs::getInstance();
     $objLogs->addShowOnly('attack');
     $objLogs->addShowOnly('defend');
     $iPage = isset($input['page']) ? $input['page'] : 0;
     $page = new Neuron_Core_Template();
     // Split in pages
     $limit = Neuron_Core_Tools::splitInPages($page, $objLogs->countLogs($this->village), $iPage, 10);
     $objLogs->addMyVillage($this->village);
     $logs = $objLogs->getLogs($this->village, $limit['start'], $limit['perpage'], 'DESC');
     $loghtml = $this->getLogHTML($page, $objLogs, $logs);
     $output = new Neuron_Core_Template();
     $output->set('vid', $this->village->getId());
     $output->set('title', $text->get('overview'));
     $output->set('loghtml', $loghtml);
     return $output->parse('battle/overview.tpl');
 }
开发者ID:Toxicat,项目名称:dolumar,代码行数:24,代码来源:Battle.php

示例8: getCustomContent

 protected function getCustomContent($input)
 {
     $db = Neuron_Core_Database::__getInstance();
     $text = Neuron_Core_Text::__getInstance();
     $text->setFile('buildings');
     $text->setSection('townCenter');
     $page = new Neuron_Core_Template();
     // Just to make sure we're not displaying old rune scouts.
     $this->getVillage()->resources->getRunes();
     // Change village name
     if (isset($input['villageName'])) {
         $input['villageName'] = strip_tags($input['villageName']);
         if (!$this->getVillage()->setName($input['villageName'])) {
             $page->set('changename_err', $text->get($this->getVillage()->getError()));
         } else {
             reloadEverything();
         }
     }
     // Let's check if we are already searching for runes
     $runeCheck = $db->select('villages_scouting', array('count(scoutId)'), "vid = '" . $this->getVillage()->getId() . "'");
     $alreadyScouting = $runeCheck[0]['count(scoutId)'] > 0;
     if (isset($input['do'])) {
         if ($input['do'] == 'scout') {
             $this->hideGeneralOptions();
             $this->hideTechnologyUpgrades();
             $currentPage = isset($input['pageid']) ? $input['pageid'] : 1;
             if ($currentPage < 1) {
                 $currentPage = 1;
             }
             Neuron_Core_Tools::splitInPages($page, $currentPage * 4 + 8, $currentPage, 4, 4, array('do' => 'scout'), null, 'pageid');
             if ($alreadyScouting) {
                 $page->set('scoutResults', $text->get('alreadyScouting'));
                 $page->set('scoutResult_isGood', false);
             } else {
                 if (isset($input['runes']) && is_numeric($input['runes'])) {
                     $runes = intval($input['runes']);
                     // Let's start scouting
                     $village = $this->getVillage();
                     //$cost = $village->getScoutLandsCost ($runes);
                     if ($village->scout($runes)) {
                         $page->set('scoutResults', $text->get('doneScouting'));
                         $page->set('scoutResult_isGood', true);
                     } else {
                         $page->set('scoutResults', $text->get('searchNoRunes'));
                         $page->set('scoutResult_isGood', false);
                     }
                 } else {
                     $scoutoptions = array();
                     $start = ($currentPage - 1) * 4 + 1;
                     $end = $start + 4;
                     for ($i = $start; $i < $end; $i++) {
                         $duration = $this->getVillage()->getScoutLandsDuration($i);
                         $cost = $this->resourceToText($this->getVillage()->getScoutLandsCost($i));
                         $duration = Neuron_Core_Tools::getDuration($duration);
                         $scoutoptions[] = array('runes' => $i, 'scoutDuration' => $duration, 'scoutCost' => $cost);
                     }
                     $page->set('scoutoptions', $scoutoptions);
                 }
             }
             return $page->parse('buildings/townCenter_scoutRunes.phpt');
         } else {
             if ($input['do'] == 'explore') {
                 /*
                  * TODO ;-)
                  *
                 $village = $this->getVillage ();
                 $village->lookForNPCs ();
                 */
             }
         }
     }
     $page->set('vid', $this->getVillage()->getId());
     // Search for new runes
     $page->set('searchRunes', $text->get('searchRunes'));
     $page->set('scoutLands', $text->get('scoutLands'));
     $page->set('scoutCost', $text->get('scoutCost'));
     // Change name
     $page->set('changeName', $text->get('changeName'));
     $page->set('villageName', $text->get('villageName'));
     $page->set('change', $text->get('change'));
     $page->set('villageName_value', Neuron_Core_Tools::output_varchar($this->getVillage()->getName()));
     $page->set('overview', $text->getClickTo($text->get('overview')));
     $page->set('techniques', $text->getClickTo($text->get('techniques')));
     $page->set('toScout', $text->getClickTo($text->get('toScout')));
     return $page->parse('buildings/townCenter.phpt');
 }
开发者ID:Toxicat,项目名称:dolumar,代码行数:86,代码来源:TownCenter.php


注:本文中的Neuron_Core_Tools::splitInPages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。