PHP Class Planning, glpi

显示文件 Open project: glpi-project/glpi Class Usage Examples

Public Properties

Property Type Description
$directgroup_itemtype
$palette_bg
$palette_ev
$palette_fg
$rightname

Public Methods

Method Description
canView ( )
checkAlreadyPlanned ( $users_id, $begin, $end, $except = [] ) Check already planned user for a period
checkAvailability ( $params = [] ) : Nothing Show the availability of a user
colorFilter ( $options = [] ) : nothing change color for selected line of $_SESSION['glpi_plannings']
constructEventsArray ( array $options = [] ) : array Prepare a set of events for jquery fullcalendar.
constructEventsArraySingleLine ( $actor, $params = [], &$raw_events = [] ) : nothing construct a single line for self::constructEventsArray() Recursively called to construct $raw_events param.
defineTabs ( $options = [] )
deleteFilter ( $options = [] ) : nothing delete selected line in $_SESSION['glpi_plannings']
displayPlanningItem ( array $val, $who, $type = "", $complete ) : Nothing Display a Planning Item
displayTabContentForItem ( CommonGLPI $item, $tabnum = 1, $withtemplate )
dropdownState ( $name, $value = '', $display = true ) Dropdown of planning state
editEventForm ( $params = [] )
generateIcal ( $who, $who_group, $limititemtype = '' ) : icalendar Generate ical file content
getMenuContent ( )
getMenuShorcut ( )
getPalette ( string $palette_name = 'bg' ) : mixed Return a palette array (for example self::$palette_bg)
getPaletteColor ( string $palette_name = 'bg', integer $color_index ) : mixed Return an hexa color from a palette
getRights ( $interface = 'central' )
getState ( $value ) Get planning state name
getTabNameForItem ( CommonGLPI $item, $withtemplate )
getTypeName ( $nb )
initSessionForCurrentUser ( ) : Nothing Init $_SESSION['glpi_plannings'] var with thses keys : - 'filters' : type of planning available (ChangeTask, Reminder, etc) - 'plannings' : all plannings definided for current user.
savePlanningsInDB ( )
sendAddGroupForm ( $params = [] ) Recieve 'Group' data from self::showAddGroupForm and save them to session and DB
sendAddGroupUsersForm ( $params = [] ) Recieve 'All users of a group' data from self::showAddGroupUsersForm and save them to session and DB
sendAddUserForm ( $params = [] ) Recieve 'User' data from self::showAddPlanningForm and save them to session and DB
showAddEventClassicForm ( $params = [] ) Former front/planning.php before 9.1.
showAddEventForm ( $params = [] )
showAddEventSubForm ( $params = [] ) : Nothing Display form after selecting date range in planning
showAddGroupForm ( $params = [] ) : Nothing Display 'Group' part of self::showAddPlanningForm spcified by planning type dropdown.
showAddGroupUsersForm ( ) : Nothing Display 'All users of a group' part of self::showAddPlanningForm spcified by planning type dropdown.
showAddPlanningForm ( ) : Nothing Display ajax form to add actor on planning
showAddUserForm ( ) : Nothing Display 'User' part of self::showAddPlanningForm spcified by planning type dropdown.
showCentral ( $who ) : Nothing Show the planning for the central page of a user
showPlanning ( $fullview = true ) : Nothing Show the planning
showPlanningFilter ( ) : Nothing Display left part of planning who contains filters and planning with delete/toggle buttons and color choosing.
showSingleLinePlanningFilter ( $filter_key, $filter_data, $options = [] ) : Nothing Display a single line of planning filter.
toggleFilter ( $options = [] ) : nothing toggle display for selected line of $_SESSION['glpi_plannings']
updateEventTimes ( $params = [] ) : boolean Change dates of a selected event.

Private Methods

Method Description
displayUsingTwoDigits ( $time ) : string Display an integer using 2 digits

Method Details

canView() static public method

static public canView ( )

checkAlreadyPlanned() static public method

Check already planned user for a period
static public checkAlreadyPlanned ( $users_id, $begin, $end, $except = [] )
$users_id user id
$begin begin date
$end end date
$except array of items which not be into account array ('Reminder'=>array(1,2,id_of_items))

checkAvailability() static public method

Show the availability of a user
static public checkAvailability ( $params = [] ) : Nothing
$params array of params must contain : - begin: begin date to check (default '') - end: end date to check (default '') - itemtype : User or Object type (Ticket...) - foreign key field of the itemtype to define which item to used optional : - limitto : limit display to a specific user
return Nothing (display function)

colorFilter() static public method

change color for selected line of $_SESSION['glpi_plannings']
Since: 9.1
static public colorFilter ( $options = [] ) : nothing
return nothing

constructEventsArray() static public method

Call populatePlanning functions for all $CFG_GLPI['planning_types'] types
Since: 9.1
static public constructEventsArray ( array $options = [] ) : array
$options array with this keys: - begin: mandatory, planning start. (should be an ISO_8601 date, but could be anything wo can be parsed by strtotime) - end: mandatory, planning end. (should be an ISO_8601 date, but could be anything wo can be parsed by strtotime) - display_done_events: default true, show also events tagged as done
return array $events : array with events in fullcalendar.io format

constructEventsArraySingleLine() static public method

construct a single line for self::constructEventsArray() Recursively called to construct $raw_events param.
Since: 9.1
static public constructEventsArraySingleLine ( $actor, $params = [], &$raw_events = [] ) : nothing
return nothing

defineTabs() public method

public defineTabs ( $options = [] )

deleteFilter() static public method

delete selected line in $_SESSION['glpi_plannings']
Since: 9.1
static public deleteFilter ( $options = [] ) : nothing
return nothing

displayPlanningItem() static public method

Display a Planning Item
static public displayPlanningItem ( array $val, $who, $type = "", $complete ) : Nothing
$val array Array of the item to display
$who ID of the user (0 if all)
$type position of the item in the time block (in, through, begin or end) (default '')
$complete complete display (more details) (default 0)
return Nothing (display function)

displayTabContentForItem() static public method

static public displayTabContentForItem ( CommonGLPI $item, $tabnum = 1, $withtemplate )
$item CommonGLPI

dropdownState() static public method

Dropdown of planning state
static public dropdownState ( $name, $value = '', $display = true )
$name select name
$value default value (default '')
$display display of send string ? (true by default)

editEventForm() static public method

static public editEventForm ( $params = [] )

generateIcal() static public method

Generate ical file content
static public generateIcal ( $who, $who_group, $limititemtype = '' ) : icalendar
$who user ID
$who_group group ID
$limititemtype itemtype only display this itemtype (default '')
return icalendar string

getMenuContent() static public method

See also: CommonGLPI::getMenuContent() @since version 9.1
static public getMenuContent ( )

getMenuShorcut() static public method

See also: CommonGLPI::getMenuShorcut()
static public getMenuShorcut ( )

getPalette() static public method

Return a palette array (for example self::$palette_bg)
Since: 9.1.1
static public getPalette ( string $palette_name = 'bg' ) : mixed
$palette_name string the short name for palette (bg, fg, ev)
return mixed the palette array or false

getPaletteColor() static public method

Return an hexa color from a palette
Since: 9.1.1
static public getPaletteColor ( string $palette_name = 'bg', integer $color_index ) : mixed
$palette_name string the short name for palette (bg, fg, ev)
$color_index integer The color index in this palette
return mixed the color in hexa (ex: #FFFFFF) or false

getRights() public method

public getRights ( $interface = 'central' )

getState() static public method

Get planning state name
static public getState ( $value )
$value status ID

getTabNameForItem() public method

public getTabNameForItem ( CommonGLPI $item, $withtemplate )
$item CommonGLPI

getTypeName() static public method

static public getTypeName ( $nb )
$nb

initSessionForCurrentUser() static public method

If currently logged user, has no plannings or filter, this function wiil init them Also manage color index in $_SESSION['glpi_plannings_color_index']
static public initSessionForCurrentUser ( ) : Nothing
return Nothing (display function)

savePlanningsInDB() static public method

static public savePlanningsInDB ( )

sendAddGroupForm() static public method

Recieve 'Group' data from self::showAddGroupForm and save them to session and DB
Since: 9.1
static public sendAddGroupForm ( $params = [] )
$params (array) : must contais form data (typically $_REQUEST)

sendAddGroupUsersForm() static public method

Recieve 'All users of a group' data from self::showAddGroupUsersForm and save them to session and DB
Since: 9.1
static public sendAddGroupUsersForm ( $params = [] )
$params (array) : must contais form data (typically $_REQUEST)

sendAddUserForm() static public method

Recieve 'User' data from self::showAddPlanningForm and save them to session and DB
static public sendAddUserForm ( $params = [] )
$params (array) : must contais form data (typically $_REQUEST)

showAddEventClassicForm() static public method

Display a classic form to plan an event (with begin fiel and duration)
Since: 9.1
static public showAddEventClassicForm ( $params = [] )
$params (array): array of parameters whou should contain : - id (integer): id of item who receive the planification - itemtype (string): itemtype of item who receive the planification - begin (string) : start date of event - end (optionnal) (string) : end date of event. Ifg missing, it will computerd from begin+1hour - rand_user (integer) : users_id to check planning avaibility

showAddEventForm() static public method

static public showAddEventForm ( $params = [] )

showAddEventSubForm() static public method

Display form after selecting date range in planning
Since: 9.1
static public showAddEventSubForm ( $params = [] ) : Nothing
$params (array): must contains this keys : - begin : start of selection range. (should be an ISO_8601 date, but could be anything wo can be parsed by strtotime) - end : end of selection range. (should be an ISO_8601 date, but could be anything wo can be parsed by strtotime)
return Nothing (display function)

showAddGroupForm() static public method

Actually called by ajax/planning.php
Since: 9.1
static public showAddGroupForm ( $params = [] ) : Nothing
return Nothing (display function)

showAddGroupUsersForm() static public method

Actually called by ajax/planning.php
static public showAddGroupUsersForm ( ) : Nothing
return Nothing (display function)

showAddPlanningForm() static public method

Display ajax form to add actor on planning
static public showAddPlanningForm ( ) : Nothing
return Nothing (display function)

showAddUserForm() static public method

Actually called by ajax/planning.php
static public showAddUserForm ( ) : Nothing
return Nothing (display function)

showCentral() static public method

Show the planning for the central page of a user
static public showCentral ( $who ) : Nothing
$who ID of the user
return Nothing (display function)

showPlanning() static public method

Function name change since version 0.84 show() => showPlanning Function prototype changes in 9.1 (no more parameters)
static public showPlanning ( $fullview = true ) : Nothing
return Nothing (display function)

showPlanningFilter() static public method

Call self::showSingleLinePlanningFilter for each filters and plannings
static public showPlanningFilter ( ) : Nothing
return Nothing (display function)

showSingleLinePlanningFilter() static public method

See self::showPlanningFilter function
static public showSingleLinePlanningFilter ( $filter_key, $filter_data, $options = [] ) : Nothing
$filter_key : identify curent line of filter
$filter_data : array of filter date, must contains : * 'show_delete' (boolean): show delete button * 'filter_color_index' (integer): index of the color to use in self::$palette_bg
$options
return Nothing (display function)

toggleFilter() static public method

toggle display for selected line of $_SESSION['glpi_plannings']
Since: 9.1
static public toggleFilter ( $options = [] ) : nothing
return nothing

updateEventTimes() static public method

Called from a drag&drop in planning
Since: 9.1
static public updateEventTimes ( $params = [] ) : boolean
return boolean

Property Details

$directgroup_itemtype static_oe public_oe property

static public $directgroup_itemtype

$palette_bg static_oe public_oe property

static public $palette_bg

$palette_ev static_oe public_oe property

static public $palette_ev

$palette_fg static_oe public_oe property

static public $palette_fg

$rightname static_oe public_oe property

static public $rightname