Skip to content
forked from firstrow/yiiadmin

Automatic admin interface for Yii Framework. It reads your model to provide a interface that you can immediately use to start adding content to the site.

Notifications You must be signed in to change notification settings

Nafania/yiiadmin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Instalation

  • Clone this repo in protected/modules/yiiadmin.(git clone [email protected]:firstrow/yiiadmin.git)
  • Edit yii main config file protected/config/main.php.
    Enable yiimodule, set password and enter models you want to manage.
        <pre>
        'modules'=>array(
         ...
            'yiiadmin'=>array(
                'password'=>'YOU PASS HERE',
                'registerModels'=>array(
                    //'application.models.Contests',
                    //'application.models.BlogPosts',
                    //'application.models.*',
                ),
                //'excludeModels'=>array(),
            ),
        ),
        ...
        </pre>
    
    </li>
    <li>Open in browser http://your-project/index.php/yiiadmin and enter your password.</li>
    

Example model config from my testing project:

    // ./application/models/Contests.php
    // Contests model file

    // Model plural names
    public $adminName='Contests'; // will be displayed in main list
    public $pluralNames=array('Contest','Contests');   

    // Config for attribute widgets
    public function attributeWidgets()
    {
        return array(
            array('proffesion_id', 'dropDownList'), // For choices create variable name proffesion_idChoices
            array('date_start','calendar', 'language'=>'ru','options'=>array('dateFormat'=>'yy-mm-dd')),
            array('date_stop','calendar'),
            array('active','boolean'),
        );
    }

    // Config for CGridView class
    public function adminSearch()
    {
        return array(
                // Data provider, by default is "search()"
                //'dataProvider'=>$this->search(),
                'columns'=>array(
                'id',
                'name',
                'date_start',
                'date_stop',
                array(
                    'name'=>'active',
                    'value'=>'$data->active==1 ? CHtml::encode("Yes") : CHtml::encode("No")',
                    'filter'=>array(1=>'Да',0=>'Нет'),
                ),
                array(
                    'name'=>'proffesion_id',
                    'value'=>'User_profile::getProfName($data->proffesion_id)',
                    'filter'=>$this->proffesion_idChoices,
                ),
            ),
        );
    }

About

Automatic admin interface for Yii Framework. It reads your model to provide a interface that you can immediately use to start adding content to the site.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 81.6%
  • JavaScript 18.4%