Exemple #1
0
 /**
  * Редактирование профиля пользователя
  */
 public function index()
 {
     \helpers\Layout::setTitles($this->fw->get('i18n.user.profile.title'));
     $model_profile = \models\UserProfile::getInstance();
     $model_profile_meta = \models\meta\Meta::getInstance()->getTableMeta('_user_profile');
     $profile = $model_profile->getByUserID($this->user_id);
     if (!is_null($profile)) {
         $this->fw->set('profile', $profile);
     } else {
         $user = $this->user_model->getOne($this->user_id);
         $title = $user->email;
         $model_profile->create($this->user_id, ['id' => $this->user_id, 'title' => $title]);
     }
     \models\UserProfile::setAjaxFields('_user_profile', $this->user_id);
     $this->fw->set('PARAMS.id', $this->user_id);
     $this->fw->set('upload_field_action_url', $this->fw->alias('backend_content_imagefield', 'table=' . $this->table . ',id=' . $this->user_id));
     foreach ($model_profile_meta->getPlural() as $k => $v) {
         $res = $this->model->getPluralSelected($this->node->id, $v);
         $this->fw->set("ajax_fields.{$v['full_table_name']}.selected", $res);
     }
     $this->fw->set('inc', 'user/profile.html');
     $this->clear_messages_after = true;
 }