function getStatisticsImages($catId, $order, $order2 = 'ASC', $limit = 3) { $query = 'SELECT i.*' . ' FROM #__phocagallery AS i' . ' WHERE i.catid = ' . (int) $catId . ' AND i.published = 1' . ' ORDER BY ' . $order . ' ' . $order2; $this->_db->setQuery($query, 0, $limit); $statistics = $this->_db->loadObjectList(); $count = 0; $total = count($statistics); for ($i = 0; $i < $total; $i++) { $statisticsData[$count] = $statistics[$i]; // PHP 4 - [$i] $item[$i] =& $statisticsData[$count]; $item[$i]->slug = $item[$i]->id . ':' . $item[$i]->alias; $item[$i]->item_type = "image"; // Get file thumbnail or No Image $file_thumbnail = PhocaGalleryHelperFront::displayFileOrNoImage($item[$i]->filename, 'medium'); $item[$i]->linkthumbnailpath = $file_thumbnail['rel']; $count++; } return $item; // return $statistics // php 5 }
function _loadData() { global $mainframe; $user =& JFactory::getUser(); // Lets load the content if it doesn't already exist if (empty($this->_data)) { $query = 'SELECT c.params,c.title,' . ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as slug ' . ' FROM #__phocagallery_categories AS c' . ' WHERE c.id = ' . (int) $this->_catid; $this->_db->setQuery($query, 0, 1); $params = $this->_db->loadObject(); if (isset($params)) { $longitude = PhocaGalleryHelper::getParamsArray($params->params, 'longitude'); $latitude = PhocaGalleryHelper::getParamsArray($params->params, 'latitude'); $zoom = PhocaGalleryHelper::getParamsArray($params->params, 'zoom'); $geotitle = PhocaGalleryHelper::getParamsArray($params->params, 'geotitle'); if (!isset($longitude[0]) || isset($longitude[0]) && ($longitude[0] == '' || $longitude[0] == 0)) { $this->_data['longitude'] = ''; } else { $this->_data['longitude'] = $longitude[0]; } if (!isset($latitude[0]) || isset($latitude[0]) && ($latitude[0] == '' || $latitude[0] == 0)) { $this->_data['latitude'] = ''; } else { $this->_data['latitude'] = $latitude[0]; } if (!isset($zoom[0]) || isset($zoom[0]) && ($zoom[0] == '' || $zoom[0] == 0)) { $this->_data['zoom'] = 2; } else { $this->_data['zoom'] = $zoom[0]; } if (!isset($geotitle[0]) || isset($geotitle[0]) && $geotitle[0] == '') { $this->_data['geotitle'] = $params->title; } else { $this->_data['geotitle'] = $geotitle[0]; } } else { $this->_data['longitude'] = ''; $this->_data['latitude'] = ''; $this->_data['zoom'] = 2; $this->_data['geotitle'] = ''; } // Image $query = 'SELECT a.filename, a.description' . ' FROM #__phocagallery AS a' . ' WHERE a.id = ' . (int) $this->_id; $this->_db->setQuery($query, 0, 1); $image = $this->_db->loadObject(); if (isset($image->filename) && $image->filename != '') { $file_thumbnail = PhocaGalleryHelperFront::displayFileOrNoImage($image->filename, 'small'); $this->_data['thumbnail'] = $file_thumbnail['rel']; } else { $this->_data['thumbnail'] = ''; } if (isset($image->description) && $image->description != '') { $this->_data['description'] = $image->description; } else { $this->_data['description'] = ''; } return (bool) $this->_data; } return true; }
$items = $menu->getItems('link', 'index.php?option=com_phocagallery&view=category&id=' . $image_object->id); $itemscat = $menu->getItems('link', 'index.php?option=com_phocagallery&view=categories'); if (isset($itemscat[0])) { $itemid = $itemscat[0]->id; $image_object->link = 'index.php?option=com_phocagallery&view=detail&catid=' . $image_object->catslug . '&id=' . $image_object->slug . '&Itemid=' . $itemid . '&tmpl=component&detail=' . $detail_window . '&buttons=' . $detail_buttons; } else { if (isset($items[0])) { $itemid = $items[0]->id; $image_object->link = 'index.php?option=com_phocagallery&view=detail&catid=' . $image_object->catslug . '&id=' . $image_object->slug . '&Itemid=' . $itemid . '&tmpl=component&detail=' . $detail_window . '&buttons=' . $detail_buttons; } else { $itemid = 0; $image_object->link = 'index.php?option=com_phocagallery&view=detail&catid=' . $image_object->catslug . '&id=' . $image_object->slug . '&tmpl=component&detail=' . $detail_window . '&buttons=' . $detail_buttons; } } //.......................... $file_thumbnail = PhocaGalleryHelperFront::displayFileOrNoImage($image_object->filename, $img_cat_size); $image_object->linkthumbnailpath = $file_thumbnail['rel']; $image_object->linkthumbnailpathabs = $file_thumbnail['abs']; //.......................... jimport('joomla.filesystem.file'); $imageWidth = 100; $imageHeight = 100; if (JFile::exists($image_object->linkthumbnailpathabs)) { list($width, $height) = GetImageSize($image_object->linkthumbnailpath); if ($width > $height) { if ($width > 100) { $imageWidth = 100; $rate = $width / 100; $imageHeight = $height / $rate; } else { $imageWidth = $width;
function _loadData() { global $mainframe; $user =& JFactory::getUser(); // Lets load the content if it doesn't already exist if (empty($this->_data)) { $query = 'SELECT p.*' . ' FROM #__phocagallery AS p' . ' WHERE p.id = ' . (int) $this->_id; $this->_db->setQuery($query); $items = $this->_db->loadObject(); // Access check - don't display the image if you have no access to this image (if user add own url) if (isset($items->catid)) { $query = 'SELECT cc.access as access, cc.params as params' . ' FROM #__phocagallery_categories AS cc' . ' WHERE cc.id = ' . (int) $items->catid; $this->_db->setQuery($query); $catid = $this->_db->loadObject(); // USER RIGHT - ACCESS ======================================= $rightDisplay = 0; if (isset($catid->params)) { $rightDisplay = PhocaGalleryHelper::getUserRight($catid->params, 'accessuserid', $catid->access, $user->get('aid', 0), $user->get('id', 0), 0); } if ($rightDisplay == 0) { $mainframe->redirect('index.php?option=com_user&view=login', JText::_("ALERTNOTAUTH")); exit; } // ============================================================ } //Select category if (!$this->_loadCategory()) { $this->_loadCategory(); } //Slugs - possible //$items->slugid = (int) $items->id . "-" . $items->alias; //$items->slugcatid = $this->_category->slug; // SLUG CATID /* $query = 'SELECT c.alias'. ' FROM #__phocagallery_categories AS c' . ' WHERE c.id = '. (int) $this->_category->id; $this->_db->setQuery($query); $catid_alias = $this->_db->loadObject(); */ if (isset($this->_category->slug) && $this->_category->slug != '') { $catid_slug = $this->_category->slug; } else { $catid_slug = (int) $this->_category->id; } // ---------- // SLUG ID /* $query = 'SELECT a.alias'. ' FROM #__phocagallery AS a' . ' WHERE a.id = '. (int) $this->_id; $this->_db->setQuery($query); $id_alias = $this->_db->loadObject(); */ if (isset($items->alias) && $items->alias != '') { $id_slug = (int) $this->_id . ':' . $items->alias; } else { $id_slug = (int) $this->_id . ':'; // Because of possible SEF problem } // ---------- //Javascript Slideshow buttons $reload_button = PhocaGalleryHelperFront::getGalleryReload((int) $this->_category->id, (int) $this->_id, $id_slug, $catid_slug); $close_button = PhocaGalleryHelperFront::getGalleryClose((int) $this->_category->id, (int) $this->_id, $id_slug, $catid_slug); $close_text = PhocaGalleryHelperFront::getGalleryCloseText((int) $this->_category->id, (int) $this->_id, $id_slug, $catid_slug); $next_button = PhocaGalleryHelperFront::getGalleryNext((int) $this->_category->id, (int) $this->_id); $prev_button = PhocaGalleryHelperFront::getGalleryPrevious((int) $this->_category->id, (int) $this->_id); $js_slideshow_data = PhocaGalleryHelperFront::getGalleryJsSlideshow((int) $this->_category->id, (int) $this->_id, (int) $this->_slideshow, $id_slug, $catid_slug); // Get file thumbnail or No Image $file_name_no = $items->filename; $file_name = PhocaGalleryHelperFront::getTitleFromFilenameWithExt($items->filename); $image_size = PhocaGalleryHelperFront::getImageSizePhoca($items->filename); $file_size = PhocaGalleryHelperFront::getFileSizePhoca($items->filename); $file_thumbnail = PhocaGalleryHelperFront::displayFileOrNoImage($items->filename, 'large'); $link_thumbnail_path = $file_thumbnail['rel']; $file = new JObject(); //slideshow $file->set('closebutton', $close_button); $file->set('reloadbutton', $reload_button); $file->set('nextbutton', $next_button); $file->set('prevbutton', $prev_button); $file->set('slideshowbutton', $js_slideshow_data['icons']); $file->set('slideshowfiles', $js_slideshow_data['files']); $file->set('slideshow', $this->_slideshow); //download $file->set('closetext', $close_text); $file->set('filenameno', $file_name_no); $file->set('filename', $file_name); $file->set('download', $this->_download); $file->set('filesize', $file_size); $file->set('imagesize', $image_size[0] . ' x ' . $image_size[1]); //all $file->set('linkthumbnailpath', $link_thumbnail_path); //description $file->set('description', $items->description); $file->set('params', $items->params); $file->set('title', $items->title); if (isset($file)) { $this->_data = $file; } else { $this->_data = ''; } return (bool) $this->_data; } return true; }
$imageArray[] = $valueImage->idimage; } $imageIds = implode(',', $imageArray); // QUERIES - all data we need to display the image if ($images) { $query = 'SELECT cc.id, a.id, a.catid, a.title, a.alias, a.filename ,' . ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(\':\', cc.id, cc.alias) ELSE cc.id END as catslug, ' . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(\':\', a.id, a.alias) ELSE a.id END as slug' . ' FROM #__phocagallery_categories AS cc' . ' LEFT JOIN #__phocagallery AS a ON a.catid = cc.id' . ' WHERE a.id in (' . $imageIds . ')'; $db->setQuery($query); $imagesArray = $db->loadObjectList(); $output = array(); // Maximum size of module image is 100 x 100 jimport('joomla.filesystem.file'); $i = 0; foreach ($imagesArray as $valueImages) { $output[$i] = ''; // Path $file_thumbnail = PhocaGalleryHelperFront::displayFileOrNoImage($valueImages->filename, $img_cat_size); $valueImages->linkthumbnailpath = $file_thumbnail['rel']; $valueImages->linkthumbnailpathabs = $file_thumbnail['abs']; // -------------------------------------------------------------------- SEF PROBLEM // Is there an Itemid for category $items = $menu->getItems('link', 'index.php?option=com_phocagallery&view=category&id=' . $valueImages->id); $itemscat = $menu->getItems('link', 'index.php?option=com_phocagallery&view=categories'); if (isset($itemscat[0])) { $itemid = $itemscat[0]->id; //No JRoute now $valueImages->link = 'index.php?option=com_phocagallery&view=detail&catid=' . $valueImages->catslug . '&id=' . $valueImages->slug . '&Itemid=' . $itemid . '&tmpl=component&detail=' . $detail_window . '&buttons=' . $detail_buttons; } else { if (isset($items[0])) { $itemid = $items[0]->id; //No JRoute now $valueImages->link = 'index.php?option=com_phocagallery&view=detail&catid=' . $valueImages->catslug . '&id=' . $valueImages->slug . '&Itemid=' . $itemid . '&tmpl=component&detail=' . $detail_window . '&buttons=' . $detail_buttons;