ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 10064


Ignore:
Timestamp:
Jan 10, 2009, 12:49:13 PM (11 years ago)
Author:
ogawa
Message:

#3412:added the size parameter to a diary comment pager

Location:
OpenPNE3/plugins/opDiaryPlugin/trunk/apps/pc_frontend/modules/diaryComment
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/plugins/opDiaryPlugin/trunk/apps/pc_frontend/modules/diaryComment/actions/components.class.php

    r10011 r10064  
    1818class diaryCommentComponents extends opDiaryPluginDiaryCommentComponents
    1919{
     20  public function executeList(sfWebRequest $request)
     21  {
     22    $this->sizes = array(20, 100);
     23
     24    $this->size = (int)$request->getParameter('size');
     25    if (!in_array($this->size, $this->sizes))
     26    {
     27      $this->size = $this->sizes[0];
     28    }
     29
     30    parent::executeList($request);
     31  }
     32
     33  protected function getPager(sfWebRequest $request)
     34  {
     35    $pager = parent::getPager($request);
     36    $pager->setMaxPerPage($this->size);
     37
     38    return $pager;
     39  }
    2040}
  • OpenPNE3/plugins/opDiaryPlugin/trunk/apps/pc_frontend/modules/diaryComment/templates/_list.php

    r9934 r10064  
    55<div class="dparts commentList"><div class="parts">
    66<div class="partsHeading"><h3><?php echo __('Comments') ?></h3></div>
     7
     8<?php if (min($sf_data->getRaw('sizes')) < $pager->getNbResults()): ?>
     9<div class="pagerRelative">
     10<?php foreach ($sizes as $n): ?>
     11  <?php if ($n !== $size): ?>
     12    <?php echo link_to(__('%1%件ずつ表示', array('%1%' => $n)), '@diary_show?id='.$diary->getId().'&size='.$n) ?>
     13  <?php endif; ?>
     14<?php endforeach; ?>
     15</div>
     16<?php endif; ?>
     17
    718<?php if ($pager->haveToPaginate()): ?>
    819<div class="pagerRelative">
    9 <?php if ($pager->hasEarlierPage()): ?><p class="prev"><?php echo link_to('前を表示', '@diary_show?id='.$diary->getId().'&page='.$pager->getEarlierPage()) ?></p><?php endif; ?>
     20<?php if ($pager->hasEarlierPage()): ?><p class="prev"><?php echo link_to('前を表示', '@diary_show?id='.$diary->getId().'&page='.$pager->getEarlierPage().'&size='.$size) ?></p><?php endif; ?>
    1021<p class="number"><?php echo __('%1%番~%2%番を表示', array('%1%' => $pager->getFirstItem()->getNumber(), '%2%' => $pager->getLastItem()->getNumber())) ?></p>
    11 <?php if ($pager->hasLaterPage()): ?><p class="next"><?php echo link_to('次を表示', '@diary_show?id='.$diary->getId().'&page='.$pager->getLaterPage()) ?></p><?php endif; ?>
     22<?php if ($pager->hasLaterPage()): ?><p class="next"><?php echo link_to('次を表示', '@diary_show?id='.$diary->getId().'&page='.$pager->getLaterPage().'&size='.$size) ?></p><?php endif; ?>
    1223</div>
    1324<?php endif; ?>
     25
    1426<?php foreach ($pager->getResults() as $comment): ?>
    1527<dl>
Note: See TracChangeset for help on using the changeset viewer.