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; } }