<?php
/**
* NeoReferences Component.
* @Copyright (C) 2008 Neoweb
* @ Released under CREATIVE COMMONS License : http://creativecommons.org/licenses/by-nc-sa/2.0/fr/deed.en
* @version $Revision: 1.3.4 $
* By NeoJoomla
**/
// no direct access
defined( '_VALID_MOS' ) or die( 'Restricted access' );
global $mosConfig_offset, $mosConfig_live_site, $mainframe;
$path = "images/stories/neoreferences/references/thumbnails/";
$count = intval( $params->get( 'count', 5 ) );
$show_name = $params->get( 'show_name', 1 );
$clickable_name = $params->get( 'clickable_name', 1 );
$show_link = $params->get( 'show_link', 0 );
$show_thumb = $params->get( 'show_thumb', 0 );
$query = "SELECT name, link, image FROM #__neoreferences AS a"
. "\nWHERE a.published=1 AND a.online=1"
. "\n ORDER BY RAND()"
. "\n LIMIT $count";
$database->setQuery( $query );
$rows = $database->loadObjectList();
?>
<ul class="latestreferences<?php echo $moduleclass_sfx; ?>">
<?
for ($i=0, $n=count( $rows ); $i < $n; $i++) {
$row = &$rows[$i];
?>
<li class="<?php echo (($i%2) ? 'sectiontableentry2' : 'sectiontableentry1'); ?>">
<?php
if ( $show_name ) {
if ( $clickable_name && ( $row->link != "" ) && ( $row->link != "http://" ) ) { ?>
<a href="<?php echo $row->link; ?>" target="_blank" class="title" title="<?php echo $row->name; ?>">
<strong><?php echo $row->name; ?></strong>
</a><br>
<?php
} else {
echo "<strong>".$row->name."</strong><br/>";
}
}
if ( $show_link && ( $row->link != "" ) && ( $row->link != "http://" ) ) {
$link = (substr($row->link, 0, 10) == "http://www") ? substr($row->link, 7) : $row->link;
?>
<a href="<?php echo $row->link; ?>" target="_blank" class="link" title="<?php echo $row->name; ?>"><?php echo $link; ?></a>
<?php
}
// Thumbnail
if ( $show_thumb ) {
$image = $path.$row->image;
if ( file_exists( $image ) ) {
if ( ( $row->link != "" ) && ( $row->link != "http://" ) ) { ?>
<a href="<?php echo $row->link; ?>" target="_blank" class="thumb" title="<?php echo $row->name; ?>">
<img src="<?php echo $image; ?>" border="0" alt="<?php echo $row->name; ?>" title="<?php echo $row->name; ?>">
</a>
<?php
} else {
?>
<img src="<?php echo $image; ?>" border="0" alt="<?php echo $row->name; ?>" title="<?php echo $row->name; ?>">
<?php
}
}
} ?>
</li>
<?php
}
?>
</ul>