|
| Copyright: copyright (C) 2004 by Mike de Boer |
| Description: zOOm Image Gallery, a multi-gallery component for |
| Mambo based on RSGallery by Ronald Smit. It's the most |
| feature-rich gallery component for Mambo! |
| Filename: lightbox.class.php |
| Version: 2.1.4 |
| |
-----------------------------------------------------------------------
**/
// MOS Intruder Alerts
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
class lightbox extends zoom{
var $_session_id = null;
var $_items = array();
var $_file = null;
function lightbox(){
$_session_id = SID;
$this->_file = 'media/'.uniqid('lightbox_').'.zip';
}
function addItem($object_id, $type, $qty = 1){
$curr_id = $this->getNoOfItems();
foreach ($this->_items as $item){
}
$this->_items[$curr_id] = new lightbox_item($object_id, $type, $qty);
return true;
}
function removeItem($id){
unset($this->_items[$id]);
$temp_array = array_values($this->_items);
$this->_items = $temp_array;
return true;
}
function editItem($id,$qty){
$this->_items[$id]->setQty($qty);
return true;
}
function getNoOfItems(){
return sizeof($this->_items);
}
function createZipFile(){
global $zoom, $mosConfig_live_site;
// the idea is that the array of items is iterated through and images are added
// to the filelist array automatically. Galleries, however, need to be parsed
// individually!
echo _ZOOM_LIGHTBOX_PARSEZIP;
$filelist = array();
foreach($this->_items as $item){
if(isset($item->_image) || !empty($item->_image)){
// item has been identified as an image, so add it simply to the filelist...
$item->_image->getInfo();
$filelist[] = $zoom->_CONFIG['imagepath'].$item->_image->getDir().'/'.$item->_image->_filename;
}else{
// item has been identified as a gallery, so parse it for images an THEN
// add those to the filelist...
foreach($item->_gallery->_images as $image){
$image->getInfo();
$filelist[] = $zoom->_CONFIG['imagepath'].$item->_gallery->getDir().'/'.$image->_filename;
}
}
}
$remove_dir = $zoom->_CONFIG['imagepath'];
echo ''._ZOOM_INFO_DONE.'
';
echo _ZOOM_LIGHTBOX_DOZIP;
if($zoom->createArchive($filelist, $this->_file, $remove_dir)){
$zoom->_EditMon->setEditMon(0, 'lightbox', $this->_file);
echo ''._ZOOM_INFO_DONE.'
';
echo _ZOOM_LIGHTBOX_DLHERE.':
';
}else{
echo 'error!
';
}
}
}
class lightbox_item extends lightbox{
var $_id = null;
var $_image = null;
var $_gallery = null;
var $_qty = null;
function lightbox_item($object_id, $type, $qty = 1){
if($type == 1)
$this->_image = new image($object_id);
elseif($type == 2)
$this->_gallery = new gallery($object_id);
$this->_qty = $qty;
}
function getImage(){
return $this->_image;
}
function getGallery(){
return $this->_gallery;
}
function getQty(){
return $this->_qty;
}
function setQty($qty = 1){
$this->_qty = $qty;
}
}