public function testGetFullName()
 {
     $person = new Person();
     $person->setFirstname('First');
     $person->setLastname('Last');
     $this->assertEquals('First Last', $person->getFullname());
 }
 /**
  * @param string $fieldname The name of the person field
  * @param Person $person The currently selected Person object
  * @return string
  */
 public function personChooser($fieldname, Person $person = null)
 {
     $this->template->addToAsset('scripts', JQUERY . '/jquery.min.js');
     $this->template->addToAsset('scripts', BASE_URI . '/js/people/personChooser.js');
     $id = '';
     $name = '';
     if ($person) {
         $id = $person->getId();
         $name = View::escape($person->getFullname());
     }
     $return_url = new Url($_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
     $personChooser = BASE_URI . '/people?return_url=' . $return_url;
     $html = "\n\t\t<input type=\"hidden\" name=\"{$fieldname}_id\" id=\"{$fieldname}_id\" value=\"{$id}\" />\n\t\t<span id=\"{$fieldname}-name\">{$name}</span>\n\t\t<a class=\"btn\"\n\t\t\thref=\"{$personChooser}\"\n\t\t\tonclick=\"PERSON_CHOOSER.open('{$fieldname}');return false;\">\n\t\t\t<span class=\"fa fa-user\"></span>\n\t\t\tChange Person\n\t\t</a>\n\t\t";
     return $html;
 }
 /**
  * @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;
     }
 }