/** * Zobrazí obrázek platformy * * @param string $platform windows|linux */ public function __construct($platform) { switch ($platform) { case 'windows': $image = 'base/win40.gif'; break; case 'linux': $image = 'base/linux40.gif'; break; default: $image = 'unknown.gif'; break; } parent::__construct('logos/' . $image, $platform); }
/** * Zobrazí obrázek hosta * * @param IEHost $host */ public function __construct($host) { $image = 'unknown.gif'; $title = ''; if (is_array($host)) { if (isset($host['icon_image'])) { $image = $host['icon_image']; $title = $host['host_name']; } } else { $image = $host->getDataValue('icon_image'); $title = $host->getName(); } parent::__construct('logos/' . $image, $title, null, null, array('class' => 'host_icon')); }
/** * Volba ikony pro host * * @param IEHost $host */ public function __construct($host) { parent::__construct(); EaseJQueryPart::jQueryze($this); $icodirs = array('' => ''); $icoBox = $this->addItem(new EaseTWBPanel(_('Vyber Ikonu'))); $icoBox->setTagCss('width: 100%;'); $icodir = self::$webdir . self::$icodir; $d = dir($icodir); if (is_object($d)) { while (false !== ($entry = $d->read())) { if (is_dir(self::$webdir . self::$icodir . '/' . $entry)) { if ($entry[0] == '.') { continue; } $icodirs[$entry] = $entry; } } $d->close(); } $iconTabs = $icoBox->addItem(new EaseTWBTabs('IconTabs')); foreach ($icodirs as $subicodir) { $default = false; $icons = new EaseContainer(); $customIcos = self::$webdir . self::$icodir . $subicodir; $d = dir($customIcos); if (is_object($d)) { while (false !== ($entry = $d->read())) { if (!is_dir($customIcos . '/' . $entry)) { if (strstr($entry, '.gd2') || $entry[0] == '.') { continue; } if ($entry == 'custom') { list($userid, $imgname) = explode('-', $entry); if ($userid != $host->owner->getId()) { continue; } $default = true; } $hostIcon = new EaseHtmlImgTag(self::$webprefix . self::$icodir . '/' . $subicodir . '/' . $entry); $hostIcon->setTagClass('host_icon'); if ($host->getDataValue('icon_image') == 'custom/' . $entry) { $hostIcon->setTagCss('border: 3px red solid;'); } $icons->addItem(new EaseHtmlATag('?action=newicon&host_id=' . $host->getId() . '&newicon=' . $subicodir . '/' . $entry, $hostIcon)); } } $d->close(); } if (!$subicodir) { $subicodir = 'ico'; } $iconTabs->addTab($subicodir, $icons, $default); } $uplBox = $this->addItem(new EaseTWBPanel(_('Nahraj vlastní'), 'info')); $uplBox->setTagCss('width: 100%;'); $icoupform = $uplBox->addItem(new EaseTWBForm('icoUp', null, 'POST', null, array('enctype' => 'multipart/form-data'))); $icoupform->addItem(new EaseHtmlEmTag(_('Obrázek typu GIF,PNG nebo JPG, nejlépe 40x40 px'))); $icoupform->addItem(new EaseTWBFormGroup(_('Ikona ze souboru'), new EaseHtmlInputFileTag('icofile'), '', _('Soubor v počítači'))); $icoupform->addItem(new EaseTWBFormGroup(_('Ikona z adresy'), new EaseHtmlInputTextTag('icourl'), '', _('Soubor na internetu'))); $icoupform->addItem(new EaseTWBFormGroup(_('Titulek obrázku'), new EaseHtmlInputTextTag('icon_image_alt'), '', _('nepovinné'))); $icoupform->addItem(new EaseTWSubmitButton(_('Odeslat'))); $icoupform->addItem(new EaseHtmlInputHiddenTag('host_id', $host->getId())); }