Location: PHPKode > scripts > GalleryShuffle > v1.0/php/Views/front.php
<?php

/**
* FRONT
**/

class view_front
{

	public $buffer = "";
	
	public function __construct($albums, $albumId, $albumIsLocked, $galleryIsLocked)
	{
		
		$LANG = LANG::getSingleton();
		
		$model_pictures = new model_pictures();
		$view_settings = new view_settings();
		
		$bodyOnLoad = "javascript: init.load(); ";
		
		if($galleryIsLocked)
			$bodyOnLoad .= FUNCTIONS::getAjaxRequestEval('gallery_connection', 'popup');
		elseif($albumIsLocked)
			$bodyOnLoad .= FUNCTIONS::getAjaxRequestEval('album_connection:' . $albumId, 'popup');
			
		$this->buffer .= HTML::getHtmlHead(CONFIG::galleryTitle, 
		Array("css/all.css",
		"css/front.css"), 
		Array(), 
		Array("http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js",
		"js/screenfull.js",
		"js/typeface-0.15.js",
		"js/brush_script_std_medium.typeface.js",
		"js/functions.js",
		"js/obj_photoViewer.js",
		"js/obj_photoAlbumShuffle.js",
		"js/obj_windowResizers.js",
		"js/obj_horizontalResize.js",
		"js/obj_fileUploader.js",
		"js/obj_panelAlbums.js",
		"js/obj_panelPictures.js",
		"js/obj_menu.js",
		"js/main.js"),
		$bodyOnLoad);
		
		$this->buffer .= "\n\n<!-- FRONT -->\n";
		
		$this->buffer .= '
		
	<div class="loading" id="photoAlbumShuffleLoading"></div>
	
	<div class="photoViewer" id="fullscreenContainer">
		<p class="label"></p>
		<div class="container">
			<a class="btnLeft" title="Previous picture" href="javascript: photoAlbumShuffle.previousImage();"></a>
			<a class="btnRight" title="Next Picture" href="javascript: photoAlbumShuffle.nextImage();"></a>
			<img src="img/diafragm.png" />
		</div>
		<a class="btnClose fullscreenExit" title="close" href="javascript: photoViewer.close();"></a>
		<a class="btnFullscreen fullScreenToggle" title="Fullscreen" href="javascript: ;"></a>
		<a class="btnStop" title="Stop slideShow" href="javascript: photoAlbumShuffle.stopSlideshow();"></a>
		<a class="btnPlay" title="SlideShow" href="javascript: photoAlbumShuffle.startSlideshow();"></a>
		<div class="loading"></div>
	</div>
	
	<div class="menu">
		<ul>
			<li><a href="' . FUNCTIONS::getAjaxRequest('admin_connection', 'popup') . '">' . $LANG->traduc['admin'] . '</a></li>
			<li><a href="http://ingwe.fr/sd/galleryShuffle/" target="_blank">' . $LANG->traduc['webSite'] . '</a></li>
			<li><a href="http://ingwe.fr" target="_blank">' . $LANG->traduc['developer'] . '</a></li>
			<!--li><a href="#" target="_blank">' . $LANG->traduc['findBug'] . '</a></li-->
			<li><p>&copy; copyright - 2012<br />' . CONFIG::title . '</p></li>
			<li class="arrow"></li>
		</ul>
	</div>
	
	<div id="bar">
		<div class="title"><span>' . CONFIG::gallerySubtitle . '</span>&nbsp;&nbsp;' . CONFIG::galleryTitle . '</div>
		<div>
			<table><tr>';
			
		if(!$galleryIsLocked && count($albums) > 1){
		
			foreach($albums as $value){
				
				$this->buffer .= '
				<td ';
				
				if($value['ID'] == $albumId){
					
					$this->buffer .= 'class="selected"';
					
				}else{
				
					$this->buffer .= 'onclick="';
					
					if($value['is_private']) $this->buffer .= FUNCTIONS::getAjaxRequest('album_connection:' . $value['ID'], 'popup');
					else $this->buffer .= "javascript: window.location.href='index.php?albumId=" . $value['ID'] . "';";
					
					$this->buffer .= '"';
				
				}
				
				$this->buffer .= '><p>' . $value['name'] . '</p></td>';
			
			}
		
		}
		
		$this->buffer .= '
				<td class="refresh" onclick="' . "javascript: window.location.href=window.location.href;" . '"><p>&nbsp;</p></td>
			</tr></table>';
		
		if(!$galleryIsLocked && count($albums) > 1) {
			$this->buffer .= '
			<label>' . $LANG->traduc['albums'] . '</label>';
		}
		
		$this->buffer .= '
		</div>

	</div>
	
	<table id="popupTable"><tr><td id="popup"></td></tr></table>';
	
	if(count($albums) == 0){
	
		$this->buffer .= '
		
	<div id="welcome">
		<p class="title">Welcome on your GalleryShuffle<span> v1.0</span> !</p>
		<p><a href="' . FUNCTIONS::getAjaxRequest('admin_connection', 'popup') . '">Logged in</a> to begin...</p>
	</div>';
	
	}
	
	$this->buffer .= '
	
	<div class="photoAlbumShuffle"></div>';
		
		$this->buffer .= "
	<script>
	
	" . $view_settings->getJsPHPCONST() . "
	
	document.getElementById('popupTable').setHide();
	
	";
	
		$this->buffer .= "
	var photoAlbumShufflePictures = new Array(";
		
		if(!$albumIsLocked && !$galleryIsLocked && count($albums) != 0){
		
			$model_buffer = $model_pictures->getAllFromAlbum($albumId);
			
			$isFirst = true;
			foreach($model_buffer as $value){
				
				if(!$isFirst) $this->buffer .= ',';
				else $isFirst = false;
				
				$this->buffer .= '
		Array("' . $value['UID'] . CONFIG::picturesExtension . '","' . $value['name'] . '")';
			
			}
			
		}
		
		$this->buffer .= "
	);";

	
	$this->buffer .= "
	
	window.onresize = function(event) 
	{

		if(photoViewer.container.style.display != 'none') photoViewer.adaptImage();
		
	};

	
	var mouseWheelEvt = function(e)
	{
	
		var event = e || window.event;
		
		if((event.wheelDelta || event.detail) > 0)
			window.scrollTo(window.pageXOffset - 30, 0);
		else
			window.scrollTo(window.pageXOffset + 30, 0);

		return false;
		
	}
	if('onmousewheel' in document.body)
		document.body.onmousewheel = mouseWheelEvt;
	else
		document.body.addEventListener('DOMMouseScroll', mouseWheelEvt);
		
		
	$(function() {

		$('#supported').text( 'Supported: ' + !!screenfull );

		if ( !screenfull ) {
			return false;
		}

		$('#request').click(function() {
			screenfull.request( $('#container')[0] );
			// Does not require jQuery, can be used like this too:
			// screenfull.request( document.getElementById('container') );
		});

		$('.fullscreenExit').click(function() {
			screenfull.exit();
			photoViewer.close();
		});

		$('.fullScreenToggle').click(function() {
			screenfull.toggle( $('#fullscreenContainer')[0] );
		});
	/*
		$('#request2').click(function() {
			screenfull.request();
		});

		$('#demo-img').click(function() {
			screenfull.toggle( this );
		})

		$('#demo-video').click(function() {
			screenfull.toggle( this );
		})*

		screenfull.onchange = function( e ) {
			$('#status').text( 'Is fullscreen: ' + screenfull.isFullscreen );
			var elem = screenfull.element;
			if ( elem ) {
				$('#element').text( 'Element: ' + elem.localName + ( elem.id ? '#' + elem.id : '' ) );
			}
		};

		// Trigger the onchange() to set the initial values
		screenfull.onchange();
	*/

	});

	</script>";
		
		$this->buffer .= "\n\n<!-- /FRONT -->\n";
	
		$this->buffer .= HTML::getHtmlFoot();
		
	}
	
}

?>
Return current item: GalleryShuffle