/** * Constructs the Calendar * * @param int $y year * @param int $m month * @param int $d day * @param int $h hour * @param int $i minute * @param int $s second * * @access protected */ function Calendar($y = 2000, $m = 1, $d = 1, $h = 0, $i = 0, $s = 0) { static $cE = null; if (!isset($cE)) { $cE =& Calendar_Engine_Factory::getEngine(); } $this->cE =& $cE; $this->year = (int) $y; $this->month = (int) $m; $this->day = (int) $d; $this->hour = (int) $h; $this->minute = (int) $i; $this->second = (int) $s; }
/** * Creates an instance of a calendar object, given a type and timestamp * @param string type of object to create * @param mixed timestamp (depending on Calendar engine being used) * @return object subclass of Calendar * @access public * @static */ function &createByTimestamp($type, $stamp) { $cE =& Calendar_Engine_Factory::getEngine(); $y = $cE->stampToYear($stamp); $m = $cE->stampToMonth($stamp); $d = $cE->stampToDay($stamp); $h = $cE->stampToHour($stamp); $i = $cE->stampToMinute($stamp); $s = $cE->stampToSecond($stamp); $cal = Calendar_Factory::create($type, $y, $m, $d, $h, $i, $s); return $cal; }