theme_name = $theme_name; $this->template = $template; } public function url($path) { return url::base() . "themes/{$this->theme_name}/$path"; } public function item() { return $this->template->item; } public function display($page_name, $view_class="View") { return new $view_class($page_name); } public function pager() { $this->pagination = new Pagination(); $this->pagination->initialize( array('query_string' => 'page', 'total_items' => $this->template->item->children_count(), 'items_per_page' => $this->template->page_size, 'style' => 'classic')); return $this->pagination->render(); } public function module($module_name) { $module = module::get($module_name); return $module->loaded ? $module : null; } public function in_place_edit() { return new View("in_place_edit.html"); } public function block($type, $module=null) { $block = ORM::factory("block") ->where("type", $type); if (isset($module)) { $block->where("module", $module); } $result = $block->find_all(); $blocks = ""; foreach ($result as $block) { $blocks .= call_user_func($block->method, $this); } return $blocks; } public function blocks() { // @todo make type mandatory, its only optional while i try this out for slideshow /** @todo: make this data driven */ $blocks = array( 'carousel' => carousel::block($this), 'tag' => tag::block($this), 'info' => info::block($this), 'gmaps' => gmaps::block($this), ); kohana::Log("debug", print_r($blocks, true)); return $blocks; } }