shemgp/ssp 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

shemgp/ssp

Composer 安装命令:

composer require shemgp/ssp

包简介

Datatables SSP class for PHP server side scripting for PostgreSQL

README 文档

README

Datatables SSP class for server side scripting for PostgreSQL (uses ILIKE)

Extra features

  • May have columns for actions which are not in the database (eg. @actions) that can be used to display actions. The name should start with @.

Sample code using Slim with slim_plates

<?php
$crud = [
    'table_name' => 'students',
    'fields' => [
        'first' => 'text',
        'middle' => 'text',
        'last' => 'text',
        'bday' => 'date',
        'gender' => 'text'
    ]
];

$app->get('/'.$crud['table_name'].'/list', function ($request, $response, $args) use ($crud) {
    $columns = [];
    $count = 0;
    foreach($crud['fields'] as $field => $data_type)
    {
        $column = ['db' => $field, 'dt' => $count++];
        if ($data_type == 'date')
            $column['formatter'] = function( $d, $row ) {
                return date( 'F d, Y', strtotime($d));
            };
        else if ($data_type == 'number')
            $column['formatter'] = function( $d, $row ) {
                return '$'.number_format($d);
            };
        $columns[] = $column;
    }
    $columns[] = ['db' => 'id', 'dt' => $count++];
    $columns[] = [
            'db' => '@actions',
            'dt' => $count++,
            'formatter' => function ($d, $row ) use ($crud) {
                return '<div class="btn-group btn-group-sm">
                <a href="'.$this->router->pathFor($crud['table_name'].'.update', ['id'=>$row['id']]).'" class="btn btn-info btn-sm"><i class="fa fa-edit"></i></a>
                <form action="'.$this->router->pathFor($crud['table_name'].'.delete', ['id'=>':id']).'" method="POST">
                    <button class="btn btn-danger btn-sm delete-item" onclick="return confirm(\'Are you sure?\')">
                        <i class="fa fa-trash"></i>
                    </button>
                </form>
                </div>';
            }
        ];
    $ssp = DataTable\SSP::simple($request->getParams(), $this->db, $crud['table_name'], 'id', $columns);
    return json_encode($ssp);
})->setName($crud['table_name'].'.list.json');

统计信息

  • 总下载量: 100
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-03-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固