X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2FPeriod.class.php;h=0e901a8d6ebf5151e888f84cef3794b0605e926f;hb=ed41335d63e71a11d30e92f4367106e9398adf9d;hp=6c1eafe577476a54883b1ff0f25aa4bc2d1b7177;hpb=1c708528cc7c5202bb5f26d45c71e32d638863a7;p=timetracker.git diff --git a/WEB-INF/lib/Period.class.php b/WEB-INF/lib/Period.class.php index 6c1eafe5..0e901a8d 100644 --- a/WEB-INF/lib/Period.class.php +++ b/WEB-INF/lib/Period.class.php @@ -52,9 +52,14 @@ define('INTERVAL_PREVIOUS_DAY', 44); define('INTERVAL_SELECTED_DAY', 48); */ +// TODO: Refactoring is needed for this class. Probably by refactoring DateAndTime first, as Period is +// basically a collection of 2 DateAndTime instances. +// +// Second problem is that "today" is (most likely?) server today, so reports may give incorrect dates +// for browser users in different time zones. Verify and fix this. class Period { - var $startDate; - var $endDate; + var $startDate; // DateAndTime object. + var $endDate; // DateAndTime object. function __construct($period_type = 0, $date_point = null) { @@ -114,43 +119,13 @@ class Period { } } - /** - * Return all days by period - * - * @return array - */ - function getAllDays() { - $ret_array = array(); - if ($this->startDate->before($this->endDate)) { - $d = $this->getBegin(); - while ($d->before($this->getEnd())) { - array_push($ret_array, $d); - $d = $d->nextDate(); - } - array_push($ret_array, $d); - } else { - array_push($ret_array, $this->startDate); - } - return $ret_array; - } - function setPeriod($b_date, $e_date) { $this->startDate = $b_date; $this->endDate = $e_date; } - // return date object - function getBegin() { - return $this->startDate; - } - - // return date object - function getEnd() { - return $this->endDate; - } - // return date string - function getBeginDate($format="") { + function getStartDate($format="") { return $this->startDate->toString($format); } @@ -158,14 +133,4 @@ class Period { function getEndDate($format="") { return $this->endDate->toString($format); } - - function getArray($format="") { - $result = array(); - $d = $this->getBegin(); - while ($d->before($this->getEnd())) { - $result[] = $d->toString($format); - $d = $d->nextDate(); - } - return $result; - } }