From 8dc6222d5e7e97e8145a85d600c214b2873f07a5 Mon Sep 17 00:00:00 2001 From: areyou123456 Date: Wed, 15 Aug 2012 05:45:51 +0000 Subject: [PATCH] * finish the task #876 --- module/todo/control.php | 3 ++- module/todo/model.php | 16 +++++++++++++--- module/todo/view/create.html.php | 3 ++- module/todo/view/edit.html.php | 3 ++- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/module/todo/control.php b/module/todo/control.php index 6059db2ef0..841cb6d3c3 100644 --- a/module/todo/control.php +++ b/module/todo/control.php @@ -112,7 +112,8 @@ class todo extends control /* Judge a private todo or not, If private, die. */ $todo = $this->todo->getById($todoID); if($todo->private and $this->app->user->account != $todo->account) die('private'); - + + $todo->date = strftime("%Y-%m-%d", strtotime($todo->date)); $header['title'] = $this->lang->my->common . $this->lang->colon . $this->lang->todo->edit; $position[] = $this->lang->todo->edit; diff --git a/module/todo/model.php b/module/todo/model.php index b1ab35d5d7..7775b2cf1c 100644 --- a/module/todo/model.php +++ b/module/todo/model.php @@ -33,11 +33,11 @@ class todoModel extends model ->setIF($this->post->type != 'custom', 'name', '') ->setIF($this->post->type == 'bug' and $this->post->bug, 'idvalue', $this->post->bug) ->setIF($this->post->type == 'task' and $this->post->task, 'idvalue', $this->post->task) + ->setIF($this->post->date == false, 'date', '2030-01-01') ->setIF($this->post->begin == false, 'begin', '2400') ->setIF($this->post->end == false, 'end', '2400') ->remove('bug, task') ->get(); - $this->dao->insert(TABLE_TODO)->data($todo) ->autoCheck() ->checkIF($todo->type == 'custom', $this->config->todo->create->requiredFields, 'notempty') @@ -56,13 +56,19 @@ class todoModel extends model public function batchCreate() { $todos = fixer::input('post')->cleanInt('date')->get(); - for($i = 0; $i < $this->config->todo->batchCreate; $i++) { if($todos->names[$i] != '' || isset($todos->bugs[$i + 1]) || isset($todos->tasks[$i + 1])) { $todo->account = $this->app->user->account; - $todo->date = $this->post->date; + if($this->post->date == false) + { + $todo->date = '2030-01-01'; + } + else + { + $todo->date = $this->post->date; + } $todo->type = $todos->types[$i]; $todo->pri = $todos->pris[$i]; $todo->name = isset($todos->names[$i]) ? $todos->names[$i] : ''; @@ -109,6 +115,7 @@ class todoModel extends model ->cleanInt('date, pri, begin, end, private') ->specialChars('type,name') ->setIF($this->post->type != 'custom', 'name', '') + ->setIF($this->post->date == false, 'date', '2030-01-01') ->setIF($this->post->begin == false, 'begin', '2400') ->setIF($this->post->end == false, 'end', '2400') ->setDefault('private', 0) @@ -511,3 +518,6 @@ class todoModel extends model return array('begin' => $begin, 'end' => $end); } } + + + diff --git a/module/todo/view/create.html.php b/module/todo/view/create.html.php index c6c8cd3e7a..1808227851 100644 --- a/module/todo/view/create.html.php +++ b/module/todo/view/create.html.php @@ -18,7 +18,8 @@ todo->create;?> todo->date;?> - + + todo->futureTodos;?> todo->type;?> diff --git a/module/todo/view/edit.html.php b/module/todo/view/edit.html.php index 28fc673785..ff49369ac5 100644 --- a/module/todo/view/edit.html.php +++ b/module/todo/view/edit.html.php @@ -18,7 +18,8 @@ todo->edit;?> todo->date;?> - date, "class='select-3 date'");?> + date, "class='select-3 date'");?> + todo->futureTodos;?> todo->type;?>