_name = _("Moon Phases"); } /** */ protected function _params() { return array( 'phase' => array( 'name' => _("Which phases"), 'type' => 'enum', 'default' => 'current', 'values' => array('current' => _("Current 4 Phases"), 'next' => _("Next 4 Phases"))), 'hemisphere' => array( 'name' => _("Hemisphere"), 'type' => 'enum', 'default' => 'northern', 'values' => array('northern' => _("Northern Hemisphere"), 'southern' => _("Southern Hemisphere"))), ); } /** */ protected function _content() { $phases = $this->_calculateMoonPhases(date('Y')); $now = time(); $lastNew = 0; $lastNewStamp = 0; $offset = 0; foreach ($phases as $key => $val) { if ($key < $now && $key > $lastNewStamp && $val == _("New Moon")) { $lastNew = $offset; $lastNewStamp = $key; } $offset++; } $dates = (isset($this->_params['phase']) && ($this->_params['phase'] == 'next')) ? array_slice(array_keys($phases), $lastNew + 4, 4) : array_slice(array_keys($phases), $lastNew, 4); $location = (isset($this->_params['hemisphere']) && ($this->_params['hemisphere'] == 'northern')) ? _("Northern Hemisphere") : _("Southern Hemisphere"); $html = '
| ' . $location . ' | |||
| ' .
Horde_Themes_Image::tag('block/moon/newmoon.png', array('alt' => _("New Moon"))) .
' ' . strftime($GLOBALS['prefs']->getValue('date_format_mini'), $dates[0]) . ' | ';
$html .= '';
if (isset($this->_params['hemisphere']) &&
($this->_params['hemisphere'] == 'northern')) {
$html .= Horde_Themes_Image::tag('block/moon/lastquarter.png', array('alt' => _("First Quarter")));
} else {
$html .= Horde_Themes_Image::tag('block/moon/firstquarter.png', array('alt' => _("First Quarter")));
}
$html .= ' ' . strftime($GLOBALS['prefs']->getValue('date_format_mini'), $dates[1]) . ' | ';
$html .= '' .
Horde_Themes_Image::tag('block/moon/fullmoon.png', array('alt' => _("Full Moon"))) .
' ' . strftime($GLOBALS['prefs']->getValue('date_format_mini'), $dates[2]) . ' | ';
$html .= '';
if (isset($this->_params['hemisphere']) &&
($this->_params['hemisphere'] == 'northern')) {
$html .= Horde_Themes_Image::tag('block/moon/firstquarter.png', array('alt' => _("Last Quarter")));
} else {
$html .= Horde_Themes_Image::tag('block/moon/lastquarter.png', array('alt' => _("Last Quarter")));
}
$html .= ' ' . strftime($GLOBALS['prefs']->getValue('date_format_mini'), $dates[3]) . ' |