Skip to content

Commit 87ec929

Browse files
committed
Renamed README to README.md
1 parent c75822c commit 87ec929

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

README.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<h3>Instalation</h3>
2+
<ul>
3+
<li>Clone this repo in protected/modules/yiiadmin.(git clone [email protected]:firstrow/yiiadmin.git)</li>
4+
<li>
5+
Edit yii main config file protected/config/main.php.
6+
<br/>Enable yiimodule, set password and enter models you want to manage.
7+
8+
<pre>
9+
'modules'=>array(
10+
...
11+
'yiiadmin'=>array(
12+
'password'=>'YOU PASS HERE',
13+
'registerModels'=>array(
14+
//'application.models.Contests',
15+
//'application.models.BlogPosts',
16+
//'application.models.*',
17+
),
18+
//'excludeModels'=>array(),
19+
),
20+
),
21+
...
22+
</pre>
23+
24+
</li>
25+
<li>Open in browser http://your-project/index.php/yiiadmin and enter your password.</li>
26+
</ul>
27+
28+
Example model config from my testing project:
29+
<pre>
30+
// ./application/models/Contests.php
31+
// Contests model file
32+
33+
// Model plural names
34+
public $adminName='Contests'; // will be displayed in main list
35+
public $pluralNames=array('Contest','Contests');
36+
37+
// Config for attribute widgets
38+
public function attributeWidgets()
39+
{
40+
return array(
41+
array('proffesion_id', 'dropDownList'), // For choices create variable name proffesion_idChoices
42+
array('date_start','calendar', 'language'=>'ru','options'=>array('dateFormat'=>'yy-mm-dd')),
43+
array('date_stop','calendar'),
44+
array('active','boolean'),
45+
);
46+
}
47+
48+
// Config for CGridView class
49+
public function adminSearch()
50+
{
51+
return array(
52+
// Data provider, by default is "search()"
53+
//'dataProvider'=>$this->search(),
54+
'columns'=>array(
55+
'id',
56+
'name',
57+
'date_start',
58+
'date_stop',
59+
array(
60+
'name'=>'active',
61+
'value'=>'$data->active==1 ? CHtml::encode("Yes") : CHtml::encode("No")',
62+
'filter'=>array(1=>'Да',0=>'Нет'),
63+
),
64+
array(
65+
'name'=>'proffesion_id',
66+
'value'=>'User_profile::getProfName($data->proffesion_id)',
67+
'filter'=>$this->proffesion_idChoices,
68+
),
69+
),
70+
);
71+
}
72+
</pre>

0 commit comments

Comments
 (0)