/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = ProfileField::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => Yii::$app->controller->module->fields_page_size]]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['like', 'id', $this->id])->andFilterWhere(['like', 'varname', $this->varname])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'field_type', $this->field_type])->andFilterWhere(['like', 'field_size', $this->field_size])->andFilterWhere(['like', 'field_size_min', $this->field_size_min])->andFilterWhere(['like', 'required', $this->required])->andFilterWhere(['like', 'match', $this->match])->andFilterWhere(['like', 'range', $this->range])->andFilterWhere(['like', 'error_message', $this->error_message])->andFilterWhere(['like', 'other_validator', $this->other_validator])->andFilterWhere(['like', 'default', $this->default])->andFilterWhere(['like', 'widget', $this->widget])->andFilterWhere(['like', 'widgetparams', $this->widgetparams])->andFilterWhere(['like', 'position', $this->position])->andFilterWhere(['like', 'visible', $this->visible]);
     return $dataProvider;
 }
Example #2
0
$this->title = Yii::$app->name . ' - ' . Module::t("Profile");
$this->params['breadcrumbs'][] = Module::t("Profile");
$menu = [['label' => Module::t('List User'), 'url' => ['/user/user/index']], ['label' => Module::t('Edit'), 'url' => ['edit']], ['label' => Module::t('Change password'), 'url' => ['changepassword']], ['label' => Module::t('Logout'), 'url' => ['/user/logout']]];
if (Module::isAdmin()) {
    array_unshift($menu, ['label' => Module::t('Manage Users'), 'url' => ['/user/admin']]);
}
Module::getInstance()->setMenu($menu);
?>
    <h1><?php 
echo Module::t('Your profile');
?>
</h1>

<?php 
$attributes = ['username', 'email:email', 'create_at:date', 'lastvisit_at:date'];
$profileFields = ProfileField::find()->forOwner()->sort()->all();
if ($profileFields) {
    foreach ($profileFields as $field) {
        $val = '';
        if ($field->widgetView($model->profile)) {
            $val = $field->widgetView($model->profile);
        } else {
            if ($field->range) {
                $val = Profile::range($field->range, $model->profile->getAttribute($field->varname));
            } else {
                $val = $model->profile->getAttribute($field->varname);
            }
        }
        $type = 'html';
        if ($field->field_type == "DATE" || $field->widget == "UWjuidate") {
            $type = 'date';
Example #3
0
 /**
  * @return ProfileField[]
  */
 public static function getFields()
 {
     if (self::$regMode) {
         if (!self::$modelReg) {
             self::$modelReg = ProfileField::find()->forRegistration()->all();
         }
         return self::$modelReg;
     } else {
         if (!self::$model) {
             self::$model = ProfileField::find()->forOwner()->all();
         }
         return self::$model;
     }
 }