示例#1
0
<ul id="top_products">
<?php 
foreach ($topProducts as $product) {
    ?>
	<li>
		<h3><?php 
    echo $product->getLabelI18n();
    ?>
</h3>
		<span>
			<?php 
    echo Media::displayThumb($product->getImageI18n(), 100, 100);
    ?>
		</span>
		<?php 
    echo $product->getShortDescriptionI18n();
    ?>
	</li>
<?php 
}
?>
</div>
示例#2
0
<?php

if ($images) {
    ?>
<div class="image_thumbs">
    <h3><?php 
    echo $galleryLabel;
    ?>
</h3>
	<ul>
		<?php 
    foreach ($images as $image) {
        ?>
    	<li>
	    	<a rel="example_group" href="<?php 
        echo $image->getRelativeUrl();
        ?>
">
	    		<?php 
        echo Media::displayThumb($image->getId(), 126, 92, false);
        ?>
	    	</a>
    	</li>
    	<?php 
    }
    ?>
    </ul>
	<div class="clear"></div>
</div>
<?php 
}
示例#3
0
/**
* this searches for pages matching the user query and returns an array of
* for the header and table rows back to search.php where it will be formated and
* printed
*
* @query            string          Keywords user is looking for
* @datestart        date/time       Start date to get results for
* @dateend          date/time       End date to get results for
* @topic            string          The topic they were searching in
* @type             string          Type of items they are searching
* @author           string          Get all results by this author
*
*/
function MG_search($id, $page, $searchinfo = '')
{
    global $_USER, $_TABLES, $_CONF, $_MG_CONF, $LANG_MG00, $LANG_MG01, $LANG_MG03;
    $columns_per_page = $_MG_CONF['search_columns'];
    $rows_per_page = $_MG_CONF['search_rows'];
    if (!empty($searchinfo['numresults'])) {
        $rows_per_page = intval($searchinfo['numresults'] / $columns_per_page);
    }
    $media_per_page = $columns_per_page * $rows_per_page;
    $current_print_page = $page;
    //    $alertmsg = '<div class="pluginAlert">' . $LANG_MG03['no_search_found'] . '</div>';
    // pull the query from the search database...
    $result = DB_query("SELECT * FROM {$_TABLES['mg_sort']} WHERE sort_id='" . addslashes($id) . "'");
    //    $nrows  = DB_numRows($result);
    //    if ($nrows < 1) {
    //        return $alertmsg;
    //    }
    $S = DB_fetchArray($result);
    if (!isset($_USER['uid']) || $_USER['uid'] < 2) {
        $sort_user = 1;
    } else {
        $sort_user = $_USER['uid'];
    }
    //    if ($sort_user != $S['sort_user'] && $S['sort_user'] != 1) {
    //        return $alertmsg;
    //    }
    $page = $page - 1;
    $begin = $media_per_page * $page;
    $end = $media_per_page;
    $root_album_owner_id = SEC_hasRights('mediagallery.admin');
    $permsql = COM_getPermSQL('AND', $sort_user, 2, 'a');
    $hiddensql = !$root_album_owner_id ? "AND a.hidden=0 " : '';
    $sql = "SELECT DISTINCT count(*) AS c FROM {$_TABLES['mg_media']} AS m, " . $_TABLES['mg_media_albums'] . " AS ma, " . $_TABLES['mg_albums'] . " AS a " . $S['sort_query'] . " AND m.media_id=ma.media_id AND ma.album_id=a.album_id " . $hiddensql . $permsql;
    $result = DB_query($sql);
    $row = DB_fetchArray($result);
    $total_media = $row['c'];
    //    if ($total_media < 1) {
    //        return $alertmsg;
    //    }
    $sql = "SELECT DISTINCT m.*,a.album_id FROM {$_TABLES['mg_media']} AS m, " . $_TABLES['mg_media_albums'] . " AS ma, " . $_TABLES['mg_albums'] . " AS a " . $S['sort_query'] . " AND m.media_id=ma.media_id AND ma.album_id=a.album_id " . $hiddensql . $permsql . " ORDER BY m.media_time DESC" . " LIMIT " . $begin . "," . intval($begin + $end);
    $result = DB_query($sql);
    $media_array = array();
    while ($row = DB_fetchArray($result)) {
        $media_array[] = $row;
    }
    $total_print_pages = ceil($total_media / $media_per_page);
    $pagination = COM_printPageNavigation($_MG_CONF['site_url'] . '/search.php?id=' . $id, $page + 1, $total_print_pages, 'page=');
    $page_number = sprintf("%s %d %s %d", $LANG_MG03['page'], $current_print_page, $LANG_MG03['of'], $total_print_pages);
    $return_url = $S['referer'] == '' ? $_MG_CONF['site_url'] : htmlentities($S['referer'], ENT_QUOTES, COM_getCharset());
    // new stuff
    $T = COM_newTemplate(MG_getTemplatePath_byName());
    $T->set_file('page', 'search_page.thtml');
    $T->set_var(array('site_url' => $_MG_CONF['site_url'], 'table_columns' => $columns_per_page, 'table_column_width' => intval(100 / $columns_per_page) . '%', 'top_pagination' => $pagination, 'bottom_pagination' => $pagination, 'page_number' => $page_number, 'lang_search_results' => $LANG_MG03['search_results'], 'lang_return_to_index' => $LANG_MG03['return_to_index'], 'return_url' => $return_url, 'search_keywords' => $searchinfo['keywords'] == '*' ? '*' : $S['keywords'], 'lang_search' => $LANG_MG01['search']));
    MG_buildSearchBox($T, $searchinfo);
    $howmany = $total_media - $page * $media_per_page;
    if ($howmany > $total_media) {
        $howmany = $total_media;
    }
    if ($howmany > 0) {
        $k = 0;
        $col = 0;
        $opt = array('sortOrder' => 0, 'searchmode' => 1);
        $T->set_block('page', 'ImageColumn', 'IColumn');
        $T->set_block('page', 'ImageRow', 'IRow');
        for ($i = 0; $i < $media_per_page; $i += $columns_per_page) {
            $next_columns = $i + $columns_per_page;
            for ($j = $i; $j < $next_columns; $j++) {
                if ($j >= $total_media) {
                    $T->parse('IRow', 'ImageRow', true);
                    $T->set_var('IColumn', '');
                    break 2;
                }
                if ($j + $begin >= $total_media) {
                    continue;
                }
                $media = new Media($media_array[$j], $media_array[$j]['album_id']);
                $celldisplay = $media->displayThumb($opt);
                if ($media->type == 1) {
                    $PhotoURL = MG_getFileUrl('disp', $media->filename);
                    $T->set_var('URL', $PhotoURL);
                }
                $T->set_var('clear_float', '');
                if ($col == $columns_per_page) {
                    $T->set_var('clear_float', ' clear:both;');
                    $col = 0;
                }
                $T->set_var('CELL_DISPLAY_IMAGE', $celldisplay);
                $T->parse('IColumn', 'ImageColumn', true);
                $col++;
            }
            $T->parse('IRow', 'ImageRow', true);
            $T->set_var('IColumn', '');
        }
        $T->set_var('album_body', 1);
    } else {
        $T->set_var('lang_no_image', $LANG_MG03['no_media_objects']);
    }
    return $T->finish($T->parse('output', 'page'));
}
示例#4
0
</h2>
	<div class="products">
		<?php 
$i = 0;
foreach ($products as $p) {
    $i++;
    $id = $p->getId();
    $url = UtilsHelper::cleanURL($p);
    ?>
	    	<div class="product">
	            <a href="<?php 
    echo $url;
    ?>
" title="#" class="product-image">
	            	<?php 
    echo Media::displayThumb($p->getImage(), 160, 120, false);
    ?>
	            </a>
	            <h1><?php 
    echo $p->getLabel();
    ?>
</h1>
	            <a href="<?php 
    echo $url;
    ?>
" title="More Info" class="more-info">More Info</a>
	            
	            <?php 
    if (array_key_exists($id, $_SESSION['cart'])) {
        ?>
					 <a href="javascript:void(0)" title="Add to cart" class="add-cart" add_id='<?php