mirror of
https://github.com/Karaka-Management/oms-ProjectManagement.git
synced 2026-01-28 23:38:40 +00:00
fixes #90
This commit is contained in:
parent
c268152214
commit
6d90b9c188
|
|
@ -38,10 +38,10 @@ class Installer extends InstallerAbstract
|
|||
{
|
||||
parent::install(__DIR__ . '/..', $dbPool, $info);
|
||||
|
||||
switch ($dbPool->get('core')->getType()) {
|
||||
switch ($dbPool->get()->getType()) {
|
||||
case DatabaseType::MYSQL:
|
||||
$dbPool->get('core')->con->prepare(
|
||||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'projectmanagement_project` (
|
||||
$dbPool->get()->con->prepare(
|
||||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get()->prefix . 'projectmanagement_project` (
|
||||
`projectmanagement_project_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`projectmanagement_project_name` varchar(255) NOT NULL,
|
||||
`projectmanagement_project_description` text NOT NULL,
|
||||
|
|
@ -51,6 +51,8 @@ class Installer extends InstallerAbstract
|
|||
`projectmanagement_project_earnings` int(11) NOT NULL,
|
||||
`projectmanagement_project_start` datetime NOT NULL,
|
||||
`projectmanagement_project_end` datetime NOT NULL,
|
||||
`projectmanagement_project_progress` int NOT NULL,
|
||||
`projectmanagement_project_progress_type` int NOT NULL,
|
||||
`projectmanagement_project_created_at` datetime NOT NULL,
|
||||
`projectmanagement_project_created_by` int(11) NOT NULL,
|
||||
PRIMARY KEY (`projectmanagement_project_id`),
|
||||
|
|
@ -59,14 +61,14 @@ class Installer extends InstallerAbstract
|
|||
)ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;'
|
||||
)->execute();
|
||||
|
||||
$dbPool->get('core')->con->prepare(
|
||||
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'projectmanagement_project`
|
||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'projectmanagement_project_ibfk_1` FOREIGN KEY (`projectmanagement_project_calendar`) REFERENCES `' . $dbPool->get('core')->prefix . 'calendar` (`calendar_id`),
|
||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'projectmanagement_project_ibfk_2` FOREIGN KEY (`projectmanagement_project_created_by`) REFERENCES `' . $dbPool->get('core')->prefix . 'account` (`account_id`);'
|
||||
$dbPool->get()->con->prepare(
|
||||
'ALTER TABLE `' . $dbPool->get()->prefix . 'projectmanagement_project`
|
||||
ADD CONSTRAINT `' . $dbPool->get()->prefix . 'projectmanagement_project_ibfk_1` FOREIGN KEY (`projectmanagement_project_calendar`) REFERENCES `' . $dbPool->get()->prefix . 'calendar` (`calendar_id`),
|
||||
ADD CONSTRAINT `' . $dbPool->get()->prefix . 'projectmanagement_project_ibfk_2` FOREIGN KEY (`projectmanagement_project_created_by`) REFERENCES `' . $dbPool->get()->prefix . 'account` (`account_id`);'
|
||||
)->execute();
|
||||
|
||||
$dbPool->get('core')->con->prepare(
|
||||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get('core')->prefix . 'projectmanagement_task_relation` (
|
||||
$dbPool->get()->con->prepare(
|
||||
'CREATE TABLE if NOT EXISTS `' . $dbPool->get()->prefix . 'projectmanagement_task_relation` (
|
||||
`projectmanagement_task_relation_id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`projectmanagement_task_relation_src` int(11) NULL,
|
||||
`projectmanagement_task_relation_dst` int(11) NULL,
|
||||
|
|
@ -76,10 +78,10 @@ class Installer extends InstallerAbstract
|
|||
)ENGINE=InnoDB DEFAULT CHARSET=utf8;'
|
||||
)->execute();
|
||||
|
||||
$dbPool->get('core')->con->prepare(
|
||||
'ALTER TABLE `' . $dbPool->get('core')->prefix . 'projectmanagement_task_relation`
|
||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'projectmanagement_task_relation_ibfk_1` FOREIGN KEY (`projectmanagement_task_relation_src`) REFERENCES `' . $dbPool->get('core')->prefix . 'task` (`task_id`),
|
||||
ADD CONSTRAINT `' . $dbPool->get('core')->prefix . 'projectmanagement_task_relation_ibfk_2` FOREIGN KEY (`projectmanagement_task_relation_dst`) REFERENCES `' . $dbPool->get('core')->prefix . 'projectmanagement_project` (`projectmanagement_project_id`);'
|
||||
$dbPool->get()->con->prepare(
|
||||
'ALTER TABLE `' . $dbPool->get()->prefix . 'projectmanagement_task_relation`
|
||||
ADD CONSTRAINT `' . $dbPool->get()->prefix . 'projectmanagement_task_relation_ibfk_1` FOREIGN KEY (`projectmanagement_task_relation_src`) REFERENCES `' . $dbPool->get()->prefix . 'task` (`task_id`),
|
||||
ADD CONSTRAINT `' . $dbPool->get()->prefix . 'projectmanagement_task_relation_ibfk_2` FOREIGN KEY (`projectmanagement_task_relation_dst`) REFERENCES `' . $dbPool->get()->prefix . 'projectmanagement_project` (`projectmanagement_project_id`);'
|
||||
)->execute();
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
35
Models/ProgressType.php
Normal file
35
Models/ProgressType.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
/**
|
||||
* Orange Management
|
||||
*
|
||||
* PHP Version 7.1
|
||||
*
|
||||
* @category TBD
|
||||
* @package TBD
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @link http://orange-management.com
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
namespace Modules\ProjectManagement\Models;
|
||||
|
||||
use phpOMS\Stdlib\Base\Enum;
|
||||
|
||||
/**
|
||||
* Task type enum.
|
||||
*
|
||||
* @category Tasks
|
||||
* @package Modules
|
||||
* @license OMS License 1.0
|
||||
* @link http://orange-management.com
|
||||
* @since 1.0.0
|
||||
*/
|
||||
abstract class ProgressType extends Enum
|
||||
{
|
||||
/* public */ const MANUAL = 0;
|
||||
/* public */ const LINEAR = 1;
|
||||
/* public */ const EXPONENTIAL = 2;
|
||||
/* public */ const LOG = 3;
|
||||
/* public */ const TASKS = 4;
|
||||
}
|
||||
|
|
@ -46,6 +46,10 @@ class Project
|
|||
|
||||
private $earnings = null;
|
||||
|
||||
private $progress = 0;
|
||||
|
||||
private $progressType = ProgressType::MANUAL;
|
||||
|
||||
/**
|
||||
* Created at.
|
||||
*
|
||||
|
|
@ -105,6 +109,26 @@ class Project
|
|||
return false;
|
||||
}
|
||||
|
||||
public function getProgress() : int
|
||||
{
|
||||
return $this->progress;
|
||||
}
|
||||
|
||||
public function setProgress(int $progress) /* : void */
|
||||
{
|
||||
$this->progress = $progres;
|
||||
}
|
||||
|
||||
public function getProgressType() : int
|
||||
{
|
||||
return $this->progressType;
|
||||
}
|
||||
|
||||
public function setProgressType(int $type) /* : void */
|
||||
{
|
||||
$this->progressType = $type;
|
||||
}
|
||||
|
||||
public function getTask(int $id) : Task
|
||||
{
|
||||
return $this->tasks[$id] ?? new Task();
|
||||
|
|
|
|||
|
|
@ -49,6 +49,8 @@ class ProjectMapper extends DataMapperAbstract
|
|||
'projectmanagement_project_earnings' => ['name' => 'projectmanagement_project_earnings', 'type' => 'Serializable', 'internal' => 'earnings'],
|
||||
'projectmanagement_project_start' => ['name' => 'projectmanagement_project_start', 'type' => 'DateTime', 'internal' => 'start'],
|
||||
'projectmanagement_project_end' => ['name' => 'projectmanagement_project_end', 'type' => 'DateTime', 'internal' => 'end'],
|
||||
'projectmanagement_project_progress' => ['name' => 'projectmanagement_project_progress', 'type' => 'int', 'internal' => 'progress'],
|
||||
'projectmanagement_project_progress_type' => ['name' => 'projectmanagement_project_progress_type', 'type' => 'int', 'internal' => 'progressType'],
|
||||
'projectmanagement_project_created_by' => ['name' => 'projectmanagement_project_created_by', 'type' => 'int', 'internal' => 'createdBy'],
|
||||
'projectmanagement_project_created_at' => ['name' => 'projectmanagement_project_created_at', 'type' => 'DateTime', 'internal' => 'createdAt'],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ return ['ProjectManagement' => [
|
|||
'Manager' => 'Manager',
|
||||
'Name' => 'Name',
|
||||
'Other' => 'Other',
|
||||
'Progress' => 'Progress',
|
||||
'Project' => 'Project',
|
||||
'Projects' => 'Projects',
|
||||
'Responsibility' => 'Responsibility',
|
||||
|
|
@ -35,4 +36,10 @@ return ['ProjectManagement' => [
|
|||
'Status' => 'Status',
|
||||
'Title' => 'Title',
|
||||
'UserGroup' => 'User/Group',
|
||||
'Manual' => 'Manual',
|
||||
'Linear' => 'Linear',
|
||||
'Exponential' => 'Exponential',
|
||||
'Progress' => 'Progress',
|
||||
'Log' => 'Log',
|
||||
'Tasks' => 'Tasks',
|
||||
]];
|
||||
|
|
|
|||
|
|
@ -32,6 +32,15 @@ echo $this->getData('nav')->render(); ?>
|
|||
<td><input type="datetime-local" id="iEnd" name="end" value="<?= $this->printHtml($project->getEnd()->format('Y-m-d\TH:i:s')); ?>">
|
||||
<tr><td colspan="2"><label for="iDescription"><?= $this->getHtml('Description') ?></label>
|
||||
<tr><td colspan="2"><textarea id="iDescription" name="desc"><?= $this->printHtml($project->getDescription()); ?></textarea>
|
||||
<tr><td colspan="2"><label for="iProgressType"><?= $this->getHtml('Progress') ?></label>
|
||||
<tr><td><select id="iProgressType" name="progressType">
|
||||
<option value="<?= \Modules\Project\Models\ProgressType::MANUAL; ?>"><?= $this->getHtml('Manual') ?>
|
||||
<option value="<?= \Modules\Project\Models\ProgressType::LINEAR; ?>"><?= $this->getHtml('Linear') ?>
|
||||
<option value="<?= \Modules\Project\Models\ProgressType::EXPONENTIAL; ?>"><?= $this->getHtml('Exponential') ?>
|
||||
<option value="<?= \Modules\Project\Models\ProgressType::LOG; ?>"><?= $this->getHtml('Log') ?>
|
||||
<option value="<?= \Modules\Project\Models\ProgressType::TASKS; ?>"><?= $this->getHtml('Tasks') ?>
|
||||
</select>
|
||||
<td><input type="text" id="iProgress" name="progress" value="<?= $project->getProgress(); ?>"<?= $project->getProgressType() !== \Modules\Project\Models\ProgressType::MANUAL ? ' disabled' : ''; ?>>
|
||||
<tr><td><label for="iBudget"><?= $this->getHtml('Budget') ?></label><td><label for="iActual"><?= $this->getHtml('Actual') ?></label>
|
||||
<tr><td><input type="text" id="iBudget" name="budget" placeholder=""><td><input type="text" id="iActual" name="actual">
|
||||
<tr><td colspan="2"><input type="submit" value="<?= $this->getHtml('Save', 0, 0); ?>">
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user