\Hermes

Hermes Base Class.

See the enclosed file LICENSE for license information (BSD). If you did not receive this file, see http://www.horde.org/licenses/bsdl.php.

Summary

Methods
Properties
Constants
listClients()
getClientSelect()
getJobTypeSelect()
getJobTypeData()
canEditTimeslice()
makeExportHours()
getEmployeesType()
getCostObjectByID()
getCostObjects()
getCostObjectType()
tabs()
listTimers()
newTimer()
getTimer()
clearTimer()
updateTimer()
pauseTimer()
showAjaxView()
url()
parseDate()
updateCostObject()
No public properties found
No constants found
No protected methods found
$_clients
N/A
No private methods found
No private properties found
N/A

Properties

$_clients

$_clients : array

List of available clients.

Type

array

Methods

listClients()

listClients(string  $name = '') : array

Returns a list of available clients.

Parameters

string $name

The string to search for in the client name.

Returns

array —

A hash of client_id => client_name.

getClientSelect()

getClientSelect(string  $id, boolean  $multi = false, boolean  $use_cotext = false) : string

Return the HTML needed to build an enum or multienum for selecting clients.

Parameters

string $id

The DOM id to identify the select list.

boolean $multi

Allow multi select?

boolean $use_cotext

Instead of 'Select A Client', use 'General Cost Objects' for the top choice.

Returns

string —

The HTML to render the select element.

getJobTypeSelect()

getJobTypeSelect(string  $id, boolean  $multi = false,   $show_disabled = false) : string

Return HTML needed to build an enum or multienum for jobtype selection.

Parameters

string $id

The DOM id to identify the select list.

boolean $multi

Allow multi select?

$show_disabled

Returns

string —

The HTML needed to render the select element.

getJobTypeData()

getJobTypeData(  $params = array()) 

Parameters

$params

canEditTimeslice()

canEditTimeslice(\<type>  $id) : \<type>

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.

Parameters

\ $id

Returns

\

makeExportHours()

makeExportHours(array  $hours) : array

Rewrite an hours array into a format useable by Horde_Data::

Parameters

array $hours

This is an array of the results from $driver->getHours().

Returns

array —

an array suitable for Horde_Data::

getEmployeesType()

getEmployeesType(string  $enumtype = 'multienum') : array

Get form control type for users.

What type of control we use depends on whether the Auth driver has list capability.

Parameters

string $enumtype

The type to return if we have list capability (should be either 'enum' or 'multienum').

Returns

array —

A two-element array of the type and the type's parameters.

getCostObjectByID()

getCostObjectByID(string  $id, string|boolean  $employee = false) : array

Return a cost object hash.

Parameters

string $id

The cost object id.

string|boolean $employee

Employee hint - if known. False otherwise.

Throws

\Horde_ExceptionNotFound

Returns

array —

The cost object hash. Keys differ depending on the API queried, but should always contain:

  • id:
  • name:

getCostObjects()

getCostObjects(  $client_ids = null,   $external_only = false) 

Return a list of cost objects exported by available APIs, optionally filtered by client_ids.

Parameters

$client_ids
$external_only

getCostObjectType()

getCostObjectType(mixed  $client_ids = null) : array

Return data for costobjects, optionally filtered by client_ids.

Parameters

mixed $client_ids

A client id or an array of client ids to filter cost obejcts by.

Returns

array —

An array of cost objects data.

tabs()

tabs() 

listTimers()

listTimers(boolean  $running_only = false) : array

Return list of current timers.

Parameters

boolean $running_only

Only return running timers if true.

Returns

array —

An array of timer hashes.

newTimer()

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.

  • 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.

Parameters

string $description

The timer description.

\stdClass $details

Additional, optional details for the ti.

Returns

integer —

The timer id.

getTimer()

getTimer(  $id) : array

Return a specific timer.

Parameters

$id

Throws

\Horde_Exception_NotFound

Returns

array —

The timer hash.

clearTimer()

clearTimer(integer  $id) 

Clear a timer

Parameters

integer $id

The timer id to clear/remove.

updateTimer()

updateTimer(integer  $id, array  $timer) 

Update an existing timer.

Parameters

integer $id

The timer id.

array $timer

The timer hash.

pauseTimer()

pauseTimer(integer  $id) : boolean

Pause a timer.

Parameters

integer $id

The timer id.

Returns

boolean

showAjaxView()

showAjaxView() : boolean

Returns true if we are showing the Ajax view.

Returns

boolean

url()

url(string  $view, array  $params = array()) : \Horde_Url

Return a URL to a specific view, taking self::showAjaxView() into account

Parameters

string $view

The view to link to.

array $params

Optional paramaters.

  • id: A slice id.

Returns

\Horde_Url —

The Url

parseDate()

parseDate(string  $date) : \Horde_Date

Parses a complete date-time string into a Horde_Date object.

Parameters

string $date

The date-time string to parse.

Throws

\Horde_Date_Exception

Returns

\Horde_Date —

The parsed date.

updateCostObject()

updateCostObject(  $slice) 

Parameters

$slice