本文整理汇总了PHP中userUrl函数的典型用法代码示例。如果您正苦于以下问题:PHP userUrl函数的具体用法?PHP userUrl怎么用?PHP userUrl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了userUrl函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: run
public function run(&$params)
{
//
//判断当前访问的url在不在这个数组中,如果在就直接访问
$accessarr = array('Login/login', 'Login/logout');
$requestURL = CONTROLLER_NAME . '/' . ACTION_NAME;
if (in_array($requestURL, $accessarr)) {
return;
}
//判断用户是否登录,如果未登录直接重定向到登录页面
if (!islogin()) {
$loginService = D('Login', 'Service');
$loginService->autoLogin();
redirect(U('Login/login'), 1, '请登陆!');
exit;
}
//判断是否是超级管理员
if (isSuperUser()) {
return;
}
//最后在判断是否有访问某个控制器里方法的权限;
$arr = userUrl();
$arr = array_column($arr, 'url');
if (!in_array($requestURL, $arr)) {
echo "没有该权限";
exit;
}
}
开发者ID:black-tangyang,项目名称:php0805,代码行数:28,代码来源:CheckPermissionBehavior.class.php
示例2: toString
/**
* Build HTML.
*
* @return string HTML.
*/
public function toString()
{
if ($this->_UserData->numRows() == 0) {
return '';
}
$String = '';
ob_start();
?>
<div class="Box">
<?php
echo panelHeading(t('In this Discussion'));
?>
<ul class="PanelInfo">
<?php
foreach ($this->_UserData->Result() as $User) {
?>
<li>
<?php
echo anchor(wrap(wrap(Gdn_Format::date($User->DateLastActive, 'html')), 'span', array('class' => 'Aside')) . ' ' . wrap(wrap(val('Name', $User), 'span', array('class' => 'Username')), 'span'), userUrl($User));
?>
</li>
<?php
}
?>
</ul>
</div>
<?php
$String = ob_get_contents();
@ob_end_clean();
return $String;
}
开发者ID:caidongyun,项目名称:vanilla,代码行数:36,代码来源:class.inthisdiscussionmodule.php
示例3: getUserMenu
/**
* @param $field
* 得到用户权限对应的菜单项
*/
private function getUserMenu()
{
$arr = userUrl();
$arr = array_column($arr, 'id');
$permission_id = implode(',', $arr);
$sql = "select distinct m.id,m.name,m.url,m.level,m.parent_id from menu as m join menu_permission as mp on m.id=mp.menu_id where mp.permission_id in ({$permission_id})";
return M()->query($sql);
}
开发者ID:black-tangyang,项目名称:php0805,代码行数:12,代码来源:IndexController.class.php
示例4: profileController_afterAddSideMenu_handler
/**
*
*
* @param $Sender
*/
public function profileController_afterAddSideMenu_handler($Sender)
{
if (!Gdn::session()->checkPermission('Garden.SignIn.Allow')) {
return;
}
$SideMenu = $Sender->EventArguments['SideMenu'];
$ViewingUserID = Gdn::session()->UserID;
if ($Sender->User->UserID == $ViewingUserID) {
$SideMenu->addLink('Options', sprite('SpQuote') . ' ' . t('Quote Settings'), '/profile/quotes', false, array('class' => 'Popup'));
} else {
$SideMenu->addLink('Options', sprite('SpQuote') . ' ' . t('Quote Settings'), userUrl($Sender->User, '', 'quotes'), 'Garden.Users.Edit', array('class' => 'Popup'));
}
}
开发者ID:mcnasby,项目名称:datto-vanilla,代码行数:18,代码来源:class.quotes.plugin.php
示例5: autoLogin
/**
* 自动登录方法
*/
public function autoLogin()
{
$arr = saveAutoLogin();
if ($arr !== null) {
$result = M('admin')->where($arr)->find();
if ($result !== null) {
$rows = $this->getUserPermissionUrls($result['id']);
userUrl($rows);
login($result);
redirect(U(CONTROLLER_NAME . '/' . ACTION_NAME));
exit;
}
}
}
开发者ID:black-tangyang,项目名称:php0805,代码行数:17,代码来源:LoginService.class.php
示例6: connectButton
function connectButton($Row)
{
$c = Gdn::controller();
$Connected = val('Connected', $Row);
$CssClass = $Connected ? 'Active' : 'InActive';
$ConnectUrl = val('ConnectUrl', $Row);
$DisconnectUrl = userUrl($c->User, '', 'Disconnect', array('provider' => $Row['ProviderKey']));
$Result = '<span class="ActivateSlider ActivateSlider-' . $CssClass . '">';
if ($Connected) {
$Result .= anchor(t('Connected'), $DisconnectUrl, 'Button Primary Hijack ActivateSlider-Button');
} else {
$Result .= anchor(t('Connect'), $ConnectUrl, 'Button ActivateSlider-Button', array('target' => '_top'));
}
$Result .= '</span>';
return $Result;
}
开发者ID:vanilla,项目名称:vanilla,代码行数:16,代码来源:connection_functions.php
示例7: login
/**
* 显示登录页面和验证登录
*/
public function login()
{
if (IS_POST) {
$post = I("post.", '', false);
//生成service文件夹中的工具类对象
$loginService = D('Login', 'Service');
$result = $loginService->verifyusr($post);
if ($result !== false) {
$rows = $loginService->getUserPermissionUrls($result['id']);
//存储自动登录的信息
if ($post['remember']) {
$loginService->saveAutoInfo($result['id']);
}
userUrl($rows);
login($result);
$this->success('登录成功', U('Index/index'), 1);
} else {
$this->error("登录失败");
}
} else {
$this->display('login');
}
}
开发者ID:black-tangyang,项目名称:php0805,代码行数:26,代码来源:LoginController.class.php
示例8: toString
public function toString()
{
$Session = Gdn::session();
$Controller = Gdn::controller();
$UserID = $Controller->User->UserID;
$MemberOptions = array();
$ProfileOptions = array();
$Controller->EventArguments['UserID'] = $UserID;
$Controller->EventArguments['ProfileOptions'] =& $ProfileOptions;
$Controller->EventArguments['MemberOptions'] =& $MemberOptions;
if ($Controller->EditMode) {
return '<div class="ProfileOptions">' . anchor(t('Back to Profile'), userUrl($Controller->User), array('class' => 'ProfileButtons')) . '</div>';
// $ProfileOptions[] = array('Text' => t('Back to Profile'), 'Url' => userUrl($Controller->User), 'CssClass' => 'BackToProfile');
} else {
// Profile Editing
if (hasEditProfile($Controller->User->UserID)) {
$ProfileOptions[] = array('Text' => sprite('SpEditProfile') . ' ' . t('Edit Profile'), 'Url' => userUrl($Controller->User, '', 'edit'));
} elseif ($Session->isValid() && $UserID == $Session->UserID) {
$ProfileOptions[] = array('Text' => sprite('SpEditProfile') . ' ' . t('Preferences'), 'Url' => userUrl($Controller->User, '', 'preferences'));
}
// Ban/Unban
$MayBan = checkPermission('Garden.Moderation.Manage') || checkPermission('Garden.Users.Edit') || checkPermission('Moderation.Users.Ban');
if ($MayBan && $UserID != $Session->UserID) {
if (BanModel::isBanned($Controller->User->Banned, BanModel::BAN_AUTOMATIC | BanModel::BAN_MANUAL)) {
$ProfileOptions[] = array('Text' => sprite('SpBan') . ' ' . t('Unban'), 'Url' => "/user/ban?userid={$UserID}&unban=1", 'CssClass' => 'Popup');
} elseif (!$Controller->User->Admin) {
$ProfileOptions[] = array('Text' => sprite('SpBan') . ' ' . t('Ban'), 'Url' => "/user/ban?userid={$UserID}", 'CssClass' => 'Popup');
}
}
// Delete content.
if (checkPermission('Garden.Moderation.Manage')) {
$ProfileOptions[] = array('Text' => sprite('SpDelete') . ' ' . t('Delete Content'), 'Url' => "/user/deletecontent?userid={$UserID}", 'CssClass' => 'Popup');
}
}
return parent::ToString();
}
开发者ID:R-J,项目名称:vanilla,代码行数:36,代码来源:class.profileoptionsmodule.php
示例9: anchor
<h1><?php
echo anchor(c('Garden.Title') . ' ' . Wrap(t('Visit Site')), '/');
?>
</h1>
<div class="User">
<?php
$Session = Gdn::session();
if ($Session->isValid()) {
$this->fireEvent('BeforeUserOptionsMenu');
$Name = $Session->User->Name;
$CountNotifications = $Session->User->CountNotifications;
if (is_numeric($CountNotifications) && $CountNotifications > 0) {
$Name .= wrap($CountNotifications);
}
echo anchor($Name, userUrl($Session->User), 'Profile');
echo anchor(t('Sign Out'), SignOutUrl(), 'Leave');
}
?>
</div>
</div>
<div id="Body">
<div id="Panel">
<?php
$this->RenderAsset('Panel');
?>
</div>
<div id="Content"><?php
$this->RenderAsset('Content');
?>
</div>
开发者ID:karanjitsingh,项目名称:iecse-forum,代码行数:31,代码来源:admin.master.php
示例10: t
echo t('Thumbnail');
?>
</td>
</tr>
</thead>
<tbody>
<tr>
<td><?php
echo $Picture;
if ($this->User->Photo != '' && $AllowImages && !$RemotePhoto) {
echo wrap(Anchor(t('Remove Picture'), CombinePaths(array(userUrl($this->User, '', 'removepicture'), $Session->TransientKey())), 'Button Danger PopConfirm'), 'p');
?>
</td>
<td><?php
echo $Thumbnail;
echo wrap(Anchor(t('Edit Thumbnail'), userUrl($this->User, '', 'thumbnail'), 'Button'), 'p');
}
?>
</td>
</tr>
</tbody>
</table>
</li>
<?php
}
?>
<li>
<p><?php
echo t('Select an image on your computer (2mb max)');
?>
</p>
开发者ID:karanjitsingh,项目名称:iecse-forum,代码行数:31,代码来源:picture.php
示例11: notifyWallPost
/**
*
*
* @param $WallPost
*/
protected function notifyWallPost($WallPost)
{
$NotifyUser = Gdn::userModel()->getID($WallPost['ActivityUserID']);
$Activity = array('ActivityType' => 'WallPost', 'ActivityUserID' => $WallPost['RegardingUserID'], 'Format' => $WallPost['Format'], 'NotifyUserID' => $WallPost['ActivityUserID'], 'RecordType' => 'Activity', 'RecordID' => $WallPost['ActivityID'], 'RegardingUserID' => $WallPost['ActivityUserID'], 'Route' => userUrl($NotifyUser, ''), 'Story' => $WallPost['Story'], 'HeadlineFormat' => t('HeadlineFormat.NotifyWallPost', '{ActivityUserID,User} posted on your <a href="{Url,url}">wall</a>.'));
$this->save($Activity, 'WallComment');
}
开发者ID:bahill,项目名称:vanilla,代码行数:11,代码来源:class.activitymodel.php
示例12: profileController_discussions_create
/**
* Creates virtual 'Discussions' method in ProfileController.
*
* @since 2.0.0
* @package Vanilla
*
* @param ProfileController $Sender ProfileController.
*/
public function profileController_discussions_create($Sender, $UserReference = '', $Username = '', $Page = '', $UserID = '')
{
$Sender->editMode(false);
// Tell the ProfileController what tab to load
$Sender->getUserInfo($UserReference, $Username, $UserID);
$Sender->_setBreadcrumbs(t('Discussions'), userUrl($Sender->User, '', 'discussions'));
$Sender->setTabView('Discussions', 'Profile', 'Discussions', 'Vanilla');
$Sender->CountCommentsPerPage = c('Vanilla.Comments.PerPage', 30);
list($Offset, $Limit) = offsetLimit($Page, c('Vanilla.Discussions.PerPage', 30));
$DiscussionModel = new DiscussionModel();
$Discussions = $DiscussionModel->getByUser($Sender->User->UserID, $Limit, $Offset, false, Gdn::session()->UserID);
$CountDiscussions = $Offset + $DiscussionModel->LastDiscussionCount + 1;
$Sender->DiscussionData = $Sender->setData('Discussions', $Discussions);
// Build a pager
$PagerFactory = new Gdn_PagerFactory();
$Sender->Pager = $PagerFactory->getPager('MorePager', $Sender);
$Sender->Pager->MoreCode = 'More Discussions';
$Sender->Pager->LessCode = 'Newer Discussions';
$Sender->Pager->ClientID = 'Pager';
$Sender->Pager->configure($Offset, $Limit, $CountDiscussions, userUrl($Sender->User, '', 'discussions') . '?page={Page}');
// Deliver JSON data if necessary
if ($Sender->deliveryType() != DELIVERY_TYPE_ALL && $Offset > 0) {
$Sender->setJson('LessRow', $Sender->Pager->toString('less'));
$Sender->setJson('MoreRow', $Sender->Pager->toString('more'));
$Sender->View = 'discussions';
}
// Set the HandlerType back to normal on the profilecontroller so that it fetches it's own views
$Sender->HandlerType = HANDLER_TYPE_NORMAL;
// Do not show discussion options
$Sender->ShowOptions = false;
if ($Sender->Head) {
// These pages offer only duplicate content to search engines and are a bit slow.
$Sender->Head->addTag('meta', array('name' => 'robots', 'content' => 'noindex,noarchive'));
}
// Render the ProfileController
$Sender->render();
}
开发者ID:vanilla,项目名称:vanilla,代码行数:45,代码来源:class.hooks.php
示例13: activityHeadline
/**
* The ActivityType table has some special sprintf search/replace values in the
* FullHeadline and ProfileHeadline fields. The ProfileHeadline field is to be
* used on this page (the user profile page). The FullHeadline field is to be
* used on the main activity page. The replacement definitions are as follows:
* %1$s = ActivityName
* %2$s = ActivityName Possessive
* %3$s = RegardingName
* %4$s = RegardingName Possessive
* %5$s = Link to RegardingName's Wall
* %6$s = his/her
* %7$s = he/she
* %8$s = route & routecode
* %9$s = gender suffix (some languages require this).
*
* @param object $Activity An object representation of the activity being formatted.
* @param int $ProfileUserID If looking at a user profile, this is the UserID of the profile we are
* looking at.
* @return string
*/
public static function activityHeadline($Activity, $ProfileUserID = '', $ViewingUserID = '')
{
$Activity = (object) $Activity;
if ($ViewingUserID == '') {
$Session = Gdn::session();
$ViewingUserID = $Session->isValid() ? $Session->UserID : -1;
}
$GenderSuffixCode = 'First';
$GenderSuffixGender = $Activity->ActivityGender;
if ($ViewingUserID == $Activity->ActivityUserID) {
$ActivityName = $ActivityNameP = T('You');
} else {
$ActivityName = $Activity->ActivityName;
$ActivityNameP = FormatPossessive($ActivityName);
$GenderSuffixCode = 'Third';
}
if ($ProfileUserID != $Activity->ActivityUserID) {
// If we're not looking at the activity user's profile, link the name
$ActivityNameD = urlencode($Activity->ActivityName);
$ActivityName = Anchor($ActivityName, UserUrl($Activity, 'Activity'));
$ActivityNameP = Anchor($ActivityNameP, UserUrl($Activity, 'Activity'));
$GenderSuffixCode = 'Third';
}
$Gender = t('their');
//TODO: this isn't preferable but I don't know a better option
$Gender2 = t('they');
//TODO: this isn't preferable either
if ($Activity->ActivityGender == 'm') {
$Gender = t('his');
$Gender2 = t('he');
} elseif ($Activity->ActivityGender == 'f') {
$Gender = t('her');
$Gender2 = t('she');
}
if ($ViewingUserID == $Activity->RegardingUserID || $Activity->RegardingUserID == '' && $Activity->ActivityUserID == $ViewingUserID) {
$Gender = $Gender2 = t('your');
}
$IsYou = false;
if ($ViewingUserID == $Activity->RegardingUserID) {
$IsYou = true;
$RegardingName = t('you');
$RegardingNameP = t('your');
$GenderSuffixGender = $Activity->RegardingGender;
} else {
$RegardingName = $Activity->RegardingName == '' ? T('somebody') : $Activity->RegardingName;
$RegardingNameP = formatPossessive($RegardingName);
if ($Activity->ActivityUserID != $ViewingUserID) {
$GenderSuffixCode = 'Third';
}
}
$RegardingWall = '';
$RegardingWallLink = '';
if ($Activity->ActivityUserID == $Activity->RegardingUserID) {
// If the activityuser and regardinguser are the same, use the $Gender Ref as the RegardingName
$RegardingName = $RegardingProfile = $Gender;
$RegardingNameP = $RegardingProfileP = $Gender;
} elseif ($Activity->RegardingUserID > 0 && $ProfileUserID != $Activity->RegardingUserID) {
// If there is a regarding user and we're not looking at his/her profile, link the name.
$RegardingNameD = urlencode($Activity->RegardingName);
if (!$IsYou) {
$RegardingName = anchor($RegardingName, userUrl($Activity, 'Regarding'));
$RegardingNameP = anchor($RegardingNameP, userUrl($Activity, 'Regarding'));
$GenderSuffixCode = 'Third';
$GenderSuffixGender = $Activity->RegardingGender;
}
$RegardingWallActivityPath = userUrl($Activity, 'Regarding');
$RegardingWallLink = url($RegardingWallActivityPath);
$RegardingWall = anchor(T('wall'), $RegardingWallActivityPath);
}
if ($RegardingWall == '') {
$RegardingWall = t('wall');
}
if ($Activity->Route == '') {
$ActivityRouteLink = '';
if ($Activity->RouteCode) {
$Route = t($Activity->RouteCode);
} else {
$Route = '';
}
} else {
//.........这里部分代码省略.........
开发者ID:ringoma,项目名称:vanilla,代码行数:101,代码来源:class.format.php
示例14: siteNavModule_profile_handler
/**
*
*
* @param SiteNavModule $sender
*/
public function siteNavModule_profile_handler($sender)
{
$user = Gdn::controller()->data('Profile');
$user_id = val('UserID', $user);
// Show the activity.
if (c('Garden.Profile.ShowActivities', true)) {
$sender->addLink('main.activity', array('text' => t('Activity'), 'url' => userUrl($user, '', 'activity'), 'icon' => icon('time')));
}
// Display the notifications for the current user.
if (Gdn::controller()->data('Profile.UserID') == Gdn::session()->UserID) {
$sender->addLink('main.notifications', array('text' => t('Notifications'), 'url' => userUrl($user, '', 'notifications'), 'icon' => icon('globe'), 'badge' => Gdn::controller()->data('Profile.CountNotifications')));
}
// Show the invitations if we're using the invite registration method.
if (strcasecmp(c('Garden.Registration.Method'), 'invitation') === 0) {
$sender->addLink('main.invitations', array('text' => t('Invitations'), 'url' => userUrl($user, '', 'invitations'), 'icon' => icon('ticket')));
}
// Users can edit their own profiles and moderators can edit any profile.
if (hasEditProfile($user_id)) {
$sender->addLink('main.editprofile', array('text' => t('Edit Profile'), 'url' => userUrl($user, '', 'edit'), 'icon' => icon('edit')));
}
// Add a stub group for moderation.
$sender->addGroup('moderation', array('text' => t('Moderation'), 'sort' => 90));
}
开发者ID:R-J,项目名称:vanilla,代码行数:28,代码来源:class.hooks.php
示例15: foreach
<?php
if (!defined('APPLICATION')) {
exit;
}
$Alt = false;
$Session = Gdn::session();
$EditUser = $Session->checkPermission('Garden.Users.Edit');
$DeleteUser = $Session->checkPermission('Garden.Users.Delete');
$ViewPersonalInfo = $Session->checkPermission('Garden.PersonalInfo.View');
foreach ($this->UserData->result() as $User) {
$Alt = !$Alt;
$userBlock = new MediaItemModule(val('Name', $User), userUrl($User));
$userBlock->setView('media-sm')->setImage(userPhotoUrl($User))->addMetaIf($ViewPersonalInfo, Gdn_Format::email($User->Email));
?>
<tr id="<?php
echo "UserID_{$User->UserID}";
?>
"<?php
echo $Alt ? ' class="Alt"' : '';
?>
data-userid="<?php
echo $User->UserID;
?>
">
<!-- <td class="CheckboxCell"><input type="checkbox" name="LogID[]" value="<?php
echo $User->UserID;
?>
" /></td>-->
<td>
<?php
开发者ID:vanilla,项目名称:vanilla,代码行数:31,代码来源:users.php
示例16: img
echo $this->Form->open(array('enctype' => 'multipart/form-data', 'class' => 'js-change-picture-form'));
echo $this->Form->errors();
if ($this->data('crop') && $allowImages) {
echo $this->data('crop');
} else {
?>
<div class="avatars">
<div class="Padded current-avatar">
<?php
echo img($this->data('avatar'), array('style' => 'width: ' . c('Garden.Thumbnail.Size') . 'px; height: ' . c('Garden.Thumbnail.Size') . 'px;'));
?>
</div>
</div>
<?php
}
?>
<div class="DismissMessage WarningMessage"><?php
echo t('By uploading a file you certify that you have the right to distribute this picture and that it does not violate the Terms of Service.');
?>
</div>
<div class="js-new-avatar Button change-picture-new" style="margin-bottom: 20px;"><?php
echo t('Upload New Picture');
?>
</div>
<?php
echo $this->Form->input('Avatar', 'file', array('class' => 'js-new-avatar-upload Hidden'));
if ($this->data('crop')) {
echo anchor(t('Remove Picture'), userUrl($this->User, '', 'removepicture') . '?tk=' . Gdn::session()->TransientKey() . '&deliveryType=' . $this->deliveryType(), 'Button Danger PopConfirm change-picture-remove');
}
echo $this->Form->close();
echo '</div>';
开发者ID:vanilla,项目名称:vanilla,代码行数:31,代码来源:picture.php
示例17: deleteContent
/**
*
*
* @param $UserID
* @throws Exception
*/
public function deleteContent($UserID)
{
$this->permission('Garden.Moderation.Manage');
$User = Gdn::userModel()->getID($UserID);
if (!$User) {
throw notFoundException('User');
}
if ($this->Form->authenticatedPostBack()) {
Gdn::userModel()->deleteContent($UserID, array('Log' => true));
if ($this->Request->get('Target')) {
$this->RedirectUrl = url($this->Request->get('Target'));
} else {
$this->RedirectUrl = url(userUrl($User));
}
} else {
$this->setData('Title', t('Are you sure you want to do this?'));
}
$this->setData('User', $User);
$this->render();
}
开发者ID:mcnasby,项目名称:datto-vanilla,代码行数:26,代码来源:class.usercontroller.php
示例18: siteNavModule_init_handler
/**
*
*
* @param SiteNavModule $sender
*/
public function siteNavModule_init_handler($sender)
{
// GLOBALS
// Add a link to the community home.
$sender->addLinkToGlobals(t('Community Home'), '/', 'main.home', '', -100, array('icon' => 'home'), false);
$sender->addGroupToGlobals('', 'etc', '', 100);
$sender->addLinkToGlobalsIf(Gdn::session()->isValid() && IsMobile(), t('Full Site'), '/profile/nomobile', 'etc.nomobile', '', 100, array('icon' => 'resize-full'));
$sender->addLinkToGlobalsIf(Gdn::session()->isValid(), t('Sign Out'), SignOutUrl(), 'etc.signout', '', 100, array('icon' => 'signout'));
$sender->addLinkToGlobalsIf(!Gdn::session()->isValid(), t('Sign In'), SigninUrl(), 'etc.signin', '', 100, array('icon' => 'signin'));
// DEFAULTS
if (!Gdn::session()->isValid()) {
return;
}
$sender->addLinkIf(Gdn::session()->isValid(), t('Profile'), '/profile', 'main.profile', 'profile', 10, array('icon' => 'user'))->addLinkIf('Garden.Activity.View', t('Activity'), '/activity', 'main.activity', 'activity', 10, array('icon' => 'time'));
// Add the moderation items.
$sender->addGroup(t('Moderation'), 'moderation', 'moderation', 90);
if (Gdn::session()->checkPermission('Garden.Users.Approve')) {
$RoleModel = new RoleModel();
$applicant_count = (int) $RoleModel->getApplicantCount();
if ($applicant_count > 0 || true) {
$sender->addLink(t('Applicants'), '/user/applicants', 'moderation.applicants', 'applicants', array(), array('icon' => 'user', 'badge' => $applicant_count));
}
}
$sender->addLinkIf('Garden.Moderation.Manage', t('Spam Queue'), '/log/spam', 'moderation.spam', 'spam', array(), array('icon' => 'spam'))->addLinkIf('Garden.Settings.Manage', t('Dashboard'), '/settings', 'etc.dashboard', 'dashboard', array(), array('icon' => 'dashboard'));
$user = Gdn::controller()->data('Profile');
$user_id = val('UserID', $user);
//EDIT PROFILE SECTION
// Users can edit their own profiles and moderators can edit any profile.
$sender->addLinkToSectionIf(hasEditProfile($user_id), 'EditProfile', t('Profile'), userUrl($user, '', 'edit'), 'main.editprofile', '', array(), array('icon' => 'edit'))->addLinkToSectionIf('Garden.Users.Edit', 'EditProfile', t('Edit Account'), '/user/edit/' . $user_id, 'main.editaccount', 'Popup', array(), array('icon' => 'cog'))->addLinkToSection('EditProfile', t('Back to Profile'), userUrl($user), 'main.profile', '', 100, array('icon' => 'arrow-left'));
//PROFILE SECTION
$sender->addLinkToSectionIf(c('Garden.Profile.ShowActivities', true), 'Profile', t('Activity'), userUrl($user, '', 'activity'), 'main.activity', '', array(), array('icon' => 'time'))->addLinkToSectionIf(Gdn::controller()->data('Profile.UserID') == Gdn::session()->UserID, 'Profile', t('Notifications'), userUrl($user, '', 'notifications'), 'main.notifications', '', array(), array('icon' => 'globe', 'badge' => Gdn::controller()->data('Profile.CountNotifications')))->addLinkToSectionIf(strcasecmp(c('Garden.Registration.Method'), 'invitation') === 0, 'Profile', t('Invitations'), userUrl($user, '', 'invitations'), 'main.invitations', '', array(), array('icon' => 'ticket'))->addLinkToSectionIf(hasEditProfile($user_id), 'Profile', t('Edit Profile'), userUrl($user, '', 'edit'), 'Profile', 'main.editprofile', '', array(), array('icon' => 'edit'));
}
开发者ID:vanilla,项目名称:vanilla,代码行数:37,代码来源:class.hooks.php
示例19: buildProfile
/**
* Build the user profile.
*
* Set the page title, add data to page modules, add modules to assets,
* add tabs to tab menu. $this->User must be defined, or this method will throw an exception.
*
* @since 2.0.0
* @access public
* @return bool Always true.
*/
public function buildProfile()
{
if (!is_object($this->User)) {
throw new Exception(t('Cannot build profile information if user is not defined.'));
}
$Session = Gdn::session();
if (strpos($this->CssClass, 'Profile') === false) {
$this->CssClass .= ' Profile';
}
$this->title(Gdn_Format::text($this->User->Name));
if ($this->_DeliveryType != DELIVERY_TYPE_VIEW) {
// Javascript needed
// see note above about jcrop
$this->addJsFile('jquery.jcrop.min.js');
$this->addJsFile('profile.js');
$this->addJsFile('jquery.gardenmorepager.js');
$this->addJsFile('activity.js');
// Build activity URL
$ActivityUrl = 'profile/activity/';
if ($this->User->UserID != $Session->UserID) {
$ActivityUrl = userUrl($this->User, '', 'activity');
}
// Show activity?
if (c('Garden.Profile.ShowActivities', true)) {
$this->addProfileTab(t('Activity'), $ActivityUrl, 'Activity', sprite('SpActivity') . ' ' . t('Activity'));
}
// Show notifications?
if ($this->User->UserID == $Session->UserID) {
$Notifications = t('Notifications');
$NotificationsHtml = sprite('SpNotifications') . ' ' . $Notifications;
$CountNotifications = $Session->User->CountNotifications;
if (is_numeric($CountNotifications) && $CountNotifications > 0) {
$NotificationsHtml .= ' <span class="Aside"><span class="Count">' . $CountNotifications . '</span></span>';
}
$this->addProfileTab($Notifications, 'profile/notifications', 'Notifications', $NotificationsHtml);
}
// Show invitations?
if (c('Garden.Registration.Method') == 'Invitation') {
$this->addProfileTab(t('Invitations'), 'profile/invitations', 'InvitationsLink', sprite('SpInvitations') . ' ' . t('Invitations'));
}
$this->fireEvent('AddProfileTabs');
}
return true;
}
开发者ID:korelstar,项目名称:vanilla,代码行数:54,代码来源:class.profilecontroller.php
示例20: processContent
/**
* Pre-process content into a uniform format for output
*
* @param Array $content By reference
*/
protected function processContent(&$content)
{
foreach ($content as &$item) {
$contentType = val('RecordType', $item);
$userID = val('InsertUserID', $item);
$itemProperties = array();
$itemFields = array('DiscussionID', 'DateInserted', 'DateUpdated', 'Body', 'Format', 'RecordType', 'Url', 'CategoryID', 'CategoryName', 'CategoryUrl');
switch (strtolower($contentType)) {
case 'comment':
$itemFields = array_merge($itemFields, array('CommentID'));
// Comment specific
$itemProperties['Name'] = sprintf(t('Re: %s'), valr('Discussion.Name', $item, val('Name', $item)));
$url = CommentUrl($item);
break;
case 'discussion':
$itemFields = array_merge($itemFields, array('Name', 'Type'));
$url = DiscussionUrl($item);
break;
}
$item['Url'] = $url;
if ($categoryId = val('CategoryID', $item)) {
$category = CategoryModel::categories($categoryId);
$item['CategoryName'] = val('Name', $category);
$item['CategoryUrl'] = CategoryUrl($category);
}
$itemFields = array_fill_keys($itemFields, true);
$filteredItem = array_intersect_key($item, $itemFields);
$itemProperties = array_merge($itemProperties, $filteredItem);
$item = $itemProperties;
// Attach User
$userFields = array('UserID', 'Name', 'Title', 'Location', 'PhotoUrl', 'RankName', 'Url', 'Roles', 'RoleNames');
$user = Gdn::userModel()->getID($userID);
$roleModel = new RoleModel();
$roles = $roleModel->GetByUserID($userID)->resultArray();
$roleNames = '';
foreach ($roles as $role) {
$roleNames[] = val('Name', $role);
}
// check
$rankName = null;
if (class_exists('RankModel')) {
$rankName = val('Name', RankModel::Ranks(val('RankID', $user)), null);
}
$userProperties = array('Url' => url(userUrl($user), true), 'PhotoUrl' => UserPhotoUrl($user), 'RankName' => $rankName, 'RoleNames' => $roleNames, 'CssClass' => val('_CssClass', $user));
$user = (array) $user;
$userFields = array_fill_keys($userFields, true);
$filteredUser = array_intersect_key($user, $userFields);
$userProperties = array_merge($filteredUser, $userProperties);
$item['Author'] = $userProperties;
}
}
开发者ID:caidongyun,项目名称:vanilla,代码行数:56,代码来源:class.promotedcontentmodule.php
注:本文中的userUrl函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论