Kronolith::buildStatusWidget PHP Méthode

buildStatusWidget() public static méthode

Builds the HTML for an event status widget.
public static buildStatusWidget ( string $name, string $current = self::STATUS_CONFIRMED, string $any = false ) : string
$name string The name of the widget.
$current string The selected status value.
$any string Whether an 'any' item should be added
Résultat string The HTML
    public static function buildStatusWidget($name, $current = self::STATUS_CONFIRMED, $any = false)
    {
        $html = "<select id=\"{$name}\" name=\"{$name}\">";
        $statii = array(self::STATUS_FREE, self::STATUS_TENTATIVE, self::STATUS_CONFIRMED, self::STATUS_CANCELLED);
        if (!isset($current)) {
            $current = self::STATUS_NONE;
        }
        if ($any) {
            $html .= "<option value=\"" . self::STATUS_NONE . "\"";
            $html .= $current == self::STATUS_NONE ? ' selected="selected">' : '>';
            $html .= _("Any") . "</option>";
        }
        foreach ($statii as $status) {
            $html .= "<option value=\"{$status}\"";
            $html .= $status == $current ? ' selected="selected">' : '>';
            $html .= self::statusToString($status) . "</option>";
        }
        $html .= '</select>';
        return $html;
    }