12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?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');
- require_once("../include/nusoap/nusoap.php");
- require_once("../include/bd_pdo.php");
- //--funcion interna
- 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 = ""){
- global $pdo;//global para que la vea la función
- $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);*/
-
- $stmt = $pdo->prepare('Select * from fs_areashortname(:short)');
- $stmt->bindParam(":short", $tmp[0]);
-
- if($stmt->execute()){
- $materias_rs = $stmt->fetchAll();
- $stmt->closeCursor();
-
- foreach($materias_rs as $materia){
- if(getIniciales($materia["Materia_desc"]) == strtoupper($tmp[1])){
- return $materia["Area_id"];
- }
- }
- }
- return "0";
- }
- //define("PAG", "http://atenea.lci.ulsa.mx/webservice/materiainfo_service");
- define("PAG", "http://200.13.89.8/webservice/materiainfo_service");
- $server = new soap_server();
- $server->configureWSDL("materiainfo_service", PAG);
-
- // Parametros de salida
- $server->register("getareashortname",
- array("shortname" => "xsd:string"),//recibe
- array("area" => "xsd:string"),//regresa
- PAG,
- PAG."#getareashortname",
- "rpc",
- "encoded",
- "Obtiene el área de una materia a partir de su shortname formato (200CIB-IALP-2020A)");
-
- @$server->service(file_get_contents("php://input"));
- ?>
|