1、必填项的翻译。
<?php echo Yum::requiredFieldNote(); ?>
2、文本翻译链接:r=user/translation/admin
3、服务器数据库密码:
4、导入其他model、类 : Yii::import('application.modules.friendship.models.YumFriendship');
5、获得当前用户Id : $id = Yii::app()->user->id;
6、菜单权限设置 $this->menu=array(
array('label'=>Yum::t('List Events'), 'url'=>array('index'),'visible'=>Yii::app()->user->isAdmin())
}
判断是否为管理员:,'visible'=>Yii::app()->user->isAdmin()
7、提示:Yum::setFlash(Yum::t('Apply course seccessfully'));
8、显示flash提示:Yum::renderFlash();[模板文件中添加]
9、<?php echo Yum::t('Fields with <span class="required">*</span> are required.');?>
带<span class="required">*</span>号为必填项.
10、<?php echo Yum::t('Create Courses');?>
11、 <?php
$Schools = Schools::model()->findByPk($data->school_id)->attributes;
echo CHtml::encode($Schools['name']); ?>
12、获得外键值:A: _view ($data 数据):$data->school->name。 B: view: 'school.name'
【array(
'header' => Yum::t('Schools'),
'name' => 'school_id',
'value' => '$data->school->name'),】
13、添加必填项:在 model 中,rule方法里面写 : array('course_name, school_id', 'required'),
14、YumUser::School_Creator()
15、 判断权限: ,'visible'=>Yii::app()->user->checkPermission('')
16 支持瞄点: CHtml::link('链接文字',array('article/view','id'=>'3','#'=>'锚名称');
17、输出提示信息 echo Yum::renderFlash();
18、连接查询:MemberRoles::model()->with('members')->findAll('members.user_id =1');
19、获取当前学校ID
Yii::app()->user->getCurrentSchool();
设置当前学校ID
Yii::app()->user->setCurrentSchool($schoo_id);
$_SESSION['Current_School_ID'];
20、写权限。protected/runtime/permission.php
Yii::app()->user->writePermission()