<?php
namespace App\Controller;
use App\Entity\SysService;
use App\Entity\SysSessionTmp;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\HttpFoundation\Request;
use App\Entity\UssdCurrentSession;
use App\Entity\MenuData;
use App\Entity\SysOperatorGSM;
use App\Entity\SysUssdMenu;
use App\Controller\BusTicketController;
use App\Entity\SysMtnEntryParam;
use App\Entity\SysSessionBackup;
use App\Entity\SysUssdHistory;
use App\Message\ServicePayment;
use DateTime;
use Psr\Log\LoggerInterface;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Encoder\XmlEncoder;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
use Symfony\Component\Serializer\Serializer;
////
class USSDFunctionController extends AbstractController
{
private $connDB;
private $shortCode = "";
private $msisdn = "";
private $userInput = "";
private $lang = "";
private $sessionId = "";
private $reqNo = "";
private $screenId = "";
private $serverSession = "";
private $operatorCode = "";
private $newRequest = false;
private $currentSession;
private $sysUssdHistory;
private $logger;
public function __construct(LoggerInterface $logger)
{
$this->logger = $logger;
}
/**
* @Route("/u/s/s/d/function", name="u_s_s_d_function")
*/
public function index(): Response
{
return $this->render('ussd_function/index.html.twig', [
'controller_name' => 'USSDFunctionController',
]);
}
/**
* @Route("/serviceussd233", name="ussdEntry")
*/
public function index2(): Response
{
$xmlResponse = new Response();
$xmlResponse->setContent("TEST MESSAGE OK");
$xmlResponse->headers->set('Content-Type', 'text/xml');
$this->logger->info("Response =>" . $xmlResponse);
return $xmlResponse;
}
/**
* @Route("/serviceussd", name="ussdEntry_Moov")
*/
public function ussdEntry_Moov(Request $request): Response
{
//
$operatorCode = 'MOOVBJ';
$currentSession = new UssdCurrentSession();
$currentSession->setOperatorCode($operatorCode);
$getRequest = $_SERVER["REQUEST_URI"];
//Log entry request
$this->logger->info($operatorCode . ",Request Entry =>" . $this->getUssdGatewayIpAddr() . "=>" . $getRequest);
$this->sysUssdHistory = new SysUssdHistory();
$this->sysUssdHistory->setEntryTime(new \DateTime('now'))
->setOperatorCode($operatorCode)
->setSourceIpAddress($this->getUssdGatewayIpAddr());
//Check and get value from $_GET or $_POST in the request
if(isset($_GET["msisdn"])){
$ARG = $_GET;
}elseif(isset($_POST["msisdn"])) {
$ARG = $_GET;
}
/***** initalise session variable *******/
$currentSession->setMsisdn($ARG["msisdn"]);
if(isset($ARG["sc"])){
$currentSession->setShortCode($ARG["sc"]);
}
if(isset($ARG["user_input"])){
$currentSession->setUserInput($ARG["user_input"]);
if(strlen($ARG["user_input"]) <=0 ){ //TODO:Check that user imput is not null during continue session
$currentSession->setNewRequest(true);
}else{
$currentSession->setNewRequest(false);
}
}
if(isset($ARG["lang"])){
$currentSession->setLanguage($ARG["lang"]);
}
if(isset($ARG["session_id"])){
$currentSession->setSessionId($ARG["session_id"]);
}
if(isset($ARG["screen_id"])){
if(strlen($ARG["screen_id"])>0)
$currentSession->setScreenId($ARG["screen_id"]);
else
$currentSession->setScreenId(0);
}
if(isset($ARG["req_no"])){
if(strlen($ARG["req_no"])>0)
$currentSession->setRequestNumber($ARG["req_no"]);
else
$currentSession->setRequestNumber(0);
}
$this->currentSession = $currentSession; //Difine the new incoming request to the global varible
/*********Fin initialisation ******/
//Start processing of the request and get the menu to be sent
$menuData = $this->processIncomingRequest();
//LogSession in dataBase
/*********** Creation du menu, reponse au serveur de moov benin */
$ussdResponse = '<?xml version="1.0" encoding="UTF-8"?>';
$ussdResponse = $ussdResponse . '<response>';
if($menuData->getIsMemuOption()){
$ussdResponse = $ussdResponse . '<screen_type>menu</screen_type>';
$ussdResponse = $ussdResponse . '<text>' . $menuData->getMenuTitle() . '</text>';
$ussdResponse = $ussdResponse . '<options>';
foreach($menuData->getOptions() as $itemVal)
{
$ussdResponse = $ussdResponse . '<option choice="'. $itemVal[0] . '.">' . $itemVal[1] . '</option>';
}
$ussdResponse = $ussdResponse . '</options>';
}else{
$ussdResponse = $ussdResponse . '<screen_type>form</screen_type>';
$ussdResponse = $ussdResponse . '<text>' . $menuData->getMenuTitle() . '</text>';
}
if($menuData->getIsShowBack()){
$ussdResponse = $ussdResponse . '<back_link>1</back_link>';
}else{
$ussdResponse = $ussdResponse . '<back_link>0</back_link>';
}
$ussdResponse = $ussdResponse . '<home_link>0</home_link>';
if($menuData->getIsSessionContinue()){
$ussdResponse = $ussdResponse . '<session_op>continue</session_op>';
}else{
$ussdResponse = $ussdResponse . '<session_op>end</session_op>';
}
$ussdResponse = $ussdResponse . '<screen_id>' . (string) $menuData->getScreenId() . '</screen_id>';
$ussdResponse = $ussdResponse . '</response>';
/********************************** */
//$response["error"] = FALSE;
//$response["error_code"] = 0; //No Error
//$response["error_msg"] = "No Message";
//$response["Sesssion"] = $currentSession;
$xmlResponse = new Response();
$xmlResponse->setContent($ussdResponse);
$xmlResponse->headers->set('Content-Type', 'text/xml');
$this->logger->info("Response =>" . $xmlResponse);
return $xmlResponse;
}
/**
* @Route("/ussd_mtnbenin", name="ussdEntry_MTN")
*/
public function ussdEntry_MTN(Request $request): Response
{
$encoders = [new XmlEncoder(), new JsonEncoder()];
$normalizers = [new ObjectNormalizer()];
$serializer = new Serializer($normalizers, $encoders);
$contentBody = $request->getContent();
$entryParam = $serializer->deserialize($contentBody, SysMtnEntryParam::class, 'xml');
//var_dump($contentBody);
//var_dump("<===============>");
//var_dump($entryParam);
$operatorCode = 'MTNBJ';
$currentSession = new UssdCurrentSession();
$currentSession->setOperatorCode($operatorCode);
$getRequest = $_SERVER["REQUEST_URI"];
//Log entry request
$this->logger->info($operatorCode . ",Request Entry =>" . $this->getUssdGatewayIpAddr() . "=>" . $getRequest . "=>" . $contentBody);
$this->sysUssdHistory = new SysUssdHistory();
$this->sysUssdHistory->setEntryTime(new \DateTime('now'))
->setOperatorCode($operatorCode)
->setSourceIpAddress($this->getUssdGatewayIpAddr());
/***** initalise session variable *******/
$currentSession->setMsisdn($entryParam->getMsisdn());
$currentSession->setShortCode("450");
if ($entryParam->getStatusCode() == 0){
$currentSession->setUserInput($entryParam->getSubscriberInput());
if($entryParam->getNewRequest() == "1" ){
$currentSession->setNewRequest(true);
}else{
$currentSession->setNewRequest(false);
}
$currentSession->setLanguage($entryParam->getLanguage());
$currentSession->setSessionId($entryParam->getSessionId());
$currentSession->setScreenId(0);
$currentSession->setRequestNumber(0);
$this->currentSession = $currentSession; //Difine the new incoming request to the global varible
/*********Fin initialisation ******/
//Start processing of the request and get the menu to be sent
$menuData = $this->processIncomingRequest();
/*********** Creation du menu, reponse au serveur de moov benin */
$ussdResponse = '<?xml version="1.0" encoding="UTF-8"?>';
$ussdResponse = $ussdResponse . '<response>';
$ussdResponse = $ussdResponse . '<msisdn>' . $currentSession->getMsisdn() . '</msisdn>';
$ussdResponse = $ussdResponse . '<applicationResponse>';
$ussdResponse = $ussdResponse . $menuData->getMenuTitle();
if($menuData->getIsMemuOption()){
foreach($menuData->getOptions() as $itemVal)
{
$ussdResponse = $ussdResponse . "\n" . $itemVal[0] . '.' . $itemVal[1];
}
}
$ussdResponse = $ussdResponse . '</applicationResponse>';
$ussdResponse = $ussdResponse . '<freeflow>';
if($menuData->getIsSessionContinue()){
$ussdResponse = $ussdResponse . '<freeflowState>FC</freeflowState>';
}else{
$ussdResponse = $ussdResponse . '<freeflowState>FB</freeflowState>';
}
$ussdResponse = $ussdResponse . '<freeflowCharging>N</freeflowCharging><freeflowChargingAmount>0</freeflowChargingAmount>';
$ussdResponse = $ussdResponse . '</freeflow>';
$ussdResponse = $ussdResponse . '</response>';
}else{
//Send Clean Acknowledge Response
$ussdResponse = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
$ussdResponse = $ussdResponse . '<response>';
$ussdResponse = $ussdResponse . '<msisdn>' . $currentSession->getMsisdn() . '</msisdn>';
$ussdResponse = $ussdResponse . '<statusCode>'.$entryParam->getStatusCode().'</statusCode>';
$ussdResponse = $ussdResponse . '</response>';
}
$xmlResponse = new Response();
$xmlResponse->setContent($ussdResponse);
$xmlResponse->headers->set('Content-Type', 'text/xml');
$this->logger->info("Response =>" . $xmlResponse);
return $xmlResponse;
//return $this->render('ussd_function/index.html.twig', [
// 'controller_name' => 'USSDFunctionController',
//]);
}
function getUssdGatewayIpAddr(){
if(!empty($_SERVER['HTTP_CLIENT_IP'])){
//ip from share internet
$ip = $_SERVER['HTTP_CLIENT_IP'];
}elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
//ip pass from proxy
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}else{
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
function processIncomingRequest(){
//Check short request like *450*1# or *450*3#
$inputTable = explode("*", $this->currentSession->getUserInput());
if(count($inputTable) > 1 && strcmp($inputTable[0], "450") == 0){
for ($i = 0; $i < 2; $i++) {
if(strcmp($inputTable[$i], "450") == 0){
$this->currentSession->setNewRequest(true);
$this->currentSession->setUserInput($inputTable[$i]);
$this->processIncomingRequest();
}else{
$this->currentSession->setNewRequest(false);
$this->currentSession->setUserInput($inputTable[$i]);
return $this->processIncomingRequest();
}
//var_dump($inputTable);
}
}
//Check temp instance of the session
$entityManager = $this->getDoctrine()->getManager();
$repoSession =$this->getDoctrine()->getRepository(SysSessionTmp::class);
$tempSession = $repoSession->findOneBy([
'msisdn' => $this->currentSession->getMsisdn(),
'sessionId' => $this->currentSession->getSessionId()
]);
//Check if user request previouse menu is the main menu
if(strcmp($this->currentSession->getUserInput(),"88") == 0 ){ //request previous menu
if($tempSession != null){
$repoUssdMenu = $this->getDoctrine()->getRepository(SysUssdMenu::class);
$menuRequest = $repoUssdMenu->findOneBy(['menuCode'=>$tempSession->getMenuCode()]);
if(strcmp($menuRequest->getPreviousMenuCode(), 'MAIN') ==0){
$this->currentSession->setNewRequest(true);
}
}
}
//Check if it is new request
if($tempSession == null)
$this->currentSession->setNewRequest(true);
//Process the request
$menuData = new MenuData(); //Data to return for creation the next menu
if($this->currentSession->getNewRequest()){ //if yes it is new session
//it is a new first request for this msisdn with this sessionId
//Fo new request we send the main menu
$menuData = $this->getMainMenu();
if($tempSession == null){ // to not create new temp entry if it is a user previous request
$sysTemp = new SysSessionTmp();
$sysTemp->setCreateTime(new \DateTime('now'));
}else{
$sysTemp = $tempSession;
}
$sysTemp->setSessionId($this->currentSession->getSessionId());
$sysTemp->setMsisdn($this->currentSession->getMsisdn());
$sysTemp->setUpdateTime(new \DateTime('now'));
$repoOperator =$this->getDoctrine()->getRepository(SysOperatorGSM::class);
$operator = new SysOperatorGSM();
$operator = $repoOperator->findOneBy(['codeOperator'=>$this->currentSession->getOperatorCode()]);
$sysTemp->setOperator($operator);
$service = new SysService();
$repoService =$this->getDoctrine()->getRepository(SysService::class);
$service = $repoService->findOneBy(['codeService'=>'MAIN']);
$sysTemp->setService($service);
$sysTemp->setMenuCode($menuData->getMenuCode());
$sysTemp->setPreviousMenuCode($menuData->getPreviousMenuCode());
$sysTemp->setNextMenuCode($menuData->getNextMenuCode());
$sysTemp->setIsInputRequest(false);
$sysTemp->setMenuOptionsString($menuData->getMenuOptionString());
$sysTemp->setMenuTitle($menuData->getMenuTitle());
$entityManager->persist($sysTemp);
$entityManager->flush();
//$this->currentSession->getMsisdn()
}else{
//session exit it is a continus request, check the service and connect to the correct service controller
$isCorrectChose = false;
$optionsMenu = [];
if(!$tempSession->getIsInputRequest()){
$options = explode('+', $tempSession->getMenuOptionsString());
foreach($options as $val){
$item = explode(',',$val);
if($item[0] === $this->currentSession->getUserInput()){
$this->currentSession->setInputItem($item);
$isCorrectChose = true;
break;
}
if($item[0]!='-1')
$optionsMenu[] = $item;
}
}else{
if(strlen($this->currentSession->getUserInput())>0){
$this->currentSession->setInputItem([-2,$this->currentSession->getUserInput(),-2]);
$isCorrectChose = true;
}
}
if($isCorrectChose){
//$ussdMenu = new SysUssdMenu();
if(strcmp($tempSession->getMenuCode(), 'MAIN') ==0 ){
//it is the first menu of the service
$repoServices =$this->getDoctrine()->getRepository(SysService::class);
$service = $repoServices->find($this->currentSession->getInputItem()[2]);
$repoUssdMenu =$this->getDoctrine()->getRepository(SysUssdMenu::class);
$ussdMenu = $repoUssdMenu->findOneBy(['service'=>$service, 'levelOrder'=>1]);
$this->currentSession->setService($service);
$this->currentSession->setNewSession(true);
$menuData = $this->processService($service->getCodeService(), 'MAIN', $ussdMenu->getMenuCode());
}else{
$this->currentSession->setService($tempSession->getService());
$this->currentSession->setNewSession(false);
$menuData = $this->processService($tempSession->getService()->getCodeService(), $tempSession->getMenuCode(), $tempSession->getNextMenuCode());
}
if($menuData->getIsSessionContinue()){ //Check if session continue
$tempSession->setUpdateTime(new \DateTime('now'));
$tempSession->setService($menuData->getService());
$tempSession->setMenuCode($menuData->getMenuCode());
$tempSession->setIsInputRequest($menuData->getIsInputRequest());
$tempSession->setMenuOptionsString($menuData->getMenuOptionString());
$tempSession->setPreviousMenuCode($menuData->getPreviousMenuCode());
$tempSession->setNextMenuCode($menuData->getNextMenuCode());
$tempSession->setMenuTitle($menuData->getMenuTitle());
$tempSession->setScreenId($menuData->getScreenId());
$entityManager->persist($tempSession);
$entityManager->flush();
}else{
//Delete SysSessionTemp
$entityManager->remove($tempSession);
}
}else{
//TODO: handle incorrect imput
$menuData->setMenuTitle("Choix incorrect, Reessayez:\n" . $tempSession->getMenuTitle());
$menuData->setService($tempSession->getService());
$menuData->setMenuCode($tempSession->getMenuCode());
$menuData->setIsInputRequest($tempSession->getIsInputRequest());
$menuData->setMenuOptionString($tempSession->getMenuOptionsString());
$menuData->setPreviousMenuCode($tempSession->getPreviousMenuCode());
$menuData->setNextMenuCode($tempSession->getNextMenuCode());
if(!$tempSession->getIsInputRequest()){
$menuData->setIsMemuOption(true);
$menuData->setOptions($optionsMenu);
}else{
$menuData->setIsMemuOption(false);
}
//$menuData->setMenuOptionString("");
$menuData->setIsShowBack(false);
$menuData->setIsSessionContinue(true);
//$menuData->setIsInputRequest(false);
//$menuData->setMenuCode('MAIN');
//$menuData->setPreviousMenuCode('MAIN');
//$menuData->setNextMenuCode('MAIN');
}
}
//****** Log Ussd Session history *******************/
$this->sysUssdHistory->setSessionId($this->currentSession->getSessionId())
->setMsisdn($this->currentSession->getMsisdn())
->setIncomingUserInput($this->currentSession->getUserInput())
->setSysResponseTitle($menuData->getMenuTitle())
->setSysResponseOption($menuData->getMenuOptionString())
->setMenuCode($menuData->getMenuCode())
->setMenuCode($menuData->getMenuCode());
if($tempSession == null){
$this->sysUssdHistory->setServiceCode('0');
}else{
$this->sysUssdHistory->setServiceCode($tempSession->getService()->getCodeService());
}
if($this->currentSession->getNewRequest()){
$this->sysUssdHistory->setSessionFlag("INTIAL");
}else{
if($menuData->getIsSessionContinue()){
$this->sysUssdHistory->setSessionFlag("INTERMEDIATE");
}else{
$this->sysUssdHistory->setSessionFlag("FINAL");
}
}
$this->sysUssdHistory->setOutputTime(new \DateTime("now"));
$entityManager->persist($this->sysUssdHistory);
//*********************************************** */
//Commit databsse
$entityManager->flush();
//Return data
return $menuData;
}
function processService($codeService, $menuCode, $nextMenuCode){
switch ($codeService) {
case "TTBUS":
$busFunction = new BusTicketController($this->getDoctrine());
$dataM = $busFunction->busUserInputProsess($menuCode, $nextMenuCode, $this->currentSession);
break;
case "TTCINE":
$cineFunction = new CineTicketController($this->getDoctrine());
$dataM = $cineFunction->busUserInputProsess($menuCode, $nextMenuCode, $this->currentSession);
break;
case "RCHGAZ":
$rechGazFunction = new RechGazController($this->getDoctrine()); //GazServiceController($this->getDoctrine()); //
$dataM = $rechGazFunction->userInputProsess($menuCode, $nextMenuCode, $this->currentSession);
break;
case "ESANTE":
$infoSanteFunction = new InfoSanteController($this->getDoctrine());
$dataM = $infoSanteFunction->userInputProsess($menuCode, $nextMenuCode, $this->currentSession);
break;
case "ELOYER":
break;
case "QOSIC":
$mobileBip = new MobileBipController($this->getDoctrine());
$dataM = $mobileBip->userInputProsess($menuCode, $nextMenuCode, $this->currentSession);
break;
case "LABBAIK":
$labbaik = new LabbaikController($this->getDoctrine());
$dataM = $labbaik->userInputProsess($menuCode, $nextMenuCode, $this->currentSession);
break;
case "AUTRES":
$autresFunction = new AutresController($this->getDoctrine());
$dataM = $autresFunction->userInputProsess($menuCode, $nextMenuCode, $this->currentSession);
break;
}
if($dataM->getIsToPayed()){
$this->dispatchMessage(new ServicePayment($dataM->getTransactionIdToPayed()));
}
return $dataM;
}
function getMainMenu(){
//initialise data to sent
$dataM = new MenuData();
$dataM->setMenuTitle("Bienvenu sur ReservLine");
$dataM->setIsMemuOption(true);
$dataM->setOptions([]);
$dataM->setMenuOptionString("");
$dataM->setIsShowBack(false);
$dataM->setIsSessionContinue(true);
$dataM->setIsInputRequest(false);
$dataM->setMenuCode('MAIN');
$dataM->setPreviousMenuCode('MAIN');
$dataM->setNextMenuCode('MAIN');
//$data = [
//'menuTitle' => ,
//'isMemuOption' => true,
//'options' => ,
//'isShowBack' => false,
//'isSessionContinue' => true,
//'menuOptionString' => "",
//'is_input_request' => 0,
//];
//create option list
$repoServices =$this->getDoctrine()->getRepository(SysService::class);
$serviceList = $repoServices->findBy(['enable'=>true], ['orderNumber' => 'ASC']);
if($serviceList == null){
//TODO: Error - no service available retreived from the data base
//print("Error - no service available retreived from the data base");
}else{
$options = [];
$menuOptionString="-1,libelle,-1";
$i=0;
foreach($serviceList as $serviceVal)
{
//Check service is in production or in test
if(!$serviceVal->getInProduction()){
if(!$serviceVal->getVisibleToAll()){
if($serviceVal->getTestNumberList() == null){
continue;
}else{
if(!str_contains($serviceVal->getTestNumberList(),$this->currentSession->getMsisdn())){
continue;
}
}
}
}
//Add service in the main menu to be display
$options[$i] = array($serviceVal->getOrderNumber(), $serviceVal->getLibelle(), $serviceVal->getId());
$menuOptionString .= '+'. $serviceVal->getOrderNumber() . ',' . $serviceVal->getLibelle() . ',' . $serviceVal->getId();
$i++;
}
$dataM->setOptions($options);
$dataM->setMenuOptionString($menuOptionString);
//$data["options"] = $options;
//$data['is_input_request'] = true;
}
return $dataM;
}
static function createReservationCode(SysService $serivce, int $tempSessionId ) : string
{
$codeString = '';
$codeString = $codeString . strVal(rand(1,9)); //premier chiffre aleatoire
//$codeString = $codeString . sprintf("%02d",$serivce->id); // Id du serivice sur 2 chiffre
//$codeString = $codeString . sprintf("%02d",date_format(new \Datetime("now"), 'm')); // add current second sur 2 chiffre
$codeString = $codeString . sprintf("%02d",date_format(new \Datetime("now"), 's')); // add current second sur 2 chiffre
$codeString = $codeString . substr(sprintf("%04d",$tempSessionId), -3); // liste 3 digit of tempSessionId
switch ($serivce->getCodeService()) {
case "TTBUS":
$codeString = 'b' . $codeString;
break;
case "TTCINE":
$codeString = 'c' . $codeString;
break;
case "RCHGAZ":
$codeString = 'g' . $codeString;
break;
case "ELOYER":
$codeString = 'l' . $codeString;
break;
case "ESANTE":
$codeString = 's' . $codeString;
break;
}
return $codeString;
}
static function createTransactionReference(SysService $serivce, int $transactionId ) : string
{
$codeString = '' . strVal(rand(111,999)); //3 premier chiffre aleatoire
$codeString = $codeString . sprintf("%02d",$serivce->getId()); // Id du serivice sur 2 chiffre
$codeString = $codeString . sprintf("%02d",date_format(new \Datetime("now"), 'i')); //Minute actuel sur 2 chiffre
$codeString = $codeString . sprintf("%02d",date_format(new \Datetime("now"), 's')); // add second sur 2 chiffre
$codeString = $codeString . substr(sprintf("%06d",$transactionId), -5); // liste 5 digit of tempSessionId
return $codeString;
}
/*
// Create ussd menu
function createMenu($operatorCode, $menuText, $isMemuOption, $menuItems, $isShowBack, $isSessionContinue, $screenId) {
//if( strcmp(,'moovbenin') == 0 )
$response = "";
switch ($operatorCode) {
case "MOOVBJ":
$response = $response . '<?xml version="1.0" encoding="UTF-8"?>';
$response = $response . '<response>';
if(!$isMemuOption){
$response = $response . "\n". '<screen_type>form</screen_type>';
$response = $response . "\n". '<text>' . $menuText . '</text>';
}else if($isMemuOption){
$response = $response . "\n". '<screen_type>menu</screen_type>';
$response = $response . "\n". '<text>' . $menuText . '</text>';
$response = $response . "\n". '<options>';
foreach($menuItems as $itemVal)
{
$response = $response . '<option choice="'. $itemVal[0] . '">' . $itemVal[1] . '</option>';
}
$response = $response . '</options>';
}
if($isShowBack){
$response = $response . '<back_link>1</back_link>';
}else{
$response = $response . '<back_link>0</back_link>';
}
$response = $response . '<home_link>0</home_link>';
if($isSessionContinue){
$response = $response . '<session_op>continue</session_op>';
}else{
$response = $response . '<session_op>end</session_op>';
}
$response = $response . '<screen_id>' . (string) $screenId . '</screen_id>';
$response = $response . '</response>';
break;
case "MTNBJ":
$response = $response . '<?xml version="1.0" encoding="UTF-8"?>';
$response = $response . '<response>';
$response = $response . '<text>' . $menuText . '</text>';
$response = $response . '</response>';
break;
default:
$response = $response . '<?xml version="1.0" encoding="UTF-8"?>';
$response = $response . '<response>';
$response = $response . '<text>Erreur d\'application</text>';
$response = $response . '</response>';
}
return $response;
}
*/
}