Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
ProfileField Class Reference

Public Member Functions

 tableName ()
 rules ()
 relations ()
 attributeLabels ()
 scopes ()
 widgetView ($model)
 widgetEdit ($model, $params=array())
 search ()

Static Public Member Functions

static model ($className=__CLASS__)
static itemAlias ($type, $code=NULL)

Public Attributes

const VISIBLE_ALL = 3
const VISIBLE_REGISTER_USER = 2
const VISIBLE_ONLY_OWNER = 1
const VISIBLE_ONLY_ADMIN = 0
const VISIBLE_NO = -1
const REQUIRED_NO = 0
const REQUIRED_YES_SHOW_REG = 1
const REQUIRED_NO_SHOW_REG = 2
const REQUIRED_YES_NOT_SHOW_REG = 3

Detailed Description

Definition at line 3 of file ProfileField.php.

Member Function Documentation

ProfileField::attributeLabels ( )
Returns
array customized attribute labels (name=>label)

Definition at line 85 of file ProfileField.php.

References UserModule\t().

{
return array(
'id' => UserModule::t('Id'),
'varname' => UserModule::t('Variable name'),
'title' => UserModule::t('Title'),
'field_type' => UserModule::t('Field Type'),
'field_size' => UserModule::t('Field Size'),
'field_size_min' => UserModule::t('Field Size min'),
'required' => UserModule::t('Required'),
'match' => UserModule::t('Match'),
'range' => UserModule::t('Range'),
'error_message' => UserModule::t('Error Message'),
'other_validator' => UserModule::t('Other Validator'),
'default' => UserModule::t('Default'),
'widget' => UserModule::t('Widget'),
'widgetparams' => UserModule::t('Widget parametrs'),
'position' => UserModule::t('Position'),
'visible' => UserModule::t('Visible'),
);
}
static ProfileField::model (   $className = __CLASS__)
static

Returns the static model of the specified AR class.

Returns
CActiveRecord the static model class

Definition at line 38 of file ProfileField.php.

Referenced by AdminController\actionView(), ProfileFieldController\loadModel(), ProfileFieldTest\testDelete(), and ProfileFieldTest\testFind().

{
return parent::model($className);
}
ProfileField::relations ( )
Returns
array relational rules.

Definition at line 74 of file ProfileField.php.

{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
);
}
ProfileField::rules ( )
Returns
array validation rules for model attributes.

Definition at line 54 of file ProfileField.php.

References UserModule\t().

{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('varname, title, field_type', 'required'),
array('varname', 'match', 'pattern' => '/^[A-Za-z_0-9]+$/u', 'message' => UserModule::t("Variable name may consist of A-z, 0-9, underscores, begin with a letter.")),
array('varname', 'unique', 'message' => UserModule::t("This field already exists.")),
array('varname, widget', 'length', 'max' => 50),
array('field_type', 'length', 'max' => 50),
array('field_size, field_size_min, required, position, visible', 'numerical', 'integerOnly' => true),
array('title, match, error_message, other_validator, default, widget', 'length', 'max' => 255),
array('range, widgetparams', 'length', 'max' => 5000),
array('id, varname, title, field_type, field_size, field_size_min, required, match, range, error_message, other_validator, default, widget, widgetparams, position, visible', 'safe', 'on'=>'search'),
);
}
ProfileField::search ( )

Retrieves a list of models based on the current search/filter conditions.

Returns
CActiveDataProvider the data provider that can return the models based on the search/filter conditions.

Definition at line 221 of file ProfileField.php.

{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria = new CDbCriteria;
$criteria->compare('id', $this->id);
$criteria->compare('varname', $this->varname, true);
$criteria->compare('title', $this->title, true);
$criteria->compare('field_type', $this->field_type, true);
$criteria->compare('field_size', $this->field_size);
//$criteria->compare('field_size_min', $this->field_size_min);
$criteria->compare('required', $this->required);
$criteria->compare('match', $this->match, true);
$criteria->compare('range', $this->range, true);
$criteria->compare('error_message', $this->error_message, true);
$criteria->compare('other_validator', $this->other_validator, true);
$criteria->compare('default', $this->default, true);
$criteria->compare('widget', $this->widget, true);
$criteria->compare('widgetparams', $this->widgetparams, true);
$criteria->compare('position', $this->position);
$criteria->compare('visible', $this->visible);
return new CActiveDataProvider($this, array(
'criteria' => $criteria,
'pagination' => array(
'pageSize' => Yii::app()->getModule('user')->fields_page_size,
),
'sort' => array(
'defaultOrder' => 'position',
),
));
}
ProfileField::tableName ( )
Returns
string the associated database table name

Definition at line 46 of file ProfileField.php.

{
return Yii::app()->getModule('user')->tableProfileFields;
}
ProfileField::widgetView (   $model)
Parameters
$value
Returns
formated value (string)

Definition at line 140 of file ProfileField.php.

{
if ($this->widget && class_exists($this->widget)) {
$widgetClass = new $this->widget;
$arr = $this->widgetparams;
if ($arr) {
$newParams = $widgetClass->params;
$arr = (array)CJavaScript::jsonDecode($arr);
foreach ($arr as $p => $v) {
if (isset($newParams[$p])) $newParams[$p] = $v;
}
$widgetClass->params = $newParams;
}
if (method_exists($widgetClass, 'viewAttribute')) {
return $widgetClass->viewAttribute($model, $this);
}
}
return false;
}

The documentation for this class was generated from the following file: