public function Field($properties = array()) { if ($this->valueObj) { if ($this->valueObj->isToday()) { $val = Convert::raw2xml($this->valueObj->toString($this->getConfig('dateformat')) . ' (' . _t('DateField.TODAY', 'today') . ')'); } else { $df = new DBDate($this->name); $df->setValue($this->dataValue()); $val = Convert::raw2xml($this->valueObj->toString($this->getConfig('dateformat')) . ', ' . $df->Ago()); } } else { $val = '<i>(' . _t('DateField.NOTSET', 'not set') . ')</i>'; } return "<span class=\"readonly\" id=\"" . $this->ID() . "\">{$val}</span>"; }
/** * Return a string in the form "12 - 16 Sept" or "12 Aug - 16 Sept" * * @param DBDate $otherDateObj Another date object specifying the end of the range * @param bool $includeOrdinals Include ordinal suffix to day, e.g. "th" or "rd" * @return string */ public function RangeString($otherDateObj, $includeOrdinals = false) { $d1 = $this->DayOfMonth($includeOrdinals); $d2 = $otherDateObj->DayOfMonth($includeOrdinals); $m1 = $this->ShortMonth(); $m2 = $otherDateObj->ShortMonth(); $y1 = $this->Year(); $y2 = $otherDateObj->Year(); if ($y1 != $y2) { return "{$d1} {$m1} {$y1} - {$d2} {$m2} {$y2}"; } else { if ($m1 != $m2) { return "{$d1} {$m1} - {$d2} {$m2} {$y1}"; } else { return "{$d1} - {$d2} {$m1} {$y1}"; } } }