git-svn-id: https://192.168.0.254/svn/Proyectos.MatritumCantat_Web/trunk@2 8e3496fd-7892-4c45-be36-0ff06e9dacc6
109 lines
4.4 KiB
PHP
109 lines
4.4 KiB
PHP
<?php
|
|
/**
|
|
* @version@1.0.beta.1.1
|
|
* for Mambo_4.5.2
|
|
* @copyright (C) 2005 Jetze van der Wal 2005
|
|
* @used some parts of CODE FROM THE MOD_ZOOM2 MOULE BY Per Lasse Baasch pl.baasch@skycube.net
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
|
|
* @project site http:://mambo.jetze.com
|
|
*/
|
|
|
|
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
|
|
if ( !class_exists( "ZoomImgHTML" ) ) {
|
|
|
|
class ZoomImgHTML {
|
|
|
|
var $href;
|
|
|
|
function makecode($imgid, $catid, $Itemid) {
|
|
|
|
if (($imgid=='')or($catid=='')) {
|
|
return "missing required values: imageid=$imgid, categorid=$catid";
|
|
};
|
|
//Note: why is this so difficult?
|
|
//cause zoom gallery doesnt allow for opening it's images using just the unique id of an image
|
|
//it DOES allow for opening a page withing the gallery and an image defiined by its position
|
|
//in the page (that key values 0 to max-number-of-images-per-page-minus-1)
|
|
|
|
##########################
|
|
#get Global Config values form Zoom Gallery
|
|
global $mosConfig_absolute_path, $database;
|
|
|
|
include($mosConfig_absolute_path.'/configuration.php');
|
|
include($mosConfig_absolute_path.'/components/com_zoom/zoom_config.php');
|
|
|
|
$BaseImagePath = ($mosConfig_live_site."/".$zoomConfig['imagepath']);
|
|
|
|
$order = $zoomConfig['orderMethod'];
|
|
$zoomModule = $zoomConfig['zoomModule'];
|
|
$maxpagesize = $zoomConfig['PageSize'];
|
|
$order = $zoomConfig['orderMethod']; //how zoom gallery orders when displaying
|
|
$usepopup = $zoomConfig['popUpImages'];
|
|
|
|
// Create a string for querying later on
|
|
if ($order == 1){ $myorder = 'imgname ASC'; } //ok
|
|
if ($order == 2){ $myorder = 'imgname DESC'; } //ok
|
|
if ($order == 3){ $myorder = 'imgfilename ASC'; } //ok
|
|
if ($order == 4){ $myorder = 'imgfilename DESC'; } //ok
|
|
if ($order == 5){ $myorder = 'imgdate ASC'; } //ok
|
|
if ($order == 6){ $myorder = 'imgdate DESC'; } //ok
|
|
|
|
//parameters passed to me are the category-id and the image-id
|
|
$query="SELECT imgid FROM #__zoomfiles WHERE catid=$catid AND published=1 ORDER BY $myorder";
|
|
//this will give use all published media in the order in which they are visible in gallery
|
|
//so find the number of pages before the image becomes visible in gallery: this gives us pageno (use for non-popup modus only)
|
|
|
|
$database->setQuery($query);
|
|
$result = $database->query();
|
|
|
|
//key-1 means no valid key;
|
|
$i=0;
|
|
$pageno=1; //zoom starts at page=1
|
|
$keyno=-1; //-1 means no key found; zoom starts at key=0
|
|
while (($keyno == -1) AND ($row = mysql_fetch_object($result))) {
|
|
//echo "<h3>63 :: imgid=$imgid, page=$pageno, keyno=$keyno, i=$i, imgid=$row->imgid</h3>";
|
|
if($imgid==$row->imgid){
|
|
|
|
$keyno = $i;
|
|
|
|
};
|
|
|
|
if ($i>=$maxpagesize){
|
|
$pageno++; //increase pageno
|
|
//$i=0; //resets possible key counter
|
|
};
|
|
|
|
$i++;
|
|
|
|
};
|
|
|
|
// handle itmeid;
|
|
$itemidurl = $Itemid=='0'?'':'&Itemid='.$Itemid;
|
|
|
|
// compute href
|
|
if ($usepopup == 1){
|
|
$this->href = "href=\"javascript:void(0)\" onClick=\"window.open('components/com_zoom/view.php?popup=1&catid=$catid&PageNo=$pageno&key=$keyno&isAdmin=false&hit=1', 'win1', 'width=650, height=700, scrollbars=1').focus()\"";
|
|
$this->href = "href=\"javascript:void(0)\" onClick=\"window.open('components/com_zoom/view.php?popup=1&catid=$catid&key=$keyno&isAdmin=false&hit=1', 'win1', 'width=650, height=700, scrollbars=1').focus()\"";
|
|
|
|
} else {
|
|
|
|
//Rodax Software
|
|
if ($catid == 15){
|
|
$this->href = "href=\"javascript:void(0)\" onClick=\"window.open('components/com_zoom/view.php?popup=1&catid=$catid&PageNo=$pageno&key=$keyno&isAdmin=false&hit=1', 'win1', 'width=650, height=700, scrollbars=1').focus()\"";
|
|
$this->href = "href=\"javascript:void(0)\" onClick=\"window.open('components/com_zoom/view.php?popup=1&catid=$catid&key=$keyno&isAdmin=false&hit=1', 'win1', 'width=850, height=700, scrollbars=1').focus()\"";
|
|
}
|
|
else
|
|
//Fin Rodax Software
|
|
$this->href ="href=\"index.php?option=com_zoom$itemidurl&page=view&catid=$catid&PageNo=$pageno&key=$keyno&hit=1\"";
|
|
};
|
|
|
|
|
|
|
|
return 'okay';
|
|
}
|
|
}
|
|
|
|
} //eo if class already exists
|
|
|
|
?>
|