本文整理汇总了PHP中Ethna_Util::getDirectLinkList方法的典型用法代码示例。如果您正苦于以下问题:PHP Ethna_Util::getDirectLinkList方法的具体用法?PHP Ethna_Util::getDirectLinkList怎么用?PHP Ethna_Util::getDirectLinkList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ethna_Util
的用法示例。
在下文中一共展示了Ethna_Util::getDirectLinkList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preforward
/**
* preprocess before forwarding.
*
* @access public
*/
public function preforward()
{
$start = $this->af->get('start');
error_log('start:' . $start);
if ($start === NULL) {
$start = 0;
}
if ($start < 0) {
$start = 0;
}
$count = 5;
$bm = new BoardManager();
$um = new UserManager();
$boardlist = $bm->boardlist($this->backend);
krsort($boardlist);
$total = count($boardlist);
$display_posts = array();
for ($i = $start; $i < $start + $count && $i < $total; $i++) {
$cur = current(array_slice($boardlist, $i, 1, true));
array_push($display_posts, $bm->addUrl($cur));
}
if ($start > 0) {
$this->af->setApp('hasprev', true);
$this->af->setApp('prev', $start - $count);
} else {
$this->af->setApp('hasprev', false);
}
if ($start + $count < $total) {
$this->af->setApp('hasnext', true);
$this->af->setApp('next', $start + $count);
$this->af->setApp('last', (ceil($total / $count) - 1) * $count);
} else {
$this->af->setApp('hasnext', false);
}
$this->af->setApp('posts', $display_posts);
$this->af->setApp('link', '/?action_board=true');
$this->af->setApp('count', $count);
$this->af->setApp('current', $start);
$this->af->setApp('pager', Ethna_Util::getDirectLinkList($total, $start, $count));
return 'board';
}
示例2: _getNavigation
/**
* ナビゲーション情報を取得する
*
* @access private
* @param int $total 検索総件数
* @param array $list 検索結果
* @return array ナビゲーション情報を格納した配列
*/
function _getNavigation($total, &$list)
{
$nav = array();
$nav['offset'] = $this->offset;
$nav['from'] = $this->offset + 1;
if ($total == 0) {
$nav['from'] = 0;
}
$nav['to'] = $this->offset + count($list);
$nav['total'] = $total;
if ($this->offset > 0) {
$prev_offset = $this->offset - $this->count;
if ($prev_offset < 0) {
$prev_offset = 0;
}
$nav['prev_offset'] = $prev_offset;
}
if ($this->offset + $this->count < $total) {
$next_offset = $this->offset + count($list);
$nav['next_offset'] = $next_offset;
}
$nav['direct_link_list'] = Ethna_Util::getDirectLinkList($total, $this->offset, $this->count);
return $nav;
}