本文整理汇总了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();
}
}
示例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());
}
}