有谁知道如何在Yii模型中应用规则输入必须大于0值,没有任何自定义方法..
喜欢 :
public function rules()
{
return array(
....
....
array('SalePrice', 'required', "on"=>"sale"),
....
....
);
}
Run Code Online (Sandbox Code Playgroud)
非常感谢 ..
我正在使用activecollab自定义模块的权限,并且在尝试调用静态方法的函数时收到此错误消息,但不知道为什么;请帮忙,真的很讨人喜欢..
Parse error: parse error, expecting `T_PAAMAYIM_NEKUDOTAYIM' in D:\wamp\www\activecollab\public\activecollab\3.0.9\modules\projectcomrequest\models\Projectcomrequests.class.php on line 130
Run Code Online (Sandbox Code Playgroud)
我在模型文件中执行的代码是:
class Projectrequests extends DataManager {
...
....
function getPermissionValue($name){
$roles = Roles::find();
foreach($roles as $role) {
if($role->getPermissionValue($name))
return true;
else
return false;
}
static function canAccess() {
if(self::getPermissionValue('can_use_project_request')) return true;
return false;
} // canAccess
...
..
}
Run Code Online (Sandbox Code Playgroud)
以此调用控制器:
echo Projectrequests::canAccess();
Run Code Online (Sandbox Code Playgroud) 我在Yii中使用CGridView,如何在2行中显示单个记录?
基本上我想在第一行表格中显示记录详细信息,在其他行上我想显示其摘要,我尝试使用div和css但是无法获得正确的结果,是否有人可以在这种情况下帮助我?
我这样使用:
<?php
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'bidding-grid',
'itemsCssClass' => 'data-default',
'dataProvider'=>$model,
'summaryText' => '',
'columns'=>array(
'people_detail_for_bid.Person' => array(
'type'=>'raw',
'name'=>'people_detail_for_bid.Person',
'value'=>'Yii::app()->Controller->createUserNameLink($data->people_detail_for_bid->PeopleFirstName." ".$data->people_detail_for_bid->PeopleLastName, $data->people_detail_for_bid->PeopleId).
"<br><span class=decriptionText>".$data->people_detail_for_bid->PeopleDesignation."</span>".
"<br><span class=decriptionText>".$data->people_detail_for_bid->PeopleEmail."</span>"',
'htmlOptions'=>array('width'=>200),
),
'timeAgo' => array(
'type'=>'raw',
'name'=>'timeAgo',
'value'=>'"<span class=decriptionText>".Yii::app()->Controller->_ago($data->PBPostedOn)."</sapn>"',
'htmlOptions'=>array('width'=>150),
),
),
));
?>
Run Code Online (Sandbox Code Playgroud) yii ×2
activecollab ×1
controller ×1
frameworks ×1
model ×1
module ×1
permissions ×1
php ×1
validation ×1