本文整理汇总了PHP中ProfileField类的典型用法代码示例。如果您正苦于以下问题:PHP ProfileField类的具体用法?PHP ProfileField怎么用?PHP ProfileField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProfileField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
gateKeeper();
$message = NULL;
$user = getLoggedInUser();
$user->profile_complete = true;
$profile_type = $user->profile_type;
$fields = ProfileField::get($profile_type);
foreach ($fields as $key => $field) {
if ($field['required'] == "true" && !getInput($key)) {
$message .= "{$field['label']} cannot be empty.";
}
}
if ($message) {
new SystemMessage($message);
forward("editProfile");
}
foreach ($fields as $key => $field) {
$user->{$key} = getInput($key);
}
$user->save();
new Activity($user->guid, "activity:profile:updated", array($user->getURL(), $user->full_name));
new SystemMessage("Your profile has been updated.");
forward("profile/{$user->guid}");
}
示例2: findbyPk
/**
* @return $this
*/
public function findbyPk($condition)
{
$primaryKey = ProfileField::primaryKey();
if (isset($primaryKey[0])) {
$condition = [$primaryKey[0] => $condition];
}
return $this->andWhere($condition);
}
示例3: attributeLabels
public function attributeLabels()
{
$labels = array('user_id' => Yii::t("UserModule.user", 'User ID'), 'profile_id' => Yii::t("UserModule.user", 'Profile ID'));
$model = ProfileField::model()->forOwner()->findAll();
foreach ($model as $field) {
$labels[$field->varname] = Yii::t("UserModule.user", $field->title);
}
return $labels;
}
示例4: actionProfile
/**
* Shows a particular model.
*/
public function actionProfile()
{
$model = $this->loadUser();
$attributes = array('username' => array('label' => 'Username', 'value' => $model->username), 'email' => array('label' => 'E-mail', 'value' => $model->email), 'createtime' => array('label' => 'Created at', 'value' => date("d.m.Y H:i:s", $model->createtime)), 'lastvisit' => array('label' => 'Last visited at', 'value' => date("d.m.Y H:i:s", $model->lastvisit)), 'status' => array('label' => 'Status', 'value' => User::itemAlias("UserStatus", $model->status)));
$profileFields = ProfileField::model()->forOwner()->sort()->findAll();
if ($profileFields) {
foreach ($profileFields as $field) {
$attributes[$field->varname] = array('label' => UserModule::t($field->title), 'value' => $model->profile->getAttribute($field->varname));
}
}
$this->render('profile', array('attributes' => $attributes));
}
示例5: actionView
/**
* Displays a particular model.
*/
public function actionView()
{
$model = $this->loadModel();
$attributes = array('id', 'username');
$profileFields = ProfileField::model()->forOwner()->sort()->findAll();
if ($profileFields) {
foreach ($profileFields as $field) {
array_push($attributes, array('label' => UserModule::t($field->title), 'name' => $field->varname, 'type' => 'raw', 'value' => $field->widgetView($model->profile) ? $field->widgetView($model->profile) : ($field->range ? Profile::range($field->range, $model->profile->getAttribute($field->varname)) : $model->profile->getAttribute($field->varname))));
}
}
array_push($attributes, 'password', 'email', 'activkey', array('name' => 'createtime', 'value' => date("d.m.Y H:i:s", $model->createtime)), array('name' => 'lastvisit', 'value' => $model->lastvisit ? date("d.m.Y H:i:s", $model->lastvisit) : UserModule::t("Not visited")), array('name' => 'superuser', 'value' => User::itemAlias("AdminStatus", $model->superuser)), array('name' => 'status', 'value' => User::itemAlias("UserStatus", $model->status)));
$this->render('view', array('model' => $model, 'attributes' => $attributes));
}
示例6: run
public function run($args)
{
$companies = Company::model()->findAll('frozen=:p', array(':p' => '0'));
foreach ($companies as $company) {
Company::setActive($company);
Yii::app()->language = Company::getLanguage();
User::model()->refreshMetaData();
AuthAssignment::model()->refreshMetaData();
ProfileField::model()->refreshMetaData();
Profile::model()->refreshMetaData();
Zakaz::model()->refreshMetaData();
ZakazParts::model()->refreshMetaData();
Events::model()->refreshMetaData();
Templates::model()->refreshMetaData();
Emails::model()->refreshMetaData();
self::executor();
self::manager();
self::send_deffered_emails();
}
}
示例7: registerManegeScript
/**
* Register Script
*/
public function registerManegeScript()
{
$basePath = Yii::getPathOfAlias(Yii::app()->getModule('cart')->assetPath);
$baseUrl = Yii::app()->getAssetManager()->publish($basePath);
$cs = Yii::app()->getClientScript();
$cs->registerCoreScript('jquery');
$cs->registerCssFile($baseUrl . '/css/redmond/jquery-ui.css');
$cs->registerCssFile($baseUrl . '/css/style.css');
$cs->registerScriptFile($baseUrl . '/js/jquery-ui.min.js');
$cs->registerScriptFile($baseUrl . '/js/form.js');
$cs->registerScriptFile($baseUrl . '/js/jquery.json.js');
$widgets = self::getWidgets();
$wgByTypes = ProfileField::itemAlias('field_type');
foreach ($wgByTypes as $k => $v) {
$wgByTypes[$k] = array();
}
foreach ($widgets[1] as $widget) {
if (isset($widget['fieldType']) && count($widget['fieldType'])) {
foreach ($widget['fieldType'] as $type) {
array_push($wgByTypes[$type], $widget['name']);
}
}
}
//echo '<pre>'; print_r($widgets[1]); die();
$js = "\n\n\tvar name = \$('#name'),\n\tvalue = \$('#value'),\n\tallFields = \$([]).add(name).add(value),\n\ttips = \$('.validateTips');\n\t\n\tvar listWidgets = jQuery.parseJSON('" . str_replace("'", "\\'", CJavaScript::jsonEncode($widgets[0])) . "');\n\tvar widgets = jQuery.parseJSON('" . str_replace("'", "\\'", CJavaScript::jsonEncode($widgets[1])) . "');\n\tvar wgByType = jQuery.parseJSON('" . str_replace("'", "\\'", CJavaScript::jsonEncode($wgByTypes)) . "');\n\t\n\tvar fieldType = {\n\t\t\t'INTEGER':{\n\t\t\t\t'hide':['match','other_validator','widgetparams'],\n\t\t\t\t'val':{\n\t\t\t\t\t'field_size':10,\n\t\t\t\t\t'default':'0',\n\t\t\t\t\t'range':'',\n\t\t\t\t\t'widgetparams':''\n\t\t\t\t}\n\t\t\t},\n\t\t\t'VARCHAR':{\n\t\t\t\t'hide':['widgetparams'],\n\t\t\t\t'val':{\n\t\t\t\t\t'field_size':255,\n\t\t\t\t\t'default':'',\n\t\t\t\t\t'range':'',\n\t\t\t\t\t'widgetparams':''\n\t\t\t\t}\n\t\t\t},\n\t\t\t'TEXT':{\n\t\t\t\t'hide':['field_size','range','widgetparams'],\n\t\t\t\t'val':{\n\t\t\t\t\t'field_size':0,\n\t\t\t\t\t'default':'',\n\t\t\t\t\t'range':'',\n\t\t\t\t\t'widgetparams':''\n\t\t\t\t}\n\t\t\t},\n\t\t\t'DATE':{\n\t\t\t\t'hide':['field_size','field_size_min','match','range','widgetparams'],\n\t\t\t\t'val':{\n\t\t\t\t\t'field_size':0,\n\t\t\t\t\t'default':'0000-00-00',\n\t\t\t\t\t'range':'',\n\t\t\t\t\t'widgetparams':''\n\t\t\t\t}\n\t\t\t},\n\t\t\t'FLOAT':{\n\t\t\t\t'hide':['match','other_validator','widgetparams'],\n\t\t\t\t'val':{\n\t\t\t\t\t'field_size':'10,2',\n\t\t\t\t\t'default':'0.00',\n\t\t\t\t\t'range':'',\n\t\t\t\t\t'widgetparams':''\n\t\t\t\t}\n\t\t\t},\n\t\t\t'BOOL':{\n\t\t\t\t'hide':['field_size','field_size_min','match','widgetparams'],\n\t\t\t\t'val':{\n\t\t\t\t\t'field_size':0,\n\t\t\t\t\t'default':0,\n\t\t\t\t\t'range':'1==" . CartModule::t('Yes') . ";0==" . CartModule::t('No') . "',\n\t\t\t\t\t'widgetparams':''\n\t\t\t\t}\n\t\t\t},\n\t\t\t'BLOB':{\n\t\t\t\t'hide':['field_size','field_size_min','match','widgetparams'],\n\t\t\t\t'val':{\n\t\t\t\t\t'field_size':0,\n\t\t\t\t\t'default':'',\n\t\t\t\t\t'range':'',\n\t\t\t\t\t'widgetparams':''\n\t\t\t\t}\n\t\t\t},\n\t\t\t'BINARY':{\n\t\t\t\t'hide':['field_size','field_size_min','match','widgetparams'],\n\t\t\t\t'val':{\n\t\t\t\t\t'field_size':0,\n\t\t\t\t\t'default':'',\n\t\t\t\t\t'range':'',\n\t\t\t\t\t'widgetparams':''\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t\t\t\n\tfunction showWidgetList(type) {\n\t\t\$('div.widget select').empty();\n\t\t\$('div.widget select').append('<option value=\"\">" . CartModule::t('No') . "</option>');\n\t\tif (wgByType[type]) {\n\t\t\tfor (var k in wgByType[type]) {\n\t\t\t\t\$('div.widget select').append('<option value=\"'+wgByType[type][k]+'\">'+widgets[wgByType[type][k]]['label']+'</option>');\n\t\t\t}\n\t\t}\n\t}\n\t\t\n\tfunction setFields(type) {\n\t\tif (fieldType[type]) {\n\t\t\tif (" . (isset($_GET['id']) ? 0 : 1) . ") {\n\t\t\t\tshowWidgetList(type);\n\t\t\t\t\$('#widgetlist option:first').attr('selected', 'selected');\n\t\t\t}\n\t\t\t\n\t\t\t\$('div.row').addClass('toshow').removeClass('tohide');\n\t\t\tif (fieldType[type].hide.length) \$('div.'+fieldType[type].hide.join(', div.')).addClass('tohide').removeClass('toshow');\n\t\t\tif (\$('div.widget select').val()) {\n\t\t\t\t\$('div.widgetparams').removeClass('tohide');\n\t\t\t}\n\t\t\t\$('div.toshow').show(500);\n\t\t\t\$('div.tohide').hide(500);\n\t\t\t" . (!isset($_GET['id']) ? "\n\t\t\tfor (var k in fieldType[type].val) { \n\t\t\t\t\$('div.'+k+' input').val(fieldType[type].val[k]);\n\t\t\t}" : '') . "\n\t\t}\n\t}\n\t\n\tfunction isArray(obj) {\n\t\tif (obj.constructor.toString().indexOf('Array') == -1)\n\t\t\treturn false;\n\t\telse\n\t\t\treturn true;\n\t}\n\t\t\n\t\$('#dialog-form').dialog({\n\t\tautoOpen: false,\n\t\theight: 400,\n\t\twidth: 400,\n\t\tmodal: true,\n\t\tbuttons: {\n\t\t\t'" . CartModule::t('Save') . "': function() {\n\t\t\t\tvar wparam = {};\n\t\t\t\tvar fparam = {};\n\t\t\t\t\$('#dialog-form fieldset .wparam').each(function(){\n\t\t\t\t\tif (\$(this).val()) wparam[\$(this).attr('name')] = \$(this).val();\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\tvar tab = \$('#tabs ul li.ui-tabs-selected').text();\n\t\t\t\tfparam[tab] = {};\n\t\t\t\t\$('#dialog-form fieldset .tab-'+tab).each(function(){\n\t\t\t\t\tif (\$(this).val()) fparam[tab][\$(this).attr('name')] = \$(this).val();\n\t\t\t\t});\n\t\t\t\t\n\t\t\t\tif (\$.JSON.encode(wparam)!='{}') \$('div.widgetparams input').val(\$.JSON.encode(wparam));\n\t\t\t\tif (\$.JSON.encode(fparam[tab])!='{}') \$('div.other_validator input').val(\$.JSON.encode(fparam)); \n\t\t\t\t\n\t\t\t\t\$(this).dialog('close');\n\t\t\t},\n\t\t\t'" . CartModule::t('Cancel') . "': function() {\n\t\t\t\t\$(this).dialog('close');\n\t\t\t}\n\t\t},\n\t\tclose: function() {\n\t\t}\n\t});\n\n\n\t\$('#widgetparams').focus(function() {\n\t\tvar widget = widgets[\$('#widgetlist').val()];\n\t\tvar html = '';\n\t\tvar wparam = (\$('div.widgetparams input').val())?\$.JSON.decode(\$('div.widgetparams input').val()):{};\n\t\tvar fparam = (\$('div.other_validator input').val())?\$.JSON.decode(\$('div.other_validator input').val()):{};\n\t\t\n\t\t// Class params\n\t\tfor (var k in widget.params) {\n\t\t\thtml += '<label for=\"name\">'+((widget.paramsLabels[k])?widget.paramsLabels[k]:k)+'</label>';\n\t\t\thtml += '<input type=\"text\" name=\"'+k+'\" id=\"widget_'+k+'\" class=\"text wparam ui-widget-content ui-corner-all\" value=\"'+((wparam[k])?wparam[k]:widget.params[k])+'\" />';\n\t\t}\n\t\t// Validator params\t\t\n\t\tif (widget.other_validator) {\n\t\t\tvar tabs = '';\n\t\t\tvar li = '';\n\t\t\tfor (var t in widget.other_validator) {\n\t\t\t\ttabs += '<div id=\"tab-'+t+'\" class=\"tab\">';\n\t\t\t\tli += '<li'+((fparam[t])?' class=\"ui-tabs-selected\"':'')+'><a href=\"#tab-'+t+'\">'+t+'</a></li>';\n\t\t\t\t\n\t\t\t\tfor (var k in widget.other_validator[t]) {\n\t\t\t\t\ttabs += '<label for=\"name\">'+((widget.paramsLabels[k])?widget.paramsLabels[k]:k)+'</label>';\n\t\t\t\t\tif (isArray(widget.other_validator[t][k])) {\n\t\t\t\t\t\ttabs += '<select type=\"text\" name=\"'+k+'\" id=\"filter_'+k+'\" class=\"text fparam ui-widget-content ui-corner-all tab-'+t+'\">';\n\t\t\t\t\t\tfor (var i in widget.other_validator[t][k]) {\n\t\t\t\t\t\t\ttabs += '<option value=\"'+widget.other_validator[t][k][i]+'\"'+((fparam[t]&&fparam[t][k])?' selected=\"selected\"':'')+'>'+widget.other_validator[t][k][i]+'</option>';\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttabs += '</select>';\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttabs += '<input type=\"text\" name=\"'+k+'\" id=\"filter_'+k+'\" class=\"text fparam ui-widget-content ui-corner-all tab-'+t+'\" value=\"'+((fparam[t]&&fparam[t][k])?fparam[t][k]:widget.other_validator[t][k])+'\" />';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttabs += '</div>';\n\t\t\t}\n\t\t\thtml += '<div id=\"tabs\"><ul>'+li+'</ul>'+tabs+'</div>';\n\t\t}\n\t\t\n\t\t\$('#dialog-form fieldset').html(html);\n\t\t\n\t\t\$('#tabs').tabs();\n\t\t\n\t\t// Show form\n\t\t\$('#dialog-form').dialog('open');\n\t});\n\t\n\t\$('#field_type').change(function() {\n\t\tsetFields(\$(this).val());\n\t});\n\t\n\t\$('#widgetlist').change(function() {\n\t\tif (\$(this).val()) {\n\t\t\t\$('div.widgetparams').show(500);\n\t\t} else {\n\t\t\t\$('div.widgetparams').hide(500);\n\t\t}\n\t\t\n\t});\n\t\n\t// show all function \n\t\$('div.form p.note').append('<br/><a href=\"#\" id=\"showAll\">" . CartModule::t('Show all') . "</a>');\n \t\$('#showAll').click(function(){\n\t\t\$('div.row').show(500);\n\t\treturn false;\n\t});\n\t\n\t// init\n\tsetFields(\$('#field_type').val());\n\t\n\t";
$cs->registerScript(__CLASS__ . '#dialog', $js);
}
示例8: getFields
public static function getFields()
{
if (self::$regMode) {
if (!self::$_modelReg) {
self::$_modelReg = ProfileField::model()->forRegistration()->findAll();
}
return self::$_modelReg;
} else {
if (!self::$_model) {
self::$_model = ProfileField::model()->forOwner()->findAll();
}
return self::$_model;
}
}
示例9: getAllVarnames
public static function getAllVarnames()
{
$criteria = new CDbCriteria();
$criteria->compare('field_type', 'LIST');
$list = CHtml::listData(ProjectField::model()->findAll($criteria), 'varname', function ($data) {
return $data->varname . " ({$data->title})";
});
$list = array_merge($list, CHtml::listData(ProfileField::model()->findAll($criteria), 'varname', function ($data) {
return $data->varname . " ({$data->title})";
}));
return $list;
}
示例10:
?>
<?php
echo CHtml::error($model, 'position');
?>
<p class="hint"><?php
echo UserModule::t('Display order of fields.');
?>
</p>
</div>
<div class="row visible">
<?php
echo CHtml::activeLabelEx($model, 'visible');
?>
<?php
echo CHtml::activeDropDownList($model, 'visible', ProfileField::itemAlias('visible'));
?>
<?php
echo CHtml::error($model, 'visible');
?>
</div>
<div class="row buttons">
<?php
echo CHtml::submitButton($model->isNewRecord ? UserModule::t('Create') : UserModule::t('Save'));
?>
</div>
<?php
echo CHtml::endForm();
?>
示例11: array
<?php
$this->breadcrumbs = array(UserModule::t('Profile Fields') => array('admin'), UserModule::t('Manage'));
$this->menu = array(array('label' => UserModule::t('Create Profile Field'), 'url' => array('create')), array('label' => UserModule::t('Manage Profile Field'), 'url' => array('admin')), array('label' => UserModule::t('Manage Users'), 'url' => array('/user/admin')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n \$('.search-form').toggle();\n return false;\n});\n\$('.search-form form').submit(function(){\n \$.fn.yiiGridView.update('profile-field-grid', {\n data: \$(this).serialize()\n });\n return false;\n});\n");
?>
<h1><?php
echo UserModule::t('Manage Profile Fields');
?>
</h1>
<p><?php
echo UserModule::t("You may optionally enter a comparison operator (<b><</b>, <b><=</b>, <b>></b>, <b>>=</b>, <b><></b> or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.");
?>
</p>
<?php
echo CHtml::link(UserModule::t('Advanced Search'), '#', array('class' => 'search-button'));
?>
<div class="search-form" style="display:none">
<?php
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->
<?php
$this->widget('bootstrap.widgets.TbGridView', array('dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('id', array('name' => 'varname', 'type' => 'raw', 'value' => 'UHtml::markSearch($data,"varname")'), array('name' => 'title', 'value' => 'UserModule::t($data->title)'), array('name' => 'field_type', 'value' => '$data->field_type', 'filter' => ProfileField::itemAlias("field_type")), 'field_size', array('name' => 'required', 'value' => 'ProfileField::itemAlias("required",$data->required)', 'filter' => ProfileField::itemAlias("required")), 'position', array('name' => 'visible', 'value' => 'ProfileField::itemAlias("visible",$data->visible)', 'filter' => ProfileField::itemAlias("visible")), array('class' => 'bootstrap.widgets.TbButtonColumn'))));
示例12: array
<?php
$this->breadcrumbs = array(UserModule::t('Profile Fields') => array('admin'), UserModule::t('Manage'));
$this->menu = array(array('label' => UserModule::t('Create Profile Field'), 'url' => array('create')), array('label' => UserModule::t('Manage Profile Field'), 'url' => array('admin')), array('label' => UserModule::t('Manage Users'), 'url' => array('/user/admin')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n \$('.search-form').toggle();\n return false;\n});\n\$('.search-form form').submit(function(){\n \$.fn.yiiGridView.update('profile-field-grid', {\n data: \$(this).serialize()\n });\n return false;\n});\n");
?>
<h1><?php
echo UserModule::t('Manage Profile Fields');
?>
</h1>
<p class="helper"><?php
echo UserModule::t("You may optionally enter a comparison operator (<b><</b>, <b><=</b>, <b>></b>, <b>>=</b>, <b><></b> or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.");
?>
</p>
<?php
echo CHtml::link(UserModule::t('Advanced Search'), '#', array('class' => 'search-button'));
?>
<div class="search-form" style="display:none">
<?php
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->
<?php
//$this->widget('zii.widgets.grid.CGridView', array(
$this->widget('JGridView', array('dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'id', 'htmlOptions' => array('class' => 'id-column')), array('name' => 'varname', 'type' => 'raw', 'value' => 'UHtml::markSearch($data,"varname")'), array('name' => 'title', 'value' => 'UserModule::t($data->title)'), array('name' => 'field_type', 'value' => '$data->field_type', 'filter' => ProfileField::itemAlias("field_type")), 'field_size', array('name' => 'required', 'value' => 'ProfileField::itemAlias("required",$data->required)', 'filter' => ProfileField::itemAlias("required")), 'position', array('name' => 'visible', 'value' => 'ProfileField::itemAlias("visible",$data->visible)', 'filter' => ProfileField::itemAlias("visible")), array('class' => 'CButtonColumn', 'template' => '{update}{delete}', 'updateButtonImageUrl' => Yii::app()->theme->baseUrl . '/images/update16x16.png', 'deleteButtonImageUrl' => Yii::app()->theme->baseUrl . '/images/delete16x16.png'))));
示例13: array
?>
<?php
echo $form->textFieldRow($model, 'error_message', array('size' => 60, 'maxlength' => 255));
?>
<?php
echo $form->textFieldRow($model, 'other_validator', array('size' => 60, 'maxlength' => 5000));
?>
<?php
echo $form->textFieldRow($model, 'default', array('size' => 60, 'maxlength' => 255));
?>
<?php
echo $form->textFieldRow($model, 'widget', array('size' => 60, 'maxlength' => 255));
?>
<?php
echo $form->textFieldRow($model, 'widgetparams', array('size' => 60, 'maxlength' => 5000));
?>
<?php
echo $form->textFieldRow($model, 'position');
?>
<?php
echo $form->dropDownListRow($model, 'visible', ProfileField::itemAlias('visible'));
?>
<div class="form-actions">
<?php
$this->widget('bootstrap.widgets.TbButton', array('type' => 'primary', 'buttonType' => 'submit', 'label' => UserModule::t('Search')));
?>
</div>
<?php
$this->endWidget();
示例14: getFields
public function getFields()
{
if ($this->regMode) {
if (!$this->_modelReg) {
$criteria = new CDbCriteria();
$criteria->order = 'position';
if ($this->regType == 'Author') {
$criteria->addInCondition('visible', array(2, 3));
$this->_modelReg = ProfileField::model()->findAll($criteria);
} elseif ($this->regType == 'Customer') {
$criteria->addInCondition('visible', array(1, 3));
$this->_modelReg = ProfileField::model()->findAll($criteria);
}
}
return $this->_modelReg;
} else {
if (!$this->_model) {
$criteria = new CDbCriteria();
$criteria->order = 'position';
if (User::model()->isCustomer()) {
$criteria->addInCondition('visible', array(1, 3));
$this->_model = ProfileField::model()->findAll($criteria);
} elseif (User::model()->isAuthor()) {
$criteria->addInCondition('visible', array(2, 3));
$this->_model = ProfileField::model()->findAll($criteria);
} elseif (User::model()->isManager()) {
$this->_model = ProfileField::model()->findAll();
} else {
$this->_model = ProfileField::model()->forAll()->findAll();
}
}
return $this->_model;
}
}
示例15: array
$specials2 = true;
}
}
if ($specials2) {
if (isset($data->zakaz->catalog_specials2)) {
return $data->zakaz->catalog_specials2->cat_name;
}
} else {
return false;
}
}), array('name' => 'manager', 'type' => 'raw', 'value' => function ($data) {
return CHtml::link($data->manager, array('/user/admin/view', 'id' => $data->profileManager->id));
}), array('name' => 'user', 'type' => 'raw', 'value' => function ($data) {
return CHtml::link($data->user, array('/user/admin/view', 'id' => $data->profileUser->id));
}), array('name' => 'profileUser.AuthAssignment.AuthItem.description'), array('name' => 'summ', 'footer' => $model->pageTotal($provider)), array('header' => Yii::t('site', 'Payment method'), 'type' => 'raw', 'value' => function ($data) {
$payFields = ProfileField::model()->findAllByAttributes(array('paymentProps' => '1'));
$payFieldsUser = $data->profileUser;
foreach ($payFields as $field) {
$fields[] = $field->varname;
$final[$field->varname] = $field->title;
}
$fields = implode($fields, ',');
$userPayFields = Profile::model()->find(array('select' => $fields, 'condition' => 'user_id = :user', 'params' => array(':user' => $data->profileUser->id)));
$fields = array();
if (!empty($userPayFields)) {
foreach ($userPayFields as $key => $field) {
if ($field != null) {
$fields[$key] = $final[$key];
}
}
}