当前位置: 首页>>代码示例>>PHP>>正文


PHP ListView::build方法代码示例

本文整理汇总了PHP中ListView::build方法的典型用法代码示例。如果您正苦于以下问题:PHP ListView::build方法的具体用法?PHP ListView::build怎么用?PHP ListView::build使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ListView的用法示例。


在下文中一共展示了ListView::build方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: menu_list

/**
 * List items
 */
function menu_list($row_id = NULL, $search = NULL, $sort = NULL, $page = 1)
{
    $view = new ListView();
    // Row Id for update only row
    if (!empty($row_id)) {
        $row_id = 'id = ' . $row_id;
    } else {
        $row_id = 'id != 0';
    }
    // Sort
    if (empty($sort)) {
        $sort = 'id ASC';
    }
    $limit = PAGER_LIMIT;
    $offset = $page * $limit - $limit;
    $db = DataConnection::readOnly();
    $total_records = 0;
    // Search
    if (!empty($search)) {
        $search_fields = array('id', 'label', 'func', 'module');
        $exceptions = array();
        $search_query = build_search_query($search, $search_fields, $exceptions);
        $menus = $db->menu()->where($row_id)->and($search_query)->order($sort)->limit($limit, $offset);
    } else {
        $menus = $db->menu()->where($row_id)->order($sort)->limit($limit, $offset);
    }
    $total_records = $db->menu()->count("*");
    $i = 0;
    if (count($menus)) {
        // Building the header with sorter
        $headers[] = array('display' => 'Id', 'field' => 'id');
        $headers[] = array('display' => 'Label', 'field' => 'label');
        $headers[] = array('display' => 'Function', 'field' => 'func');
        $headers[] = array('display' => 'Module', 'field' => 'module');
        $headers[] = array('display' => 'Edit', 'field' => NULL);
        $headers[] = array('display' => 'Delete', 'field' => NULL);
        $headers = build_sort_header('menu_list', 'menu', $headers, $sort);
        foreach ($menus as $menu) {
            $j = $i + 1;
            //This is important for the row update/delete
            $rows[$j]['row_id'] = $menu['id'];
            /////////////////////////////////////////////
            $rows[$j]['id'] = $menu['id'];
            $rows[$j]['label'] = $menu['label'];
            $rows[$j]['func'] = $menu['func'];
            $rows[$j]['module'] = $menu['module'];
            if ($menu['system'] == 1) {
                $disabled = 'disabled';
            } else {
                $disabled = '';
            }
            $rows[$j]['edit'] = theme_link_process_information('', 'menu_edit_form', 'menu_edit_form', 'menu', array('extra_value' => 'id|' . $menu['id'], 'response_type' => 'modal', 'icon' => NATURAL_EDIT_ICON, 'class' => $disabled));
            $rows[$j]['delete'] = theme_link_process_information('', 'menu_delete_form', 'menu_delete_form', 'menu', array('extra_value' => 'id|' . $menu['id'], 'response_type' => 'modal', 'icon' => NATURAL_REMOVE_ICON, 'class' => $disabled));
            $i++;
        }
    }
    $options = array('show_headers' => TRUE, 'page_title' => translate('Users List'), 'page_subtitle' => translate('Manage Menus'), 'empty_message' => translate('No menu found!'), 'table_prefix' => theme_link_process_information(translate('Create New Menu'), 'menu_create_form', 'menu_create_form', 'menu', array('response_type' => 'modal')), 'pager_items' => build_pager('menu_list', 'menu', $total_records, $limit, $page), 'page' => $page, 'sort' => $sort, 'search' => $search, 'show_search' => TRUE, 'function' => 'menu_list', 'module' => 'menu', 'update_row_id' => '', 'table_form_id' => '', 'table_form_process' => '');
    $listview = $view->build($rows, $headers, $options);
    return $listview;
}
开发者ID:enettolima,项目名称:mvno-platform,代码行数:63,代码来源:menu.controller.php

示例2: user_list

/**
 * User List.
 */
function user_list($row_id = NULL, $search = NULL, $sort = NULL, $page = 1)
{
    $view = new ListView();
    // Row Id for update only row
    if (!empty($row_id)) {
        $row_id = 'id = ' . $row_id;
    } else {
        $row_id = 'id != 0';
    }
    // Sort
    if (empty($sort)) {
        $sort = 'first_name ASC';
    }
    $limit = PAGER_LIMIT;
    // PAGER_LIMIT
    $offset = $page * $limit - $limit;
    $db = DataConnection::readOnly();
    $total_records = 0;
    // Search
    if (!empty($search)) {
        $search_fields = array('id', 'first_name', 'last_name', 'username');
        $exceptions = array();
        $search_query = build_search_query($search, $search_fields, $exceptions);
        $users = $db->user()->where($row_id)->and($search_query)->order($sort)->limit($limit, $offset);
    } else {
        $users = $db->user()->where($row_id)->order($sort)->limit($limit, $offset);
    }
    $total_records = $db->user()->count("*");
    if (count($users) > 0) {
        // Building the header with sorter
        $headers[] = array('display' => 'Id', 'field' => 'id');
        $headers[] = array('display' => 'First Name', 'field' => 'first_name');
        $headers[] = array('display' => 'Last Name', 'field' => 'last_name');
        $headers[] = array('display' => 'Username', 'field' => 'username');
        $headers[] = array('display' => 'Edit', 'field' => NULL);
        $headers[] = array('display' => 'Delete', 'field' => NULL);
        $headers = build_sort_header('user_list', 'user', $headers, $sort);
        $i = 0;
        foreach ($users as $user) {
            $class = "";
            if ($user['username'] == "admin") {
                $class = "disabled";
            }
            //This is important for the row update
            $rows[$i]['row_id'] = $user['id'];
            $rows[$i]['id'] = $user['id'];
            $rows[$i]['first_name'] = $user['first_name'];
            $rows[$i]['last_name'] = $user['last_name'];
            $rows[$i]['username'] = $user['username'];
            $rows[$i]['edit'] = theme_link_process_information('', 'user_edit_form', 'user_edit_form', 'user', array('extra_value' => 'user_id|' . $user['id'], 'response_type' => 'modal', 'icon' => constant("NATURAL_EDIT_ICON")));
            $rows[$i]['delete'] = theme_link_process_information('', 'user_delete_form', 'user_delete_form', 'user', array('extra_value' => 'user_id|' . $user['id'], 'response_type' => 'modal', 'icon' => constant("NATURAL_REMOVE_ICON"), 'class' => $class));
            $i++;
        }
    }
    //count($users)
    $options = array('show_headers' => TRUE, 'page_title' => translate('Users List'), 'page_subtitle' => translate('Manage Users'), 'empty_message' => translate('No user found!'), 'table_prefix' => theme_link_process_information(translate('Create New User'), 'user_create_form', 'user_create_form', 'user', array('response_type' => 'modal')), 'pager_items' => build_pager('user_list', 'user', $total_records, $limit, $page), 'page' => $page, 'sort' => $sort, 'search' => $search, 'show_search' => TRUE, 'function' => 'user_list', 'module' => 'user', 'update_row_id' => '', 'table_form_id' => '', 'table_form_process' => '');
    $listview = $view->build($rows, $headers, $options);
    return $listview;
}
开发者ID:enettolima,项目名称:mvno-platform,代码行数:62,代码来源:user.controller.php

示例3: bank_list

/**
 * List items
 */
function bank_list($row_id = NULL, $search = NULL, $sort = NULL, $page = 1)
{
    $view = new ListView();
    // Row Id for update only row
    if (!empty($row_id)) {
        $row_id = 'id = ' . $row_id;
    } else {
        $row_id = 'id != 0';
    }
    // Sort
    if (empty($sort)) {
        $sort = 'bank_name asc';
    }
    $limit = PAGER_LIMIT;
    $offset = $page * $limit - $limit;
    $total_records = 0;
    $pdo = new PDO(NATURAL_PDO_DSN_READ, NATURAL_PDO_USER_READ, NATURAL_PDO_PASS_READ);
    // Search
    if (!empty($search)) {
        $search_fields = array('id', 'bank_name', 'account_number', 'comment');
        $exceptions = array();
        $search_query = build_search_query($search, $search_fields, $exceptions);
        $sql = 'select SQL_CALC_FOUND_ROWS  * from bank where church_id = ' . $_SESSION['log_church_id'] . ' and ' . $search_query . ' order by ' . $sort . ' limit ' . $limit . ' offset ' . $offset;
        $records = $pdo->prepare($sql);
        $records->execute();
    } else {
        $sql = 'select SQL_CALC_FOUND_ROWS  * from bank where church_id = ' . $_SESSION['log_church_id'] . ' order by ' . $sort . ' limit ' . $limit . ' offset ' . $offset;
        $records = $pdo->prepare($sql);
        $records->execute();
    }
    $total_records = $pdo->query('SELECT FOUND_ROWS();')->fetch(PDO::FETCH_COLUMN);
    $i = 0;
    if (count($records)) {
        // Building the header with sorter
        $headers[] = array('display' => 'Id', 'field' => 'id');
        $headers[] = array('display' => 'Bank Name', 'field' => 'bank_name');
        $headers[] = array('display' => 'Account Number', 'field' => 'bank_account_number');
        $headers[] = array('display' => 'Comment', 'field' => 'comment');
        $headers[] = array('display' => 'Edit', 'field' => NULL);
        $headers[] = array('display' => 'Delete', 'field' => NULL);
        $headers = build_sort_header('bank_list', 'bank', $headers, $sort);
        foreach ($records as $bank) {
            $j = $i + 1;
            //This is important for the row update/delete
            $rows[$j]['row_id'] = $bank['id'];
            /////////////////////////////////////////////
            $rows[$j]['id'] = $bank['id'];
            $rows[$j]['bank_name'] = $bank['bank_name'];
            $rows[$j]['account_number'] = $bank['bank_account_number'];
            $rows[$j]['comment'] = $bank['comment'];
            $rows[$j]['edit'] = theme_link_process_information('', 'bank_edit_form', 'bank_edit_form', 'bank', array('extra_value' => 'id|' . $bank['id'], 'response_type' => 'modal', 'icon' => NATURAL_EDIT_ICON));
            $rows[$j]['delete'] = theme_link_process_information('', 'bank_delete_form', 'bank_delete_form', 'bank', array('extra_value' => 'id|' . $bank['id'], 'response_type' => 'modal', 'icon' => NATURAL_REMOVE_ICON));
            $i++;
        }
    }
    $options = array('show_headers' => TRUE, 'page_title' => translate('Banks List'), 'page_subtitle' => translate('Manage Banks'), 'empty_message' => translate('No bank found!'), 'table_prefix' => theme_link_process_information(translate('Create New Bank'), 'bank_create_form', 'bank_create_form', 'bank', array('response_type' => 'modal')), 'pager_items' => build_pager('bank_list', 'bank', $total_records, $limit, $page), 'page' => $page, 'sort' => $sort, 'search' => $search, 'show_search' => TRUE, 'function' => 'bank_list', 'module' => 'bank', 'update_row_id' => '', 'table_form_id' => '', 'table_form_process' => '');
    $listview = $view->build($rows, $headers, $options);
    return $listview;
}
开发者ID:enettolima,项目名称:ceva-finance,代码行数:62,代码来源:bank.controller.php

示例4: categories_list

/**
 * List items
 */
function categories_list($row_id = NULL, $search = NULL, $sort = NULL, $page = 1)
{
    $view = new ListView();
    // Row Id for update only row
    if (!empty($row_id)) {
        $row_id = 'tt.id = ' . $row_id;
    } else {
        $row_id = 'tt.id != 0';
    }
    // Sort
    if (empty($sort)) {
        $sort = 'tt.type_id, tt.name asc';
    }
    $limit = PAGER_LIMIT;
    $offset = $page * $limit - $limit;
    $total_records = 0;
    $pdo = new PDO(NATURAL_PDO_DSN_READ, NATURAL_PDO_USER_READ, NATURAL_PDO_PASS_READ);
    // Search
    if (!empty($search)) {
        $search_fields = array('id', 'bank_name', 'account_number', 'comment');
        $exceptions = array();
        $search_query = build_search_query($search, $search_fields, $exceptions);
        $sql = "select SQL_CALC_FOUND_ROWS tt.id, tt.name, tt.budget, (case tt.type_id when 0 then 'Income' else 'Withdraw' end) type from categories tt\n              where tt.church_id = " . $_SESSION['log_church_id'] . " and " . $search_query . " order by " . $sort . " limit " . $limit . " offset " . $offset;
        $records = $pdo->prepare($sql);
        $records->execute();
    } else {
        $sql = "select SQL_CALC_FOUND_ROWS tt.id, tt.name, tt.budget, (case tt.type_id when 0 then 'Income' else 'Withdraw' end) type  from categories tt\n              where tt.church_id = " . $_SESSION['log_church_id'] . "  order by " . $sort . " limit " . $limit . " offset " . $offset;
        $records = $pdo->prepare($sql);
        $records->execute();
    }
    $total_records = $pdo->query('SELECT FOUND_ROWS();')->fetch(PDO::FETCH_COLUMN);
    $i = 0;
    if (count($records)) {
        // Building the header with sorter
        $headers[] = array('display' => 'Type', 'field' => 'type');
        $headers[] = array('display' => 'Name', 'field' => 'name');
        $headers[] = array('display' => 'Budget', 'field' => 'budget');
        $headers[] = array('display' => 'Edit', 'field' => NULL);
        $headers[] = array('display' => 'Delete', 'field' => NULL);
        $headers = build_sort_header('categories_list', 'categories', $headers, $sort);
        foreach ($records as $record) {
            $j = $i + 1;
            //This is important for the row update/delete
            $rows[$j]['row_id'] = $record['id'];
            /////////////////////////////////////////////
            $rows[$j]['type'] = $record['type'];
            $rows[$j]['name'] = $record['name'];
            $rows[$j]['budget'] = $record['budget'];
            $rows[$j]['edit'] = theme_link_process_information('', 'categories_edit_form', 'categories_edit_form', 'categories', array('extra_value' => 'id|' . $record['id'], 'response_type' => 'modal', 'icon' => NATURAL_EDIT_ICON));
            $rows[$j]['delete'] = theme_link_process_information('', 'categories_delete_form', 'categories_delete_form', 'categories', array('extra_value' => 'id|' . $record['id'], 'response_type' => 'modal', 'icon' => NATURAL_REMOVE_ICON));
            $i++;
        }
    }
    $options = array('show_headers' => TRUE, 'page_title' => translate('Categories List'), 'page_subtitle' => translate('Manage Categories'), 'empty_message' => translate('No category found!'), 'table_prefix' => theme_link_process_information(translate('Create New Category'), 'categories_create_form', 'categories_create_form', 'categories', array('response_type' => 'modal')), 'pager_items' => build_pager('categories_list', 'categories', $total_records, $limit, $page), 'page' => $page, 'sort' => $sort, 'search' => $search, 'show_search' => TRUE, 'function' => 'categories_list', 'module' => 'categories', 'update_row_id' => '', 'table_form_id' => '', 'table_form_process' => '');
    $listview = $view->build($rows, $headers, $options);
    return $listview;
}
开发者ID:enettolima,项目名称:ceva-finance,代码行数:60,代码来源:categories.controller.php

示例5: dashboard_widgets_list

/**
 * List items
 */
function dashboard_widgets_list($row_id = NULL, $search = NULL, $sort = NULL, $page = 1)
{
    $view = new ListView();
    // Row Id for update only row
    if (!empty($row_id)) {
        $row_id = 'id = ' . $row_id;
    } else {
        $row_id = 'id != 0';
    }
    // Sort
    if (empty($sort)) {
        $sort = 'id ASC';
    }
    $limit = PAGER_LIMIT;
    $offset = $page * $limit - $limit;
    $db = DataConnection::readOnly();
    $total_records = 0;
    // Search
    if (!empty($search)) {
        $search_fields = array('id', 'title', 'description');
        $exceptions = array();
        $search_query = build_search_query($search, $search_fields, $exceptions);
        $dashboard_widgets = $db->dashboard_widgets()->where($row_id)->and($search_query)->order($sort)->limit($limit, $offset);
    } else {
        $dashboard_widgets = $db->dashboard_widgets()->where($row_id)->order($sort)->limit($limit, $offset);
    }
    $total_records = $db->dashboard_widgets()->count("*");
    if (count($dashboard_widgets) > 0) {
        // Building the header with sorter
        $headers[] = array('display' => 'Id', 'field' => 'id');
        $headers[] = array('display' => 'Title', 'field' => 'title');
        $headers[] = array('display' => 'Description', 'field' => 'description');
        $headers[] = array('display' => 'Edit', 'field' => NULL);
        $headers[] = array('display' => 'Delete', 'field' => NULL);
        $headers = build_sort_header('dashboard_widgets_list', 'dashboard_widgets', $headers, $sort);
        $i = 0;
        foreach ($dashboard_widgets as $widget) {
            $rows[$i]['row_id'] = $widget['id'];
            $rows[$i]['id'] = $widget['id'];
            $rows[$i]['title'] = $widget['title'];
            if (strlen($widget['description']) > 50) {
                $rows[$i]['description'] = substr($widget['description'], 0, 50) . '...';
            } else {
                $rows[$i]['description'] = $widget['description'];
            }
            $rows[$i]['edit'] = theme_link_process_information('', 'dashboard_widgets_edit_form', 'dashboard_widgets_edit_form', 'dashboard_widgets', array('extra_value' => 'id|' . $widget['id'], 'response_type' => 'modal', 'icon' => NATURAL_EDIT_ICON, 'class' => $disabled));
            $rows[$i]['delete'] = theme_link_process_information('', 'dashboard_widgets_delete_form', 'dashboard_widgets_delete_form', 'dashboard_widgets', array('extra_value' => 'id|' . $widget['id'], 'response_type' => 'modal', 'icon' => NATURAL_REMOVE_ICON, 'class' => $disabled));
            $i++;
        }
    }
    $options = array('show_headers' => TRUE, 'page_title' => translate('Users List'), 'page_subtitle' => translate('Manage Dashboard Widgetss'), 'empty_message' => translate('No dashboard widgets found!'), 'table_prefix' => theme_link_process_information(translate('Create New Dashboard Widget'), 'dashboard_widgets_graph_line_template', 'dashboard_widgets_graph_line_template', 'dashboard_widgets', array('response_type' => 'in_modal')), 'pager_items' => build_pager('dashboard_widgets_list', 'dashboard_widgets', $total_records, $limit, $page), 'page' => $page, 'sort' => $sort, 'search' => $search, 'show_search' => TRUE, 'function' => 'dashboard_widgets_list', 'module' => 'dashboard_widgets', 'update_row_id' => '', 'table_form_id' => '', 'table_form_process' => '');
    $listview = $view->build($rows, $headers, $options);
    return $listview;
}
开发者ID:enettolima,项目名称:ceva-finance,代码行数:57,代码来源:dashboard_widgets.controller.php

示例6: report_list

/**
 * List items
 */
function report_list($row_id = NULL, $search = NULL, $sort = NULL, $page = 1)
{
    $view = new ListView();
    // Row Id for update only row
    if (!empty($row_id)) {
        $row_id = 'id = ' . $row_id;
    } else {
        $row_id = 'id != 0';
    }
    // Sort
    if (empty($sort)) {
        $sort = 'id ASC';
    }
    $limit = PAGER_LIMIT;
    $offset = $page * $limit - $limit;
    $db = DataConnection::readOnly();
    $total_records = 0;
    // Search
    if (!empty($search)) {
        $search_fields = array('id', 'report_name', 'report_content');
        $exceptions = array();
        $search_query = build_search_query($search, $search_fields, $exceptions);
        $reports = $db->report()->where($row_id)->and($search_query)->order($sort)->limit($limit, $offset);
    } else {
        $reports = $db->report()->where($row_id)->order($sort)->limit($limit, $offset);
    }
    $total_records = $db->report()->count("*");
    $i = 0;
    if (count($reports)) {
        // Building the header with sorter
        $headers[] = array('display' => 'Id', 'field' => 'id');
        $headers[] = array('display' => 'Report Name', 'field' => 'report_name');
        $headers[] = array('display' => 'Pdf', 'field' => NULL);
        $headers = build_sort_header('report_list', 'report', $headers, $sort);
        foreach ($reports as $report) {
            $j = $i + 1;
            //This is important for the row update/delete
            $rows[$j]['row_id'] = $report['id'];
            /////////////////////////////////////////////
            $rows[$j]['id'] = $report['id'];
            $rows[$j]['report_name'] = $report['report_name'];
            $rows[$j]['Pdf'] = theme_link_process_information('Pdf', 'report_pdf', 'report_pdf', 'report', array('extra_value' => 'id|' . $report['id'], 'response_type' => 'modal'));
            $i++;
        }
    }
    $options = array('show_headers' => TRUE, 'page_title' => translate('Reports List'), 'page_subtitle' => translate('Generate Reports'), 'empty_message' => translate('No report found!'), 'pager_items' => build_pager('report_list', 'report', $total_records, $limit, $page), 'page' => $page, 'sort' => $sort, 'search' => $search, 'show_search' => TRUE, 'function' => 'report_list', 'module' => 'report', 'update_row_id' => '', 'table_form_id' => '', 'table_form_process' => '');
    $listview = $view->build($rows, $headers, $options);
    return $listview;
}
开发者ID:enettolima,项目名称:ceva-finance,代码行数:52,代码来源:report.controller.php

示例7: user_list_vendors

/**
 * User List.
 */
function user_list_vendors($row_id = NULL, $search = NULL, $sort = NULL, $page = 1)
{
    $view = new ListView();
    // Row Id for update only row
    if (!empty($row_id)) {
        $row_id = 'u.id = ' . $row_id;
    } else {
        $row_id = 'u.id != 0';
    }
    // Sort
    if (empty($sort)) {
        $sort = 'u.first_name, u.last_name asc';
    }
    $limit = PAGER_LIMIT;
    $offset = $page * $limit - $limit;
    $total_records = 0;
    $pdo = new PDO(NATURAL_PDO_DSN_READ, NATURAL_PDO_USER_READ, NATURAL_PDO_PASS_READ);
    // Search
    if (!empty($search)) {
        $search_fields = array('u.id', 'u.first_name', 'u.last_name', 'u.phone_number', 'u.email');
        $exceptions = array();
        $search_query = build_search_query($search, $search_fields, $exceptions);
        $sql = 'select SQL_CALC_FOUND_ROWS  u.`id`, u.`first_name`, u.`last_name`, u.`username`, u.`email`, u.`phone_number`, al.description, al.access_level
						       from church_link cl
									 left outer join user u on u.id = cl.user_id
									 left outer join acl_levels al on al.id = cl.acl_levels_id
						       where cl.church_id = ' . $_SESSION['log_church_id'] . ' and u.vendor = 1 and ' . $search_query . ' order by ' . $sort . ' limit ' . $limit . ' offset ' . $offset;
        $records = $pdo->prepare($sql);
        $records->execute();
    } else {
        $sql = 'select SQL_CALC_FOUND_ROWS  u.`id`, u.`first_name`, u.`last_name`, u.`username`, u.`email`, u.`phone_number`, al.description, al.access_level
						       from church_link cl
									 left outer join user u on u.id = cl.user_id
									 left outer join acl_levels al on al.id = cl.acl_levels_id
						       where cl.church_id = ' . $_SESSION['log_church_id'] . ' and u.vendor = 1 order by ' . $sort . ' limit ' . $limit . ' offset ' . $offset;
        $records = $pdo->prepare($sql);
        $records->execute();
    }
    $total_records = $pdo->query('SELECT FOUND_ROWS();')->fetch(PDO::FETCH_COLUMN);
    if (count($records)) {
        // Building the header with sorter
        $headers[] = array('display' => 'Id', 'field' => 'id');
        $headers[] = array('display' => 'First Name', 'field' => 'first_name');
        $headers[] = array('display' => 'Last Name', 'field' => 'last_name');
        $headers[] = array('display' => 'User Name', 'field' => 'username');
        $headers[] = array('display' => 'Email', 'field' => 'email');
        $headers[] = array('display' => 'Phone', 'field' => 'phone_number');
        $headers[] = array('display' => 'Rule', 'field' => 'description');
        $headers[] = array('display' => 'Level', 'field' => 'access_level');
        $headers[] = array('display' => 'Edit', 'field' => NULL);
        $headers[] = array('display' => 'Delete', 'field' => NULL);
        $headers = build_sort_header('user_list_vendors', 'user', $headers, $sort);
        foreach ($records as $record) {
            $j = $i + 1;
            //This is important for the row update/delete
            $rows[$j]['row_id'] = $record['id'];
            /////////////////////////////////////////////
            $rows[$j]['id'] = $record['id'];
            $rows[$j]['first_name'] = $record['first_name'];
            $rows[$j]['last_name'] = $record['last_name'];
            $rows[$j]['username'] = $record['username'];
            $rows[$j]['email'] = $record['email'];
            $rows[$j]['phone_number'] = $record['phone_number'];
            $rows[$j]['description'] = $record['description'];
            $rows[$j]['level'] = $record['access_level'];
            $rows[$j]['edit'] = theme_link_process_information('', 'user_edit_form', 'user_edit_form', 'user', array('extra_value' => 'user_id|' . $record['id'], 'response_type' => 'modal', 'icon' => constant("NATURAL_EDIT_ICON")));
            $rows[$j]['delete'] = theme_link_process_information('', 'user_delete_form', 'user_delete_form', 'user', array('extra_value' => 'user_id|' . $record['id'], 'response_type' => 'modal', 'icon' => constant("NATURAL_REMOVE_ICON"), 'class' => $class));
            $i++;
        }
    }
    //count($users)
    $options = array('show_headers' => TRUE, 'page_title' => translate('Vendors List'), 'page_subtitle' => translate('Manage Vendors'), 'empty_message' => translate('No vendor found!'), 'table_prefix' => theme_link_process_information(translate('Create New Vendor'), 'user_create_form', 'user_create_form', 'user', array('response_type' => 'modal')), 'pager_items' => build_pager('user_list_vendors', 'user', $total_records, $limit, $page), 'page' => $page, 'sort' => $sort, 'search' => $search, 'show_search' => TRUE, 'function' => 'user_list_vendors', 'module' => 'user', 'update_row_id' => '', 'table_form_id' => '', 'table_form_process' => '');
    $listview = $view->build($rows, $headers, $options);
    return $listview;
}
开发者ID:enettolima,项目名称:ceva-finance,代码行数:78,代码来源:user.controller.php

示例8: field_list

function field_list($row_id = NULL, $search = NULL, $sort = NULL, $page = 1)
{
    $view = new ListView();
    // Row Id for update only row
    if (!empty($row_id)) {
        $row_id = 'id = ' . $row_id;
    } else {
        $row_id = 'id != 0';
    }
    // Sort
    if (empty($sort)) {
        $sort = 'form_reference ASC';
    }
    $limit = PAGER_LIMIT;
    $offset = $page * $limit - $limit;
    $db = DataConnection::readOnly();
    $total_records = 0;
    // Search
    if (!empty($search)) {
        $search_fields = array('id', 'field_name', 'form_reference', 'html_type', 'def_label');
        $exceptions = array();
        $search_query = build_search_query($search, $search_fields, $exceptions);
        $fields = $db->field_templates()->where($row_id)->and($search_query)->order($sort)->limit($limit, $offset);
    } else {
        $fields = $db->field_templates()->where($row_id)->order($sort)->limit($limit, $offset);
    }
    $total_records = $db->field_templates()->count("*");
    $i = 0;
    if (count($fields)) {
        // Building the header with sorter
        $headers[] = array('display' => 'Id', 'field' => 'id');
        $headers[] = array('display' => 'Form Reference', 'field' => 'form_reference');
        $headers[] = array('display' => 'Position', 'field' => 'form_field_order');
        $headers[] = array('display' => 'Name', 'field' => 'field_name');
        $headers[] = array('display' => 'HTML Type', 'field' => 'html_type');
        $headers[] = array('display' => 'Label', 'field' => 'def_label');
        $headers[] = array('display' => 'Edit', 'field' => NULL);
        $headers[] = array('display' => 'Delete', 'field' => NULL);
        $headers = build_sort_header('field_list', 'natural', $headers, $sort);
        $total = 0;
        foreach ($fields as $field) {
            $j = $i + 1;
            //This is important for the row update
            $rows[$j]['row_id'] = $field['id'];
            //////////////////////////////////////
            $rows[$j]['id'] = $field['id'];
            $rows[$j]['form_reference'] = $field['form_reference'];
            $rows[$j]['form_field_order'] = $field['form_field_order'];
            $rows[$j]['field_name'] = $field['field_name'];
            $rows[$j]['html_type'] = $field['html_type'];
            $rows[$j]['def_label'] = $field['def_label'];
            $rows[$j]['edit'] = theme_link_process_information('', 'field_edit_form', 'field_edit_form', 'natural', array('extra_value' => 'id|' . $field['id'], 'response_type' => 'modal', 'icon' => NATURAL_EDIT_ICON));
            $rows[$j]['delete'] = theme_link_process_information('', 'field_delete_form', 'field_delete_form', 'natural', array('extra_value' => 'id|' . $field['id'], 'response_type' => 'modal', 'icon' => NATURAL_REMOVE_ICON));
            $i++;
        }
    }
    $options = array('show_headers' => TRUE, 'page_title' => translate('Field List'), 'page_subtitle' => translate('Manage Fields'), 'empty_message' => translate('No field found!'), 'table_prefix' => theme_link_process_information(translate('Create New Field'), 'field_create_form', 'field_create_form', 'natural', array('response_type' => 'modal')), 'pager_items' => build_pager('field_list', 'natural', $total_records, $limit, $page), 'page' => $page, 'sort' => $sort, 'search' => $search, 'show_search' => TRUE, 'function' => 'field_list', 'module' => 'natural', 'update_row_id' => '', 'table_form_id' => '', 'table_form_process' => '');
    $listview = $view->build($rows, $headers, $options);
    return $listview;
}
开发者ID:enettolima,项目名称:mvno-platform,代码行数:60,代码来源:natural.controller.php

示例9: church_list

/**
 * List items
 */
function church_list($row_id = NULL, $search = NULL, $sort = NULL, $page = 1)
{
    $view = new ListView();
    // Row Id for update only row
    if (!empty($row_id)) {
        $row_id = 'id = ' . $row_id;
    } else {
        $row_id = 'id != 0';
    }
    // Sort
    if (empty($sort)) {
        $sort = 'c.name asc';
    }
    $limit = PAGER_LIMIT;
    $offset = $page * $limit - $limit;
    $total_records = 0;
    $pdo = new PDO(NATURAL_PDO_DSN_READ, NATURAL_PDO_USER_READ, NATURAL_PDO_PASS_READ);
    // Search
    if (!empty($search)) {
        $search_fields = array('id', 'name', 'rowcount');
        $exceptions = array();
        $search_query = build_search_query($search, $search_fields, $exceptions);
        $sql = 'select SQL_CALC_FOUND_ROWS c.id, c.name,
                 (select count(id) from church_link where church_id = c.id and acl_levels_id = 1) visitors,
                 (select count(id) from church_link where church_id = c.id and acl_levels_id = 2) members,
                 (select count(id) from church_link where church_id = c.id and acl_levels_id = 3) pastors,
                 (select count(id) from church_link where church_id = c.id and acl_levels_id = 4) treasurers,
                 (select count(id) from church_link where church_id = c.id and acl_levels_id = 5) administrators
       from church_link cl
       left outer join church c on c.id = cl.church_id
       where cl.user_id = ' . $_SESSION['log_id'] . ' ' . $search_query . ' order by ' . $sort . ' limit ' . $limit . ' offset ' . $offset;
        $records = $pdo->prepare($sql);
        $records->execute();
    } else {
        $sql = 'select SQL_CALC_FOUND_ROWS c.id, c.name,
                   (select count(id) from church_link where church_id = c.id and acl_levels_id = 1) visitors,
                   (select count(id) from church_link where church_id = c.id and acl_levels_id = 2) members,
                   (select count(id) from church_link where church_id = c.id and acl_levels_id = 3) pastors,
                   (select count(id) from church_link where church_id = c.id and acl_levels_id = 4) treasurers,
                   (select count(id) from church_link where church_id = c.id and acl_levels_id = 5) administrators
              from church_link cl
              left outer join church c on c.id = cl.church_id
              where cl.user_id = ' . $_SESSION['log_id'] . ' order by ' . $sort . ' limit ' . $limit . ' offset ' . $offset;
        $records = $pdo->prepare($sql);
        $records->execute();
    }
    $total_records = $pdo->query('SELECT FOUND_ROWS();')->fetch(PDO::FETCH_COLUMN);
    $i = 0;
    if (count($records)) {
        // Building the header with sorter
        $headers[] = array('display' => 'Id', 'field' => 'id');
        $headers[] = array('display' => 'Church', 'field' => 'name');
        $headers[] = array('display' => 'Visitors', 'field' => 'visitors');
        $headers[] = array('display' => 'Members', 'field' => 'members');
        $headers[] = array('display' => 'Pastors', 'field' => 'pastors');
        $headers[] = array('display' => 'Treasurers', 'field' => 'treasurers');
        $headers[] = array('display' => 'Administrators', 'field' => 'administrators');
        $headers[] = array('display' => 'Access', 'field' => NULL);
        $headers = build_sort_header('church_list', 'church', $headers, $sort);
        foreach ($records as $record) {
            $j = $i + 1;
            //This is important for the row update/delete
            $rows[$j]['row_id'] = $record['id'];
            /////////////////////////////////////////////
            $rows[$j]['id'] = $record['id'];
            $rows[$j]['name'] = $record['name'];
            $rows[$j]['visitors'] = $record['visitors'];
            $rows[$j]['members'] = $record['members'];
            $rows[$j]['pastors'] = $record['pastors'];
            $rows[$j]['treasurers'] = $record['treasurers'];
            $rows[$j]['administrators'] = $record['administrators'];
            $rows[$j]['account_management'] = theme_link_process_information('Manage', '', '', 'church', array('response_type' => null, 'href' => 'jump.php?url=dashboard_church.php&church_id=' . $record['id']));
            $i++;
        }
    }
    $options = array('show_headers' => TRUE, 'page_title' => translate('Churchs List'), 'page_subtitle' => translate('Manage Churchs'), 'empty_message' => translate('No church found!'), 'table_prefix' => theme_link_process_information(translate('Create New Church'), 'church_create_form', 'church_create_form', 'church', array('response_type' => 'modal')), 'pager_items' => build_pager('church_list', 'church', $total_records, $limit, $page), 'page' => $page, 'sort' => $sort, 'search' => $search, 'show_search' => TRUE, 'function' => 'church_list', 'module' => 'church', 'update_row_id' => '', 'table_form_id' => '', 'table_form_process' => '');
    $listview = $view->build($rows, $headers, $options);
    return $listview;
}
开发者ID:enettolima,项目名称:ceva-finance,代码行数:82,代码来源:church.controller.php


注:本文中的ListView::build方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。