PHP Класс ProfileController, vanilla

Наследование: extends BaseController
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$CanEditPhotos Can the current user edit the profile user's photo?
$CurrentTab Name of current tab.
$EditMode Is the page in "edit" mode or not.
$Form Gdn_Form
$ProfileTabs List of available tabs.
$User User data to use in building profile.
$Uses Models to automatically instantiate.

Защищенные свойства (Protected)

Свойство Тип Описание
$_TabApplication Application for current tab.
$_TabController Controller for current tab.
$_TabView View for current tab.
$_UserInfoRetrieved Whether data has been stored in $this->User yet.

Открытые методы

Метод Описание
__construct ( ) Prep properties.
_setBreadcrumbs ( $Name = null, $Url = null )
activity ( mixed $UserReference = '', string $Username = '', integer $UserID = '', $Page = '' ) Show activity feed for this user.
addProfileTab ( mixed $TabName, string $TabUrl = '', string $CssClass = '', string $TabHtml = '' ) Adds a tab (or array of tabs) to the profile tab collection ($this->ProfileTabs).
addSideMenu ( string $CurrentUrl = '' ) Adds the option menu to the panel asset.
buildEditMenu ( SideMenuModule &$Module, string $CurrentUrl = '' )
buildProfile ( ) : boolean Build the user profile.
clear ( mixed $UserID = '' ) Clear user's current status message.
connections ( integer | string $UserReference = '', string $Username = '' ) Lists the connections to other sites.
count ( string $Column, integer $UserID = false ) Generic way to get count via UserModel->ProfileCount().
deleteInvitation ( integer $InvitationID ) Delete an invitation that has already been accepted.
disconnect ( string $UserReference = '', string $Username = '', $Provider )
edit ( mixed $UserReference = '', $Username = '', $UserID = '' ) Edit user account.
editMode ( $Switch )
get ( integer $UserID = false ) Render basic data about user.
getProfileUrl ( string | integer | null $UserReference = null, integer | null $UserID = null ) : string
getUserInfo ( $UserReference = '', string $Username = '', integer $UserID = '', boolean $CheckPermissions = false ) : boolean Retrieve the user to be manipulated. Defaults to current user.
index ( mixed $User = '', string $Username = '', integer $UserID = '', $Page = false ) Default profile page.
initialize ( ) Adds JS, CSS, & modules. Automatically run on every use.
invitations ( $UserReference = '', $Username = '', $UserID = '' ) Manage current user's invitations.
multi ( type $UserID ) Fetch multiple users
noMobile ( string $type = 'desktop' ) Set 'NoMobile' cookie for current user to prevent use of mobile theme.
notifications ( integer $Page = false ) Show notifications for current user.
notificationsPopin ( )
password ( ) Set new password for current user.
picture ( mixed $userReference = '', string $username = '', string $userID = '' ) Set user's photo (avatar).
preference ( string $Key = false ) Gets or sets a user's preference. This method is meant for ajax calls.
preferences ( mixed $UserReference = '', string $Username = '', integer $UserID = '' ) Edit user's preferences (mostly notification settings).
profileUrl ( mixed $UserReference = null, string $UserID = null ) : string Build URL to user's profile.
removePicture ( mixed $UserReference = '', string $Username = '', string $tk = '', $deliveryType = '' ) Remove the user's photo.
sendInvite ( integer $InvitationID = '' ) Let user send an invitation.
setTabView ( string $CurrentTab, string $View = '', string $Controller = 'Profile', string $Application = 'Dashboard' ) Define & select the current tab in the tab menu. Sets $this->_CurrentTab.
thumbnail ( mixed $UserReference = '', string $Username = '' ) Set user's thumbnail (crop & center photo).
uninvite ( integer $InvitationID ) Revoke an invitation.

Защищенные методы

Метод Описание
_removeEmailFilter ( $Value )
_removeEmailPreferences ( $Data )

Приватные методы

Метод Описание
deleteAvatars ( string $avatar = '' ) Deletes uploaded avatars in the profile size format.
isUploadedAvatar ( string $avatar ) : boolean Test whether a path is a full url, which gives us an indication whether it's an upload or not.
saveAvatars ( string $source, array $thumbOptions, Gdn_UploadImage | null $upload = null ) : boolean Saves the avatar to /uploads in two sizes: p* : The profile-sized image, which is constrained by Garden.Profile.MaxWidth and Garden.Profile.MaxHeight.

Описание методов

__construct() публичный Метод

Prep properties.
С версии: 2.0.0
public __construct ( )

_removeEmailFilter() защищенный статический Метод

protected static _removeEmailFilter ( $Value )

_removeEmailPreferences() защищенный статический Метод

protected static _removeEmailPreferences ( $Data )

_setBreadcrumbs() публичный Метод

public _setBreadcrumbs ( $Name = null, $Url = null )

activity() публичный Метод

Show activity feed for this user.
С версии: 2.0.0
public activity ( mixed $UserReference = '', string $Username = '', integer $UserID = '', $Page = '' )
$UserReference mixed Unique identifier, possible ID or username.
$Username string Username.
$UserID integer Unique ID.

addProfileTab() публичный Метод

Adds a tab (or array of tabs) to the profile tab collection ($this->ProfileTabs).
С версии: 2.0.0
public addProfileTab ( mixed $TabName, string $TabUrl = '', string $CssClass = '', string $TabHtml = '' )
$TabName mixed Tab name (or array of tab names) to add to the profile tab collection.
$TabUrl string URL the tab should point to.
$CssClass string Class property to apply to tab.
$TabHtml string Overrides tab's HTML.

addSideMenu() публичный Метод

Adds the option menu to the panel asset.
С версии: 2.0.0
public addSideMenu ( string $CurrentUrl = '' )
$CurrentUrl string Path to highlight.

buildEditMenu() публичный Метод

public buildEditMenu ( SideMenuModule &$Module, string $CurrentUrl = '' )
$Module SideMenuModule
$CurrentUrl string

buildProfile() публичный Метод

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.
С версии: 2.0.0
public buildProfile ( ) : boolean
Результат boolean Always true.

clear() публичный Метод

Clear user's current status message.
С версии: 2.0.0
public clear ( mixed $UserID = '' )
$UserID mixed

connections() публичный Метод

Lists the connections to other sites.
С версии: 2.1
public connections ( integer | string $UserReference = '', string $Username = '' )
$UserReference integer | string
$Username string

count() публичный Метод

Generic way to get count via UserModel->ProfileCount().
С версии: 2.0.?
public count ( string $Column, integer $UserID = false )
$Column string Name of column to count for this user.
$UserID integer Defaults to current session.

deleteInvitation() публичный Метод

Delete an invitation that has already been accepted.
public deleteInvitation ( integer $InvitationID )
$InvitationID integer

disconnect() публичный Метод

public disconnect ( string $UserReference = '', string $Username = '', $Provider )
$UserReference string
$Username string
$Provider

edit() публичный Метод

Edit user account.
С версии: 2.0.0
public edit ( mixed $UserReference = '', $Username = '', $UserID = '' )
$UserReference mixed Username or User ID.

editMode() публичный Метод

public editMode ( $Switch )

get() публичный Метод

Render basic data about user.
С версии: 2.0.?
public get ( integer $UserID = false )
$UserID integer Unique ID.

getProfileUrl() публичный Метод

public getProfileUrl ( string | integer | null $UserReference = null, integer | null $UserID = null ) : string
$UserReference string | integer | null
$UserID integer | null
Результат string

getUserInfo() публичный Метод

Retrieve the user to be manipulated. Defaults to current user.
С версии: 2.0.0
public getUserInfo ( $UserReference = '', string $Username = '', integer $UserID = '', boolean $CheckPermissions = false ) : boolean
$Username string .
$UserID integer Unique ID.
$CheckPermissions boolean Whether or not to check user permissions.
Результат boolean Always true.

index() публичный Метод

If current user's profile, get notifications. Otherwise show their activity (if available) or discussions.
С версии: 2.0.0
public index ( mixed $User = '', string $Username = '', integer $UserID = '', $Page = false )
$User mixed Unique identifier, possible ID or username.
$Username string .
$UserID integer Unique ID.

initialize() публичный Метод

Adds JS, CSS, & modules. Automatically run on every use.
С версии: 2.0.0
public initialize ( )

invitations() публичный Метод

Manage current user's invitations.
С версии: 2.0.0
public invitations ( $UserReference = '', $Username = '', $UserID = '' )

multi() публичный Метод

Note: API only
public multi ( type $UserID )
$UserID type

noMobile() публичный Метод

Set 'NoMobile' cookie for current user to prevent use of mobile theme.
public noMobile ( string $type = 'desktop' )
$type string The type of mobile device. This can be one of the following: - desktop: Force the desktop theme. - mobile: Force the mobile theme. - tablet: Force the tablet theme (desktop). - app: Force the app theme (app). - 1: Unset the force cookie and use the user agent to determine the theme.

notifications() публичный Метод

Show notifications for current user.
С версии: 2.0.0
public notifications ( integer $Page = false )
$Page integer Number to skip (paging).

notificationsPopin() публичный Метод

public notificationsPopin ( )

password() публичный Метод

Set new password for current user.
С версии: 2.0.0
public password ( )

picture() публичный Метод

Set user's photo (avatar).
С версии: 2.0.0
public picture ( mixed $userReference = '', string $username = '', string $userID = '' )
$userReference mixed Unique identifier, possible username or ID.
$username string The username.
$userID string The user's ID.

preference() публичный Метод

Gets or sets a user's preference. This method is meant for ajax calls.
С версии: 2.1
public preference ( string $Key = false )
$Key string The name of the preference.

preferences() публичный Метод

Edit user's preferences (mostly notification settings).
С версии: 2.0.0
public preferences ( mixed $UserReference = '', string $Username = '', integer $UserID = '' )
$UserReference mixed Unique identifier, possibly username or ID.
$Username string .
$UserID integer Unique identifier.

profileUrl() публичный Метод

Build URL to user's profile.
С версии: 2.0.0
public profileUrl ( mixed $UserReference = null, string $UserID = null ) : string
$UserReference mixed Unique identifier, possibly username or ID.
$UserID string Unique ID.
Результат string Relative URL path.

removePicture() публичный Метод

Remove the user's photo.
С версии: 2.0.0
public removePicture ( mixed $UserReference = '', string $Username = '', string $tk = '', $deliveryType = '' )
$UserReference mixed Unique identifier, possibly username or ID.
$Username string .
$tk string Security token.

sendInvite() публичный Метод

Let user send an invitation.
С версии: 2.0.0
public sendInvite ( integer $InvitationID = '' )
$InvitationID integer Unique identifier.

setTabView() публичный Метод

Define & select the current tab in the tab menu. Sets $this->_CurrentTab.
С версии: 2.0.0
public setTabView ( string $CurrentTab, string $View = '', string $Controller = 'Profile', string $Application = 'Dashboard' )
$CurrentTab string Name of tab to highlight.
$View string View name. Defaults to index.
$Controller string Controller name. Defaults to Profile.
$Application string Application name. Defaults to Dashboard.

thumbnail() публичный Метод

Set user's thumbnail (crop & center photo).
С версии: 2.0.0
public thumbnail ( mixed $UserReference = '', string $Username = '' )
$UserReference mixed Unique identifier, possible username or ID.
$Username string .

uninvite() публичный Метод

Revoke an invitation.
С версии: 2.0.0
public uninvite ( integer $InvitationID )
$InvitationID integer Unique identifier.

Описание свойств

$CanEditPhotos публичное свойство

Can the current user edit the profile user's photo?
public $CanEditPhotos

$CurrentTab публичное свойство

Name of current tab.
public $CurrentTab

$EditMode публичное свойство

Is the page in "edit" mode or not.
public $EditMode

$Form публичное свойство

public Gdn_Form $Form
Результат Gdn_Form

$ProfileTabs публичное свойство

List of available tabs.
public $ProfileTabs

$User публичное свойство

User data to use in building profile.
public $User

$Uses публичное свойство

Models to automatically instantiate.
public $Uses

$_TabApplication защищенное свойство

Application for current tab.
protected $_TabApplication

$_TabController защищенное свойство

Controller for current tab.
protected $_TabController

$_TabView защищенное свойство

View for current tab.
protected $_TabView

$_UserInfoRetrieved защищенное свойство

Whether data has been stored in $this->User yet.
protected $_UserInfoRetrieved