diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/Controller/Task.php | 2 | ||||
-rw-r--r-- | app/Locales/de_DE/translations.php | 10 | ||||
-rw-r--r-- | app/Locales/es_ES/translations.php | 2 | ||||
-rw-r--r-- | app/Locales/fr_FR/translations.php | 2 | ||||
-rw-r--r-- | app/Locales/pl_PL/translations.php | 2 | ||||
-rw-r--r-- | app/Locales/pt_BR/translations.php | 2 | ||||
-rw-r--r-- | app/Locales/sv_SE/translations.php | 2 | ||||
-rw-r--r-- | app/Locales/zh_CN/translations.php | 2 | ||||
-rw-r--r-- | app/Model/Task.php | 64 | ||||
-rw-r--r-- | app/Schema/Mysql.php | 8 | ||||
-rw-r--r-- | app/Schema/Postgres.php | 8 | ||||
-rw-r--r-- | app/Schema/Sqlite.php | 8 | ||||
-rw-r--r-- | app/Templates/task_show.php | 14 |
13 files changed, 93 insertions, 33 deletions
diff --git a/app/Controller/Task.php b/app/Controller/Task.php index 15482afc..7414f7f9 100644 --- a/app/Controller/Task.php +++ b/app/Controller/Task.php @@ -108,6 +108,8 @@ class Task extends Base public function save() { $values = $this->request->getValues(); + $values['creator_id'] = $this->acl->getUserId(); + $this->checkProjectPermissions($values['project_id']); list($valid, $errors) = $this->task->validateCreation($values); diff --git a/app/Locales/de_DE/translations.php b/app/Locales/de_DE/translations.php index 734c3437..cea48b94 100644 --- a/app/Locales/de_DE/translations.php +++ b/app/Locales/de_DE/translations.php @@ -384,4 +384,14 @@ return array( // 'Maximum size: ' => '', // 'Unable to upload the file.' => '', // 'Display another project' => '', + // 'Your GitHub account was successfully linked to your profile.' => '', + // 'Unable to link your GitHub Account.' => '', + // 'GitHub authentication failed' => '', + // 'Your GitHub account is no longer linked to your profile.' => '', + // 'Unable to unlink your GitHub Account.' => '', + // 'Login with my GitHub Account' => '', + // 'Link my GitHub Account' => '', + // 'Unlink my GitHub Account' => '', + // 'Created by %s' => 'Créé par %s', + // 'Last modified on %B %e, %G at %k:%M %p' => '', ); diff --git a/app/Locales/es_ES/translations.php b/app/Locales/es_ES/translations.php index 98ab30ca..2dd3765f 100644 --- a/app/Locales/es_ES/translations.php +++ b/app/Locales/es_ES/translations.php @@ -384,4 +384,6 @@ return array( // 'Login with my GitHub Account' => '', // 'Link my GitHub Account' => '', // 'Unlink my GitHub Account' => '', + // 'Created by %s' => 'Créé par %s', + // 'Last modified on %B %e, %G at %k:%M %p' => '', ); diff --git a/app/Locales/fr_FR/translations.php b/app/Locales/fr_FR/translations.php index 4405a9a3..5067ea61 100644 --- a/app/Locales/fr_FR/translations.php +++ b/app/Locales/fr_FR/translations.php @@ -382,4 +382,6 @@ return array( 'Login with my GitHub Account' => 'Se connecter avec mon compte Github', 'Link my GitHub Account' => 'Lier mon compte Github', 'Unlink my GitHub Account' => 'Ne plus utiliser mon compte Github', + 'Created by %s' => 'Créé par %s', + 'Last modified on %B %e, %G at %k:%M %p' => 'Modifié le %d/%m/%Y à %H:%M', ); diff --git a/app/Locales/pl_PL/translations.php b/app/Locales/pl_PL/translations.php index 7e552d6a..a96d5672 100644 --- a/app/Locales/pl_PL/translations.php +++ b/app/Locales/pl_PL/translations.php @@ -385,4 +385,6 @@ return array( // 'Login with my GitHub Account' => '', // 'Link my GitHub Account' => '', // 'Unlink my GitHub Account' => '', + // 'Created by %s' => 'Créé par %s', + // 'Last modified on %B %e, %G at %k:%M %p' => '', ); diff --git a/app/Locales/pt_BR/translations.php b/app/Locales/pt_BR/translations.php index 9a571bad..8ba9b64a 100644 --- a/app/Locales/pt_BR/translations.php +++ b/app/Locales/pt_BR/translations.php @@ -382,4 +382,6 @@ return array( // 'Login with my GitHub Account' => '', // 'Link my GitHub Account' => '', // 'Unlink my GitHub Account' => '', + // 'Created by %s' => 'Créé par %s', + // 'Last modified on %B %e, %G at %k:%M %p' => '', ); diff --git a/app/Locales/sv_SE/translations.php b/app/Locales/sv_SE/translations.php index b59217a1..8bd6a592 100644 --- a/app/Locales/sv_SE/translations.php +++ b/app/Locales/sv_SE/translations.php @@ -384,4 +384,6 @@ return array( // 'Login with my GitHub Account' => '', // 'Link my GitHub Account' => '', // 'Unlink my GitHub Account' => '', + // 'Created by %s' => 'Créé par %s', + // 'Last modified on %B %e, %G at %k:%M %p' => '', ); diff --git a/app/Locales/zh_CN/translations.php b/app/Locales/zh_CN/translations.php index 86628756..9ed0c8a3 100644 --- a/app/Locales/zh_CN/translations.php +++ b/app/Locales/zh_CN/translations.php @@ -390,4 +390,6 @@ return array( // 'Login with my GitHub Account' => '', // 'Link my GitHub Account' => '', // 'Unlink my GitHub Account' => '', + // 'Created by %s' => 'Créé par %s', + // 'Last modified on %B %e, %G at %k:%M %p' => '', ); diff --git a/app/Model/Task.php b/app/Model/Task.php index f08eb910..8933cb14 100644 --- a/app/Model/Task.php +++ b/app/Model/Task.php @@ -73,34 +73,40 @@ class Task extends Base { if ($more) { - return $this->db - ->table(self::TABLE) - ->columns( - self::TABLE.'.id', - self::TABLE.'.title', - self::TABLE.'.description', - self::TABLE.'.date_creation', - self::TABLE.'.date_completed', - self::TABLE.'.date_due', - self::TABLE.'.color_id', - self::TABLE.'.project_id', - self::TABLE.'.column_id', - self::TABLE.'.owner_id', - self::TABLE.'.position', - self::TABLE.'.is_active', - self::TABLE.'.score', - self::TABLE.'.category_id', - Category::TABLE.'.name AS category_name', - Project::TABLE.'.name AS project_name', - Board::TABLE.'.title AS column_title', - User::TABLE.'.username' - ) - ->join(Category::TABLE, 'id', 'category_id') - ->join(Project::TABLE, 'id', 'project_id') - ->join(Board::TABLE, 'id', 'column_id') - ->join(User::TABLE, 'id', 'owner_id') - ->eq(self::TABLE.'.id', $task_id) - ->findOne(); + $sql = ' + SELECT + tasks.id, + tasks.title, + tasks.description, + tasks.date_creation, + tasks.date_completed, + tasks.date_modification, + tasks.date_due, + tasks.color_id, + tasks.project_id, + tasks.column_id, + tasks.owner_id, + tasks.creator_id, + tasks.position, + tasks.is_active, + tasks.score, + tasks.category_id, + project_has_categories.name AS category_name, + projects.name AS project_name, + columns.title AS column_title, + users.username AS assignee_username, + creators.username AS creator_username + FROM tasks + LEFT JOIN users ON users.id = tasks.owner_id + LEFT JOIN users AS creators ON creators.id = tasks.creator_id + LEFT JOIN project_has_categories ON project_has_categories.id = tasks.category_id + LEFT JOIN projects ON projects.id = tasks.project_id + LEFT JOIN columns ON columns.id = tasks.column_id + WHERE tasks.id = ? + '; + + $rq = $this->db->execute($sql, array($task_id)); + return $rq->fetch(\PDO::FETCH_ASSOC); } else { @@ -385,6 +391,7 @@ class Task extends Base } $updated_task = $values; + $updated_task['date_modification'] = time(); unset($updated_task['id']); $result = $this->db->table(self::TABLE)->eq('id', $values['id'])->update($updated_task); @@ -514,6 +521,7 @@ class Task extends Base new Validators\Required('column_id', t('The column is required')), new Validators\Integer('column_id', t('This value must be an integer')), new Validators\Integer('owner_id', t('This value must be an integer')), + new Validators\Integer('creator_id', t('This value must be an integer')), new Validators\Integer('score', t('This value must be an integer')), new Validators\Required('title', t('The title is required')), new Validators\MaxLength('title', t('The maximum length is %d characters', 200), 200), diff --git a/app/Schema/Mysql.php b/app/Schema/Mysql.php index 2c78d1e5..b9c35efc 100644 --- a/app/Schema/Mysql.php +++ b/app/Schema/Mysql.php @@ -4,7 +4,13 @@ namespace Schema; use Core\Security; -const VERSION = 20; +const VERSION = 21; + +function version_21($pdo) +{ + $pdo->exec("ALTER TABLE tasks ADD COLUMN creator_id INTEGER DEFAULT '0'"); + $pdo->exec("ALTER TABLE tasks ADD COLUMN date_modification INTEGER DEFAULT '0'"); +} function version_20($pdo) { diff --git a/app/Schema/Postgres.php b/app/Schema/Postgres.php index 8ac6631c..bc18bdca 100644 --- a/app/Schema/Postgres.php +++ b/app/Schema/Postgres.php @@ -4,7 +4,13 @@ namespace Schema; use Core\Security; -const VERSION = 1; +const VERSION = 2; + +function version_2($pdo) +{ + $pdo->exec("ALTER TABLE tasks ADD COLUMN creator_id INTEGER DEFAULT 0"); + $pdo->exec("ALTER TABLE tasks ADD COLUMN date_modification INTEGER DEFAULT 0"); +} function version_1($pdo) { diff --git a/app/Schema/Sqlite.php b/app/Schema/Sqlite.php index e4de397d..5ab42a6e 100644 --- a/app/Schema/Sqlite.php +++ b/app/Schema/Sqlite.php @@ -4,7 +4,13 @@ namespace Schema; use Core\Security; -const VERSION = 20; +const VERSION = 21; + +function version_21($pdo) +{ + $pdo->exec("ALTER TABLE tasks ADD COLUMN creator_id INTEGER DEFAULT '0'"); + $pdo->exec("ALTER TABLE tasks ADD COLUMN date_modification INTEGER DEFAULT '0'"); +} function version_20($pdo) { diff --git a/app/Templates/task_show.php b/app/Templates/task_show.php index 4c3d4697..b28a3a08 100644 --- a/app/Templates/task_show.php +++ b/app/Templates/task_show.php @@ -7,6 +7,11 @@ <li> <?= dt('Created on %B %e, %G at %k:%M %p', $task['date_creation']) ?> </li> + <?php if ($task['date_modification']): ?> + <li> + <?= dt('Last modified on %B %e, %G at %k:%M %p', $task['date_modification']) ?> + </li> + <?php endif ?> <?php if ($task['date_completed']): ?> <li> <?= dt('Completed on %B %e, %G at %k:%M %p', $task['date_completed']) ?> @@ -17,10 +22,15 @@ <strong><?= dt('Must be done before %B %e, %G', $task['date_due']) ?></strong> </li> <?php endif ?> + <?php if ($task['creator_username']): ?> + <li> + <?= t('Created by %s', $task['creator_username']) ?> + </li> + <?php endif ?> <li> <strong> - <?php if ($task['username']): ?> - <?= t('Assigned to %s', $task['username']) ?> + <?php if ($task['assignee_username']): ?> + <?= t('Assigned to %s', $task['assignee_username']) ?> <?php else: ?> <?= t('There is nobody assigned') ?> <?php endif ?> |