Example #1
0
/**
 * Zikula_View modifier to turn a boolean value into a suitable language string
 *
 * Example
 *
 *   {$myvar|yesno|safetext} returns Yes if $myvar = 1 and No if $myvar = 0
 *
 * @param string  $string The contents to transform.
 * @param boolean $images Display the yes/no response as tick/cross.
 *
 * @return string Rhe modified output.
 */
function smarty_modifier_yesno($string, $images = false)
{
    if ($string != '0' && $string != '1') {
        return $string;
    }
    if ($images) {
        $view = Zikula_View::getInstance();
        require_once $view->_get_plugin_filepath('function', 'img');
        $params = array('modname' => 'core', 'set' => 'icons/extrasmall');
    }
    if ((bool) $string) {
        if ($images) {
            $params['src'] = 'button_ok.png';
            $params['alt'] = $params['title'] = __('Yes');
            return smarty_function_img($params, $view);
        } else {
            return __('Yes');
        }
    } else {
        if ($images) {
            $params['src'] = 'button_cancel.png';
            $params['alt'] = $params['title'] = __('No');
            return smarty_function_img($params, $view);
        } else {
            return __('No');
        }
    }
}
Example #2
0
 public function testBackgroundImageData()
 {
     $smarty = new Smarty();
     $render = new CM_Frontend_Render();
     $template = $smarty->createTemplate('string:');
     $template->assignGlobal('render', $render);
     $html = '<img src="https://example.com/img/foo.png" style="background-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)" class="background-cover" width="456" height="123" />';
     $this->assertSame($html, smarty_function_img(['path' => 'https://example.com/img/foo.png', 'width' => 456, 'height' => 123, 'background-image' => 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'], $template));
 }
function smarty_block_swiper__slide($params, $content = '', $template, &$repeat)
{
    if ($repeat) {
        \Clips\clips_context('indent_level', 1, true);
        return;
    }
    $default = array('class' => 'swiper-slide');
    $dataImage = \Clips\get_default($params, 'data-image', null);
    $paginationImage = \Clips\get_default($params, 'data-pagination-image', null);
    $responsive = \Clips\get_default($params, 'responsive', false);
    $image = '';
    if ($dataImage) {
        if ($responsive == "true") {
            $image = smarty_function_resimg(array('data-image' => $dataImage, 'data-pagination-src' => $paginationImage), $template);
        } else {
            $image = smarty_function_img(array('src' => $dataImage, 'data-pagination-src' => $dataImage), $template);
        }
        unset($params['data-image']);
        unset($params['data-pagination-image']);
        unset($params['responsive']);
    }
    \Clips\context_pop('indent_level');
    return \Clips\create_tag('div', $params, $default, $image . $content);
}
Example #4
0
function smarty_block_qrcode($params, $content = '', $template, &$repeat)
{
    if ($repeat) {
        return;
    }
    $config = Clips\get_default($params, 'config');
    if ($config) {
        $arr = array();
        foreach ($config as $k => $v) {
            $arr[] = $k . '=' . urlencode($v);
        }
        $params['data-pattern'] = 'qr/generate/_(img)?size=_(size)&' . implode('&', $arr);
    } else {
        $params['data-pattern'] = 'qr/generate/_(img)?size=_(size)';
    }
    $params['data-image'] = str_replace('%2f', '%252F', str_replace('%2F', '%252F', urlencode($content)));
    $width = Clips\get_default($params, 'width');
    $div = array('class' => 'responsive');
    if ($width) {
        unset($params['width']);
        $div['style'] = 'width:' . $width . 'px;';
    }
    return Clips\create_tag_with_content('div', smarty_function_img($params, $template), $div);
}
/**
 * Display an core image form submission button using either the <button> or the <input> HTML element.
 *
 * This tag calls the img tag to determine the full path of the image
 * for the src attribute of the img element within the button element, or
 * for the src attribute of the input element.
 *
 * <i>BEWARE: Internt Explorer 6.x does NOT work especially well with <button> tags!</i>
 *
 * Available attributes:
 *  - src       (string)    The file name of the image. The full path of the image
 *                          will be determined by the smarty_function_img function.
 *  - set       (string)    The name of the image set from which to retrieve the
 *                          image file (the name of a subdirectory under /images/icons).
 *  - mode      (string)    if set, the type of HTML element to be used (optional,
 *                          default: button). Values = [button|input]
 *  - type      (string)    if set, the type of button that will be generated
 *                          (optional, default: submit, used only if mode is set to 'button')
 *  - name      (string)    if set, the name of button that will be generated as
 *                          the name attribute on the button or input element
 *                          (optional, default: value of 'type' parameter)
 *  - value     (string)    if set, the value that will be generated as the
 *                          value attribute on the button or input element (optional,
 *                          however should be set if mode is input)
 *  - id        (string)    if set, the value of the id attribute on the button
 *                          or input element (optional)
 *  - class     (string)    if set, the value of the class attribute on the
 *                          button or input element (optional)
 *  - alt       (string)    if set, the value for the alt attribute. If mode is
 *                          'button' then the alt attribute is generated for
 *                          the img element embedded in the button element. If
 *                          mode is 'input' then the alt attribute is generated
 *                          for the input element. (optional)
 *  - title     (string)    if set, the value for the title attribute of the
 *                          button or input element. (optional)
 *  - text      (string)    if set, the button tag surrounds this string
 *  - assign    (string)    If set, the results are assigned to the corresponding
 *                          template variable instead of being returned to the template (optional)
 *
 * Examples:
 *
 * Display a submit button with button_ok.png (a green check mark) from the set of
 * small icons (/images/icons/small) with the <button ...> HTML element.
 *
 * <samp>{button src='button_ok.png' set='small'}</samp>
 *
 * Display a cancel button with button_cancel.png (a red 'X') from the set of
 * extra small icons (/images/icons/extrasmall) with the <button ...> HTML element.
 *
 * <samp>{button src='button_cancel.png' set='extrasmall' type='cancel'}</samp>
 *
 * Display a submit button with button_cancel.png (a red 'X') from the set of
 * medium icons (/images/icons/medium) and a value of
 * 'cancel' with the <input ...> HTML element. The id attribute of the input
 * element is set to 'cancelbutton'.
 *
 * <samp>{button src='button_cancel.png' set='medium' mode='input' value='cancel' id='cancelbutton'}</samp>
 *
 * @param array       $params All attributes passed to this function from the template.
 * @param Zikula_View $view   Reference to the {@link Zikula_View} object.
 *
 * @return string The rendered <button ...><img ...></button> or <input ...>
 *                element for the form button.
 */
function smarty_function_button($params, Zikula_View $view)
{
    // we're going to make use of pnimg for path searching
    require_once $view->_get_plugin_filepath('function', 'img');
    if (!isset($params['src'])) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('smarty_function_button', 'src')));
        return false;
    }
    if (!isset($params['set'])) {
        $view->trigger_error(__f('Error! in %1$s: the %2$s parameter must be specified.', array('smarty_function_button', 'set')));
        return false;
    }
    $type = isset($params['type']) ? $params['type'] : 'submit';
    $mode = isset($params['mode']) ? $params['mode'] : 'button';
    if (isset($params['name'])) {
        $name = ' name="' . DataUtil::formatForDisplay($params['name']) . '"';
    } else {
        $name = ' name="' . DataUtil::formatForDisplay($type) . '"';
    }
    if (isset($params['value'])) {
        $value = ' value="' . DataUtil::formatForDisplay($params['value']) . '"';
    } else {
        $value = '';
    }
    if (isset($params['id'])) {
        $id = ' id="' . DataUtil::formatForDisplay($params['id']) . '"';
    } else {
        $id = '';
    }
    if (isset($params['class'])) {
        $class = ' class="' . DataUtil::formatForDisplay($params['class']) . '"';
    } else {
        $class = '';
    }
    if (isset($params['text'])) {
        $text = ' ' . DataUtil::formatForDisplay($params['text']);
    } else {
        $text = '';
    }
    $title = isset($params['title']) ? $params['title'] : '';
    $alt = isset($params['alt']) ? $params['alt'] : '';
    // call the pnimg plugin and work out the src from the assigned template vars
    smarty_function_img(array('assign' => 'buttonsrc', 'src' => $params['src'], 'set' => $params['set'], 'modname' => 'core'), $view);
    $imgvars = $view->get_template_vars('buttonsrc');
    $imgsrc = $imgvars['src'];
    // form the button html
    if ($mode == 'button') {
        $return = '<button' . $id . $class . ' type="' . DataUtil::formatForDisplay($type) . '"' . $name . $value . ' title="' . DataUtil::formatForDisplay($title) . '"><img src="' . DataUtil::formatForDisplay($imgsrc) . '" alt="' . DataUtil::formatForDisplay($alt) . '" />' . $text . '</button>';
    } else {
        $return = '<input' . $id . $class . ' type="image"' . $name . $value . ' title="' . DataUtil::formatForDisplay($title) . '" src="' . DataUtil::formatForDisplay($imgsrc) . '" alt="' . DataUtil::formatForDisplay($alt) . '" />';
    }
    if (isset($params['assign'])) {
        $view->assign($params['assign'], $return);
    } else {
        return $return;
    }
}
<?php

/* Smarty version 2.6.26, created on 2015-12-13 16:27:46
   compiled from /home/illumin/public_html/application/view///backend/productImage/index.tpl */
require_once SMARTY_CORE_DIR . 'core.load_plugins.php';
smarty_core_load_plugins(array('plugins' => array(array('function', 'img', '/home/illumin/public_html/application/view///backend/productImage/index.tpl', 3, false), array('function', 'translate', '/home/illumin/public_html/application/view///backend/productImage/index.tpl', 10, false), array('function', 'filefield', '/home/illumin/public_html/application/view///backend/productImage/index.tpl', 44, false), array('function', 'maketext', '/home/illumin/public_html/application/view///backend/productImage/index.tpl', 45, false), array('function', 'textfield', '/home/illumin/public_html/application/view///backend/productImage/index.tpl', 52, false), array('function', 'link', '/home/illumin/public_html/application/view///backend/productImage/index.tpl', 107, false), array('block', 'denied', '/home/illumin/public_html/application/view///backend/productImage/index.tpl', 8, false), array('block', 'form', '/home/illumin/public_html/application/view///backend/productImage/index.tpl', 34, false), array('block', 'language', '/home/illumin/public_html/application/view///backend/productImage/index.tpl', 55, false), array('block', 'allowed', '/home/illumin/public_html/application/view///backend/productImage/index.tpl', 89, false), array('modifier', 'escape', '/home/illumin/public_html/application/view///backend/productImage/index.tpl', 64, false), array('modifier', 'addslashes', '/home/illumin/public_html/application/view///backend/productImage/index.tpl', 112, false))), $this);
?>
<ul style="display: none;">
	<li class="imageTemplate">
		<?php 
echo smarty_function_img(array('class' => 'image', 'src' => ""), $this);
?>

		<span class="imageTitle"></span>
	</li>
</ul>

<fieldset class="container" <?php 
$this->_tag_stack[] = array('denied', array('role' => "product.update"));
$_block_repeat = true;
smarty_block_denied($this->_tag_stack[count($this->_tag_stack) - 1][1], null, $this, $_block_repeat);
while ($_block_repeat) {
    ob_start();
    ?>
style="display: none"<?php 
    $_block_content = ob_get_contents();
    ob_end_clean();
    $_block_repeat = false;
    echo smarty_block_denied($this->_tag_stack[count($this->_tag_stack) - 1][1], $_block_content, $this, $_block_repeat);
}
array_pop($this->_tag_stack);
function smarty_function_resimg($params, $template)
{
    return Clips\create_tag_with_content('div', smarty_function_img($params, $template), array('class' => 'responsive'));
}
if (count($this->_tpl_vars['images']) > 0) {
    ?>
				<div class="hidden">
			<?php 
    $_from = $this->_tpl_vars['images'];
    if (!is_array($_from) && !is_object($_from)) {
        settype($_from, 'array');
    }
    if (count($_from)) {
        foreach ($_from as $this->_tpl_vars['image']) {
            ?>
				<a rel="lightbox[product]" href="<?php 
            echo $this->_tpl_vars['image']['paths']['4'];
            ?>
" target="_blank" onclick="return false;"><?php 
            echo smarty_function_img(array('src' => $this->_tpl_vars['image']['paths']['1'], 'id' => "img_" . $this->_tpl_vars['image']['ID'], 'alt' => is_array($_tmp = $this->_tpl_vars['image']['title_lang']) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp), 'onclick' => "return false;"), $this);
            ?>
</a>
			<?php 
        }
    }
    unset($_from);
    ?>
		</div>
	<?php 
}
?>
	
	
</div>
?>
');
	</script>

	<?php 
echo smarty_function_renderBlock(array('block' => 'TRANSLATIONS'), $this);
?>


</head>
<body>
<script type="text/javascript">
<?php 
echo '
	window.historyStorage.init();
	window.dhtmlHistory.create();
';
?>

</script>

<!-- Preload images -->
<?php 
echo smarty_function_img(array('src' => "image/silk/bullet_arrow_up.png", 'style' => "display: none", 'id' => 'bullet_arrow_up'), $this);
?>

<?php 
echo smarty_function_img(array('src' => "image/silk/bullet_arrow_down.png", 'style' => "display: none", 'id' => 'bullet_arrow_down'), $this);
?>

Example #10
0
 /**
  * Render event handler.
  *
  * @param Zikula_Form_View $view Reference to Zikula_Form_View object.
  *
  * @return string The rendered output
  */
 public function render(Zikula_Form_View $view)
 {
     $idHtml = $this->getIdHtml();
     $text = $view->translateForDisplay($this->text);
     $onclickHtml = '';
     if ($this->confirmMessage != null) {
         $msg = $view->translateForDisplay($this->confirmMessage) . '?';
         $onclickHtml = " onclick=\"return confirm('{$msg}');\"";
     }
     $imageHtml = '';
     if (isset($this->attributes['imgsrc']) && !empty($this->attributes['imgsrc'])) {
         if (!isset($this->attributes['imgset']) || empty($this->attributes['imgset'])) {
             $this->attributes['imgset'] = 'icons/extrasmall';
         }
         // we're going to make use of pnimg for path searching
         require_once $view->_get_plugin_filepath('function', 'img');
         // call the pnimg plugin and work out the src from the assigned template vars
         $args = array('src' => $this->attributes['imgsrc'], 'set' => $this->attributes['imgset'], 'title' => $text, 'alt' => $text, 'modname' => 'core');
         $imageHtml = smarty_function_img($args, $view);
         $imageHtml .= !empty($imageHtml) ? ' ' : '';
     }
     if (isset($this->attributes['imgsrc'])) {
         unset($this->attributes['imgsrc']);
     }
     if (isset($this->attributes['imgset'])) {
         unset($this->attributes['imgset']);
     }
     $attributes = $this->renderAttributes($view);
     $carg = serialize(array('cname' => $this->commandName, 'carg' => $this->commandArgument));
     $href = $view->getPostBackEventReference($this, $carg);
     $href = htmlspecialchars($href);
     $result = "<a{$idHtml} href=\"javascript:{$href}\"{$onclickHtml}{$attributes}>{$imageHtml}{$text}</a>";
     return $result;
 }
$_block_repeat = true;
smarty_block_denied($this->_tag_stack[count($this->_tag_stack) - 1][1], null, $this, $_block_repeat);
while ($_block_repeat) {
    ob_start();
    ?>
style="display: none"<?php 
    $_block_content = ob_get_contents();
    ob_end_clean();
    $_block_repeat = false;
    echo smarty_block_denied($this->_tag_stack[count($this->_tag_stack) - 1][1], $_block_content, $this, $_block_repeat);
}
array_pop($this->_tag_stack);
?>
>
												<?php 
echo smarty_function_img(array('src' => "image/silk/calendar.png", 'class' => 'calendar_button'), $this);
?>

											</span>

											<input type="hidden" class="hidden filter_date_start_real filter_update"  <?php 
$this->_tag_stack[] = array('denied', array('role' => "category.update"));
$_block_repeat = true;
smarty_block_denied($this->_tag_stack[count($this->_tag_stack) - 1][1], null, $this, $_block_repeat);
while ($_block_repeat) {
    ob_start();
    ?>
readonly="readonly"<?php 
    $_block_content = ob_get_contents();
    ob_end_clean();
    $_block_repeat = false;
"><?php 
        echo smarty_function_translate(array('text' => '_remove'), $this);
        ?>
</a>
		</td>

		<td class="cartImage">
			<?php 
        if ($this->_tpl_vars['item']['Product']['DefaultImage']['paths']['1']) {
            ?>
			<a href="<?php 
            echo smarty_function_productUrl(array('product' => $this->_tpl_vars['item']['Product']), $this);
            ?>
">
				<?php 
            echo smarty_function_img(array('src' => $this->_tpl_vars['item']['Product']['DefaultImage']['paths']['1'], 'alt' => is_array($_tmp = $this->_tpl_vars['item']['Product']['name_lang']) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)), $this);
            ?>

			</a>
			<?php 
        }
        ?>
		</td>

		<?php 
        if (is_array($_tmp = 'SHOW_SKU_CART') ? $this->_run_mod_handler('config', true, $_tmp) : $this->_plugins['modifier']['config'][0][0]->config($_tmp)) {
            ?>
			<td><?php 
            echo is_array($_tmp = $this->_tpl_vars['item']['Product']['sku']) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp);
            ?>
</td>
	<div id="topMenuContainer">
		<?php 
echo smarty_function_renderBlock(array('block' => 'CART'), $this);
?>

	</div>
	<div class="clear"></div>

		
	<div id="logoContainer">
		<center><a href="<?php 
echo smarty_function_link(array(), $this);
?>
"><?php 
echo smarty_function_img(array('src' => is_array($_tmp = 'LOGO') ? $this->_run_mod_handler('config', true, $_tmp) : $this->_plugins['modifier']['config'][0][0]->config($_tmp), 'alt' => 'Illuminata Logo'), $this);
?>
</a></center>
	</div>

		

	<div class="clear"></div>

	<?php 
echo smarty_function_renderBlock(array('block' => 'HEADER'), $this);
?>


	
</div>
            ?>
selected<?php 
        }
        ?>
><?php 
        echo $this->_tpl_vars['status'];
        ?>
</option>
		   <?php 
    }
}
unset($_from);
?>
	   </select>
	   <?php 
echo smarty_function_img(array('style' => "display: none", 'id' => "orderShipment_status_" . $this->_tpl_vars['shipment']['ID'] . "_feedback", 'src' => "image/indicator.gif"), $this);
?>

   </fieldset>

   <?php 
if ($this->_tpl_vars['order']['isMultiAddress']) {
    ?>
		<fieldset class="shipmentAddress">
			<legend><?php 
    echo smarty_function_translate(array('text' => '_shipping_address'), $this);
    ?>
</legend>
			<div class="menu">
				<a href="#" onclick="Backend.Shipment.prototype.getInstance(Event.element(event).up('.orderShipment')).editShippingAddress(); return false;"><?php 
    echo smarty_function_translate(array('text' => '_edit_address'), $this);
    }
}
smarty_fun_address($this, array());
?>

<div id="content" class="left right">

	<div id="invoice">

		<div id="invoiceHeader">

			<?php 
$this->assign('logo', is_array($_tmp = 'LOGO') ? $this->_run_mod_handler('config', true, $_tmp) : $this->_plugins['modifier']['config'][0][0]->config($_tmp));
?>
			<?php 
echo smarty_function_img(array('src' => is_array($_tmp = is_array($_tmp = 'INVOICE_LOGO') ? $this->_run_mod_handler('config', true, $_tmp) : $this->_plugins['modifier']['config'][0][0]->config($_tmp)) ? $this->_run_mod_handler('default', true, $_tmp, @$this->_tpl_vars['logo']) : smarty_modifier_default($_tmp, @$this->_tpl_vars['logo']), 'id' => 'invoiceLogo', 'alt' => 'Invoice Logo'), $this);
?>


			<h1><?php 
echo smarty_function_translate(array('text' => '_invoice'), $this);
?>
 <?php 
echo $this->_tpl_vars['order']['invoiceNumber'];
?>
</h1>
			<div id="invoiceDate"><?php 
echo $this->_tpl_vars['order']['formatted_dateCompleted']['date_long'];
?>
</div>
unset($_smarty_tpl_vars);
?>

<h1 id="loginHeader"><?php 
ob_start();
echo smarty_function_translate(array('text' => '_backend_login'), $this);
$this->_smarty_vars['capture']['default'] = ob_get_contents();
$this->assign('translation__backend_login', ob_get_contents());
ob_end_clean();
echo is_array($_tmp = $this->_tpl_vars['translation__backend_login']) ? $this->_run_mod_handler('branding', true, $_tmp) : $this->_plugins['modifier']['branding'][0][0]->branding($_tmp);
?>
</h1>

<div id="logoContainer">
	<?php 
echo smarty_function_img(array('src' => smarty_modifier_or(is_array($_tmp = 'BACKEND_LOGIN_LOGO') ? $this->_run_mod_handler('config', true, $_tmp) : $this->_plugins['modifier']['config'][0][0]->config($_tmp), "image/promo/transparentlogo.png")), $this);
?>

</div>

<div id="loginContainer">
<?php 
if ($this->_tpl_vars['request']['failed']) {
    ?>
	<div class="loginFailed"><?php 
    echo smarty_function_translate(array('text' => '_login_failed'), $this);
    ?>
</div>
<?php 
}
?>
?>
</div>
		</div>
		<div id="productFileSaved" class="yellowMessage" style="display: none;">
			<?php 
echo smarty_function_img(array('class' => 'closeMessage', 'src' => "image/silk/cancel.png"), $this);
?>

			<div><?php 
echo smarty_function_translate(array('text' => '_product_file_was_successfully_saved'), $this);
?>
</div>
		</div>
		<div id="productRelationshipCreated" class="yellowMessage" style="display: none;">
			<?php 
echo smarty_function_img(array('class' => 'closeMessage', 'src' => "image/silk/cancel.png"), $this);
?>

			<div><?php 
echo smarty_function_translate(array('text' => '_a_relationship_between_products_was_successfully_created'), $this);
?>
</div>
		</div>
	</div>
</div>

<div id="catgegoryContainer" class="treeContainer  maxHeight h--60">
	<div id="categoryBrowser" class="treeBrowser"></div>

	<br />
/**
 * Smarty {prod_images} function plugin
 *
 * Type:     function<br>
 * Name:     prod_images<br>
 * Purpose:  display product images
 *
 * @param         $params
 * @param \Smarty $smarty
 * @return bool
 */
function smarty_function_prod_images($params, &$smarty)
{
    //load up the img plugin
    require_once $smarty->_get_plugin_filepath('function', 'img');
    $rec = $params['record'];
    if ($rec->main_image_functionality == 'iws') {
        $images = $rec->expFile['imagesforswatches'];
    } else {
        $images = $rec->expFile['mainimage'];
    }
    //ref for additional images so we can play with the array
    $additionalImages = !empty($rec->expFile['images']) ? $rec->expFile['images'] : array();
    $mainImages = !empty($additionalImages) ? array_merge($images, $additionalImages) : $images;
    $mainthmb = !empty($rec->expFile['mainthumbnail'][0]) ? $rec->expFile['mainthumbnail'][0] : $mainImages[0];
    $addImgs = array_merge(array($mainthmb), $additionalImages);
    //pulling in store configs. This is a placeholder for now, so we'll manually set them til we get that worked in.
    $config = $smarty->getTemplateVars('config');
    // $config = array(
    //     "listing-width"=>148,
    //     "listing-height"=>148,
    //     "disp-width"=>200,
    //     "disp-height"=>250,
    //     "thmb-box"=>40,
    //     "swatch-box"=>30,
    //     "swatch-pop"=>100
    //     );
    switch ($params['display']) {
        case 'single':
            $html = '<a class="prod-img" href="' . makelink(array("controller" => "store", "action" => "showByTitle", "title" => $rec->title)) . '">';
            $width = !empty($params['width']) ? $params['width'] : 100;
            $imgparams = array("constraint" => 1, "file_id" => $images[0]->id, "w" => $config["listingwidth"], "h" => $config["listingheight"], "return" => 1, "class" => "ecom-image");
            if (!$images[0]->id) {
                unset($imgparams['file_id']);
                $imgparams['src'] = 'framework/modules/ecommerce/assets/images/no-image.jpg';
                $imgparams['alt'] = gt('No image found for') . ' ' . $rec->title;
            }
            $img = smarty_function_img($imgparams, &$smarty);
            $html .= $img;
            $html .= '</a>';
            break;
        case 'main':
            // if we have only 1 image to display, left do a little math to figure out how tall to make our display box
            if (count($addImgs) <= 1) {
                $config['displayheight'] = ceil($mainImages[0]->image_height * $config['displaywidth'] / $mainImages[0]->image_width);
            }
            if (count($addImgs) > 1) {
                $adi .= '<ul class="thumbnails">';
                for ($i = 0; $i < count($addImgs); $i++) {
                    $thumbparams = array("h" => $config['addthmbw'], "w" => $config['addthmbh'], "zc" => 1, "file_id" => $addImgs[$i]->id, "return" => 1, "class" => "thumnail");
                    $thmb .= '<li>' . smarty_function_img($thumbparams, &$smarty) . '</li>';
                }
                $adi .= $thmb;
                $adi .= '</ul>';
            }
            // shrink shrink the display window to fit the selected image if no height is set
            if ($config['displayheight'] == 0) {
                $config['displayheight'] = $config['displaywidth'] * $mainImages[0]->image_height / $mainImages[0]->image_width;
            }
            $html = '<div class="ecom-images loading-images" style="width:' . $config['displaywidth'] . 'px;">';
            // if configured, the additional thumb images will display at the bottom
            $html .= $config['thumbsattop'] == 1 ? $adi : '';
            $html .= '<ul class="enlarged" style="height:' . $config['displayheight'] . 'px;width:' . $config['displaywidth'] . 'px;">';
            for ($i = 0; $i < count($mainImages); $i++) {
                $imgparams = array("w" => $config['displaywidth'], "file_id" => $mainImages[$i]->id, "return" => 1, "class" => "large-img");
                $img .= '<li>' . smarty_function_img($imgparams, &$smarty) . '</li>';
            }
            $html .= $img;
            $html .= '</ul>';
            // if configured, the additional thumb images will display at the bottom
            $html .= $config['thumbsattop'] != 1 ? $adi : '';
            $html .= '</div>';
            // javascripting
            $js = "\n                YUI(EXPONENT.YUI3_CONFIG).use('node','anim', function(Y) {\n                    // set up the images with correct z-indexes to put the first image on top\n                    var imgs = Y.all('.ecom-images img.large-img');\n                    var thumbs = Y.all('.thumbnails img');\n                    var swatches = Y.all('.swatches .swatch');\n\n                    //remove loading\n                    Y.one('.loading-images').removeClass('loading-images');\n\n                    var resetZ = function(n,y){\n                        n.setStyles({'zIndex':0,'display':'none'});\n                        n.set('id','exp-ecom-msi-'+y);\n                    }\n\n                    imgs.each(resetZ);\n                    imgs.item(0).setStyles({'zIndex':'1','display':'block'});\n                    \n                    swatches.each(function(n,y){\n                        n.set('id','exp-ecom-ms-'+y)\n                    });\n                    \n                    swatches.on('click',function(e){\n                        imgs.each(resetZ);\n                        var curImg = imgs.item(swatches.indexOf(e.target));\n                        var imgWin = curImg.ancestor('ul.enlarged');\n                        imgWin.setStyle('height',curImg.get('height')+'px');\n                        //animImgWin(imgWin,curImg.get('height'));\n                        curImg.setStyles({'zIndex':'1','display':'block'});\n                    });\n                \n                    thumbs.on('click',function(e){\n                        imgs.each(resetZ);\n                        \n                        if (swatches.size()!=0) {\n                            var processedIndex = thumbs.indexOf(e.target)==0 ? 0 : swatches.size()+thumbs.indexOf(e.target)-1;\n                        } else {\n                            var processedIndex = thumbs.indexOf(e.target);\n                        }\n                        var curImg = imgs.item(processedIndex);   \n                        curImg.ancestor('ul.enlarged').setStyle('height',curImg.get('height')+'px');                \n                        curImg.setStyles({'zIndex':'1','display':'block'});\n                    });\n                    \n                    // animation...  too much for now, but we'll leave the code\n                    var animImgWin = function (node,h) {\n                        var hAnim = new Y.Anim({\n                                node: node,\n                                to: {height: h},\n                                easing:Y.Easing.easeOut,\n                                duration:0.5\n                        });\n                        hAnim.run();\n                    }\n                \n                });\n            ";
            expJavascript::pushToFoot(array("unique" => 'imgswatches', "yui2mods" => null, "yui3mods" => null, "content" => $js, "src" => ""));
            break;
        case 'swatches':
            $html = '<ul class="swatches">';
            $swatches = $rec->expFile['swatchimages'];
            for ($i = 0; $i < count($swatches); $i++) {
                $small = array("h" => $config['swatchsmh'], "w" => $config['swatchsmw'], "zc" => 1, "file_id" => $swatches[$i]->id, "return" => 1, "class" => 'swatch');
                $med = array("h" => $config['swatchpoph'], "w" => $config['swatchpopw'], "zc" => 1, "file_id" => $swatches[$i]->id, "return" => 1);
                $swtch .= '<li>' . smarty_function_img($small, &$smarty);
                $swtch .= '<div>' . smarty_function_img($med, &$smarty) . '<strong>' . $swatches[$i]->title . '</strong></div>';
                $swtch .= '</li>';
            }
            $html .= $swtch;
            $html .= '</ul>';
            break;
    }
    echo $html;
}
						<a href="<?php 
            echo smarty_function_productUrl(array('product' => $this->_tpl_vars['product']), $this);
            ?>
">
						<?php 
            if ($this->_tpl_vars['product']['DefaultImage']['ID']) {
                ?>
							<?php 
                echo smarty_function_img(array('src' => $this->_tpl_vars['product']['DefaultImage']['paths']['1'], 'alt' => is_array($_tmp = $this->_tpl_vars['product']['name_lang']) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)), $this);
                ?>

						<?php 
            } else {
                ?>
							<?php 
                echo smarty_function_img(array('src' => is_array($_tmp = 'MISSING_IMG_THUMB') ? $this->_run_mod_handler('config', true, $_tmp) : $this->_plugins['modifier']['config'][0][0]->config($_tmp), 'alt' => is_array($_tmp = $this->_tpl_vars['product']['name_lang']) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp)), $this);
                ?>

						<?php 
            }
            ?>
						</a>
					</td>
				<?php 
        }
        ?>

				<?php 
        if ($this->_tpl_vars['columns']['SKU']) {
            ?>
					<td class="productSku text"><a href="<?php 
                ?>
" id="filter_<?php 
                echo $this->_tpl_vars['column'];
                ?>
_<?php 
                echo $this->_tpl_vars['id'];
                ?>
" value="<?php 
                echo is_array($_tmp = $this->_tpl_vars['availableColumns'][$this->_tpl_vars['column']]['name']) ? $this->_run_mod_handler('escape', true, $_tmp) : smarty_modifier_escape($_tmp);
                ?>
"  />
					<?php 
            }
            ?>
					<?php 
            echo smarty_function_img(array('src' => "image/silk/bullet_arrow_up.png", 'class' => 'sortPreview'), $this);
            ?>

					</div>
				</th>
			<?php 
        }
        ?>
		<?php 
    }
}
unset($_from);
?>
	</tr>
</thead>
<tbody>