function ADDALTBanner() {
			
			$idbanner = $_GET["idbanner"];
			$banner = new Banner();
			$bannerDAO = new BannerDAO();
			$banner = $bannerDAO->getBannerPorId($idbanner);
				
			$iddep = $_GET["iddep"];
			$lado = $_GET["lado"];
			$numero = $_GET["numero"];
							
			if(isset($idbanner)) {
				$width = $banner->getWidth(); 
			    $height = $banner->getHeight();
			    $width = $width / 2;
			    $height = $height / 2;
				$acao = "Alterar";
				$classBotao = "bttn4";
			}else{
				$acao = "Adicionar";
				$classBotao = "bttn2";
			}
			
			//print_r($banner);
			?>
			<span class="TituloPage">• <?=$acao;?> Banner</span>
	        <br/>
	        <br/>
			<form method="POST" action="act/Banner.act.php?acao=<?=$acao;?>" enctype="multipart/form-data">			
			<table width="558" cellspacing="1" cellpadding="4" border="0" class="BordaTabela">
				<tr class="TituloTabela">
					<td colspan="3">
						<b><?=$acao;?> Banner</b>
					</td>
				</tr>
				<tr class="Linha1Tabela">
					<td align="center">
						<table align="center" width="100%" border="0" cellpadding="3" cellspacing="1">										
							<tr class="Linha1Tabela">
								<td width="35%" class="label">Imagem ou animaçao do Banner</td>
								<td><input class="FORMbox" type="file" name="banner" size="50"></td>							
							</tr>
							<tr class="Linha1Tabela">
								<td class="label">URL</td>
								<td><input class="FORMbox" type="text" name="url" size="50" value="<?=$banner->getUrl();?>"></td>
							</tr>						
							<tr class="Linha1Tabela">
								<td class="label">Ao clicar, Pagina designada:</td>
								<td valign="bottom"><select class="FORMbox" name='target'><option value='_self' <? if($banner->getTarget() == "_self") { echo "selected"; } ?>>Abra em Pagina Atual</option><option value='_blank' <? if($banner->getTarget() == "_blank") { echo "selected"; } ?>>Abra em uma Nova Pagina</option></select></td>
							</tr>
							<tr>
								<td>Por quanto tempo<br>este banner será exibido:</td>
								<td>
									<select name="tempo" class="FORMBox">
										<option value="0">Ilimitado</option>
										<option value="valor">- Escolha o valor -</option>
										<option value="5">5 DIAS</option>
										<option value="10">10 DIAS</option>
										<option value="15">15 DIAS</option>
										<option value="20">20 DIAS</option>
										<option value="25">25 DIAS</option>
										<option value="30">30 DIAS</option>
										<option value="60">60 DIAS</option>
										<option value="90">90 DIAS</option>
										<option value="120">120 DIAS</option>
										<option value="150">150 DIAS</option>
										</select>
										 (ou) Entre valor:<input name="valor" size="5" type="text"  class="FORMBox">
								</td>
							</tr>
							<tr class="Linha1Tabela">
								<td colspan="2"><br></td>
							</tr>
							<tr class="Linha1Tabela">
								<td colspan="2"><input type="submit" class="<?=$classBotao;?>" name="botao" value="<?=$acao;?>"><input type="button" class="bttn1" value="Voltar" onclick="javascript:history.back();"><? if($acao == "Alterar") {?><input type="submit" class="bttn3" onclick="return confirma_apagar();" value="Excluir Banner" name="remover"/><? } ?></td>
							</tr>							
						</table>
					</td>
				</tr>			
				<tr class="Linha1Tabela">
					<td align="center" colspan="2">
					<? if($this->pegaExt($banner->getBanner()) == "swf") { ?>													
						<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="<?=$width;?>" height="<?=$height;?>" id="promocao" align="middle">
						<param name="movie" value="../images/banners/<?=$banner->getBanner();?>" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" /><embed src="../images/banners/<?=$banner->getBanner();?>" quality="high" wmode="transparent" bgcolor="#ffffff" width="<?=$width;?>" height="<?=$height;?>" name="promocao" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
						</object>
					<? }else{ ?>
						<img src="../images/banners/<?=$banner->getBanner();?>" border="0">
					<? } ?>
					<? if(!$idbanner) { ?>																	
						<input type="hidden" name="iddep" value="<?=$iddep;?>">				
						<input type="hidden" name="lado" value="<?=$lado;?>">				
						<input type="hidden" name="numero" value="<?=$numero;?>">				
						<input type="hidden" name="largura" value="<?=$largura;?>">				
						<input type="hidden" name="altura" value="<?=$altura;?>">				
					<? }else{ ?>
						<input type="hidden" name="idbanner" value="<?=$banner->getIdbanner();?>">
						<input type="hidden" name="banner" value="<?=$banner->getBanner();?>">																	
						<input type="hidden" name="iddep" value="<?=$banner->getIddepartamento();?>">																	
						<input type="hidden" name="lado" value="<?=$banner->getLado();?>">				
						<input type="hidden" name="numero" value="<?=$banner->getNumero();?>">
						<input type="hidden" name="largura" value="<?=$largura;?>">				
						<input type="hidden" name="altura" value="<?=$altura;?>">	
					<? } ?>
					</td>
				</tr>
			</table>		
			</form>	
	<?	}
Ejemplo n.º 2
0
     $ok = $banner->upload_banners($name, $type, $tmp_name, $size, $tamanho, $banner->getWidth(), $banner->getHeight());
     if ($ok == true) {
         $iddep = $banner->getIddepartamento();
         $bannerDAO->Insere($banner);
         header("location: ../principal.php?menu={$idmenu}&act={$act}&iddep={$iddep}");
     } else {
         header("location: ../principal.php?menu={$idmenu}&act={$act}");
     }
     break;
     //altera banner
 //altera banner
 case "Alterar":
     $act = "mostra";
     if ($_POST["remover"]) {
         $idbanner = $_POST["idbanner"];
         $banner = $bannerDAO->getBannerPorId($idbanner);
         $iddep = $banner->getIddepartamento();
         $bannerDAO->Deleta($banner->getIdbanner());
         header("location: ../principal.php?menu={$idmenu}&act={$act}&iddep={$iddep}");
     } else {
         if ($_POST["valor"] == "") {
             if ($_POST["tempo"] == "0") {
                 $tempo = '0000-00-00 00:00:00';
             } else {
                 $dias = $_POST["tempo"];
                 $dias = "+" . $dias . " days";
                 $timestamp = strtotime($dias);
                 $tempo = date('Y-m-d G:i:s', $timestamp);
             }
         } else {
             $dias = $_POST["valor"];