site_showplaylist.phtml 4.67 KB
<?php
/**
 * @input Mage::app()->getRequest()->getParam('ncalbum_id') direkt dann muss eingeloggt 
 * oder 
 * @input Mage::app()->getRequest()->getParam('urlauth') dann holt er sich ncalbum_id über tabelle
 */


if($urlauth = Mage::app()->getRequest()->getParam('urlauth')) {
	$ncplaylist_ncalbum = Mage::helper('anc_playlist/ncmodel')->getNcAlbumByUrlauth($urlauth);
	$ncalbum_id = $ncplaylist_ncalbum->getId();
	
} else if($ncalbum_id = Mage::app()->getRequest()->getParam('ncalbum_id')) {
//	 $ncplaylist_ncalbum = Mage::getModel('anc_album/ncalbum')->load($ncalbum_id);
//	 $ncplaylist_ncalbum = Mage::helper('anc_lib/ncrights')->loadNcModel('anc_album/ncalbum', $ncalbum_id);
	 $ncplaylist_ncalbum = Mage::helper('anc_playlist/ncmodel')->getNcAlbumByAlbumId($ncalbum_id);
	 

//	 D::show($ncimage, '$NcImageId: '.$NcImageId,1,1);
	 
//	 D::compareFe($ncplaylist_ncalbum, $ncimage, '$ncplaylist_ncalbum, $ncimage',1,1);
} else {
	exit;
}

//if(is_object($ncplaylist_ncalbum)) {
	 $NcImageId = Mage::getSingleton('checkout/session')->getNcImageId();
	 if($NcImageId >= 0) {
		 if(Mage::app()->getRequest()->getParam('show')=== 'next') {
			 $NcImageId++;
		 } else if(Mage::app()->getRequest()->getParam('show')=== 'back') {
			 $NcImageId--;
		 } 
		 Mage::getSingleton('checkout/session')->setNcImageId($NcImageId);
		 $ncimage = Mage::helper('anc_playlist/ncmodel')->getOneNcImageFromNcAlbum($ncalbum_id, $NcImageId);
	 } else {
//		 $ncimage = Mage::helper('anc_playlist/ncmodel')->getOneNcImageFromNcAlbum($ncalbum_id);
		 $ncimage = Mage::helper('anc_playlist/ncmodel')->getOneNcImageFromNcAlbum($ncalbum_id, 0);
		 Mage::getSingleton('checkout/session')->setNcImageId(0);
	 }	
//}


?>
<div class="ancplaylist-site_showplaylist">
	<div class="ncheader">
		<a href="<?php echo Mage::getUrl('',array()); ?>">
			<img src="/skin/frontend/ancprintconfigproduct/default/images/logo.gif" />
		</a>
	</div>
	<div class="nccontent">
		<div class="ncimage">
			<img src="<?php echo DS.Mage::helper('anc_image/ncimage')->getNcImagePath($ncimage['entity_id'], 'relative', 'original') ?>" />
		</div>
	</div>
	<div class="ncmenu">
		<a href="?show=back" id="ancplaylist_back">
			<div class="ncleft">
				<img src="/skin/frontend/ancprintconfigproduct/default/images/links_weiss_25x50.png" alt="weiter" />
			</div>
		</a>
		<a href="?show=next">
			<div class="ncright" id="ancplaylist_next">
				<img src="/skin/frontend/ancprintconfigproduct/default/images/rechts_weiss_25x50.png" alt="zurück" />
			</div>
		</a>
	</div>
</div> 
<script type="text/javascript">
	jQuery(document).ready(function($) {

		var viewbox_height;
		var viewbox_width;
		if(jQuery('#ncplaylist_preview').length) {
			viewbox_height = jQuery('#ncplaylist_preview').height();
			viewbox_width = jQuery('#ncplaylist_preview').width();
		} else {
			viewbox_height = jQuery(window).height() ;
			viewbox_width = jQuery(window).width();
		}

		jQuery('.ancplaylist-site_showplaylist').css({
			'height': viewbox_height+'px',
			'width' : viewbox_width+'px'
		});
		
		if(jQuery('.nccontent > .ncimage > img ').width() > jQuery('.nccontent > .ncimage > img ').height()) {
			var img_css = {
				'width':	viewbox_width+'px'
			}	
			
		} else {
			var height = viewbox_height -jQuery('.ncheader').outerHeight() - jQuery('.ncmenu').outerHeight();
			var height_klein = height - 30;
			var img_css = {
				'height':	height_klein+'px'
			}			
		}
		console.log(img_css);
			
			jQuery('.nccontent > .ncimage > img ').css(img_css);		
		console.log(jQuery('.nccontent > .ncimage > img '));
		
//		
//		var viewbox_height;
//		if(jQuery('#ncplaylist_preview').length) {
//			viewbox_height = jQuery('#ncplaylist_preview').height();
//		} else {
//			viewbox_height = jQuery(window).innerHeight() ;
//		}
////		console.log('viewbox_height: '+viewbox_height);
//		
////		var realarea = jQuery(window).innerHeight() 
//		var realarea = viewbox_height 
//					-	jQuery('.ncheader').outerHeight() 
//					-	jQuery('.ncmenu').outerHeight() ;
////		console.log(realarea+' <= '+jQuery('.nccontent ').outerHeight());
//		if(realarea <= jQuery('.nccontent ').outerHeight()) {
//			var factor = (realarea-12) / jQuery('.nccontent ').outerHeight();
//			var new_width = Math.round(jQuery('.nccontent ').outerWidth() *  factor);
//
//			var img_css = {
//				'height':	realarea+'px', 
//				'width'	:	new_width+'px'
//			}
////			console.log(img_css);
//			jQuery('.nccontent > .ncimage > img ').css(img_css);
//		}
//
//		var area =		realarea 
//					-	jQuery('.nccontent ').outerHeight();
//		var padding = Math.round(area/2)+'px';
////		console.log(area+' :: '+jQuery('.nccontent ').outerHeight());
//		var css = {
//			'margin-top':  padding,
//		}
////		console.log(css);
//		jQuery('.nccontent').css(css);
	
	});

</script>