本文整理匯總了PHP中Paginator::output方法的典型用法代碼示例。如果您正苦於以下問題:PHP Paginator::output方法的具體用法?PHP Paginator::output怎麽用?PHP Paginator::output使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Paginator
的用法示例。
在下文中一共展示了Paginator::output方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: leave
public function leave()
{
$smarty = parent::load('smarty');
$leave_form = parent::load('form', 'LeaveForm', $_POST);
parent::load('model', 'forms');
parent::load('model', 'system/contrib/auth.User');
if (!$this->is_post()) {
import('system/share/web/paginator');
if (User::has_role('人力資源') || User::has_role('總經理')) {
$data = Forms::get_by_type_and_user('請假申請');
$smarty->assign('has_role', true);
} else {
$data = Forms::get_by_type_and_user('請假申請', User::info('id'));
}
$paginator = new Paginator((array) $data, $_GET['page'], 10);
$smarty->assign('paginator', $paginator->output());
$smarty->assign('page_title', '請假申請');
$smarty->assign('leave_form', $leave_form->output());
$smarty->display('forms/leave');
return;
}
$form_data = new Forms();
$form_data->user_id = User::info('id');
$form_data->state = 0;
$form_data->type = '請假申請';
$form_data->form_data = serialize($_POST);
$form_data->save();
import('system/share/network/redirect');
HTTPRedirect::flash_to('forms/leave', '提交請假申請成功, 請耐心等待審核', $smarty);
}
示例2: index
public function index($id_or_alias)
{
parent::load('model', 'system/contrib/auth');
parent::load('model', 'articles');
$articles = Article::get_by_category($id_or_alias);
import('system/share/web/paginator');
$paginator = new Paginator($articles, $_GET['page'], 10);
$category = CategoryTable::getInstance()->findByAlias($id_or_alias);
$smarty = parent::load('smarty');
$smarty->assign('category', $category[0]);
$smarty->assign('paginator', $paginator->output());
$smarty->assign('page_title', $category[0]->name);
$smarty->display('article/list');
}
示例3: ls
public function ls($workflow = null, $mix = false, $orders = null)
{
$smarty = parent::load('smarty');
$userinfo = User::info();
/*
* 緩存ID
*/
$cache_id = sprintf('order_list_%s_%s_%s', $workflow, $_GET['page'], User::info('id'));
/*
* 訂單導航
*/
$_navigation = Workflow::get_navigation($userinfo);
if (!$workflow) {
if ($_navigation[0]['alias'] == '錄入訂單') {
$action = $_navigation[1]['action'];
} else {
$action = $_navigation[0]['action'];
}
HTTPRedirect::to($action);
}
if (!$workflow instanceof Workflow) {
$workflow = Workflow::get_by_id($workflow);
}
$smarty->assign('page_title', $workflow->name);
/*
* 當前工作流程是否允許當前用戶查看
*/
$role_ids = array_filter(explode(',', $workflow->roles));
AuthPlugins::required($this, $role_ids);
/*
* 當前導航
*/
foreach ($_navigation as $nav) {
if ($nav['id'] == $workflow->id) {
$navigation[$nav['id']]['active'] = true;
}
$navigation[$nav['id']] = $nav;
}
$smarty->assign('page_title', $navigation[$workflow->id]['name']);
$smarty->assign('active_workflow', $workflow->id);
$smarty->assign('order_navigation', $navigation);
/*
* 獲取工作流程中, 當前的可操作選項
*/
$operation = Workflow::get_operation($workflow->sequence, User::info());
$smarty->assign('operations', $operation);
$smarty->assign('workflow', $workflow);
if (!$mix) {
if (method_exists('OrderController', 'order_list_custom_' . $workflow)) {
$method_name = 'order_list_custom_' . $workflow->id;
$orders = $this->{$method_name}($workflow->id);
} else {
/*
* 訂單列表
*/
if (count($workflow->Children) > 0) {
$get_by_id = array();
foreach ($workflow->Children as $child) {
$get_by_id[] = $child->id;
}
$get_by_id[] = $workflow->id;
} else {
$get_by_id = $workflow->id;
}
/*
* 在跟進訂單之後 隻顯示當前用戶所有的
*/
if ($workflow->id > 2 && !User::has_role('總經理')) {
$orders = Order::get_list($get_by_id, $userinfo['id'], $userinfo['role'][0]['alias']);
} else {
$orders = Order::get_list($get_by_id);
}
}
if (User::has_role('技術經理')) {
$operation[] = array('label' => '分配任務', 'action' => 'order/select_designer');
}
}
/*
* 分頁
*/
import('system/share/web/paginator');
$paginator = new Paginator($orders, $_GET['page'], 10);
$smarty->assign('paginator', $paginator->output());
/*
* 是否客服
*/
if (User::has_role('客服')) {
$smarty->assign('is_customer_service', true);
}
/*
* 嘗試顯示對應操作的模板
*/
try {
if ($workflow->template) {
$tpl = $workflow->template;
} else {
$tpl = str_replace('order/list/', 'order/list_', $navigation[$workflow->id]['action']);
}
$smarty->display($tpl);
} catch (DoesNotExistsException $e) {
//.........這裏部分代碼省略.........
示例4: workflow_permission
public function workflow_permission()
{
parent::load('model', 'workflow');
parent::load('model', 'order');
parent::load('model', 'system/contrib/auth');
$workflows = WorkflowTable::getInstance()->findAll();
$roles = RoleTable::getInstance()->findAll();
$roles_cleaned = array();
foreach ($roles as $role) {
$roles_cleaned[$role['id']] = $role['name'];
}
foreach ($workflows as $k => $workflow) {
$_roles = array_filter(explode(',', $workflow->roles));
$workflows[$k]->roles = '';
if ($_roles) {
foreach ($_roles as $_r) {
$workflows[$k]->roles .= ' ' . $roles_cleaned[$_r];
}
}
}
import('system/share/web/paginator');
$paginator = new Paginator($workflows, $_GET['page'], 20);
$this->smarty->assign('paginator', $paginator->output());
$this->smarty->display('manager/order/workflow_list');
}