This section covers methods used for managing projects in activeCollab.
object ActiveCollab::findProjectById( int $project_id) - Fetches an ActiveCollabProject object
Parameters:
project_id - id of a specific project
Return value: Object instance of ActiveCollabProject
object $project = new ActiveCollabProject(void) - Creates a new ActiveCollabProject object
Variable value: Object instance of ActiveCollabProject
These methods are called out through an project object.
• setCompanyId(int $company_id) - Sets the id of the company of the project
• setStartsOn(string $starts_on) - Sets the start date of the project
• setGroupID(int $group_id) - Sets the id of the group of the project
• setName(string $name) - Sets the name of the project
• setOverview(string $overview) - Sets the overview of the project
• setLeaderId(int $user) - Sets the id of the leader user of the project
• save(void) - Saves the project object into activeCollab
• delete(void) - Deletes the project from activeCollab
• changeStatus(int $status) - Sets the status of the project; the status parameter can be a combination of the following constants: ACTIVECOLLAB_PROJECT_STATUS_ACTIVE, ACTIVECOLLAB_PROJECT_STATUS_PAUSED,ACTIVECOLLAB_PROJECT_STATUS_COMPLETED,ACTIVECOLLAB_PROJECT_STATUS_CANCELED
• getUserLoggedUserPermission(void) - gets permission of the logged user
• getIconUrl(void) - gets the URL of the project icon
• getUserTasks(void) - list all the tasks of the user (returns array of ticket objects)
These methods are used for adding users and their project roles to the project.
Example code:
$project = ActiveCollab::findProjectById(5);
$permission = array();
$permission['milestone'] = ACTIVECOLLAB_PERMISSION_NO_ACCESS;
$permission['discussion'] = ACTIVECOLLAB_PERMISSION_HAS_ACCESS;
$permission['file'] = ACTIVECOLLAB_PERMISSION_NO_ACCESS;
$permission['page'] = ACTIVECOLLAB_PERMISSION_HAS_ACCESS;
$permission['ticket'] = ACTIVECOLLAB_PERMISSION_CAN_CREATE;
$permission['checklist'] = ACTIVECOLLAB_PERMISSION_CAN_CREATE;
$permission['timerecord'] = ACTIVECOLLAB_PERMISSION_CAN_MANAGE;
$project->addUsers(array(5),$permission);
$project->changeUserPermission(5,$permission);
$project->removeUserFromProject(5);
Available permission constants:
• ACTIVECOLLAB_PERMISSION_NO_ACCESS
• ACTIVECOLLAB_PERMISSION_HAS_ACCESS
• ACTIVECOLLAB_PERMISSION_CAN_CREATE
• ACTIVECOLLAB_PERMISSION_CAN_MANAGE
These methods are used for managing project groups.
$group = new ActiveCollabProjectGroup();
$group = ActiveCollab::findProjectGroupById(1);
$group->setName('Gavric11');
$group->save();
$group->delete();