class Project

Introduction

The Project class represents a project, generally one taken on by a team within an organization. Attributes include project name, containing project space, starting and projected and actual completion dates, lead and optional co-lead, and containers for team members, basic accounting attributes, milestones, and deliverables.

Constructor:

Project Project (int project_space_guid, string name, string description, int lead [, int co_lead [, array start_date [, array projected_finish [, array finish_date)] ] ] ])

Used to create a new Project object. Before contained objects can be associated with the new project, it must be saved by calling project_object->save().
Note:
This method should only be used to create a new Project. To access an existing Project object, use Project::get_by_project_id().

Methods

Project get_by_project_id (int project_id)
void load_containers ()
void save ()
int get_project_id ()
string get_project_name ()
void change_project_name (string new_project_name)
int get_project_lead ()
void change_project_lead (int new_lead_id)
int get_project_co_lead ()
void set_project_co_lead (int new_co_lead_id)
text get_project_description ()
void change_project_description (text new_description)
array get_start_date ()
void set_start_date (array start_date)
array get_projected_finish ()
void set_projected_finish (array projected_finish)
array get_finish_date ()
void set_finish_date (array finish_date)
boolean is_modified ()
array as_array ()
string to_string ()
string to_HTML_string ()

Container Accessor Methods

array get_participants ()
array get_allocations ()
array get_expenditures ()
array get_milestones ()
array get_deliverables ()
void load_containers ()

Loads all container attributes of the Project object. The following containers will be loaded: task headers, participants, allocations, expenditures, milestones, and deliverables. These containers can then be accessed by calling the related accessor methods

Note: This method should not be called on a newly-created Project object until that object has been saved by calling project_object->save().

mixed save ()

This method should be called to save either a newly created Project object, or one that has been modified. Most operations on a newly-created object will required that it be saved before use. Returns 1 on success, or an array with keys "error" and "rows affected" on failure.

int get_project_id ()

Returns the unique ID for the project. This GUID can then be used when accessing to the project. Returns NULL if project has not been saved.

string get_project_name()

Returns the name of the Project object.

void change_project_name (string new_project_name)

Changes the name of the current Project object to project_name.

int get_project_lead()

Returns the unique ID of the Person assigned as lead fo the current project.

void change_project_lead (int new_lead_id)

Changes the project lead to the person whose unique ID is new_lead_id

int get_project_co_lead ()

Returns the unique ID of the Person assigned as co-lead fo the current project.

void set_project_co_lead (int new_co_lead_id)

Assigns the person whose unigue ID is new_co_lead_id as the co-lead on the current project

text get_project_description ()

Returns the description text for the current project.

void change_project_description (text new_description)

Changes the description text of the current project to the text provided by new_description

array get_start_date ()

Returns an associative array with keys 'year', 'month', and 'day' if the start date for the current project has been set. Othewise returns an empty array.

void set_start_date (array start_date)

Sets or changes the start date for the current project to the value given by start_date.

array get_projected_finish ()

Returns an associative array with keys 'year', 'month', and 'day' if the projected finish date for the current project has been set. Othewise returns an empty array.

void set_projected_finish (array projected_finish)

Sets or changes the projected finish date for the current project to the value given by projected_finish.

array get_finish_date ()

Returns an associative array with keys 'year', 'month', and 'day' if the actual completion date for the current project has been set. Othewise returns an empty array.

void set_finish_date (array finish_date)

Records the completion of the project or task by setting the finish date to the value given by finish_date.

boolean is_modified ()

Returns true if the Project object has been newly created and not saved, or if it has been modified since it was loaded.

array as_array ()

Returns an associative array with keys:
Mandatory: project_name, description, lead
Optional: co_lead, start_date, projected_finish, finish_date
Collections: participants, task_ids, expenditures, allocations, milestones, deliverables.
If optional keys have not been set, they will not be defined in the returned array. Collection keys will contain empty arrays if corresponding collections have not yet been loaded, or are empty.

string to_string ()

Returns a plain-text string describing the current Project object. May be used for debugging when printng to a log file or console.

string to_HTML_string ()

Returns an HTML-formatted string describing the current project object. May be used for debugging directly to the browser.

Container Accessor Methods:

The following methods provide access to collections of objects related to the current project. These include Person objects for participants, Allocation and Expenditure objects for budget items specifically tied to the current project, and Milestone and Deliverable objects used as progress indicators for the project.

In this version of the Project Manager API, no methods for creating these objects are provided within the Project class. Each of these classes has its own constructor, which takes a project_id argument. These constructors may be called when creating new objects. The ProjectManager class also provides methods for creating each type of object and associating it with a specific Project object.

array get_participants ()

Returns an array containing Person objects corresponding to each person currently listed as a participant in the current project.

array get_allocations ()

Returns an array containing Allocation objects for all allocations specified directly for use on the current project.

array get_expenditures ()

Returns an array containing Expenditure objects for all expenditures billed directly to the current project.

array get_milestones ()

Returns an array containing Milestone objects for all milestones set or achieved that relate directly to the current project.

type get_deliverables ()

Returns an array containing Deliverable objects for all deliverables specified directly for the current project.

See Also:

class OtherClass