From 5e47b860d8a77e24cd8f42dfab7f68ff4b2029d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BB=94=E5=93=A5?= Date: Wed, 15 Nov 2017 18:25:22 +0800 Subject: [PATCH] * Add story for todo --- module/todo/control.php | 7 ++++--- module/todo/model.php | 10 ++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/module/todo/control.php b/module/todo/control.php index b88b96ef1a..70041e2b70 100644 --- a/module/todo/control.php +++ b/module/todo/control.php @@ -181,8 +181,9 @@ class todo extends control } foreach($editedTodos as $todo) { - if($todo->type == 'task') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_TASK)->fetch('name'); - if($todo->type == 'bug') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_BUG)->fetch('title'); + if($todo->type == 'story') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_STORY)->fetch('title'); + if($todo->type == 'task') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_TASK)->fetch('name'); + if($todo->type == 'bug') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_BUG)->fetch('title'); $todo->begin = str_replace(':', '', $todo->begin); $todo->end = str_replace(':', '', $todo->end); } @@ -320,7 +321,7 @@ class todo extends control { $todo = $this->todo->getById($todoID); if($todo->status != 'done') $this->todo->finish($todoID); - if($todo->type == 'bug' or $todo->type == 'task') + if(in_array($todo->type, array('bug', 'task', 'story'))) { $confirmNote = 'confirm' . ucfirst($todo->type); $confirmURL = $this->createLink($todo->type, 'view', "id=$todo->idvalue"); diff --git a/module/todo/model.php b/module/todo/model.php index 1f1e85456d..94a56ec73d 100644 --- a/module/todo/model.php +++ b/module/todo/model.php @@ -87,8 +87,9 @@ class todoModel extends model $todo->status = "wait"; $todo->private = 0; $todo->idvalue = 0; - if($todo->type == 'bug') $todo->idvalue = isset($todos->bugs[$i + 1]) ? $todos->bugs[$i + 1] : 0; - if($todo->type == 'task') $todo->idvalue = isset($todos->tasks[$i + 1]) ? $todos->tasks[$i + 1] : 0; + if($todo->type == 'bug') $todo->idvalue = isset($todos->bugs[$i + 1]) ? $todos->bugs[$i + 1] : 0; + if($todo->type == 'task') $todo->idvalue = isset($todos->tasks[$i + 1]) ? $todos->tasks[$i + 1] : 0; + if($todo->type == 'story') $todo->idvalue = isset($todos->storys[$i + 1]) ? $todos->storys[$i + 1] : 0; $this->dao->insert(TABLE_TODO)->data($todo)->autoCheck()->exec(); if(dao::isError()) @@ -122,10 +123,10 @@ class todoModel extends model public function update($todoID) { $oldTodo = $this->dao->findById((int)$todoID)->from(TABLE_TODO)->fetch(); - if($oldTodo->type == 'bug' or $oldTodo->type == 'task') $oldTodo->name = ''; + if(in_array($oldTodo->type, array('bug', 'task', 'story'))) $oldTodo->name = ''; $todo = fixer::input('post') ->cleanInt('date, pri, begin, end, private') - ->setIF($this->post->type == 'bug' or $this->post->type == 'task', 'name', '') + ->setIF(in_array($oldTodo->type, array('bug', 'task', 'story')), 'name', '') ->setIF($this->post->date == false, 'date', '2030-01-01') ->setIF($this->post->begin == false, 'begin', '2400') ->setIF($this->post->end == false, 'end', '2400') @@ -133,6 +134,7 @@ class todoModel extends model ->stripTags($this->config->todo->editor->edit['id'], $this->config->allowedTags) ->remove('uid') ->get(); + $todo = $this->loadModel('file')->processImgURL($todo, $this->config->todo->editor->edit['id'], $this->post->uid); $this->dao->update(TABLE_TODO)->data($todo) ->autoCheck()