PHP Class Backend\Modules\Profiles\Engine\Model

Author: Dieter Vanden Eynde ([email protected])
Author: Jeroen Desloovere ([email protected])
Show file Open project: forkcms/forkcms Class Usage Examples

Protected Properties

Property Type Description
$avatars Cache avatars

Public Methods

Method Description
delete ( mixed $ids ) Delete the given profiles.
deleteGroup ( integer $id ) Delete a profile group.
deleteProfileGroup ( integer $id ) Delete a membership of a profile in a group.
deleteSession ( integer $id ) Delete a sessions of a profile.
exists ( integer $id ) : boolean Check if a profile exists.
existsByEmail ( string $email, integer $id = null ) : boolean Check if a profile exists by email address.
existsDisplayName ( string $displayName, integer $id = null ) : boolean Check if a display name exists.
existsGroup ( integer $id ) : boolean Check if a group exists.
existsGroupName ( string $groupName, integer $id = null ) : boolean Check if a group name exists.
existsProfileGroup ( integer $id ) : boolean Check if a profile is in a group.
get ( integer $id ) : array Get information about a profile.
getAvatar ( integer $id, string $email = null ) : string Get avatar
getByEmail ( string $email ) : array Get information about a profile, by email
getEncryptedString ( string $string, string $salt ) : string Encrypt a string with a salt.
getGroup ( integer $id ) : array Get information about a profile group.
getGroups ( ) : array Get the list of all groups as array($groupId => $groupName).
getGroupsForDropDown ( integer $profileId, integer $includeId = null ) : array Get profile groups for dropdown not yet linked to a profile
getProfileGroup ( integer $id ) : array Get information about a profile group where a user is member of.
getProfileGroups ( integer $id ) : array Get the groups where a profile is member of.
getRandomString ( integer $length = 15, boolean $numeric = true, boolean $lowercase = true, boolean $uppercase = true, boolean $special = true ) : string Generate a random string.
getSetting ( integer $id, string $name ) : string Get a setting for a profile.
getStatusForDropDown ( ) : array Fetch the list of status, but for a dropdown.
getUrl ( string $displayName, integer $id = null ) : string Retrieve a unique URL for a profile based on the display name.
getUser ( integer $id ) : string Get the HTML for a user to use in a datagrid
importCsv ( array $data, null $groupId = null, boolean $overwriteExisting = false ) : array Import CSV data
insert ( array $values ) : integer Insert a new profile.
insertGroup ( array $values ) : integer Insert a new group.
insertProfileGroup ( array $values ) : integer Add a profile to a group.
notifyAdmin ( array $values, string $templatePath = null ) Notify admin - after adding profile to profiles module
notifyProfile ( array $values, boolean $forUpdate = false, string $templatePath = null ) Notify profile - after adding profile to profiles module
setSetting ( integer $id, string $name, mixed $value ) Insert or update a single profile setting.
update ( integer $id, array $values ) : integer Update a profile.
updateGroup ( integer $id, array $values ) : integer Update a profile group.
updateProfileGroup ( integer $id, array $values ) : integer Update a membership of a profile in a group.

Protected Methods

Method Description
sendMail ( string $subject, string $templatePath = null, array $variables, string $toEmail, string $toDisplayName = null ) Send mail

Method Details

delete() public static method

Delete the given profiles.
public static delete ( mixed $ids )
$ids mixed One ID, or an array of IDs.

deleteGroup() public static method

Delete a profile group.
public static deleteGroup ( integer $id )
$id integer Id of the group.

deleteProfileGroup() public static method

Delete a membership of a profile in a group.
public static deleteProfileGroup ( integer $id )
$id integer Id of the membership.

deleteSession() public static method

Delete a sessions of a profile.
public static deleteSession ( integer $id )
$id integer Profile id.

exists() public static method

Check if a profile exists.
public static exists ( integer $id ) : boolean
$id integer Profile id.
return boolean

existsByEmail() public static method

Check if a profile exists by email address.
public static existsByEmail ( string $email, integer $id = null ) : boolean
$email string Email address to check for existence.
$id integer Profile id to ignore.
return boolean

existsDisplayName() public static method

Check if a display name exists.
public static existsDisplayName ( string $displayName, integer $id = null ) : boolean
$displayName string The display name to check.
$id integer Profile id to ignore.
return boolean

existsGroup() public static method

Check if a group exists.
public static existsGroup ( integer $id ) : boolean
$id integer Group id.
return boolean

existsGroupName() public static method

Check if a group name exists.
public static existsGroupName ( string $groupName, integer $id = null ) : boolean
$groupName string Group name.
$id integer Group id to ignore.
return boolean

existsProfileGroup() public static method

Check if a profile is in a group.
public static existsProfileGroup ( integer $id ) : boolean
$id integer Membership id.
return boolean

get() public static method

Get information about a profile.
public static get ( integer $id ) : array
$id integer The profile id to get the information for.
return array

getAvatar() public static method

Get avatar
public static getAvatar ( integer $id, string $email = null ) : string
$id integer The id for the profile we want to get the avatar from.
$email string The email from the user we can use for gravatar.
return string $avatar The absolute path to the avatar.

getByEmail() public static method

Get information about a profile, by email
public static getByEmail ( string $email ) : array
$email string The profile email to get the information for.
return array

getEncryptedString() public static method

Encrypt a string with a salt.
public static getEncryptedString ( string $string, string $salt ) : string
$string string String to encrypt.
$salt string Salt to saltivy the string with.
return string

getGroup() public static method

Get information about a profile group.
public static getGroup ( integer $id ) : array
$id integer Id of the group.
return array

getGroups() public static method

Get the list of all groups as array($groupId => $groupName).
public static getGroups ( ) : array
return array

getGroupsForDropDown() public static method

Get profile groups for dropdown not yet linked to a profile
public static getGroupsForDropDown ( integer $profileId, integer $includeId = null ) : array
$profileId integer Profile id.
$includeId integer Group id to always include.
return array

getProfileGroup() public static method

Get information about a profile group where a user is member of.
public static getProfileGroup ( integer $id ) : array
$id integer Membership id.
return array

getProfileGroups() public static method

Get the groups where a profile is member of.
public static getProfileGroups ( integer $id ) : array
$id integer The profile id to get the groups for.
return array

getRandomString() public static method

Generate a random string.
public static getRandomString ( integer $length = 15, boolean $numeric = true, boolean $lowercase = true, boolean $uppercase = true, boolean $special = true ) : string
$length integer Length of random string.
$numeric boolean Use numeric characters.
$lowercase boolean Use alphanumeric lowercase characters.
$uppercase boolean Use alphanumeric uppercase characters.
$special boolean Use special characters.
return string

getSetting() public static method

Get a setting for a profile.
public static getSetting ( integer $id, string $name ) : string
$id integer Profile id.
$name string Setting name.
return string

getStatusForDropDown() public static method

Fetch the list of status, but for a dropdown.
public static getStatusForDropDown ( ) : array
return array

getUrl() public static method

Retrieve a unique URL for a profile based on the display name.
public static getUrl ( string $displayName, integer $id = null ) : string
$displayName string The display name to base on.
$id integer The id of the profile to ignore.
return string

getUser() public static method

Get the HTML for a user to use in a datagrid
public static getUser ( integer $id ) : string
$id integer The Id of the user.
return string

importCsv() public static method

Import CSV data
public static importCsv ( array $data, null $groupId = null, boolean $overwriteExisting = false ) : array
$data array The array from the .csv file
$groupId null $groupId Adding these profiles to a group
$overwriteExisting boolean $overwriteExisting
return array array('count' => array('exists' => 0, 'inserted' => 0));

insert() public static method

Insert a new profile.
public static insert ( array $values ) : integer
$values array The values to insert.
return integer

insertGroup() public static method

Insert a new group.
public static insertGroup ( array $values ) : integer
$values array Group data.
return integer

insertProfileGroup() public static method

Add a profile to a group.
public static insertProfileGroup ( array $values ) : integer
$values array Membership data.
return integer

notifyAdmin() public static method

Notify admin - after adding profile to profiles module
public static notifyAdmin ( array $values, string $templatePath = null )
$values array
$templatePath string

notifyProfile() public static method

Notify profile - after adding profile to profiles module
public static notifyProfile ( array $values, boolean $forUpdate = false, string $templatePath = null )
$values array
$forUpdate boolean
$templatePath string

sendMail() protected static method

Send mail
protected static sendMail ( string $subject, string $templatePath = null, array $variables, string $toEmail, string $toDisplayName = null )
$subject string
$templatePath string
$variables array
$toEmail string
$toDisplayName string

setSetting() public static method

Insert or update a single profile setting.
public static setSetting ( integer $id, string $name, mixed $value )
$id integer Profile id.
$name string Setting name.
$value mixed Setting value.

update() public static method

Update a profile.
public static update ( integer $id, array $values ) : integer
$id integer The profile id.
$values array The values to update.
return integer

updateGroup() public static method

Update a profile group.
public static updateGroup ( integer $id, array $values ) : integer
$id integer Group id.
$values array Group data.
return integer

updateProfileGroup() public static method

Update a membership of a profile in a group.
public static updateProfileGroup ( integer $id, array $values ) : integer
$id integer Membership id.
$values array Membership data.
return integer

Property Details

$avatars protected static property

Cache avatars
protected static $avatars