diff --git a/module/action/model.php b/module/action/model.php index 3e36a848df..babe6aa6e8 100644 --- a/module/action/model.php +++ b/module/action/model.php @@ -545,12 +545,12 @@ class actionModel extends model */ public function computeBeginAndEnd($period) { - $this->loadModel('todo'); + $this->loadModel('date'); - $today = $this->todo->today(); - $tomorrow = $this->todo->tomorrow(); - $yesterday = $this->todo->yesterday(); - $twoDaysAgo = $this->todo->twoDaysAgo(); + $today = $this->date->today(); + $tomorrow = $this->date->tomorrow(); + $yesterday = $this->date->yesterday(); + $twoDaysAgo = $this->date->twoDaysAgo(); $period = strtolower($period); @@ -564,12 +564,12 @@ class actionModel extends model if($period == 'thisweek' or $period == 'lastweek') { $func = "get$period"; - extract($this->todo->$func()); + extract($this->date->$func()); return array('begin' => $begin, 'end' => $end . ' 23:59:59'); } - if($period == 'thismonth') return $this->todo->getThisMonth(); - if($period == 'lastmonth') return $this->todo->getLastMonth(); + if($period == 'thismonth') return $this->date->getThisMonth(); + if($period == 'lastmonth') return $this->date->getLastMonth(); } /** diff --git a/module/date/control.php b/module/date/control.php new file mode 100644 index 0000000000..e997b07f1a --- /dev/null +++ b/module/date/control.php @@ -0,0 +1,14 @@ + + * @package date + * @version $Id: control.php 3793 2012-12-13 06:34:30Z wyd621@gmail.com $ + * @link http://www.zentao.net + */ +class date extends control +{ +} diff --git a/module/date/lang/en.php b/module/date/lang/en.php new file mode 100644 index 0000000000..fe8fe2cb48 --- /dev/null +++ b/module/date/lang/en.php @@ -0,0 +1,15 @@ + + * @package date + * @version $Id: en.php 3753 2012-12-11 05:51:16Z wwccss $ + * @link http://www.zentao.net + */ +$lang->date->week = '(l)'; // date function's param. +$lang->date->today = 'Today'; +$lang->date->weekDateList = ''; +$lang->date->dayInFuture = 'Future'; diff --git a/module/date/lang/zh-cn.php b/module/date/lang/zh-cn.php new file mode 100644 index 0000000000..4fb2efa645 --- /dev/null +++ b/module/date/lang/zh-cn.php @@ -0,0 +1,15 @@ + + * @package date + * @version $Id: en.php 3753 2012-12-11 05:51:16Z wwccss $ + * @link http://www.zentao.net + */ +$lang->date->week = '星期'; +$lang->date->today = '今天'; +$lang->date->weekDateList = '一,二,三,四,五,六,天'; +$lang->date->dayInFuture = '暂不指定'; diff --git a/module/date/lang/zh-tw.php b/module/date/lang/zh-tw.php new file mode 100644 index 0000000000..e69de29bb2 diff --git a/module/date/model.php b/module/date/model.php new file mode 100644 index 0000000000..37042d4876 --- /dev/null +++ b/module/date/model.php @@ -0,0 +1,289 @@ + + * @package date + * @version $Id: model.php 3938 2013-01-06 01:57:35Z zhujinyonging@gmail.com $ + * @link http://www.zentao.net + */ +?> +today()); + $delta = 60 * 60 * 24; + $dates = array(); + $weekList = range(1, 7); + $weekDateList = explode(',', $this->lang->date->weekDateList); + for($i = -1 * $before; $i <= $after; $i ++) + { + $time = $today + $i * $delta; + $label = date(DT_DATE1, $time); + if($i == 0) + { + $label .= " ({$this->lang->date->today})"; + } + else + { + if($this->cookie->lang == 'zh-cn' or $this->cookie->lang == 'zh-tw') + { + $label .= str_replace($weekList, $weekDateList, date(" ({$this->lang->date->week}N)", $time)); + } + else + { + $label .= date($this->lang->date->week, $time); + } + } + $date = date(DT_DATE2, $time); + $dates[$date] = $label; + } + $dates[self::DAY_IN_FUTURE] = $this->lang->date->dayInFuture; + return $dates; + } + + /** + * Build hour time list. + * + * @param int $begin + * @param int $end + * @param int $delta + * @access public + * @return array + */ + public function buildTimeList($begin, $end, $delta) + { + $times = array(); + for($hour = $begin; $hour <= $end; $hour ++) + { + for($minutes = 0; $minutes < 60; $minutes += $delta) + { + $time = sprintf('%02d%02d', $hour, $minutes); + $label = sprintf('%02d:%02d', $hour, $minutes); + $times[$time] = $label; + } + } + return $times; + } + + /** + * Get today. + * + * @access public + * @return date + */ + public function today() + { + return date(DT_DATE2, time()); + } + + /** + * Get yesterday + * + * @access public + * @return date + */ + public function yesterday() + { + return date(DT_DATE1, strtotime('yesterday')); + } + + /** + * Get tomorrow. + * + * @access public + * @return date + */ + public function tomorrow() + { + return date(DT_DATE1, strtotime('tomorrow')); + } + + /** + * Get the day before yesterday. + * + * @access public + * @return date + */ + public function twoDaysAgo() + { + return date(DT_DATE1, strtotime('-2 days')); + } + + /** + * Get now time period. + * + * @param int $delta + * @access public + * @return string the current time period, like 0915 + */ + public function now($delta = 10) + { + $range = range($delta, 60 - $delta, $delta); + $hour = date('H', time()); + $minute = date('i', time()); + + if($minute > 60 - $delta) + { + $hour += 1; + $minute = 00; + } + else + { + for($i = 0; $i < $delta; $i ++) + { + if(in_array($minute + $i, $range)) + { + $minute = $minute + $i; + break; + } + } + } + + return sprintf('%02d%02d', $hour, $minute); + } + + /** + * Format time 0915 to 09:15 + * + * @param string $time + * @access public + * @return string + */ + public function formatTime($time) + { + if(strlen($time) != 4 or $time == '2400') return ''; + return substr($time, 0, 2) . ':' . substr($time, 2, 2); + } + + /** + * Get the begin and end date of this week. + * + * @access public + * @return array + */ + public function getThisWeek() + { + $baseTime = $this->getMiddleOfThisWeek(); + $begin = date(DT_DATE1, strtotime('last monday', $baseTime)) . ' 00:00:00'; + $end = date(DT_DATE1, strtotime('next sunday', $baseTime)) . ' 23:59:59'; + return array('begin' => $begin, 'end' => $end); + } + + /** + * Get the begin and end date of last week. + * + * @access public + * @return array + */ + public function getLastWeek() + { + $baseTime = $this->getMiddleOfLastWeek(); + $begin = date(DT_DATE1, strtotime('last monday', $baseTime)) . ' 00:00:00'; + $end = date(DT_DATE1, strtotime('next sunday', $baseTime)) . ' 23:59:59'; + return array('begin' => $begin, 'end' => $end); + } + + /** + * Get the time at the middle of this week. + * + * If today in week is 1, move it one day in future. Else is 7, move it back one day. To keep the time geted in this week. + * + * @access public + * @return time + */ + public function getMiddleOfThisWeek() + { + $baseTime = time(); + $weekDay = date('N'); + if($weekDay == 1) $baseTime = time() + 86400; + if($weekDay == 7) $baseTime = time() - 86400; + return $baseTime; + } + + /** + * Get middle of last week + * + * @access public + * @return time + */ + public function getMiddleOfLastWeek() + { + $baseTime = time(); + $weekDay = date('N'); + $baseTime = time() - 86400 * 7; + if($weekDay == 1) $baseTime = time() - 86400 * 4; // Make sure is last thursday. + if($weekDay == 7) $baseTime = time() - 86400 * 10; // Make sure is last thursday. + return $baseTime; + } + + /** + * Get this month begin and end time + * + * @access public + * @return array + */ + public function getThisMonth() + { + $begin = date('Y-m') . '-01 00:00:00'; + $end = date('Y-m', strtotime('next month')) . '-00 23:59:59'; + return array('begin' => $begin, 'end' => $end); + } + + /** + * Get last month begin and end time + * + * @access public + * @return array + */ + public function getLastMonth() + { + $begin = date('Y-m', strtotime('last month')) . '-01 00:00:00'; + $end = date('Y-m', strtotime('this month')) . '-00 23:59:59'; + return array('begin' => $begin, 'end' => $end); + } + + public function getThisSeason() + { + $year = date("Y-"); + $month = date("n"); + if($month % 3) + { + $seasonBegin = $month - ($month % 3) + 1; + $seasonEnd = $seasonBegin + 3; + } + else + { + $seasonEnd = $month + 1; + $seasonBegin = $seasonEnd - 3; + } + + if(strlen($seasonBegin) == 1) $seasonBegin = "0$seasonBegin"; + if(strlen($seasonEnd) == 1) $seasonEnd = "0$seasonEnd"; + $begin = $year . $seasonBegin; + $end = $year . $seasonEnd; + + return array('begin' => $begin, 'end' => $end); + } + + public function getThisYear() + { + $begin = date(DT_DATE1, strtotime('1/1 this year')); + $end = date(DT_DATE1, strtotime('1/1 next year -1 day')); + return array('begin' => $begin, 'end' => $end); + } +} diff --git a/module/my/control.php b/module/my/control.php index 0be22e205e..26821731ad 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -85,8 +85,8 @@ class my extends control $this->view->position[] = $this->lang->my->todo; /* Assign. */ - $this->view->dates = $this->loadModel('todo')->buildDateList(); - $this->view->todos = $this->todo->getList($type, $account, $status, 0, $pager, $orderBy); + $this->view->dates = $this->loadModel('date')->buildDateList(); + $this->view->todos = $this->loadModel('todo')->getList($type, $account, $status, 0, $pager, $orderBy); $this->view->date = (int)$type == 0 ? date(DT_DATE1) : date(DT_DATE1, strtotime($type)); $this->view->type = is_numeric($type) ? 'bydate' : $type; $this->view->recTotal = $recTotal; diff --git a/module/search/model.php b/module/search/model.php index 3b1f1ff7d0..5f41582265 100644 --- a/module/search/model.php +++ b/module/search/model.php @@ -329,13 +329,13 @@ class searchModel extends model */ public function replaceDynamic($query) { - $this->loadModel('todo'); - $lastWeek = $this->todo->getLastWeek(); - $thisWeek = $this->todo->getThisWeek(); - $lastMonth = $this->todo->getLastMonth(); - $thisMonth = $this->todo->getThisMonth(); - $yesterday = $this->todo->yesterday(); - $today = $this->todo->today(); + $this->loadModel('date'); + $lastWeek = $this->date->getLastWeek(); + $thisWeek = $this->date->getThisWeek(); + $lastMonth = $this->date->getLastMonth(); + $thisMonth = $this->date->getThisMonth(); + $yesterday = $this->date->yesterday(); + $today = $this->date->today(); if(strpos($query, '$') !== false) { $query = str_replace('$@me', $this->app->user->account, $query); diff --git a/module/todo/control.php b/module/todo/control.php index 73f2e58d28..c7827ccb83 100644 --- a/module/todo/control.php +++ b/module/todo/control.php @@ -20,6 +20,7 @@ class todo extends control public function __construct() { parent::__construct(); + $this->loadModel('date'); $this->loadModel('task'); $this->loadModel('bug'); $this->loadModel('my')->setMenu(); @@ -35,7 +36,7 @@ class todo extends control */ public function create($date = 'today', $account = '') { - if($date == 'today') $date = $this->todo->today(); + if($date == 'today') $date = $this->date->today(); if($account == '') $account = $this->app->user->account; if(!empty($_POST)) { @@ -51,8 +52,8 @@ class todo extends control $this->view->header = $header; $this->view->position = $position; $this->view->date = strftime("%Y-%m-%d", strtotime($date)); - $this->view->times = $this->todo->buildTimeList($this->config->todo->times->begin, $this->config->todo->times->end, $this->config->todo->times->delta); - $this->view->time = $this->todo->now(); + $this->view->times = $this->date->buildTimeList($this->config->todo->times->begin, $this->config->todo->times->end, $this->config->todo->times->delta); + $this->view->time = $this->date->now(); $this->display(); } @@ -83,8 +84,8 @@ class todo extends control $this->view->header = $header; $this->view->position = $position; $this->view->date = (int)$date == 0 ? $date : date('Y-m-d', strtotime($date)); - $this->view->times = $this->todo->buildTimeList($this->config->todo->times->begin, $this->config->todo->times->end, $this->config->todo->times->delta); - $this->view->time = $this->todo->now(); + $this->view->times = $this->date->buildTimeList($this->config->todo->times->begin, $this->config->todo->times->end, $this->config->todo->times->delta); + $this->view->time = $this->date->now(); $this->display(); } @@ -120,7 +121,7 @@ class todo extends control $this->view->header = $header; $this->view->position = $position; - $this->view->times = $this->todo->buildTimeList($this->config->todo->times->begin, $this->config->todo->times->end, $this->config->todo->times->delta); + $this->view->times = $this->date->buildTimeList($this->config->todo->times->begin, $this->config->todo->times->end, $this->config->todo->times->delta); $this->view->todo = $todo; $this->display(); } @@ -184,8 +185,8 @@ class todo extends control $this->view->bugs = $bugs; $this->view->tasks = $tasks; $this->view->editedTodos = $editedTodos; - $this->view->times = $this->todo->buildTimeList($this->config->todo->times->begin, $this->config->todo->times->end, $this->config->todo->times->delta); - $this->view->time = $this->todo->now(); + $this->view->times = $this->date->buildTimeList($this->config->todo->times->begin, $this->config->todo->times->end, $this->config->todo->times->delta); + $this->view->time = $this->date->now(); $this->view->header = $header; $this->view->position = $position; @@ -234,7 +235,7 @@ class todo extends control $this->view->header->title = "TODO #$todo->id $todo->name"; $this->view->position[] = $this->lang->todo->view; $this->view->todo = $todo; - $this->view->times = $this->todo->buildTimeList($this->config->todo->times->begin, $this->config->todo->times->end, $this->config->todo->times->delta); + $this->view->times = $this->date->buildTimeList($this->config->todo->times->begin, $this->config->todo->times->end, $this->config->todo->times->delta); $this->view->users = $this->user->getPairs('noletter'); $this->view->actions = $this->loadModel('action')->getList('todo', $todoID); $this->view->from = $from; @@ -299,7 +300,7 @@ class todo extends control public function import2Today() { $todoIDList = $this->post->todoIDList; - $today = $this->todo->today(); + $today = $this->date->today(); $this->dao->update(TABLE_TODO)->set('date')->eq($today)->where('id')->in($todoIDList)->exec(); die(js::locate($this->session->todoList)); } @@ -339,7 +340,7 @@ class todo extends control $users = $this->loadModel('user')->getPairs('noletter'); $bugs = $this->loadModel('bug')->getUserBugPairs($account); $tasks = $this->loadModel('task')->getUserTaskPairs($account); - $times = $this->todo->buildTimeList($this->config->todo->times->begin, $this->config->todo->times->end, $this->config->todo->times->delta); + $times = $this->date->buildTimeList($this->config->todo->times->begin, $this->config->todo->times->end, $this->config->todo->times->delta); foreach($todos as $todo) { diff --git a/module/todo/lang/en.php b/module/todo/lang/en.php index 3ad4aced69..63b191df9c 100644 --- a/module/todo/lang/en.php +++ b/module/todo/lang/en.php @@ -43,10 +43,6 @@ $lang->todo->desc = 'Desc'; $lang->todo->private = 'Private'; $lang->todo->idvalue = 'Task or bug'; -$lang->todo->week = '(l)'; // date function's param. -$lang->todo->today = 'Today'; -$lang->todo->weekDateList = ''; -$lang->todo->dayInFuture = 'Future'; $lang->todo->confirmBug = 'This todo linked to bug #%s,chang it also?'; $lang->todo->confirmTask = 'This todo linked to task #%s,chang it also?'; diff --git a/module/todo/lang/zh-cn.php b/module/todo/lang/zh-cn.php index 3c062b6636..5217fd5db3 100644 --- a/module/todo/lang/zh-cn.php +++ b/module/todo/lang/zh-cn.php @@ -43,10 +43,6 @@ $lang->todo->desc = '描述'; $lang->todo->private = '私人事务'; $lang->todo->idvalue = '任务或Bug'; -$lang->todo->week = '星期'; -$lang->todo->today = '今天'; -$lang->todo->weekDateList = '一,二,三,四,五,六,天'; -$lang->todo->dayInFuture = '暂不指定'; $lang->todo->confirmBug = '该Todo关联的是Bug #%s,需要修改它吗?'; $lang->todo->confirmTask = '该Todo关联的是Task #%s,需要修改它吗?'; diff --git a/module/todo/model.php b/module/todo/model.php index e61c1d55e5..37c79cb925 100644 --- a/module/todo/model.php +++ b/module/todo/model.php @@ -13,8 +13,6 @@ loadModel('date'); $todos = array(); if($date == 'today') { - $begin = $this->today(); + $begin = $this->date->today(); $end = $begin; } elseif($date == 'yesterday') { - $begin = $this->yesterday(); + $begin = $this->date->yesterday(); $end = $begin; } elseif($date == 'thisweek') { - extract($this->getThisWeek()); + extract($this->date->getThisWeek()); } elseif($date == 'lastweek') { - extract($this->getLastWeek()); + extract($this->date->getLastWeek()); } elseif($date == 'thismonth') { - extract($this->getThisMonth()); + extract($this->date->getThisMonth()); } elseif($date == 'lastmonth') { - extract($this->getLastMonth()); + extract($this->date->getLastMonth()); } elseif($date == 'thisseason') { - extract($this->getThisSeason()); + extract($this->date->getThisSeason()); } elseif($date == 'thisyear') { - extract($this->getThisYear()); + extract($this->date->getThisYear()); } elseif($date == 'future') { @@ -281,7 +280,7 @@ class todoModel extends model elseif($date == 'before') { $begin = '1970-01-01'; - $end = $this->yesterday(); + $end = $this->date->yesterday(); } else { @@ -310,8 +309,8 @@ class todoModel extends model { 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 = $this->formatTime($todo->begin); - $todo->end = $this->formatTime($todo->end); + $todo->begin = $this->date->formatTime($todo->begin); + $todo->end = $this->date->formatTime($todo->end); /* If is private, change the title to private. */ if($todo->private and $this->app->user->account != $todo->account) $todo->name = $this->lang->todo->thisIsPrivate; @@ -319,278 +318,6 @@ class todoModel extends model } return $todos; } - - /** - * Build date list, for selection use. - * - * @param int $before - * @param int $after - * @access public - * @return void - */ - public function buildDateList($before = 7, $after = 7) - { - $today = strtotime($this->today()); - $delta = 60 * 60 * 24; - $dates = array(); - $weekList = range(1, 7); - $weekDateList = explode(',', $this->lang->todo->weekDateList); - for($i = -1 * $before; $i <= $after; $i ++) - { - $time = $today + $i * $delta; - $label = date(DT_DATE1, $time); - if($i == 0) - { - $label .= " ({$this->lang->todo->today})"; - } - else - { - if($this->cookie->lang == 'zh-cn' or $this->cookie->lang == 'zh-tw') - { - $label .= str_replace($weekList, $weekDateList, date(" ({$this->lang->todo->week}N)", $time)); - } - else - { - $label .= date($this->lang->todo->week, $time); - } - } - $date = date(DT_DATE2, $time); - $dates[$date] = $label; - } - $dates[self::DAY_IN_FUTURE] = $this->lang->todo->dayInFuture; - return $dates; - } - - /** - * Build hour time list. - * - * @param int $begin - * @param int $end - * @param int $delta - * @access public - * @return array - */ - public function buildTimeList($begin, $end, $delta) - { - $times = array(); - for($hour = $begin; $hour <= $end; $hour ++) - { - for($minutes = 0; $minutes < 60; $minutes += $delta) - { - $time = sprintf('%02d%02d', $hour, $minutes); - $label = sprintf('%02d:%02d', $hour, $minutes); - $times[$time] = $label; - } - } - return $times; - } - - /** - * Get today. - * - * @access public - * @return date - */ - public function today() - { - return date(DT_DATE2, time()); - } - - /** - * Get yesterday - * - * @access public - * @return date - */ - public function yesterday() - { - return date(DT_DATE1, strtotime('yesterday')); - } - - /** - * Get tomorrow. - * - * @access public - * @return date - */ - public function tomorrow() - { - return date(DT_DATE1, strtotime('tomorrow')); - } - - /** - * Get the day before yesterday. - * - * @access public - * @return date - */ - public function twoDaysAgo() - { - return date(DT_DATE1, strtotime('-2 days')); - } - - /** - * Get now time period. - * - * @param int $delta - * @access public - * @return string the current time period, like 0915 - */ - public function now($delta = 10) - { - $range = range($delta, 60 - $delta, $delta); - $hour = date('H', time()); - $minute = date('i', time()); - - if($minute > 60 - $delta) - { - $hour += 1; - $minute = 00; - } - else - { - for($i = 0; $i < $delta; $i ++) - { - if(in_array($minute + $i, $range)) - { - $minute = $minute + $i; - break; - } - } - } - - return sprintf('%02d%02d', $hour, $minute); - } - - /** - * Format time 0915 to 09:15 - * - * @param string $time - * @access public - * @return string - */ - public function formatTime($time) - { - if(strlen($time) != 4 or $time == '2400') return ''; - return substr($time, 0, 2) . ':' . substr($time, 2, 2); - } - - /** - * Get the begin and end date of this week. - * - * @access public - * @return array - */ - public function getThisWeek() - { - $baseTime = $this->getMiddleOfThisWeek(); - $begin = date(DT_DATE1, strtotime('last monday', $baseTime)) . ' 00:00:00'; - $end = date(DT_DATE1, strtotime('next sunday', $baseTime)) . ' 23:59:59'; - return array('begin' => $begin, 'end' => $end); - } - - /** - * Get the begin and end date of last week. - * - * @access public - * @return array - */ - public function getLastWeek() - { - $baseTime = $this->getMiddleOfLastWeek(); - $begin = date(DT_DATE1, strtotime('last monday', $baseTime)) . ' 00:00:00'; - $end = date(DT_DATE1, strtotime('next sunday', $baseTime)) . ' 23:59:59'; - return array('begin' => $begin, 'end' => $end); - } - - /** - * Get the time at the middle of this week. - * - * If today in week is 1, move it one day in future. Else is 7, move it back one day. To keep the time geted in this week. - * - * @access public - * @return time - */ - public function getMiddleOfThisWeek() - { - $baseTime = time(); - $weekDay = date('N'); - if($weekDay == 1) $baseTime = time() + 86400; - if($weekDay == 7) $baseTime = time() - 86400; - return $baseTime; - } - - /** - * Get middle of last week - * - * @access public - * @return time - */ - public function getMiddleOfLastWeek() - { - $baseTime = time(); - $weekDay = date('N'); - $baseTime = time() - 86400 * 7; - if($weekDay == 1) $baseTime = time() - 86400 * 4; // Make sure is last thursday. - if($weekDay == 7) $baseTime = time() - 86400 * 10; // Make sure is last thursday. - return $baseTime; - } - - /** - * Get this month begin and end time - * - * @access public - * @return array - */ - public function getThisMonth() - { - $begin = date('Y-m') . '-01 00:00:00'; - $end = date('Y-m', strtotime('next month')) . '-00 23:59:59'; - return array('begin' => $begin, 'end' => $end); - } - - /** - * Get last month begin and end time - * - * @access public - * @return array - */ - public function getLastMonth() - { - $begin = date('Y-m', strtotime('last month')) . '-01 00:00:00'; - $end = date('Y-m', strtotime('this month')) . '-00 23:59:59'; - return array('begin' => $begin, 'end' => $end); - } - - public function getThisSeason() - { - $year = date("Y-"); - $month = date("n"); - if($month % 3) - { - $seasonBegin = $month - ($month % 3) + 1; - $seasonEnd = $seasonBegin + 3; - } - else - { - $seasonEnd = $month + 1; - $seasonBegin = $seasonEnd - 3; - } - - if(strlen($seasonBegin) == 1) $seasonBegin = "0$seasonBegin"; - if(strlen($seasonEnd) == 1) $seasonEnd = "0$seasonEnd"; - $begin = $year . $seasonBegin; - $end = $year . $seasonEnd; - - return array('begin' => $begin, 'end' => $end); - } - - public function getThisYear() - { - $begin = date(DT_DATE1, strtotime('1/1 this year')); - $end = date(DT_DATE1, strtotime('1/1 next year -1 day')); - return array('begin' => $begin, 'end' => $end); - } } diff --git a/module/user/control.php b/module/user/control.php index 2cacf1f114..45bf9c406d 100644 --- a/module/user/control.php +++ b/module/user/control.php @@ -25,6 +25,7 @@ class user extends control $this->loadModel('company')->setMenu(); $this->loadModel('dept'); $this->loadModel('todo'); + $this->loadModel('date'); } /** @@ -71,7 +72,7 @@ class user extends control /* Get user, totos. */ $user = $this->dao->findByAccount($account)->from(TABLE_USER)->fetch(); $todos = $this->todo->getList($type, $account, $status, 0, $pager); - $date = (int)$type == 0 ? $this->todo->today() : $type; + $date = (int)$type == 0 ? $this->date->today() : $type; $header['title'] = $this->lang->company->orgView . $this->lang->colon . $this->lang->user->todo; $position[] = $this->lang->user->todo;