/**
  * Returns number of files within a specific gallery and it's children
  * @deprecated use rsgGallery->itemCount() instead.
  * @param int Category id
  * @return int Number of files in category
  */
 function getFileCount($id)
 {
     $database =& JFactory::getDBO();
     $list = galleryUtils::getChildList($id);
     $database->setQuery("SELECT COUNT(1) FROM #__rsgallery2_files WHERE gallery_id IN ({$list})");
     $count = $database->loadResult();
     return $count;
 }
Exemple #2
0
 /**
  * Shows a selectbox  with the filenames in the selected gallery
  * @param int Gallery ID
  * @param int Currently selected thumbnail
  * @return HTML representation of a selectbox
  * @todo Also offer the possiblity to select thumbs from subgalleries
  */
 function showThumbNames($id, $current_id, $selectname = 'thumb_id')
 {
     $database =& JFactory::getDBO();
     if ($id == null) {
         echo JText::_('NO IMAGES IN GALLERY YET');
         return;
     }
     $list = galleryUtils::getChildList($id);
     //$sql = "SELECT name, id FROM #__rsgallery2_files WHERE gallery_id in ($list)";
     $sql = "SELECT a.name, a.id, b.name as gname FROM #__rsgallery2_files AS a " . "LEFT JOIN #__rsgallery2_galleries AS b ON a.gallery_id = b.id " . "WHERE gallery_id IN ({$list}) " . "ORDER BY gname, a.id ASC";
     $database->setQuery($sql);
     $list = $database->loadObjectList();
     if ($list == null) {
         echo JText::_('NO IMAGES IN GALLERY YET');
         return;
     }
     $dropdown_html = "<select name=\"{$selectname}\"><option value=\"0\" SELECTED>- Random thumbnail -</option>\n";
     if (!isset($current_id)) {
         $current_id = 0;
     }
     foreach ($list as $item) {
         $dropdown_html .= "<option value=\"{$item->id}\"";
         if ($item->id == $current_id) {
             $dropdown_html .= " SELECTED>";
         } else {
             $dropdown_html .= ">";
         }
         $dropdown_html .= $item->name . " (" . $item->gname . ")</option>\n";
     }
     echo $dropdown_html . "</select>";
 }