2017 © Pedro PelĂĄez
 

library gii-template-collection

Gii Template Collection, Model and CRUD templates with Boostrap UI

image

phundament/gii-template-collection

Gii Template Collection, Model and CRUD templates with Boostrap UI

  • Wednesday, January 13, 2016
  • by schmunk
  • Repository
  • 11 Watchers
  • 52 Stars
  • 748 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 23 Forks
  • 20 Open issues
  • 38 Versions
  • 0 % Grown

The README.md

gii-template-collection

Fork on github, (*1)

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

For a Yii 2 port of this project, please visit giiant., (*3)

NOTE! Relation widgets moved to https://github.com/schmunk42/yii-relation, (*4)

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, (*5)

singlefile

Standard Model Class Model, (*6)

FullCrud

slim

Bootstrap UI with relations, (*7)

hybrid

Bootstrap UI with relations and grids, (*8)

slim_editable

Screenshots:, (*9)

FullCrud Slim Editable List, (*10)

FullCrud Slim Editable List, (*11)

legacy

Original gtc CRUDs, (*12)

Requirements

  • PHP 5.3 and short_open_tags = On

Notes

Installation

Get it via composer:, (*13)

composer.phar require phundament/gii-template-collection

or, (*14)

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

Setup

  1. Configure the templates in the generatorPaths section of the gii configuration inside your application configuration:, (*16)

    '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., (*17)

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

    // 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, (*19)

    '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, (*20)

AuthItems

Controller actions and UI buttons follow these checkAccess rules:, (*21)

  • 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., (*22)

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

Template slim

Requirements: https://github.com/clevertech/yiibooster, schmunk42/yii-relation, (*24)

Template slim editable

Requirements: - https://github.com/clevertech/yiibooster, - schmunk42/yii-relation, - x-editable-yii - php composer.phar require dbrisinajumi/x-editable-yii dev-german-translations, (*25)

Template hybrid

An enhanced hybrid between the default/slim templates and the bootstrap crud generator., (*26)

Requires x-editable-yii dev and echosen., (*27)

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.:, (*28)

$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., (*29)

Example

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

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., (*31)

  • 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, (*32)

Known Problems and Limitations

  • gtc does not support composite primary keys

Resources

History

This project has been originally created by thyseus back in 2010., (*33)

To quote from the original project page:, (*34)

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

In 2011 schmunk create the currently active fork of the project from revision 186 of the Google Code repository., (*36)

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

Contributors

Active maintainers are written in bold., (*38)

Contact

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

The Versions

13/01 2016

dev-develop

dev-develop http://phundament.com/

Gii Template Collection, Model and CRUD templates with Boostrap UI

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

package dependency autoload

24/06 2014

dev-master

9999999-dev http://phundament.com/

Gii Template Collection, Model and CRUD templates with Boostrap UI

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

package dependency autoload

24/06 2014

0.13.0-beta1

0.13.0.0-beta1 http://phundament.com/

Gii Template Collection, Model and CRUD templates with Boostrap UI

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

package dependency autoload

12/03 2014

dev-yiistrap-bs3

dev-yiistrap-bs3 http://phundament.com/

Gii Template Collection, Model and CRUD templates with Boostrap UI

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

package dependency autoload

21/09 2013

0.12.6

0.12.6.0 http://phundament.com/

Gii Template Collection, Model and CRUD templates with Boostrap UI

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

package dependency autoload

10/09 2013

dev-release

dev-release http://phundament.com/

Gii Template Collection, Model and CRUD templates with Boostrap UI

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

package dependency autoload

07/09 2013

dev-restore-hybrid-template

dev-restore-hybrid-template http://phundament.com/

Gii Template Collection, Model and CRUD templates with Boostrap UI

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

package dependency autoload

23/08 2013

0.12.5

0.12.5.0 http://phundament.com/

Gii Template Collection, Model and CRUD templates with Boostrap UI

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

package dependency autoload

22/08 2013

0.12.4

0.12.4.0 http://phundament.com/

Gii Template Collection, Model and CRUD templates with Boostrap UI

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

package dependency autoload

21/08 2013

0.12.3

0.12.3.0 http://phundament.com/

Gii Template Collection, Model and CRUD templates with Boostrap UI

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

package dependency autoload

19/08 2013

0.12.2

0.12.2.0 http://phundament.com/

Gii Template Collection, Model and CRUD templates with Boostrap UI

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

package dependency autoload

17/08 2013

0.12.1

0.12.1.0 http://phundament.com/

Gii Template Collection, Model and CRUD templates with Boostrap UI

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

package dependency autoload

15/08 2013

0.12.0

0.12.0.0 http://phundament.com/

Gii Template Collection, Model and CRUD templates with Boostrap UI

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.3.0

 

package dependency autoload

01/08 2013

0.11.0

0.11.0.0 http://phundament.com/

Gii Template Collection, Model and CRUD templates with Boostrap UI

  Sources   Download

BSD

The Requires

  • php >=5.3.0

 

package dependency autoload

29/07 2013

dev-hybrid

dev-hybrid http://phundament.com/

Gii Template Collection, Model and CRUD templates with Boostrap UI

  Sources   Download

BSD

The Requires

  • php >=5.3.0

 

package dependency autoload

29/07 2013

dev-master-before-back-to-the-roots

dev-master-before-back-to-the-roots http://phundament.com/

Gii Template Collection, Model and CRUD templates with Boostrap UI

  Sources   Download

BSD

The Requires

  • php >=5.3.0

 

package dependency autoload

13/07 2013

0.10.1

0.10.1.0 http://phundament.com/

Gii Template Collection, Model and CRUD templates with Boostrap UI

  Sources   Download

BSD

The Requires

  • php >=5.3.0

 

package dependency autoload

10/07 2013

0.10.0

0.10.0.0 http://phundament.com/

Gii Template Collection, Model and CRUD templates with Boostrap UI

  Sources   Download

BSD

The Requires

  • php >=5.3.0

 

package dependency autoload

27/06 2013

0.9.0

0.9.0.0 http://phundament.com/

Gii Template Collection, Model and CRUD templates with Boostrap UI

  Sources   Download

BSD

The Requires

  • php >=5.3.0

 

package dependency autoload

28/05 2013

0.8.11

0.8.11.0 http://phundament.com/

Gii Template Collection

  Sources   Download

BSD

The Requires

  • php >=5.3.0
  • crisu83/yii-bootstrap 1.*
  • vitalets/yii-bootstrap-editable @dev
  • ifdattic/echosen @dev

 

package dependency autoload

15/05 2013

0.8.10

0.8.10.0 http://phundament.com/

Gii Template Collection

  Sources   Download

BSD

The Requires

  • php >=5.3.0
  • crisu83/yii-bootstrap 1.*
  • vitalets/yii-bootstrap-editable @dev
  • ifdattic/echosen @dev

 

package dependency autoload

12/05 2013

0.8.9

0.8.9.0 http://phundament.com/

Gii Template Collection

  Sources   Download

BSD

The Requires

  • php >=5.3.0
  • crisu83/yii-bootstrap 1.*
  • vitalets/yii-bootstrap-editable @dev
  • ifdattic/echosen @dev

 

package dependency autoload

12/04 2013

0.8.8

0.8.8.0 http://phundament.com/

Gii Template Collection

  Sources   Download

BSD

The Requires

  • php >=5.3.0
  • crisu83/yii-bootstrap 1.*
  • vitalets/yii-bootstrap-editable @dev
  • ifdattic/echosen @dev

 

package dependency autoload

12/04 2013

0.8.7

0.8.7.0 http://phundament.com/

Gii Template Collection

  Sources   Download

BSD

The Requires

  • php >=5.3.0
  • crisu83/yii-bootstrap 1.*
  • vitalets/yii-bootstrap-editable @dev
  • ifdattic/echosen @dev

 

package dependency autoload

11/03 2013

0.8.6

0.8.6.0 http://phundament.com/

Gii Template Collection

  Sources   Download

BSD

The Requires

  • php >=5.3.0
  • crisu83/yii-bootstrap 1.*
  • vitalets/yii-bootstrap-editable @dev
  • ifdattic/echosen @dev

 

package dependency autoload

11/03 2013

0.8.5

0.8.5.0 http://phundament.com/

Gii Template Collection

  Sources   Download

BSD

The Requires

  • php >=5.3.0
  • crisu83/yii-bootstrap 1.*
  • vitalets/yii-bootstrap-editable @dev
  • ifdattic/echosen @dev

 

package dependency autoload

26/02 2013

0.8.4

0.8.4.0 http://phundament.com/

Gii Template Collection

  Sources   Download

BSD

The Requires

  • php >=5.3.0
  • crisu83/yii-bootstrap 1.*
  • vitalets/yii-bootstrap-editable @dev
  • ifdattic/echosen @dev

 

package dependency autoload

14/02 2013

0.8.3

0.8.3.0 http://phundament.com/

Gii Template Collection

  Sources   Download

BSD

The Requires

  • php >=5.3.0
  • crisu83/yii-bootstrap 1.*
  • vitalets/yii-bootstrap-editable @dev
  • ifdattic/echosen @dev

 

package dependency autoload

05/02 2013

0.8.2

0.8.2.0 http://phundament.com/

Gii Template Collection

  Sources   Download

BSD

The Requires

  • php >=5.3.0
  • crisu83/yii-bootstrap 1.*
  • ifdattic/echosen @dev

 

package dependency autoload

04/02 2013

0.8.1

0.8.1.0 http://phundament.com/

Gii Template Collection

  Sources   Download

BSD

The Requires

  • php >=5.3.0
  • crisu83/yii-bootstap 1.*
  • ifdattic/echosen @dev

 

package dependency autoload

31/01 2013

0.8.0

0.8.0.0 http://phundament.com/

Gii Template Collection

  Sources   Download

BSD

The Requires

  • php >=5.3.0

 

package dependency autoload

30/01 2013

0.7.6

0.7.6.0 http://phundament.com/

Gii Template Collection

  Sources   Download

BSD

The Requires

  • php >=5.3.0

 

package dependency autoload

30/01 2013

0.7.5

0.7.5.0 http://phundament.com/

Gii Template Collection

  Sources   Download

BSD

The Requires

  • php >=5.3.0

 

package dependency autoload

20/11 2012

0.7.4

0.7.4.0 http://phundament.com/

Gii Template Collection

  Sources   Download

BSD

The Requires

  • php >=5.3.0

 

package dependency autoload

15/11 2012

0.7.3

0.7.3.0 http://phundament.com/

Gii Template Collection

  Sources   Download

BSD

The Requires

  • php >=5.3.0

 

package dependency autoload

15/11 2012

0.7.2

0.7.2.0 http://phundament.com/

Gii Template Collection

  Sources   Download

BSD

The Requires

  • php >=5.3.0

 

package dependency autoload

22/10 2012

0.7.1

0.7.1.0 http://phundament.com/

Gii Template Collection

  Sources   Download

BSD

The Requires

  • php >=5.3.0

 

package dependency autoload

10/10 2012

0.7.0

0.7.0.0 http://phundament.com/

Gii Template Collection

  Sources   Download

BSD

The Requires

  • php >=5.3.0

 

package dependency autoload