/**
  * @param GET ticket_id
  */
 public function view()
 {
     $ticket = $this->loadTicket($_GET['ticket_id']);
     if ($ticket->allowsDisplay(isset($_SESSION['USER']) ? $_SESSION['USER'] : null)) {
         $this->template->setFilename('tickets');
         $this->template->blocks['ticket-panel'][] = new Block('tickets/ticketInfo.inc', array('ticket' => $ticket));
         $this->template->blocks['ticket-panel'][] = new Block('tickets/slaStatus.inc', array('ticket' => $ticket));
         if (Person::isAllowed('tickets', 'update') && $ticket->getStatus() != 'closed') {
             $this->template->blocks['history-panel'][] = new Block('tickets/actionForm.inc', array('ticket' => $ticket));
         }
         $this->addStandardInfoBlocks($ticket);
     } else {
         $_SESSION['errorMessages'][] = new \Exception('noAccessAllowed');
     }
 }
 /**
  * Displays a single issue from a ticket
  */
 public function index()
 {
     try {
         $issue = new Issue($_GET['issue_id']);
         $ticket = $issue->getTicket();
     } catch (\Exception $e) {
         $_SESSION['errorMessages'][] = $e;
         header('Location: ' . BASE_URL . '/tickets');
         exit;
     }
     $this->template->setFilename('issues');
     $this->template->blocks['ticket-panel'][] = new Block('tickets/ticketInfo.inc', array('ticket' => $ticket));
     if (Person::isAllowed('people', 'view')) {
         $person = $issue->getReportedByPerson();
         if ($person) {
             $this->template->blocks['person-panel'][] = new Block('people/personInfo.inc', array('person' => $person, 'disableButtons' => true));
         }
     }
     $this->template->blocks['issue-panel'][] = new Block('tickets/issueInfo.inc', array('issue' => $issue));
 }
 /**
  * View a single location
  */
 public function view()
 {
     // Make sure we have the location in the system
     $location = trim($_GET['location']);
     if (!$location) {
         header('Location: ' . BASE_URL . '/locations');
         exit;
     }
     $table = new TicketTable();
     $ticketList = $table->find(array('location' => $location));
     $this->template->setFilename('locations');
     $blocks = array('locationInfo', 'masterAddressData', 'locationPeople');
     foreach ($blocks as $b) {
         $this->template->blocks['left'][] = new Block("locations/{$b}.inc", array('location' => $location, 'disableButtons' => isset($_GET['disableButtons'])));
     }
     $this->template->blocks['right'][] = new Block('tickets/ticketList.inc', array('ticketList' => $ticketList, 'title' => 'Cases Associated with this Location', 'disableLinks' => isset($_GET['disableLinks']), 'disableButtons' => isset($_GET['disableButtons'])));
     if (Person::isAllowed('tickets', 'merge') && !isset($_GET['disableLinks']) && count($ticketList) > 1) {
         $this->template->blocks['right'][] = new Block('tickets/ticketSelectForMergeForm.inc');
     }
 }
 /**
  * @param GET person_id
  * @param GET disableLinks
  */
 public function view()
 {
     $this->template->setFilename('people');
     if (!isset($_GET['person_id'])) {
         $this->redirectToErrorUrl(new \Exception('people/unknownPerson'));
     }
     try {
         $person = new Person($_GET['person_id']);
     } catch (\Exception $e) {
         $this->redirectToErrorUrl($e);
     }
     $this->template->title = $person->getFullname();
     $disableButtons = isset($_REQUEST['disableButtons']) ? (bool) $_REQUEST['disableButtons'] : false;
     $block = new Block('people/personInfo.inc', array('person' => $person, 'disableButtons' => $disableButtons));
     if ($this->template->outputFormat == 'html') {
         $this->template->blocks['left'][] = $block;
         $this->template->blocks['right'][] = new Block('people/stats.inc', array('person' => $person));
         $lists = array('reportedBy' => 'Reported Cases', 'assigned' => 'Assigned Cases', 'referred' => 'Referred Cases', 'enteredBy' => 'Entered Cases');
         $disableLinks = isset($_REQUEST['disableLinks']) ? (bool) $_REQUEST['disableLinks'] : false;
         $count = 0;
         foreach ($lists as $listType => $title) {
             $count += $this->addTicketList('right', $listType, $title, $person, $disableLinks);
         }
         if (Person::isAllowed('tickets', 'merge') && !isset($_GET['disableLinks']) && $count > 1) {
             $this->template->blocks['right'][] = new Block('tickets/ticketSelectForMergeForm.inc');
         }
     } else {
         $this->template->blocks[] = $block;
     }
 }