doc_cartareposicion.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <?php
  2. /* AJAX
  3. * Genera nombramientos en docx
  4. * Recibe:
  5. * id reposicion
  6. * Return:
  7. * imprime docx
  8. */
  9. setlocale(LC_TIME, 'es_MX.UTF-8');
  10. require_once("../../include/nocache.php");
  11. require_once("../../include/bd_pdo.php");
  12. require_once("../../include/util.php");
  13. require_once("../../include/constantes.php");
  14. require_once("../../classes/ValidaSesion.php");
  15. include_once('../../include/xTemplate/xtemplate.class.php'); // including mpdf.php
  16. include_once('../../include/htmlToDoc/HtmlToDoc.php'); // including mpdf.php
  17. $pag = "../perfil.php";
  18. //--- Objeto para validar usuario. El id de usuario lo lee desde sesión
  19. $objSesion = new ValidaSesion($pdo, 52, APSA);
  20. if(!$objSesion->tieneAcceso()){
  21. echo "<script>window.close();</script>";
  22. exit();
  23. }
  24. unset($objValida);
  25. if(!isset($_GET["id"])){
  26. echo "<script>window.close();</script>";
  27. exit();
  28. }
  29. $periodo_id = $_SESSION["periodo_id"];
  30. $profesor = $_GET["id"];
  31. //Obtiene datos de reposición
  32. $stmt = $pdo->prepare('Select * from fs_reposicion(:id, :per, NULL, NULL, NULL, NULL, NULL, 0, NULL)');
  33. $stmt->bindParam(":id", $profesor);
  34. $stmt->bindParam(":per", $periodo_id);
  35. if(!$stmt->execute()){
  36. header("Location:".$pag."?error=4");
  37. //print_r($stmt->errorInfo());
  38. exit();
  39. }
  40. $reposicion_rs = $stmt->fetch();
  41. $stmt->closeCursor();
  42. if(empty($reposicion_rs["HorarioGrupo_id"]) || $reposicion_rs["ReposicionEstado_id"] < 2){
  43. //echo "Error";
  44. echo "<script>window.close();</script>";
  45. exit();
  46. }
  47. //$reposicion_rs["Horario_id"]
  48. //Obtiene datos de horario original
  49. $stmt = $pdo->prepare('Select * from fs_horario(:id)');
  50. $stmt->bindParam(":id", $reposicion_rs["HorarioGrupo_id"]);
  51. if(!$stmt->execute()){
  52. header("Location:".$pag."?error=4");
  53. //print_r($stmt->errorInfo());
  54. exit();
  55. }
  56. $horario_rs = $stmt->fetch();
  57. $stmt->closeCursor();
  58. //-----
  59. $htmlToDoc = new HtmlToDoc();
  60. $stylesheet = "<style>";
  61. $stylesheet .= file_get_contents('../../css/indivisa.css'); // external css
  62. $stylesheet .= file_get_contents('../css/cartareposicion.css'); // external css
  63. $stylesheet .= "</style>";
  64. $xtpl = new XTemplate('../tpl/reposicion.tpl.html');
  65. $xtpl->assign("TITULO1", "FACULTAD");
  66. $xtpl->assign("VALOR1", "FACULTAD DE INGENIERÍA");
  67. $xtpl->assign("TITULO2", "CARRERA");
  68. $xtpl->assign("VALOR2", mb_strtoupper($reposicion_rs["Carrera_desc"]));
  69. $xtpl->parse("main.tabla.renglon.data4");
  70. $xtpl->parse("main.tabla.renglon");
  71. $xtpl->assign("TITULO", "PROFESOR");
  72. $xtpl->assign("VALOR", mb_strtoupper($reposicion_rs["Usuario_nombre"]." ".$reposicion_rs["Usuario_apellidos"]));
  73. $xtpl->parse("main.tabla.renglon.data2");
  74. $xtpl->parse("main.tabla.renglon");
  75. $salon = $horario_rs["Salon_desc"];
  76. if($salon == ""){
  77. $salon = "<i>Pendiente</i>";
  78. }else{
  79. if(!empty($horario_rs["Salon_desc_larga"]))
  80. $salon = $horario_rs["Salon_desc_larga"];
  81. }
  82. $xtpl->assign("TITULO1", "SEMESTRE");
  83. $xtpl->assign("VALOR1", $reposicion_rs["Materia_semestre"]);
  84. $xtpl->assign("TITULO2", "SALON HABITUAL");
  85. $xtpl->assign("VALOR2", $salon);//TODO
  86. $xtpl->parse("main.tabla.renglon.data4");
  87. $xtpl->parse("main.tabla.renglon");
  88. $xtpl->assign("TITULO", "ASIGNATURA");
  89. $xtpl->assign("VALOR", mb_strtoupper($reposicion_rs["Materia_desc"]));
  90. $xtpl->parse("main.tabla.renglon.data2");
  91. $xtpl->parse("main.tabla.renglon");
  92. $xtpl->parse("main.tabla");
  93. $xtpl->assign("TITULO1", "FECHA DE SOLICITUD");
  94. $xtpl->assign("VALOR1", date("d/m/Y"));
  95. $xtpl->assign("TITULO2", "NÚMERO DE ALUMNOS");
  96. $xtpl->assign("VALOR2", $reposicion_rs["Reposicion_alumnos"]);
  97. $xtpl->parse("main.tabla.renglon.data4");
  98. $xtpl->parse("main.tabla.renglon");
  99. $xtpl->assign("TITULO1", "FECHA DE INASISTENCIA");
  100. $xtpl->assign("VALOR1", date("d/m/Y", strtotime($reposicion_rs["Reposicion_fecha_falta"])));
  101. $xtpl->assign("TITULO2", "HORARIO DE CLASE");
  102. $xtpl->assign("VALOR2", substr($horario_rs["Horario_hora"],0,-3)." a ".substr($horario_rs["Horario_hora_final"],0,-3)." hrs");
  103. $xtpl->parse("main.tabla.renglon.data4");
  104. $xtpl->parse("main.tabla.renglon");
  105. $xtpl->assign("TITULO1", "FECHA DE REPOSICIÓN");
  106. $xtpl->assign("VALOR1", date("d/m/Y", strtotime($reposicion_rs["Reposicion_fecha_nueva"])) );
  107. $xtpl->assign("TITULO2", "HORARIO DE CLASE");
  108. $xtpl->assign("VALOR2", date("H:i", strtotime($reposicion_rs["Reposicion_fecha_nueva"]))." A ".date("H:i", strtotime($reposicion_rs["Reposicion_fecha_nueva"].' +'.$horario_rs["Horario_duracion"].'minutes'))." hrs");
  109. $xtpl->parse("main.tabla.renglon.data4");
  110. $xtpl->parse("main.tabla.renglon");
  111. $xtpl->parse("main.tabla");
  112. $xtpl->parse("main");
  113. /*echo $stylesheet;
  114. $xtpl->out("main");exit();*/
  115. $content = $stylesheet." ".$xtpl->text();
  116. $htmlToDoc->createDoc( $content, "reposicion", true );