Hawk - PHP documentation
  • Namespace
  • Class
  • Tree

Namespaces

  • Hawk
    • View
      • Plugins

Classes

  • App
  • ButtonInput
  • Cache
  • CheckboxInput
  • ColorInput
  • Conf
  • Controller
  • Crypto
  • DatabaseSessionHandler
  • DatetimeInput
  • DB
  • DBExample
  • DeleteInput
  • Dialogbox
  • EmailInput
  • ErrorHandler
  • Event
  • FileInput
  • FileSystem
  • FloatInput
  • Form
  • FormFieldset
  • FormInput
  • GenericModel
  • GifImage
  • HawkApi
  • HawkUpdater
  • HiddenInput
  • HtmlInput
  • HTTPRequest
  • Icon
  • Image
  • IntegerInput
  • ItemList
  • ItemListField
  • JpegImage
  • Lang
  • Language
  • LeftSidebarTab
  • Less
  • Logger
  • Mail
  • MenuItem
  • Model
  • NoSidebarTab
  • NumberInput
  • ObjectInput
  • Option
  • Panel
  • PasswordInput
  • Permission
  • Plugin
  • PluginInstaller
  • PngImage
  • ProfileQuestion
  • ProfileQuestionValue
  • RadioInput
  • Request
  • Response
  • RightSidebarTab
  • Role
  • RolePermission
  • Route
  • Router
  • SelectInput
  • Session
  • Singleton
  • SubmitInput
  • Tabs
  • TextareaInput
  • TextInput
  • Theme
  • TimeInput
  • Upload
  • User
  • View
  • ViewPlugin
  • Widget
  • WysiwygInput

Traits

  • Utils

Exceptions

  • AppStopException
  • DBExampleException
  • DBException
  • FileSystemException
  • HawkApiException
  • ImageException
  • MailException
  • UploadException
  • ViewException

Class User

This model describes the user data

Hawk\Model uses Hawk\Utils
Extended by Hawk\User
Namespace: Hawk
Package: BaseModels
Located at models/User.php

Methods summary

public
# __construct( array $data = array() )

Constructor

Constructor

Parameters

$data
The data to set to the user

Overrides

Hawk\Model::__construct
public static array
# getAll( string $index = null, array $fields = array(), array $order = array() )

Get all users except guest user

Get all users except guest user

Parameters

$index
The field to use as key in the returned array
$fields
The table fields to get
$order
The order instruction to get the users

Returns

array

Overrides

Hawk\Model::getAll
public static Hawk\User
# getByUsername( string $username )

Get a user by it username

Get a user by it username

Parameters

$username
The username to search

Returns

Hawk\User
public static Hawk\User
# getByEmail( string $email )

Get a user by it email address

Get a user by it email address

Parameters

$email
The user email

Returns

Hawk\User
public mixed
# getProfileData( string $prop = "" )

Get the user's profile data

Get the user's profile data

Parameters

$prop

The property name to get. If not set, the function will return an array containing all the profile data

Returns

mixed
public
# setProfileData( string $prop, string $value )

Set the user's profile data. This method does not register the data in database, only set in the user properties

Set the user's profile data. This method does not register the data in database, only set in the user properties

Parameters

$prop
The property name to set
$value
The value to set
public
# saveProfile( )

Save the user's profile in the database

Save the user's profile in the database

public mixed
# getOptions( string $name = '' )

Get the user options. This function returns the option value for $name. If $name is not set, it returns the array containing all the user options

Get the user options. This function returns the option value for $name. If $name is not set, it returns the array containing all the user options

Parameters

$name
The option name, formatted like '.'

Returns

mixed
The value for the option $name, or the array contaning all the user options
public
# setOption( string $name, mixed $value )

Register an option for the user. This function registers the option value in the database and in the current user options

Register an option for the user. This function registers the option value in the database and in the current user options

Parameters

$name
The option name, formatted as '.'
$value
The value to set to the option
public boolean
# isAllowed( string|integer $action )

Check if the user is allowed to perform an action

Check if the user is allowed to perform an action

Parameters

$action

This parameter can represent : - A specific action, formatted as "." - A permission id, when an integer is given

Returns

boolean
TRUE if the user is allowed to perform the action, else FALSE
public string
# getUsername( )

Get the user's username

Get the user's username

Returns

string
The user's username
public string
# getDisplayName( )

Get the user's full name. This method returns the real name if it set in the user's profile, else, it returns his username

Get the user's full name. This method returns the real name if it set in the user's profile, else, it returns his username

Returns

string
public boolean
# isLogged( )

Check if the user is logged or not

Check if the user is logged or not

Returns

boolean
public boolean
# canAccessApplication( )

Check if the user can access the application

Check if the user can access the application

Returns

boolean
public boolean
# isRemovable( )

Check of the user is removable. A user is removable if he's not the one executing the current script, and if he's not a guest or the main application administrator

Check of the user is removable. A user is removable if he's not the one executing the current script, and if he's not a guest or the main application administrator

Returns

boolean

Methods inherited from Hawk\Model

add(), addIfNotExists(), countElementsByExample(), countElementsBySQL(), delete(), deleteByExample(), deleteBySQL(), getByExample(), getById(), getBySQL(), getData(), getDbInstance(), getDbName(), getListByExample(), getListBySQL(), getPrimaryColumn(), getTable(), save(), set(), setDbName(), setPrimaryColumn(), setTable(), update()

Methods used from Hawk\Utils

debug(), getSerializedVersion(), map()

Constants summary

integer GUEST_USER_ID

The id of guest users

The id of guest users

# 0
integer ROOT_USER_ID

The id for the first administrator user

The id for the first administrator user

# 1

Properties summary

protected static string $tablename

The associated table

The associated table

# "User"

Properties inherited from Hawk\Model

$dbname, $primaryColumn

Hawk - PHP documentation API documentation generated by ApiGen