/** * Default action to dispatch */ public function indexAction() { $personId = (int) $this->_getParam('personId', 0); $visitId = (int) $this->_getParam('visitId', 0); $this->_setActivePatient($personId, $visitId); // ALERTS $personId = Zend_Auth::getInstance()->getIdentity()->personId; $team = new TeamMember(); $teamId = $team->getTeamByPersonId($personId); $ctr = 0; if (strlen($teamId) > 0) { $alert = new GeneralAlert(); $alertIterator = $alert->getIteratorByTeam($teamId); foreach ($alertIterator as $item) { $ctr++; } } if ($ctr > 0) { $this->view->alerts = $ctr; } $this->view->xmlHeader = '<?xml version=\'1.0\' encoding=\'iso-8859-1\'?>' . "\n"; $contentType = stristr($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml") ? "application/xhtml+xml" : "text/xml"; header("Content-type: " . $contentType); $this->render(); }
public function myAlertsAction() { $personId = Zend_Auth::getInstance()->getIdentity()->personId; $team = new TeamMember(); $teamId = $team->getTeamByPersonId($personId); $rows = array(); if (true) { $alertMsg = new GeneralAlert(); $alertMsgIterator = $alertMsg->getIteratorByTeam($teamId); foreach ($alertMsgIterator as $alert) { $tmp = array(); $tmp['id'] = $alert->generalAlertId; $tmp['data'][] = '<img src="' . $this->view->baseUrl . '/img/medium.png' . '" alt="' . $alert->urgency . '" /> ' . $alert->urgency; // below are temporary data $objectClass = $alert->objectClass; if (!class_exists($objectClass)) { continue; } $obj = new $objectClass(); foreach ($obj->_primaryKeys as $key) { $obj->{$key} = $alert->objectId; } $obj->populate(); $patient = new Patient(); $patient->personId = $obj->personId; $patient->populate(); $tmp['data'][] = $patient->person->getDisplayName(); // patient $tmp['data'][] = ''; // location $tmp['data'][] = date('m/d/Y H:i', strtotime($alert->dateTime)); $tmp['data'][] = $alert->message; $forwardedBy = ''; if ($alert->forwardedBy > 0) { $person = new Person(); $person->personId = (int) $alert->forwardedBy; $person->populate(); $forwardedBy = $person->displayName; } $tmp['data'][] = $forwardedBy; // forwarded $tmp['data'][] = $alert->comment; // comment $controllerName = call_user_func($objectClass . "::" . "getControllerName"); $jumpLink = call_user_func_array($controllerName . "::" . "buildJSJumpLink", array($alert->objectId, $alert->userId, $objectClass)); $js = "function jumpLink{$objectClass}(objectId,patientId) {\n{$jumpLink}\n}"; $tmp['data'][] = $js; $tmp['data'][] = $objectClass . ':' . $alert->objectId . ':' . $patient->personId; $rows[] = $tmp; } } $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json'); $json->suppressExit = true; $json->direct(array('rows' => $rows)); }