<?
require("../clases/foro.class.php");
require("../clases/rsptaforo.class.php");
$objr = new rsptaforo();
$obj = new foro();
$t = $_REQUEST["text"];
if($t=="R"){	
		 $f = date("Y-m-d");	
		 $con = $_REQUEST["concepto"];	
		 $det = $_REQUEST["detalle"];	
		 $i = $_REQUEST["iddoc"];
		 $vi = $_REQUEST["visible"];
		 $iddoc_curso = $_REQUEST['iddoc_curso'];		
	if($obj->Crear($f,$con,$det,$i,$vi,$iddoc_curso)){		
					echo "<script languaje=javascript>\n"; 
	 				echo "location.href ='../manforo.php?iddc=$iddoc_curso';";					
	 				echo "</script>"; 
							
		}else{
		       echo "no pasa nada";
		     }
}

if($t=="M"){
         $idf = $_REQUEST['idforo'];
         $con = $_REQUEST["concepto"];	
		 $det = $_REQUEST["detalle"];	
		 $i = $_REQUEST["iddoc"];
		 $vi = $_REQUEST["visible"];
		 $iddoc_curso = $_REQUEST['iddoc_curso'];		
		if($obj->Actualizar($idf,$con,$det,$vi)){		
					echo "<script languaje=javascript>\n"; 
	 				echo "alert('Modificada Correctamente!!!');location.href ='../manforo.php?iddc=$iddoc_curso';";				
	 				echo "</script>"; 
							
		}else{
		       echo "no pasa nada";
		     }
}

if($t=="e"){
 $iddoc_curso = $_REQUEST["iddc"];
 $cod = $_REQUEST["id"];
 if($objr->EliminarPorForo($cod))
 {
   if($obj->Eliminar($cod)){
   
       echo "<script languaje=javascript>\n"; 
	 	echo "location.href ='../manforo.php?iddc=$iddoc_curso';";					
	 	echo "</script>";		
   }
   else
   {
    echo "no se elimino el foro";
	}
  }

}
?>
