public function afterPermissionCheck() { if (gfGetVar('reset', false)) { Session::setupWebSession(); } $this->redirect = Session::redirectLastStep(0); $this->tdList = TopicalDomain::fromDatabaseCompleteList(); }
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; }
public function execute() { global $gvOfficeCode; $tdList = TopicalDomain::fromDatabaseCompleteList(); $content = array(); if (!$tdList) { $content['ErrorCode'] = "AE003"; $content['ErrorMsg'] = "No queues in this office"; return $content; } $content['OfficeCode'] = $gvOfficeCode; $content['NumQueues'] = count($tdList); $content['Queues'] = array(); foreach ($tdList as $td) { $queueObj = array('Code' => $td->getCode(), 'Name' => $td->getName(), 'Description' => $td->getDescription(), 'Eta' => (int) ($td->getEta() / 60), 'PeopleWaiting' => Ticket::getNumberTicketInQueue($td->getCode())); $content['Queues'][] = $queueObj; } return $content; }
private function getTdStatsRows() { $rows = ''; $tdList = TopicalDomain::fromDatabaseCompleteList(false); foreach ($tdList as $td) { $tickets = TicketStats::fromDatabaseListByCode($td->getCode(), $this->dateFrom, $this->dateTo); $accumulatorWait = 0; $accumulatorService = 0; $counter = 0; foreach ($tickets as $ticket) { // Do not count canceled ticket if (!$ticket->getTimeExec()) { continue; } $wait = $ticket->getTimeExec() - $ticket->getTimeIn(); $accumulatorWait += $wait; $service = $ticket->getTimeOut() - $ticket->getTimeExec(); $accumulatorService += $service; $counter++; } if ($counter) { $averageWait = (int) ($accumulatorWait / $counter / 60); $averageService = (int) ($accumulatorService / $counter / 60); } else { $averageWait = 0; $averageService = 0; } $rows .= <<<EOS <tr> <td>{$td->getCode()}</td> <td>{$counter}</td> <td>{$averageWait} min</td> <td>{$averageService} min</td> </tr> EOS; } if (!$rows) { $rows = '<tr><td colspan="3">Nessuna statistica disponibile</td></tr>'; } return $rows; }
private function getTableBody() { global $gvPath; $topDomains = TopicalDomain::fromDatabaseCompleteList(false); if (count($topDomains) === 0) { return '<tr><td colspan="5" class="noEntry">Nessuna area tematica</td></tr>'; } $ret = ""; foreach ($topDomains as $topDomain) { $checkbox = $this->getCheckbox($topDomain); $ret .= <<<EOS <tr> <td>{$topDomain->getCode()}</td> <td>{$topDomain->getName()}</td> <td>{$topDomain->getDescription()}</td> <td>{$checkbox}</td> \t<td><a href="{$gvPath}/application/adminTopicalDomainEdit?td_id={$topDomain->getId()}" class="tdEditLink">Modifica</a> <a class="ajaxRemove" href="{$gvPath}/ajax/removeRecord?td_id={$topDomain->getId()}">Rimuovi</a></td> </tr> EOS; } return $ret; }
private function getTableBody() { $topicalDomains = TopicalDomain::fromDatabaseCompleteList(true); $tableBody = ''; for ($i = 0; $i < count($topicalDomains); $i++) { $td = $topicalDomains[$i]; $description = $td->getCode() . " - " . htmlspecialchars($td->getName()); $queueLength = Ticket::getNumberTicketInQueue($td->getCode()); $checkbox = $this->getCheckBox($td->getCode(), $description, $queueLength, in_array($td->getCode(), $this->td_served)); if ($i % 4 === 0) { $tableBody .= "<tr>\n"; } $tableBody .= "<td style=\"padding: 5px;\">{$checkbox}</td>\n"; if (($i + 1) % 4 === 0) { $tableBody .= "</tr>\n"; } } // Close row if not closed if (substr($tableBody, -6) !== "</tr>\n") { $tableBody .= "</tr>\n"; } return $tableBody; }
private function getComboboxTd() { $ret = '<select name="dev_td_code" id="dev_td_code">'; $ret .= PHP_EOL . '<option value="0">Tutte</option>'; foreach (TopicalDomain::fromDatabaseCompleteList() as $td) { $code = $td->getCode(); $selected = $this->dev_td_code === $code ? ' selected' : ''; $ret .= "\n<option value=\"{$code}\"{$selected}>{$code}</option>"; } $ret .= "\n</select>"; return $ret; }