PHP Class ProfileController, vanilla

Inheritance: extends BaseController
Exibir arquivo Open project: vanilla/vanilla Class Usage Examples

Public Properties

Property Type Description
$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 Properties

Property Type Description
$_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.

Public Methods

Method Description
__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.

Protected Methods

Method Description
_removeEmailFilter ( $Value )
_removeEmailPreferences ( $Data )

Private Methods

Method Description
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.

Method Details

__construct() public method

Prep properties.
Since: 2.0.0
public __construct ( )

_removeEmailFilter() protected static method

protected static _removeEmailFilter ( $Value )

_removeEmailPreferences() protected static method

protected static _removeEmailPreferences ( $Data )

_setBreadcrumbs() public method

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

activity() public method

Show activity feed for this user.
Since: 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() public method

Adds a tab (or array of tabs) to the profile tab collection ($this->ProfileTabs).
Since: 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() public method

Adds the option menu to the panel asset.
Since: 2.0.0
public addSideMenu ( string $CurrentUrl = '' )
$CurrentUrl string Path to highlight.

buildEditMenu() public method

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

buildProfile() public method

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
public buildProfile ( ) : boolean
return boolean Always true.

clear() public method

Clear user's current status message.
Since: 2.0.0
public clear ( mixed $UserID = '' )
$UserID mixed

connections() public method

Lists the connections to other sites.
Since: 2.1
public connections ( integer | string $UserReference = '', string $Username = '' )
$UserReference integer | string
$Username string

count() public method

Generic way to get count via UserModel->ProfileCount().
Since: 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() public method

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

disconnect() public method

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

edit() public method

Edit user account.
Since: 2.0.0
public edit ( mixed $UserReference = '', $Username = '', $UserID = '' )
$UserReference mixed Username or User ID.

editMode() public method

public editMode ( $Switch )

get() public method

Render basic data about user.
Since: 2.0.?
public get ( integer $UserID = false )
$UserID integer Unique ID.

getProfileUrl() public method

public getProfileUrl ( string | integer | null $UserReference = null, integer | null $UserID = null ) : string
$UserReference string | integer | null
$UserID integer | null
return string

getUserInfo() public method

Retrieve the user to be manipulated. Defaults to current user.
Since: 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.
return boolean Always true.

index() public method

If current user's profile, get notifications. Otherwise show their activity (if available) or discussions.
Since: 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() public method

Adds JS, CSS, & modules. Automatically run on every use.
Since: 2.0.0
public initialize ( )

invitations() public method

Manage current user's invitations.
Since: 2.0.0
public invitations ( $UserReference = '', $Username = '', $UserID = '' )

multi() public method

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

noMobile() public method

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() public method

Show notifications for current user.
Since: 2.0.0
public notifications ( integer $Page = false )
$Page integer Number to skip (paging).

notificationsPopin() public method

public notificationsPopin ( )

password() public method

Set new password for current user.
Since: 2.0.0
public password ( )

picture() public method

Set user's photo (avatar).
Since: 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() public method

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

preferences() public method

Edit user's preferences (mostly notification settings).
Since: 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() public method

Build URL to user's profile.
Since: 2.0.0
public profileUrl ( mixed $UserReference = null, string $UserID = null ) : string
$UserReference mixed Unique identifier, possibly username or ID.
$UserID string Unique ID.
return string Relative URL path.

removePicture() public method

Remove the user's photo.
Since: 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() public method

Let user send an invitation.
Since: 2.0.0
public sendInvite ( integer $InvitationID = '' )
$InvitationID integer Unique identifier.

setTabView() public method

Define & select the current tab in the tab menu. Sets $this->_CurrentTab.
Since: 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() public method

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

uninvite() public method

Revoke an invitation.
Since: 2.0.0
public uninvite ( integer $InvitationID )
$InvitationID integer Unique identifier.

Property Details

$CanEditPhotos public_oe property

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

$CurrentTab public_oe property

Name of current tab.
public $CurrentTab

$EditMode public_oe property

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

$Form public_oe property

public Gdn_Form $Form
return Gdn_Form

$ProfileTabs public_oe property

List of available tabs.
public $ProfileTabs

$User public_oe property

User data to use in building profile.
public $User

$Uses public_oe property

Models to automatically instantiate.
public $Uses

$_TabApplication protected_oe property

Application for current tab.
protected $_TabApplication

$_TabController protected_oe property

Controller for current tab.
protected $_TabController

$_TabView protected_oe property

View for current tab.
protected $_TabView

$_UserInfoRetrieved protected_oe property

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