Dropdown::showItemTypeMenu PHP Метод

showItemTypeMenu() статический публичный Метод

Display a menu to select a itemtype which open the search form
static public showItemTypeMenu ( $title, $optgroup, $value = '' )
$title string title to display
$optgroup array (group of dropdown) of array (itemtype => localized name)
$value string URL of selected current value (default '')
    static function showItemTypeMenu($title, $optgroup, $value = '')
    {
        echo "<table class='tab_cadre' width='50%'>";
        echo "<tr class='tab_bg_1'><td class='b'>&nbsp;" . $title . "&nbsp; ";
        $selected = '';
        foreach ($optgroup as $label => $dp) {
            foreach ($dp as $key => $val) {
                $search = $key::getSearchURL();
                if (basename($search) == basename($value)) {
                    $selected = $search;
                }
                $values[$label][$search] = $val;
            }
        }
        Dropdown::showFromArray('dpmenu', $values, array('on_change' => "window.location.href=this.options[this.selectedIndex].value", 'value' => $selected, 'display_emptychoice' => true));
        echo "</td></tr>";
        echo "</table><br>";
    }

Usage Example

 function title()
 {
     Dropdown::showItemTypeMenu(_n('Component', 'Components', Session::getPluralNumber()), Dropdown::getDeviceItemTypes(), $this->getSearchURL());
 }
All Usage Examples Of Dropdown::showItemTypeMenu