function getGalleryJsSlideshow($catid, $id, $slideshow = 0, $id_slug, $catid_slug) { $path = PhocaGalleryHelperFront::getPathSet(); $icon =& PhocaGalleryHelperFront::getFormatIcon(); // 1. GET DATA FOR JAVASCRIPT $js_slideshow_data['files'] = ''; //Get the catid of selected id // $query = "SELECT catid as catid FROM #__phocagallery WHERE id=$id"; // $this->_db->setQuery($query); // $catid = $this->_db->loadObject(); //Get filename of all photos $query = "SELECT filename as filename FROM #__phocagallery WHERE catid=" . (int) $catid . " AND published=1 ORDER BY catid, ordering"; $this->_db->setQuery($query); $filename_all = $this->_db->loadObjectList(); if (isset($filename_all)) { $j = 0; foreach ($filename_all as $key => $value) { $file_thumbnail = PhocaGalleryHelperFront::getThumbnailName($value->filename, 'large'); if (is_file($file_thumbnail['abs'])) { //$file_name = JURI::base(true).'/' . "images/phocagallery/thumbs/phoca_thumb_l_" . $value->filename; $js_slideshow_data['files'] .= 'fadeimages[' . $j . ']=["' . JURI::base(true) . str_replace('./', '/', $file_thumbnail['rel']) . '", "", ""];'; } else { $file_thumbnail = JURI::base(true) . '/' . "components/com_phocagallery/assets/images/phoca_thumb_l_no_image." . $icon; $js_slideshow_data['files'] .= 'fadeimages[' . $j . ']=["' . $file_thumbnail . '", "", ""];'; } $j++; } } // 2. GET DATA FOR DISPLAYING SLIDESHOW BUTTONS //We can display slideshow option if there is more than one foto //But in database there can be more photos - more rows but if file is in db but it doesn't exist, we don't count it //$foto_count = SQLQuery::selectOne($mdb2, "SELECT COUNT(*) FROM $db_gallery WHERE siteid=$id"); $foto_count = 0; //how many photos there are (but only photos they have file on the server saved if (isset($filename_all)) { foreach ($filename_all as $key => $value) { //if (is_file($folder['originalabs'] . $value->filename)) //{ $foto_count++; //} } } if ($foto_count > 1) { if ($slideshow == 1) { $js_slideshow_data['icons'] = '<a href="' . JRoute::_('index.php?option=com_phocagallery&view=detail&catid=' . $catid_slug . '&id=' . $id_slug . '&tmpl=component&phocaslideshow=0' . '&Itemid=' . JRequest::getVar('Itemid', 1, 'get', 'int')) . '" title="' . JText::_('Stop slideshow') . '" >' . JHTML::_('image', 'components/com_phocagallery/assets/images/icon-stop.' . $icon, JText::_('Stop slideshow')) . '</a>' . '</td><td>' . JHTML::_('image', 'components/com_phocagallery/assets/images/icon-play-grey.' . $icon, JText::_('Start slideshow')); } else { $js_slideshow_data['icons'] = JHTML::_('image', 'components/com_phocagallery/assets/images/icon-stop-grey.' . $icon, JText::_('Stop slideshow')) . '</td><td>' . '<a href="' . JRoute::_('index.php?option=com_phocagallery&view=detail&catid=' . $catid_slug . '&id=' . $id_slug . '&tmpl=component&phocaslideshow=1' . '&Itemid=' . JRequest::getVar('Itemid', 1, 'get', 'int')) . '" title="' . JText::_('Start slideshow') . '">' . JHTML::_('image', 'components/com_phocagallery/assets/images/icon-play.' . $icon, JText::_('Start slideshow')) . '</a>'; } } else { $js_slideshow_data['icons'] = ''; } return $js_slideshow_data; //files (javascript) and icons (buttons) }