public static function dateSelector($prefix, $editable, $timestamp = null) { if ($editable) { $dateRanges = CentralNotice::getDateRanges(); // Normalize timestamp format. If no timestamp is passed, default to now. If -1 is // passed, set no defaults. if ($timestamp === -1) { $ts = '00000000'; } else { $ts = wfTimestamp(TS_MW, $timestamp); } $fields = array(array("month", "centralnotice-month", $dateRanges['months'], substr($ts, 4, 2)), array("day", "centralnotice-day", $dateRanges['days'], substr($ts, 6, 2)), array("year", "centralnotice-year", $dateRanges['years'], substr($ts, 0, 4))); return CentralNotice::createSelector($prefix, $fields); } else { global $wgLang; return $wgLang->date($timestamp); } }
private function dateSelector($prefix, $year = 0, $month = 0, $day = 0) { $dateRanges = CentralNotice::getDateRanges(); $fields = array(array($prefix . "_month", "centralnotice-month", $dateRanges['months'], $month), array($prefix . "_day", "centralnotice-day", $dateRanges['days'], $day), array($prefix . "_year", "centralnotice-year", $dateRanges['years'], $year)); $out = ''; foreach ($fields as $data) { list($field, $label, $set, $current) = $data; $out .= Xml::listDropDown($field, CentralNotice::dropDownList(wfMsg($label), $set), '', $current); } return $out; }