PHP Класс Planning, glpi

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$directgroup_itemtype
$palette_bg
$palette_ev
$palette_fg
$rightname

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
displayUsingTwoDigits ( $time ) : string Display an integer using 2 digits

Описание методов

canView() статический публичный Метод

static public canView ( )

checkAlreadyPlanned() статический публичный Метод

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() статический публичный Метод

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
Результат Nothing (display function)

colorFilter() статический публичный Метод

change color for selected line of $_SESSION['glpi_plannings']
С версии: 9.1
static public colorFilter ( $options = [] ) : nothing
Результат nothing

constructEventsArray() статический публичный Метод

Call populatePlanning functions for all $CFG_GLPI['planning_types'] types
С версии: 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
Результат array $events : array with events in fullcalendar.io format

constructEventsArraySingleLine() статический публичный Метод

construct a single line for self::constructEventsArray() Recursively called to construct $raw_events param.
С версии: 9.1
static public constructEventsArraySingleLine ( $actor, $params = [], &$raw_events = [] ) : nothing
Результат nothing

defineTabs() публичный Метод

public defineTabs ( $options = [] )

deleteFilter() статический публичный Метод

delete selected line in $_SESSION['glpi_plannings']
С версии: 9.1
static public deleteFilter ( $options = [] ) : nothing
Результат nothing

displayPlanningItem() статический публичный Метод

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)
Результат Nothing (display function)

displayTabContentForItem() статический публичный Метод

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

dropdownState() статический публичный Метод

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 editEventForm ( $params = [] )

generateIcal() статический публичный Метод

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 '')
Результат icalendar string

getMenuContent() статический публичный Метод

См. также: CommonGLPI::getMenuContent() @since version 9.1
static public getMenuContent ( )

getMenuShorcut() статический публичный Метод

См. также: CommonGLPI::getMenuShorcut()
static public getMenuShorcut ( )

getPalette() статический публичный Метод

Return a palette array (for example self::$palette_bg)
С версии: 9.1.1
static public getPalette ( string $palette_name = 'bg' ) : mixed
$palette_name string the short name for palette (bg, fg, ev)
Результат mixed the palette array or false

getPaletteColor() статический публичный Метод

Return an hexa color from a palette
С версии: 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
Результат mixed the color in hexa (ex: #FFFFFF) or false

getRights() публичный Метод

public getRights ( $interface = 'central' )

getState() статический публичный Метод

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

getTabNameForItem() публичный Метод

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

getTypeName() статический публичный Метод

static public getTypeName ( $nb )
$nb

initSessionForCurrentUser() статический публичный Метод

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
Результат Nothing (display function)

savePlanningsInDB() статический публичный Метод

static public savePlanningsInDB ( )

sendAddGroupForm() статический публичный Метод

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

sendAddGroupUsersForm() статический публичный Метод

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

sendAddUserForm() статический публичный Метод

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() статический публичный Метод

Display a classic form to plan an event (with begin fiel and duration)
С версии: 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 showAddEventForm ( $params = [] )

showAddEventSubForm() статический публичный Метод

Display form after selecting date range in planning
С версии: 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)
Результат Nothing (display function)

showAddGroupForm() статический публичный Метод

Actually called by ajax/planning.php
С версии: 9.1
static public showAddGroupForm ( $params = [] ) : Nothing
Результат Nothing (display function)

showAddGroupUsersForm() статический публичный Метод

Actually called by ajax/planning.php
static public showAddGroupUsersForm ( ) : Nothing
Результат Nothing (display function)

showAddPlanningForm() статический публичный Метод

Display ajax form to add actor on planning
static public showAddPlanningForm ( ) : Nothing
Результат Nothing (display function)

showAddUserForm() статический публичный Метод

Actually called by ajax/planning.php
static public showAddUserForm ( ) : Nothing
Результат Nothing (display function)

showCentral() статический публичный Метод

Show the planning for the central page of a user
static public showCentral ( $who ) : Nothing
$who ID of the user
Результат Nothing (display function)

showPlanning() статический публичный Метод

Function name change since version 0.84 show() => showPlanning Function prototype changes in 9.1 (no more parameters)
static public showPlanning ( $fullview = true ) : Nothing
Результат Nothing (display function)

showPlanningFilter() статический публичный Метод

Call self::showSingleLinePlanningFilter for each filters and plannings
static public showPlanningFilter ( ) : Nothing
Результат Nothing (display function)

showSingleLinePlanningFilter() статический публичный Метод

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
Результат Nothing (display function)

toggleFilter() статический публичный Метод

toggle display for selected line of $_SESSION['glpi_plannings']
С версии: 9.1
static public toggleFilter ( $options = [] ) : nothing
Результат nothing

updateEventTimes() статический публичный Метод

Called from a drag&drop in planning
С версии: 9.1
static public updateEventTimes ( $params = [] ) : boolean
Результат boolean

Описание свойств

$directgroup_itemtype статическое публичное свойство

static public $directgroup_itemtype

$palette_bg статическое публичное свойство

static public $palette_bg

$palette_ev статическое публичное свойство

static public $palette_ev

$palette_fg статическое публичное свойство

static public $palette_fg

$rightname статическое публичное свойство

static public $rightname