site_showplaylist_1.phtml 3.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;
		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>