コード例 #1
0
ファイル: member.php プロジェクト: refirio/levis-members
// 名簿を取得
if (empty($_GET['class_id'])) {
    $where = null;
} else {
    $where = array('members.class_id = :class_id', array('class_id' => $_GET['class_id']));
}
$_view['members'] = select_members(array('where' => $where, 'order_by' => 'id', 'limit' => array(':offset, :limit', array('offset' => $GLOBALS['config']['limits']['member'] * ($_GET['page'] - 1), 'limit' => $GLOBALS['config']['limits']['member']))), array('associate' => true));
$_view['member_count'] = select_members(array('select' => 'COUNT(DISTINCT members.id) AS count', 'where' => $where), array('associate' => true));
$_view['member_count'] = $_view['member_count'][0]['count'];
$_view['member_page'] = ceil($_view['member_count'] / $GLOBALS['config']['limits']['member']);
// 教室を取得
$classes = select_classes(array('order_by' => 'sort, id'));
$class_sets = array();
foreach ($classes as $class) {
    $class_sets[$class['id']] = $class;
}
$_view['class_sets'] = $class_sets;
$_view['classes'] = $classes;
// 分類を取得
$categories = select_categories(array('order_by' => 'sort, id'));
$category_sets = array();
foreach ($categories as $category) {
    $category_sets[$category['id']] = $category;
}
$_view['category_sets'] = $category_sets;
$_view['categories'] = $categories;
// ページャー
$pager = ui_pager(array('key' => 'page', 'count' => $_view['member_count'], 'size' => $GLOBALS['config']['limits']['member'], 'width' => $GLOBALS['config']['pagers']['member'], 'query' => '?class_id=' . $_GET['class_id'] . '&'));
$_view['member_pager'] = $pager['first'] . ' ' . $pager['back'] . ' ' . implode(' | ', $pager['pages']) . ' ' . $pager['next'] . ' ' . $pager['last'];
// タイトル
$_view['title'] = '名簿一覧';
コード例 #2
0
ファイル: user.php プロジェクト: refirio/levis-members
<?php

import('libs/plugins/ui.php');
// ページを取得
if (isset($_GET['page'])) {
    $_GET['page'] = intval($_GET['page']);
} else {
    $_GET['page'] = 1;
    $_SESSION['bulk']['user'] = array();
}
// ユーザを取得
$_view['users'] = select_users(array('order_by' => 'users.id', 'limit' => array(':offset, :limit', array('offset' => $GLOBALS['config']['limits']['user'] * ($_GET['page'] - 1), 'limit' => $GLOBALS['config']['limits']['user']))), array('associate' => true));
$_view['user_count'] = select_users(array('select' => 'COUNT(*) AS count'), array('associate' => true));
$_view['user_count'] = $_view['user_count'][0]['count'];
$_view['user_page'] = ceil($_view['user_count'] / $GLOBALS['config']['limits']['user']);
// ページャー
$pager = ui_pager(array('key' => 'page', 'count' => $_view['user_count'], 'size' => $GLOBALS['config']['limits']['user'], 'width' => $GLOBALS['config']['pagers']['user'], 'query' => '?'));
$_view['user_pager'] = $pager['first'] . ' ' . $pager['back'] . ' ' . implode(' | ', $pager['pages']) . ' ' . $pager['next'] . ' ' . $pager['last'];
// タイトル
$_view['title'] = 'ユーザ一覧';