summaryrefslogtreecommitdiff
path: root/modules/album_block
diff options
context:
space:
mode:
Diffstat (limited to 'modules/album_block')
-rw-r--r--modules/album_block/helpers/album_block_block.php61
-rw-r--r--modules/album_block/module.info3
-rw-r--r--modules/album_block/views/album_block_block.html.php8
3 files changed, 72 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;
+ }
+}
diff --git a/modules/album_block/module.info b/modules/album_block/module.info
new file mode 100644
index 00000000..0a93532d
--- /dev/null
+++ b/modules/album_block/module.info
@@ -0,0 +1,3 @@
+name = "Album Block"
+description = "Display a list of albums in the sidebar"
+version = 1
diff --git a/modules/album_block/views/album_block_block.html.php b/modules/album_block/views/album_block_block.html.php
new file mode 100644
index 00000000..81660263
--- /dev/null
+++ b/modules/album_block/views/album_block_block.html.php
@@ -0,0 +1,8 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<?php foreach ( $items as $item ) : ?>
+<div>
+<a href="/photos/index.php/<?php echo $item->slug ?>">
+<img alt="<?php echo $item->title ?>" src="/photos/var/thumbs/<?php echo $item->slug ?>/.album.jpg?m=<?php echo $item->updated ?>" class="g-thumbnail"/>
+</a>
+</div>
+<?php endforeach ?>