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

root/plugins/apostropheExtraSlotsPlugin/trunk/lib/model/doctrine/PluginaReusableSlotTable.class.php @ 4388

Revision 4388, 1.4 KB (checked in by tboutell, 18 months ago)

* 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

Line 
1<?php
2
3/**
4 * PluginaReusableSlotTable
5 *
6 * This class has been auto-generated by the Doctrine ORM Framework
7 */
8class PluginaReusableSlotTable extends Doctrine_Table
9{
10  /**
11   * Returns an instance of this class.
12   *
13   * @return object PluginaReusableSlotTable
14   */
15  public static function getInstance()
16  {
17    return Doctrine_Core::getTable('PluginaReusableSlot');
18  }
19 
20  public function findOneBySlot($page_id, $area_name, $permid)
21  {
22    return $this->createQuery('r')->where('r.page_id = ? AND r.area_name = ? AND r.permid = ?', array($page_id, $area_name, $permid))->fetchOne();
23  }
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  }
48}
Note: See TracBrowser for help on using the browser.