Exemplo n.º 1
0
    /**
     * Get a month select box
     *
     * @param string $name the name and id of the html select element
     * @param int $selected the currently selected month
     * @return string html select element populated with a list of months
     */
    public static function getMonthText($name, $selected = null)
    {
        if (empty($selected)) {
            $selected = date('n');
        }
        $html = <<<HTML
\t\t\t<select name="{$name}" id="{$name}">

HTML;
        foreach (phpgwapi_datetime::get_month_fullnames() as $id => $month) {
            $slctd = $id == $selected ? ' selected="selected"' : '';
            $html .= <<<HTML
\t\t\t\t<option value="{$id}"{$slctd}>{$month}</option>

HTML;
        }
        $html .= <<<HTML
\t\t\t</select>

HTML;
        return $html;
    }