Exemple #1
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     $this->addItemGroup(array('id' => 'profile', 'label' => Yii::t('UserModule.widgets_ProfileMenuWidget', '<strong>Profile</strong> menu'), 'sortOrder' => 100));
     $this->addItem(array('label' => Yii::t('UserModule.widgets_ProfileMenuWidget', 'Stream'), 'group' => 'profile', 'url' => $this->user->createUrl('//user/profile/home'), 'sortOrder' => 200, 'isActive' => Yii::$app->controller->id == "profile" && (Yii::$app->controller->action->id == "index" || Yii::$app->controller->action->id == "home")));
     if ($this->user->permissionManager->can(new \humhub\modules\user\permissions\ViewAboutPage())) {
         $this->addItem(array('label' => Yii::t('UserModule.widgets_ProfileMenuWidget', 'About'), 'group' => 'profile', 'url' => $this->user->createUrl('//user/profile/about'), 'sortOrder' => 300, 'isActive' => Yii::$app->controller->id == "profile" && Yii::$app->controller->action->id == "about"));
     }
     parent::init();
 }
 /**
  * @inheritdoc
  */
 public function run()
 {
     if ($this->user->isCurrentUser() || \Yii::$app->user->isGuest) {
         return;
     }
     if (Yii::$app->getModule('friendship')->getIsEnabled()) {
         // Don't show follow button, when friends
         if (Friendship::getFriendsQuery($this->user)->one() !== null) {
             return;
         }
     }
     // Add class for javascript handling
     $this->followOptions['class'] .= ' followButton';
     $this->unfollowOptions['class'] .= ' unfollowButton';
     // Hide inactive button
     if ($this->user->isFollowedByUser()) {
         $this->followOptions['style'] .= ' display:none;';
     } else {
         $this->unfollowOptions['style'] .= ' display:none;';
     }
     // Add UserId Buttons
     $this->followOptions['data-userid'] = $this->user->id;
     $this->unfollowOptions['data-userid'] = $this->user->id;
     $this->view->registerJsFile('@web/resources/user/followButton.js');
     return Html::a($this->unfollowLabel, $this->user->createUrl('/user/profile/unfollow'), $this->unfollowOptions) . Html::a($this->followLabel, $this->user->createUrl('/user/profile/follow'), $this->followOptions);
 }
 /**
  * @inheritdoc
  */
 public function run()
 {
     if ($this->user->isCurrentUser() || \Yii::$app->user->isGuest) {
         return;
     }
     // Add class for javascript handling
     $this->followOptions['class'] .= ' followButton';
     $this->unfollowOptions['class'] .= ' unfollowButton';
     // Hide inactive button
     if ($this->user->isFollowedByUser()) {
         $this->followOptions['style'] .= ' display:none;';
     } else {
         $this->unfollowOptions['style'] .= ' display:none;';
     }
     // Add UserId Buttons
     $this->followOptions['data-userid'] = $this->user->id;
     $this->unfollowOptions['data-userid'] = $this->user->id;
     $this->view->registerJsFile('@web/resources/user/followButton.js');
     return Html::a($this->unfollowLabel, $this->user->createUrl('/user/profile/unfollow'), $this->unfollowOptions) . Html::a($this->followLabel, $this->user->createUrl('/user/profile/follow'), $this->followOptions);
 }