gii-template-collection
Code templates for Yii 1.1 Framework
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:
legacy
Original gtc CRUDs
Requirements
- PHP 5.3 and
short_open_tags = On
Notes
- repo uses git-flow naming conventions
- repo follows the guidelines of semantic versioning
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
-
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.
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.*', ),
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 requirevitalets/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 aController.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
andechosen
.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 yourMANY_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
- Alban Jubert [email protected]
- Anne Datema
- Fredrik Wollsén [email protected]
- Herbert Maschke [email protected] (original creator)
- Igor Santos
- Tobias Munk [email protected]
- Uldis Nelsons [email protected]
- [email protected]
- robregonm [email protected]
- sealtrip
- thyseus
Active maintainers are written in bold.
Contact
Of course, any templates are appreciated and just leave a comment or mail: [email protected], [email protected] or [email protected].
gii-template-collection's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.