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


PHP GDO::getLimit方法代码示例

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


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

示例1: templateSolutions

 private function templateSolutions(WC_Challenge $chall, GWF_User $user, $length, $token)
 {
     $tt = $this->module->lang('pt_wmc_sol', array($chall->display('chall_title'), $length));
     GWF_Website::setPageTitle($tt);
     $ipp = 50;
     $cid = $chall->getID();
     $length = (int) $length;
     $whitelist = array('user_name', 'wmc_date', 'wmc_length', 'wmc_solution');
     $by = GDO::getWhitelistedByS(Common::getGetString('by'), $whitelist, self::DEFAULT_BY);
     $dir = GDO::getWhitelistedDirS(Common::getGetString('dir'), self::DEFAULT_DIR);
     $wmc = GWF_TABLE_PREFIX . 'wc_math_chall';
     $users = GWF_TABLE_PREFIX . 'user';
     $where = "wmc_cid={$cid} AND wmc_length>={$length}";
     $db = gdo_db();
     $result = $db->queryFirst("SELECT COUNT(*) c FROM {$wmc} WHERE {$where}");
     $nRows = (int) $result['c'];
     $nPages = GWF_PageMenu::getPagecount($ipp, $nRows);
     $page = Common::clamp(Common::getGetInt('page', 1), 1, $nPages);
     $from = GWF_PageMenu::getFrom($page, $ipp);
     $limit = GDO::getLimit($ipp, $from);
     $query = "SELECT user_name, wmc_date, wmc_length, wmc_solution FROM {$wmc} LEFT JOIN {$users} ON user_id=wmc_uid WHERE {$where} ORDER BY {$by} {$dir} {$limit}";
     $tVars = array('sort_url' => GWF_WEB_ROOT . "index.php?mo=WeChall&me=MathSolutions&cid={$cid}&length={$length}&token={$token}&by=%BY%&dir=%DIR%", 'data' => $db->queryAll($query), 'page_menu' => GWF_PageMenu::display($page, $nPages, GWF_WEB_ROOT . sprintf('index.php?mo=WeChall&me=MathSolutions&cid=%d&length=%d&token=%s&by=%s&dir=%s&page=%%PAGE%%', $cid, $length, $token, urlencode($by), urlencode($dir))), 'table_title' => $tt, 'chall' => $chall);
     return $this->module->templatePHP('math_solutions.php', $tVars);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:24,代码来源:MathSolutions.php

示例2: onTop5DamageBest

 private function onTop5DamageBest($rank)
 {
     $db = gdo_db();
     $user = GWF_TABLE_PREFIX . 'dog_users';
     $user2 = GWF_TABLE_PREFIX . 'dog_users';
     $lsh = GWF_TABLE_PREFIX . 'dog_slap_history';
     $limit = GDO::getLimit(1, Common::clamp($rank - 1, 0));
     $query = "SELECT u.user_name slapper, u2.user_name target, s.* FROM {$lsh} s JOIN {$user} u ON u.user_id=lsh_slapper JOIN {$user2} u2 ON u2.user_id=lsh_target ORDER BY lsh_damage DESC {$limit}";
     echo $query . PHP_EOL;
     if (false === ($row = $db->queryFirst($query))) {
         return 'No database record found.' . PHP_EOL;
     }
     $adverb = Dog_SlapItem::getByID($row['lsh_adverb']);
     $verb = Dog_SlapItem::getByID($row['lsh_verb']);
     $adjective = Dog_SlapItem::getByID($row['lsh_adjective']);
     $item = Dog_SlapItem::getByID($row['lsh_item']);
     $date = $row['lsh_date'];
     return sprintf('BestSlap #%d: %s %s %s %s with %s %s. This dealt %d damage and happened on %s, %s ago.', $rank, $row['slapper'], $adverb->getVar('lsi_name'), $verb->getVar('lsi_name'), $row['target'], $adjective->getVar('lsi_name'), $item->getVar('lsi_name'), $row['lsh_damage'], GWF_Time::displayDate($date), GWF_Time::displayAge($date));
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:19,代码来源:DOGMOD_Slapwarz.php

示例3: onSearchB

 private function onSearchB()
 {
     $whitelist = array('user_name', 'user_countryid', 'prof_icq', 'prof_msn', 'prof_jabber', 'prof_skype', 'prof_yahoo', 'prof_aim');
     $ipp = 50;
     $db = gdo_db();
     if ('' === ($where = $this->getWhereQuery())) {
         $where = "'1'='0'";
     }
     $deleted = GWF_User::DELETED;
     $where .= " AND user_options&{$deleted}=0";
     $users = GWF_TABLE_PREFIX . 'user';
     $profiles = GWF_TABLE_PREFIX . 'profile';
     $query = "SELECT COUNT(*) AS c FROM {$users} LEFT JOIN {$profiles} ON prof_uid=user_id WHERE {$where}";
     if (false === ($result = $db->queryFirst($query, false))) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     $nRows = (int) $result['c'];
     $nPages = GWF_PageMenu::getPagecount($ipp, $nRows);
     $page = Common::clamp(Common::getGetInt('page', 1), 1, $nPages);
     $from = GWF_PageMenu::getFrom($page, $ipp);
     $limit = GDO::getLimit($ipp, $from);
     $by = GDO::getWhitelistedByS(Common::getGetString('by'), $whitelist, 'user_name');
     $dir = GDO::getWhitelistedDirS(Common::getGetString('dir'), 'ASC');
     $_GET['search'] = 'yes';
     $query = "SELECT u.*, p.* FROM {$users} u LEFT JOIN {$profiles} p ON prof_uid=user_id WHERE {$where} ORDER BY {$by} {$dir} {$limit}";
     $form = $this->formSearch();
     $tVars = array('result' => $db->queryAll($query, true), 'form' => $form->templateY($this->module->lang('ft_search_adv'), $this->module->getMethodURL('SearchAdv')), 'pagemenu' => GWF_PageMenu::display($page, $nPages, $this->getPageMenuHREF()), 'sort_url' => $this->getSortHREF());
     return $this->module->templatePHP('search_adv.php', $tVars);
 }
开发者ID:sinfocol,项目名称:gwf3,代码行数:29,代码来源:SearchAdv.php


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