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

Show
Ignore:
Timestamp:
11/30/11 16:41:32 (18 months ago)
Author:
tboutell
Message:

* If a reusable slideshow slot is reusing another slideshow and its label is called for, it shows the label of the reused slideshow
* Deleted slideshows are not offered on the list of options for reuse
* PluginaReusableSlotTable::getReusedSlot() method abstracts away the scary bits of the above

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • plugins/apostropheExtraSlotsPlugin/trunk/lib/model/doctrine/PluginaReusableSlotTable.class.php

    r4379 r4388  
    2222    return $this->createQuery('r')->where('r.page_id = ? AND r.area_name = ? AND r.permid = ?', array($page_id, $area_name, $permid))->fetchOne(); 
    2323  } 
     24   
     25  /** 
     26   * Accepts an aReusableSlot or an array hydrated with the same columns. Returns the 
     27   * actual Apostrophe slot being reused, or null if its page no longer exists or 
     28   * it does not exist in the current version of its area on the page 
     29   */ 
     30  static public function getReusedSlot($reusableSlot) 
     31  { 
     32    $q = aPageTable::queryWithSlot($reusableSlot['area_name']); 
     33    $q->andWhere('p.id = ?', $reusableSlot['page_id']); 
     34    $q->andWhere('avs.permid = ?', $reusableSlot['permid']); 
     35    $page = $q->fetchOne(); 
     36    if (!$page) 
     37    { 
     38      return null; 
     39    } 
     40    $slots = $page->getSlotsByAreaName($reusableSlot['area_name']); 
     41    if (!isset($slots[$reusableSlot['permid']])) 
     42    { 
     43      return null; 
     44    } 
     45    $slot = $slots[$reusableSlot['permid']]; 
     46    return $slot; 
     47  } 
    2448}