Advertisement
xlujiax

Untitled

Dec 3rd, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. //CONTROLLERPROFESOR.PHP
  2. <?php
  3. include_once '../model/ModelProfesor.php';
  4. class ControllerProfesor
  5. {
  6.  
  7. public function ControllerInsertarProfesor($id,$pat,$mat,$nom,$usu,$cla,$img){
  8. try{
  9. $obj=new ModelProfesor();
  10. $obj->ModelInsertarProfesor($id,$pat,$mat,$nom,$usu,$cla,$img);
  11. header("Location:../view/registrese.php?valor=1");
  12. }catch(Exception $e){
  13. throw $e;
  14. }
  15. }
  16. public function ControllerValidarProfesor($usu,$cla){
  17. try{
  18. $obj=new ModelProfesor();
  19. return $obj->ModelValidarProfesor($usu,$cla);
  20. }catch(Exception $e){
  21. throw $e;
  22. }
  23. }
  24. public function ControllerBuscarProfesor($paterno){
  25. try{
  26. $obj=new ModelProfesor();
  27. return $obj->ModelBuscarProfesor($paterno);
  28. }catch(Exception $e){
  29. throw $e;
  30. }
  31. }
  32. public function ControllerModificarProfesor($id,$pat,$mat,$nom){
  33. try{
  34. $obj=new ModelProfesor();
  35. $obj->ModelModificarProfesor($id,$pat,$mat,$nom);
  36. header("Location:../view/registrese.php");
  37. }catch(Exception $e){
  38. throw $e;
  39. }
  40. }
  41. }
  42. //Recibiendo los valores
  43. //Recibiendo valores del formulario
  44. //Validar que se pulso el botón grabar
  45. if(isset($_POST["grabar"])){
  46. $obj = new ControllerProfesor();
  47.  
  48. $id = $_POST["txtid"];
  49. $pat = $_POST["txtpat"];
  50. $mat = $_POST["txtmat"];
  51. $nom = $_POST["txtnom"];
  52. $usu = $_POST["txtusu"];
  53. $cla = md5($_POST["txtpas"]);
  54. $img = $_POST["uploadedfile"];
  55. $obj->ControllerInsertarProfesor($id,$pat,$mat,$nom,$usu,$cla,$img);
  56. }
  57. if(isset($_POST["modificar"])){
  58. $obj = new ControllerProfesor();
  59.  
  60. $id = $_POST["txtid"];
  61. $pat = $_POST["txtpat"];
  62. $mat = $_POST["txtmat"];
  63. $nom = $_POST["txtnom"];
  64.  
  65. $obj->ControllerModificarProfesor($id,$pat,$mat,$nom);
  66. }
  67.  
  68. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement