From 39a40e49a19f00baeeeefe375d67e915ccc7e09a Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Tue, 29 Sep 2009 14:35:15 -0700 Subject: Refactor sidebar_blocks into a separate function and then call block_manager::get_html(site.sidebar). Convert image_block to use block management instead of theme::sidebar_blocks --- modules/image_block/helpers/image_block_theme.php | 50 ----------------------- 1 file changed, 50 deletions(-) delete mode 100644 modules/image_block/helpers/image_block_theme.php (limited to 'modules/image_block/helpers/image_block_theme.php') diff --git a/modules/image_block/helpers/image_block_theme.php b/modules/image_block/helpers/image_block_theme.php deleted file mode 100644 index 78138b23..00000000 --- a/modules/image_block/helpers/image_block_theme.php +++ /dev/null @@ -1,50 +0,0 @@ -css_id = "gImageBlock"; - $block->title = t("Random Image"); - $block->content = new View("image_block_block.html"); - - $random = ((float)mt_rand()) / (float)mt_getrandmax(); - - $items = ORM::factory("item") - ->viewable() - ->where("type !=", "album") - ->where("rand_key < ", $random) - ->orderby(array("rand_key" => "DESC")) - ->find_all(1); - - 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); - } - - $block->content->item = $items->current(); - - return $items->count() == 0 ? "" : $block; - } -} -- cgit v1.2.3