<?php
	session_start();
	error_reporting(E_ERROR);

  require_once('html/ClsGeneradorHtml.class.php'); 
  require_once('Connections/dbms.class.php');
  require_once('Connections/dbmy.class.php');
  require_once('clsObjetodeDatos.class.php');
  extract ($_POST);
  extract($_GET);
  $bd =new dbms('mysql','no'); 
  $clsObjetodeDatos = new clsObjetodeDatos($bd,$_POST,$_GET);    
  $ClsGeneradorHtml=new ClsGeneradorHtml("","");    


	function cambiaf_a_mysql($fecha){

		ereg( "([0-9]{1,2})/([0-9]{1,2})/([0-9]{2,4})", $fecha, $mifecha);
		$lafecha=$mifecha[3]."-".$mifecha[2]."-".$mifecha[1];	
		return $lafecha;
	}

if (empty($boton)){ 
	echo '
	<link rel="stylesheet" href="css/estilos1.css" type="text/css">
	<script src="jquery.min.js" type="text/javascript"></script>
	<script src="js/gestor_contenido.js" type="text/javascript"></script>
	<script type="text/javascript" src="tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
	<script type="text/javascript">
	tinyMCE.init({
			// General options
			mode : "textareas",
			language : "es",
			theme : "advanced",
			plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",

			// Theme options
			theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
			theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
			theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
			theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
			theme_advanced_toolbar_location : "top",
			theme_advanced_toolbar_align : "left",
			theme_advanced_statusbar_location : "bottom",
			theme_advanced_resizing : true,

			// Skin options
			skin : "o2k7",
			skin_variant : "silver",

			// Example content CSS (should be your site CSS)
			content_css : "tinymce/examples/css/examples.css",

			// Drop lists for link/image/media/template dialogs
			template_external_list_url : "js/template_list.js",
			external_link_list_url : "js/link_list.js",
			external_image_list_url : "js/image_list.js",
			media_external_list_url : "js/media_list.js",

			// Replace values for the template plugin
			template_replace_values : {
					username : "Some User",
					staffid : "991234"
			}
	});
	</script>';

		$grupo=array("SI"=>"SI","NO"=>"NO");
		$forma= $ClsGeneradorHtml->Pagina_Top("Publicar Noticias","","");
		echo $forma;
		echo $ClsGeneradorHtml->Pagina_Inicio_Body();
		echo $ClsGeneradorHtml->htmlTable("","","","100%","center","","bd");
		echo $ClsGeneradorHtml->htmlTd("","","","","hr");
		echo $ClsGeneradorHtml->htmlH("2","left");
		echo "Publicaciones";
		echo $ClsGeneradorHtml->htmlFinH("2");
		echo $ClsGeneradorHtml->htmlFinTd();
		echo $ClsGeneradorHtml->htmlFinTable();
		echo $ClsGeneradorHtml->htmlTable("5","0","0","100%","center","","","border:1px solid #ccc;");
		echo $ClsGeneradorHtml->htmlInicioFormulario("POST","frmPublicaciones");
		echo $ClsGeneradorHtml->htmlTr();
		echo $ClsGeneradorHtml->htmlTd("20%").$ClsGeneradorHtml->htmlEtiqueta('Publicar:').$ClsGeneradorHtml->htmlFinTd();
		echo $ClsGeneradorHtml->htmlTd().$ClsGeneradorHtml->htmlSelectArray($grupo,"cmbPublicar","","","").$ClsGeneradorHtml->htmlFinTd();
		echo $ClsGeneradorHtml->htmlFinTr();
		echo $ClsGeneradorHtml->htmlFinTable();
		echo $ClsGeneradorHtml->htmlTable("5","0","0","100%","center","","","border:1px solid #ccc;");
		echo $ClsGeneradorHtml->htmlTd("2%").'<textarea id="contenido" name="contenido" style="width:100%"></textarea>'.$ClsGeneradorHtml->htmlFinTd();
		echo $ClsGeneradorHtml->htmlFinTable();
		echo $ClsGeneradorHtml->htmlTable("5","0","0","100%","center","","","");
		echo $ClsGeneradorHtml->htmlTd("25%","left").$ClsGeneradorHtml->htmlBoton("Guardar", "cmdEnviar").$ClsGeneradorHtml->htmlFinTd();
		echo $ClsGeneradorHtml->htmlFinTable();		
		echo $ClsGeneradorHtml->htmlSaltolinea();
		echo $ClsGeneradorHtml->htmlSaltolinea();
		echo $ClsGeneradorHtml->htmlSaltolinea();
		echo $ClsGeneradorHtml->htmlCenter().$ClsGeneradorHtml->htmlDiv("MENSAJES","","","MENSAJES").$ClsGeneradorHtml->htmlFinCenter();
		echo $ClsGeneradorHtml->htmlFinDiv();
		
		echo $ClsGeneradorHtml->htmlFinFormulario();
		echo $ClsGeneradorHtml->Pagina_Fin_Body();
		echo $ClsGeneradorHtml->Pagina_Fin_Html();
}else{
  /**  if(empty($content)){
	   echo "<TABLE align=center width=100%  BORDER=0 CELLSPACING=0 CELLPADDING=0><TD COLSPAN=2 ALIGN='CENTER'><INPUT TYPE='image' src='imagenes/informacion.gif'><FONT class=font ><STRONG> Registre el cuerpo del Mensaje</STRONG></FONT></TD></TABLE>";	
	   return;	
	}
	if(empty($txtAsunto)){
	   echo "<TABLE align=center width=100%  BORDER=0 CELLSPACING=0 CELLPADDING=0><TD COLSPAN=2 ALIGN='CENTER'><INPUT TYPE='image' src='imagenes/informacion.gif'><FONT class=font ><STRONG> Registre el Asunto</STRONG></FONT></TD></TABLE>";	
	   return;	
	}
	if(empty($cmbgrupo)){
	   echo "<TABLE align=center width=100%  BORDER=0 CELLSPACING=0 CELLPADDING=0><TD COLSPAN=2 ALIGN='CENTER'><INPUT TYPE='image' src='imagenes/informacion.gif'><FONT class=font ><STRONG> Registre el Destinatario</STRONG></FONT></TD></TABLE>";	
	   return;	
	}*/
	if ($cmbpublicar=="SI"){
		$sql = " update `siga_pregrado`.`gestor_contenido` set publicar='NO'"; 
		$bd->EjecutarQuery($sql); 
		$publicar ='SI';
	}else{
		$publicar ='NO';
	}
	$sql = "INSERT INTO `siga_pregrado`.`gestor_contenido` ( `contenido`, `publicar`, `fecha`) VALUES ('".$content."', '".$cmbpublicar."', '".date("Y-m-d")."')"; 
	$bd->EjecutarQuery($sql); 
		

		
}

?>
