當前位置: 首頁>>代碼示例>>PHP>>正文


PHP view::__toString方法代碼示例

本文整理匯總了PHP中view::__toString方法的典型用法代碼示例。如果您正苦於以下問題:PHP view::__toString方法的具體用法?PHP view::__toString怎麽用?PHP view::__toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在view的用法示例。


在下文中一共展示了view::__toString方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: index

 public function index($type = NULL)
 {
     //Event::add('system.post_controller', 'foo');
     if ($this->access->allowed('papers', 'read')) {
         $filtered = in_array($type, array('standard', 'digital', 'sticky'));
         $total = ORM::factory('paper')->where('status != ', 'deleted');
         if ($filtered) {
             $total->where('type', $type);
         }
         $total = $total->count_all();
         $paging = new Pagination(array('total_items' => $total));
         $view = new view(url::routes_area() . 'index');
         $list = new view(url::routes_area() . 'index_list');
         $list_papers = ORM::factory('paper')->orderby('name', 'asc')->where('status != ', 'deleted');
         if ($filtered) {
             $list_papers->where('type', $type);
         }
         $list->papers = $list_papers->find_all($paging->items_per_page, $paging->sql_offset);
         if (request::is_ajax()) {
             // ajax request return all the data the index will require to repopulate
             $this->ajax['list'] = $list->__toString();
             $this->ajax['page_number'] = $paging->page_number()->__toString();
             $this->ajax['pagination'] = $paging->render();
         } else {
             if ($filtered) {
                 // replace the last bread crumb
                 $this->breadcrumbs->add()->url(url::location())->title(ucwords($type));
             }
             $view->pagination = $paging->render();
             $view->page_number = $paging->page_number();
             $view->list = $list;
             $this->template->content = $view;
             $this->template->title = $filtered ? ucwords($type) . ' Papers' : 'Papers';
         }
     } else {
         Kohana::log('debug', 'User failed constructor security check');
         url::failed();
     }
 }
開發者ID:HIVE-Creative,項目名稱:spicers,代碼行數:39,代碼來源:papers.php

示例2: index

 /**
  * Method for displaying a users lightboxes, the only people who should have access to this page are
  * user of the system.
  *
  * @todo add notification for fails
  */
 public function index()
 {
     // get the current user.
     $user = Security::instance()->get_user();
     // sanity check
     if ($user && $user->loaded) {
         if ($this->access->allowed('lightboxes', 'index')) {
             $paging = new Pagination(array('total_items' => ORM::factory('lightbox')->where('creator_id', $user->id)->count_all()));
             $view = new view(url::routes_area() . 'index');
             $view->breadcrumbs = $this->breadcrumbs->get();
             $this->breadcrumbs->delete();
             $list = new view(url::routes_area() . 'index_list');
             $list->lightboxes = ORM::factory('lightbox')->orderby('updated', 'desc')->where('creator_id', $user->id)->find_all($paging->items_per_page, $paging->sql_offset);
             if (request::is_ajax()) {
                 // ajax request return all the data the index will require to repopulate
                 $this->ajax['list'] = $list->__toString();
                 $this->ajax['page_number'] = $paging->page_number()->__toString();
                 $this->ajax['pagination'] = $paging->render();
             } else {
                 $view->pagination = $paging->render();
                 $view->page_number = $paging->page_number();
                 $view->list = $list;
                 $this->template->content = $view;
                 $this->template->title = 'Papers';
             }
         } else {
             // they are logged in, but dont have access to the page.
             // you cant go to an index of a lightbox with out being logged into an account.
             Kohana::log('debug', 'User failed constructor security check');
             url::failed();
         }
     } else {
         // instead of the generic message, instead give them a nice messgae, or redirect to login page.
         Kohana::log('debug', 'User failed constructor security check');
         url::failed(url::current());
     }
 }
開發者ID:HIVE-Creative,項目名稱:spicers,代碼行數:43,代碼來源:lightboxes.php


注:本文中的view::__toString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。