theme_name = module::get_var("gallery", "active_site_theme");
if (user::active()->admin) {
$this->theme_name = Input::instance()->get("theme", $this->theme_name);
}
$this->item = null;
$this->tag = null;
$this->set_global("theme", $this);
$this->set_global("user", user::active());
$this->set_global("page_type", $page_type);
$this->set_global("page_title", null);
if ($page_type == "album") {
$this->set_global("thumb_proportion", $this->thumb_proportion());
}
$maintenance_mode = Kohana::config("core.maintenance_mode", false, false);
if ($maintenance_mode) {
message::warning(t("This site is currently in maintenance mode"));
}
}
/**
* Proportion of the current thumb_size's to default
* @return int
*/
public function thumb_proportion() {
// @TODO change the 200 to a theme supplied value when and if we come up with an
// API to allow the theme to set defaults.
return module::get_var("gallery", "thumb_size", 200) / 200;
}
public function url($path, $absolute_url=false, $no_root=false) {
$arg = "themes/{$this->theme_name}/$path";
return $absolute_url ? url::abs_file($arg) : $no_root ? $arg : url::file($arg);
}
public function item() {
return $this->item;
}
public function tag() {
return $this->tag;
}
public function page_type() {
return $this->page_type;
}
public function display($page_name, $view_class="View") {
return new $view_class($page_name);
}
public function site_menu() {
$menu = Menu::factory("root");
if ($this->page_type != "login") {
gallery_menu::site($menu, $this);
foreach (module::active() as $module) {
if ($module->name == "gallery") {
continue;
}
$class = "{$module->name}_menu";
if (method_exists($class, "site")) {
call_user_func_array(array($class, "site"), array(&$menu, $this));
}
}
}
$menu->compact();
print $menu;
}
public function album_menu() {
$this->_menu("album");
}
public function tag_menu() {
$this->_menu("tag");
}
public function photo_menu() {
$this->_menu("photo");
}
public function thumb_menu($item) {
$this->_menu("thumb", $item);
}
private function _menu($type, $item=null) {
$menu = Menu::factory("root");
call_user_func_array(array("gallery_menu", $type), array(&$menu, $this, $item));
foreach (module::active() as $module) {
if ($module->name == "gallery") {
continue;
}
$class = "{$module->name}_menu";
if (method_exists($class, $type)) {
call_user_func_array(array($class, $type), array(&$menu, $this, $item));
}
}
print $menu;
}
public function pager() {
if ($this->children_count) {
$this->pagination = new Pagination();
$this->pagination->initialize(
array("query_string" => "page",
"total_items" => $this->children_count,
"items_per_page" => $this->page_size,
"style" => "classic"));
return $this->pagination->render();
}
}
/**
* Print out any site wide status information.
*/
public function site_status() {
return site_status::get();
}
/**
* Print out any messages waiting for this user.
*/
public function messages() {
return message::get();
}
public function script($file) {
$this->scripts[$file] = 1;
}
public function css($file) {
$this->css[$file] = 1;
}
/**
* Combine a series of Javascript files into a single one and cache it in the database, then
* return a single ";
}
/**
* Combine a series of Javascript files into a single one and cache it in the database, then
* return a single