12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- //no index
- header("X-Robots-Tag: noindex, nofollow", true);
- //no caché
- header('Expires: Sun, 01 Jan 2014 00:00:00 GMT');
- header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
- header('Cache-Control: no-store, no-cache, must-revalidate');
- header('Cache-Control: post-check=0, pre-check=0', false);
- header('Pragma: no-cache');
- date_default_timezone_set('America/Mexico_City');
- //header("Content-Type: text/xml; charset=UTF-8");
- require_once("../include/nusoap/nusoap.php");
- require_once("../include/bd_pdo.php");
- function quitaNumeros($words){
- $words = strtoupper($words);
- return preg_replace('/\d/', '', $words );
- }
- function quitaLetras($words){
- $words = strtoupper($words);
- return preg_replace("/[^0-9]/", "", $words);
- }
- function getIniciales($materia){
- $ret = '';
- $materia = str_ireplace( array("Á","É","Í","Ó","Ú","Ñ","Ä","Ë","Ï","Ö","Ü","Â","Ê","Î","Ô","Û","Ã"), array("A","E","I","O","U","N","A","E","I","O","U","A","E","I","O","U","A"), utf8_encode($materia));
- foreach (explode(' ', $materia) as $word){
- if(ctype_alpha($word[0]))
- $ret .= $word[0];
- }
- return strtoupper($ret);
- }
- function getareashortname($shortname = "", $pdo){
- $tmp = explode('-', $shortname);
- $grupo = quitaLetras(str_replace(' ', '', $tmp[0]));
- $carrera = quitaNumeros(str_replace(' ', '', $tmp[0]));
-
- $stmt = $pdo->prepare('Select * from fs_areamateria(:gpo, :pref)');
- $stmt->bindParam(":gpo", $grupo);
- $stmt->bindParam(":pref", $carrera);
- if(!$stmt->execute()){
- //return "error";
- print_r($stmt->errorInfo());
- $stmt->closeCursor();
- }else{
- $materias_rs = $stmt->fetchAll();
- $stmt->closeCursor();
-
- foreach($materias_rs as $materia){
- if(getIniciales($materia["Materia_desc"]) == strtoupper($tmp[1])){
- echo "Area:".$materia["Area_id"];
- }
- }
- }
- //return "0";
- }
- getareashortname("100AB-A-2020A", $pdo);
- ?>
|