dbrisinajumi/gii-template-collection 问题修复 & 功能扩展

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

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

dbrisinajumi/gii-template-collection

Composer 安装命令:

composer require dbrisinajumi/gii-template-collection

包简介

Gii Template Collection, Model and CRUD templates with Boostrap UI

README 文档

README

Fork on github

The gii-template-collection (gtc) contains templates for the Yii Framework Gii module.

For a Yii 2 port of this project, please visit giiant.

Features

  • relation handling
  • YiiBooster integration
  • giic prove
  • customize inputs with code-providers, detect input-type by model and column
    • date and time pickers
    • checkboxes
    • relation widgets
    • editable grid columns
    • partial views
    • enum fields
  • multi languages

Templates

FullModule

FullModel

default

Model Classes in two files BaseModel, Model

singlefile

Standard Model Class Model

FullCrud

Note: Relation widgets moved to https://github.com/schmunk42/yii-relation

slim

Bootstrap UI with relations

hybrid

Bootstrap UI with relations and grids

slim_editable

Screenshots:

FullCrud Slim Editable List

FullCrud Slim Editable List

legacy

Original gtc CRUDs

Requirements

  • PHP 5.3 and short_open_tags = On

Notes

Installation

Get it via composer:

composer.phar require phundament/gii-template-collection

or

Download latest release To use it, simply extract the content of the archive into your application extensions/ directory.

Setup

  1. Configure the templates in the generatorPaths section of the gii configuration inside your application configuration:

    'gii'=>array(
        'class'=>'system.gii.GiiModule',
        'password'=>'<your gii password>',
        'generatorPaths'=>array(
            'vendor.phundament.gii-template-collection',   
        ),
    ),
    

    After that, the new generators of gtc should be available in your Gii index page.

  2. The last step is to add some gtc components to your import path so they can be found by the application:

     // autoloading model and component classes
     'import'=>array(
     	// relation widget and save behavior
     	'vendor.phundament.gii-template-collection.components.*', 
     ),
    
  3. For Debugging Information plz add the log under yours config console

    'components' => array(
        'log'      => array(
            'class'  => 'CLogRouter',
            'routes' => array(
                // file logging
                array(
                    'class'   => 'CFileLogRoute',
                    'logFile' => 'console.log',
                    'levels'  => 'error, warning, info, trace',
                    'enabled' => true,
                ),
            ),
        ),
    ),
    

Usage

Full Module

  • open Gii
  • select FullModule
  • enter Module ID
  • click preview
  • click generate

Full Model

  • open Gii
  • select FullModel
  • enter model class
  • click preview
  • click generate

Full CRUD

Note: Generated templates require clevertech/yiibooster >=1.1.1 Note: slim_editable require vitalets/x-editable-yii dev

  • open Gii
  • select FullCrud
  • enter model class
  • click preview
  • click generate

AuthItems

Controller actions and UI buttons follow these checkAccess rules:

  • Controller.*
  • Controller.View
  • Controller.Delete
  • ...

From 0.13.0 on the a Controller.SimpleUi item was added by default, which hides UI elements, when this item is assigned to the current user.

Note: An admin (superuser) always sees the full UI.

Template slim

Requirements: https://github.com/clevertech/yiibooster, schmunk42/yii-relation

Template slim editable

Requirements:

  • https://github.com/clevertech/yiibooster,
  • schmunk42/yii-relation,
  • x-editable-yii
    • php composer.phar require vitalets/x-editable-yii dev-master
    • in config add to aliases vendor.vitalets.x-editable-yii

Template hybrid

An enhanced hybrid between the default/slim templates and the bootstrap crud generator.

Requires x-editable-yii dev and echosen.

Development

Code Providers

The FullCrudCode is able to access providers from a provider-queue to render fields, labels, etc. You can call a provider from your template with, eg.:

$this->provider()->generateColumn($this->modelClass, $column)

FullCrudCode will walk the provider queue until it finds a provider which has the requested method AND which returns not null. This is on of the major differences compared to a behavior.

Example

Render a populated dropdown, if the model contains and optsColumnName() method.

public function generateActiveField($model, $column)
{
    $func = "opts".str_replace("_","",$column->name);
    if (method_exists($model, $func)) {
        return "echo \$form->dropDownList(\$model,'{$column->name}',{$model}::{$func}());";
    }
}

Coding Standards

GTC is using <?=""?> Bobsled Coding Style.

  • Write PHP code to be generated wrapped in short-open-echo tags and double quotes
<?=
"<?php 
    ...code... 
?>"
?>
  • Use bobsled only for generating PHP code (in the gtc templates), DO NOT use short open tags in outputted code (yet)
  • Use brackets {} to insert variables for generated code
  • Use a provider to generate fields, labels, relations and columns.
  • Follow guidelines for-good schema design from the Yii Wiki
  • Use a UNIQUE index over both of your foreign keys in your MANY_MANY tables

Examples

tbd

Known Problems and Limitations

  • gtc does not support composite primary keys

Resources

Links

History

This project has been originally created by thyseus back in 2010.

To quote from the original project page:

Please enjoy this extension and let us collect as many Templates as possible for other people to enjoy. (haml, smarty, dwoo, twig, ...)

In 2011 schmunk create the currently active fork of the project from revision 186 of the Google Code repository.

While there has been much, much, much, … code added over the time. At the end of July 2013 gtc was completely refurbished.

Contributors

Active maintainers are written in bold.

Contact

Of course, any templates are appreciated and just leave a comment or mail: schmunk@usrbin.de, fredrik@neam.se or thyseus@gmail.com.

dbrisinajumi/gii-template-collection 适用场景与选型建议

dbrisinajumi/gii-template-collection 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 132 次下载、GitHub Stars 达 0, 最近一次更新时间为 2014 年 05 月 29 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「package」 「dependency」 「autoload」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 dbrisinajumi/gii-template-collection 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 dbrisinajumi/gii-template-collection 我们能提供哪些服务?
定制开发 / 二次开发

基于 dbrisinajumi/gii-template-collection 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 4
  • Forks: 19
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2014-05-29