<?php
require_once("SimpleRest.php");
require_once("Mobile.php");
		
class MobileRestHandler extends SimpleRest {
	function getUsuarios() {	
		$mobile = new Mobile();
		$rawData = $mobile->getUsuario();
		if(empty($rawData)) {
			$statusCode = 200;
			$rawData = "ERROR";		
		} else {
			$statusCode = 200;
		}
		$requestContentType = 'application/json';//$_POST['HTTP_ACCEPT'];
		$this ->setHttpHeaders($requestContentType, $statusCode);
		$result["Datos"] =$rawData;
		if(strpos($requestContentType,'application/json') !== false){
			$response = $this->encodeJson($result);
			echo $response;
		}
	}
	
	function getLicencias() {	
		$mobile = new Mobile();
		$rawData = $mobile->getLicencia();
		if(empty($rawData)) {
			$statusCode = 200;
			$rawData = "ERROR";		
		} else {
			$statusCode = 200;
		}
		$requestContentType = 'application/json';//$_POST['HTTP_ACCEPT'];
		$this ->setHttpHeaders($requestContentType, $statusCode);
		$result["Datos"] =$rawData;
		if(strpos($requestContentType,'application/json') !== false){
			$response = $this->encodeJson($result);
			echo $response;
		}
	}
	
	function getActividades() {	
		$mobile = new Mobile();
		$rawData = $mobile->getActividad();
		if(empty($rawData)) {
			$statusCode = 200;
			$rawData = "ERROR";		
		} else {
			$statusCode = 200;
		}
		$requestContentType = 'application/json';//$_POST['HTTP_ACCEPT'];
		$this ->setHttpHeaders($requestContentType, $statusCode);
		$result["Datos"] =$rawData;
		if(strpos($requestContentType,'application/json') !== false){
			$response = $this->encodeJson($result);
			echo $response;
		}
	}
	
	function getEspecialidades() {	
		$mobile = new Mobile();
		$rawData = $mobile->getEspecialidad();
		if(empty($rawData)) {
			$statusCode = 200;
			$rawData = "ERROR";		
		} else {
			$statusCode = 200;
		}
		$requestContentType = 'application/json';//$_POST['HTTP_ACCEPT'];
		$this ->setHttpHeaders($requestContentType, $statusCode);
		$result["Datos"] =$rawData;
		if(strpos($requestContentType,'application/json') !== false){
			$response = $this->encodeJson($result);
			echo $response;
		}
	}
	
	function getProcesos() {	
		$mobile = new Mobile();
		$rawData = $mobile->getProceso();
		if(empty($rawData)) {
			$statusCode = 200;
			$rawData = "ERROR";		
		} else {
			$statusCode = 200;
		}
		$requestContentType = 'application/json';//$_POST['HTTP_ACCEPT'];
		$this ->setHttpHeaders($requestContentType, $statusCode);
		$result["Datos"] =$rawData;
		if(strpos($requestContentType,'application/json') !== false){
			$response = $this->encodeJson($result);
			echo $response;
		}
	}
	
	function getModulos() {	
		$mobile = new Mobile();
		$rawData = $mobile->getModulo();
		if(empty($rawData)) {
			$statusCode = 200;
			$rawData = "ERROR";		
		} else {
			$statusCode = 200;
		}
		$requestContentType = 'application/json';//$_POST['HTTP_ACCEPT'];
		$this ->setHttpHeaders($requestContentType, $statusCode);
		$result["Datos"] =$rawData;
		if(strpos($requestContentType,'application/json') !== false){
			$response = $this->encodeJson($result);
			echo $response;
		}
	}
	
	function getRegistros() {	
		$mobile = new Mobile();
		$rawData = $mobile->getRegistro();
		if(empty($rawData)) {
			$statusCode = 200;
			$rawData = "ERROR";		
		} else {
			$statusCode = 200;
		}
		$requestContentType = 'application/json';//$_POST['HTTP_ACCEPT'];
		$this ->setHttpHeaders($requestContentType, $statusCode);
		$result["Datos"] =$rawData;
		if(strpos($requestContentType,'application/json') !== false){
			$response = $this->encodeJson($result);
			echo $response;
		}
	}
	function getFes() {	
		$mobile = new Mobile();
		$rawData = $mobile->getFe();
		if(empty($rawData)) {
			$statusCode = 200;
			$rawData = "ERROR";		
		} else {
			$statusCode = 200;
		}
		$requestContentType = 'application/json';//$_POST['HTTP_ACCEPT'];
		$this ->setHttpHeaders($requestContentType, $statusCode);
		$result["Datos"] =$rawData;
		if(strpos($requestContentType,'application/json') !== false){
			$response = $this->encodeJson($result);
			echo $response;
		}
	}
	
	function getMenus() {	
		$mobile = new Mobile();
		$rawData = $mobile->getMenu();
		if(empty($rawData)) {
			$statusCode = 200;
			$rawData = "ERROR";		
		} else {
			$statusCode = 200;
		}
		$requestContentType = 'application/json';//$_POST['HTTP_ACCEPT'];
		$this ->setHttpHeaders($requestContentType, $statusCode);
		$result["Datos"] =$rawData;
		if(strpos($requestContentType,'application/json') !== false){
			$response = $this->encodeJson($result);
			echo $response;
		}
	}
	
	function getAliaddofes() {	
		$mobile = new Mobile();
		$rawData = $mobile->getAliaddofe();
		if(empty($rawData)) {
			$statusCode = 200;
			$rawData = "ERROR";		
		} else {
			$statusCode = 200;
		}
		$requestContentType = 'application/json';//$_POST['HTTP_ACCEPT'];
		$this ->setHttpHeaders($requestContentType, $statusCode);
		$result["Datos"] =$rawData;
		if(strpos($requestContentType,'application/json') !== false){
			$response = $this->encodeJson($result);
			echo $response;
		}
	}
	
	function getDataicos() {	
		$mobile = new Mobile();
		$rawData = $mobile->getDataico();
		if(empty($rawData)) {
			$statusCode = 200;
			$rawData = "ERROR";		
		} else {
			$statusCode = 200;
		}
		$requestContentType = 'application/json';//$_POST['HTTP_ACCEPT'];
		$this ->setHttpHeaders($requestContentType, $statusCode);
		$result["Datos"] =$rawData;
		if(strpos($requestContentType,'application/json') !== false){
			$response = $this->encodeJson($result);
			echo $response;
		}
	}
	
	function getUpdatedes() {	
		$mobile = new Mobile();
		$rawData = $mobile->getUpdatede();
		if(empty($rawData)) {
			$statusCode = 200;
			$rawData = "ERROR";		
		} else {
			$statusCode = 200;
		}
		$requestContentType = 'application/json';//$_POST['HTTP_ACCEPT'];
		$this ->setHttpHeaders($requestContentType, $statusCode);
		$result["Datos"] =$rawData;
		if(strpos($requestContentType,'application/json') !== false){
			$response = $this->encodeJson($result);
			echo $response;
		}
	}
	
	public function encodeJson($responseData) {
		  $jsonResponse = json_encode($responseData);
		  return $jsonResponse;		
	}
	
}
?>