public function getOutput() { $output = new JsonOutput(); $td_code = gfGetVar('td_code', null); if (!$td_code) { $output->setContent(array('result' => 'error')); return $output; } // check td existence and activation $td = TopicalDomain::fromDatabaseByCode($td_code); if (!$td) { $output->setContent(array('result' => 'error')); return $output; } if (!$td->getActive()) { $output->setContent(array('result' => 'error')); return $output; } $ticket = Ticket::nextNewTicket($td_code, 'totem'); $ticket->save(); list($queueLength, $eta) = $ticket->getPeopleAndEta(); $content = array('code' => $ticket->getCode(), 'number' => $ticket->getNumber(), 'eta' => $eta, 'queueLength' => $queueLength); $jsonOutput = new JsonOutput(); $jsonOutput->setContent($content); return $jsonOutput; }
public function getOutput() { $response = $this->performRequest(); $json = new JsonOutput(); $json->setContent($response); return $json; }
public function getOutput() { $result = $this->performRemove(); $data = array('result' => $result); $ret = new JsonOutput(); $ret->setContent($data); return $ret; }
public function getOutput() { if ($this->content == null) { $this->setNotPostError(); } $output = new JsonOutput(); $output->setContent($this->content); return $output; }
public function getOutput() { global $gvQrCodeMsg, $gvSpotTitle, $gvSpotBody, $gvOfficeName, $gvOfficeAddress, $gvOfficeCode, $gvOfficeSecret; $content = array(); $content['qrCodeMsg'] = $gvQrCodeMsg; $content['spotTitle'] = $gvSpotTitle; $content['spotBody'] = $gvSpotBody; $content['officeName'] = $gvOfficeName; $content['officeAddress'] = $gvOfficeAddress; $content['officeCode'] = $gvOfficeCode; $content['officeSecret'] = $gvOfficeSecret; $jsonOutput = new JsonOutput(); $jsonOutput->setContent($content); return $jsonOutput; }
public function getOutput() { $tds = TopicalDomain::fromDatabaseCompleteList(true); $content = array(); $i = 0; foreach ($tds as $td) { $content[$i]['code'] = $td->getCode(); $content[$i]['name'] = $td->getName(); $content[$i]['description'] = $td->getDescription(); $content[$i]['color'] = $td->getColor(); $i++; } $jsonOutput = new JsonOutput(); $jsonOutput->setContent($content); return $jsonOutput; }
function main() { // Check whether this device needs to be redirected somewhere $dev = Device::fromDatabaseByIpAddress($_SERVER['REMOTE_ADDR']); if ($content = getContentForRedirect($dev, 0)) { $output = new JsonOutput(); $output->setContent($content); $output->output(); exit; } $td_code = gfGetVar('td_code', ''); $lastTicket = gfGetVar('lastTicket', 'A000'); $content = null; $startTime = time(); while (time() - $startTime < 120) { sleep(1); // Check every second $currentState = DisplayMain::fromDatabaseCompleteList($td_code); if (count($currentState) == 0) { continue; } if ($lastTicket != $currentState[0]->getTicket()) { // Something changed, compute new tickets $newTickets = array($currentState[0]); $i = 1; while ($i < count($currentState) && $i < 8 && $lastTicket != $currentState[$i]->getTicket()) { $newTickets[] = $currentState[$i]; $i++; } $content = array('status' => 'changed', 'count' => count($newTickets), 'entries' => $newTickets); break; } unset($currentState); } // End while if (!$content) { // Polling wait expired $content = array('status' => 'unchanged'); } $output = new JsonOutput(); $output->setContent($content); $output->output(); }
include '../includes/Setup.php'; include './displayFunctions.php'; // Do not lock tables Database::lockTables(false); $deskNumber = gfGetVar('deskNumber'); // Check whether this device needs to be redirected somewhere $dev = Device::fromDatabaseByIpAddress($_SERVER['REMOTE_ADDR']); if ($content = getContentForRedirect($dev, (int) $deskNumber)) { $output = new JsonOutput(); $output->setContent($content); $output->output(); exit; } // Response is json $output = new JsonOutput(); $pageTicketCode = gfGetVar('ticketCode', ''); $pageTicketNumber = gfGetVar('ticketNumber', ''); $startTime = time(); while (time() - $startTime < 120) { sleep(1); // Check every second // Update table for session timed out $desk = Desk::fromDatabaseByNumber($deskNumber); $desk->isOpen(); $currentTicket = Ticket::fromDatabaseByDesk($deskNumber); if (!$currentTicket) { if ($pageTicketCode == '' && $pageTicketNumber == '') { // Still no ticket continue; }