Documentation

Project_Gantt_Model
in package

Gantt Model class.

Tags
copyright

YetiForce S.A.

license

YetiForce Public License 6.5 (licenses/LicenseEN.txt or yetiforce.com)

author

Rafal Pospiech r.pospiech@yetiforce.com

author

Radosław Skrzypczak r.skrzypczak@yetiforce.com

Table of Contents

$statusColors  : array<string|int, mixed>
$activeStatuses  : array<string|int, mixed>
$rootNode  : array<string|int, mixed>
$statuses  : array<string|int, mixed>
$tasks  : array<string|int, mixed>
$tasksById  : array<string|int, mixed>
$tree  : array<string|int, mixed>
getAllData()  : array<string|int, mixed>
Get all projects from the system.
getById()  : array<string|int, mixed>
Get project data to display in view as gantt.
getGanttMilestones()  : array<string|int, milestone>
Get project milestones.
getGanttTasks()  : array<string|int, task>
Get project tasks.
getStatuses()  : mixed
Collect all statuses.
iterateNodes()  : mixed
Iterate through all tasks in tree.
addRootNode()  : mixed
Add root node to generate tree structure.
calculateDuration()  : int
Calculate duration in seconds.
calculateDurations()  : mixed
Calculate task duration in days.
calculateLevels()  : mixed
Calculate task levels and dependencies.
cleanup()  : array<string|int, task>
Remove root node and children because they are not needed anymore.
collectChildrens()  : mixed
Sort all node types (task,milestones,projects) so each parent task is before its child (frontend lib needs this).
findOutEndDates()  : int
Iterate through children and search for end date.
findOutStartDates()  : int
Iterate through children and search for start date.
flattenRecordTasks()  : array<string|int, task>
Flatten task tree with proper order to use it in frontend gantt lib.
getAllParentRecordsIds()  : array<string|int, mixed>
Collect all parents of all tasks.
getParentRecordsIdsRecursive()  : array<string|int, mixed>
Get parent nodes id as associative array [taskId]=>[parentId1,parentId2,...].
getProject()  : array<string|int, mixed>
Get project data.
getRecordWithChildren()  : array<string|int, mixed>
Collect task all parent nodes.
normalizeParents()  : mixed
Normalize task parent property set as 0 if not exists (root node).
prepareRecords()  : mixed
Prepare tasks and gather some information.

Properties

$statusColors

public array<string|int, mixed> $statusColors = []

colors for statuses

$activeStatuses

private array<string|int, mixed> $activeStatuses
  • without closing value - for JS filter

$rootNode

private array<string|int, mixed> $rootNode

rootNode needed for tree generation process

$statuses

private array<string|int, mixed> $statuses

statuses - with closing value

$tasks

private array<string|int, mixed> $tasks = []

project tasks,milesones and projects

$tasksById

private array<string|int, mixed> $tasksById = []

if some task is already loaded get it from here

$tree

private array<string|int, mixed> $tree = []

task nodes as tree with children

Methods

getAllData()

Get all projects from the system.

public getAllData([mixed|null $viewName = null ]) : array<string|int, mixed>
Parameters
$viewName : mixed|null = null
Return values
array<string|int, mixed>

projects,milestones,tasks

getById()

Get project data to display in view as gantt.

public getById(int|string $id) : array<string|int, mixed>
Parameters
$id : int|string
Return values
array<string|int, mixed>
  • projects,milestones,tasks

getGanttMilestones()

Get project milestones.

public getGanttMilestones(int|array<string|int, int> $projectIds) : array<string|int, milestone>
Parameters
$projectIds : int|array<string|int, int>
Return values
array<string|int, milestone>

getGanttTasks()

Get project tasks.

public getGanttTasks(int|array<string|int, int> $projectIds) : array<string|int, task>
Parameters
$projectIds : int|array<string|int, int>
Return values
array<string|int, task>

getStatuses()

Collect all statuses.

public getStatuses() : mixed
Return values
mixed

iterateNodes()

Iterate through all tasks in tree.

public iterateNodes(array<string|int, mixed> &$node, mixed $currentValue, callable $callback) : mixed
Parameters
$node : array<string|int, mixed>

starting point - might by rootNode

$currentValue : mixed

initial result which will be evaluated if there are some child nodes like array reduce

$callback : callable

what to do with task

Return values
mixed

addRootNode()

Add root node to generate tree structure.

private addRootNode() : mixed
Return values
mixed

calculateDuration()

Calculate duration in seconds.

private calculateDuration(string $startDateStr, string $endDateStr) : int
Parameters
$startDateStr : string
$endDateStr : string
Return values
int

calculateDurations()

Calculate task duration in days.

private calculateDurations() : mixed
Return values
mixed

calculateLevels()

Calculate task levels and dependencies.

private calculateLevels() : mixed
Return values
mixed

cleanup()

Remove root node and children because they are not needed anymore.

private cleanup(array<string|int, task$tasks) : array<string|int, task>
Parameters
$tasks : array<string|int, task>
Return values
array<string|int, task>

new array (not mutated)

collectChildrens()

Sort all node types (task,milestones,projects) so each parent task is before its child (frontend lib needs this).

private collectChildrens() : mixed
Return values
mixed

findOutEndDates()

Iterate through children and search for end date.

private findOutEndDates(array<string|int, mixed> &$node) : int
Parameters
$node : array<string|int, mixed>
Return values
int

timestamp

findOutStartDates()

Iterate through children and search for start date.

private findOutStartDates(array<string|int, mixed> &$node) : int
Parameters
$node : array<string|int, mixed>
Return values
int

timestamp

flattenRecordTasks()

Flatten task tree with proper order to use it in frontend gantt lib.

private flattenRecordTasks( $nodes[, array<string|int, mixed> $flat = [] ]) : array<string|int, task>
Parameters
$nodes :

tasks tree

$flat : array<string|int, mixed> = []

initial array

Return values
array<string|int, task>

getAllParentRecordsIds()

Collect all parents of all tasks.

private getAllParentRecordsIds() : array<string|int, mixed>
Return values
array<string|int, mixed>

getParentRecordsIdsRecursive()

Get parent nodes id as associative array [taskId]=>[parentId1,parentId2,...].

private getParentRecordsIdsRecursive(int|string $parentId[, array<string|int, mixed> $parents = [] ]) : array<string|int, mixed>
Parameters
$parentId : int|string
$parents : array<string|int, mixed> = []

initial value

Return values
array<string|int, mixed>

getProject()

Get project data.

private getProject(array<string|int, mixed>|int $id[, mixed|null $viewName = null ]) : array<string|int, mixed>
Parameters
$id : array<string|int, mixed>|int

project id

$viewName : mixed|null = null
Return values
array<string|int, mixed>

getRecordWithChildren()

Collect task all parent nodes.

private & getRecordWithChildren(array<string|int, mixed> &$task) : array<string|int, mixed>
Parameters
$task : array<string|int, mixed>
Return values
array<string|int, mixed>

task with parents property int[]

normalizeParents()

Normalize task parent property set as 0 if not exists (root node).

private normalizeParents() : mixed
Return values
mixed

prepareRecords()

Prepare tasks and gather some information.

private prepareRecords() : mixed
Return values
mixed

        

Search results