public static function fieldMonth($name, $value, $settings = array()) { if ($value instanceof DateTime) { $value = $value->format('m'); } self::fieldSelect($name, isset($settings['months']) ? $settings['months'] : SLN_Func::getMonths(), $value, $settings, true); }
private function bindDates($dates) { $this->years = array(); $this->months = array(); $this->days = array(); $checkDay = $this->suggestedDate->format('Y-m-'); $checkMonth = $this->suggestedDate->format('Y-'); foreach ($dates as $date) { list($year, $month, $day) = explode('-', $date); $this->years[$year] = true; if (strpos($date, $checkMonth) === 0) { $this->months[$month] = true; } if (strpos($date, $checkDay) === 0) { $this->days[$day] = true; } $this->dates[] = $date; } foreach ($this->years as $k => $v) { $this->years[$k] = $k; } $months = SLN_Func::getMonths(); foreach ($this->months as $k => $v) { $this->months[$k] = $months[intval($k)]; } foreach ($this->days as $k => $v) { $this->days[$k] = $k; //. date_i18n(' l',strtotime($checkDay.$k)); } ksort($this->years); ksort($this->months); ksort($this->days); }
public static function evalPickedDate($date) { $date = explode(' ', $date); foreach (SLN_Func::getMonths() as $k => $v) { if (strcasecmp($date[1], $v) == 0) { $ret = $date[2] . '-' . ($k < 10 ? '0' . $k : $k) . '-' . $date[0]; return $ret; } } throw new Exception('wrong date'); }