public function __construct($content = '', $icon = false) { parent::__construct($content); if ($icon) { $this->setIcon(is_string($icon) ? Icon::create2($icon) : $icon); } }
/** * create a link for a widget * * @param String $label Label/content of the link * @param String $url URL/Location of the link * @param Mixed $icon Icon for the link, should be an Icon * object; until v3.6 this may be a string * @param array $attributes HTML-attributes for the a-tag in an associative array. */ public function __construct($label, $url, $icon = null, $attributes = array()) { parent::__construct(); $this->label = $label; $this->url = $url; $this->attributes = $attributes; // DEPRECATED // TODO icon may be a string until v3.6 $this->icon = is_string($icon) ? Icon::create2($icon) : $icon; }
/** * Set the image for the active state of this navigation item. * If no active image is set, the normal image is used for the * active state. Additional HTML attributes can be passed using * the $options parameter (like 'style' or 'onclick'). * * @param Icon $image an instance of class Icon depicting this item * @param array $link_attributes additional link attributes */ public function setActiveImage($image, $link_attributes = []) { $this->active_image = $image; $this->setLinkAttributes($link_attributes); // DEPRECATED // TODO remove this case in v3.6 if (is_string($image)) { $this->active_image = Icon::create2(Assets::image_path($image)); } }
/** * Returns an input tag using options as html attributes on the * tag, but with these special cases: * * * 'size' - Supplied as "X@Y", so "30@45" becomes width="30" and height="45" * * The source can be supplied as a... * * full path, like "/my_images/image.gif" * * file name, like "rss.png", that gets expanded to "/images/rss.png" * * file name without extension, like "logo", that gets expanded to "/images/logo.png" * * Do not use this to render icons. Use the more appropiate class * Icon for this. */ static function input($source, $opt = array()) { if (!$source) { return ''; } $parts = explode('/', $source); if (($pos = array_search('icons', $parts)) !== false) { $source = substr($source, 6); $source = preg_replace('/\\.png$/', '', $source); return Icon::create2($source, $opt)->render(Icon::SVG | Icon::INPUT); } $size = $opt['size']; $opt = Assets::parse_attributes($opt); $opt['src'] = Assets::image_path($source); $opt['type'] = 'image'; if (isset($size) && !isset($opt['width'])) { list($opt['width'], $opt['height']) = explode('@', $size, 2); unset($opt['size']); } return Assets::tag('input', $opt); }
Sidebar::get()->insertWidget($nav_links, ':first'); } } } // TODO: Remove this after sidebar migration has been completed if ($infobox && is_array($infobox)) { $sidebar = Sidebar::get(); if (!$sidebar->getImage()) { $sidebar->setImage(is_object($infobox['picture']) ? $infobox['picture']->getURL(Avatar::NORMAL) : $infobox['picture']); } foreach ($infobox['content'] as $entry) { $widget = new InfoboxWidget(); $widget->setTitle($entry['kategorie']); if (isset($entry['eintrag']) && is_array($entry['eintrag'])) { foreach (@$entry['eintrag'] as $row) { $icon = is_string($row['icon']) ? Icon::create2(str_replace('/black/', '/blue/', $row['icon'])) : $row['icon']; $widget->addElement(new InfoboxElement($row['text'], $icon)); } } $sidebar->addWidget($widget); } unset($infobox); } ?> <!DOCTYPE html> <html class="no-js"> <head> <meta charset="WINDOWS-1252"> <title> <?php echo htmlReady(PageLayout::getTitle() . ' - ' . $GLOBALS['UNI_NAME_CLEAN']);
<tr> <td colspan="2"> <b><?php echo $category["kategorie"]; ?> </b> </td> </tr> <? if (isset($category['eintrag'])) : ?> <? foreach ($category['eintrag'] as $item) : ?> <tr> <td width="1%" align="center" valign="top"> <?php echo is_string($item['icon']) ? Icon::create2($item['icon'])->asImg() : $item['icon']->asImg(); ?> </td> <td width="99%"> <?php echo $item["text"]; ?> </td> </tr> <? endforeach ?> <? endif ?> <? endforeach ?> </table>