Example #1
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $m = $this->_module;
     if (!isset($this->hasSocial)) {
         $this->hasSocial = $m->socialSettings['enabled'];
     }
     if (!isset($this->hasProfile)) {
         $this->hasProfile = $m->profileSettings['enabled'];
     }
 }
Example #2
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $m = $this->_module;
     if (Yii::$app->user->id != $this->model->id || !$m->socialSettings['enabled']) {
         return;
     }
     $attributes = [['group' => true, 'label' => $m->icon('link') . Yii::t('user', 'Connect Social Accounts'), 'rowOptions' => ['class' => 'info']], ['group' => true, 'label' => $m->getSocialWidget()]];
     $this->attributes = array_replace_recursive($attributes, $this->attributes);
     $this->widgetOptions = array_replace_recursive(['striped' => false, 'enableEditMode' => false, 'attributes' => $this->attributes], $this->widgetOptions);
     $this->widgetOptions['model'] = $this->profile;
     $this->getView()->registerCss('.user-link-social .auth-clients {margin:4px;padding:0}');
 }
Example #3
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $m = $this->_module;
     if (!$m->profileSettings['enabled']) {
         return;
     }
     // basic attributes from Profile model
     $attributes = [['group' => true, 'label' => $m->icon('user') . Yii::t('user', 'Profile Details'), 'rowOptions' => ['class' => 'info']], 'first_name', 'last_name', ['attribute' => 'gender', 'format' => 'raw', 'value' => $this->profile->getGenderHtml(), 'labelColOptions' => ['style' => 'width:40%;text-align:right']], 'birth_date:date'];
     $this->attributes = array_replace_recursive($attributes, $this->attributes);
     $this->widgetOptions = array_replace_recursive(['striped' => false, 'hover' => true, 'enableEditMode' => false, 'attributes' => $this->attributes], $this->widgetOptions);
     $this->widgetOptions['model'] = $this->profile;
 }
Example #4
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $m = $this->_module;
     $editSettings = $m->getEditSettingsUser($this->model);
     // basic attributes from User model
     $attributes = [['group' => true, 'label' => $m->icon('tag') . Yii::t('user', 'Account Details'), 'rowOptions' => ['class' => 'info']], 'username', 'email:email'];
     if ($editSettings['changeEmail'] && !empty($this->model->email_new)) {
         $attributes[] = 'email_new:email';
     }
     $attributes[] = ['attribute' => 'created_on', 'label' => Yii::t('user', 'Registered On'), 'format' => ['datetime', $m->datetimeDispFormat], 'labelColOptions' => ['style' => 'width:40%;text-align:right']];
     $attributes[] = ['attribute' => 'last_login_on', 'format' => ['datetime', $m->datetimeDispFormat], 'value' => strtotime($this->model->last_login_on) ? $this->model->last_login_on : null];
     $this->attributes = array_replace_recursive($attributes, $this->attributes);
     $this->widgetOptions = array_replace_recursive(['striped' => false, 'hover' => true, 'enableEditMode' => false, 'attributes' => $this->attributes], $this->widgetOptions);
     $this->widgetOptions['model'] = $this->model;
 }
Example #5
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     $m = $this->_module;
     if (!$m->socialSettings['enabled']) {
         return;
     }
     $attributes = [['group' => true, 'label' => $m->icon('globe') . Yii::t('user', 'Social Details'), 'rowOptions' => ['class' => 'info']]];
     if (count($this->social) === 1 && $this->social[0]->isNewRecord) {
         $attributes[] = ['group' => true, 'label' => '<span class="not-set" style="font-weight:normal">' . Yii::t('user', 'No social profiles linked yet') . '</span>'];
     } else {
         foreach ($this->social as $record) {
             $provider = empty($record->source) ? Yii::t('user', 'Unknown') : '<span class="auth-icon ' . $record->source . '"></span>' . '<span class="auth-title">' . ucfirst($record->source) . '</span>';
             $attributes[] = ['label' => Yii::t('user', 'Source'), 'value' => '<b>' . Yii::t('user', 'Connected On') . '</b>', 'format' => 'raw', 'rowOptions' => ['class' => 'active'], 'labelColOptions' => ['style' => 'width:90px;text-align:center']];
             $attributes[] = ['label' => '<div class="auth-client"><span class="auth-link">' . $provider . '</span></div>', 'value' => $record->updated_on, 'labelColOptions' => ['style' => 'text-align:center;vertical-align:middle'], 'valueColOptions' => ['style' => 'vertical-align:middle'], 'format' => ['datetime', $m->datetimeDispFormat]];
         }
     }
     $this->attributes = array_replace_recursive($attributes, $this->attributes);
     $this->widgetOptions = array_replace_recursive(['striped' => false, 'hover' => true, 'enableEditMode' => false, 'attributes' => $this->attributes], $this->widgetOptions);
     $this->widgetOptions['model'] = $this->profile;
 }
Example #6
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     $this->_module = Yii::$app->getModule('user');
     parent::init();
 }