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

Changeset 10671


Ignore:
Timestamp:
Feb 6, 2009, 12:39:24 PM (12 years ago)
Author:
ebihara
Message:

#3558:fixed the PhotoList? parts doesn't display all items of a list

Location:
OpenPNE3/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/trunk/apps/pc_frontend/templates/_partsPhotoTable.php

    r10426 r10671  
    1 <?php if (count($options['list'])): ?>
     1<?php if (count($options->list)): ?>
    22
    33<?php
    4 $options->setDefault('row', 10);
    54$options->setDefault('col', 5);
    65$options->setDefault('type', 'full');
     6
     7$options->addRequiredOption('pager');
    78?>
    89
    910<?php ob_start() ?>
    10 <?php include_partial('global/pagerRelative', array('pager' => $options['pager'], 'link_to' => $options->getRaw('link_to_pager'))) ?>
     11<?php include_partial('global/pagerRelative', array('pager' => $options->pager, 'link_to' => $options->getRaw('link_to_pager'))) ?>
    1112<?php $pager = ob_get_flush() ?>
    1213
    1314<table>
    14 <?php $row = ceil(count($options['list']) / $options['row']) ?>
     15<?php $row = ceil(count($options->list) / $options->col) ?>
    1516<?php for ($i = $j = 1; $row >= $i; $i++): ?>
    16 <?php if ($options['type'] === 'full' || $options['type'] === 'only_image'): ?>
     17<?php if ($options->type === 'full' || $options->type === 'only_image'): ?>
    1718<tr class="photo">
    18 <?php for ($j = ($i * $options['col']) - $options['col']; ($i * $options['col']) > $j; $j++): ?>
    19 <td><?php if (!empty($options['list'][$j])): ?>
    20 <?php echo link_to(image_tag_sf_image($options['list'][$j]->getImageFileName(), array('size' => '76x76')), $options['link_to'].$options['list'][$j]->getId()) ?>
     19<?php for ($j = ($i * $options->col) - $options->col; ($i * $options->col) > $j; $j++): ?>
     20<td><?php if (!empty($options->list[$j])): ?>
     21<?php echo link_to(image_tag_sf_image($options->list[$j]->getImageFileName(), array('size' => '76x76')), $options->link_to.$options->list[$j]->getId()) ?>
    2122<?php endif; ?></td>
    2223<?php endfor; ?>
    2324</tr>
    2425<?php endif; ?>
    25 <?php if ($options['type'] === 'full' || $options['type'] === 'only_name'): ?>
     26<?php if ($options->type === 'full' || $options->type === 'only_name'): ?>
    2627<tr class="text">
    27 <?php for ($j = ($i * $options['col']) - $options['col']; ($i * $options['col']) > $j; $j++): ?>
    28 <td><?php if (!empty($options['list'][$j])): ?>
    29 <?php echo link_to($options['list'][$j]->getName(), 'member/profile?id='.$options['list'][$j]->getId()) ?>
     28<?php for ($j = ($i * $options->col) - $options->col; ($i * $options->col) > $j; $j++): ?>
     29<td><?php if (!empty($options->list[$j])): ?>
     30<?php echo link_to($options->list[$j]->getName(), 'member/profile?id='.$options->list[$j]->getId()) ?>
    3031<?php endif; ?></td>
    3132<?php endfor; ?>
  • OpenPNE3/trunk/lib/helper/opPartsHelper.php

    r10555 r10671  
    4242
    4343  include_partial('global/partsLayout', $params);
     44
     45  $shorts = $params['options']->getShortRequiredOptions();
     46  if ($shorts)
     47  {
     48    throw new LogicException(sprintf('The %s parts requires the following options: \'%s\'.', $name, implode('\', \'', $shorts)));
     49  }
    4450}
    4551
  • OpenPNE3/trunk/lib/log/opFileLogger.class.php

    r10242 r10671  
    3535  {
    3636    parent::doLog($message, $priority);
    37     chmod($this->file, 0666);
     37    @chmod($this->file, 0666);
    3838  }
    3939}
  • OpenPNE3/trunk/lib/view/opPartsOptionHolder.class.php

    r10349 r10671  
    1919class opPartsOptionHolder extends sfParameterHolder implements ArrayAccess, IteratorAggregate
    2020{
     21  protected $required = array();
     22
    2123  public function __construct($parameters = array())
    2224  {
     
    5254  }
    5355
     56  public function addRequiredOption($name)
     57  {
     58    $this->required[] = $name;
     59  }
     60
     61  public function getShortRequiredOptions()
     62  {
     63    $short = array();
     64
     65    foreach ($this->required as $name)
     66    {
     67      if (!$this->has($name))
     68      {
     69        $short[] = $name;
     70      }
     71    }
     72
     73    return $short;
     74  }
     75
    5476  public function offsetGet($name)
    5577  {
Note: See TracChangeset for help on using the changeset viewer.