mirror of
https://github.com/Karaka-Management/oms-Tasks.git
synced 2026-01-09 22:58:40 +00:00
bump
This commit is contained in:
parent
f524e490f4
commit
421f0743d1
35
.github/dev_bug_report.md
vendored
35
.github/dev_bug_report.md
vendored
|
|
@ -1,35 +0,0 @@
|
|||
---
|
||||
name: Dev Bug Report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: stat_backlog, type_bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
# Bug Description
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
# How to Reproduce
|
||||
|
||||
Steps to reproduce the behavior:
|
||||
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
## Minimal Code Example
|
||||
|
||||
```
|
||||
// your code ...
|
||||
```
|
||||
|
||||
# Expected Behavior
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
# Screenshots
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
# Additional Information
|
||||
Add any other context about the problem here.
|
||||
18
.github/dev_feature_request.md
vendored
18
.github/dev_feature_request.md
vendored
|
|
@ -1,18 +0,0 @@
|
|||
---
|
||||
name: Dev Feature Request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: stat_backlog, type_feature
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
# What is the feature you request
|
||||
* A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
* A clear and concise description of what you want to happen.
|
||||
|
||||
# Alternatives
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
# Additional Information
|
||||
Add any other context or screenshots about the feature request here.
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
"pid": "/task",
|
||||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "List",
|
||||
"name": "Dashboard",
|
||||
"uri": "{/base}/task/dashboard?{?}",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
|
|
@ -26,29 +26,28 @@
|
|||
"from": "Tasks",
|
||||
"permission": { "permission": 2, "category": null, "element": null },
|
||||
"parent": 1001101001,
|
||||
"children": [
|
||||
{
|
||||
"id": 1001102101,
|
||||
"pid": "/task",
|
||||
"type": 0,
|
||||
"subtype": 1,
|
||||
"name": "Tasks",
|
||||
"uri": "{/base}/task/view?{?}",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 1,
|
||||
"from": "Tasks",
|
||||
"permission": { "permission": 2, "category": null, "element": null },
|
||||
"parent": 1001102001,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"id": 1001103001,
|
||||
"pid": "/task",
|
||||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "List",
|
||||
"uri": "{/base}/task/list?{?}",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 5,
|
||||
"from": "Tasks",
|
||||
"permission": { "permission": 2, "category": null, "element": null },
|
||||
"parent": 1001101001,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"id": 1001104001,
|
||||
"pid": "/task",
|
||||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "Create",
|
||||
"uri": "{/base}/task/create?{?}",
|
||||
"target": "self",
|
||||
|
|
@ -60,7 +59,7 @@
|
|||
"children": []
|
||||
},
|
||||
{
|
||||
"id": 1001104001,
|
||||
"id": 1001105001,
|
||||
"pid": "/task",
|
||||
"type": 3,
|
||||
"subtype": 1,
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
use Modules\Tasks\Controller\SearchController;
|
||||
use Modules\Tasks\Models\PermissionCategory;
|
||||
use phpOMS\Account\PermissionType;
|
||||
use phpOMS\Router\RouteVerb;
|
||||
|
||||
|
|
@ -27,4 +28,15 @@ return [
|
|||
],
|
||||
],
|
||||
],
|
||||
'^(?!:).+.*?' => [
|
||||
[
|
||||
'dest' => '\Modules\Tasks\Controller\SearchController:searchGeneral',
|
||||
'verb' => RouteVerb::ANY,
|
||||
'permission' => [
|
||||
'module' => SearchController::NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionCategory::TASK,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ final class Installer extends InstallerAbstract
|
|||
$taskAttrType = [];
|
||||
|
||||
/** @var \Modules\Tasks\Controller\ApiAttributeController $module */
|
||||
$module = $app->moduleManager->getModuleInstance('Tasks', 'ApiAttribute');
|
||||
$module = $app->moduleManager->get('Tasks', 'ApiAttribute');
|
||||
|
||||
/** @var array $attribute */
|
||||
foreach ($attributes as $attribute) {
|
||||
|
|
@ -142,7 +142,7 @@ final class Installer extends InstallerAbstract
|
|||
$taskAttrValue = [];
|
||||
|
||||
/** @var \Modules\Tasks\Controller\ApiAttributeController $module */
|
||||
$module = $app->moduleManager->getModuleInstance('Tasks', 'ApiAttribute');
|
||||
$module = $app->moduleManager->get('Tasks', 'ApiAttribute');
|
||||
|
||||
foreach ($attributes as $attribute) {
|
||||
$taskAttrValue[$attribute['name']] = [];
|
||||
|
|
|
|||
|
|
@ -29,6 +29,17 @@ return [
|
|||
],
|
||||
],
|
||||
],
|
||||
'^.*/task/list(\?.*$|$)' => [
|
||||
[
|
||||
'dest' => '\Modules\Tasks\Controller\BackendController:viewTaskList',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => BackendController::NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionCategory::TASK,
|
||||
],
|
||||
],
|
||||
],
|
||||
'^.*/task/view(\?.*$|$)' => [
|
||||
[
|
||||
'dest' => '\Modules\Tasks\Controller\BackendController:viewTaskView',
|
||||
|
|
|
|||
|
|
@ -1,46 +0,0 @@
|
|||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at spl1nes.com@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
||||
196
CONTRIBUTING.md
196
CONTRIBUTING.md
|
|
@ -1,196 +0,0 @@
|
|||
## Development environment
|
||||
|
||||
The setup and configuration of the development environment is in the hands of every developer themselves. However, it is recommended to follow the setup instructions in the [Developer-Guide](https://github.com/Karaka-Management/Developer-Guide/blob/develop/general/setup.md).
|
||||
|
||||
## Code of conduct
|
||||
|
||||
Every organization member and contributor to the organization must follow the [Code of Conduct](../Policies%20&%20Guidelines/Code%20of%20Conduct.md).
|
||||
|
||||
## Becoming a contributor
|
||||
|
||||
For public repositories you can immediately start by creating forks and pull requests. For private repositories which are necessary to setup the complete developer environment, feel free to request access. Please not that we may not immediately give you access to private repositories and instead will give you smaller tasks regarding public repositories. Please contact info@jingga.app for more details. (**R1**)
|
||||
|
||||
For all contributions our [Contributor License Agreement "CLA"](https://github.com/Karaka-Management/Organization-Guide/blob/master/Processes/HR/Hiring/Individual%20Contributor%20License%20Agreement.md) comes into effect. (**R2**)
|
||||
|
||||
## Code changes
|
||||
|
||||
### Topics / Tasks / Todos
|
||||
|
||||
Generally, the development philosophy is result orientated. This means that anyone can propose tasks, pick up existing tasks or right away implement their code changes. However, implementing code changes without consulting with a senior developer in advance has a much higher risk of code changes not getting admitted. The easiest way to discuss a code change idea in advance are the github [issues](https://github.com/Karaka-Management/Karaka/issues) or [discussions](https://github.com/Karaka-Management/Karaka/discussions).
|
||||
|
||||
Developers are encouraged to pick open tasks with high priorities according to their own skill level. Senior developers may directly assign tasks to developers based on their importance. New developers may find it easier to start with a task that has a low priority as they often also have a lower difficulty.
|
||||
|
||||
Open tasks can be found in the project overview: [Todos](https://github.com/orgs/Karaka-Management/projects/10)
|
||||
|
||||
Tasks currently in development are prefixed in the priority column with an asterisk `*` and a name tag in the task description of the developer who is working on the task.
|
||||
|
||||
The open tasks are reviewed once a month by a senior developer. The senior developer updates the project overview if necessary and requests feedback regarding development status of important tasks under development. During this process important tasks may also get directly assigned to developers. This review is performed on a judgmental bases of the senior basis.
|
||||
|
||||
### Quality
|
||||
|
||||
#### Code style
|
||||
|
||||
Code changes must follow the [style guidelines](https://github.com/Karaka-Management/Developer-Guide/tree/develop/standards) (**R3**). Additionally, the automatic code style inspection tools must return no errors, failures or warnings. Developers should test their changes with inspection tools and configurations mentioned in the [inspection documentation](https://github.com/Karaka-Management/Developer-Guide/blob/develop/quality/inspections.md) in advance before submitting them for review. (**R4**)
|
||||
|
||||
In rare cases errors, failures or warnings during the automatic inspection are acceptable. Reasons can be for example special cases which are difficult automatize or must be individually configured in the inspection settings. If this is the case for a code change and if inspection configuration changes are necessary are decided by the senior developer performing the code review. (**R5**)
|
||||
|
||||
Automated checks which are run during the review process (**R4**):
|
||||
|
||||
```sh
|
||||
php ./vendor/bin/phpcs ./ --standard="Build/Config/phpcs.xml"
|
||||
php ./vendor/bin/php-cs-fixer fix ./ --config=Build/Config/.php-cs-fixer.php --allow-risky=yes
|
||||
php ./vendor/bin/phpcbf --standard=Build/Config/phpcs.xml ./
|
||||
php ./vendor/bin/rector process --dry-run --config Build/Config/rector.php ./
|
||||
npx eslint ./ -c ./Build/Config/.eslintrc.json
|
||||
```
|
||||
|
||||
#### Tests
|
||||
|
||||
Code changes must follow the inspection guidelines (i.e. code coverage) mentioned in the [inspection documentation](https://github.com/Karaka-Management/Developer-Guide/blob/develop/quality/inspections.md) (**R6**). Developers should test their changes with inspection tools and configurations mentioned in the [inspection documentation](https://github.com/Karaka-Management/Developer-Guide/blob/develop/quality/inspections.md) in advance before submitting them for review. (**R7**)
|
||||
|
||||
In rare cases it might be not possible to follow the inspection guidelines. In such cases the senior developer performing the code review may decide if the code change still gets accepted. (**R8**)
|
||||
|
||||
Automated tests which are run during the review process (**R7**):
|
||||
|
||||
```sh
|
||||
php ./vendor/bin/phpunit -c tests/PHPUnit/phpunit_default.xml
|
||||
php ./vendor/bin/phpstan analyse --no-progress -l 9 -c Build/Config/phpstan.neon ./
|
||||
npx jasmine-node ./
|
||||
./cOMS/tests/test.sh
|
||||
```
|
||||
|
||||
Additional inspections which are run but might be ignored during the review depending on the use case are mentioned in the [inspection documentation](https://github.com/Karaka-Management/Developer-Guide/blob/develop/quality/inspections.md) as other checks. (**R7**)
|
||||
|
||||
#### Performance
|
||||
|
||||
Developers should occasionaly check performance statistics. At this point no target metrics are defined.
|
||||
|
||||
Since the primary application is a web based application a similar tool as the Google lighthouse tool can be used to inspect the application for best practicies which can significantly improve the application performance. The sitespeed.io tool shows potential performance improvements and slow pages. With the php trace and profiler enabled in the `php.ini` file the VM automatically generates profiling and trace reports for every web request. These can be found in the webgrind logs directory and inspected in webgrind and dropped into the trace visualizer for a flame chart visualization. With mysqldumpslow you can inspect slow sql queries which may need optimization.
|
||||
|
||||
1. Automatic trace and benchmark generation with every web request in `/var/www/html/webgrind/Logs`
|
||||
2. Webgrind view `http://vm_ip:82`
|
||||
3. Trace visualization `http://vm_ip:81`
|
||||
1. Download the latest trace from `http://vm_ip:82/Logs`
|
||||
2. Drag and drop that downloaded `*.xt` file in the trace visualizer
|
||||
4. `sitespeed.io ./Build/Helper/Scripts/sitespeedDemoUrls.txt -b chrome --outputFolder /var/www/html/sitespeed`
|
||||
5. Slow query inspection.
|
||||
|
||||
```sh
|
||||
mysqldumpslow -t 10 /var/log/mysql/mysql-slow.log
|
||||
mysqldumpslow -t 10 -s l /var/log/mysql/mysql-slow.log
|
||||
```
|
||||
|
||||
#### Code review
|
||||
|
||||
In addition to the automatic code review performed by the various inspection tools such as (phpcs, phpstan, phpunit, eslint and custom scripts) a senior developer must check the proposed code change before it is merged with the respective `develop` branch. Only upon the approval by the reviewer a code change requests gets merged as no other developers have permission in the software to make such code merges.
|
||||
|
||||
In case a code change request is not approved the reviewer states the reason for the decision, this may include some tips and requests which will allow the contributor to make improvements so that the code change may get approved.
|
||||
|
||||
If the code reviewer only finds minor issues with the proposed code change the reviewer may make small changes to the proposed code change and inform the contributor to speed up the implementation process. Code reviewers are encouraged to do this with new contributors to avoid long iteration processes and to not discourage new developers. However, communication is key and severe issues with code change requests or if the contributor already made multiple code change requests in the past the reviewer should not implement the improvements by himself and rather decline the code change requests with his reasoning. (**R5**+**R8**)
|
||||
|
||||
#### Demo
|
||||
|
||||
Some code changes may also require changes or extensions in the demo setup scripts. The demo setup script try to simulate a real world use case by generating and modifying mostly random data. This is also a good way to setup and “manually” test the code changes in a larger picture. The demo setup script can be found in the [demoSetup](https://github.com/Karaka-Management/demoSetup) repository. The demo setup script takes a long time due to the large amount of user input simulated data which is generated. Therefore it is recommended to run this only sporadically. (**R9**)
|
||||
|
||||
```sh
|
||||
sudo -u www-data php -dxdebug.remote_enable=1 -dxdebug.start_with_request=yes -dxdebug.mode=coverage,develop,debug demoSetup/setup.php
|
||||
```
|
||||
|
||||
#### Documentation
|
||||
|
||||
Occasionally new code or code changes also require new documentation or documentation changes. Developers should make sure that the new code is also reflected in the existing documentation ([Developer-Guide](), [User-Guide]() and/or module documentation) or if additional documentation is necessary.
|
||||
|
||||
#### Improvements, features, bugs
|
||||
|
||||
If a developer (or employee in general) has an idea for an improvement, feature or finds a potential bug it should be reported at https://github.com/Karaka-Management/Karaka/issues. A senior developer has to check these issues and decide how to proceed with them. The decision how to proceed with the issue must be explained by the senior developer as a response in the issue. Possible steps are:
|
||||
|
||||
* Accept the issue and put the task into the [Todos](https://github.com/orgs/Karaka-Management/projects/10)
|
||||
* Dismiss the issue with an explanation
|
||||
|
||||
### Release flow
|
||||
|
||||
In case SCSS/CSS or JS files got changed they must get re-built locally before comitting the code change:
|
||||
|
||||
```sh
|
||||
npx esbuild Web/Backend/js/backend.js --bundle --outfile=Install/Application/Backend/js/backend.min.js --minify
|
||||
scss cssOMS/styles.scss > cssOMS/styles.css
|
||||
```
|
||||
|
||||
For JS you may also use the shorthand command `npm run build`.
|
||||
|
||||
Code changes must be performed in a new branch. A new branch can be created with:
|
||||
|
||||
```sh
|
||||
git checkout -b new-branch-name
|
||||
```
|
||||
|
||||
The name of the branch can be chosen freely however it is recommended to follow the following branch naming conventions:
|
||||
|
||||
* `feature-*` for feature implementations
|
||||
* `hotfix-*` for security related fixes/improvements
|
||||
* `bug-*` for bug fixes
|
||||
* `security-*` for security related fixes/improvements
|
||||
* `general-*` for general improvements (i.e. documentation, code style & performance improvements)
|
||||
|
||||
```mermaid
|
||||
%%{init: { 'gitGraph': {'mainBranchName': 'master'}} }%%
|
||||
gitGraph
|
||||
commit
|
||||
branch hotfix-xxx
|
||||
commit
|
||||
checkout master
|
||||
branch develop
|
||||
checkout master
|
||||
merge hotfix-xxx
|
||||
checkout develop
|
||||
branch bug-xxx
|
||||
commit
|
||||
commit
|
||||
checkout hotfix-xxx
|
||||
commit
|
||||
checkout master
|
||||
merge hotfix-xxx
|
||||
checkout develop
|
||||
merge bug-xxx
|
||||
commit
|
||||
checkout develop
|
||||
branch feature-xxx
|
||||
commit
|
||||
commit
|
||||
commit
|
||||
checkout develop
|
||||
merge feature-xxx
|
||||
checkout master
|
||||
merge develop
|
||||
checkout develop
|
||||
branch general-xxx
|
||||
commit
|
||||
checkout develop
|
||||
merge general-xxx
|
||||
branch security-xxx
|
||||
commit
|
||||
commit
|
||||
checkout develop
|
||||
merge security-xxx
|
||||
checkout master
|
||||
merge develop
|
||||
|
||||
```
|
||||
|
||||
The senior developer who performs the code review merges the change request into the `develop` branch after their successful code review. Unsuccessful reviews lead to change requests by the original developer, other developers who can make the requested changes, changes by the senior developer who performed the review, or dismissal of the changed code. (**R10**)
|
||||
|
||||
## Approved dependencies
|
||||
|
||||
### Customer dependencies
|
||||
|
||||
Developers may only rely on the dependencies defined in [Approved Customer Software]() when developing a solution. If new software should be added to this list or a different version is required developers should make a request with their team leader/head of department who forwards this requests if appropriate to the CTO and explain the reasoning for the different dependency needs. The CTO can decide if the dependency will be accepted. (**R11**)
|
||||
|
||||
### Developer dependencies
|
||||
|
||||
Developers may only rely on the dependencies defined in [IT Equipment & Software](). If new software should be added to this list or a different version is required developers should make a request with their team leader/head of department who forwards this requests if appropriate to the CTO and explain the reasoning for the different dependency needs. The CTO can decide if the dependency will be accepted. Changing the package managers such as `composer.json` or `package.json` is not allowed by anyone else than the CTO. (**R12**)
|
||||
|
||||
## Other related documents
|
||||
|
||||
* [Confidentiality Policy](../Policies%20&%20Guidelines/Confidentiality%20Policy.md)
|
||||
* [Organization Activity Policy](../Policies%20&%20Guidelines/Organization%20Activity%20Policy.md)
|
||||
* [Tutorials](./Development/Tutorials)
|
||||
|
|
@ -15,6 +15,7 @@ declare(strict_types=1);
|
|||
namespace Modules\Tasks\Controller;
|
||||
|
||||
use Modules\Admin\Models\AccountMapper;
|
||||
use Modules\Admin\Models\GroupMapper;
|
||||
use Modules\Admin\Models\NullAccount;
|
||||
use Modules\Media\Models\CollectionMapper;
|
||||
use Modules\Media\Models\MediaMapper;
|
||||
|
|
@ -22,6 +23,13 @@ use Modules\Media\Models\NullMedia;
|
|||
use Modules\Media\Models\PathSettings;
|
||||
use Modules\Media\Models\Reference;
|
||||
use Modules\Media\Models\ReferenceMapper;
|
||||
use Modules\Notification\Models\Notification;
|
||||
use Modules\Notification\Models\NotificationMapper;
|
||||
use Modules\Notification\Models\NotificationStatus;
|
||||
use Modules\Notification\Models\NotificationType;
|
||||
use Modules\Profile\Models\ProfileMapper;
|
||||
use Modules\Tasks\Models\DutyType;
|
||||
use Modules\Tasks\Models\PermissionCategory;
|
||||
use Modules\Tasks\Models\Task;
|
||||
use Modules\Tasks\Models\TaskElement;
|
||||
use Modules\Tasks\Models\TaskElementMapper;
|
||||
|
|
@ -168,6 +176,8 @@ final class ApiController extends Controller
|
|||
$task = $this->createTaskFromRequest($request);
|
||||
$this->createModel($request->header->account, $task, TaskMapper::class, 'task', $request->getOrigin());
|
||||
|
||||
$this->createNotifications(\reset($task->taskElements), NotificationType::CREATE, $request);
|
||||
|
||||
if (!empty($request->files)
|
||||
|| !empty($request->getDataJson('media'))
|
||||
) {
|
||||
|
|
@ -177,6 +187,97 @@ final class ApiController extends Controller
|
|||
$this->createStandardCreateResponse($request, $response, $task);
|
||||
}
|
||||
|
||||
private function createNotifications(TaskElement $ele, int $type, RequestAbstract $request) : void
|
||||
{
|
||||
$accChecked = [];
|
||||
$grpChecked = [];
|
||||
|
||||
$task = TaskMapper::get()
|
||||
->with('taskElements')
|
||||
->with('taskElements/accRelation')
|
||||
->with('taskElements/grpRelation')
|
||||
->where('id', $ele->task)
|
||||
->execute();
|
||||
|
||||
// Don't notify on template generations
|
||||
if ($task->type !== TaskType::SINGLE) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We have to check all previous elements as well because other accounts/groups are probably defined in a
|
||||
// previous task element.
|
||||
foreach ($task->taskElements as $element) {
|
||||
// Account relations
|
||||
foreach ($element->accRelation as $rel) {
|
||||
if (\in_array($rel->relation->id, $accChecked)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$profile = ProfileMapper::count()
|
||||
->where('account', $rel->relation->id)
|
||||
->execute();
|
||||
|
||||
if ($profile < 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$notification = new Notification();
|
||||
$notification->module = self::NAME;
|
||||
$notification->title = $task->title;
|
||||
$notification->createdBy = $element->createdBy;
|
||||
$notification->createdFor = $rel->relation;
|
||||
$notification->type = $type;
|
||||
$notification->category = PermissionCategory::TASK;
|
||||
$notification->element = $task->id;
|
||||
$notification->redirect = '{/base}/task/view?{?}&id=' . $element->task;
|
||||
|
||||
$this->createModel($request->header->account, $notification, NotificationMapper::class, 'notification', $request->getOrigin());
|
||||
$accChecked[] = $rel->relation->id;
|
||||
}
|
||||
|
||||
// Group relations
|
||||
foreach ($element->grpRelation as $rel) {
|
||||
if (\in_array($rel->relation->id, $grpChecked)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$group = GroupMapper::get()
|
||||
->with('accounts')
|
||||
->where('id', $rel->relation->id)
|
||||
->execute();
|
||||
|
||||
foreach ($group->accounts as $account) {
|
||||
if (\in_array($account->id, $accChecked)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$profile = ProfileMapper::count()
|
||||
->where('account', $account->id)
|
||||
->execute();
|
||||
|
||||
if ($profile < 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$notification = new Notification();
|
||||
$notification->module = self::NAME;
|
||||
$notification->title = $task->title;
|
||||
$notification->createdBy = $element->createdBy;
|
||||
$notification->createdFor = $account;
|
||||
$notification->type = $type;
|
||||
$notification->category = PermissionCategory::TASK;
|
||||
$notification->element = $task->id;
|
||||
$notification->redirect = '{/base}/task/view?{?}&id=' . $element->task;
|
||||
|
||||
$this->createModel($request->header->account, $notification, NotificationMapper::class, 'notification', $request->getOrigin());
|
||||
$accChecked[] = $account->id;
|
||||
}
|
||||
|
||||
$grpChecked[] = $rel->relation->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create media files for task
|
||||
*
|
||||
|
|
@ -492,6 +593,8 @@ final class ApiController extends Controller
|
|||
$task = TaskMapper::get()->where('id', (int) ($request->getData('task')))->execute();
|
||||
$element = $this->createTaskElementFromRequest($request, $task);
|
||||
|
||||
$this->createNotifications($element, NotificationType::CHILDREN, $request);
|
||||
|
||||
$task->due = $element->due;
|
||||
$task->completion = $request->getDataInt('completion') ?? $task->completion;
|
||||
$task->priority = $element->priority;
|
||||
|
|
|
|||
|
|
@ -66,41 +66,11 @@ final class BackendController extends Controller implements DashboardElementInte
|
|||
|
||||
/** @var \phpOMS\Model\Html\Head $head */
|
||||
$head = $response->data['Content']->head;
|
||||
$head->addAsset(AssetType::CSS, 'Modules/Tasks/Theme/Backend/css/styles.css?v=1.0.0');
|
||||
$head->addAsset(AssetType::CSS, 'Modules/Tasks/Theme/Backend/css/styles.css?v=' . self::VERSION);
|
||||
|
||||
$view->setTemplate('/Modules/Tasks/Theme/Backend/task-dashboard');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001101001, $request, $response);
|
||||
|
||||
$mapperQuery = TaskMapper::getAnyRelatedToUser($request->header->account)
|
||||
->with('tags')
|
||||
->with('tags/title')
|
||||
->with('createdBy')
|
||||
->where('status', TaskStatus::OPEN, '!=')
|
||||
->where('type', TaskType::SINGLE)
|
||||
->where('tags/title/language', $response->header->l11n->language)
|
||||
->sort('createdAt', OrderType::DESC)
|
||||
->limit(25);
|
||||
|
||||
if ($request->getData('ptype') === 'p') {
|
||||
$view->data['tasks'] = $mapperQuery->where('id', $request->getDataInt('id') ?? 0, '<')
|
||||
->execute();
|
||||
} elseif ($request->getData('ptype') === 'n') {
|
||||
$view->data['tasks'] = $mapperQuery->where('id', $request->getDataInt('id') ?? 0, '>')
|
||||
->execute();
|
||||
} else {
|
||||
$view->data['tasks'] = $mapperQuery->where('id', 0, '>')
|
||||
->execute();
|
||||
}
|
||||
|
||||
$view->data['task_media'] = [];
|
||||
foreach ($view->data['tasks'] as $task) {
|
||||
$view->data['task_media'][$task->id] = TaskMapper::has()
|
||||
->with('files')
|
||||
->where('id', $task->id)
|
||||
->where('type', TaskType::SINGLE)
|
||||
->execute();
|
||||
}
|
||||
|
||||
$openQuery = new Builder($this->app->dbPool->get(), true);
|
||||
$openQuery->innerJoin(TaskElementMapper::TABLE)
|
||||
->on(TaskMapper::TABLE . '_d1.' . TaskMapper::PRIMARYFIELD, '=', TaskElementMapper::TABLE . '.task_element_task')
|
||||
|
|
@ -157,23 +127,75 @@ final class BackendController extends Controller implements DashboardElementInte
|
|||
}
|
||||
|
||||
/** @var \Modules\Tasks\Models\TaskSeen[] $unread */
|
||||
$unread = TaskSeenMapper::getAll()
|
||||
->where('task', \array_keys($open), 'in')
|
||||
->where('seenBy', $request->header->account)
|
||||
->execute();
|
||||
$view->data['unread'] = TaskMapper::getUnread($request->header->account);
|
||||
|
||||
$unseen = [];
|
||||
foreach ($unread as $read) {
|
||||
if ($read->isRemindered && ($read->reminderAt?->getTimestamp() ?? 0) > $request->header->getRequestTime()) {
|
||||
continue;
|
||||
}
|
||||
return $view;
|
||||
}
|
||||
|
||||
$unseen[$read->task] = true;
|
||||
/**
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return RenderableInterface Returns a renderable object
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function viewTaskList(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$isModerator = false;
|
||||
if (!$this->app->accountManager->get($request->header->account)
|
||||
->hasPermission(PermissionType::READ, $this->app->unitId, module: 'Tasks')
|
||||
) {
|
||||
$isModerator = true;
|
||||
}
|
||||
|
||||
$view->data['unread'] = $unseen;
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
|
||||
foreach ($view->data['unread'] as $task) {
|
||||
/** @var \phpOMS\Model\Html\Head $head */
|
||||
$head = $response->data['Content']->head;
|
||||
$head->addAsset(AssetType::CSS, 'Modules/Tasks/Theme/Backend/css/styles.css?v=' . self::VERSION);
|
||||
|
||||
$view->setTemplate('/Modules/Tasks/Theme/Backend/task-list');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001101001, $request, $response);
|
||||
|
||||
if ($isModerator) {
|
||||
$mapperQuery = TaskMapper::getAll()
|
||||
->with('tags')
|
||||
->with('tags/title')
|
||||
->with('createdBy')
|
||||
->where('status', TaskStatus::OPEN, '!=')
|
||||
->where('type', TaskType::SINGLE)
|
||||
->sort('createdAt', OrderType::DESC)
|
||||
->limit(25);
|
||||
} else {
|
||||
$mapperQuery = TaskMapper::getAnyRelatedToUser($request->header->account)
|
||||
->with('tags')
|
||||
->with('tags/title')
|
||||
->with('createdBy')
|
||||
->where('status', TaskStatus::OPEN, '!=')
|
||||
->where('type', TaskType::SINGLE)
|
||||
->where('tags/title/language', $response->header->l11n->language)
|
||||
->sort('createdAt', OrderType::DESC)
|
||||
->limit(25);
|
||||
}
|
||||
|
||||
if ($request->getData('ptype') === 'p') {
|
||||
$view->data['tasks'] = $mapperQuery->where('id', $request->getDataInt('id') ?? 0, '<')
|
||||
->execute();
|
||||
} elseif ($request->getData('ptype') === 'n') {
|
||||
$view->data['tasks'] = $mapperQuery->where('id', $request->getDataInt('id') ?? 0, '>')
|
||||
->execute();
|
||||
} else {
|
||||
$view->data['tasks'] = $mapperQuery->where('id', 0, '>')
|
||||
->execute();
|
||||
}
|
||||
|
||||
$view->data['task_media'] = [];
|
||||
foreach ($view->data['tasks'] as $task) {
|
||||
$view->data['task_media'][$task->id] = TaskMapper::has()
|
||||
->with('files')
|
||||
->where('id', $task->id)
|
||||
|
|
@ -181,6 +203,9 @@ final class BackendController extends Controller implements DashboardElementInte
|
|||
->execute();
|
||||
}
|
||||
|
||||
/** @var \Modules\Tasks\Models\TaskSeen[] $unread */
|
||||
$view->data['unread'] = TaskMapper::getUnread($request->header->account);
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
|
|
@ -192,7 +217,7 @@ final class BackendController extends Controller implements DashboardElementInte
|
|||
{
|
||||
/** @var \phpOMS\Model\Html\Head $head */
|
||||
$head = $response->data['Content']->head;
|
||||
$head->addAsset(AssetType::CSS, 'Modules/Tasks/Theme/Backend/css/styles.css?v=1.0.0');
|
||||
$head->addAsset(AssetType::CSS, 'Modules/Tasks/Theme/Backend/css/styles.css?v=' . self::VERSION);
|
||||
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Modules/Tasks/Theme/Backend/dashboard-task');
|
||||
|
|
@ -251,7 +276,7 @@ final class BackendController extends Controller implements DashboardElementInte
|
|||
|
||||
/** @var \phpOMS\Model\Html\Head $head */
|
||||
$head = $response->data['Content']->head;
|
||||
$head->addAsset(AssetType::CSS, 'Modules/Tasks/Theme/Backend/css/styles.css?v=1.0.0');
|
||||
$head->addAsset(AssetType::CSS, 'Modules/Tasks/Theme/Backend/css/styles.css?v=' . self::VERSION);
|
||||
|
||||
/** @var \Modules\Tasks\Models\Task $task */
|
||||
$task = TaskMapper::get()
|
||||
|
|
@ -394,6 +419,6 @@ final class BackendController extends Controller implements DashboardElementInte
|
|||
*/
|
||||
public function openNav(int $account) : int
|
||||
{
|
||||
return TaskMapper::countUnread($account);
|
||||
return \count(TaskMapper::getUnread($account));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ final class SearchController extends Controller
|
|||
->where('tags/title/language', $response->header->l11n->language)
|
||||
->sort('createdAt', OrderType::DESC)
|
||||
->sort('taskElements/createdAt', OrderType::ASC)
|
||||
->limit(25)
|
||||
->limit(8)
|
||||
//->limit(1, 'taskElements')
|
||||
->execute();
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ final class TaskAttributeMapper extends DataMapperFactory
|
|||
*/
|
||||
public const COLUMNS = [
|
||||
'task_attr_id' => ['name' => 'task_attr_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'task_attr_item' => ['name' => 'task_attr_item', 'type' => 'int', 'internal' => 'ref'],
|
||||
'task_attr_task' => ['name' => 'task_attr_task', 'type' => 'int', 'internal' => 'ref'],
|
||||
'task_attr_type' => ['name' => 'task_attr_type', 'type' => 'int', 'internal' => 'type'],
|
||||
'task_attr_value' => ['name' => 'task_attr_value', 'type' => 'int', 'internal' => 'value'],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -482,6 +482,56 @@ class Task implements \JsonSerializable
|
|||
return $this->toArray();
|
||||
}
|
||||
|
||||
public static function fromTemplate(self $task) : self
|
||||
{
|
||||
$now = new \DateTimeImmutable('now');
|
||||
|
||||
$task->id = 0;
|
||||
$task->type = TaskType::SINGLE;
|
||||
|
||||
if ($task->due !== null) {
|
||||
$task->due->setTimestamp(
|
||||
$task->due->getTimestamp()
|
||||
+ ($now->getTimestamp() - $task->createdAt->getTimestamp())
|
||||
);
|
||||
}
|
||||
|
||||
$task->createdAt = $now;
|
||||
|
||||
// We need to create a new relation since the old one references the template
|
||||
foreach ($task->attributes as $attribute) {
|
||||
$attribute->id = 0;
|
||||
$attribute->ref = 0;
|
||||
}
|
||||
|
||||
foreach ($task->taskElements as $element) {
|
||||
$element->id = 0;
|
||||
$element->task = 0;
|
||||
|
||||
if ($element->due !== null) {
|
||||
$element->due->setTimestamp(
|
||||
$element->due->getTimestamp()
|
||||
+ ($now->getTimestamp() - $element->createdAt->getTimestamp())
|
||||
);
|
||||
}
|
||||
|
||||
$element->createdAt = $now;
|
||||
|
||||
// We need to create a new relation since the old one references the template
|
||||
foreach ($element->accRelation as $relation) {
|
||||
$relation->id = 0;
|
||||
$relation->element = 0;
|
||||
}
|
||||
|
||||
foreach ($element->grpRelation as $relation) {
|
||||
$relation->id = 0;
|
||||
$relation->element = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return $task;
|
||||
}
|
||||
|
||||
use \Modules\Media\Models\MediaListTrait;
|
||||
use \Modules\Attribute\Models\AttributeHolderTrait;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ final class TaskMapper extends DataMapperFactory
|
|||
'attributes' => [
|
||||
'mapper' => TaskAttributeMapper::class,
|
||||
'table' => 'task_attr',
|
||||
'self' => 'task_attr_item',
|
||||
'self' => 'task_attr_task',
|
||||
'external' => null,
|
||||
],
|
||||
];
|
||||
|
|
@ -395,38 +395,40 @@ final class TaskMapper extends DataMapperFactory
|
|||
*
|
||||
* @param int $user User
|
||||
*
|
||||
* @return int
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function countUnread(int $user) : int
|
||||
public static function getUnread(int $user) : array
|
||||
{
|
||||
try {
|
||||
$query = new Builder(self::$db);
|
||||
|
||||
$query->count('DISTINCT ' . self::TABLE . '.' . self::PRIMARYFIELD)
|
||||
$query->select(self::TABLE . '.' . self::PRIMARYFIELD)
|
||||
->from(self::TABLE)
|
||||
->innerJoin(TaskElementMapper::TABLE)
|
||||
->on(self::TABLE . '.' . self::PRIMARYFIELD, '=', TaskElementMapper::TABLE . '.task_element_task')
|
||||
->innerJoin(AccountRelationMapper::TABLE)
|
||||
->on(TaskElementMapper::TABLE . '.' . TaskElementMapper::PRIMARYFIELD, '=', AccountRelationMapper::TABLE . '.task_account_task_element')
|
||||
->leftJoin(TaskSeenMapper::TABLE)
|
||||
->on(TaskMapper::TABLE . '.' . TaskMapper::PRIMARYFIELD, '=', TaskSeenMapper::TABLE . '.task_seen_task')
|
||||
->where(self::TABLE . '.task_status', '=', TaskStatus::OPEN)
|
||||
->andWhere(AccountRelationMapper::TABLE . '.task_account_account', '=', $user);
|
||||
->andWhere(AccountRelationMapper::TABLE . '.task_account_account', '=', $user)
|
||||
->andWhere(TaskSeenMapper::TABLE . '.task_seen_task', '=', null);
|
||||
|
||||
$sth = self::$db->con->prepare($query->toSql());
|
||||
$sth->execute();
|
||||
|
||||
$fetched = $sth->fetchAll();
|
||||
|
||||
$fetched = $sth->fetchAll(\PDO::FETCH_COLUMN);
|
||||
if ($fetched === false) {
|
||||
return -1;
|
||||
return [];
|
||||
}
|
||||
|
||||
$count = $fetched[0][0] ?? 0;
|
||||
$result = $fetched;
|
||||
} catch (\Exception $_) {
|
||||
return -1;
|
||||
return [];
|
||||
}
|
||||
|
||||
return $count;
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,12 +16,6 @@ use Modules\Tasks\Models\TaskPriority;
|
|||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
/** @var \Modules\Tasks\Models\Task[] $tasks */
|
||||
$tasks = $this->data['tasks'] ?? [];
|
||||
|
||||
$previous = empty($tasks) ? 'task/dashboard' : 'task/dashboard?{?}&id=' . \reset($tasks)->id . '&ptype=p';
|
||||
$next = empty($tasks) ? 'task/dashboard' : 'task/dashboard?{?}&id=' . \end($tasks)->id . '&ptype=n';
|
||||
|
||||
$open = $this->data['open'];
|
||||
|
||||
echo $this->data['nav']->render(); ?>
|
||||
|
|
@ -30,7 +24,7 @@ echo $this->data['nav']->render(); ?>
|
|||
<div class="box">
|
||||
<ul class="tab-links">
|
||||
<li><label for="c-tab-1"><?= $this->getHtml('Overview'); ?></label>
|
||||
<li><label for="c-tab-2"><?= $this->getHtml('Unread'); ?></label>
|
||||
<!--<li><label for="c-tab-2"><?= $this->getHtml('Unread'); ?></label>-->
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tab-content">
|
||||
|
|
@ -77,7 +71,7 @@ echo $this->data['nav']->render(); ?>
|
|||
</a>
|
||||
<td><?= ($this->data['task_media'][$task->id] ?? false) === true ? '<i class="g-icon">attachment</i>' : ''; ?>
|
||||
<td data-label="<?= $this->getHtml('Title'); ?>">
|
||||
<a href="<?= $url; ?>"><?= $this->printHtml($task->title); ?></a>
|
||||
<a href="<?= $url; ?>"><?= \in_array($key, $this->data['unread']) ? '<strong>' : ''; ?><?= $this->printHtml($task->title); ?><?= \in_array($key, $this->data['unread']) ? '</strong>' : ''; ?></a>
|
||||
<td data-label="<?= $this->getHtml('Tag'); ?>">
|
||||
<?php foreach ($task->tags as $tag) : ?>
|
||||
<a href="<?= $url; ?>">
|
||||
|
|
@ -151,7 +145,7 @@ echo $this->data['nav']->render(); ?>
|
|||
</a>
|
||||
<td><?= ($this->data['task_media'][$task->id] ?? false) === true ? '<i class="g-icon">attachment</i>' : ''; ?>
|
||||
<td data-label="<?= $this->getHtml('Title'); ?>">
|
||||
<a href="<?= $url; ?>"><?= $this->printHtml($task->title); ?></a>
|
||||
<a href="<?= $url; ?>"><?= \in_array($key, $this->data['unread']) ? '<strong>' : ''; ?><?= $this->printHtml($task->title); ?><?= \in_array($key, $this->data['unread']) ? '</strong>' : ''; ?></a>
|
||||
<td data-label="<?= $this->getHtml('Tag'); ?>">
|
||||
<?php foreach ($task->tags as $tag) : ?>
|
||||
<a href="<?= $url; ?>">
|
||||
|
|
@ -177,170 +171,6 @@ echo $this->data['nav']->render(); ?>
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('All'); ?><i class="g-icon download btn end-xs">download</i></div>
|
||||
<div class="slider">
|
||||
<table id="taskList" class="default sticky">
|
||||
<thead>
|
||||
<td><?= $this->getHtml('Status'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
|
||||
<td><?= $this->getHtml('Due/Priority'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
|
||||
<td>
|
||||
<td class="wf-100"><?= $this->getHtml('Title'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
|
||||
<td><?= $this->getHtml('Tag'); ?>
|
||||
<td><?= $this->getHtml('Creator'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
|
||||
<td><?= $this->getHtml('Created'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
|
||||
<tbody>
|
||||
<?php
|
||||
$c = 0;
|
||||
foreach ($tasks as $key => $task) :
|
||||
if ($open !== null && isset($open[$task->id])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
++$c;
|
||||
$url = UriFactory::build(empty($task->redirect)
|
||||
? '{/base}/task/view?{?}&id=' . $task->id
|
||||
: ('{/app}/' . $task->redirect),
|
||||
['$id' => $task->id]
|
||||
);
|
||||
?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td data-label="<?= $this->getHtml('Status'); ?>">
|
||||
<a href="<?= $url; ?>">
|
||||
<span class="tag <?= $this->printHtml('task-status-' . $task->status); ?>">
|
||||
<?= $this->getHtml('S' . $task->status); ?>
|
||||
</span>
|
||||
</a>
|
||||
<td data-label="<?= $this->getHtml('Due/Priority'); ?>">
|
||||
<a href="<?= $url; ?>">
|
||||
<?php if ($task->priority === TaskPriority::NONE) : ?>
|
||||
<?= $this->printHtml($task->due->format('Y-m-d H:i')); ?>
|
||||
<?php else : ?>
|
||||
<?= $this->getHtml('P' . $task->priority); ?>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
<td><?= ($this->data['task_media'][$task->id] ?? false) === true ? '<i class="g-icon">attachment</i>' : ''; ?>
|
||||
<td data-label="<?= $this->getHtml('Title'); ?>">
|
||||
<a href="<?= $url; ?>"><?= $this->printHtml($task->title); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Tag'); ?>">
|
||||
<?php foreach ($task->tags as $tag) : ?>
|
||||
<a href="<?= $url; ?>">
|
||||
<span class="tag" style="background: <?= $this->printHtml($tag->color); ?>">
|
||||
<?= empty($tag->icon) ? '' : ''; ?>
|
||||
<?= $this->printHtml($tag->getL11n()); ?>
|
||||
</span>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
<td data-label="<?= $this->getHtml('Creator'); ?>">
|
||||
<a class="content" href="<?= UriFactory::build('{/base}/profile/view?{?}&for=' . $task->createdBy->id); ?>">
|
||||
<?= $this->printHtml($this->renderUserName(
|
||||
'%3$s %2$s %1$s',
|
||||
[
|
||||
$task->createdBy->name1,
|
||||
$task->createdBy->name2,
|
||||
$task->createdBy->name3,
|
||||
$task->createdBy->login ?? '',
|
||||
])
|
||||
); ?>
|
||||
</a>
|
||||
<td data-label="<?= $this->getHtml('Created'); ?>">
|
||||
<a href="<?= $url; ?>"><?= $this->printHtml($task->createdAt->format('Y-m-d H:i')); ?></a>
|
||||
<?php endforeach; if ($c == 0) : ?>
|
||||
<tr><td colspan="7" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
<a class="button" href="<?= UriFactory::build($previous); ?>"><?= $this->getHtml('Previous', '0', '0'); ?></a>
|
||||
<a class="button" href="<?= UriFactory::build($next); ?>"><?= $this->getHtml('Next', '0', '0'); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
|
||||
<div class="tab">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('UnreadChanges'); ?><i class="g-icon download btn end-xs">download</i></div>
|
||||
<div class="slider">
|
||||
<table id="taskList" class="default sticky">
|
||||
<thead>
|
||||
<td><?= $this->getHtml('Status'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
|
||||
<td><?= $this->getHtml('Due/Priority'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
|
||||
<td>
|
||||
<td class="wf-100"><?= $this->getHtml('Title'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
|
||||
<td><?= $this->getHtml('Tag'); ?>
|
||||
<td><?= $this->getHtml('Creator'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
|
||||
<td><?= $this->getHtml('Created'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
|
||||
<tbody>
|
||||
<?php
|
||||
$c = 0;
|
||||
foreach ($open as $key => $task) : ++$c;
|
||||
if (isset($this->data['unread'][$key])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$url = UriFactory::build(empty($task->redirect)
|
||||
? '{/base}/task/view?{?}&id=' . $task->id
|
||||
: ('{/app}/' . $task->redirect),
|
||||
['$id' => $task->id]
|
||||
);
|
||||
?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td data-label="<?= $this->getHtml('Status'); ?>">
|
||||
<a href="<?= $url; ?>">
|
||||
<span class="tag <?= $this->printHtml('task-status-' . $task->status); ?>">
|
||||
<?= $this->getHtml('S' . $task->status); ?>
|
||||
</span>
|
||||
</a>
|
||||
<td data-label="<?= $this->getHtml('Due/Priority'); ?>">
|
||||
<a href="<?= $url; ?>">
|
||||
<?php if ($task->priority === TaskPriority::NONE) : ?>
|
||||
<?= $this->printHtml($task->due->format('Y-m-d H:i')); ?>
|
||||
<?php else : ?>
|
||||
<?= $this->getHtml('P' . $task->priority); ?>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
<td><?= ($this->data['task_media'][$task->id] ?? false) === true ? '<i class="g-icon">attachment</i>' : ''; ?>
|
||||
<td data-label="<?= $this->getHtml('Title'); ?>">
|
||||
<a href="<?= $url; ?>"><?= $this->printHtml($task->title); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Tag'); ?>">
|
||||
<?php foreach ($task->tags as $tag) : ?>
|
||||
<a href="<?= $url; ?>">
|
||||
<span class="tag" style="background: <?= $this->printHtml($tag->color); ?>">
|
||||
<?= empty($tag->icon) ? '' : ''; ?>
|
||||
<?= $this->printHtml($tag->getL11n()); ?>
|
||||
</span>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
<td data-label="<?= $this->getHtml('Creator'); ?>">
|
||||
<a class="content" href="<?= UriFactory::build('{/base}/profile/view?{?}&for=' . $task->createdBy->id); ?>">
|
||||
<?= $this->printHtml($this->renderUserName(
|
||||
'%3$s %2$s %1$s',
|
||||
[
|
||||
$task->createdBy->name1,
|
||||
$task->createdBy->name2,
|
||||
$task->createdBy->name3,
|
||||
$task->createdBy->login ?? '',
|
||||
])
|
||||
); ?>
|
||||
</a>
|
||||
<td data-label="<?= $this->getHtml('Created'); ?>">
|
||||
<a href="<?= $url; ?>"><?= $this->printHtml($task->createdAt->format('Y-m-d H:i')); ?></a>
|
||||
<?php endforeach; if ($c == 0) : ?>
|
||||
<tr><td colspan="7" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
110
Theme/Backend/task-list.tpl.php
Normal file
110
Theme/Backend/task-list.tpl.php
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Tasks
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Modules\Tasks\Models\TaskPriority;
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
/** @var \Modules\Tasks\Models\Task[] $tasks */
|
||||
$tasks = $this->data['tasks'] ?? [];
|
||||
|
||||
$previous = empty($tasks) ? 'task/dashboard' : 'task/dashboard?{?}&id=' . \reset($tasks)->id . '&ptype=p';
|
||||
$next = empty($tasks) ? 'task/dashboard' : 'task/dashboard?{?}&id=' . \end($tasks)->id . '&ptype=n';
|
||||
|
||||
$open = $this->data['open'];
|
||||
|
||||
echo $this->data['nav']->render(); ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('All'); ?><i class="g-icon download btn end-xs">download</i></div>
|
||||
<div class="slider">
|
||||
<table id="taskList" class="default sticky">
|
||||
<thead>
|
||||
<td><?= $this->getHtml('Status'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
|
||||
<td><?= $this->getHtml('Due/Priority'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
|
||||
<td>
|
||||
<td class="wf-100"><?= $this->getHtml('Title'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
|
||||
<td><?= $this->getHtml('Tag'); ?>
|
||||
<td><?= $this->getHtml('Creator'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
|
||||
<td><?= $this->getHtml('Created'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
|
||||
<tbody>
|
||||
<?php
|
||||
$c = 0;
|
||||
foreach ($tasks as $key => $task) :
|
||||
if ($open !== null && isset($open[$task->id])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
++$c;
|
||||
$url = UriFactory::build(empty($task->redirect)
|
||||
? '{/base}/task/view?{?}&id=' . $task->id
|
||||
: ('{/app}/' . $task->redirect),
|
||||
['$id' => $task->id]
|
||||
);
|
||||
?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td data-label="<?= $this->getHtml('Status'); ?>">
|
||||
<a href="<?= $url; ?>">
|
||||
<span class="tag <?= $this->printHtml('task-status-' . $task->status); ?>">
|
||||
<?= $this->getHtml('S' . $task->status); ?>
|
||||
</span>
|
||||
</a>
|
||||
<td data-label="<?= $this->getHtml('Due/Priority'); ?>">
|
||||
<a href="<?= $url; ?>">
|
||||
<?php if ($task->priority === TaskPriority::NONE) : ?>
|
||||
<?= $this->printHtml($task->due->format('Y-m-d H:i')); ?>
|
||||
<?php else : ?>
|
||||
<?= $this->getHtml('P' . $task->priority); ?>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
<td><?= ($this->data['task_media'][$task->id] ?? false) === true ? '<i class="g-icon">attachment</i>' : ''; ?>
|
||||
<td data-label="<?= $this->getHtml('Title'); ?>">
|
||||
<a href="<?= $url; ?>"><?= $this->printHtml($task->title); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Tag'); ?>">
|
||||
<?php foreach ($task->tags as $tag) : ?>
|
||||
<a href="<?= $url; ?>">
|
||||
<span class="tag" style="background: <?= $this->printHtml($tag->color); ?>">
|
||||
<?= empty($tag->icon) ? '' : ''; ?>
|
||||
<?= $this->printHtml($tag->getL11n()); ?>
|
||||
</span>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
<td data-label="<?= $this->getHtml('Creator'); ?>">
|
||||
<a class="content" href="<?= UriFactory::build('{/base}/profile/view?{?}&for=' . $task->createdBy->id); ?>">
|
||||
<?= $this->printHtml($this->renderUserName(
|
||||
'%3$s %2$s %1$s',
|
||||
[
|
||||
$task->createdBy->name1,
|
||||
$task->createdBy->name2,
|
||||
$task->createdBy->name3,
|
||||
$task->createdBy->login ?? '',
|
||||
])
|
||||
); ?>
|
||||
</a>
|
||||
<td data-label="<?= $this->getHtml('Created'); ?>">
|
||||
<a href="<?= $url; ?>"><?= $this->printHtml($task->createdAt->format('Y-m-d H:i')); ?></a>
|
||||
<?php endforeach; if ($c == 0) : ?>
|
||||
<tr><td colspan="7" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
<a class="button" href="<?= UriFactory::build($previous); ?>"><?= $this->getHtml('Previous', '0', '0'); ?></a>
|
||||
<a class="button" href="<?= UriFactory::build($next); ?>"><?= $this->getHtml('Next', '0', '0'); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -31,7 +31,7 @@ echo $this->data['nav']->render(); ?>
|
|||
<div class="row">
|
||||
<div class="col-md-6 col-xs-12">
|
||||
<?php if (!empty($this->data['reminder'])) : ?>
|
||||
<section class="portlet highlight-4">
|
||||
<section class="portlet hl-4">
|
||||
<div class="portlet-body"><?= $this->getHtml('ReminderedBy'); ?> <?= \reset($this->data['reminder'])->reminderBy->name1; ?></div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
|
@ -114,8 +114,8 @@ echo $this->data['nav']->render(); ?>
|
|||
<div class="col-xs-0 end-xs plain-grid">
|
||||
<?php if ($task->isEditable && $this->request->header->account === $task->createdBy->id) : ?>
|
||||
<div class="col-xs end-xs plain-grid">
|
||||
<button class="save hidden"><?= $this->getHtml('Save', '0', '0'); ?></button>
|
||||
<button class="cancel hidden"><?= $this->getHtml('Cancel', '0', '0'); ?></button>
|
||||
<button class="save vh"><?= $this->getHtml('Save', '0', '0'); ?></button>
|
||||
<button class="cancel vh"><?= $this->getHtml('Cancel', '0', '0'); ?></button>
|
||||
<button class="update"><?= $this->getHtml('Edit', '0', '0'); ?></button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
|
@ -156,8 +156,8 @@ echo $this->data['nav']->render(); ?>
|
|||
|
||||
<div class="col-xs end-xs plain-grid">
|
||||
<input type="hidden" value="" name="id">
|
||||
<button class="save hidden"><?= $this->getHtml('Save', '0', '0'); ?></button>
|
||||
<button class="cancel hidden"><?= $this->getHtml('Cancel', '0', '0'); ?></button>
|
||||
<button class="save vh"><?= $this->getHtml('Save', '0', '0'); ?></button>
|
||||
<button class="cancel vh"><?= $this->getHtml('Cancel', '0', '0'); ?></button>
|
||||
<button class="update"><?= $this->getHtml('Edit', '0', '0'); ?></button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -292,8 +292,8 @@ echo $this->data['nav']->render(); ?>
|
|||
) : ?>
|
||||
<div class="col-xs end-xs plain-grid">
|
||||
<input type="hidden" value="<?= $element->id; ?>" name="id">
|
||||
<button class="save hidden"><?= $this->getHtml('Save', '0', '0'); ?></button>
|
||||
<button class="cancel hidden"><?= $this->getHtml('Cancel', '0', '0'); ?></button>
|
||||
<button class="save vh"><?= $this->getHtml('Save', '0', '0'); ?></button>
|
||||
<button class="cancel vh"><?= $this->getHtml('Cancel', '0', '0'); ?></button>
|
||||
<button class="update"><?= $this->getHtml('Edit', '0', '0'); ?></button>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user