Hermes::getClientSelect PHP Method

getClientSelect() public static method

Return the HTML needed to build an enum or multienum for selecting clients.
public static getClientSelect ( string $id, boolean $multi = false, boolean $use_cotext = false ) : string
$id string The DOM id to identify the select list.
$multi boolean Allow multi select?
$use_cotext boolean Instead of 'Select A Client', use 'General Cost Objects' for the top choice.
return string The HTML to render the select element.
    public static function getClientSelect($id, $multi = false, $use_cotext = false)
    {
        $clients = self::listClients();
        $select = '<select name="' . ($multi ? 'client[]' : 'client') . '" id="' . $id . '" ' . ($multi ? 'multiple = "multiple"' : '') . '>';
        $select .= '<option value="">';
        if ($use_cotext) {
            $select .= _("--- General Cost Objects ---");
        } else {
            $select .= _("--- Select A Client ---");
        }
        $select .= '</option>';
        foreach ($clients as $cid => $client) {
            $select .= '<option value="' . $cid . '">' . htmlspecialchars($client) . '</option>';
        }
        return $select . '</select>';
    }