/*--carga las clases que necesita en este la pagina para hacer las consultas y despliegues*/
require_once ("class/Materia.class.php");
require_once ("class/TypeDocument.class.php");
require_once ("class/Preinscripcion.class.php");
require_once ("class/ProgramaConjunto.class.php");
require_once ("class/User.class.php");
require_once ("class/Poll.class.php");
require_once ("class/Teacher.class.php");
require_once ("class/Sustentacion.class.php");
require_once ("class/Db.class.php");
require_once ("class/Correo.class.php");
require_once ("class/Candidate.class.php");
require_once ("include/include.inc.php");
require_once ("class/Worksheet.class.php");
require_once ("class/Workbook.class.php");
require_once ("class/ConsultasDAO.class.php");
require_once ("class/GraduadosHist.class.php");
session_start();
if (!session_is_registered('user'))session_register('user');
if (!session_is_registered('teacher'))session_register('teacher');
if (!session_is_registered('admin'))session_register('admin');
header('Content-Type: text/html; charset=ISO-8859-1');
if ( isset ( $screen ) && $screen == "formatos" )
{
require_once("templates/template_admin_formatos.php");
?>
Magister en Ingeniería de Sistemas
}
/*----------------------------------------------------------------------------------------------------------------
* Sino esta validado - validelo
* Aqui se hace la validacion de los Usuarios del sistema magsist:
* 1. hace la validacion usando el servidor ldap de la universidad con lo caul un usuario se puede valiar
* con el login y pw de su cuenta de correo de uniandes
* 2. Si se valido el usuario como estudiante de la universidad ahora valida que sea un estudiante de la
* maestria en sistemas
* 3. hay tres cuentas especiales de las cuales dos son de administrador y una de observador, las cuales son
* validadas por el ldap y luego se admiten sin mas validacion.
---------------------------------------------------------------------------------------------------------------*/
if ( !isset( $_SESSION['admin'] ) ||
( !$_SESSION['admin'] &&
( !isset( $_SESSION['user'] ) ||
( !$_SESSION['user'] &&
( !isset( $_SESSION['teacher' ]) || $_SESSION['teacher'] == "" )
)
)
)
)
{
$_SESSION['admin'] = false;
$_SESSION['observer'] = false;
$autenticate = false;
$db = new Db("localhost","maestria","7ujm,ki8","maestria");
if ( isset ( $_POST['login'] ) && isset ( $_POST['password'] ) && $_POST['password'] != "" )
{
$ds = ldap_connect("ldap.uniandes.edu.co", "389");
if ($ds)
{
$r =@ldap_bind( $ds, "uid=".$_POST['login'].",ou=people,dc=uniandes,dc=edu,dc=co",$_POST['password'] );
if ( $r )
{
$autenticate = true;
if (($_POST['login']=="marc-her" ) || ($_POST['login']=="stakahas" ) || ($_POST['login']=="magsist"))
{
$_SESSION['admin'] = true;
}
else if ( $_POST['login']=="yroman" )
{
$_SESSION['admin'] = true;
$_SESSION['observer'] = true;
}
else if ( $_POST['login']=="crozo")
{
$_SESSION['admin'] = true;
}
else if ( $_POST['login']=="yrincon")
{
$_SESSION['admin'] = true;
}
}
else if ($_POST['login']=="magsist" && $_POST['password']=="col12345")
{
$autenticate = true;
$_SESSION['admin'] = true;
}
else
{
$autenticate = false;
}
@ldap_close($ds);
}
if ( $autenticate )
{
//Si ya se autentico como administrador siga
if ( $_SESSION['admin'] && $autenticate ) {
$screen = "principal_administracion";
}
//Sino es administrador
else if ( $autenticate ){
//Si se autentico en el ldap de la universidad mire que exista como estudiante en la maestria
$db->query("select * from magsist_user where login = '". $_POST['login'] ."'");
if ( $db->numrows() > 0) {
$_SESSION['user'] = new User ($db, $_POST['login']);
$_SESSION['user'] = serialize ( $_SESSION['user'] );
$_SESSION['estudiante'] = true;
$screen = "show_user";
}
//Si no es estudiante mire que sea profesor
else {
$db->query("SELECT * FROM magsist_teacher WHERE login = '".$_POST['login']."'");
if ( $db->numrows() > 0) {
$_SESSION['teacher'] = new Teacher ($db, $_POST['login']);
$_SESSION['teacher'] = serialize ( $_SESSION['teacher'] );
$_SESSION['profesor']= true;
$screen = "show_teacher";
}
//si tampoco no es profesor salga
else {
$autenticate = false;
}
}
}
}
}
}
//Si ya fue validado obtenga el screen actual y muestrelo
else
{
if ( isset( $_POST['screen'] ) )
{
$screen = $_POST['screen'];
}
else if ( isset( $_GET['screen'] ) )
{
$screen = $_GET['screen'];
}
else
{
$screen = "show_user";
}
}
/*-----------------------------------------------------------------------------------------------------------
* Si lasession es administrador mire en cual ventana esta la session y desplieguela
*/
if ( $_SESSION['admin'] )
{
if ( isset ( $screen ) && $screen == "report_poll" )
{
require_once("templates/template_admin_report_poll.php");
}
else if ( isset ( $screen ) && $screen == "show_teacher") {
require_once("templates/template_admin_teachers.php");
}
else if ( isset ( $screen ) && $screen == "update_teacher") {
$profe = new Teacher( new Db("localhost","maestria","7ujm,ki8","maestria"),'');
$profe->update( $_POST['login_prof'], $_POST['nombres_prof'], $_POST['apellidos_prof'], $_POST['area1_prof'],
$_POST['area2_prof'], $_POST['activo_prof'] );
$profe->commit(0);
require_once("templates/template_admin_teachers.php");
}
else if ( isset ( $screen ) && $screen == "add_teacher") {
$profe = new Teacher( new Db("localhost","maestria","7ujm,ki8","maestria"),'');
$profe->update( $_POST['login_prof'], $_POST['nombres_prof'], $_POST['apellidos_prof'], $_POST['area1_prof'],
$_POST['area2_prof'], $_POST['activo_prof'] );
$profe->commit(1);
require_once("templates/template_admin_teachers.php");
}
else if ( isset ( $screen ) && $screen == "preinsc" )
{
require_once("templates/template_admin_preinscripciones.php");
}
else if ( isset ( $screen ) && $screen == "principal_administracion" )
{
require_once("templates/template_admin_user.php");
}
else if ( isset ( $screen ) && $screen == "show_matter" )
{
require_once("templates/template_admin_matters.php");
}
else if ( isset ( $screen ) && $screen == "programa_conjunto" ) {
require_once("templates/template_admin_programa_conjunto.php");
} else if( isset ($screen) && $screen == "edit_programa_conjunto" ) {
require_once("templates/template_admin_edit_pc.php");
} else if( isset ($screen) && $screen == "modify_pc_student" ) {
$hoy = "$current_date[year]-$current_date[mon]-$current_date[mday] $current_date[hours]:$current_date[minutes]:$current_date[seconds]";
$pc = new ProgramaConjunto( new Db("localhost","maestria","7ujm,ki8","maestria") , $_POST['codigo']);
if ( $_POST['aceptado'] == 1 ) {
$pc->update(
$_POST['nombres'],
$_POST['apellidos'],
$_POST['codigo'],
$_POST['promedio'],
$_POST['creditos'],
$_POST['sem_grado'],
$_POST['prog_pregrado'],
$_POST['correo'],
$hoy,
$_POST['area'],
$_POST['aceptado']
);
$pc->commit( 0 );
}
//Generar Carta RTF
if( $_POST['est_ant'] != $_POST['aceptado'] ) {
if ( $_POST['aceptado'] == 1 ) {
?>
} else if( $_POST['aceptado'] == 0 ) {
//borrar registro de la base de datos
$pc->excluir();
?>
} else {
?>
}
} else {
?>
}
} else if ( isset ( $screen ) && $screen == "generarCartaAceptadoPC" ) {
require_once("templates/template_generar_aceptado_pc.php");
} else if( isset ($screen ) && $screen == "generarCartaExcluidoPC") {
require_once("templates/template_generar_excluido_pc.php");
} else if ( isset ($screen) && $screen == "correoPC"){
require_once("templates/template_admin_mail_pc.php");
} else if ( isset ($screen) && $screen == "enviarCorreoPC" ) {
require_once("templates/template_admin_enviar_correo_pc.php");
}
else if ( isset ( $screen ) && $screen == "inscritos" )
{
require_once("templates/template_admin_inscritos.php");
}
else if ( isset ( $screen ) && $screen == "edit_candidate" )
{
require_once("templates/template_admin_edit_candidate.php");
}
else if ( isset ( $screen ) && $screen == "candidateMail" )
{
require_once("templates/template_admin_insc_mail.php");
}
else if ( isset ( $screen ) && $screen == "send_mail" )
{
require_once("templates/template_admin_send_mail.php");
}
else if ( isset ( $screen ) && $screen == "del_candidate" ) {
if ( isset ($_POST['idCandidate']) ) {
$idCandidato = $_POST['idCandidate'];
} else {
$idCandidato = $_GET['idCandidate'];
}
if( $idCandidato > 0 ) {
$candidate = new Candidate( new Db("localhost","maestria","7ujm,ki8","maestria"), $idCandidato );
$candidate->deleteCandidate( $idCandidato );
}
require_once("templates/template_admin_inscritos.php");
}
else if ( isset ( $screen ) && $screen == "update_candidate" )
{
$candidate = new Candidate(new Db("localhost","maestria","7ujm,ki8","maestria"), $_POST['idCandidate'] );
$candidate->update( $_POST['idCandidate'], $_POST['nombre'], $_POST['apellido'], $_POST['cedula'],
$_POST['address'], $_POST['city'], $_POST['telefono'], $_POST['celular'],
$_POST['email1'], $_POST['email2'], $_POST['empresa'], $_POST['cargo'], $_POST['dir_empresa'],
$_POST['tel_empresa'], $_POST['ciudad_empresa'], $_POST['doc1'], $_POST['doc2'],
$_POST['doc3'], $_POST['doc4'], $_POST['doc5'], $_POST['doc6'],
$_POST['doc7'], $_POST['doc8'], $_POST['doc9'], $_POST['promedio'],
$_POST['universidad'], $_POST['titulo'], $_POST['ciudad'], $_POST['area'],
$_POST['consignacion'], $_POST['financiacion'], $_POST['posgrado'], $_POST['centro'],
$_POST['codigo'], $_POST['ref1'], $_POST['ref2'], $_POST['ref3'],
$_POST['ref4'], $_POST['observaciones'], $_POST['aceptado'], $_POST['NC'],
$_POST['NR'], $_POST['NB'], $_POST['ok1'], $_POST['ok2'], $_POST['ok3'], $_POST['ok4']
);
if( $candidate->id != '' ) {
$candidate->commit( 0 );
}
else {
$candidate->commit( 1 );
}
require_once("templates/template_admin_inscritos.php");
}
else if ( isset ( $screen ) && $screen == "edit_matter" )
{
require_once("templates/template_admin_edit_matter.php");
}
else if ( isset ( $screen ) && $screen == "update_matter" )
{
$materia = new Materia ( new Db("localhost","maestria","7ujm,ki8","maestria"), $_POST['source'] );
$materia->update( $_POST['source'], $_POST['description'] );
$materia->commit( 0 );
require_once("templates/template_admin_matters.php");
}
else if ( isset ( $screen ) && $screen == "edit_user" )
{
require_once("templates/template_admin_edit_user.php");
}
else if ( isset ( $screen ) && $screen == "logout" )
{
session_destroy();
require_once("templates/template_login.php");
}
else if ( isset ( $screen ) && $screen == "update_user" )
{
$user = new User(new Db("localhost","maestria","7ujm,ki8","maestria"), $_POST['login']);
$user->update( $_POST['login'], $_POST['first_name'], $_POST['last_name'], $_POST['id_card'],
$_POST['id_code'], $_POST['home_phone1'], $_POST['home_phone2'], $_POST['home_address'],
$_POST['cel_phone'], $_POST['office_phone1'], $_POST['office_phone2'], $_POST['office_address'],
$_POST['email'], $_POST['optional_email1'], $_POST['optional_email2'], $_POST['description'],
$_POST['area'], $_POST['req_english'] );
$user->commit();
require_once("templates/template_admin_user.php");
}
else if ( isset ( $screen ) && $screen == "add_document" )
{
require_once("templates/template_admin_add_document.php");
}
else if ( isset ( $screen ) && $screen == "add_course" )
{
require_once("templates/template_admin_add_course.php");
}
else if ( isset ( $screen ) && $screen == "sustentaciones" )
{
require_once("templates/template_admin_sustentaciones.php");
}
else if (isset ( $screen ) && $screen == "admin_sustentaciones") {
require_once("templates/template_admin_edit_sustentaciones.php");
}
else if (isset ( $screen ) && $screen == "admin_add_sustentation") {
require_once("templates/template_admin_modify_sustentaciones.php");
}
else if (isset ( $screen ) && $screen == "adicionar_sustentacion") {
$sustentacion = new Sustentacion(new Db("localhost","maestria","7ujm,ki8","maestria"),'');
$accion = $_POST['tact'];
if($accion == 2 ){
$sustentacion->update( $_POST['id'], $_POST['asesorado'], $_POST['titleThesis'], $_POST['adviser'],
$_POST['jury1'], $_POST['jury2'], $_POST['jury3'], $_POST['fecha'], $_POST['fechaFin'], $_POST['finHora'], $_POST['finMinuto'], $_POST['salon']);
$sustentacion->commit( $_POST['adicionar'] );
}
else if($accion == 1) {
$sustentacion->deleteSustentacion( $_POST['asesorado'], $_POST['fecha'] );
}
?>
}
else if (isset ( $screen ) && $screen == "eliminar_sustentacion") {
$sustentacion = new Sustentacion( new Db("localhost","maestria","7ujm,ki8","maestria"), '' );
if ( isset($_POST['fecha']) ) {
$sustentacion->deleteSustentacion( $_POST['user'], $_POST['fecha'] );
}
else{
$sustentacion->deleteSustentacion( $_GET['user'], $_GET['fecha'] );
}
?>
}
else if ( isset ( $screen ) && $screen == "formatos" )
{
require_once("templates/template_admin_formatos.php");
}
else if ( isset ( $screen ) && $screen == "edit_document" )
{
require_once("templates/template_admin_edit_document.php");
}
else if ( isset ($screen) && $screen == "edit_user_notes" )
{
require_once("templates/template_admin_edit_user_notes.php");
}
else if ( isset ($screen) && $screen == "update_calf" )
{
$course = new Course( new Db("localhost","maestria","7ujm,ki8","maestria"), $_POST['cod_user'], $_POST['date'], $_POST['code'] );
$course->update( $_POST['cod_user'], $_POST['date'], $_POST['code'], $_POST['credits'], $_POST['calf'], $_POST['area'] );
$course->commit( 1 );
?>
}
else if ( isset ($screen) && $screen == "add_calf" )
{
$course = new Course( new Db("localhost","maestria","7ujm,ki8","maestria"), $_POST['cod_user'], $_POST['date'], $_POST['code'] );
$course->update( $_POST['cod_user'], $_POST['fecha'], $_POST['code'], $_POST['credits'], $_POST['calf'], $_POST['area'] );
$course->commit( 0 );
?>
}
else if ( isset ( $screen ) && $screen == "insert_document" )
{
$document=new Document( new Db("localhost","maestria","7ujm,ki8","maestria"), false );
if (isset($_FILES['new_file']) && $_FILES['new_file']['size'] > 0)
{
if ( copy($_FILES['new_file']['tmp_name'], "documents/".$_POST['user']."_".$_POST['type']."_".$_FILES['new_file']['name']) )
{
$document->update( $document->id,$_POST['user'], $_POST['type'], $_POST['title'], $_POST['owner'],
$_POST['adviser'], $_POST['jury1'], $_POST['jury2'], $_POST['jury3'],
$_POST['jury4'], $_POST['description'],
"documents/".$_POST['user']->login."_".$_POST['type']."_".$_FILES['new_file']['name']);
$document->commit();
}
else
{
echo "error";
}
}
else
{
$document->update( $document->id, $_POST['user'], $_POST['type'], $_POST['title'],
$_POST['owner'], $_POST['adviser'], $_POST['jury1'], $_POST['jury2'],
$_POST['jury3'], $_POST['jury4'], $_POST['description'], "");
$document->commit();
}
?>
}
else if ( isset ( $screen ) && $screen == "update_document" )
{
$document=new Document( new Db("localhost","maestria","7ujm,ki8","maestria"), $_POST['id'] );
$document->update( $_POST['id'], $_POST['user'], $_POST['type'], $_POST['title'],
$_POST['owner'], $_POST['adviser'], $_POST['jury1'], $_POST['jury2'],
$_POST['jury3'], $_POST['jury4'], $_POST['description']);
$document->commit();
?>
}
else if (isset($screen) && $screen == "report_grado"){
require_once("templates/template_admin_report_grado.php");
}
else if (isset($screen) && $screen == "edit_graduate_notes"){
require_once("templates/template_edit_notas_graduandos.php");
}
else if(isset($screen) && $screen == "update_graduate_notes"){
$notas = new Course ( new Db("localhost","maestria","7ujm,ki8","maestria"), '', '', '');
//$db = new Db("localhost","maestria","7ujm,ki8","maestria");
$tam = $_POST['num_matt'];
for( $k = 0; $k < $tam ; $k++) {
$calificacion = $_POST['calf'.$k];
$area_matt = $_POST['area'.$k];
$sem_matt = $_POST['matter_date'.$k];
$code_matt = $_POST['matter_code'.$k];
$notas->update( $_POST['cod_user'], $sem_matt, $code_matt, '', $calificacion, $area_matt );
$notas->commit( 1 );
}
?>
}
else if (isset($screen) && $screen == "imp_report_grado"){
require_once("templates/template_admin_generar_reporte_grado.php");
}
else if (isset($screen) && $screen == "graduandos_historico")
{
require_once("templates/template_graduandos_historico.php");
}
else
{
require_once("templates/template_admin_user.php");
}
}
/**-------------------------------------------------------------------------------------------------
* Si no es el adminstrador despilegue el screen de la session correspondiente
*/
else if ( $_SESSION['estudiante']) {
if ( isset ( $screen ) && $screen == "poll" ) {
require_once("templates/template_poll.php");
}
else if ( isset ( $screen ) && $screen == "preinsc" ) {
require_once("templates/template_preinscripciones.php");
}
else if ( isset ( $screen ) && $screen == "send_preinsc" ) {
$_SESSION['user'] = unserialize( $_SESSION['user'] ) ;
$matts = "";
$sep = "";
$esgr = "NO";
for ($i=0; $iupdate( $_SESSION['user']->login, $matts, $_POST['otraMat'], $esgr );
$preinscripcion->commit( !$preinscripcion->preinscribio($_SESSION['user']->login) );
$_SESSION['user'] = serialize( $_SESSION['user'] ) ;
require_once("templates/template_show_user.php");
}else if ( isset ( $screen ) && $screen == "no_preinsc" ) {
$_SESSION['user'] = unserialize( $_SESSION['user'] ) ;
$matts = "";
$esgr = "SI";
$preinscripcion = new Preinscripcion( new Db("localhost","maestria","7ujm,ki8","maestria") );
$preinscripcion->update( $_SESSION['user']->login, $matts, $_POST['otraMat'], $esgr );
$preinscripcion->commit( !$preinscripcion->preinscribio($_SESSION['user']->login) );
$_SESSION['user'] = serialize( $_SESSION['user'] ) ;
require_once("templates/template_show_user.php");
}
else if ( isset ( $screen ) && $screen == "send_poll" ) {
$poll = new Poll(new Db("localhost","maestria","7ujm,ki8","maestria"), $_POST['A'], $_POST['B'], $_POST['TA'], $_POST['TB'], $_POST['semestre'], $_POST['fecha'], $_POST['area']);
$poll->commit();
$_SESSION['user'] = unserialize( $_SESSION['user'] ) ;
$_SESSION['user']->writePoll();
$_SESSION['user']->commit();
$_SESSION['user'] = serialize( $_SESSION['user'] ) ;
require_once("templates/template_show_user.php");
}
else if ( isset ( $screen ) && $screen == "show_user" ) {
require_once("templates/template_show_user.php");
}
else if ( isset ( $screen ) && $screen == "llenar_certificado" ) {
require_once("templates/template_llenar_certificados.php");
}
else if ( isset ( $screen ) && $screen == "certificados" ) {
require_once("templates/template_seleccionar_certificado.php");
}
else if ( isset ( $screen ) && $screen == "generador_certificado" ) {
require_once("templates/template_generador_certificados.php");
}
else if ( isset ( $screen ) && $screen == "sustentaciones" ) {
require_once("templates/template_sustentacion_tesis.php");
}
else if ( isset ( $screen ) && $screen == "user_add_sustentation" ) {
require_once("templates/template_user_add_sustentacion.php");
}
else if ( isset ( $screen ) && $screen == "user_delete_sustentation" ) {
$_SESSION['user'] = unserialize ( $_SESSION['user'] );
$db = new Db("localhost","maestria","7ujm,ki8","maestria");
$sustentacion = new Sustentacion( $db,'' );
if ( isset($_POST['fecha']) ) {
$sustentacion->deleteSustentacion( $_SESSION['user']->login, $_POST['fecha'] );
}
else{
$sustentacion->deleteSustentacion( $_SESSION['user']->login, $_GET['fecha'] );
}
$_SESSION['user'] = serialize ( $_SESSION['user'] );
?>
}
else if ( isset ( $screen ) && $screen == "adicionar_sustentacion" ) {
$_SESSION['user'] = unserialize ( $_SESSION['user'] );
$db = new Db("localhost","maestria","7ujm,ki8","maestria");
$sustentacion = new Sustentacion( $db,'' );
$sustentacion->update( '', $_POST['userLogin'], $_POST['titleThesis'], $_POST['adviser'],
$_POST['jury1'], $_POST['jury2'], $_POST['jury3'], $_POST['fecha'], $_POST['fechaFin'], $_POST['finHora'], $_POST['finMinuto'], $_POST['salon'] );
$sustentacion->commit( 1 );
//Enviar notificacion por correo
$correo = new Correo( );
$message = "Correo Generado Automaticamente por Magsist
----------- ---------------------------
".
$_SESSION['user']->first_name." ".$_SESSION['user']->last_name." selecciono el horario "
.$_POST['fecha']." para su sutentacion de tesis.";
$correo->setCorreo( 'Silvia Takahashi', 'stakahas@uniandes.edu.co',
// $correo->setCorreo( 'MISC', 'magsist@uniandes.edu.co', 'magsist@uniandes.edu.co',
$_POST['userLogin']."@uniandes.edu.co", $_SESSION['user']->first_name." ".$_SESSION['user']->last_name,
"Horario de Sustentacion Seleccionado ", $_POST['userLogin']."@uniandes.edu.co", "", $message );
$correo->sendMail();
$_SESSION['user'] = serialize ( $_SESSION['user'] );
?>
}
else if ( isset ( $screen ) && $screen == "generador_formatos" ) {
require_once("templates/template_generar_formatos.php");
}
else if ( isset ( $screen ) && $screen == "logout" ) {
session_destroy();
require_once("templates/template_login.php");
}
else if ( isset ( $screen ) && $screen == "edit_user" ) {
require_once("templates/template_edit_user.php");
}
else if ( isset ( $screen ) && $screen == "edit_document" ) {
require_once("templates/template_edit_document.php");
}
else if ( isset ( $screen ) && $screen == "update_document" ) {
$_SESSION['user'] = unserialize( $_SESSION['user'] ) ;
for ($i=0;$i< count($_SESSION['user']->documents);$i++) {
if ($_SESSION['user']->documents[$i]->id == $_POST['id'] ) {
$_SESSION['user']->documents[$i]->update(
$_SESSION['user']->documents[$i]->id, $_SESSION['user']->documents[$i]->user,
$_SESSION['user']->documents[$i]->type, $_POST['title'], $_POST['owner'], $_POST['adviser'],
$_POST['jury1'], $_POST['jury2'], $_POST['jury3'], $_POST['jury4'], $_POST['description']);
$_SESSION['user']->documents[$i]->commit();
$i = count($_SESSION['user']->documents);
}
}
$_SESSION['user'] = serialize ( $_SESSION['user'] );
?>
}
else if ( isset ( $screen ) && $screen == "update_user" ) {
$_SESSION['user'] = unserialize ( $_SESSION['user'] );
$_SESSION['user']->update( $_SESSION['user']->login, $_POST['first_name'], $_POST['last_name'], $_POST['id_card'],
$_SESSION['user']->id_code, $_POST['home_phone1'], $_POST['home_phone2'], $_POST['home_address'],
$_POST['cel_phone'], $_POST['office_phone1'], $_POST['office_phone2'], $_POST['office_address'],
$_POST['email'], $_POST['optional_email1'], $_POST['optional_email2'], $_POST['description'],
$_POST['area'] );
$_SESSION['user']->commit();
$_SESSION['user'] = serialize ( $_SESSION['user'] );
require_once("templates/template_show_user.php");
}
else {
require_once("templates/template_login.php");
}
}
/*
*Si se inicio la sesion como un profesor
*-----------------------------------------------------------------------------------*/
else if( $_SESSION['profesor'] ) {
if ( isset ( $screen ) && $screen == "show_teacher" ) {
require_once("templates/template_show_teacher.php");
}
else if ( isset ( $screen ) && $screen == "sustentaciones" ) {
require_once("templates/template_teacher_sustentaciones.php");
}
else if ( isset ( $screen ) && $screen == "update_teacher" ) {
$_SESSION['teacher'] = unserialize( $_SESSION['teacher'] );
$_SESSION['teacher']->update( $_POST['login_prof'], $_POST['nombres_prof'], $_POST['apellidos_prof'], $_POST['area1_prof'], $_POST['area2_prof'], $_POST['activo_prof'] );
$_SESSION['teacher']->commit(0);
$_SESSION['teacher'] = serialize ( $_SESSION['teacher'] );
require_once("templates/template_show_teacher.php");
}
else if ( isset ( $screen ) && $screen == "teacher_add_sustentation" ) {
require_once("templates/template_teacher_add_sustentacion.php");
}
else if ( isset ( $screen ) && $screen == "adicionar_sustentacion" ) {
$sustentacion = new Sustentacion($db,'');
$sustentacion->update('', $_POST['asesorado'], $_POST['titleThesis'], $_POST['teachername'], $_POST['jury1'], $_POST['jury2'], $_POST['jury3'], $_POST['fecha'], $_POST['fechaFin'], $_POST['finHora'], $_POST['finMinuto'],$_POST['salon']);
$sustentacion->printInfo();
$sustentacion->commit(1);
$correo = new Correo( );
$message = "Correo Generado Automaticamente por Magsist
--
".$_POST['teachername'].
" selecciono el horario ".$_POST['fecha']." para la sustentacion de tesis";
$correo->setCorreo( 'MAGSIST', 'magsist@uniandes.edu.co', 'magsist@uniandes.edu.co',
$_POST['teacherlogin']."@uniandes.edu.co", $_POST['teachername'],
"Horario de Sustentacion Seleccionado ",
$_POST['asesorado']."@uniandes.edu.co", "",
$message );
$correo->sendMail();
?>
}
else if ( isset ( $screen ) && $screen == "logout" ) {
session_destroy();
require_once("templates/template_login.php");
}
else {
require_once("templates/template_login.php");
}
}
else {
require_once("templates/template_login.php");
}
if ( isset ( $screen ) && $screen == "formatos" ) {
require_once("templates/template_admin_formatos.php");
?>
}
?>