コード例 #1
0
ファイル: userHelper.php プロジェクト: pwstrick/grape
/**
 * lists页面的view代码
 */
function lists_view($filter, $email_value, $begin_value, $rows, $page_html)
{
    //目前是写死的,到时候应该是在controller中将逻辑写好,在view层与页面控件结合
    $group1 = matrix_a_btn(array('href' => '#', 'text' => '未完成(100)'), 'info', '');
    $group2 = matrix_a_btn(array('href' => '#', 'text' => '已完成(2)'), 'info', '');
    $group3 = matrix_a_btn(array('href' => '#', 'text' => '已退货(21)'), 'info', 'active');
    $btn_groups = array(array($group1, $group2, $group3));
    //超链接按钮
    $buttons = array(matrix_a_btn(array('href' => base_url('user/add'), 'text' => '添加用户')));
    //过滤条件
    $options = array(0 => '包含', 1 => '等于', 2 => '开头', 3 => '完与');
    $select = form_dropdown('filter', $options, $filter);
    //单选下拉框
    $select = matrix_select($select, true);
    $email_attr = quick_input_attr('email', 'span3', '请输入邮箱');
    $email = form_input($email_attr, $email_value);
    $begin_attr = quick_input_attr('begin', 'span2', '开始注册时间');
    $begin = my97DatePicker($begin_attr, $begin_value);
    $inputs = array(array($select, $email), array($begin));
    //table列表
    //设置表头 排序的icon可以根据逻辑做修改 这里是写死的
    $ths = array(table_th(form_checkbox(), '5%'), table_th(table_a('#', '<i class="icon-sort"></i>邮箱'), '35%'), table_th(table_a('#', '<i class="icon-caret-down"></i>角色'), '20%'), table_th('上次登录时间', '20%'), table_th('操作', '20%'));
    $trs = array();
    foreach ($rows as $key => $row) {
        $a1 = table_a(base_url('user/add', array('id' => $row['id'])), '查看');
        $attrs = array('data-id' => $row['id'], 'data-name' => "xx", 'class' => 'warning', 'data-href' => base_url('user/add'), 'data-prompt' => '您确定这个订单吗?');
        $a2 = table_a_btn($attrs, '删除');
        $tds = array(table_format_td(form_checkbox()), table_format_td($row['email']), table_format_td(matrix_badge(array('text' => $row['role']))), table_format_td($row['time']), table_format_td($a1 . $a2));
        $trs[] = table_format_tr($tds, array('data-sort' => $key, 'data-id' => $row['id']));
    }
    $table_attrs = array('data-type' => 'dragsort', 'data-ajax' => 'ajax/sort.php', 'data-td' => $row['id']);
    $table = table_format($ths, $trs, $page_html, $table_attrs);
    return query_form($inputs, $buttons, $btn_groups) . $table;
}
コード例 #2
0
ファイル: systemHelper.php プロジェクト: pwstrick/grape
/**
 * grouplist页面的view代码
 */
function grouplist_view($rows)
{
    //超链接按钮
    $buttons = array(matrix_a_btn(array('href' => base_url('system/grouplistadd'), 'text' => '添加分组')));
    //table列表
    //设置表头 排序的icon可以根据逻辑做修改 这里是写死的
    $ths = array(table_th('编号', '20%'), table_th('分组', '40%'), table_th('操作', '40%'));
    $trs = array();
    foreach ($rows as $key => $row) {
        $a1 = table_a(base_url('system/grouplistadd', array('id' => $row['group_id'])), '修改');
        $attrs = array('data-id' => $row['group_id'], 'data-reload' => 'true', 'data-href' => base_url('system/grouplistdel'), 'data-prompt' => '您确定关闭此分组吗?', 'class' => 'warning');
        $a2 = table_a_btn($attrs, '关闭分组');
        $tds = array(table_format_td($row['group_id']), table_format_td($row['group_name']), table_format_td($a1 . $a2));
        $trs[] = table_format_tr($tds);
    }
    $table = table_format($ths, $trs);
    return query_form(array(), $buttons) . $table;
}