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/PluginaReusableSlideshowSlot.class.php @ 4379

Revision 4379, 1.9 KB (checked in by tboutell, 18 months ago)

New aReusableSlideshowSlot is just like the regular slideshow slot (and reuses its logic as much as practical), with one addition: you can reuse them elsewhere on the site. Click the "reuse" button (which repurposes the edit view) to either label the current slideshow for reuse elsewhere, or pick an existing slideshow to be displayed in this location.

Note that this is a separate slot type to avoid bc problems. However the storage format is compatible, so if you want to switch your existing slideshows you can write a migration (or just do an UPDATE statement in SQL) to change the type from aSlideshow to aReusableSlideshow, and switch your templates to offer only the reusable variety

Line 
1<?php
2
3/**
4 * PluginaReusableSlideshowSlot
5 *
6 * This class has been auto-generated by the Doctrine ORM Framework
7 *
8 * @package    ##PACKAGE##
9 * @subpackage ##SUBPACKAGE##
10 * @author     ##NAME## <##EMAIL##>
11 * @version    SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $
12 */
13abstract class PluginaReusableSlideshowSlot extends BaseaReusableSlideshowSlot
14{
15  /**
16   * DOCUMENT ME
17   * @return mixed
18   */
19  public function isOutlineEditable()
20  {
21    // We have an edit button and don't use an in-place editor
22    return false;
23  }
24
25  /**
26   * Returns the media items of the slot being reused, if any, otherwise
27   * the media items of this slot
28   */
29  public function getOrderedMediaItems()
30  {
31    error_log("getOrderedMediaItems");
32    $values = $this->getArrayValue();
33    if (isset($values['reuse']))
34    {
35      // This isn't terrible but it could be more efficient if I used
36      // array hydration. The trouble with that is that I have to walk the
37      // results of that join which would be a lot easier if I refactored
38      // some of the code for that purpose that lives in PluginaPageTable
39      $q = aPageTable::queryWithSlot($values['reuse']['area_name']);
40      $q->andWhere('p.id = ?', $values['reuse']['page_id']);
41      $q->andWhere('avs.permid = ?', $values['reuse']['permid']);
42      $page = $q->fetchOne();
43      if (!$page)
44      {
45        return array();
46      }
47      $slots = $page->getSlotsByAreaName($values['reuse']['area_name']);
48      if (!isset($slots[$values['reuse']['permid']]))
49      {
50        return array();
51      }
52      $slot = $slots[$values['reuse']['permid']];
53      return $slot->getOrderedMediaItems();
54    }
55    return parent::getOrderedMediaItems();
56  }
57
58  /**
59   * DOCUMENT ME
60   * @return mixed
61   */
62  public function getMediaItemOrder()
63  {
64    $data = $this->getArrayValue();
65    if (isset($data['order']))
66    {
67      return $data['order'];
68    }
69    return null;
70  }
71}
Note: See TracBrowser for help on using the browser.