当前位置: 首页>>代码示例>>PHP>>正文


PHP Theme_View类代码示例

本文整理汇总了PHP中Theme_View的典型用法代码示例。如果您正苦于以下问题:PHP Theme_View类的具体用法?PHP Theme_View怎么用?PHP Theme_View使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Theme_View类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: show

 public function show($page_name)
 {
     // Display the page specified by $page_name, or a 404 error if it doesn't exist.
     // Run a database search to look up the page.
     $existing_page = ORM::factory("px_static_page")->where("name", "=", $page_name)->find_all();
     // If it doesn't exist, display a 404 error.
     if (count($existing_page) == 0) {
         throw new Kohana_404_Exception();
     }
     // Set up breadcrumbs.
     $breadcrumbs = array();
     $root = item::root();
     $breadcrumbs[] = Breadcrumb::instance($root->title, $root->url())->set_first();
     $breadcrumbs[] = Breadcrumb::instance(t($existing_page[0]->title), url::site("pages_xtra/show/{$page_name}"))->set_last();
     // Display the page.
     $template = new Theme_View("page.html", "other", "Pages");
     $template->set_global(array("breadcrumbs" => $breadcrumbs));
     //  Call database variables into page header (off-page content).
     $site_title = module::get_var("pages_xtra", "site_title");
     //  Next line can be used as alternative to the following line
     //  $template->page_title = t("Gallery :: ") . t($existing_page[0]->title);
     $template->page_title = t($existing_page[0]->title) . t(" :: {$site_title}");
     $template->page_tags = $existing_page[0]->tags;
     $page_tags = trim(nl2br(html::purify($existing_page[0]->tags)));
     $template->page_description = $existing_page[0]->description;
     $page_description = trim(nl2br(html::purify($existing_page[0]->description)));
     //  Set a new View and call database variables into page (on-page content).
     $template->content = new View("pages_xtra_display.html");
     $template->content->title = $existing_page[0]->title;
     $template->content->body = $existing_page[0]->html_code;
     print $template;
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:32,代码来源:pages_xtra.php

示例2: day

 public function day($display_year, $display_user, $display_month, $display_day)
 {
     // Display all images for the specified day.
     // Figure out the total number of photos to display.
     if ($display_user == "-1") {
         $day_count = ORM::factory("item")->viewable()->where("type !=", "album")->where("captured >=", mktime(0, 0, 0, $display_month, $display_day, $display_year))->where("captured <", mktime(0, 0, 0, $display_month, $display_day + 1, $display_year))->find_all()->count();
     } else {
         $day_count = ORM::factory("item")->viewable()->where("owner_id", $display_user)->where("type !=", "album")->where("captured >=", mktime(0, 0, 0, $display_month, $display_day, $display_year))->where("captured <", mktime(0, 0, 0, $display_month, $display_day + 1, $display_year))->find_all()->count();
     }
     // Figure out paging stuff.
     $page_size = module::get_var("gallery", "page_size", 9);
     $page = $this->input->get("page", "1");
     $offset = ($page - 1) * $page_size;
     $max_pages = ceil($day_count / $page_size);
     // Make sure that the page references a valid offset
     if ($page < 1 || $day_count && $page > ceil($day_count / $page_size)) {
         Kohana::show_404();
     }
     // Set up the page.
     $template = new Theme_View("page.html", "other", "CalendarDayView");
     $template->page_title = t("Gallery :: Calendar");
     $template->set_global("page_size", $page_size);
     // Figure out which photos go on this page.
     if ($display_user == "-1") {
         $template->set_global("children", ORM::factory("item")->viewable()->where("type !=", "album")->where("captured >=", mktime(0, 0, 0, $display_month, $display_day, $display_year))->where("captured <", mktime(0, 0, 0, $display_month, $display_day + 1, $display_year))->orderby("captured", "ASC")->find_all($page_size, $offset));
     } else {
         $template->set_global("children", ORM::factory("item")->viewable()->where("owner_id", $display_user)->where("type !=", "album")->where("captured >=", mktime(0, 0, 0, $display_month, $display_day, $display_year))->where("captured <", mktime(0, 0, 0, $display_month, $display_day + 1, $display_year))->orderby("captured", "ASC")->find_all($page_size, $offset));
     }
     // Finish setting up and then display the page.
     $template->set_global("children_count", $day_count);
     $template->content = new View("dynamic.html");
     $template->content->title = t("Photos From ") . date("d F Y", mktime(0, 0, 0, $display_month, $display_day, $display_year));
     print $template;
 }
开发者ID:regi01,项目名称:gallery3-contrib,代码行数:34,代码来源:calendarview.php

示例3: index

 public function index()
 {
     $page_size = module::get_var("gallery", "page_size", 9);
     $q = Input::instance()->get("q");
     $q_with_more_terms = search::add_query_terms($q);
     $show = Input::instance()->get("show");
     if ($show) {
         $child = ORM::factory("item", $show);
         $index = search::get_position($child, $q_with_more_terms);
         if ($index) {
             $page = ceil($index / $page_size);
             url::redirect(url::abs_site("search?q=" . urlencode($q) . ($page == 1 ? "" : "&page={$page}")));
         }
     }
     $page = Input::instance()->get("page", 1);
     // Make sure that the page references a valid offset
     if ($page < 1) {
         $page = 1;
     }
     $offset = ($page - 1) * $page_size;
     list($count, $result) = search::search($q_with_more_terms, $page_size, $offset);
     $title = t("Search: %q", array("q" => $q_with_more_terms));
     $max_pages = max(ceil($count / $page_size), 1);
     $template = new Theme_View("page.html", "collection", "search");
     $root = item::root();
     $template->set_global(array("page" => $page, "max_pages" => $max_pages, "page_size" => $page_size, "breadcrumbs" => array(Breadcrumb::instance($root->title, $root->url())->set_first(), Breadcrumb::instance($q, url::abs_site("search?q=" . urlencode($q)))->set_last()), "children_count" => $count));
     $template->content = new View("search.html");
     $template->content->items = $result;
     $template->content->q = $q;
     print $template;
     item::set_display_context_callback("Search_Controller::get_display_context", $title, $q_with_more_terms, $q);
 }
开发者ID:JasonWiki,项目名称:docs,代码行数:32,代码来源:search.php

示例4: _show

 private function _show($album)
 {
     $page_size = module::get_var("gallery", "page_size", 9);
     $album_defn = unserialize(module::get_var("dynamic", $album));
     $input = Input::instance();
     $show = $input->get("show");
     if ($show) {
         $child = ORM::factory("item", $show);
         $index = dynamic::get_position($album_defn, $child);
         if ($index) {
             $page = ceil($index / $page_size);
             url::redirect("dynamic/{$album}" . ($page == 1 ? "" : "?page={$page}"));
         }
     } else {
         $page = (int) $input->get("page", "1");
     }
     $children_count = dynamic::get_display_count($album_defn);
     $offset = ($page - 1) * $page_size;
     $max_pages = max(ceil($children_count / $page_size), 1);
     // Make sure that the page references a valid offset
     if ($page < 1) {
         url::redirect(url::merge(array("page" => 1)));
     } else {
         if ($page > $max_pages) {
             url::redirect(url::merge(array("page" => $max_pages)));
         }
     }
     $root = item::root();
     $template = new Theme_View("page.html", "collection", "dynamic");
     $template->set_global(array("page" => $page, "max_pages" => $max_pages, "page_size" => $page_size, "children" => dynamic::items($album_defn->key_field, $page_size, $offset), "breadcrumbs" => array(Breadcrumb::instance($root->title, $root->url())->set_first(), Breadcrumb::instance($album_defn->title, url::site("dynamic/{$album}"))->set_last()), "children_count" => $children_count));
     $template->content = new View("dynamic.html");
     $template->content->title = t($album_defn->title);
     print $template;
     item::set_display_context_callback("Dynamic_Controller::get_display_context", $album_defn, $album);
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:35,代码来源:dynamic.php

示例5: index

 public function index()
 {
     $template = new Theme_View("page.html", "other", "About");
     $template->css("about.css");
     $template->page_title = t("Gallery :: About");
     $template->content = new View("about.html");
     print $template;
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:8,代码来源:about.php

示例6: _show

 /**
  *  @see REST_Controller::_show($resource)
  */
 public function _show($photo)
 {
     access::required("view", $photo);
     $where = array("type != " => "album");
     $position = $photo->parent()->get_position($photo, $where);
     if ($position > 1) {
         list($previous_item, $ignore, $next_item) = $photo->parent()->children(3, $position - 2, $where);
     } else {
         $previous_item = null;
         list($next_item) = $photo->parent()->viewable()->children(1, $position, $where);
     }
     $template = new Theme_View("page.html", "photo");
     $template->set_global("item", $photo);
     $template->set_global("children", array());
     $template->set_global("children_count", 0);
     $template->set_global("parents", $photo->parents());
     $template->set_global("next_item", $next_item);
     $template->set_global("previous_item", $previous_item);
     $template->set_global("sibling_count", $photo->parent()->viewable()->children_count($where));
     $template->set_global("position", $position);
     $template->content = new View("photo.html");
     $photo->view_count++;
     $photo->save();
     print $template;
 }
开发者ID:ChrisRut,项目名称:gallery3,代码行数:28,代码来源:photos.php

示例7: show

 public function show($movie)
 {
     if (!is_object($movie)) {
         // show() must be public because we route to it in url::parse_url(), so make
         // sure that we're actually receiving an object
         Kohana::show_404();
     }
     access::required("view", $movie);
     $where = array(array("type", "!=", "album"));
     $position = $movie->parent()->get_position($movie, $where);
     if ($position > 1) {
         list($previous_item, $ignore, $next_item) = $movie->parent()->children(3, $position - 2, $where);
     } else {
         $previous_item = null;
         list($next_item) = $movie->parent()->viewable()->children(1, $position, $where);
     }
     $template = new Theme_View("page.html", "item", "movie");
     $template->set_global("item", $movie);
     $template->set_global("children", array());
     $template->set_global("children_count", 0);
     $template->set_global("parents", $movie->parents());
     $template->set_global("next_item", $next_item);
     $template->set_global("previous_item", $previous_item);
     $template->set_global("sibling_count", $movie->parent()->viewable()->children_count($where));
     $template->set_global("position", $position);
     $template->content = new View("movie.html");
     $movie->view_count++;
     $movie->save();
     print $template;
 }
开发者ID:viosca,项目名称:gallery3,代码行数:30,代码来源:movies.php

示例8: show

 public function show($movie)
 {
     if (!is_object($movie)) {
         // show() must be public because we route to it in url::parse_url(), so make
         // sure that we're actually receiving an object
         throw new Kohana_404_Exception();
     }
     access::required("view", $movie);
     $template = new Theme_View("page.html", "item", "movie");
     $template->set_global(array("item" => $movie, "children" => array(), "children_count" => 0));
     $template->set_global(item::get_display_context($movie));
     $template->content = new View("movie.html");
     $movie->increment_view_count();
     print $template;
 }
开发者ID:HarriLu,项目名称:gallery3,代码行数:15,代码来源:movies.php

示例9: index

 public function index()
 {
     $template = new Theme_View("page.html", "other", "All Tags");
     $template->css("all_tags.css");
     $template->page_title = t("Gallery :: All Tags");
     $template->content = new View("all_tags.html");
     $filter = Input::instance()->get("filter");
     $template->content->filter = $filter;
     $query = ORM::factory("tag");
     if ($filter) {
         $query->like("name", $filter);
     }
     $template->content->tags = $query->order_by("name", "ASC")->find_all();
     print $template;
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:15,代码来源:all_tags.php

示例10: showuser

 public function showuser()
 {
     if (identity::active_user()->guest && !module::get_var("photoannotation", "allowguestsearch", false)) {
         message::error(t("You have to log in to perform a people search."));
         url::redirect(url::site());
         return;
     }
     $form = photoannotation::get_user_search_form("g-user-cloud-form");
     $user_id = Input::instance()->get("name", "");
     if ($user_id == "") {
         $user_id = Input::instance()->post("name", "");
     }
     $getuser = photoannotation::getuser($user_id);
     if ($getuser->found) {
         url::redirect(user_profile::url($getuser->user->id));
         return;
     }
     $page_size = module::get_var("gallery", "page_size", 9);
     $page = Input::instance()->get("page", 1);
     $offset = ($page - 1) * $page_size;
     // Make sure that the page references a valid offset
     if ($page < 1) {
         $page = 1;
     }
     list($count, $result) = photoannotation::search_user($user_id, $page_size, $offset);
     $max_pages = max(ceil($count / $page_size), 1);
     if ($page > 1) {
         $previous_page_url = url::site("photoannotation/showuser?name=" . $user_id . "&amp;page=" . ($page - 1));
     }
     if ($page < $max_pages) {
         $next_page_url = url::site("photoannotation/showuser?name=" . $user_id . "&amp;page=" . ($page + 1));
     }
     if ($user_id == "") {
         $user_id = "*";
     }
     $template = new Theme_View("page.html", "other", "usersearch");
     $template->set_global("position", $page);
     $template->set_global("total", $max_pages);
     $template->content = new View("photoannotation_user_search.html");
     $template->content->search_form = photoannotation::get_user_search_form(g - user - search - form);
     $template->content->users = $result;
     $template->content->q = $user_id;
     $template->content->count = $count;
     $template->content->paginator = new View("paginator.html");
     $template->content->paginator->previous_page_url = $previous_page_url;
     $template->content->paginator->next_page_url = $next_page_url;
     print $template;
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:48,代码来源:photoannotation.php

示例11: show

 public function show($tag_id)
 {
     $tag = ORM::factory("tag", $tag_id);
     $page_size = module::get_var("gallery", "page_size", 9);
     $page = (int) Input::instance()->get("page", "1");
     $children_count = $tag->items_count();
     $offset = ($page - 1) * $page_size;
     $max_pages = max(ceil($children_count / $page_size), 1);
     // Make sure that the page references a valid offset
     if ($page < 1) {
         url::redirect($album->abs_url());
     } else {
         if ($page > $max_pages) {
             url::redirect($album->abs_url("page={$max_pages}"));
         }
     }
     $template = new Theme_View("page.html", "collection", "tag");
     $template->set_global("page", $page);
     $template->set_global("max_pages", $max_pages);
     $template->set_global("page_size", $page_size);
     $template->set_global("tag", $tag);
     $template->set_global("children", $tag->items($page_size, $offset));
     $template->set_global("children_count", $children_count);
     $template->content = new View("dynamic.html");
     $template->content->title = $tag->name;
     print $template;
 }
开发者ID:andyst,项目名称:gallery3,代码行数:27,代码来源:tags.php

示例12: show

 public function show($album)
 {
     if (!is_object($album)) {
         // show() must be public because we route to it in url::parse_url(), so make
         // sure that we're actually receiving an object
         throw new Kohana_404_Exception();
     }
     access::required("view", $album);
     $page_size = module::get_var("gallery", "page_size", 9);
     $input = Input::instance();
     $show = $input->get("show");
     if ($show) {
         $child = ORM::factory("item", $show);
         $index = $album->get_position($child);
         if ($index) {
             $page = ceil($index / $page_size);
             if ($page == 1) {
                 url::redirect($album->abs_url());
             } else {
                 url::redirect($album->abs_url("page={$page}"));
             }
         }
     }
     $page = $input->get("page", "1");
     $children_count = $album->viewable()->children_count();
     $offset = ($page - 1) * $page_size;
     $max_pages = max(ceil($children_count / $page_size), 1);
     // Make sure that the page references a valid offset
     if ($page < 1) {
         url::redirect($album->abs_url());
     } else {
         if ($page > $max_pages) {
             url::redirect($album->abs_url("page={$max_pages}"));
         }
     }
     $template = new Theme_View("page.html", "collection", "album");
     $template->set_global("page", $page);
     $template->set_global("page_title", null);
     $template->set_global("max_pages", $max_pages);
     $template->set_global("page_size", $page_size);
     $template->set_global("item", $album);
     $template->set_global("children", $album->viewable()->children($page_size, $offset));
     $template->set_global("children_count", $children_count);
     $template->set_global("parents", $album->parents());
     $template->content = new View("album.html");
     // We can't use math in ORM or the query builder, so do this by hand.  It's important
     // that we do this with math, otherwise concurrent accesses will damage accuracy.
     db::query("UPDATE {items} SET `view_count` = `view_count` + 1 WHERE `id` = {$album->id}");
     print $template;
 }
开发者ID:andyst,项目名称:gallery3,代码行数:50,代码来源:albums.php

示例13: _show

 public function _show($tag)
 {
     $page_size = module::get_var("core", "page_size", 9);
     $page = $this->input->get("page", "1");
     $children_count = $tag->items_count();
     $offset = ($page - 1) * $page_size;
     // Make sure that the page references a valid offset
     if ($page < 1 || $page > ceil($children_count / $page_size)) {
         Kohana::show_404();
     }
     $template = new Theme_View("page.html", "tag");
     $template->set_global('page_size', $page_size);
     $template->set_global('tag', $tag);
     $template->set_global('children', $tag->items($page_size, $offset));
     $template->set_global('children_count', $children_count);
     $template->content = new View("tag.html");
     print $template;
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:18,代码来源:tags.php

示例14: googlemap

 public function googlemap($fullsize)
 {
     // Display all tags with GPS coordinates on a google map.
     // If the user can't view maps, throw a 404 error.
     if (module::get_var("tagsmap", "restrict_maps") == true && identity::active_user()->guest) {
         throw new Kohana_404_Exception();
     }
     // Generate a list of GPS coordinates.
     $tagsGPS = ORM::factory("tags_gps")->find_all();
     // Set up and display the actual page.
     //  If fullsize is true, allow the map to take up the entire browser window,
     //  if not, then display the map in the gallery theme.
     if ($fullsize == true) {
         $view = new View("tagsmap_googlemap.html");
         $view->map_fullsize = true;
         // Load in module preferences.
         $view->tags_gps = $tagsGPS;
         $view->google_map_key = module::get_var("tagsmap", "googlemap_api_key");
         $view->google_map_latitude = module::get_var("tagsmap", "googlemap_latitude");
         $view->google_map_longitude = module::get_var("tagsmap", "googlemap_longitude");
         $view->google_map_zoom = module::get_var("tagsmap", "googlemap_zoom");
         $view->google_map_type = module::get_var("tagsmap", "googlemap_type");
         print $view;
     } else {
         // Set up breadcrumbs.
         $breadcrumbs = array();
         $root = item::root();
         $breadcrumbs[] = Breadcrumb::instance($root->title, $root->url())->set_first();
         $breadcrumbs[] = Breadcrumb::instance(t("Tag Map"), url::site("tagsmap/googlemap/"))->set_last();
         $template = new Theme_View("page.html", "other", "tag");
         $template->page_title = t("Gallery :: Map");
         $template->set_global(array("breadcrumbs" => $breadcrumbs));
         $template->content = new View("tagsmap_googlemap.html");
         // Load in module preferences.
         $template->content->tags_gps = $tagsGPS;
         $template->content->google_map_key = module::get_var("tagsmap", "googlemap_api_key");
         $template->content->google_map_latitude = module::get_var("tagsmap", "googlemap_latitude");
         $template->content->google_map_longitude = module::get_var("tagsmap", "googlemap_longitude");
         $template->content->google_map_zoom = module::get_var("tagsmap", "googlemap_zoom");
         $template->content->google_map_type = module::get_var("tagsmap", "googlemap_type");
         print $template;
     }
 }
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:43,代码来源:tagsmap.php

示例15: index

 public function index()
 {
     $page_size = module::get_var("gallery", "page_size", 9);
     $q = $this->input->get("q");
     $page = $this->input->get("page", 1);
     $offset = ($page - 1) * $page_size;
     // Make sure that the page references a valid offset
     if ($page < 1) {
         $page = 1;
     }
     list($count, $result) = search::search($q, $page_size, $offset);
     $template = new Theme_View("page.html", "search");
     $template->set_global("page_size", $page_size);
     $template->set_global("children_count", $count);
     $template->content = new View("search.html");
     $template->content->items = $result;
     $template->content->q = $q;
     print $template;
 }
开发者ID:xafr,项目名称:gallery3,代码行数:19,代码来源:search.php


注:本文中的Theme_View类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。