Esempio n. 1
0
function get_icon($name, $params = array())
{
    switch ($name) {
        case 'favourite':
            if (CFavorite::exists($params['fav'], $params['elid'], $params['elname'])) {
                $icon = new CIcon(_('Remove from favourites'), 'iconminus', 'rm4favorites("' . $params['elname'] . '", "' . $params['elid'] . '", 0);');
            } else {
                $icon = new CIcon(_('Add to favourites'), 'iconplus', 'add2favorites("' . $params['elname'] . '", "' . $params['elid'] . '");');
            }
            $icon->setAttribute('id', 'addrm_fav');
            break;
        case 'fullscreen':
            $url = new Curl();
            $url->setArgument('fullscreen', $params['fullscreen'] ? '0' : '1');
            $icon = new CIcon($_REQUEST['fullscreen'] ? _('Normal view') : _('Fullscreen'), 'fullscreen', "document.location = '" . $url->getUrl() . "';");
            break;
        case 'menu':
            $icon = new CIcon(_('Menu'), 'iconmenu', 'create_page_menu(event, "' . $params['menu'] . '");');
            break;
        case 'reset':
            $icon = new CIcon(_('Reset'), 'iconreset', 'timeControl.objectReset();');
            break;
    }
    return $icon;
}
Esempio n. 2
0
function get_icon($type, $params = [])
{
    switch ($type) {
        case 'favourite':
            if (CFavorite::exists($params['fav'], $params['elid'], $params['elname'])) {
                $icon = (new CRedirectButton(SPACE, null))->addClass(ZBX_STYLE_BTN_REMOVE_FAV)->setTitle(_('Remove from favourites'))->onClick('rm4favorites("' . $params['elname'] . '", "' . $params['elid'] . '");');
            } else {
                $icon = (new CRedirectButton(SPACE, null))->addClass(ZBX_STYLE_BTN_ADD_FAV)->setTitle(_('Add to favourites'))->onClick('add2favorites("' . $params['elname'] . '", "' . $params['elid'] . '");');
            }
            $icon->setId('addrm_fav');
            return $icon;
        case 'fullscreen':
            $url = new CUrl();
            if ($params['fullscreen'] == 0) {
                $url->setArgument('fullscreen', '1');
                $icon = (new CRedirectButton(SPACE, $url->getUrl()))->setTitle(_('Fullscreen'))->addClass(ZBX_STYLE_BTN_MAX);
            } else {
                $url->setArgument('fullscreen', '0');
                $icon = (new CRedirectButton(SPACE, $url->getUrl()))->setTitle(_('Normal view'))->addClass(ZBX_STYLE_BTN_MIN);
            }
            return $icon;
        case 'dashconf':
            $icon = (new CRedirectButton(SPACE, 'dashconf.php'))->addClass(ZBX_STYLE_BTN_CONF)->setTitle(_('Configure'));
            if ($params['enabled']) {
                $icon = [$icon, (new CDiv())->addClass(ZBX_STYLE_ACTIVE_INDIC)];
            }
            return $icon;
        case 'screenconf':
            return (new CRedirectButton(SPACE, null))->addClass(ZBX_STYLE_BTN_CONF)->setTitle(_('Refresh time'));
        case 'overviewhelp':
            return (new CRedirectButton(SPACE, null))->addClass(ZBX_STYLE_BTN_INFO);
        case 'reset':
            return (new CRedirectButton(SPACE, null))->addClass(ZBX_STYLE_BTN_RESET)->setTitle(_('Reset'))->onClick('timeControl.objectReset();');
    }
    return null;
}