/** * Shows thumbnails for gallery and links to subgalleries if they exist. * @param integer Category ID * @param integer Columns per page * @param integer Number of thumbs per page * @param integer pagenav stuff * @param integer pagenav stuff */ function RSShowPictures($catid, $limit, $limitstart) { global $rsgConfig; $my = JFactory::getUser(); $database = JFactory::getDBO(); $columns = $rsgConfig->get("display_thumbs_colsPerPage"); $PageSize = $rsgConfig->get("display_thumbs_maxPerPage"); //$my_id = $my->id; $database->setQuery("SELECT COUNT(1) FROM #__rsgallery2_files WHERE gallery_id='{$catid}'"); $numPics = $database->loadResult(); if (!isset($limitstart)) { $limitstart = 0; } //instantiate page navigation $pagenav = new JPagination($numPics, $limitstart, $PageSize); $picsThisPage = min($PageSize, $numPics - $limitstart); if (!$picsThisPage == 0) { $columns = min($picsThisPage, $columns); } //Add a hit to the database if ($catid && !$limitstart) { galleryUtils::addCatHit($catid); } //Old rights management. If user is owner or user is Super Administrator, you can edit this gallery if ($my->id != 0 and (galleryUtils::getUID($catid) == $my->id or $my->usertype == 'Super Administrator')) { $allowEdit = true; } else { $allowEdit = false; } $thumbNumber = 0; ?> <div class="rsg2-pageNav"> <?php /* if( $numPics > $PageSize ){ echo $pagenav->writePagesLinks("index.php?option=com_rsgallery2&catid=".$catid); } */ ?> </div> <br /> <?php if ($picsThisPage) { $database->setQuery("SELECT * FROM #__rsgallery2_files" . " WHERE gallery_id='{$catid}'" . " ORDER BY ordering ASC" . " LIMIT {$limitstart}, {$PageSize}"); $rows = $database->loadObjectList(); switch ($rsgConfig->get('display_thumbs_style')) { case 'float': $floatDirection = $rsgConfig->get('display_thumbs_floatDirection'); ?> <ul id="rsg2-thumbsList"> <?php foreach ($rows as $row) { ?> <li <?php echo "style='float: {$floatDirection}'"; ?> > <a href="<?php echo JRoute::_("index.php?option=com_rsgallery2&page=inline&id=" . $row->id . "&catid=" . $row->gallery_id . "&limitstart=" . $limitstart++); ?> "> <!--<div class="img-shadow">--> <img border="1" alt="<?php echo htmlspecialchars(stripslashes($row->descr), ENT_QUOTES); ?> " src="<?php echo imgUtils::getImgThumb($row->name); ?> " /> <!--</div>--> <span class="rsg2-clr"></span> <?php if ($rsgConfig->get("display_thumbs_showImgName")) { ?> <br /><span class='rsg2_thumb_name'><?php echo htmlspecialchars(stripslashes($row->title), ENT_QUOTES); ?> </span> <?php } ?> </a> <?php if ($allowEdit) { ?> <div id='rsg2-adminButtons'> <a href="<?php echo JRoute::_("index.php?option=com_rsgallery2&page=edit_image&id=" . $row->id); ?> "><img src="<?php echo JURI_SITE; ?> /administrator/images/edit_f2.png" alt="" height="15" /></a> <a href="#" onClick="if(window.confirm('<?php echo JText::_('Are you sure you want to delete this image?'); ?> ')) location='<?php echo JRoute::_("index.php?option=com_rsgallery2&page=delete_image&id=" . $row->id); ?> '"><img src="<?php echo JURI_SITE; ?> /administrator/images/delete_f2.png" alt="" height="15" /></a> </div> <?php } ?> </li> <?php } ?> </ul> <div class='rsg2-clr'> </div> <?php break; case 'table': $cols = $rsgConfig->get('display_thumbs_colsPerPage'); $i = 0; ?> <table id='rsg2-thumbsList'> <?php foreach ($rows as $row) { ?> <?php if ($i % $cols == 0) { echo "<tr>\n"; } ?> <td> <!--<div class="img-shadow">--> <a href="<?php echo JRoute::_("index.php?option=com_rsgallery2&page=inline&id=" . $row->id . "&catid=" . $row->gallery_id . "&limitstart=" . $limitstart++); ?> "> <img border="1" alt="<?php echo htmlspecialchars(stripslashes($row->descr), ENT_QUOTES); ?> " src="<?php echo imgUtils::getImgThumb($row->name); ?> " /> </a> <!--</div>--> <div class="rsg2-clr"></div> <?php if ($rsgConfig->get("display_thumbs_showImgName")) { ?> <br /> <span class='rsg2_thumb_name'> <?php echo htmlspecialchars(stripslashes($row->title), ENT_QUOTES); ?> </span> <?php } ?> <?php if ($allowEdit) { ?> <div id='rsg2-adminButtons'> <a href="<?php echo JRoute::_("index.php?option=com_rsgallery2&page=edit_image&id=" . $row->id); ?> "><img src="<?php echo JURI_SITE; ?> /administrator/images/edit_f2.png" alt="" height="15" /></a> <a href="#" onClick="if(window.confirm('<?php echo JText::_('Are you sure you want to delete this image?'); ?> ')) location='<?php echo JRoute::_("index.php?option=com_rsgallery2&page=delete_image&id=" . $row->id); ?> '"><img src="<?php echo JURI_SITE; ?> /administrator/images/delete_f2.png" alt="" height="15" /></a> </div> <?php } ?> </td> <?php if (++$i % $cols == 0) { echo "</tr>\n"; } ?> <?php } ?> <?php if ($i % $cols != 0) { echo "</tr>\n"; } ?> </table> <?php break; case 'magic': echo JText::_('Magic not implemented yet'); ?> <table id='rsg2-thumbsList'> <tr> <td><?php echo JText::_('Magic not implemented yet'); ?> </td> </tr> </table> <?php break; } ?> <div class="rsg2-pageNav"> <?php if ($numPics > $PageSize) { echo $pagenav->writePagesLinks("index.php?option=com_rsgallery2&catid=" . $catid); echo "<br /><br />" . $pagenav->writePagesCounter(); } ?> </div> <?php } else { if (!$catid == 0) { echo JText::_('No images in gallery'); } } }