From: Chuck Hagenbuch Date: Sat, 21 Aug 2010 01:19:47 +0000 (-0400) Subject: Move logic for returning childImageIds to a function X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=0574069b0c184186933a459bdd067196b3052b11;p=horde.git Move logic for returning childImageIds to a function --- diff --git a/ansel/lib/View/GalleryRenderer/Base.php b/ansel/lib/View/GalleryRenderer/Base.php index dff7c9510..744a70751 100644 --- a/ansel/lib/View/GalleryRenderer/Base.php +++ b/ansel/lib/View/GalleryRenderer/Base.php @@ -163,17 +163,9 @@ abstract class Ansel_View_GalleryRenderer_Base unset($this->style['widgets']['Actions']); } - // I *think* this is more efficient, iterate over the children - // since we already have them instead of calling listImages. - //$image_ids = $this->view->gallery->listImages($this->pagestart, $this->pagestart + $this->perpage); - $ids = array(); - foreach ($this->children as $child) { - if ($child instanceof Ansel_Image) { - $ids[] = $child->id; - } - } // Gallery widgets always receive an array of image ids for // the current page. + $ids = $this->getChildImageIds(); foreach ($this->style['widgets'] as $wname => $wparams) { $wparams = array_merge($wparams, array('images' => $ids)); $this->view->addWidget(Ansel_Widget::factory($wname, $wparams)); @@ -205,6 +197,17 @@ abstract class Ansel_View_GalleryRenderer_Base $this->pageend = min($this->numTiles, $this->pagestart + $this->perpage - 1); } + public function getChildImageIds() + { + $ids = array(); + foreach ($this->children as $child) { + if ($child instanceof Ansel_Image) { + $ids[] = $child->id; + } + } + return $ids; + } + /** * Return the HTML for this view. Done this way so we can override this in * subclasses if desired.