diff options
Diffstat (limited to 'modules/album_block/helpers')
-rw-r--r-- | modules/album_block/helpers/album_block_block.php | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/modules/album_block/helpers/album_block_block.php b/modules/album_block/helpers/album_block_block.php new file mode 100644 index 00000000..d469a0c7 --- /dev/null +++ b/modules/album_block/helpers/album_block_block.php @@ -0,0 +1,61 @@ +<?php defined("SYSPATH") or die("No direct script access."); +/** + * Gallery - a web based photo album viewer and editor + * Copyright (C) 2000-2009 Bharat Mediratta + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + */ +class album_block_block_Core { + static function get_site_list() { + return array("album_list" => t("Album list")); + } + + static function get($block_id, $theme) { + $block = ""; + switch ($block_id) { + case "album_list": + $block = new Block(); + $block->css_id = "g-album-block"; + $block->title = t("Album list"); + $block->content = new View("album_block_block.html"); + + //$items = ORM::factory("item") + // ->viewable() + // ->where("type ==", "album") + // ->find_all(5); + + $items = ORM::factory("item")->where(array("type" => "album", "id !=" => 1))->orderby("updated", "DESC")->find_all(); + //if ($items->count() == 0) { + // Try once more. If this fails, just ditch the block altogether + //$items = ORM::factory("item") + //->viewable() + // ->where("type !=", "album") + // ->where("rand_key >= ", $random) + // ->orderby(array("rand_key" => "DESC")) + // ->find_all(1); + //} + + if ($items->count() > 0) { + #$block->content->item = $items->current(); + $block->content->items = $items; + } else { + $block = ""; + } + break; + } + + return $block; + } +} |