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

/**
* ALBUMS
**/

class view_albums extends view_classicView
{
	
	public function getAll($selectedId=NULL) 
	{
		
		$buffer = '';
		$script = '';
		
		$model_buffer = $this->model->getAll();
		if($model_buffer) {
			
			foreach($model_buffer as $key => $value) {
			
				$buffer .= '
						<div id="album_' . $value['ID'] . '" onmouseover="javascript: panelAlbums.albumOver(event);" onmouseout="javascript: panelAlbums.albumOut(event);" class="';
					
				if($value['is_active'] == 1) $buffer .= 'active ';
				else $buffer .= 'invisible ';
				if($value['is_private'] == 1) $buffer .= 'locked ';
				if($selectedId == $value['ID']) $buffer .= 'selected ';
				
				$buffer .= '"><a class="btnTrash" href="' . FUNCTIONS::getAjaxRequest('albums_delete:' . $value['ID'], 'popup') . '"></a><p onmousedown="javascript: panelAlbums.albumStartDrag(event, ' . $value['ID'] . ');" onclick=" javascript: panelAlbums.albumClick(event, ' . $value['ID'] . '); ' . FUNCTIONS::getAjaxRequestEval('pictures_listfromalbum:' . $value['ID'], 'panel_pictures') . FUNCTIONS::getAjaxRequestEval('albums_edit:' . $value['ID'], 'panel_options') . '" class="title">' . $value['name'] . '</p></div>';
			
			}
			
		}else{
		
			$buffer .= '
						<p class="empty">' . $this->LANG->traduc['warningNoAlbum'] . '</p>';
			
		}
		
		$btnAddHref = FUNCTIONS::getAjaxRequest('albums_create', 'panel_options');
		$helpContent = '<p class="active">' . $this->LANG->traduc['active'] . '</p><p class="invisible">' . $this->LANG->traduc['invisible'] . '</p><p class="locked">' . $this->LANG->traduc['locked'] . '</p>';
		
		return $this->getPanel($buffer, $this->LANG->traduc['addAlbum'], $btnAddHref, $helpContent, 'panelAlbums');
	
	}
	
	public function getCreateForm() 
	{
		
		$uid = uniqid();
		
		$buffer = '
					<table id="album_form_' . $uid . '"><tr>
						<td>
							<input type="checkbox" name="active" id="album_active_' . $uid . '" /><label for="album_active_' . $uid . '">' . $this->LANG->traduc['active'] . '</label><br />
							<label for="album_title_' . $uid . '">' . $this->LANG->traduc['title'] . ' :</label><input name="title" id="album_title_' . $uid . '" size="30" />
						</td>
						<td>
							<input onclick="javascript: var object = document.getElementById(' . "'albums_private_" . $uid . "'" . '); if(object.style.opacity < 1){ object.setOpacity(1); }else{ object.setOpacity(0.3); };" type="checkbox" name="locked" id="album_locked_' . $uid . '" />
							<label for="album_locked_' . $uid . '">' . $this->LANG->traduc['locked'] . '</label><br />
							<div id="albums_private_' . $uid . '" style="opacity: 0.3;"><label for="album_password_' . $uid . '">' . $this->LANG->traduc['password'] . ' :</label>
							<input type="password" id="album_password_' . $uid . '" size="8" /></div>
						</td>
						<td class="horizontalMargin">&nbsp;</td>
						<td class="btnSave" onClick="' . FUNCTIONS::getAjaxRequest('albums_createfinish', 'panel_albums', 'album_form_' . $uid) . '">' . $this->LANG->traduc['addAlbum'] . '</td>
						<td class="btnTrash" style="visibility: hidden;">&nbsp;</td>
					</tr></table>';
					
		return $buffer;
		
	}
	
	public function getEditForm($id) 
	{
		
		$model_buffer = $this->model->getLineById($id);
		$uid = uniqid();
		
		$buffer = '
					<table id="album_form_' . $uid . '"><tr>
						<td>
							<input type="checkbox" name="active" id="album_active_' . $uid . '"';
							
		if($model_buffer['is_active'] == 1) $buffer .= ' checked="checked"';
		
		$buffer .= ' /><label for="album_active_' . $uid . '">' . $this->LANG->traduc['active'] . '</label><br />
							<label for="album_title_' . $uid . '">' . $this->LANG->traduc['title'] . ' :</label><input name="title" id="album_title_' . $uid . '" size="30" value="' . $model_buffer['name'] . '"/>
						</td>
						<td>
							<input onclick="javascript: var object = document.getElementById(' . "'album_private_" . $uid . "'" . '); if(object.style.opacity < 1){ object.setOpacity(1); }else{ object.setOpacity(0.3); };" type="checkbox" name="locked" id="album_locked_' . $uid . '"';
							
		if($model_buffer['is_private'] == 1) $buffer .= ' checked="checked"';
		
		$buffer .= ' /><label for="album_locked_' . $uid . '">' . $this->LANG->traduc['locked'] . '</label><br />
							<div id="album_private_' . $uid . '" style="opacity: ';
							
		if($model_buffer['is_private'] == 0) $buffer .= '0.3';
		else $buffer .= '1';
		
		$buffer .= ';"><label for="album_password_' . $uid . '">' . $this->LANG->traduc['password'] . ' :</label><input name="password" id="album_password_' . $uid . '" size="8" value="' . $model_buffer['password'] . '" /></div>
						</td>
						<td><p><b>' . $this->LANG->traduc['dateCreated'] . ' : </b>' . FUNCTIONS::stringNoWrap($model_buffer['date_created'] . '</p><p><b>' . $this->LANG->traduc['dateModified']) . ' : </b>' . FUNCTIONS::stringNoWrap($model_buffer['date_modified']) . '</p></td>
						<td class="horizontalMargin">&nbsp;</td>
						<td class="btnSave" onClick="' . FUNCTIONS::getAjaxRequest('albums_editfinish:' . $id, 'panel_albums', 'album_form_' . $uid) . '">' . $this->LANG->traduc['save'] . '</td>
						<td class="btnTrash" onClick="' . FUNCTIONS::getAjaxRequest('albums_delete:' . $id, 'popup') . '">&nbsp;</td>
					</tr></table>';
		
		return $buffer;
		
	}
	
	
	public function getPopupDelete($id) 
	{
		
		$model_buffer = $this->model->getLineById($id);
		
		$subject = $this->LANG->traduc['warningDeleteAlbumSubject'] . '"' . $model_buffer['name'] . '" ?';
		$btnHref = FUNCTIONS::getAjaxRequestEval('albums_deletefinish:' . $model_buffer['ID'], 'panel_albums');
		
		return $this->getPopup($subject, $this->LANG->traduc['warningDeleteAlbumText'], NULL, $this->LANG->traduc['delete'], $btnHref);
	
	}
	
}

?>
Return current item: GalleryShuffle