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 ) { ?> excluir(); ?> 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'] ); } ?> deleteSustentacion( $_POST['user'], $_POST['fecha'] ); } else{ $sustentacion->deleteSustentacion( $_GET['user'], $_GET['fecha'] ); } ?> update( $_POST['cod_user'], $_POST['date'], $_POST['code'], $_POST['credits'], $_POST['calf'], $_POST['area'] ); $course->commit( 1 ); ?> update( $_POST['cod_user'], $_POST['fecha'], $_POST['code'], $_POST['credits'], $_POST['calf'], $_POST['area'] ); $course->commit( 0 ); ?> 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(); } ?> 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(); ?> update( $_POST['cod_user'], $sem_matt, $code_matt, '', $calificacion, $area_matt ); $notas->commit( 1 ); } ?> 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 == "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'] ); ?> 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'] ); ?> 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'] ); ?> 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(); ?>