本文整理汇总了PHP中humhub\modules\user\models\User::createUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP User::createUrl方法的具体用法?PHP User::createUrl怎么用?PHP User::createUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类humhub\modules\user\models\User
的用法示例。
在下文中一共展示了User::createUrl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* @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();
}
示例2: run
/**
* @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);
}
示例3: run
/**
* @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);
}