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


PHP Theme_View::set_global方法代码示例

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


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

示例1: 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

示例2: _show

 private function _show($album)
 {
     $page_size = module::get_var("gallery", "page_size", 9);
     $page = Input::instance()->get("page", "1");
     $album_defn = unserialize(module::get_var("dynamic", $album));
     $children_count = $album_defn->limit;
     if (empty($children_count)) {
         $children_count = ORM::factory("item")->viewable()->where("type", "!=", "album")->count_all();
     }
     $offset = ($page - 1) * $page_size;
     $max_pages = ceil($children_count / $page_size);
     // Make sure that the page references a valid offset
     if ($page < 1 || $children_count && $page > ceil($children_count / $page_size)) {
         throw new Kohana_404_Exception();
     }
     $template = new Theme_View("page.html", "collection", "dynamic");
     $template->set_global("page", $page);
     $template->set_global("page_size", $page_size);
     $template->set_global("max_pages", $max_pages);
     $template->set_global("children", ORM::factory("item")->viewable()->where("type", "!=", "album")->order_by($album_defn->key_field, "DESC")->find_all($page_size, $offset));
     $template->set_global("children_count", $children_count);
     $template->content = new View("dynamic.html");
     $template->content->title = t($album_defn->title);
     print $template;
 }
开发者ID:Glooper,项目名称:gallery3-contrib,代码行数:25,代码来源:dynamic.php

示例3: _show

 /**
  *  @see REST_Controller::_show($resource)
  */
 public function _show($album)
 {
     access::required("view", $album);
     $page_size = module::get_var("core", "page_size", 9);
     $show = $this->input->get("show");
     if ($show) {
         $index = $album->get_position($show);
         $page = ceil($index / $page_size);
         if ($page == 1) {
             url::redirect("albums/{$album->id}");
         } else {
             url::redirect("albums/{$album->id}?page={$page}");
         }
     }
     $page = $this->input->get("page", "1");
     $children_count = $album->viewable()->children_count();
     $offset = ($page - 1) * $page_size;
     // Make sure that the page references a valid offset
     if ($page < 1 || $page > max(ceil($children_count / $page_size), 1)) {
         Kohana::show_404();
     }
     $template = new Theme_View("page.html", "album");
     $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");
     $album->view_count++;
     $album->save();
     print $template;
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:35,代码来源:albums.php

示例4: _show

 /**
  *  @see REST_Controller::_show($resource)
  */
 public function _show($album)
 {
     $page_size = module::get_var("gallery", "page_size", 9);
     if (!access::can("view", $album)) {
         if ($album->id == 1) {
             $view = new Theme_View("page.html", "login");
             $view->page_title = t("Log in to Gallery");
             $view->content = new View("login_ajax.html");
             $view->content->form = auth::get_login_form("login/auth_html");
             print $view;
             return;
         } else {
             access::forbidden();
         }
     }
     $show = $this->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 = $this->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", "album");
     $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.
     Database::instance()->query("UPDATE {items} SET `view_count` = `view_count` + 1 WHERE `id` = {$album->id}");
     print $template;
 }
开发者ID:ChrisRut,项目名称:gallery3,代码行数:55,代码来源:albums.php

示例5: 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

示例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
         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

示例8: 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

示例9: 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

示例10: _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

示例11: 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

示例12: _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

示例13: drawfaces

 public function drawfaces($id)
 {
     // Generate the page that allows the user to draw boxes over a photo.
     // Make sure user has access to view and edit the photo.
     $item = ORM::factory("item", $id);
     access::required("view", $item);
     access::required("edit", $item);
     // Create the page.
     $template = new Theme_View("page.html", "drawfaces");
     $template->set_global("item_id", $id);
     $template->set_global("page_title", t("Draw Faces"));
     $template->set_global("page_type", "photoface");
     $template->content = new View("drawfaces.html");
     $template->content->title = t("Tag Faces");
     $template->content->form = $this->_get_faces_form($id);
     $template->content->delete_form = $this->_get_delfaces_form($id);
     // Display the page.
     print $template;
 }
开发者ID:ChrisRut,项目名称:gallery3-contrib,代码行数:19,代码来源:tagfaces.php

示例14: _show

 public function _show($tag)
 {
     $page_size = module::get_var("gallery", "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 || $children_count && $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("page_title", t("Browse Tag::%name", array("name" => $tag->name)));
     $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");
     print $template;
 }
开发者ID:krgeek,项目名称:gallery3,代码行数:19,代码来源:tags.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::set_global方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。