当前位置: 首页>>代码示例>>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;未经允许,请勿转载。