PHP Class Hermes, horde

See the enclosed file LICENSE for license information (BSD). If you did not receive this file, see http://www.horde.org/licenses/bsdl.php.
Author: Chuck Hagenbuch ([email protected])
Show file Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_clients array List of available clients.

Public Methods

Method Description
canEditTimeslice ( $id ) : Determines if the current user can edit a specific timeslice according to the following rules: 'hermes:review' perms may edit any slice, the current user can edit his/her own slice prior to submitting it. Otherwise no editing allowed.
clearTimer ( integer $id ) Clear a timer
getClientSelect ( string $id, boolean $multi = false, boolean $use_cotext = false ) : string Return the HTML needed to build an enum or multienum for selecting clients.
getCostObjectByID ( string $id, string | boolean $employee = false ) : array Return a cost object hash.
getCostObjectType ( mixed $client_ids = null ) : array Return data for costobjects, optionally filtered by client_ids.
getCostObjects ( $client_ids = null, $external_only = false ) Return a list of cost objects exported by available APIs, optionally filtered by client_ids.
getEmployeesType ( string $enumtype = 'multienum' ) : array Get form control type for users.
getJobTypeData ( $params = [] )
getJobTypeSelect ( string $id, boolean $multi = false, $show_disabled = false ) : string Return HTML needed to build an enum or multienum for jobtype selection.
getTimer ( $id ) : array Return a specific timer.
listClients ( string $name = '' ) : array Returns a list of available clients.
listTimers ( boolean $running_only = false ) : array Return list of current timers.
makeExportHours ( array $hours ) : array Rewrite an hours array into a format useable by Horde_Data::
newTimer ( string $description, stdClass $details = null ) : integer Create a new timer and save it to storage. Timers contain the following values: - name: (string) The descriptive name of the timer.
parseDate ( string $date ) : Horde_Date Parses a complete date-time string into a Horde_Date object.
pauseTimer ( integer $id ) : boolean Pause a timer.
showAjaxView ( ) : boolean Returns true if we are showing the Ajax view.
tabs ( )
updateCostObject ( $slice )
updateTimer ( integer $id, array $timer ) Update an existing timer.
url ( string $view, array $params = [] ) : Horde_Url Return a URL to a specific view, taking self::showAjaxView() into account

Method Details

canEditTimeslice() public static method

Determines if the current user can edit a specific timeslice according to the following rules: 'hermes:review' perms may edit any slice, the current user can edit his/her own slice prior to submitting it. Otherwise no editing allowed.
public static canEditTimeslice ( $id ) :
$id
return

clearTimer() public static method

Clear a timer
public static clearTimer ( integer $id )
$id integer The timer id to clear/remove.

getClientSelect() public static method

Return the HTML needed to build an enum or multienum for selecting clients.
public static getClientSelect ( string $id, boolean $multi = false, boolean $use_cotext = false ) : string
$id string The DOM id to identify the select list.
$multi boolean Allow multi select?
$use_cotext boolean Instead of 'Select A Client', use 'General Cost Objects' for the top choice.
return string The HTML to render the select element.

getCostObjectByID() public static method

Return a cost object hash.
public static getCostObjectByID ( string $id, string | boolean $employee = false ) : array
$id string The cost object id.
$employee string | boolean Employee hint - if known. False otherwise.
return array The cost object hash. Keys differ depending on the API queried, but should always contain: - id: - name:

getCostObjectType() public static method

Return data for costobjects, optionally filtered by client_ids.
public static getCostObjectType ( mixed $client_ids = null ) : array
$client_ids mixed A client id or an array of client ids to filter cost obejcts by.
return array An array of cost objects data.

getCostObjects() public static method

Return a list of cost objects exported by available APIs, optionally filtered by client_ids.
public static getCostObjects ( $client_ids = null, $external_only = false )

getEmployeesType() public static method

What type of control we use depends on whether the Auth driver has list capability.
public static getEmployeesType ( string $enumtype = 'multienum' ) : array
$enumtype string The type to return if we have list capability (should be either 'enum' or 'multienum').
return array A two-element array of the type and the type's parameters.

getJobTypeData() public static method

public static getJobTypeData ( $params = [] )

getJobTypeSelect() public static method

Return HTML needed to build an enum or multienum for jobtype selection.
public static getJobTypeSelect ( string $id, boolean $multi = false, $show_disabled = false ) : string
$id string The DOM id to identify the select list.
$multi boolean Allow multi select?
return string The HTML needed to render the select element.

getTimer() public static method

Return a specific timer.
public static getTimer ( $id ) : array
return array The timer hash.

listClients() public static method

Returns a list of available clients.
public static listClients ( string $name = '' ) : array
$name string The string to search for in the client name.
return array A hash of client_id => client_name.

listTimers() public static method

Return list of current timers.
public static listTimers ( boolean $running_only = false ) : array
$running_only boolean Only return running timers if true.
return array An array of timer hashes.

makeExportHours() public static method

Rewrite an hours array into a format useable by Horde_Data::
public static makeExportHours ( array $hours ) : array
$hours array This is an array of the results from $driver->getHours().
return array an array suitable for Horde_Data::

newTimer() public static method

- client_id: (string) The client id. - deliverable_id: (string) The delverable id. - deliverable_text: (string) Descriptive text for deliverable. - jobtype_id: (string) The jobtype id. - time: (integer) Contains the timestamp of the last time this timer was started. Contains zero if paused. - paused: (boolean) Flag to indicate the timer is paused. - elapsed: (integer) Total elapsed time since the timer was created or reset. Updated when timer is paused. - exclusive: (boolean) Whether or not this timer should cause other timers to stop when it is started.
public static newTimer ( string $description, stdClass $details = null ) : integer
$description string The timer description.
$details stdClass Additional, optional details for the ti.
return integer The timer id.

parseDate() public static method

Parses a complete date-time string into a Horde_Date object.
public static parseDate ( string $date ) : Horde_Date
$date string The date-time string to parse.
return Horde_Date The parsed date.

pauseTimer() public static method

Pause a timer.
public static pauseTimer ( integer $id ) : boolean
$id integer The timer id.
return boolean

showAjaxView() public static method

Returns true if we are showing the Ajax view.
public static showAjaxView ( ) : boolean
return boolean

tabs() public static method

public static tabs ( )

updateCostObject() public static method

public static updateCostObject ( $slice )

updateTimer() public static method

Update an existing timer.
public static updateTimer ( integer $id, array $timer )
$id integer The timer id.
$timer array The timer hash.

url() public static method

Return a URL to a specific view, taking self::showAjaxView() into account
public static url ( string $view, array $params = [] ) : Horde_Url
$view string The view to link to.
$params array Optional paramaters. - id: A slice id.
return Horde_Url The Url

Property Details

$_clients protected static property

List of available clients.
protected static array $_clients
return array