diff --git a/api/README.md b/api/README.md index 7bd1863..84898c9 100644 --- a/api/README.md +++ b/api/README.md @@ -91,7 +91,7 @@ If `Module` and `Service` have the same name they can be summarized to `leantime | Available Services | Description | |--- |--- | -| [Projects](api/classes/Leantime/Domain/Projects/Services/Projects.md) | | +| [Projects](api/classes/Leantime/Domain/Projects/Services/Projects.md) | Class Projects| ## `leantime.rpc.Queue` diff --git a/api/classes/Leantime/Domain/Projects/Services/Projects.md b/api/classes/Leantime/Domain/Projects/Services/Projects.md index 836fa34..d21dde8 100644 --- a/api/classes/Leantime/Domain/Projects/Services/Projects.md +++ b/api/classes/Leantime/Domain/Projects/Services/Projects.md @@ -5,16 +5,18 @@ footer: false # Projects +Class Projects - - +This class represents a collection of methods related to projects. +It provides functionality to retrieve project types, project data, +project progress, users to notify in a project, and send project notifications. `leantime.rpc.Projects.Projects.` ## Available Methods ### `leantime.rpc.Projects.Projects.getProjectTypes` - +Gets the project types. ```json { @@ -50,7 +52,7 @@ footer: false --- ### `leantime.rpc.Projects.Projects.getProject` - +Gets the project with the given ID. ```json { @@ -75,16 +77,16 @@ footer: false | Parameter | Type | Description | |-----------|------|-------------| -| `id` | **int** | | +| `id` | **int** | The ID of the project to retrieve. | **Returns:** - +Returns the project data as an associative array if the project exists, otherwise returns false. ```json { "jsonrpc": "2.0", "id": 1, - "result": array|bool + "result": bool|array } ``` @@ -93,7 +95,7 @@ footer: false --- ### `leantime.rpc.Projects.Projects.getProjectProgress` - +Gets the progress of a project. ```json { @@ -101,13 +103,14 @@ footer: false "jsonrpc": "2.0", "id": 1, "params": { - "projectId": , + "projectId": int, } } ``` - +Calculates the completion percentage, estimated completion date, +and planned completion date of the project. @@ -118,11 +121,11 @@ footer: false | Parameter | Type | Description | |-----------|------|-------------| -| `projectId` | **** | | +| `projectId` | **int** | The ID of the project. | **Returns:** - +The progress of the project. ```json { "jsonrpc": "2.0", @@ -136,7 +139,7 @@ footer: false --- ### `leantime.rpc.Projects.Projects.getUsersToNotify` - +Gets an array of user IDs to notify for a given project. ```json { @@ -144,7 +147,7 @@ footer: false "jsonrpc": "2.0", "id": 1, "params": { - "projectId": , + "projectId": int, } } ``` @@ -161,11 +164,11 @@ footer: false | Parameter | Type | Description | |-----------|------|-------------| -| `projectId` | **** | | +| `projectId` | **int** | The ID of the project to get users to notify for. | **Returns:** - +An array of user IDs. ```json { "jsonrpc": "2.0", @@ -179,7 +182,7 @@ footer: false --- ### `leantime.rpc.Projects.Projects.getAllUserInfoToNotify` - +Gets all the users who need to be notified for a given project. ```json { @@ -187,7 +190,7 @@ footer: false "jsonrpc": "2.0", "id": 1, "params": { - "projectId": , + "projectId": int, } } ``` @@ -204,11 +207,11 @@ footer: false | Parameter | Type | Description | |-----------|------|-------------| -| `projectId` | **** | | +| `projectId` | **int** | The ID of the project. | **Returns:** - +An array of users to notify. ```json { "jsonrpc": "2.0", @@ -222,7 +225,7 @@ footer: false --- ### `leantime.rpc.Projects.Projects.notifyProjectUsers` - +Notifies the users associated with a project about a notification. ```json { @@ -247,7 +250,7 @@ footer: false | Parameter | Type | Description | |-----------|------|-------------| -| `notification` | **\Leantime\Domain\Notifications\Models\Notification** | | +| `notification` | **\Leantime\Domain\Notifications\Models\Notification** | The notification object to send. | **Returns:** @@ -265,7 +268,7 @@ footer: false --- ### `leantime.rpc.Projects.Projects.getProjectName` - +Retrieves the name of a project based on its ID. ```json { @@ -273,7 +276,7 @@ footer: false "jsonrpc": "2.0", "id": 1, "params": { - "projectId": , + "projectId": int, } } ``` @@ -290,16 +293,16 @@ footer: false | Parameter | Type | Description | |-----------|------|-------------| -| `projectId` | **** | | +| `projectId` | **int** | The ID of the project. | **Returns:** - +The name of the project, or null if the project does not exist. ```json { "jsonrpc": "2.0", "id": 1, - "result": mixed|void + "result": string|null } ``` @@ -308,7 +311,7 @@ footer: false --- ### `leantime.rpc.Projects.Projects.getProjectIdAssignedToUser` - +Gets the project IDs assigned to a specified user. ```json { @@ -316,7 +319,7 @@ footer: false "jsonrpc": "2.0", "id": 1, "params": { - "userId": , + "userId": int, } } ``` @@ -333,16 +336,16 @@ footer: false | Parameter | Type | Description | |-----------|------|-------------| -| `userId` | **** | | +| `userId` | **int** | The ID of the user. | **Returns:** - +The project IDs assigned to the user, or false if no projects are found. ```json { "jsonrpc": "2.0", "id": 1, - "result": array|false + "result": false|array } ``` @@ -351,7 +354,7 @@ footer: false --- ### `leantime.rpc.Projects.Projects.getProjectsAssignedToUser` - +Gets projects assigned to a user. ```json { @@ -359,9 +362,9 @@ footer: false "jsonrpc": "2.0", "id": 1, "params": { - "userId": , + "userId": int, "projectStatus": string, - "clientId": , + "clientId": int|null, } } ``` @@ -378,13 +381,13 @@ footer: false | Parameter | Type | Description | |-----------|------|-------------| -| `userId` | **** | | -| `projectStatus` | **string** | | -| `clientId` | **** | | +| `userId` | **int** | The ID of the user. | +| `projectStatus` | **string** | The status of the projects. Defaults to "open". | +| `clientId` | **int|null** | The ID of the client. Defaults to null. | **Returns:** - +The projects assigned to the user. ```json { "jsonrpc": "2.0", @@ -398,7 +401,7 @@ footer: false --- ### `leantime.rpc.Projects.Projects.findMyChildren` - +Finds all children projects for a given parent project. ```json { @@ -406,7 +409,7 @@ footer: false "jsonrpc": "2.0", "id": 1, "params": { - "currentParentId": , + "currentParentId": mixed, "projects": array, } } @@ -424,12 +427,12 @@ footer: false | Parameter | Type | Description | |-----------|------|-------------| -| `currentParentId` | **** | | -| `projects` | **array** | | +| `currentParentId` | **mixed** | The ID of the current parent project. | +| `projects` | **array** | An array of projects to search for children. | **Returns:** - +An array of children projects found. ```json { "jsonrpc": "2.0", @@ -443,7 +446,7 @@ footer: false --- ### `leantime.rpc.Projects.Projects.cleanParentRelationship` -Ensures all projects have a valid parent. If not the parent is removed. +Cleans the parent relationship in the given array of projects. ```json { @@ -457,7 +460,8 @@ Ensures all projects have a valid parent. If not the parent is removed. ``` -This way a user can still access a project even if they don't have access to the child. +Removes projects that have a parent project that does not exist in the array. +Assigns a parent id of 0 to projects that have no parent. @@ -468,11 +472,11 @@ This way a user can still access a project even if they don't have access to the | Parameter | Type | Description | |-----------|------|-------------| -| `projects` | **array** | | +| `projects` | **array** | An array of projects | **Returns:** - +The cleaned array of projects ```json { "jsonrpc": "2.0", @@ -486,7 +490,7 @@ This way a user can still access a project even if they don't have access to the --- ### `leantime.rpc.Projects.Projects.getProjectHierarchyAssignedToUser` - +Gets the hierarchy of projects assigned to a user. ```json { @@ -494,9 +498,9 @@ This way a user can still access a project even if they don't have access to the "jsonrpc": "2.0", "id": 1, "params": { - "userId": , + "userId": int, "projectStatus": string, - "clientId": , + "clientId": int|null, } } ``` @@ -513,13 +517,13 @@ This way a user can still access a project even if they don't have access to the | Parameter | Type | Description | |-----------|------|-------------| -| `userId` | **** | | -| `projectStatus` | **string** | | -| `clientId` | **** | | +| `userId` | **int** | The ID of the user. | +| `projectStatus` | **string** | The project status. Default is "open". | +| `clientId` | **int|null** | The ID of the client. Default is null. | **Returns:** - +An array containing the assigned projects, the project hierarchy, and the favorite projects. ```json { "jsonrpc": "2.0", @@ -533,7 +537,7 @@ This way a user can still access a project even if they don't have access to the --- ### `leantime.rpc.Projects.Projects.getProjectHierarchyAvailableToUser` - +Gets the project hierarchy available to a user. ```json { @@ -541,9 +545,9 @@ This way a user can still access a project even if they don't have access to the "jsonrpc": "2.0", "id": 1, "params": { - "userId": , + "userId": int, "projectStatus": string, - "clientId": , + "clientId": int|null, } } ``` @@ -560,13 +564,16 @@ This way a user can still access a project even if they don't have access to the | Parameter | Type | Description | |-----------|------|-------------| -| `userId` | **** | | -| `projectStatus` | **string** | | -| `clientId` | **** | | +| `userId` | **int** | The ID of the user. | +| `projectStatus` | **string** | The status of the projects to retrieve. Defaults to "open". | +| `clientId` | **int|null** | The ID of the client. Defaults to null. | **Returns:** - +Returns an array containing the following keys: +- "allAvailableProjects": An array of all projects available to the user. +- "allAvailableProjectsHierarchy": An array representing the project hierarchy available to the user. +- "clients": An array of clients associated with the projects available to the user. ```json { "jsonrpc": "2.0", @@ -595,51 +602,6 @@ Gets all the clients available to a user. ``` -Clients are determined by the projects -the user is assigned to. - - - - - - -**Parameters:** - -| Parameter | Type | Description | -|-----------|------|-------------| -| `userId` | **int** | The ID of the user. | -| `projectStatus` | **string** | (optional) The status of the projects to consider. Defaults to "open". | - - -**Returns:** -An array of client objects. -```json -{ - "jsonrpc": "2.0", - "id": 1, - "result": array -} -``` - - - ---- -### `leantime.rpc.Projects.Projects.getClientsFromProjectList` - - - -```json -{ - "method": "leantime.rpc.Projects.Projects.getClientsFromProjectList", - "jsonrpc": "2.0", - "id": 1, - "params": { - "projects": array, - } -} -``` - - @@ -651,11 +613,12 @@ An array of client objects. | Parameter | Type | Description | |-----------|------|-------------| -| `projects` | **array** | | +| `userId` | **int** | The ID of the user. | +| `projectStatus` | **string** | The status of the projects to be considered. Defaults to "open". | **Returns:** - +An array of clients available to the user. ```json { "jsonrpc": "2.0", @@ -669,7 +632,7 @@ An array of client objects. --- ### `leantime.rpc.Projects.Projects.getProjectRole` - +Gets the role of a user in a specific project. ```json { @@ -677,8 +640,8 @@ An array of client objects. "jsonrpc": "2.0", "id": 1, "params": { - "userId": , - "projectId": , + "userId": mixed, + "projectId": mixed, } } ``` @@ -695,17 +658,17 @@ An array of client objects. | Parameter | Type | Description | |-----------|------|-------------| -| `userId` | **** | | -| `projectId` | **** | | +| `userId` | **mixed** | The user ID. | +| `projectId` | **mixed** | The project ID. | **Returns:** - +The role of the user in the project (string) or an empty string if the user is not assigned to the project or if the project role is not defined. ```json { "jsonrpc": "2.0", "id": 1, - "result": mixed|string + "result": mixed } ``` @@ -714,7 +677,7 @@ An array of client objects. --- ### `leantime.rpc.Projects.Projects.getProjectsUserHasAccessTo` - +Gets the projects that a user has access to. ```json { @@ -722,7 +685,7 @@ An array of client objects. "jsonrpc": "2.0", "id": 1, "params": { - "userId": , + "userId": int, } } ``` @@ -739,11 +702,11 @@ An array of client objects. | Parameter | Type | Description | |-----------|------|-------------| -| `userId` | **** | | +| `userId` | **int** | The ID of the user. | **Returns:** - +The array of projects if the user has access, false otherwise. ```json { "jsonrpc": "2.0", @@ -754,84 +717,10 @@ An array of client objects. ---- -### `leantime.rpc.Projects.Projects.setCurrentProject` - -Sets the current project in the session. - -```json -{ - "method": "leantime.rpc.Projects.Projects.setCurrentProject", - "jsonrpc": "2.0", - "id": 1, - "params": { - } -} -``` - - -If a project ID is provided in the query string, it is used to set the current project. -If no project ID is provided, the last visited project or the first assigned project is set as the current project. -If no project is found, an exception is thrown. - - - - - - - -**Returns:** - -```json -{ - "jsonrpc": "2.0", - "id": 1, - "result": void -} -``` - - - ---- -### `leantime.rpc.Projects.Projects.getCurrentProjectId` - -Get current project id or 0 if no current project is set. - -```json -{ - "method": "leantime.rpc.Projects.Projects.getCurrentProjectId", - "jsonrpc": "2.0", - "id": 1, - "params": { - } -} -``` - - - - - - - - - - -**Returns:** - -```json -{ - "jsonrpc": "2.0", - "id": 1, - "result": int -} -``` - - - --- ### `leantime.rpc.Projects.Projects.changeCurrentSessionProject` - +Change the current session project to the specified projectId. ```json { @@ -839,7 +728,7 @@ Get current project id or 0 if no current project is set. "jsonrpc": "2.0", "id": 1, "params": { - "projectId": , + "projectId": mixed, } } ``` @@ -856,11 +745,11 @@ Get current project id or 0 if no current project is set. | Parameter | Type | Description | |-----------|------|-------------| -| `projectId` | **** | | +| `projectId` | **mixed** | The ID of the project to set as current. | **Returns:** - +Returns true if the current project is successfully changed, false otherwise. ```json { "jsonrpc": "2.0", @@ -872,16 +761,17 @@ Get current project id or 0 if no current project is set. --- -### `leantime.rpc.Projects.Projects.resetCurrentProject` - +### `leantime.rpc.Projects.Projects.getUsersAssignedToProject` +Gets all the users assigned to a specific project. ```json { - "method": "leantime.rpc.Projects.Projects.resetCurrentProject", + "method": "leantime.rpc.Projects.Projects.getUsersAssignedToProject", "jsonrpc": "2.0", "id": 1, "params": { + "projectId": int, } } ``` @@ -894,31 +784,38 @@ Get current project id or 0 if no current project is set. +**Parameters:** -**Returns:** +| Parameter | Type | Description | +|-----------|------|-------------| +| `projectId` | **int** | The ID of the project. | + +**Returns:** +An array of users assigned to the project. ```json { "jsonrpc": "2.0", "id": 1, - "result": void + "result": array } ``` --- -### `leantime.rpc.Projects.Projects.getUsersAssignedToProject` - +### `leantime.rpc.Projects.Projects.isUserAssignedToProject` +Checks if a user is assigned to a particular project. ```json { - "method": "leantime.rpc.Projects.Projects.getUsersAssignedToProject", + "method": "leantime.rpc.Projects.Projects.isUserAssignedToProject", "jsonrpc": "2.0", "id": 1, "params": { - "projectId": , + "userId": int, + "projectId": int, } } ``` @@ -935,16 +832,17 @@ Get current project id or 0 if no current project is set. | Parameter | Type | Description | |-----------|------|-------------| -| `projectId` | **** | | +| `userId` | **int** | The ID of the user being checked. | +| `projectId` | **int** | The ID of the project being checked. | **Returns:** - +Returns true if the user is assigned to the project, false otherwise. ```json { "jsonrpc": "2.0", "id": 1, - "result": array + "result": bool } ``` @@ -953,7 +851,7 @@ Get current project id or 0 if no current project is set. --- ### `leantime.rpc.Projects.Projects.isUserMemberOfProject` -Checks if a user is directly assigned to a project. +Checks if a user is a member of a specific project. ```json { @@ -968,7 +866,7 @@ Checks if a user is directly assigned to a project. ``` -Client assignments or projects available to entire organization are not considered true. + @@ -979,12 +877,12 @@ Client assignments or projects available to entire organization are not consider | Parameter | Type | Description | |-----------|------|-------------| -| `userId` | **int** | | -| `projectId` | **int** | | +| `userId` | **int** | - The ID of the user. | +| `projectId` | **int** | - The ID of the project. | **Returns:** - +- Returns true if the user is a member of the project, otherwise false. ```json { "jsonrpc": "2.0", @@ -998,7 +896,7 @@ Client assignments or projects available to entire organization are not consider --- ### `leantime.rpc.Projects.Projects.addProject` -Adds a new project to the system. +Adds a new project. ```json { @@ -1023,11 +921,11 @@ Adds a new project to the system. | Parameter | Type | Description | |-----------|------|-------------| -| `values` | **array** | An associative array containing the project details.
- name: The name of the project.
- details: Additional details of the project (optional, default: '').
- clientId: The ID of the client associated with the project.
- hourBudget: The hour budget for the project (optional, default: 0).
- assignedUsers: Comma-separated list of user IDs assigned to the project (optional, default: '').
- dollarBudget: The dollar budget for the project (optional, default: 0).
- psettings: The settings for the project (optional, default: 'restricted').
- type: The type of the project (optional, default: 'project').
- start: The start date of the project in user format (YYYY-MM-DD).
- end: The end date of the project in user format (YYYY-MM-DD). | +| `values` | **array** | The project data.
- name: string (required) The name of the project.
- details: string (optional) Additional details about the project.
- clientId: int (required) The ID of the client associated with the project.
- hourBudget: int (optional) The hour budget for the project (defaults to 0).
- assignedUsers: string (optional) The list of assigned users (defaults to an empty string).
- dollarBudget: int (optional) The dollar budget for the project (defaults to 0).
- psettings: string (optional) The project settings (defaults to 'restricted').
- type: string (fixed value 'project') The type of the project.
- start: string|null The start date of the project in user format or null.
- end: string|null The end date of the project in user format or null. | **Returns:** -The ID of the newly added project +The ID of the added project, or false if the project could not be added. ```json { "jsonrpc": "2.0", @@ -1041,7 +939,7 @@ The ID of the newly added project --- ### `leantime.rpc.Projects.Projects.duplicateProject` - +Duplicates a project with the specified details. ```json { @@ -1070,15 +968,15 @@ The ID of the newly added project | Parameter | Type | Description | |-----------|------|-------------| -| `projectId` | **int** | | -| `clientId` | **int** | | -| `projectName` | **string** | | -| `userStartDate` | **string** | | -| `assignSameUsers` | **bool** | | +| `projectId` | **int** | The ID of the project to duplicate. | +| `clientId` | **int** | The ID of the client for the duplicate project. | +| `projectName` | **string** | The name of the duplicate project. | +| `userStartDate` | **string** | The start date of the duplicate project in the format specified by the language setting. | +| `assignSameUsers` | **bool** | Whether to assign the same users as the original project. | **Returns:** - +Returns true if the project was successfully duplicated, or the ID of the new project if successful. ```json { "jsonrpc": "2.0", @@ -1092,7 +990,7 @@ The ID of the newly added project --- ### `leantime.rpc.Projects.Projects.duplicateCanvas` - +Duplicate a canvas from one project to another. ```json { @@ -1120,14 +1018,14 @@ The ID of the newly added project | Parameter | Type | Description | |-----------|------|-------------| -| `repository` | **string** | | -| `originalProjectId` | **int** | | -| `newProjectId` | **int** | | -| `canvasTypeName` | **string** | | +| `repository` | **string** | The repository class to use for CRUD operations | +| `originalProjectId` | **int** | The ID of the original project | +| `newProjectId` | **int** | The ID of the new project | +| `canvasTypeName` | **string** | The canvas type name (optional) | **Returns:** - +True if the canvas is duplicated successfully, false otherwise ```json { "jsonrpc": "2.0", @@ -1141,7 +1039,7 @@ The ID of the newly added project --- ### `leantime.rpc.Projects.Projects.getProjectUserRelation` - +Retrieves the relation between a project and its users. ```json { @@ -1149,7 +1047,7 @@ The ID of the newly added project "jsonrpc": "2.0", "id": 1, "params": { - "id": , + "id": int, } } ``` @@ -1166,11 +1064,11 @@ The ID of the newly added project | Parameter | Type | Description | |-----------|------|-------------| -| `id` | **** | | +| `id` | **int** | The ID of the project. | **Returns:** - +The relation between the project and its users. ```json { "jsonrpc": "2.0", @@ -1184,7 +1082,7 @@ The ID of the newly added project --- ### `leantime.rpc.Projects.Projects.patch` - +Updates a project with the given parameters. ```json { @@ -1192,8 +1090,8 @@ The ID of the newly added project "jsonrpc": "2.0", "id": 1, "params": { - "id": , - "params": , + "id": int, + "params": array, } } ``` @@ -1210,12 +1108,12 @@ The ID of the newly added project | Parameter | Type | Description | |-----------|------|-------------| -| `id` | **** | | -| `params` | **** | | +| `id` | **int** | The ID of the project. | +| `params` | **array** | The parameters to update the project. | **Returns:** - +Returns true if the project was successfully updated, false otherwise. ```json { "jsonrpc": "2.0", @@ -1229,7 +1127,7 @@ The ID of the newly added project --- ### `leantime.rpc.Projects.Projects.getProjectAvatar` - +Retrieves the avatar for a project. ```json { @@ -1237,7 +1135,7 @@ The ID of the newly added project "jsonrpc": "2.0", "id": 1, "params": { - "id": , + "id": mixed, } } ``` @@ -1254,11 +1152,11 @@ The ID of the newly added project | Parameter | Type | Description | |-----------|------|-------------| -| `id` | **** | | +| `id` | **mixed** | The ID of the project. | **Returns:** - +The avatar for the project. ```json { "jsonrpc": "2.0", @@ -1272,7 +1170,7 @@ The ID of the newly added project --- ### `leantime.rpc.Projects.Projects.setProjectAvatar` - +Sets the avatar for a project. ```json { @@ -1280,8 +1178,8 @@ The ID of the newly added project "jsonrpc": "2.0", "id": 1, "params": { - "file": , - "project": , + "file": mixed, + "project": mixed, } } ``` @@ -1298,145 +1196,12 @@ The ID of the newly added project | Parameter | Type | Description | |-----------|------|-------------| -| `file` | **** | | -| `project` | **** | | +| `file` | **mixed** | The file containing the avatar. | +| `project` | **mixed** | The project object. | **Returns:** - -```json -{ - "jsonrpc": "2.0", - "id": 1, - "result": null -} -``` - - - ---- -### `leantime.rpc.Projects.Projects.getProjectSetupChecklist` - - - -```json -{ - "method": "leantime.rpc.Projects.Projects.getProjectSetupChecklist", - "jsonrpc": "2.0", - "id": 1, - "params": { - "projectId": , - } -} -``` - - - - - - - - - -**Parameters:** - -| Parameter | Type | Description | -|-----------|------|-------------| -| `projectId` | **** | | - - -**Returns:** - -```json -{ - "jsonrpc": "2.0", - "id": 1, - "result": array -} -``` - - - ---- -### `leantime.rpc.Projects.Projects.updateProjectProgress` - - - -```json -{ - "method": "leantime.rpc.Projects.Projects.updateProjectProgress", - "jsonrpc": "2.0", - "id": 1, - "params": { - "stepsComplete": , - "projectId": , - } -} -``` - - - - - - - - - -**Parameters:** - -| Parameter | Type | Description | -|-----------|------|-------------| -| `stepsComplete` | **** | | -| `projectId` | **** | | - - -**Returns:** - -```json -{ - "jsonrpc": "2.0", - "id": 1, - "result": void -} -``` - - - ---- -### `leantime.rpc.Projects.Projects.editUserProjectRelations` - -Edits the project relations of a user. - -```json -{ - "method": "leantime.rpc.Projects.Projects.editUserProjectRelations", - "jsonrpc": "2.0", - "id": 1, - "params": { - "id": int, - "projects": array, - } -} -``` - - - - - - - - - -**Parameters:** - -| Parameter | Type | Description | -|-----------|------|-------------| -| `id` | **int** | The ID of the user. | -| `projects` | **array** | An array of project IDs to be assigned to the user. | - - -**Returns:** -Returns true if the project relations were successfully edited, false otherwise. +Indicates whether the avatar was successfully set. ```json { "jsonrpc": "2.0", @@ -1448,18 +1213,16 @@ Returns true if the project relations were successfully edited, false otherwise. --- -### `leantime.rpc.Projects.Projects.getProjectIdbyName` +### `leantime.rpc.Projects.Projects.getAllProjects` -Returns the project ID by its name from the given array of projects. +Retrieves all projects. ```json { - "method": "leantime.rpc.Projects.Projects.getProjectIdbyName", + "method": "leantime.rpc.Projects.Projects.getAllProjects", "jsonrpc": "2.0", "id": 1, "params": { - "allProjects": array, - "projectName": string, } } ``` @@ -1472,194 +1235,9 @@ Returns the project ID by its name from the given array of projects. -**Parameters:** - -| Parameter | Type | Description | -|-----------|------|-------------| -| `allProjects` | **array** | An array of projects. | -| `projectName` | **string** | The name of the project to search for. | - **Returns:** -The ID of the project if found, or false if not found. -```json -{ - "jsonrpc": "2.0", - "id": 1, - "result": int|bool -} -``` - - - ---- -### `leantime.rpc.Projects.Projects.updateProjectSorting` - - - -```json -{ - "method": "leantime.rpc.Projects.Projects.updateProjectSorting", - "jsonrpc": "2.0", - "id": 1, - "params": { - "params": , - } -} -``` - - - - - - - - - -**Parameters:** - -| Parameter | Type | Description | -|-----------|------|-------------| -| `params` | **** | | - - -**Returns:** - -```json -{ - "jsonrpc": "2.0", - "id": 1, - "result": false|void -} -``` - - - ---- -### `leantime.rpc.Projects.Projects.editProject` - -Edits a project with the given values. - -```json -{ - "method": "leantime.rpc.Projects.Projects.editProject", - "jsonrpc": "2.0", - "id": 1, - "params": { - "values": mixed, - "id": int, - } -} -``` - - - - - - - - - -**Parameters:** - -| Parameter | Type | Description | -|-----------|------|-------------| -| `values` | **mixed** | The values to update the project with. | -| `id` | **int** | The ID of the project to edit. | - - -**Returns:** - -```json -{ - "jsonrpc": "2.0", - "id": 1, - "result": void -} -``` - - - ---- -### `leantime.rpc.Projects.Projects.updateProjectStatusAndSorting` - - - -```json -{ - "method": "leantime.rpc.Projects.Projects.updateProjectStatusAndSorting", - "jsonrpc": "2.0", - "id": 1, - "params": { - "params": , - "handler": , - } -} -``` - - - - - - - - - -**Parameters:** - -| Parameter | Type | Description | -|-----------|------|-------------| -| `params` | **** | | -| `handler` | **** | | - - -**Returns:** - -```json -{ - "jsonrpc": "2.0", - "id": 1, - "result": bool -} -``` - - - ---- -### `leantime.rpc.Projects.Projects.getClientManagerProjects` - -Gets all the projects a company manager has access to. - -```json -{ - "method": "leantime.rpc.Projects.Projects.getClientManagerProjects", - "jsonrpc": "2.0", - "id": 1, - "params": { - "userId": int, - "clientId": int, - } -} -``` - - -Includes all projects within a client + all assigned projects - - - - - - -**Parameters:** - -| Parameter | Type | Description | -|-----------|------|-------------| -| `userId` | **int** | | -| `clientId` | **int** | | - - -**Returns:** - +The projects. ```json { "jsonrpc": "2.0", @@ -1673,7 +1251,7 @@ Includes all projects within a client + all assigned projects --- ### `leantime.rpc.Projects.Projects.getAll` - +Gets all the projects for the current user. ```json { @@ -1687,7 +1265,7 @@ Includes all projects within a client + all assigned projects ``` - +By default, closed projects are not included. @@ -1698,11 +1276,11 @@ Includes all projects within a client + all assigned projects | Parameter | Type | Description | |-----------|------|-------------| -| `showClosedProjects` | **bool** | | +| `showClosedProjects` | **bool** | (optional) Set to true to include closed projects. | **Returns:** - +Returns an array of projects. ```json { "jsonrpc": "2.0", @@ -1716,7 +1294,7 @@ Includes all projects within a client + all assigned projects --- ### `leantime.rpc.Projects.Projects.findProject` - +Finds projects based on a search term. ```json { @@ -1741,11 +1319,11 @@ Includes all projects within a client + all assigned projects | Parameter | Type | Description | |-----------|------|-------------| -| `term` | **string** | | +| `term` | **string** | The search term (optional) | **Returns:** - +The filtered projects that match the search term ```json { "jsonrpc": "2.0", @@ -1759,7 +1337,7 @@ Includes all projects within a client + all assigned projects --- ### `leantime.rpc.Projects.Projects.pollForNewProjects` - +Polls for new projects for the current user session. ```json { @@ -1772,7 +1350,7 @@ Includes all projects within a client + all assigned projects ``` - +Retrieves all projects for the current user and prepares the dates for API response. @@ -1781,7 +1359,7 @@ Includes all projects within a client + all assigned projects **Returns:** - +An array of projects with prepared dates for API response. ```json { "jsonrpc": "2.0", @@ -1795,7 +1373,7 @@ Includes all projects within a client + all assigned projects --- ### `leantime.rpc.Projects.Projects.pollForUpdatedProjects` - +Polls for updated projects. ```json { @@ -1808,7 +1386,8 @@ Includes all projects within a client + all assigned projects ``` - +Retrieves all the projects the current user has access to and prepares them for API response. +Adds the modified timestamp to the project ID for tracking updates. diff --git a/technical/README.md b/technical/README.md index 821a0f5..dc76406 100644 --- a/technical/README.md +++ b/technical/README.md @@ -1488,7 +1488,7 @@ This is an automatically generated documentation for **Leantime Code Reference** | Class | Description | |--- |--- | -| [Projects](technical/classes/Leantime/Domain/Projects/Services/Projects.md) | | +| [Projects](technical/classes/Leantime/Domain/Projects/Services/Projects.md) | Class Projects| diff --git a/technical/classes/Leantime/Domain/Projects/Services/Projects.md b/technical/classes/Leantime/Domain/Projects/Services/Projects.md index 53f0e0f..722efca 100644 --- a/technical/classes/Leantime/Domain/Projects/Services/Projects.md +++ b/technical/classes/Leantime/Domain/Projects/Services/Projects.md @@ -5,9 +5,11 @@ footer: false # Projects +Class Projects - - +This class represents a collection of methods related to projects. +It provides functionality to retrieve project types, project data, +project progress, users to notify in a project, and send project notifications. `\Leantime\Domain\Projects\Services\Projects` @@ -53,7 +55,7 @@ public Projects::__construct(\Leantime\Core\Template $tpl, \Leantime\Domain\Proj --- ### getProjectTypes - +Gets the project types. ```php public Projects::getProjectTypes(): mixed @@ -76,10 +78,10 @@ public Projects::getProjectTypes(): mixed --- ### getProject - +Gets the project with the given ID. ```php -public Projects::getProject(int $id): array|bool +public Projects::getProject(int $id): bool|array ``` @@ -93,25 +95,26 @@ public Projects::getProject(int $id): array|bool | Parameter | Type | Description | |-----------|------|-------------| -| `id` | **int** | | +| `id` | **int** | The ID of the project to retrieve. | **Return Value:** - +Returns the project data as an associative array if the project exists, otherwise returns false. --- ### getProjectProgress - +Gets the progress of a project. ```php -public Projects::getProjectProgress( $projectId): array +public Projects::getProjectProgress(int $projectId): array ``` - +Calculates the completion percentage, estimated completion date, +and planned completion date of the project. @@ -122,22 +125,22 @@ public Projects::getProjectProgress( $projectId): array | Parameter | Type | Description | |-----------|------|-------------| -| `projectId` | **** | | +| `projectId` | **int** | The ID of the project. | **Return Value:** - +The progress of the project. --- ### getUsersToNotify - +Gets an array of user IDs to notify for a given project. ```php -public Projects::getUsersToNotify( $projectId): array +public Projects::getUsersToNotify(int $projectId): array ``` @@ -151,22 +154,22 @@ public Projects::getUsersToNotify( $projectId): array | Parameter | Type | Description | |-----------|------|-------------| -| `projectId` | **** | | +| `projectId` | **int** | The ID of the project to get users to notify for. | **Return Value:** - +An array of user IDs. --- ### getAllUserInfoToNotify - +Gets all the users who need to be notified for a given project. ```php -public Projects::getAllUserInfoToNotify( $projectId): array +public Projects::getAllUserInfoToNotify(int $projectId): array ``` @@ -180,19 +183,19 @@ public Projects::getAllUserInfoToNotify( $projectId): array | Parameter | Type | Description | |-----------|------|-------------| -| `projectId` | **** | | +| `projectId` | **int** | The ID of the project. | **Return Value:** - +An array of users to notify. --- ### notifyProjectUsers - +Notifies the users associated with a project about a notification. ```php public Projects::notifyProjectUsers(\Leantime\Domain\Notifications\Models\Notification $notification): void @@ -209,7 +212,7 @@ public Projects::notifyProjectUsers(\Leantime\Domain\Notifications\Models\Notifi | Parameter | Type | Description | |-----------|------|-------------| -| `notification` | **\Leantime\Domain\Notifications\Models\Notification** | | +| `notification` | **\Leantime\Domain\Notifications\Models\Notification** | The notification object to send. | **Return Value:** @@ -221,10 +224,10 @@ public Projects::notifyProjectUsers(\Leantime\Domain\Notifications\Models\Notifi --- ### getProjectName - +Retrieves the name of a project based on its ID. ```php -public Projects::getProjectName( $projectId): mixed|void +public Projects::getProjectName(int $projectId): string|null ``` @@ -238,22 +241,22 @@ public Projects::getProjectName( $projectId): mixed|void | Parameter | Type | Description | |-----------|------|-------------| -| `projectId` | **** | | +| `projectId` | **int** | The ID of the project. | **Return Value:** - +The name of the project, or null if the project does not exist. --- ### getProjectIdAssignedToUser - +Gets the project IDs assigned to a specified user. ```php -public Projects::getProjectIdAssignedToUser( $userId): array|false +public Projects::getProjectIdAssignedToUser(int $userId): false|array ``` @@ -267,22 +270,22 @@ public Projects::getProjectIdAssignedToUser( $userId): array|false | Parameter | Type | Description | |-----------|------|-------------| -| `userId` | **** | | +| `userId` | **int** | The ID of the user. | **Return Value:** - +The project IDs assigned to the user, or false if no projects are found. --- ### getProjectsAssignedToUser - +Gets projects assigned to a user. ```php -public Projects::getProjectsAssignedToUser( $userId, string $projectStatus = "open", $clientId = null): array +public Projects::getProjectsAssignedToUser(int $userId, string $projectStatus = "open", int|null $clientId = null): array ``` @@ -296,24 +299,24 @@ public Projects::getProjectsAssignedToUser( $userId, string $projectStatus = &qu | Parameter | Type | Description | |-----------|------|-------------| -| `userId` | **** | | -| `projectStatus` | **string** | | -| `clientId` | **** | | +| `userId` | **int** | The ID of the user. | +| `projectStatus` | **string** | The status of the projects. Defaults to "open". | +| `clientId` | **int|null** | The ID of the client. Defaults to null. | **Return Value:** - +The projects assigned to the user. --- ### findMyChildren - +Finds all children projects for a given parent project. ```php -public Projects::findMyChildren( $currentParentId, array $projects): array +public Projects::findMyChildren(mixed $currentParentId, array $projects): array ``` @@ -327,26 +330,27 @@ public Projects::findMyChildren( $currentParentId, array $projects): array | Parameter | Type | Description | |-----------|------|-------------| -| `currentParentId` | **** | | -| `projects` | **array** | | +| `currentParentId` | **mixed** | The ID of the current parent project. | +| `projects` | **array** | An array of projects to search for children. | **Return Value:** - +An array of children projects found. --- ### cleanParentRelationship -Ensures all projects have a valid parent. If not the parent is removed. +Cleans the parent relationship in the given array of projects. ```php public Projects::cleanParentRelationship(array $projects): array ``` -This way a user can still access a project even if they don't have access to the child. +Removes projects that have a parent project that does not exist in the array. +Assigns a parent id of 0 to projects that have no parent. @@ -357,22 +361,22 @@ This way a user can still access a project even if they don't have access to the | Parameter | Type | Description | |-----------|------|-------------| -| `projects` | **array** | | +| `projects` | **array** | An array of projects | **Return Value:** - +The cleaned array of projects --- ### getProjectHierarchyAssignedToUser - +Gets the hierarchy of projects assigned to a user. ```php -public Projects::getProjectHierarchyAssignedToUser( $userId, string $projectStatus = "open", $clientId = null): array +public Projects::getProjectHierarchyAssignedToUser(int $userId, string $projectStatus = "open", int|null $clientId = null): array ``` @@ -386,24 +390,24 @@ public Projects::getProjectHierarchyAssignedToUser( $userId, string $projectStat | Parameter | Type | Description | |-----------|------|-------------| -| `userId` | **** | | -| `projectStatus` | **string** | | -| `clientId` | **** | | +| `userId` | **int** | The ID of the user. | +| `projectStatus` | **string** | The project status. Default is "open". | +| `clientId` | **int|null** | The ID of the client. Default is null. | **Return Value:** - +An array containing the assigned projects, the project hierarchy, and the favorite projects. --- ### getProjectHierarchyAvailableToUser - +Gets the project hierarchy available to a user. ```php -public Projects::getProjectHierarchyAvailableToUser( $userId, string $projectStatus = "open", $clientId = null): array +public Projects::getProjectHierarchyAvailableToUser(int $userId, string $projectStatus = "open", int|null $clientId = null): array ``` @@ -417,14 +421,17 @@ public Projects::getProjectHierarchyAvailableToUser( $userId, string $projectSta | Parameter | Type | Description | |-----------|------|-------------| -| `userId` | **** | | -| `projectStatus` | **string** | | -| `clientId` | **** | | +| `userId` | **int** | The ID of the user. | +| `projectStatus` | **string** | The status of the projects to retrieve. Defaults to "open". | +| `clientId` | **int|null** | The ID of the client. Defaults to null. | **Return Value:** - +Returns an array containing the following keys: +- "allAvailableProjects": An array of all projects available to the user. +- "allAvailableProjectsHierarchy": An array representing the project hierarchy available to the user. +- "clients": An array of clients associated with the projects available to the user. @@ -437,8 +444,7 @@ Gets all the clients available to a user. public Projects::getAllClientsAvailableToUser(int $userId, string $projectStatus = "open"): array ``` -Clients are determined by the projects -the user is assigned to. + @@ -450,12 +456,12 @@ the user is assigned to. | Parameter | Type | Description | |-----------|------|-------------| | `userId` | **int** | The ID of the user. | -| `projectStatus` | **string** | (optional) The status of the projects to consider. Defaults to "open". | +| `projectStatus` | **string** | The status of the projects to be considered. Defaults to "open". | **Return Value:** -An array of client objects. +An array of clients available to the user. @@ -491,10 +497,10 @@ public Projects::getClientsFromProjectList(array $projects): array --- ### getProjectRole - +Gets the role of a user in a specific project. ```php -public Projects::getProjectRole( $userId, $projectId): mixed|string +public Projects::getProjectRole(mixed $userId, mixed $projectId): mixed ``` @@ -508,23 +514,23 @@ public Projects::getProjectRole( $userId, $projectId): mixed|string | Parameter | Type | Description | |-----------|------|-------------| -| `userId` | **** | | -| `projectId` | **** | | +| `userId` | **mixed** | The user ID. | +| `projectId` | **mixed** | The project ID. | **Return Value:** - +The role of the user in the project (string) or an empty string if the user is not assigned to the project or if the project role is not defined. --- ### getProjectsUserHasAccessTo - +Gets the projects that a user has access to. ```php -public Projects::getProjectsUserHasAccessTo( $userId): array|false +public Projects::getProjectsUserHasAccessTo(int $userId): array|false ``` @@ -538,27 +544,30 @@ public Projects::getProjectsUserHasAccessTo( $userId): array|false | Parameter | Type | Description | |-----------|------|-------------| -| `userId` | **** | | +| `userId` | **int** | The ID of the user. | **Return Value:** - +The array of projects if the user has access, false otherwise. --- ### setCurrentProject -Sets the current project in the session. +Sets the current project for the user. ```php public Projects::setCurrentProject(): void ``` -If a project ID is provided in the query string, it is used to set the current project. -If no project ID is provided, the last visited project or the first assigned project is set as the current project. -If no project is found, an exception is thrown. +If projectId is present in the query string, it sets the project based on that. +If projectId is not present, it checks if the currentProject is set in the session and sets the project based on that. +If currentProject is not set, it sets the currentProject to 0. +If lastProject setting is set in the user's settings, it sets the project based on that. +If lastProject setting is not set, it sets the currentProject to the first project assigned to the user. +If no projects are assigned to the user, it throws an Exception. @@ -575,13 +584,14 @@ If no project is found, an exception is thrown. --- ### getCurrentProjectId -Get current project id or 0 if no current project is set. +Gets the current project ID. ```php public Projects::getCurrentProjectId(): int ``` - +If the session variable "currentProject" is set, it returns its integer value. +Otherwise, it returns 0. @@ -591,17 +601,17 @@ public Projects::getCurrentProjectId(): int **Return Value:** - +The current project ID. --- ### changeCurrentSessionProject - +Change the current session project to the specified projectId. ```php -public Projects::changeCurrentSessionProject( $projectId): bool +public Projects::changeCurrentSessionProject(mixed $projectId): bool ``` @@ -615,19 +625,19 @@ public Projects::changeCurrentSessionProject( $projectId): bool | Parameter | Type | Description | |-----------|------|-------------| -| `projectId` | **** | | +| `projectId` | **mixed** | The ID of the project to set as current. | **Return Value:** - +Returns true if the current project is successfully changed, false otherwise. --- ### resetCurrentProject - +Resets the current project by clearing all session data related to the project. ```php public Projects::resetCurrentProject(): void @@ -650,10 +660,10 @@ public Projects::resetCurrentProject(): void --- ### getUsersAssignedToProject - +Gets all the users assigned to a specific project. ```php -public Projects::getUsersAssignedToProject( $projectId): array +public Projects::getUsersAssignedToProject(int $projectId): array ``` @@ -667,19 +677,19 @@ public Projects::getUsersAssignedToProject( $projectId): array | Parameter | Type | Description | |-----------|------|-------------| -| `projectId` | **** | | +| `projectId` | **int** | The ID of the project. | **Return Value:** - +An array of users assigned to the project. --- ### isUserAssignedToProject - +Checks if a user is assigned to a particular project. ```php public Projects::isUserAssignedToProject(int $userId, int $projectId): bool @@ -696,26 +706,26 @@ public Projects::isUserAssignedToProject(int $userId, int $projectId): bool | Parameter | Type | Description | |-----------|------|-------------| -| `userId` | **int** | | -| `projectId` | **int** | | +| `userId` | **int** | The ID of the user being checked. | +| `projectId` | **int** | The ID of the project being checked. | **Return Value:** - +Returns true if the user is assigned to the project, false otherwise. --- ### isUserMemberOfProject -Checks if a user is directly assigned to a project. +Checks if a user is a member of a specific project. ```php public Projects::isUserMemberOfProject(int $userId, int $projectId): bool ``` -Client assignments or projects available to entire organization are not considered true. + @@ -726,20 +736,20 @@ Client assignments or projects available to entire organization are not consider | Parameter | Type | Description | |-----------|------|-------------| -| `userId` | **int** | | -| `projectId` | **int** | | +| `userId` | **int** | - The ID of the user. | +| `projectId` | **int** | - The ID of the project. | **Return Value:** - +- Returns true if the user is a member of the project, otherwise false. --- ### addProject -Adds a new project to the system. +Adds a new project. ```php public Projects::addProject(array $values): int|false @@ -756,19 +766,19 @@ public Projects::addProject(array $values): int|false | Parameter | Type | Description | |-----------|------|-------------| -| `values` | **array** | An associative array containing the project details.
- name: The name of the project.
- details: Additional details of the project (optional, default: '').
- clientId: The ID of the client associated with the project.
- hourBudget: The hour budget for the project (optional, default: 0).
- assignedUsers: Comma-separated list of user IDs assigned to the project (optional, default: '').
- dollarBudget: The dollar budget for the project (optional, default: 0).
- psettings: The settings for the project (optional, default: 'restricted').
- type: The type of the project (optional, default: 'project').
- start: The start date of the project in user format (YYYY-MM-DD).
- end: The end date of the project in user format (YYYY-MM-DD). | +| `values` | **array** | The project data.
- name: string (required) The name of the project.
- details: string (optional) Additional details about the project.
- clientId: int (required) The ID of the client associated with the project.
- hourBudget: int (optional) The hour budget for the project (defaults to 0).
- assignedUsers: string (optional) The list of assigned users (defaults to an empty string).
- dollarBudget: int (optional) The dollar budget for the project (defaults to 0).
- psettings: string (optional) The project settings (defaults to 'restricted').
- type: string (fixed value 'project') The type of the project.
- start: string|null The start date of the project in user format or null.
- end: string|null The end date of the project in user format or null. | **Return Value:** -The ID of the newly added project +The ID of the added project, or false if the project could not be added. --- ### duplicateProject - +Duplicates a project with the specified details. ```php public Projects::duplicateProject(int $projectId, int $clientId, string $projectName, string $userStartDate, bool $assignSameUsers): bool|int @@ -785,23 +795,23 @@ public Projects::duplicateProject(int $projectId, int $clientId, string $project | Parameter | Type | Description | |-----------|------|-------------| -| `projectId` | **int** | | -| `clientId` | **int** | | -| `projectName` | **string** | | -| `userStartDate` | **string** | | -| `assignSameUsers` | **bool** | | +| `projectId` | **int** | The ID of the project to duplicate. | +| `clientId` | **int** | The ID of the client for the duplicate project. | +| `projectName` | **string** | The name of the duplicate project. | +| `userStartDate` | **string** | The start date of the duplicate project in the format specified by the language setting. | +| `assignSameUsers` | **bool** | Whether to assign the same users as the original project. | **Return Value:** - +Returns true if the project was successfully duplicated, or the ID of the new project if successful. --- ### duplicateCanvas - +Duplicate a canvas from one project to another. ```php private Projects::duplicateCanvas(string $repository, int $originalProjectId, int $newProjectId, string $canvasTypeName = ''): bool @@ -818,25 +828,25 @@ private Projects::duplicateCanvas(string $repository, int $originalProjectId, in | Parameter | Type | Description | |-----------|------|-------------| -| `repository` | **string** | | -| `originalProjectId` | **int** | | -| `newProjectId` | **int** | | -| `canvasTypeName` | **string** | | +| `repository` | **string** | The repository class to use for CRUD operations | +| `originalProjectId` | **int** | The ID of the original project | +| `newProjectId` | **int** | The ID of the new project | +| `canvasTypeName` | **string** | The canvas type name (optional) | **Return Value:** - +True if the canvas is duplicated successfully, false otherwise --- ### getProjectUserRelation - +Retrieves the relation between a project and its users. ```php -public Projects::getProjectUserRelation( $id): array +public Projects::getProjectUserRelation(int $id): array ``` @@ -850,22 +860,22 @@ public Projects::getProjectUserRelation( $id): array | Parameter | Type | Description | |-----------|------|-------------| -| `id` | **** | | +| `id` | **int** | The ID of the project. | **Return Value:** - +The relation between the project and its users. --- ### patch - +Updates a project with the given parameters. ```php -public Projects::patch( $id, $params): bool +public Projects::patch(int $id, array $params): bool ``` @@ -879,23 +889,23 @@ public Projects::patch( $id, $params): bool | Parameter | Type | Description | |-----------|------|-------------| -| `id` | **** | | -| `params` | **** | | +| `id` | **int** | The ID of the project. | +| `params` | **array** | The parameters to update the project. | **Return Value:** - +Returns true if the project was successfully updated, false otherwise. --- ### getProjectAvatar - +Retrieves the avatar for a project. ```php -public Projects::getProjectAvatar( $id): mixed +public Projects::getProjectAvatar(mixed $id): mixed ``` @@ -909,22 +919,22 @@ public Projects::getProjectAvatar( $id): mixed | Parameter | Type | Description | |-----------|------|-------------| -| `id` | **** | | +| `id` | **mixed** | The ID of the project. | **Return Value:** - +The avatar for the project. --- ### setProjectAvatar - +Sets the avatar for a project. ```php -public Projects::setProjectAvatar( $file, $project): null +public Projects::setProjectAvatar(mixed $file, mixed $project): bool ``` @@ -938,23 +948,23 @@ public Projects::setProjectAvatar( $file, $project): null | Parameter | Type | Description | |-----------|------|-------------| -| `file` | **** | | -| `project` | **** | | +| `file` | **mixed** | The file containing the avatar. | +| `project` | **mixed** | The project object. | **Return Value:** - +Indicates whether the avatar was successfully set. --- ### getAllProjects - +Retrieves all projects. ```php -public Projects::getAllProjects(): mixed +public Projects::getAllProjects(): array ``` @@ -967,17 +977,17 @@ public Projects::getAllProjects(): mixed **Return Value:** - +The projects. --- ### getProjectSetupChecklist - +Retrieves the setup checklist for a project. ```php -public Projects::getProjectSetupChecklist( $projectId): array +public Projects::getProjectSetupChecklist(int $projectId): array ``` @@ -991,22 +1001,22 @@ public Projects::getProjectSetupChecklist( $projectId): array | Parameter | Type | Description | |-----------|------|-------------| -| `projectId` | **** | | +| `projectId` | **int** | The ID of the project. | **Return Value:** - +The setup checklist for the project. --- ### updateProjectProgress - +Updates the progress of a project. ```php -public Projects::updateProjectProgress( $stepsComplete, $projectId): void +public Projects::updateProjectProgress(string|array $stepsComplete, int $projectId): void ``` @@ -1020,8 +1030,8 @@ public Projects::updateProjectProgress( $stepsComplete, $projectId): void | Parameter | Type | Description | |-----------|------|-------------| -| `stepsComplete` | **** | | -| `projectId` | **** | | +| `stepsComplete` | **string|array** | The steps completed for the project. | +| `projectId` | **int** | The ID of the project. | **Return Value:** @@ -1051,22 +1061,22 @@ public Projects::editUserProjectRelations(int $id, array $projects): bool | Parameter | Type | Description | |-----------|------|-------------| | `id` | **int** | The ID of the user. | -| `projects` | **array** | An array of project IDs to be assigned to the user. | +| `projects` | **array** | The projects to be edited. | **Return Value:** -Returns true if the project relations were successfully edited, false otherwise. +True if the project relations were successfully edited, false otherwise. --- ### getProjectIdbyName -Returns the project ID by its name from the given array of projects. +Retrieves the ID of a project by its name. ```php -public Projects::getProjectIdbyName(array $allProjects, string $projectName): int|bool +public Projects::getProjectIdbyName(array $allProjects, string $projectName): mixed ``` @@ -1080,8 +1090,8 @@ public Projects::getProjectIdbyName(array $allProjects, string $projectName): in | Parameter | Type | Description | |-----------|------|-------------| -| `allProjects` | **array** | An array of projects. | -| `projectName` | **string** | The name of the project to search for. | +| `allProjects` | **array** | The array of all projects. | +| `projectName` | **string** | The name of the project to retrieve the ID for. | **Return Value:** @@ -1093,10 +1103,10 @@ The ID of the project if found, or false if not found. --- ### updateProjectSorting - +Updates the sorting of multiple projects. ```php -public Projects::updateProjectSorting( $params): false|void +public Projects::updateProjectSorting(array $params): bool ``` @@ -1110,19 +1120,19 @@ public Projects::updateProjectSorting( $params): false|void | Parameter | Type | Description | |-----------|------|-------------| -| `params` | **** | | +| `params` | **array** | The array containing the project IDs as keys and their corresponding sort index as values (ticketId: sortIndex). | **Return Value:** - +Returns true if the sorting update was successful, false otherwise. --- ### editProject -Edits a project with the given values. +Edits a project. ```php public Projects::editProject(mixed $values, int $id): void @@ -1139,8 +1149,8 @@ public Projects::editProject(mixed $values, int $id): void | Parameter | Type | Description | |-----------|------|-------------| -| `values` | **mixed** | The values to update the project with. | -| `id` | **int** | The ID of the project to edit. | +| `values` | **mixed** | The values to be updated in the project. | +| `id` | **int** | The ID of the project to be edited. | **Return Value:** @@ -1152,10 +1162,10 @@ public Projects::editProject(mixed $values, int $id): void --- ### updateProjectStatusAndSorting - +Updates the status and sorting of projects. ```php -public Projects::updateProjectStatusAndSorting( $params, $handler = null): bool +public Projects::updateProjectStatusAndSorting(array $params, null $handler = null): bool ``` @@ -1169,26 +1179,26 @@ public Projects::updateProjectStatusAndSorting( $params, $handler = null): bool | Parameter | Type | Description | |-----------|------|-------------| -| `params` | **** | | -| `handler` | **** | | +| `params` | **array** | An associative array representing the project status and sorting.
The key is the status and the value is the serialized project list. | +| `handler` | **null** | Optional parameter for handling the project update process. | **Return Value:** - +Returns true if the update process is successful, false otherwise. --- ### getClientManagerProjects -Gets all the projects a company manager has access to. +Retrieves the projects for a client manager. ```php public Projects::getClientManagerProjects(int $userId, int $clientId): array ``` -Includes all projects within a client + all assigned projects + @@ -1199,26 +1209,26 @@ Includes all projects within a client + all assigned projects | Parameter | Type | Description | |-----------|------|-------------| -| `userId` | **int** | | -| `clientId` | **int** | | +| `userId` | **int** | The ID of the user. | +| `clientId` | **int** | The ID of the client. | **Return Value:** - +The projects for the client manager. --- ### getAll - +Gets all the projects for the current user. ```php public Projects::getAll(bool $showClosedProjects = false): array ``` - +By default, closed projects are not included. @@ -1229,19 +1239,19 @@ public Projects::getAll(bool $showClosedProjects = false): array | Parameter | Type | Description | |-----------|------|-------------| -| `showClosedProjects` | **bool** | | +| `showClosedProjects` | **bool** | (optional) Set to true to include closed projects. | **Return Value:** - +Returns an array of projects. --- ### findProject - +Finds projects based on a search term. ```php public Projects::findProject(string $term = ""): array @@ -1258,25 +1268,25 @@ public Projects::findProject(string $term = ""): array | Parameter | Type | Description | |-----------|------|-------------| -| `term` | **string** | | +| `term` | **string** | The search term (optional) | **Return Value:** - +The filtered projects that match the search term --- ### pollForNewProjects - +Polls for new projects for the current user session. ```php public Projects::pollForNewProjects(): array ``` - +Retrieves all projects for the current user and prepares the dates for API response. @@ -1286,19 +1296,21 @@ public Projects::pollForNewProjects(): array **Return Value:** - +An array of projects with prepared dates for API response. --- ### pollForUpdatedProjects - +Polls for updated projects. ```php public Projects::pollForUpdatedProjects(): array ``` +Retrieves all the projects the current user has access to and prepares them for API response. +Adds the modified timestamp to the project ID for tracking updates. @@ -1306,36 +1318,6 @@ public Projects::pollForUpdatedProjects(): array - -**Return Value:** - - - - - ---- -### prepareDatesForApiResponse - - - -```php -private Projects::prepareDatesForApiResponse(mixed $project): mixed -``` - - - - - - - - -**Parameters:** - -| Parameter | Type | Description | -|-----------|------|-------------| -| `project` | **mixed** | | - - **Return Value:** diff --git a/technical/hooks.md b/technical/hooks.md index 80b125a..239f811 100644 --- a/technical/hooks.md +++ b/technical/hooks.md @@ -939,6 +939,12 @@ Source: [app/Domain/Projects/Templates/submodules/projectDetails.sub.php](https: ### `Leantime.Domain.Projects.Services.Projects.notifyProjectUsers.notifyProjectUsers` +*This event is fired to notify project users of important updates.* + +An event "notifyProjectUsers" is dispatched with an array of variables required for the notification. +These variables include the type of update, module affected, entity ID, message and subject of notification, +users to be notified, and url if present. This event belongs to the "domain.services.projects" context. + **Arguments** Argument | Type | Description @@ -946,17 +952,19 @@ Argument | Type | Description `array("type" => "projectUpdate", "module" => $notification->module, "moduleId" => $entityId, "message" => $notification->message, "subject" => $notification->subject, "users" => $this->getAllUserInfoToNotify($notification->projectId), "url" => $notification->url['url'])` | | `"domain.services.projects"` | | -Source: [app/Domain/Projects/Services/Projects.php](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php), [line 247](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php#L247-L343) +Source: [app/Domain/Projects/Services/Projects.php](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php), [line 359](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php#L359-L376) ### `Leantime.Domain.Projects.Services.Projects.changeCurrentSessionProject.projects.setCurrentProject` +*Change the current session project to the specified projectId.* + **Arguments** Argument | Type | Description -------- | ---- | ----------- `$project` | | -Source: [app/Domain/Projects/Services/Projects.php](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php), [line 687](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php#L687-L784) +Source: [app/Domain/Projects/Services/Projects.php](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php), [line 739](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php#L739-L838) ### `Leantime.Domain.Calendar.Templates.export.tpl.afterFormOpen` @@ -2006,36 +2014,44 @@ Source: [app/Domain/Projects/Controllers/ChangeCurrentProject.php](https://githu ### `Leantime.Domain.Projects.Services.Projects.getProjectTypes.filterProjectType` +*Gets the project types.* + **Arguments** Argument | Type | Description -------- | ---- | ----------- `$types` | | -Source: [app/Domain/Projects/Services/Projects.php](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php), [line 77](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php#L77-L87) +Source: [app/Domain/Projects/Services/Projects.php](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php), [line 81](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php#L81-L93) ### `Leantime.Domain.Projects.Services.Projects.notifyProjectUsers.notificationFilter` +*Notifies the users associated with a project about a notification.* + **Arguments** Argument | Type | Description -------- | ---- | ----------- -`$notification` | `\Notification` | +`$notification` | `\Notification` | The notification object to send. -Source: [app/Domain/Projects/Services/Projects.php](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php), [line 247](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php#L247-L258) +Source: [app/Domain/Projects/Services/Projects.php](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php), [line 262](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php#L262-L274) ### `Leantime.Domain.Projects.Services.Projects.getProjectHierarchyAssignedToUser.afterLoadingProjects` +*Gets the hierarchy of projects assigned to a user.* + **Arguments** Argument | Type | Description -------- | ---- | ----------- `$projects` | | -Source: [app/Domain/Projects/Services/Projects.php](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php), [line 453](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php#L453-L471) +Source: [app/Domain/Projects/Services/Projects.php](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php), [line 495](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php#L495-L516) ### `Leantime.Domain.Projects.Services.Projects.getProjectHierarchyAssignedToUser.afterPopulatingProjectHierarchy` +*Gets the hierarchy of projects assigned to a user.* + **Arguments** Argument | Type | Description @@ -2043,10 +2059,12 @@ Argument | Type | Description `$projectHierarchy` | | `array("projects" => $projects)` | | -Source: [app/Domain/Projects/Services/Projects.php](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php), [line 453](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php#L453-L477) +Source: [app/Domain/Projects/Services/Projects.php](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php), [line 495](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php#L495-L522) ### `Leantime.Domain.Projects.Services.Projects.getProjectHierarchyAssignedToUser.afterPopulatingProjectFavorites` +*Gets the hierarchy of projects assigned to a user.* + **Arguments** Argument | Type | Description @@ -2054,20 +2072,24 @@ Argument | Type | Description `$favorites` | | `array("projects" => $projects)` | | -Source: [app/Domain/Projects/Services/Projects.php](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php), [line 453](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php#L453-L486) +Source: [app/Domain/Projects/Services/Projects.php](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php), [line 495](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php#L495-L531) ### `Leantime.Domain.Projects.Services.Projects.getProjectHierarchyAvailableToUser.afterLoadingProjects` +*Gets the project hierarchy available to a user.* + **Arguments** Argument | Type | Description -------- | ---- | ----------- `$projects` | | -Source: [app/Domain/Projects/Services/Projects.php](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php), [line 495](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php#L495-L513) +Source: [app/Domain/Projects/Services/Projects.php](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php), [line 540](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php#L540-L563) ### `Leantime.Domain.Projects.Services.Projects.getProjectHierarchyAvailableToUser.afterPopulatingProjectHierarchy` +*Gets the project hierarchy available to a user.* + **Arguments** Argument | Type | Description @@ -2075,25 +2097,24 @@ Argument | Type | Description `$projectHierarchy` | | `array("projects" => $projects)` | | -Source: [app/Domain/Projects/Services/Projects.php](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php), [line 495](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php#L495-L519) +Source: [app/Domain/Projects/Services/Projects.php](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php), [line 540](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php#L540-L569) ### `Leantime.Domain.Projects.Services.Projects.getAllClientsAvailableToUser.afterLoadingProjects` *Gets all the clients available to a user.* -Clients are determined by the projects -the user is assigned to. - **Arguments** Argument | Type | Description -------- | ---- | ----------- `$projects` | | -Source: [app/Domain/Projects/Services/Projects.php](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php), [line 531](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php#L531-L552) +Source: [app/Domain/Projects/Services/Projects.php](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php), [line 581](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php#L581-L600) ### `Leantime.Domain.Projects.Services.Projects.getProjectAvatar.afterGettingAvatar` +*Retrieves the avatar for a project.* + **Arguments** Argument | Type | Description @@ -2101,7 +2122,7 @@ Argument | Type | Description `$avatar` | | `array("projectId" => $id)` | | -Source: [app/Domain/Projects/Services/Projects.php](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php), [line 1273](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php#L1273-L1283) +Source: [app/Domain/Projects/Services/Projects.php](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php), [line 1332](https://github.com/Leantime/leantime/blob/master/app/Domain/Projects/Services/Projects.php#L1332-L1343) ### `Leantime.Domain.Install.Controllers.Update.get.customUpdatePage`