/** * showImage * * @param mixed $value * * @return string */ public static function showImage($value) { if ($value) { return \JHtml::image(static::getThumbPath($value), 'UserXTD image'); } return ''; }
/** * Returns a list of buttons for the backend * * @return array */ public static function getAdminButtons() { $buttons = array(); if (JFactory::getUser()->authorise('core.manage', 'com_pfdesigns')) { $buttons[] = array('title' => 'COM_PROJECTFORK_SUBMENU_DESIGNS', 'link' => 'index.php?option=com_pfdesigns', 'icon' => JHtml::image('com_pfdesigns/header/icon-48-designs.png', JText::_('COM_PROJECTFORK_SUBMENU_DESIGNS'), null, true)); } return $buttons; }
/** * Display the view * * @param string $tpl A template file to load. [optional] * * @return nothing */ public function display($tpl = null) { $this->logo_img = JHtml::image('com_attachments/attachments_help_logo32.png', '', null, true); $this->version = AttachmentsDefines::$ATTACHMENTS_VERSION; $rdate = new JDate(AttachmentsDefines::$ATTACHMENTS_VERSION_DATE); $this->date = JHtml::_('date', $rdate, JText::_('DATE_FORMAT_LC1')); parent::display($tpl); }
/** * Returns a list of buttons for the backend * * @return array */ public static function getAdminButtons() { $user = JFactory::getUser(); $buttons = array(); if ($user->authorise('core.manage', 'com_pfforum')) { $buttons[] = array('title' => 'COM_PROJECTFORK_SUBMENU_FORUM', 'link' => 'index.php?option=com_pfforum', 'icon' => JHtml::image('com_projectfork/projectfork/header/icon-48-forum.png', JText::_('COM_PROJECTFORK_SUBMENU_FORUM'), null, true)); } return $buttons; }
public static function link($name, $text, $url) { $bar = JToolbar::getInstance('toolbar'); $img = JHtml::image("com_ostoolbar/icon-32-{$name}.png", null, null, true, true); if ($img) { $doc = JFactory::getDocument(); $doc->addStyleDeclaration(".icon-32-{$name} { background-image: url({$img}); }"); } $bar->appendButton('link', $name, $text, $url); }
/** * getButtonImage * * @param array $button * * @return string */ public static function getButtonIcon($button) { if (!empty($button['icon_class'])) { return "<i class=\"{$button['icon_class']}\"></i>"; } if (!empty($button['image'])) { return JHtml::image($button['image'], $button['id'], null, true); } return "<i class=\"icon-joomla\"></i>"; }
protected function getInput() { require_once JPATH_COMPONENT . '/helpers/jcomments.php'; $smiliesPath = JCommentsHelper::getSmiliesPath(); $livePath = str_replace('\\', '/', $smiliesPath); if (!self::$initialised) { $script = array(); $script[] = ' function JCommentsSmileyRefreshPreview(id) {'; $script[] = ' var value = document.id(id).value;'; $script[] = ' var img = document.id(id + "_preview");'; $script[] = ' if (img) {'; $script[] = ' if (value) {'; $script[] = ' img.src = "' . JURI::root() . $livePath . '" + value;'; $script[] = ' document.id(id + "_preview_empty").setStyle("display", "none");'; $script[] = ' document.id(id + "_preview_img").setStyle("display", "");'; $script[] = ' } else { '; $script[] = ' img.src = ""'; $script[] = ' document.id(id + "_preview_empty").setStyle("display", "");'; $script[] = ' document.id(id + "_preview_img").setStyle("display", "none");'; $script[] = ' } '; $script[] = ' } '; $script[] = ' }'; JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); self::$initialised = true; } $html = array(); $html[] = '<div class="input-prepend input-append">'; // Images list $listAttr = ''; $listAttr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : ''; $listAttr .= ' onchange="JCommentsSmileyRefreshPreview(this.getAttribute(\'id\'))"'; $html[] = JHtml::_('select.genericlist', (array) $this->getOptions($smiliesPath), $this->name, trim($listAttr), 'value', 'text', $this->value, $this->id); // Preview if ($this->value && file_exists(JPATH_ROOT . '/' . $smiliesPath . $this->value)) { $src = JURI::root() . $livePath . $this->value; } else { $src = ''; } $width = isset($this->element['preview_width']) ? (int) $this->element['preview_width'] : 48; $height = isset($this->element['preview_height']) ? (int) $this->element['preview_height'] : 48; $style = ''; $style .= $width > 0 ? 'max-width:' . $width . 'px;' : ''; $style .= $height > 0 ? 'max-height:' . $height . 'px;' : ''; $imgAttr = array('id' => $this->id . '_preview', 'class' => 'media-preview', 'style' => $style); $img = JHtml::image($src, JText::_('JLIB_FORM_MEDIA_PREVIEW_ALT'), $imgAttr); $previewImg = '<div id="' . $this->id . '_preview_img"' . ($src ? '' : ' style="display:none"') . '>' . $img . '</div>'; $previewImgEmpty = '<div id="' . $this->id . '_preview_empty"' . ($src ? ' style="display:none"' : '') . '>' . JText::_('JLIB_FORM_MEDIA_PREVIEW_EMPTY') . '</div>'; $html[] = '<div class="media-preview add-on">'; $html[] = ' ' . $previewImgEmpty; $html[] = ' ' . $previewImg; $html[] = '</div>'; $html[] = '</div>'; return implode("\n", $html); }
/** * Default admin screen title * * @param string $sub * @param string $icon * * @return void */ protected function setTitle($sub = null, $icon = 'ostoolbar') { $img = JHtml::image("com_ostoolbar/icon-48-{$icon}.png", null, null, true, true); if ($img) { $doc = JFactory::getDocument(); $doc->addStyleDeclaration(".icon-48-{$icon} { background-image: url({$img}); }"); } $title = JText::_('COM_OSTOOLBAR'); if ($sub) { $title .= ': ' . JText::_($sub); } JToolbarHelper::title($title, $icon); }
function DefaultEventManagementButton($view, $row) { JEVHelper::script('view_detailJQ.js', 'components/' . JEV_COM_COMPONENT . "/assets/js/"); ?> <a href="#my-modal" data-toggle="modal" data-target="#action_dialogJQ<?php echo $row->rp_id(); ?> " title="<?php echo JText::_('JEV_E_EDIT', true); ?> "> <?php echo JHtml::image('com_jevents/icons-32/edit.png', JText::_("JEV_E_EDIT"), null, true); ?> </a> <?php }
/** * get img for team * @param object teams row * @param int type = 0 for club small logo, 1 for medium logo, 2 for big logo * @return html string */ public static function getLogo($item, $type = 1) { if ($type == 0) { $picture = $item->logo_small; if (is_null($item->logo_small) || !file_exists($picture)) { $picture = JoomleagueHelper::getDefaultPlaceholder('clublogosmall'); } echo JHtml::image($picture, $item->team_name, 'class="logo_small" title="View ' . $item->team_name . '"'); } else { if ($type == 1) { $picture = $item->logo_middle; if (is_null($item->logo_middle) || !file_exists($picture)) { $picture = JoomleagueHelper::getDefaultPlaceholder('clublogomedium'); } echo JHtml::image($picture, $item->team_name, 'class="logo_middle" title="View ' . $item->team_name . '"'); } else { if ($type == 2) { $picture = $item->logo_big; if (is_null($item->logo_big) || !file_exists($picture)) { $picture = JoomleagueHelper::getDefaultPlaceholder('clublogobig'); } echo JHtml::image($picture, $item->team_name, 'class="logo_big" title="View ' . $item->team_name . '"'); } else { if ($type == 3) { $picture = $item->team_picture; if (is_null($item->team_picture) || !file_exists($picture)) { $picture = JoomleagueHelper::getDefaultPlaceholder('team'); } echo JHtml::image($picture, $item->team_name, 'class="team_picture" title="View ' . $item->team_name . '"'); } else { if ($type == 4) { $picture = $item->projectteam_picture; if (is_null($item->projectteam_picture) || !file_exists($picture)) { $picture = JoomleagueHelper::getDefaultPlaceholder('team'); } echo JHtml::image($picture, $item->team_name, 'class="projecteam_picture" title="View ' . $item->team_name . '"'); } } } } } return ''; }
private function initialize() { //now lets echo responese header('Content-type: text/xml'); echo '<?xml version="1.0" encoding="UTF-8" ?>', "\n"; echo "<nodes>\n"; $config = JFactory::getConfig(); $config->set('live_site', ''); // Inialize array $contentIcon = JHtml::image('editors/arkeditor/content.png', '', null, true, true); $menuIcon = JHtml::image('editors/arkeditor/menu.png', '', null, true, true); $extensions = array('content' => array($contentIcon, $contentIcon), 'menu' => array($menuIcon, $menuIcon)); ARkTreeLinkHelper::ListExtensions($extensions); foreach ($extensions as $extension => $icon) { $load = JURI::root() . 'index.php?option=com_ajax&plugin=arktreelink&format=json&action=links&extension=' . $extension; echo '<node text="' . ucfirst($extension) . '" openicon="' . $icon[0] . '" icon="' . $icon[1] . '" load="' . $load . '" selectable="false" url ="">' . "\n"; echo "</node>\n"; } echo "</nodes>"; exit; }
* other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */ // no direct access defined('_JEXEC') or die('Restricted access'); JHtml::_('behavior.tooltip'); ?> Tracks team link <div class="mod_tracks_teamsocial"> <ul> <?php foreach ($links as $name => $s) { ?> <?php $attr = array('class' => 'hasTip', 'title' => $s->label); ?> <li class="ts-<?php echo $name; ?> "> <?php echo JHtml::link($s->link, JHtml::image($s->icon, $s->label, null, true), $attr); ?> </li> <?php } ?> </ul> </div>
/** * Method to get the field input markup for a media selector. * Use attributes to identify specific created_by and asset_id fields * * @return string The field input markup. * * @since 1.6 */ protected function getInput() { $asset = $this->asset; if ($asset == '') { $asset = JFactory::getApplication()->input->get('option'); } if (!self::$initialised) { // Load the modal behavior script. JHtml::_('behavior.modal'); // Include jQuery JHtml::_('jquery.framework'); // Build the script. $script = array(); $script[] = ' function jInsertFieldValue(value, id) {'; $script[] = ' var $ = jQuery.noConflict();'; $script[] = ' var old_value = $("#" + id).val();'; $script[] = ' if (old_value != value) {'; $script[] = ' var $elem = $("#" + id);'; $script[] = ' $elem.val(value);'; $script[] = ' $elem.trigger("change");'; $script[] = ' if (typeof($elem.get(0).onchange) === "function") {'; $script[] = ' $elem.get(0).onchange();'; $script[] = ' }'; $script[] = ' jMediaRefreshPreview(id);'; $script[] = ' }'; $script[] = ' }'; $script[] = ' function jMediaRefreshPreview(id) {'; $script[] = ' var $ = jQuery.noConflict();'; $script[] = ' var value = $("#" + id).val();'; $script[] = ' var $img = $("#" + id + "_preview");'; $script[] = ' if ($img.length) {'; $script[] = ' if (value) {'; $script[] = ' $img.attr("src", "' . JUri::root() . '" + value);'; $script[] = ' $("#" + id + "_preview_empty").hide();'; $script[] = ' $("#" + id + "_preview_img").show()'; $script[] = ' } else { '; $script[] = ' $img.attr("src", "");'; $script[] = ' $("#" + id + "_preview_empty").show();'; $script[] = ' $("#" + id + "_preview_img").hide();'; $script[] = ' } '; $script[] = ' } '; $script[] = ' }'; $script[] = ' function jMediaRefreshPreviewTip(tip)'; $script[] = ' {'; $script[] = ' var $ = jQuery.noConflict();'; $script[] = ' var $tip = $(tip);'; $script[] = ' var $img = $tip.find("img.media-preview");'; $script[] = ' $tip.find("div.tip").css("max-width", "none");'; $script[] = ' var id = $img.attr("id");'; $script[] = ' id = id.substring(0, id.length - "_preview".length);'; $script[] = ' jMediaRefreshPreview(id);'; $script[] = ' $tip.show();'; $script[] = ' }'; // JQuery for tooltip for INPUT showing whole image path $script[] = ' function jMediaRefreshImgpathTip(tip)'; $script[] = ' {'; $script[] = ' var $ = jQuery.noConflict();'; $script[] = ' var $tip = $(tip);'; $script[] = ' $tip.css("max-width", "none");'; $script[] = ' var $imgpath = $("#" + "' . $this->id . '").val();'; $script[] = ' $("#TipImgpath").html($imgpath);'; $script[] = ' if ($imgpath.length) {'; $script[] = ' $tip.show();'; $script[] = ' } else {'; $script[] = ' $tip.hide();'; $script[] = ' }'; $script[] = ' }'; // Add the script to the document head. JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); self::$initialised = true; } $html = array(); $attr = ''; // Tooltip for INPUT showing whole image path $options = array('onShow' => 'jMediaRefreshImgpathTip'); JHtml::_('behavior.tooltip', '.hasTipImgpath', $options); if (!empty($this->class)) { $this->class .= ' hasTipImgpath'; } else { $this->class = 'hasTipImgpath'; } $attr .= ' title="' . htmlspecialchars('<span id="TipImgpath"></span>', ENT_COMPAT, 'UTF-8') . '"'; // Initialize some field attributes. $attr .= !empty($this->class) ? ' class="input-small ' . $this->class . '"' : ' class="input-small"'; $attr .= !empty($this->size) ? ' size="' . $this->size . '"' : ''; // Initialize JavaScript field attributes. $attr .= !empty($this->onchange) ? ' onchange="' . $this->onchange . '"' : ''; // The text field. $html[] = '<div class="input-prepend input-append">'; // The Preview. $showPreview = true; $showAsTooltip = false; switch ($this->preview) { case 'no': // Deprecated parameter value // Deprecated parameter value case 'false': case 'none': $showPreview = false; break; case 'yes': // Deprecated parameter value // Deprecated parameter value case 'true': case 'show': break; case 'tooltip': default: $showAsTooltip = true; $options = array('onShow' => 'jMediaRefreshPreviewTip'); JHtml::_('behavior.tooltip', '.hasTipPreview', $options); break; } if ($showPreview) { if ($this->value && file_exists(JPATH_ROOT . '/' . $this->value)) { $src = JUri::root() . $this->value; } else { $src = ''; } $width = $this->previewWidth; $height = $this->previewHeight; $style = ''; $style .= $width > 0 ? 'max-width:' . $width . 'px;' : ''; $style .= $height > 0 ? 'max-height:' . $height . 'px;' : ''; $imgattr = array('id' => $this->id . '_preview', 'class' => 'media-preview', 'style' => $style); $img = JHtml::image($src, JText::_('JLIB_FORM_MEDIA_PREVIEW_ALT'), $imgattr); $previewImg = '<div id="' . $this->id . '_preview_img"' . ($src ? '' : ' style="display:none"') . '>' . $img . '</div>'; $previewImgEmpty = '<div id="' . $this->id . '_preview_empty"' . ($src ? ' style="display:none"' : '') . '>' . JText::_('JLIB_FORM_MEDIA_PREVIEW_EMPTY') . '</div>'; if ($showAsTooltip) { $html[] = '<div class="media-preview add-on">'; $tooltip = $previewImgEmpty . $previewImg; $options = array('title' => JText::_('JLIB_FORM_MEDIA_PREVIEW_SELECTED_IMAGE'), 'text' => '<span class="icon-eye"></span>', 'class' => 'hasTipPreview'); $html[] = JHtml::tooltip($tooltip, $options); $html[] = '</div>'; } else { $html[] = '<div class="media-preview add-on" style="height:auto">'; $html[] = ' ' . $previewImgEmpty; $html[] = ' ' . $previewImg; $html[] = '</div>'; } } $html[] = ' <input type="text" name="' . $this->name . '" id="' . $this->id . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" readonly="readonly"' . $attr . ' />'; if ($this->value && file_exists(JPATH_ROOT . '/' . $this->value)) { $folder = explode('/', $this->value); $folder = array_diff_assoc($folder, explode('/', JComponentHelper::getParams('com_media')->get('image_path', 'images'))); array_pop($folder); $folder = implode('/', $folder); } elseif (file_exists(JPATH_ROOT . '/' . JComponentHelper::getParams('com_media')->get('image_path', 'images') . '/' . $this->directory)) { $folder = $this->directory; } else { $folder = ''; } // The button. if ($this->disabled != true) { JHtml::_('bootstrap.tooltip'); $html[] = '<a class="modal btn" title="' . JText::_('JLIB_FORM_BUTTON_SELECT') . '" href="' . ($this->readonly ? '' : ($this->link ? $this->link : 'index.php?option=com_media&view=images&tmpl=component&asset=' . $asset . '&author=' . $this->form->getValue($this->authorField)) . '&fieldid=' . $this->id . '&folder=' . $folder) . '"' . ' rel="{handler: \'iframe\', size: {x: 800, y: 500}}">'; $html[] = JText::_('JLIB_FORM_BUTTON_SELECT') . '</a><a class="btn hasTooltip" title="' . JText::_('JLIB_FORM_BUTTON_CLEAR') . '" href="#" onclick="'; $html[] = 'jInsertFieldValue(\'\', \'' . $this->id . '\');'; $html[] = 'return false;'; $html[] = '">'; $html[] = '<span class="icon-remove"></span></a>'; } $html[] = '</div>'; return implode("\n", $html); }
echo JText::_('COM_JOOMLEAGUE_MATCHREPORT_EVENTS'); ?> </h2> <?php $txt_tab = ''; $p = 1; echo JHtml::_('bootstrap.startTabSet', 'tabs_events', array('active' => 'panel1')); foreach ($this->eventtypes as $event) { $pic_tab = $event->icon; if ($pic_tab == '/events/event.gif') { $txt_tab = JText::_($event->name); } else { $imgTitle = JText::_($event->name); $imgTitle2 = array(' title' => $imgTitle, ' alt' => $imgTitle, ' style' => 'max-height:40px;'); $txt_tab = JHtml::image($pic_tab, $imgTitle, $imgTitle2); } echo JHtml::_('bootstrap.addTab', 'tabs_events', 'panel' . $p++, $txt_tab); echo '<table class="matchreport">'; echo '<tr>'; echo '<td class="list">'; echo '<ul>'; foreach ($this->matchevents as $me) { if ($me->event_type_id == $event->id && $me->ptid == $this->match->projectteam1_id) { echo '<li class="list">'; if ($this->config['show_event_minute'] == 1 && $me->event_time > 0) { $prefix = str_pad($me->event_time, 2, '0', STR_PAD_LEFT) . "' "; } else { $prefix = null; } $match_player = JoomleagueHelper::formatName($prefix, $me->firstname1, $me->nickname1, $me->lastname1, $this->config["name_format"]);
/** * returns html for events in tabs * @param object match * @param array project events * @param array match events * @param aray match substitutions * @param array $config * @return string */ function showEventsContainerInResults($matchInfo, $projectevents, $matchevents, $substitutions = null, $config) { $output = ''; $result = ''; if ($this->config['use_tabs_events']) { // Make event tabs with JPane integrated function in Joomla 1.5 API $result = JPane::getInstance('tabs', array('startOffset' => 0)); $output .= $result->startPane('pane'); $cnt = 0; foreach ($projectevents as $event) { //display only tabs with events foreach ($matchevents as $me) { $cnt = 0; if ($me->event_type_id == $event->id) { $cnt++; break; } } if ($cnt == 0) { continue; } // I think its better to show the event name,the the event image(gives some probs with tabs) $pic_tab = $event->icon; $imgTitle = JText::_($event->name); $imgTitle2 = array(' title' => $imgTitle); $txt_tab = JHtml::image($pic_tab, $imgTitle, $imgTitle2); $backgroundStyle = "background: url(" . $pic_tab . ") no-repeat transparent"; if (empty($pic_tab)) { $backgroundStyle = ""; } $output .= $result->startPanel($txt_tab, $event->id); //$output .= $result->startPanel($event->name,$event->id); $output .= '<table class="matchreport" border="0">'; $output .= '<tr>'; $output .= '<td class="list">'; $output .= '<ul>'; foreach ($matchevents as $me) { $output .= self::_formatEventContainerInResults($me, $event, $matchInfo->projectteam1_id, $backgroundStyle); } $output .= '</ul>'; $output .= '</td>'; $output .= '<td class="list">'; $output .= '<ul>'; foreach ($matchevents as $me) { $output .= self::_formatEventContainerInResults($me, $event, $matchInfo->projectteam2_id, $backgroundStyle); } $output .= '</ul>'; $output .= '</td>'; $output .= '</tr>'; $output .= '</table>'; $output .= $result->endPanel(); } if (!empty($substitutions)) { $pic_time = 'images/com_joomleague/database/events/' . $this->project->fs_sport_type_name . '/playtime.gif'; $pic_out = 'images/com_joomleague/database/events/' . $this->project->fs_sport_type_name . '/out.png'; $pic_in = 'images/com_joomleague/database/events/' . $this->project->fs_sport_type_name . '/in.png'; $pic_tab = 'images/com_joomleague/database/events/' . $this->project->fs_sport_type_name . '/subst.png'; $imgTitle = JText::_('COM_JOOMLEAGUE_IN_OUT'); $imgTitle2 = array(' title' => $imgTitle); $txt_tab = JHtml::image($pic_tab, $imgTitle, $imgTitle2); $imgTime = JHtml::image($pic_time, JText::_('COM_JOOMLEAGUE_MATCHREPORT_SUBSTITUTION_MINUTE'), array(' title' => JText::_('COM_JOOMLEAGUE_MATCHREPORT_SUBSTITUTION_MINUTE'))); $imgOut = JHtml::image($pic_out, JText::_('COM_JOOMLEAGUE_MATCHREPORT_SUBSTITUTION_WENT_OUT'), array(' title' => JText::_('COM_JOOMLEAGUE_MATCHREPORT_SUBSTITUTION_WENT_OUT'))); $imgIn = JHtml::image($pic_in, JText::_('COM_JOOMLEAGUE_MATCHREPORT_SUBSTITUTION_CAME_IN'), array(' title' => JText::_('COM_JOOMLEAGUE_MATCHREPORT_SUBSTITUTION_CAME_IN'))); $output .= $result->startPanel($txt_tab, '0'); $output .= '<table class="matchreport" border="0">'; $output .= '<tr>'; $output .= '<td class="list">'; $output .= '<ul>'; foreach ($substitutions as $subs) { $output .= self::_formatSubstitutionContainerInResults($subs, $matchInfo->projectteam1_id, $imgTime, $imgOut, $imgIn); } $output .= '</ul>'; $output .= '</td>'; $output .= '<td class="list">'; $output .= '<ul>'; foreach ($substitutions as $subs) { $output .= self::_formatSubstitutionContainerInResults($subs, $matchInfo->projectteam2_id, $imgTime, $imgOut, $imgIn); } $output .= '</ul>'; $output .= '</td>'; $output .= '</tr>'; $output .= '</table>'; $output .= $result->endPanel(); } $output .= $result->endPane(); } else { $output .= '<table class="matchreport" border="0">'; $output .= '<tr>'; $output .= '<td class="list-left">'; $output .= '<ul>'; foreach ((array) $matchevents as $me) { if ($me->ptid == $matchInfo->projectteam1_id) { if ($this->config['show_events_with_icons'] == 1) { $event_icon = JUri::root() . $projectevents[$me->event_type_id]->icon; $backgroundStyle = "background: url(" . $event_icon . ") no-repeat transparent"; if (empty($event_icon)) { $backgroundStyle = ""; } $output .= self::_formatEventContainerInResults($me, $projectevents[$me->event_type_id], $matchInfo->projectteam1_id, $backgroundStyle); } else { $output .= '<li class="list">'; if (!strlen($me->firstname1 . $me->lastname1)) { $output .= $me->event_time . '\' ' . JText::_($projectevents[$me->event_type_id]->name) . ' ' . JText::_('Unknown Person'); } else { $output .= $me->event_time . '\' ' . JText::_($projectevents[$me->event_type_id]->name) . ' ' . $me->firstname1 . ' ' . $me->lastname1; } // only show event sum and match notice when set to on in template cofig if ($this->config['show_event_sum'] == 1 || $this->config['show_event_notice'] == 1) { if ($this->config['show_event_sum'] == 1 && $me->event_sum > 0 || $this->config['show_event_notice'] == 1 && strlen($me->notice) > 0) { $output .= ' ('; if ($this->config['show_event_sum'] == 1 && $me->event_sum > 0) { $output .= $me->event_sum; } if ($this->config['show_event_sum'] == 1 && $me->event_sum > 0 && ($this->config['show_event_notice'] == 1 && strlen($me->notice) > 0)) { $output .= ' | '; } if ($this->config['show_event_notice'] == 1 && strlen($me->notice) > 0) { $output .= $me->notice; } $output .= ')'; } } $output .= '</li>'; } } } $output .= '</ul>'; $output .= '</td>'; $output .= '<td class="list-right">'; $output .= '<ul>'; foreach ($matchevents as $me) { if ($me->ptid == $matchInfo->projectteam2_id) { if ($this->config['show_events_with_icons'] == 1) { $event_icon = JUri::root() . $projectevents[$me->event_type_id]->icon; $backgroundStyle = "background: url(" . $event_icon . ") no-repeat transparent"; if (empty($event_icon)) { $backgroundStyle = ""; } $output .= self::_formatEventContainerInResults($me, $projectevents[$me->event_type_id], $matchInfo->projectteam2_id, $backgroundStyle); } else { $output .= '<li class="list">'; if (!strlen($me->firstname1 . $me->lastname1)) { $output .= $me->event_time . '\' ' . JText::_($projectevents[$me->event_type_id]->name) . ' ' . JText::_('Unknown Person'); } else { $output .= $me->event_time . '\' ' . JText::_($projectevents[$me->event_type_id]->name) . ' ' . $me->firstname1 . ' ' . $me->lastname1; } // only show event sum and match notice when set to on in template cofig if ($this->config['show_event_sum'] == 1 || $this->config['show_event_notice'] == 1) { if ($this->config['show_event_sum'] == 1 && $me->event_sum > 0 || $this->config['show_event_notice'] == 1 && strlen($me->notice) > 0) { $output .= ' ('; if ($this->config['show_event_sum'] == 1 && $me->event_sum > 0) { $output .= $me->event_sum; } if ($this->config['show_event_sum'] == 1 && $me->event_sum > 0 && ($this->config['show_event_notice'] == 1 && strlen($me->notice) > 0)) { $output .= ' | '; } if ($this->config['show_event_notice'] == 1 && strlen($me->notice) > 0) { $output .= $me->notice; } $output .= ')'; } } $output .= '</li>'; } } } $output .= '</ul>'; $output .= '</td>'; $output .= '</tr>'; $output .= '</table>'; } return $output; }
/** * Method to get the field input markup for a media selector. * Use attributes to identify specific created_by and asset_id fields * * @return string The field input markup. * * @todo Create a layout and put all the output HTML there! */ protected function getInput() { $assetField = $this->element['asset_field'] ? (string) $this->element['asset_field'] : 'asset_id'; $authorField = $this->element['created_by_field'] ? (string) $this->element['created_by_field'] : 'created_by'; $asset = $this->form->getValue($assetField) ? $this->form->getValue($assetField) : (string) $this->element['asset_id']; if ($asset == '') { $asset = JFactory::getApplication()->input->get('option'); } $link = (string) $this->element['link']; $modalTitle = isset($this->element['modal_title']) ? JText::_($this->element['modal_title']) : JText::_('LIB_REDCORE_MEDIA_MANAGER'); $modalId = 'modal-' . $this->id; if (!self::$initialised) { // Build the script. $script = array(); $script[] = ' function jInsertFieldValue(value, id) {'; $script[] = ' var old_value = document.id(id).value;'; $script[] = ' if (old_value != value) {'; $script[] = ' var elem = document.id(id);'; $script[] = ' elem.value = value;'; $script[] = ' elem.fireEvent("change");'; $script[] = ' if (typeof(elem.onchange) === "function") {'; $script[] = ' elem.onchange();'; $script[] = ' }'; $script[] = ' jMediaRefreshPreview(id);'; $script[] = ' };'; $script[] = ' jQuery("#' . $modalId . '").modal("hide");'; $script[] = ' }'; $script[] = ' function jMediaRefreshPreview(id) {'; $script[] = ' var value = document.id(id).value;'; $script[] = ' var img = document.id(id + "_preview");'; $script[] = ' if (img) {'; $script[] = ' if (value) {'; $script[] = ' img.src = "' . JUri::root() . '" + value;'; $script[] = ' document.id(id + "_preview_empty").setStyle("display", "none");'; $script[] = ' document.id(id + "_preview_img").setStyle("display", "");'; $script[] = ' } else { '; $script[] = ' img.src = ""'; $script[] = ' document.id(id + "_preview_empty").setStyle("display", "");'; $script[] = ' document.id(id + "_preview_img").setStyle("display", "none");'; $script[] = ' } '; $script[] = ' } '; $script[] = ' }'; $script[] = ' function jMediaRefreshPreviewTip(tip)'; $script[] = ' {'; $script[] = ' var img = tip.getElement("img.media-preview");'; $script[] = ' tip.getElement("div.tip").setStyle("max-width", "none");'; $script[] = ' var id = img.getProperty("id");'; $script[] = ' id = id.substring(0, id.length - "_preview".length);'; $script[] = ' jMediaRefreshPreview(id);'; $script[] = ' tip.setStyle("display", "block");'; $script[] = ' }'; $script[] = ' function jSetIframeHeight(iframe)'; $script[] = ' {'; $script[] = ' var newheight;'; $script[] = ' if(iframe) {'; $script[] = ' newheight = iframe.contentWindow.document.body.scrollHeight;'; $script[] = ' iframe.height= (newheight) + "px";'; $script[] = ' iframe.setStyle("max-height", iframe.height);'; $script[] = ' }'; $script[] = ' }'; $script[] = "\n\t\t\t\tfunction closeModal(fieldId)\n\t\t\t\t{\n\t\t\t\t\tjQuery('#modal-' + fieldId).modal('hide');\n\t\t\t\t}\n\t\t\t"; // Add the script to the document head. JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); self::$initialised = true; } $html = array(); $attr = ''; // Initialize some field attributes. $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : ''; $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : ''; // Initialize JavaScript field attributes. $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : ''; // The text field. $html[] = '<div class="input-prepend input-append input-group">'; // The Preview. $preview = (string) $this->element['preview']; $showPreview = true; $showAsTooltip = false; switch ($preview) { case 'no': // Deprecated parameter value // Deprecated parameter value case 'false': case 'none': $showPreview = false; break; case 'yes': // Deprecated parameter value // Deprecated parameter value case 'true': case 'show': break; case 'tooltip': default: $showAsTooltip = true; $options = array('onShow' => 'jMediaRefreshPreviewTip'); JHtml::_('rbootstrap.tooltip', '.hasTipPreview', $options); break; } if ($showPreview) { if ($this->value && file_exists(JPATH_ROOT . '/' . $this->value)) { $src = JUri::root() . $this->value; } else { $src = ''; } $width = isset($this->element['preview_width']) ? (int) $this->element['preview_width'] : 300; $height = isset($this->element['preview_height']) ? (int) $this->element['preview_height'] : 200; $style = ''; $style .= $width > 0 ? 'max-width:' . $width . 'px;' : ''; $style .= $height > 0 ? 'max-height:' . $height . 'px;' : ''; $imgattr = array('id' => $this->id . '_preview', 'class' => 'media-preview', 'style' => $style); $img = JHtml::image($src, JText::_('JLIB_FORM_MEDIA_PREVIEW_ALT'), $imgattr); $previewImg = '<div id="' . $this->id . '_preview_img"' . ($src ? '' : ' style="display:none"') . '>' . $img . '</div>'; $previewImgEmpty = '<div id="' . $this->id . '_preview_empty"' . ($src ? ' style="display:none"' : '') . '>' . JText::_('JLIB_FORM_MEDIA_PREVIEW_EMPTY') . '</div>'; if ($showAsTooltip) { $html[] = '<div class="media-preview add-on input-group-addon">'; $tooltip = $previewImgEmpty . $previewImg; $options = array('title' => JText::_('JLIB_FORM_MEDIA_PREVIEW_SELECTED_IMAGE'), 'text' => '<i class="icon-eye-open"></i>', 'class' => 'hasTipPreview'); $html[] = RHtml::tooltip($tooltip, $options); $html[] = '</div>'; } else { $html[] = '<div class="media-preview add-on input-group-addon" style="height:auto">'; $html[] = ' ' . $previewImgEmpty; $html[] = ' ' . $previewImg; $html[] = '</div>'; } } $html[] = ' <input type="text" class="input-small input-sm" name="' . $this->name . '" id="' . $this->id . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" readonly="readonly"' . $attr . ' />'; $directory = (string) $this->element['directory']; if ($this->value && file_exists(JPATH_ROOT . '/' . $this->value)) { $folder = explode('/', $this->value); $folder = array_diff_assoc($folder, explode('/', JComponentHelper::getParams('com_media')->get('image_path', 'images'))); array_pop($folder); $folder = implode('/', $folder); } elseif (file_exists(JPATH_ROOT . '/' . JComponentHelper::getParams('com_media')->get('image_path', 'images') . '/' . $directory)) { $folder = $directory; } else { $folder = ''; } $link = ($link ? $link : 'index.php?option=com_media&view=images&layout=modal&tmpl=component&asset=' . $asset . '&author=' . $this->form->getValue($authorField)) . '&fieldid=' . $this->id . '&folder=' . $folder . '&redcore=true'; // Create the modal object $modal = RModal::getInstance(array('attribs' => array('id' => $modalId, 'class' => 'modal hide', 'style' => 'width: 820px; height: 500px; margin-left: -410px; top: 50%; margin-top: -250px;'), 'params' => array('showHeader' => true, 'showFooter' => false, 'showHeaderClose' => true, 'title' => $modalTitle, 'link' => $link, 'events' => array('onload' => 'jSetIframeHeight'))), $modalId); $html[] = RLayoutHelper::render('fields.rmedia', array('modal' => $modal, 'field' => $this)); $html[] = '</div>'; return implode("\n", $html); }
static function displayImages($types = '', $page = 0, $max = 16) { $Images = array(); $list = VmMediaHandler::getImagesList($types, $page, $max); if (empty($list['images'])) { return vmText::_('COM_VIRTUEMART_NO_MEDIA_FILES'); } foreach ($list['images'] as $key => $image) { $htmlImages = ''; if ($image->file_url_thumb > "0") { /*$htmlImages .= '<div class="vm_thumb_image"> <span><a class="vm_thumb" rel="group1" title ="'.$image->file_title.'"href="'.JURI::root(true).'/'.$image->file_url.'" >' .JHtml::image($image->file_url_thumb,$image->file_title, 'class="vm_thumb" ').'</span></a>';*/ $htmlImages .= '<div class="vm_thumb_image"> <span>' . JHtml::image($image->file_url_thumb, $image->file_title, 'class="vm_thumb" ') . '</span>'; } else { $htmlImages .= '<div class="vm_thumb_image">' . vmText::_('COM_VIRTUEMART_NO_IMAGE_SET') . '<br />' . $image->file_title; } $Images[$key]['label'] = $htmlImages . '<input type="hidden" value="' . $image->virtuemart_media_id . '" name="virtuemart_media_id[' . $image->virtuemart_media_id . ']"><input class="ordering" type="hidden" name="mediaordering[' . $image->virtuemart_media_id . ']" value=""><div class="vmicon vmicon-16-remove" title="remove"></div><div title="edit image information" class="edit-24-grey"></div></div>'; $Images[$key]['value'] = $image->file_title . ' :: ' . $image->virtuemart_media_id; } //$list['htmlImages'] = $htmlImages; return $Images; }
/** * Get the rendering of this field type for static display, e.g. in a single * item view (typically a "read" task). * * @since 2.0 * * @return string The field HTML */ public function getStatic() { $imgattr = array('id' => $this->id); if ($this->element['class']) { $imgattr['class'] = (string) $this->element['class']; } if ($this->element['style']) { $imgattr['style'] = (string) $this->element['style']; } if ($this->element['width']) { $imgattr['width'] = (string) $this->element['width']; } if ($this->element['height']) { $imgattr['height'] = (string) $this->element['height']; } if ($this->element['align']) { $imgattr['align'] = (string) $this->element['align']; } if ($this->element['rel']) { $imgattr['rel'] = (string) $this->element['rel']; } if ($this->element['alt']) { $alt = JText::_((string) $this->element['alt']); } else { $alt = null; } if ($this->element['title']) { $imgattr['title'] = JText::_((string) $this->element['title']); } $path = (string) $this->element['directory']; $path = trim($path, '/' . DIRECTORY_SEPARATOR); if ($this->value && file_exists(JPATH_ROOT . '/' . $path . '/' . $this->value)) { $src = FOFPlatform::getInstance()->URIroot() . '/' . $path . '/' . $this->value; } else { $src = ''; } return JHtml::image($src, $alt, $imgattr); }
function showClubIcon(&$team, $type = 1, $with_space = 0) { if ($type == 1 && isset($team->country)) { if ($team->logo_small != '') { echo JHtml::image($team->logo_small, ''); if ($with_space == 1) { echo ' style="padding:1px;"'; } } else { echo ' '; } } elseif ($type == 2 && isset($team->country)) { echo Countries::getCountryFlag($team->country); } }
// Related Products ?> <?php // Customer Reviews if ($this->allowRating || $this->showReview) { $maxrating = VmConfig::get('vm_maximum_rating_scale', 5); $ratingsShow = VmConfig::get('vm_num_ratings_show', 3); // TODO add vm_num_ratings_show in vmConfig $starsPath = JURI::root() . VmConfig::get('assets_general_path') . 'images/stars/'; $stars = array(); $showall = vRequest::getBool('showall', false); for ($num = 0; $num <= $maxrating; $num++) { $title = vmText::_("VM_RATING_TITLE") . ' : ' . $num . '/' . $maxrating; $stars[] = JHtml::image($starsPath . $num . '.gif', vmText::_($num . '_STARS'), array("title" => $title)); } ?> <div class="customer-reviews"> <?php } if ($this->showReview) { $alreadycommented = false; ?> <h4><?php echo vmText::_('COM_VIRTUEMART_REVIEWS'); ?> </h4>
/** * Method to get the field input markup for a media selector. * Use attributes to identify specific created_by and asset_id fields * * @return string The field input markup. * * @since 1.6 */ protected function getInput() { $assetField = $this->element['asset_field'] ? (string) $this->element['asset_field'] : 'asset_id'; $authorField = $this->element['created_by_field'] ? (string) $this->element['created_by_field'] : 'created_by'; $asset = $this->form->getValue($assetField) ? $this->form->getValue($assetField) : (string) $this->element['asset_id']; if ($asset == '') { $asset = JFactory::getApplication()->input->get('option'); } $link = (string) $this->element['link']; if (!self::$initialised) { // Load the modal behavior script. JHtml::_('behavior.modal'); // Build the script. $script = array(); $script[] = ' function jInsertFieldValue(value, id) {'; $script[] = ' var old_value = document.id(id).value;'; $script[] = ' if (old_value != value) {'; $script[] = ' var elem = document.id(id);'; $script[] = ' elem.value = value;'; $script[] = ' elem.fireEvent("change");'; $script[] = ' if (typeof(elem.onchange) === "function") {'; $script[] = ' elem.onchange();'; $script[] = ' }'; $script[] = ' jMediaRefreshPreview(id);'; $script[] = ' }'; $script[] = ' }'; $script[] = ' function jMediaRefreshPreview(id) {'; $script[] = ' var value = document.id(id).value;'; $script[] = ' var img = document.id(id + "_preview");'; $script[] = ' if (img) {'; $script[] = ' if (value) {'; $script[] = ' img.src = "' . JURI::root() . '" + value;'; $script[] = ' document.id(id + "_preview_empty").setStyle("display", "none");'; $script[] = ' document.id(id + "_preview_img").setStyle("display", "");'; $script[] = ' } else { '; $script[] = ' img.src = ""'; $script[] = ' document.id(id + "_preview_empty").setStyle("display", "");'; $script[] = ' document.id(id + "_preview_img").setStyle("display", "none");'; $script[] = ' } '; $script[] = ' } '; $script[] = ' }'; $script[] = ' function jMediaRefreshPreviewTip(tip)'; $script[] = ' {'; $script[] = ' var img = tip.getElement("img.media-preview");'; $script[] = ' tip.getElement("div.tip").setStyle("max-width", "none");'; $script[] = ' var id = img.getProperty("id");'; $script[] = ' id = id.substring(0, id.length - "_preview".length);'; $script[] = ' jMediaRefreshPreview(id);'; $script[] = ' tip.setStyle("display", "block");'; $script[] = ' }'; // Add the script to the document head. JFactory::getDocument()->addScriptDeclaration(implode("\n", $script)); self::$initialised = true; } $html = array(); $attr = ''; // Initialize some field attributes. $attr .= $this->element['class'] ? ' class="' . (string) $this->element['class'] . '"' : ''; $attr .= $this->element['size'] ? ' size="' . (int) $this->element['size'] . '"' : ''; // Initialize JavaScript field attributes. $attr .= $this->element['onchange'] ? ' onchange="' . (string) $this->element['onchange'] . '"' : ''; // The text field. $html[] = '<div class="input-prepend input-append">'; // The Preview. $preview = (string) $this->element['preview']; $showPreview = true; $showAsTooltip = false; switch ($preview) { case 'no': // Deprecated parameter value // Deprecated parameter value case 'false': case 'none': $showPreview = false; break; case 'yes': // Deprecated parameter value // Deprecated parameter value case 'true': case 'show': break; case 'tooltip': default: $showAsTooltip = true; $options = array('onShow' => 'jMediaRefreshPreviewTip'); JHtml::_('behavior.tooltip', '.hasTipPreview', $options); break; } if ($showPreview) { if ($this->value && file_exists(JPATH_ROOT . '/' . $this->value)) { $src = JURI::root() . $this->value; } else { $src = ''; } $width = isset($this->element['preview_width']) ? (int) $this->element['preview_width'] : 300; $height = isset($this->element['preview_height']) ? (int) $this->element['preview_height'] : 200; $style = ''; $style .= $width > 0 ? 'max-width:' . $width . 'px;' : ''; $style .= $height > 0 ? 'max-height:' . $height . 'px;' : ''; $imgattr = array('id' => $this->id . '_preview', 'class' => 'media-preview', 'style' => $style); $img = JHtml::image($src, JText::_('JLIB_FORM_MEDIA_PREVIEW_ALT'), $imgattr); $previewImg = '<div id="' . $this->id . '_preview_img"' . ($src ? '' : ' style="display:none"') . '>' . $img . '</div>'; $previewImgEmpty = '<div id="' . $this->id . '_preview_empty"' . ($src ? ' style="display:none"' : '') . '>' . JText::_('JLIB_FORM_MEDIA_PREVIEW_EMPTY') . '</div>'; $html[] = '<div class="media-preview add-on">'; if ($showAsTooltip) { $tooltip = $previewImgEmpty . $previewImg; $options = array('title' => JText::_('JLIB_FORM_MEDIA_PREVIEW_SELECTED_IMAGE'), 'text' => '<i class="icon-eye"></i>', 'class' => 'hasTipPreview'); $html[] = JHtml::tooltip($tooltip, $options); } else { $html[] = ' ' . $previewImgEmpty; $html[] = ' ' . $previewImg; } $html[] = '</div>'; } $html[] = ' <input type="text" class="input-small" name="' . $this->name . '" id="' . $this->id . '"' . ' value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '"' . ' readonly="readonly"' . $attr . ' />'; $directory = (string) $this->element['directory']; if ($this->value && file_exists(JPATH_ROOT . '/' . $this->value)) { $folder = explode('/', $this->value); array_diff_assoc($folder, explode('/', JComponentHelper::getParams('com_media')->get('image_path', 'images'))); array_pop($folder); $folder = implode('/', $folder); } elseif (file_exists(JPATH_ROOT . '/' . JComponentHelper::getParams('com_media')->get('image_path', 'images') . '/' . $directory)) { $folder = $directory; } else { $folder = ''; } // The button. if ($this->element['disabled'] != true) { JHtml::_('bootstrap.tooltip'); $html[] = '<a class="modal btn" title="' . JText::_('JLIB_FORM_BUTTON_SELECT') . '"' . ' href="' . ($this->element['readonly'] ? '' : ($link ? $link : 'index.php?option=com_media&view=images&tmpl=component&asset=' . $asset . '&author=' . $this->form->getValue($authorField)) . '&fieldid=' . $this->id . '&folder=' . $folder) . '"' . ' rel="{handler: \'iframe\', size: {x: 800, y: 500}}">'; $html[] = JText::_('JLIB_FORM_BUTTON_SELECT') . '</a><a class="btn hasTooltip" title="' . JText::_('JLIB_FORM_BUTTON_CLEAR') . '"' . ' href="#" onclick="'; $html[] = 'jInsertFieldValue(\'\', \'' . $this->id . '\');'; $html[] = 'return false;'; $html[] = '">'; $html[] = '<i class="icon-remove"></i></a>'; } $html[] = '</div>'; return implode("\n", $html); }
$textdiv .= '<div class="jlplplaneleaguename">'; $textdiv .= $match->project_name; $textdiv .= '</div>'; } if ($params->get('show_league_name', 0)) { $textdiv .= '<div class="jlplplaneleaguename">'; $textdiv .= $match->league_name; $textdiv .= '</div>'; } $textdiv .= '<div>'; $textdiv .= '<div class="jlplplanetname">'; if ($params->get('show_club_logo')) { $team1logo = modJLGPlaygroundplanHelper::getTeamLogo($match->team1); $textdiv .= '<p>' . JHtml::image($team1logo, "") . '</p>'; } $textdiv .= '<p>' . modJLGPlaygroundplanHelper::getTeams($match->team1, $teamformat) . '</p>'; $textdiv .= '</div>'; $textdiv .= '<div class="jlplplanetnamesep"> - </div>'; $textdiv .= '<div class="jlplplanetname">'; if ($params->get('show_club_logo')) { $team2logo = modJLGPlaygroundplanHelper::getTeamLogo($match->team2); $textdiv .= '<p>' . JHtml::image($team2logo, "") . '</p>'; } $textdiv .= '<p>' . modJLGPlaygroundplanHelper::getTeams($match->team2, $teamformat) . '</p>'; $textdiv .= '</div>'; $textdiv .= '</div>'; $textdiv .= '<div style="clear:both"></div>'; $textdiv .= '</div>'; } echo $textdiv; echo '</div>';
if ($stockhandle == 'risetime' and VmConfig::get('rised_availability') and empty($product->product_availability)) { ?> <div class="availability"> <?php echo file_exists(JPATH_BASE . DS . VmConfig::get('assets_general_path') . 'images/availability/' . VmConfig::get('rised_availability')) ? JHtml::image(JURI::root() . VmConfig::get('assets_general_path') . 'images/availability/' . VmConfig::get('rised_availability', '7d.gif'), VmConfig::get('rised_availability', '7d.gif'), array('class' => 'availability')) : vmText::_(VmConfig::get('rised_availability')); ?> </div> <?php } else { if (!empty($product->product_availability)) { ?> <div class="availability"> <?php echo file_exists(JPATH_BASE . DS . VmConfig::get('assets_general_path') . 'images/availability/' . $product->product_availability) ? JHtml::image(JURI::root() . VmConfig::get('assets_general_path') . 'images/availability/' . $product->product_availability, $product->product_availability, array('class' => 'availability')) : vmText::_($product->product_availability); ?> </div> <?php } } } } else { if ($product_available_date != '0000-00-00' and $current_date < $product_available_date) { ?> <div class="availability"> <?php echo vmText::_('COM_VIRTUEMART_PRODUCT_AVAILABLE_DATE') . ': ' . JHtml::_('date', $product->product_available_date, vmText::_('DATE_FORMAT_LC4')); ?>
/** * returns html for events in tabs * @param object match * @param array project events * @param array match events * @param aray match substitutions * @param array $config * @return string */ function showEventsContainerInResults($matchInfo, $projectevents, $matchevents, $substitutions = null, $config) { $output = ''; if ($this->config['use_tabs_events']) { // Make event tabs with JPane integrated function in Joomla 1.5 API $iPanel = 1; echo JHtml::_('tabs.start', 'tabs', array('useCookie' => 1)); // Size of the event icons in the tabs (when used) $width = 20; $height = 20; $type = 4; // Never show event text or icon for each event list item (info already available in tab) $showEventInfo = 0; $cnt = 0; foreach ($projectevents as $event) { //display only tabs with events foreach ($matchevents as $me) { $cnt = 0; if ($me->event_type_id == $event->id) { $cnt++; break; } } if ($cnt == 0) { continue; } if ($this->config['show_events_with_icons'] == 1) { // Event icon as thumbnail on the tab (a placeholder icon is used when the icon does not exist) $imgTitle = JText::_($event->name); $tab_content = JoomleagueHelper::getPictureThumb($event->icon, $imgTitle, $width, $height, $type); } else { $tab_content = JText::_($event->name); } $output .= JHtml::_('tabs.panel', $tab_content, 'panel' . $iPanel++); $output .= '<table class="matchreport" border="0">'; $output .= '<tr>'; // Home team events $output .= '<td class="list">'; $output .= '<ul>'; foreach ($matchevents as $me) { $output .= self::_formatEventContainerInResults($me, $event, $matchInfo->projectteam1_id, $showEventInfo); } $output .= '</ul>'; $output .= '</td>'; // Away team events $output .= '<td class="list">'; $output .= '<ul>'; foreach ($matchevents as $me) { $output .= self::_formatEventContainerInResults($me, $event, $matchInfo->projectteam2_id, $showEventInfo); } $output .= '</ul>'; $output .= '</td>'; $output .= '</tr>'; $output .= '</table>'; } if (!empty($substitutions)) { if ($this->config['show_events_with_icons'] == 1) { // Event icon as thumbnail on the tab (a placeholder icon is used when the icon does not exist) $imgTitle = JText::_('COM_JOOMLEAGUE_IN_OUT'); $pic_tab = 'images/com_joomleague/database/events/' . $this->project->fs_sport_type_name . '/subst.png'; $tab_content = JoomleagueHelper::getPictureThumb($pic_tab, $imgTitle, $width, $height, $type); } else { $tab_content = JText::_('COM_JOOMLEAGUE_IN_OUT'); } $pic_time = 'images/com_joomleague/database/events/' . $this->project->fs_sport_type_name . '/playtime.gif'; $pic_out = 'images/com_joomleague/database/events/' . $this->project->fs_sport_type_name . '/out.png'; $pic_in = 'images/com_joomleague/database/events/' . $this->project->fs_sport_type_name . '/in.png'; $imgTime = JHtml::image($pic_time, JText::_('COM_JOOMLEAGUE_MATCHREPORT_SUBSTITUTION_MINUTE'), array(' title' => JText::_('COM_JOOMLEAGUE_MATCHREPORT_SUBSTITUTION_MINUTE'))); $imgOut = JHtml::image($pic_out, JText::_('COM_JOOMLEAGUE_MATCHREPORT_SUBSTITUTION_WENT_OUT'), array(' title' => JText::_('COM_JOOMLEAGUE_MATCHREPORT_SUBSTITUTION_WENT_OUT'))); $imgIn = JHtml::image($pic_in, JText::_('COM_JOOMLEAGUE_MATCHREPORT_SUBSTITUTION_CAME_IN'), array(' title' => JText::_('COM_JOOMLEAGUE_MATCHREPORT_SUBSTITUTION_CAME_IN'))); $output .= JHtml::_('tabs.panel', $tab_content, 'panel' . $iPanel++); $output .= '<table class="matchreport" border="0">'; $output .= '<tr>'; $output .= '<td class="list">'; $output .= '<ul>'; foreach ($substitutions as $subs) { $output .= self::_formatSubstitutionContainerInResults($subs, $matchInfo->projectteam1_id, $imgTime, $imgOut, $imgIn); } $output .= '</ul>'; $output .= '</td>'; $output .= '<td class="list">'; $output .= '<ul>'; foreach ($substitutions as $subs) { $output .= self::_formatSubstitutionContainerInResults($subs, $matchInfo->projectteam2_id, $imgTime, $imgOut, $imgIn); } $output .= '</ul>'; $output .= '</td>'; $output .= '</tr>'; $output .= '</table>'; } echo JHtml::_('tabs.end'); } else { $showEventInfo = $this->config['show_events_with_icons'] == 1 ? 1 : 2; $output .= '<table class="matchreport" border="0">'; $output .= '<tr>'; // Home team events $output .= '<td class="list-left">'; $output .= '<ul>'; foreach ((array) $matchevents as $me) { if ($me->ptid == $matchInfo->projectteam1_id) { $output .= self::_formatEventContainerInResults($me, $projectevents[$me->event_type_id], $matchInfo->projectteam1_id, $showEventInfo); } } $output .= '</ul>'; $output .= '</td>'; // Away team events $output .= '<td class="list-right">'; $output .= '<ul>'; foreach ($matchevents as $me) { if ($me->ptid == $matchInfo->projectteam2_id) { $output .= self::_formatEventContainerInResults($me, $projectevents[$me->event_type_id], $matchInfo->projectteam2_id, $showEventInfo); } } $output .= '</ul>'; $output .= '</td>'; $output .= '</tr>'; $output .= '</table>'; } return $output; }
?> </td> </tr> <?php } if ($this->config['show_player_number'] && isset($this->teamPlayer->jerseynumber) && $this->teamPlayer->jerseynumber > 0) { ?> <tr> <td class=""><span class="label"><?php echo JText::_('COM_JOOMLEAGUE_PERSON_NUMBER'); ?> </span></td> <td class="data"><?php if ($this->config['player_number_picture']) { $posnumber = $this->teamPlayer->jerseynumber; echo JHtml::image('components/com_joomleague/helpers/shirt.php?text=' . $posnumber . '&picpath=' . urlencode($this->config['player_numbers_picture']), $posnumber, array('title' => $posnumber)); } else { echo $this->teamPlayer->jerseynumber; } ?> </td> </tr> <?php } if (isset($this->teamPlayer->position_id) && $this->teamPlayer->position_id != "") { ?> <tr> <td class=""><span class="label"><?php echo JText::_('COM_JOOMLEAGUE_PERSON_ROSTERPOSITION'); ?> </span></td>
<?php defined('_JEXEC') or die('Restricted access'); ?> <table class="contentpaneopen"> <tr> <td class="contentheading"> <?php echo $this->pagetitle; if ($this->showediticon) { $modalheight = JComponentHelper::getParams('com_joomleague')->get('modal_popup_height', 600); $modalwidth = JComponentHelper::getParams('com_joomleague')->get('modal_popup_width', 900); $link = JoomleagueHelperRoute::getPlayersRoute($this->project->id, $this->team->id, 'teamplayer.select', $this->projectteam->division_id, $this->projectteam->ptid); echo ' <a rel="{handler: \'iframe\',size: {x:' . $modalwidth . ',y:' . $modalheight . '}}" href="' . $link . '" class="modal">'; echo JHtml::image("media/com_joomleague/jl_images/edit.png", JText::_('COM_JOOMLEAGUE_ROSTER_EDIT'), array("title" => JText::_("COM_JOOMLEAGUE_ROSTER_EDIT"))); echo '</a>'; } ?> </td> </tr> </table> <br />
/** * Tests the image method. * * @return void * * @since 3.1 */ public function testImage() { // These are some paths to pass to JHtml for testing purposes. $urlpath = 'test1/'; $urlfilename = 'image1.jpg'; // We generate a random template name so that we don't collide or hit anything. $template = 'mytemplate' . rand(1, 10000); // We create a stub (not a mock because we don't enforce whether it is called or not) // to return a value from getTemplate. JFactory::$application->expects($this->any())->method('getTemplate')->will($this->returnValue($template)); // We create the file that JHtml::image will look for. if (!is_dir(JPATH_THEMES . '/' . $template . '/images/' . $urlpath)) { mkdir(JPATH_THEMES . '/' . $template . '/images/' . $urlpath, 0777, true); } file_put_contents(JPATH_THEMES . '/' . $template . '/images/' . $urlpath . $urlfilename, 'test'); // We do a test for the case that the image is in the templates directory. $this->assertEquals(JHtml::image($urlpath . $urlfilename, 'My Alt Text', null, true), '<img src="' . JUri::base(true) . '/templates/' . $template . '/images/' . $urlpath . $urlfilename . '" alt="My Alt Text" />', 'JHtml::image failed when we should get it from the templates directory'); $this->assertEquals(JHtml::image($urlpath . $urlfilename, 'My Alt Text', null, true, true), JUri::base(true) . '/templates/' . $template . '/images/' . $urlpath . $urlfilename, 'JHtml::image failed in URL only mode when it should come from the templates directory'); unlink(JPATH_THEMES . '/' . $template . '/images/' . $urlpath . $urlfilename); rmdir(JPATH_THEMES . '/' . $template . '/images/' . $urlpath); rmdir(JPATH_THEMES . '/' . $template . '/images'); rmdir(JPATH_THEMES . '/' . $template); // We create the file that JHtml::image will look for. if (!is_dir(dirname(JPATH_ROOT . '/media/' . $urlpath . 'images/' . $urlfilename))) { mkdir(dirname(JPATH_ROOT . '/media/' . $urlpath . 'images/' . $urlfilename), 0777, true); } file_put_contents(JPATH_ROOT . '/media/' . $urlpath . 'images/' . $urlfilename, 'test'); // We do a test for the case that the image is in the media directory. $this->assertEquals(JHtml::image($urlpath . $urlfilename, 'My Alt Text', null, true), '<img src="' . JUri::base(true) . '/media/' . $urlpath . 'images/' . $urlfilename . '" alt="My Alt Text" />', 'JHtml::image failed when we should get it from the media directory'); $this->assertEquals(JHtml::image($urlpath . $urlfilename, 'My Alt Text', null, true, true), JUri::base(true) . '/media/' . $urlpath . 'images/' . $urlfilename, 'JHtml::image failed when we should get it from the media directory in path only mode'); unlink(JPATH_ROOT . '/media/' . $urlpath . 'images/' . $urlfilename); rmdir(JPATH_ROOT . '/media/' . $urlpath . 'images'); rmdir(JPATH_ROOT . '/media/' . $urlpath); // We create the file that JHtml::image will look for. if (!is_dir(dirname(JPATH_ROOT . '/media/system/images/' . $urlfilename))) { mkdir(dirname(JPATH_ROOT . '/media/system/images/' . $urlfilename), 0777, true); } file_put_contents(JPATH_ROOT . '/media/system/images/' . $urlfilename, 'test'); $this->assertEquals(JHtml::image($urlpath . $urlfilename, 'My Alt Text', null, true), '<img src="' . JUri::base(true) . '/media/system/images/' . $urlfilename . '" alt="My Alt Text" />', 'JHtml::image failed when we should get it from the media directory'); $this->assertEquals(JHtml::image($urlpath . $urlfilename, 'My Alt Text', null, true, true), JUri::base(true) . '/media/system/images/' . $urlfilename, 'JHtml::image failed when we should get it from the media directory in path only mode'); unlink(JPATH_ROOT . '/media/system/images/' . $urlfilename); $this->assertEquals(JHtml::image($urlpath . $urlfilename, 'My Alt Text', null, true), '<img src="" alt="My Alt Text" />', 'JHtml::image failed when we should get it from the media directory'); $this->assertNull(JHtml::image($urlpath . $urlfilename, 'My Alt Text', null, true, true), 'JHtml::image failed when we should get it from the media directory in path only mode'); $extension = 'testextension'; $element = 'element'; $urlpath = 'path1/'; $urlfilename = 'image1.jpg'; mkdir(JPATH_ROOT . '/media/' . $extension . '/' . $element . '/images/' . $urlpath, 0777, true); file_put_contents(JPATH_ROOT . '/media/' . $extension . '/' . $element . '/images/' . $urlpath . $urlfilename, 'test'); $this->assertEquals(JHtml::image($extension . '/' . $element . '/' . $urlpath . $urlfilename, 'My Alt Text', null, true), '<img src="' . JUri::base(true) . '/media/' . $extension . '/' . $element . '/images/' . $urlpath . $urlfilename . '" alt="My Alt Text" />', 'JHtml::image failed when we should get it from the media directory, with the plugin fix'); $this->assertEquals(JHtml::image($extension . '/' . $element . '/' . $urlpath . $urlfilename, 'My Alt Text', null, true, true), JUri::base(true) . '/media/' . $extension . '/' . $element . '/images/' . $urlpath . $urlfilename, 'JHtml::image failed when we should get it from the media directory, with the plugin fix path only mode'); // We remove the file from the media directory. unlink(JPATH_ROOT . '/media/' . $extension . '/' . $element . '/images/' . $urlpath . $urlfilename); rmdir(JPATH_ROOT . '/media/' . $extension . '/' . $element . '/images/' . $urlpath); rmdir(JPATH_ROOT . '/media/' . $extension . '/' . $element . '/images'); rmdir(JPATH_ROOT . '/media/' . $extension . '/' . $element); rmdir(JPATH_ROOT . '/media/' . $extension); mkdir(JPATH_ROOT . '/media/' . $extension . '/images/' . $element . '/' . $urlpath, 0777, true); file_put_contents(JPATH_ROOT . '/media/' . $extension . '/images/' . $element . '/' . $urlpath . $urlfilename, 'test'); $this->assertEquals(JHtml::image($extension . '/' . $element . '/' . $urlpath . $urlfilename, 'My Alt Text', null, true), '<img src="' . JUri::base(true) . '/media/' . $extension . '/images/' . $element . '/' . $urlpath . $urlfilename . '" alt="My Alt Text" />'); $this->assertEquals(JHtml::image($extension . '/' . $element . '/' . $urlpath . $urlfilename, 'My Alt Text', null, true, true), JUri::base(true) . '/media/' . $extension . '/images/' . $element . '/' . $urlpath . $urlfilename); unlink(JPATH_ROOT . '/media/' . $extension . '/images/' . $element . '/' . $urlpath . $urlfilename); rmdir(JPATH_ROOT . '/media/' . $extension . '/images/' . $element . '/' . $urlpath); rmdir(JPATH_ROOT . '/media/' . $extension . '/images/' . $element); rmdir(JPATH_ROOT . '/media/' . $extension . '/images'); rmdir(JPATH_ROOT . '/media/' . $extension); mkdir(JPATH_ROOT . '/media/system/images/' . $element . '/' . $urlpath, 0777, true); file_put_contents(JPATH_ROOT . '/media/system/images/' . $element . '/' . $urlpath . $urlfilename, 'test'); $this->assertEquals(JHtml::image($extension . '/' . $element . '/' . $urlpath . $urlfilename, 'My Alt Text', null, true), '<img src="' . JUri::base(true) . '/media/system/images/' . $element . '/' . $urlpath . $urlfilename . '" alt="My Alt Text" />'); $this->assertEquals(JHtml::image($extension . '/' . $element . '/' . $urlpath . $urlfilename, 'My Alt Text', null, true, true), JUri::base(true) . '/media/system/images/' . $element . '/' . $urlpath . $urlfilename); unlink(JPATH_ROOT . '/media/system/images/' . $element . '/' . $urlpath . $urlfilename); rmdir(JPATH_ROOT . '/media/system/images/' . $element . '/' . $urlpath); rmdir(JPATH_ROOT . '/media/system/images/' . $element); $this->assertEquals(JHtml::image($extension . '/' . $element . '/' . $urlpath . $urlfilename, 'My Alt Text', null, true), '<img src="" alt="My Alt Text" />'); $this->assertNull(JHtml::image($extension . '/' . $element . '/' . $urlpath . $urlfilename, 'My Alt Text', null, true, true)); $this->assertEquals(JHtml::image('http://www.example.com/test/image.jpg', 'My Alt Text', array('width' => 150, 'height' => 150)), '<img src="http://www.example.com/test/image.jpg" alt="My Alt Text" width="150" height="150" />', 'JHtml::image with an absolute path'); mkdir(JPATH_ROOT . '/test', 0777, true); file_put_contents(JPATH_ROOT . '/test/image.jpg', 'test'); $this->assertEquals(JHtml::image('test/image.jpg', 'My Alt Text', array('width' => 150, 'height' => 150), false), '<img src="' . JUri::root(true) . '/test/image.jpg" alt="My Alt Text" width="150" height="150" />', 'JHtml::image with an absolute path, URL does not start with http'); unlink(JPATH_ROOT . '/test/image.jpg'); rmdir(JPATH_ROOT . '/test'); $this->assertEquals(JHtml::image('test/image.jpg', 'My Alt Text', array('width' => 150, 'height' => 150), false), '<img src="" alt="My Alt Text" width="150" height="150" />', 'JHtml::image with an absolute path, URL does not start with http'); }
echo JHtml::image('images/com_joomleague/database/events/' . $this->project->fs_sport_type_name . '/playtime.gif', $imageTitle, array('title' => $imageTitle)); ?> </th> <?php } } if ($this->config['show_career_events_stats']) { if (count($this->AllEvents)) { foreach ($this->AllEvents as $eventtype) { ?> <th class="td_c"><?php $iconPath = $eventtype->icon; if (!strpos(" " . $iconPath, "/")) { $iconPath = "images/com_joomleague/database/events/" . $iconPath; } echo JHtml::image($iconPath, JText::_($eventtype->name), array("title" => JText::_($eventtype->name), "align" => "top", "hspace" => "2")); ?> </th> <?php } } } if ($this->config['show_career_stats']) { foreach ($this->stats as $stat) { //do not show statheader when there are no stats if (!empty($stat)) { if ($stat->showInPlayer()) { ?> <th class="td_c"><?php echo !empty($stat) ? $stat->getImage() : ""; ?>
/** * testImage(). * * @return void * * @since 11.1 */ public function testImage() { if (!is_array($_SERVER)) { $_SERVER = array(); } // we save the state of $_SERVER for later and set it to appropriate values $http_host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : null; $script_name = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : null; $_SERVER['HTTP_HOST'] = 'example.com'; $_SERVER['SCRIPT_NAME'] = '/index.php'; // these are some paths to pass to JHtml for testing purposes $urlpath = 'test1/'; $urlfilename = 'image1.jpg'; // we generate a random template name so that we don't collide or hit anything $template = 'mytemplate' . rand(1, 10000); // we create a stub (not a mock because we don't enforce whether it is called or not) // to return a value from getTemplate $mock = $this->getMock('myMockObject', array('getTemplate')); $mock->expects($this->any())->method('getTemplate')->will($this->returnValue($template)); JFactory::$application = $mock; // we create the file that JHtml::image will look for mkdir(JPATH_THEMES . '/' . $template . '/images/' . $urlpath, 0777, true); file_put_contents(JPATH_THEMES . '/' . $template . '/images/' . $urlpath . $urlfilename, 'test'); // we do a test for the case that the image is in the templates directory $this->assertThat(JHtml::image($urlpath . $urlfilename, 'My Alt Text', null, true), $this->equalTo('<img src="' . JURI::base(true) . '/templates/' . $template . '/images/' . $urlpath . $urlfilename . '" alt="My Alt Text" />'), 'JHtml::image failed when we should get it from the templates directory'); $this->assertThat(JHtml::image($urlpath . $urlfilename, 'My Alt Text', null, true, true), $this->equalTo(JURI::base(true) . '/templates/' . $template . '/images/' . $urlpath . $urlfilename), 'JHtml::image failed in URL only mode when it should come from the templates directory'); unlink(JPATH_THEMES . '/' . $template . '/images/' . $urlpath . $urlfilename); rmdir(JPATH_THEMES . '/' . $template . '/images/' . $urlpath); rmdir(JPATH_THEMES . '/' . $template . '/images'); rmdir(JPATH_THEMES . '/' . $template); // we create the file that JHtml::image will look for if (!is_dir(dirname(JPATH_ROOT . '/media/' . $urlpath . 'images/' . $urlfilename))) { mkdir(dirname(JPATH_ROOT . '/media/' . $urlpath . 'images/' . $urlfilename), 0777, true); } file_put_contents(JPATH_ROOT . '/media/' . $urlpath . 'images/' . $urlfilename, 'test'); // we do a test for the case that the image is in the media directory $this->assertThat(JHtml::image($urlpath . $urlfilename, 'My Alt Text', null, true), $this->equalTo('<img src="' . JURI::base(true) . '/media/' . $urlpath . 'images/' . $urlfilename . '" alt="My Alt Text" />'), 'JHtml::image failed when we should get it from the media directory'); $this->assertThat(JHtml::image($urlpath . $urlfilename, 'My Alt Text', null, true, true), $this->equalTo(JURI::base(true) . '/media/' . $urlpath . 'images/' . $urlfilename), 'JHtml::image failed when we should get it from the media directory in path only mode'); unlink(JPATH_ROOT . '/media/' . $urlpath . 'images/' . $urlfilename); rmdir(JPATH_ROOT . '/media/' . $urlpath . 'images'); rmdir(JPATH_ROOT . '/media/' . $urlpath); // we create the file that JHtml::image will look for if (!is_dir(dirname(JPATH_ROOT . '/media/system/images/' . $urlfilename))) { mkdir(dirname(JPATH_ROOT . '/media/system/images/' . $urlfilename), 0777, true); } file_put_contents(JPATH_ROOT . '/media/system/images/' . $urlfilename, 'test'); $this->assertThat(JHtml::image($urlpath . $urlfilename, 'My Alt Text', null, true), $this->equalTo('<img src="' . JURI::base(true) . '/media/system/images/' . $urlfilename . '" alt="My Alt Text" />'), 'JHtml::image failed when we should get it from the media directory'); $this->assertThat(JHtml::image($urlpath . $urlfilename, 'My Alt Text', null, true, true), $this->equalTo(JURI::base(true) . '/media/system/images/' . $urlfilename), 'JHtml::image failed when we should get it from the media directory in path only mode'); unlink(JPATH_ROOT . '/media/system/images/' . $urlfilename); $this->assertThat(JHtml::image($urlpath . $urlfilename, 'My Alt Text', null, true), $this->equalTo('<img src="" alt="My Alt Text" />'), 'JHtml::image failed when we should get it from the media directory'); $this->assertThat(JHtml::image($urlpath . $urlfilename, 'My Alt Text', null, true, true), $this->equalTo(null), 'JHtml::image failed when we should get it from the media directory in path only mode'); $extension = 'testextension'; $element = 'element'; $urlpath = 'path1/'; $urlfilename = 'image1.jpg'; mkdir(JPATH_ROOT . '/media/' . $extension . '/' . $element . '/images/' . $urlpath, 0777, true); file_put_contents(JPATH_ROOT . '/media/' . $extension . '/' . $element . '/images/' . $urlpath . $urlfilename, 'test'); $this->assertThat(JHtml::image($extension . '/' . $element . '/' . $urlpath . $urlfilename, 'My Alt Text', null, true), $this->equalTo('<img src="' . JURI::base(true) . '/media/' . $extension . '/' . $element . '/images/' . $urlpath . $urlfilename . '" alt="My Alt Text" />'), 'JHtml::image failed when we should get it from the media directory, with the plugin fix'); $this->assertThat(JHtml::image($extension . '/' . $element . '/' . $urlpath . $urlfilename, 'My Alt Text', null, true, true), $this->equalTo(JURI::base(true) . '/media/' . $extension . '/' . $element . '/images/' . $urlpath . $urlfilename), 'JHtml::image failed when we should get it from the media directory, with the plugin fix path only mode'); // we remove the file from the media directory unlink(JPATH_ROOT . '/media/' . $extension . '/' . $element . '/images/' . $urlpath . $urlfilename); rmdir(JPATH_ROOT . '/media/' . $extension . '/' . $element . '/images/' . $urlpath); rmdir(JPATH_ROOT . '/media/' . $extension . '/' . $element . '/images'); rmdir(JPATH_ROOT . '/media/' . $extension . '/' . $element); rmdir(JPATH_ROOT . '/media/' . $extension); mkdir(JPATH_ROOT . '/media/' . $extension . '/images/' . $element . '/' . $urlpath, 0777, true); file_put_contents(JPATH_ROOT . '/media/' . $extension . '/images/' . $element . '/' . $urlpath . $urlfilename, 'test'); $this->assertThat(JHtml::image($extension . '/' . $element . '/' . $urlpath . $urlfilename, 'My Alt Text', null, true), $this->equalTo('<img src="' . JURI::base(true) . '/media/' . $extension . '/images/' . $element . '/' . $urlpath . $urlfilename . '" alt="My Alt Text" />')); $this->assertThat(JHtml::image($extension . '/' . $element . '/' . $urlpath . $urlfilename, 'My Alt Text', null, true, true), $this->equalTo(JURI::base(true) . '/media/' . $extension . '/images/' . $element . '/' . $urlpath . $urlfilename)); unlink(JPATH_ROOT . '/media/' . $extension . '/images/' . $element . '/' . $urlpath . $urlfilename); rmdir(JPATH_ROOT . '/media/' . $extension . '/images/' . $element . '/' . $urlpath); rmdir(JPATH_ROOT . '/media/' . $extension . '/images/' . $element); rmdir(JPATH_ROOT . '/media/' . $extension . '/images'); rmdir(JPATH_ROOT . '/media/' . $extension); mkdir(JPATH_ROOT . '/media/system/images/' . $element . '/' . $urlpath, 0777, true); file_put_contents(JPATH_ROOT . '/media/system/images/' . $element . '/' . $urlpath . $urlfilename, 'test'); $this->assertThat(JHtml::image($extension . '/' . $element . '/' . $urlpath . $urlfilename, 'My Alt Text', null, true), $this->equalTo('<img src="' . JURI::base(true) . '/media/system/images/' . $element . '/' . $urlpath . $urlfilename . '" alt="My Alt Text" />')); $this->assertThat(JHtml::image($extension . '/' . $element . '/' . $urlpath . $urlfilename, 'My Alt Text', null, true, true), $this->equalTo(JURI::base(true) . '/media/system/images/' . $element . '/' . $urlpath . $urlfilename)); unlink(JPATH_ROOT . '/media/system/images/' . $element . '/' . $urlpath . $urlfilename); rmdir(JPATH_ROOT . '/media/system/images/' . $element . '/' . $urlpath); rmdir(JPATH_ROOT . '/media/system/images/' . $element); $this->assertThat(JHtml::image($extension . '/' . $element . '/' . $urlpath . $urlfilename, 'My Alt Text', null, true), $this->equalTo('<img src="" alt="My Alt Text" />')); $this->assertThat(JHtml::image($extension . '/' . $element . '/' . $urlpath . $urlfilename, 'My Alt Text', null, true, true), $this->equalTo(null)); $this->assertThat(JHtml::image('http://www.example.com/test/image.jpg', 'My Alt Text', array('width' => 150, 'height' => 150)), $this->equalTo('<img src="http://www.example.com/test/image.jpg" alt="My Alt Text" width="150" height="150" />'), 'JHtml::image with an absolute path'); mkdir(JPATH_ROOT . '/test', 0777, true); file_put_contents(JPATH_ROOT . '/test/image.jpg', 'test'); $this->assertThat(JHtml::image('test/image.jpg', 'My Alt Text', array('width' => 150, 'height' => 150), false), $this->equalTo('<img src="' . JURI::root(true) . '/test/image.jpg" alt="My Alt Text" width="150" height="150" />'), 'JHtml::image with an absolute path, URL does not start with http'); unlink(JPATH_ROOT . '/test/image.jpg'); rmdir(JPATH_ROOT . '/test'); $this->assertThat(JHtml::image('test/image.jpg', 'My Alt Text', array('width' => 150, 'height' => 150), false), $this->equalTo('<img src="" alt="My Alt Text" width="150" height="150" />'), 'JHtml::image with an absolute path, URL does not start with http'); $_SERVER['HTTP_HOST'] = $http_host; $_SERVER['SCRIPT_NAME'] = $script_name; }
/** * Show image for com_users. */ public static function showImage($value) { if ($value) { return JHtml::image($value, 'image'); } }