To participate you must create an account on apostrophenow.org. If you have already done so, click Login.

Changeset 1102

Show
Ignore:
Timestamp:
04/30/10 11:15:17 (22 months ago)
Author:
dordille
Message:

Improvements for displaying images with blogSlots. #302.

Location:
plugins/apostropheBlogPlugin/trunk
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • plugins/apostropheBlogPlugin/trunk/lib/model/doctrine/PluginaBlogItem.class.php

    r1066 r1102  
    9595      foreach($this->Page->getArea($area) as $slot) 
    9696      { 
    97         if(method_exists($slot, 'getSearchText')) 
     97        if(method_exists($slot, 'getText')) 
    9898        { 
    99           $text .= strip_tags($slot->getValue()); 
     99          $text .= strip_tags($slot->getText()); 
    100100        } 
    101101      } 
     
    119119    return $this->getTextForAreas(array($area), $limit); 
    120120  } 
     121 
     122  public function getMediaForArea($area, $type = null, $limit = null) 
     123  { 
     124    return $this->getMediaForAreas(array($area), $type, $limit); 
     125  } 
     126 
     127  /** 
     128   * Given an array of array this function returns the mediaItems in those areas. 
     129   * @param  aArea $areas 
     130   * @param  $type Set the type of media to return (image, video, pdf, etc...) 
     131   * @param  $limit Limit the number of mediaItems returned 
     132   * @return array aMediaItems 
     133   */ 
     134  public function getMediaForAreas($areas, $type = null, $limit = 9999) 
     135  { 
     136    $aMediaItems = array(); 
     137    foreach($areas as $area) 
     138    { 
     139      foreach($this->Page->getArea($area) as $slot) 
     140      { 
     141        foreach($slot->MediaItems as $aMediaItem) 
     142        { 
     143          if(is_null($type) || $aMediaItem['type'] == $type) 
     144          { 
     145            $limit = $limit - 1; 
     146            $aMediaItems[] = $aMediaItem; 
     147            if($limit == 0) return $aMediaItems; 
     148          } 
     149        } 
     150      } 
     151    } 
     152    return $aMediaItems; 
     153  } 
    121154   
    122155  public function getFeedText() 
     
    125158    foreach($this->Page->getArea('blog-body') as $slot) 
    126159    { 
    127       if(method_exists($slot, 'getSearchText')) 
    128       { 
    129         $text .= $slot->getSearchText(); 
     160      if(method_exists($slot, 'getText')) 
     161      { 
     162        $text .= $slot->getText(); 
    130163      } 
    131164    } 
  • plugins/apostropheBlogPlugin/trunk/lib/model/doctrine/PluginaBlogItemTable.class.php

    r1022 r1102  
    4848    return Doctrine::getTable('aBlogCategory')->addCategoriesForUser($user, $admin, $q); 
    4949  } 
    50    
     50 
     51 
    5152  public function addCategories(Doctrine_Query $q=null) 
    5253  { 
     
    5859  } 
    5960 
     61  /** 
     62   * Given an array of blogItems this function will populate its virtual page 
     63   * areas with the current slot versions. 
     64   * @param aBlogItem $blogItems 
     65   */ 
    6066  public static function populatePages($blogItems) 
    6167  {     
     
    6975      $q = aPageTable::queryWithSlots(); 
    7076      $q->whereIn('id', $pageIds); 
    71       $q->execute(); 
     77      $pages = $q->execute(); 
     78      aTools::cacheVirtualPages($pages); 
    7279    } 
    7380  } 
  • plugins/apostropheBlogPlugin/trunk/modules/aBlog/lib/BaseaBlogActions.class.php

    r1051 r1102  
    5252     
    5353    $this->pager = $pager; 
    54      
     54 
     55    aBlogItemTable::populatePages($pager->getResults()); 
     56 
    5557    if($this->getRequestParameter('feed', false)) 
    5658    { 
  • plugins/apostropheBlogPlugin/trunk/modules/aBlog/templates/_singleColumnTemplate_slot.php

    r990 r1102  
    1 <?php echo $aBlogPost->getTextForArea('blog-body', 100) ?> 
     1<div class="a-blog-post-excerpt"> 
     2<?php echo $aBlogPost->getTextForArea('blog-body', $options['excerptLength']) ?> 
     3</div> 
    24 
     5<div class="a-blog-post-media"> 
     6<?php include_component('aSlideshowSlot', 'slideshow', array( 
     7  'items' => $aBlogPost->getMediaForArea('blog-body', 'image', 1), 
     8  'id' => 'test', 
     9  'options' => $options['slideshowOptions'] 
     10  )) ?> 
     11</div> 
     12 
  • plugins/apostropheBlogPlugin/trunk/modules/aBlogSingleSlot/actions/components.class.php

    r1053 r1102  
    2626      aBlogItemTable::populatePages(array($this->aBlogItem)); 
    2727    } 
     28    $this->options['word_count'] = $this->getOption('word_count', 100); 
     29    if(!isset($this->options['slideshowOptions'])) 
     30      $this->options['slideshowOptions'] = array(); 
     31 
     32    $this->options['excerptLength'] = $this->getOption('excerptLength', 200); 
    2833  } 
    2934} 
  • plugins/apostropheBlogPlugin/trunk/modules/aBlogSingleSlot/templates/_normalView.php

    r1061 r1102  
    22<?php if (isset($values['blog_item'])): ?> 
    33  <h2><?php echo $aBlogItem['title'] ?></h2> 
    4   <?php include_partial('aBlog/'.$aBlogItem['template'].'_slot', array('aBlogPost' => $aBlogItem)) ?> 
     4  <?php include_partial('aBlog/'.$aBlogItem['template'].'_slot', array('aBlogPost' => $aBlogItem, 'options' => $options)) ?> 
    55<?php endif ?> 
  • plugins/apostropheBlogPlugin/trunk/modules/aBlogSlot/actions/components.class.php

    r1021 r1102  
    3131      $q->limit($this->values['count']); 
    3232 
     33    if(!isset($this->options['slideshowOptions'])) 
     34      $this->options['slideshowOptions'] = array(); 
     35 
     36    $this->options['excerptLength'] = $this->getOption('excerptLength', 200); 
    3337     
    3438    $this->aBlogPosts = $q->execute(); 
  • plugins/apostropheBlogPlugin/trunk/modules/aBlogSlot/templates/_normalView.php

    r1019 r1102  
    1515 
    1616      <div class="a-blog-post-excerpt-container"> 
    17         <?php include_partial('aBlog/'.$aBlogPost['template'].'_slot', array('aBlogPost' => $aBlogPost)) ?> 
     17        <?php include_partial('aBlog/'.$aBlogPost['template'].'_slot', array('aBlogPost' => $aBlogPost, 'options' => $options)) ?> 
    1818        <div class="a-blog-read-more"> 
    1919          <?php echo link_to('Read More', 'a_blog_post', $aBlogPost, array('class' => 'a-blog-more')) ?>