The AutoAdmin is a "CMS framework". It's a perfect solution for web projects with free designed databases. It really does for portals as well as for "turnkey websites". Easy-to-Learn and easy-to-use.
The AutoAdmin includes built-in module to provide shared access to interfaces with different rights.
PHP 5.3, Yii 1.1x
The extension uses PDO interfaces and was tested on MySQL and PostgreSQL databases.
You may download the special exemplary pack which is a very good solution for quick start. It contains full directories structure, configs, controllers and SQL dump.
Note: There are several enhancements in version 1.1 that have simplified setup process. So for setup of previous versions see an appropriate ReadMe.
There are only two steps to install the AutoAdmin extension:
Set necessary parameters:
//In this example we read the main config. //Note if you use a fully separate config just set appropriate sections in the returning array. $main = require(dirname(__FILE__).'/main.php'); $main['modules'] = array( 'autoadmin'=>array( 'class'=>'ext.autoAdmin.AutoAdmin', 'basePath' => dirname(__FILE__).'/../modules/autoadmin', 'wwwDirName' => 'www', //your DocumentRoot ), ); //... $main['components'] = array( 'urlManager' => array( //... 'rules'=>array( //Module paths should be configured in a standart way '/<module:autoadmin>' => 'autoadmin/default/index', '/<module:autoadmin>/<controller:\w+>' => 'autoadmin/<controller>/index', '/<module:autoadmin>/<controller:\w+>/<action:\w+>' => 'autoadmin/<controller>/<action>', ) //...
After all, your common AutoAdmin file structure should be something like this (recommended case):
- protected/ - - ... - - extensions/ - - - ... - - - autoAdmin/ - - - - assets/ - - - - controllers/ - - - - helpers/ - - - - messages/ - - - - models/ - - - - schemas/ - - - - views/ - - - - AutoAdmin.php - - - - AutoAdminAccess.php - - - - AutoAdminIExtension.php - - - - LICENSE - - - - ReadMe.md - - ... - - modules/ - - - ... - - - autoadmin/ - - - - controllers/ - - - - models/ - - - - views/ - www/ - - ...
Optionally you can use the built-in AutoAdmin's shared access system.
Firstly import SQL dump which you can find in [autoAdmin/schemas] of the distributive directory. It's recommended to do it in a separate database (if you have such a possibility).
Add this params to the config:
$main['modules'] = array( 'autoadmin'=>array( //... 'authMode' => true, //Switch on authorization system 'openMode' => true, //Use for temporary switching off all access limitations 'logMode' => false, //Switch log mode ), );
Create a dedicated user for service DB (imported from distributive dump) and grant him appropriate access rights. If you use the only, common DB, just clone settings from a primary connection to "dbAdmin".
$main['components'] = array( //... 'db' => array( 'class'=>'CDbConnection', 'connectionString' => 'mysql:host=localhost;dbname=yourdb', 'username' => 'yourlogin_that_can_edit', 'password' => 'freepussyriot', 'charset' => 'utf8', //... ), 'dbAdmin' => array( 'class'=>'CDbConnection', 'connectionString' => 'mysql:host=localhost;dbname=yourdb_autoadmin', 'username' => 'yourlogin_aa', 'password' => 'freepussyriot', 'charset' => 'utf8', //... ), //...
If you use different DB schemes, you may configure them using special params:
$main['modules'] = array( 'autoadmin'=>array( //... 'dbSchema' => 'public', 'dbAdminSchema' => 'autoadmin', ), );
At first time you enter AutoAdmin you'll be forwarded to the special form to create root (and other) users.
Create actions (AutoAdmin interfaces) and only then grant personal rights to users on them. Use the link in the right bottom corner:


You may try real working AutoAdmin CMS here. In this "showroom" you'll find several good examples of interfaces with source PHP and SQL code.
Let's suppose you have the SQL table:

Then your AutoAdmin action would be like this:
class SportController extends Controller { public function actionContinents() { $this->module->tableName('continents'); $this->module->setPK('id'); $this->module->fieldsConf(array( array('name_en', 'string', 'Continent', array('show')), )); $this->module->setSubHref('countries'); $this->module->sortDefault(array('name_en')); $this->module->process(); } public function actionCountries() { $this->module->tableName('countries'); $this->module->setPK('id'); $this->module->fieldsConf(array( array('flag_ico', 'image', 'Flag', array('show', 'directoryPath'=>'/i/flags')), array('flag', 'image', 'Flag', array('directoryPath'=>'/i/flags/120', 'description'=>'120x80 px')), array('name_en', 'string', 'Country name', array('show')), array('continent_id', 'foreign', 'Continent', array('bindBy'=>'id', 'foreign'=>array( 'table' => 'continents', 'pk' => 'id', 'select' => array('name_en'), 'order' => 'name_en', ))), )); $this->module->sortDefault(array('name_en')); $this->module->process(); } }


public function actionTeams() { $this->module->tableName('teams'); //SQL table name $this->module->setPK('id'); //Primary key name (use an array for composite keys) $this->module->fieldsConf(array( // SQL field name; Field type; Field Label; Options array('name_en', 'string', 'Team name', array('show', 'search')), array('country_id', 'foreign', 'Country', array( 'show', //Show in List mode 'search', //User is allowed to search by this field 'bindBy'=>'id', //Country is fixed by previous interface. Set that field. 'foreign'=>array( //Foreign key options 'table' => 'countries', //Table which it belongs to 'pk' => 'id', //Foreign table's PK 'select' => array('name_en'), //Foreign field to select for listing 'searchBy' => array('name_en'=>'Country name'),//Foreign field to search by 'order' => 'name_en', //Foreign field to order by ) )), array('emblem', 'image', 'Team emblem', array( 'null', //Field can be NULL 'directoryPath'=>'/i/teams/football',//Directory to upload images (web-based) )), array('emblem_sm', 'image', 'Team emblem <small>(small size)</small>', array('show', 'null', 'directoryPath'=>'/i/teams/football/sm')), )); $this->module->sortDefault(array('name_en')); //Default sorting $this->module->rowsOnPage = 20; //Customizing "rows on page" in List mode $this->pageTitle = 'Sports teams'; //Customizing CSS Yii::app()->clientScript->registerCssFile(Yii::app()->request->baseUrl.'/css/sport.css'); //Attaching the custom view that is displaying this information to you. $this->module->setPartialView('teams-up', $area='up'); $this->module->process(); //Initiate main processing }

$this->module->foreignLink('spheres', array( 'label' => 'The spheres of activity', //Iframe title 'show' => true, //Show in List mode 'linkTable' => 'brands_spheres', //Table of links (between many-to-many) 'inKey' => 'brand_id', //In key (for local PK) 'outKey' => array('sphere_id'=>'id'), //Out key (for external PK) 'targetTable' => 'spheres', //External table on the other side of many-to-many 'targetFields' => array('title_en'), //Fields to select for listing ));

Much more examples you can find in the AutoAdmin showroom.
Data fields configurations must be set by passing a special-formatted array as an argument to the AutoAdmin::fieldsConf() function.
$this->module->fieldsConf(array( array([SQL field name], [AutoAdmin field type], [Form label], array([options])), //... ));
To avoid "monkey-coding" you can use the AutoAdmin Code Generator to generate default interfaces (Yii actions) based on SQL tables service info. To use the Generator go to the "/autoadmin/aagenerator/" URL or just click on the link in the right bottom corner of any page. The feature requires the root access level (or disabling the authentication system).

AutoAdmin provides various built-in types. Most of them accept the following standart options:
Classical text strings. Usually used with VARCHAR SQL type.
Additional options
Textareas for HTML-formatted texts. Usually used with TEXT type.
Additional options
Textareas for short texts without complicated formatting. Usually used with TEXT type.
TineMCE visual text editor. Usually used with TEXT type. To use this field you need to download the "TinyMCE jQuery package", then unpack it to [/js/] directory of your DocumentRoot. If you use another JS directory you can set it up in options, as well as documented TinyMCE options (overriding the default ones):
... array('content', 'wysiwig', 'Page content', array('show', 'null', 'directoryPath'=>'/i/articles/', 'subDirectoryPath'=>date('Y-m'), 'tinyMCE'=>array( 'dir'=>'/js/tinymce', 'options'=>array( //Documented TineMCE options which you can override individually 'plugins' => 'pagebreak,style,layer,table,save,advhr,advimage', ), ), )),
Numbers - integer or decimal. Usually used with INTEGER and DECIMAL (NUMERIC, FLOAT etc.) types.
Additional options:
Predefined sets of values. Usually used with ENUM type.
Obligatory options:
..., 'enum'=>array('deg1'=>'I degree', 'deg2'=>'II degree', 'deg3'=>'III degree'), ...
Dates. Usually used with DATE type.
Date and time. Usually used with DATETIME and TIMESTAMP types.
Time. Usually used with TIME type in SQL. Fully supports 'limit' options to restrict lower and upper values.
Boolean checkbox (yes or no). Usually used with BOOLEAN type.
For passwords. Will be hashed.
Additional options:
To upload images. Uses database to store path to file only.
Obligatory options:
Additional options:
..., 'directoryPath'=>'/i/flags/120', 'subDirectoryPath'=>date('Ym'), 'description'=> '120x80px'
To upload files in public areas and give links to them. Uses database to store path to file only.
Obligatory options:
Additional options:
For values from other tables which are linked with the field through a foreign key (you may use virtual connection like as in MyISAM).
Obligatory options: * foreign: Describes one-to-many connections.
..., 'foreign', array( 'table' => 'continents', 'pk' => 'id', //foreign primary key 'select' => array('name_en'), //foreign fields to select 'order' => 'name_en', //foreign fields to order by ), ...
You can manage spatial SQL data in the AutoAdmin after installing the AutoAdminGIS extension. After that the following field types will be accessible: gispoint, gislinestring, gispolygon. For more information see AutoAdminGIS page.
AudoAdmin is an extendable system. Particularly you can create your own field types by programming classes that implement AAIField interface.
You may also inherit built-in field-type classes and modify theirs behavior, add custom options etc.
Complicated content-management tasks may require complex logic custom fields need. In that case you can create a sub-extension for the AutoAdmin. An example of such development is the AutoAdminGIS extension.
English, Russian.
Be the first person to leave a comment
Please login to leave your comment.