public function setUp()
 {
     parent::setUp();
     $user = new User();
     $user->username = TEST_LOGIN_USERNAME;
     $user->populateWithUsername();
     Zend_Auth::getInstance()->getStorage()->write($user);
     $clinicalNoteTemplate = new ClinicalNoteTemplate();
     $clinicalNoteTemplate->name = 'Test Note';
     $clinicalNoteTemplate->template = "<progressNoteTemplate>\r\n\t<question label=\"Are you in pain?\">\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.pain.inPain\" dbValue=\"tinyint\" label=\"y/n\">\r\n\t\t</dataPoint>\r\n\t</question>\r\n\t<question label=\"Describe the pain:\">\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.pain.description.burning\" dbValue=\"tinyint\" label=\"Burning\"/>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.pain.description.cramping\" dbValue=\"tinyint\" label=\"Cramping\"/>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.pain.description.penetrating\" dbValue=\"tinyint\" label=\"Penetrating\"/>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.pain.description.colic\" dbValue=\"tinyint\" label=\"Colic\"/>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.pain.description.oppressive\" dbValue=\"tinyint\" label=\"Oppressive\"/>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.pain.description.shooting\" dbValue=\"tinyint\" label=\"Shooting\"/>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.pain.description.sharp\" dbValue=\"tinyint\" label=\"Sharp\"/>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.pain.description.other\" dbValue=\"tinyint\" label=\"Other\"/>\r\n\t</question>\r\n\t<question label=\"Duration of pain:\">\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.pain.description.constant\" dbValue=\"tinyint\" label=\"Constant\"/>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.pain.description.intermittent\" dbValue=\"tinyint\" label=\"Intermittent\"/>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.pain.description.home\" dbValue=\"tinyint\" label=\"Home\"/>\r\n\t</question>\r\n\t<question label=\"What relieves the pain?\">\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.pain.relief.sleep\" dbValue=\"tinyint\" label=\"Sleep\"/>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.pain.description.relief.heat\" dbValue=\"tinyint\" label=\"Heat\"/>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.pain.description.relief.cold\" dbValue=\"tinyint\" label=\"Cold\"/>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.pain.description.relief.medicine\" dbValue=\"tinyint\" label=\"Medicine\"/>\r\n\t</question>\r\n\t<question label=\"Problem Sleeping?\">\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.sleep.problemSleeping\" dbValue=\"tinyint\" label=\"y/n\"/>\r\n\t</question>\r\n\t<question label=\"Is pain now controlled?\">\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.pain.nowControlled\" dbValue=\"tinyint\" label=\"y/n\"/>\r\n\t\t<dataPoint type=\"text\" namespace=\"assessment.pain.comment\" dbValue=\"varchar:255\" label=\"Pain Comment:\"/>\r\n\t</question>\r\n\t<question label=\"Is patient able to communicate?\">\r\n\t\t<heading>Verbal:</heading>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.communicate.verbal.positive\" dbValue=\"tinyint\" label=\"Positive\"/>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.communicate.verbal.plaintativeWhining\" dbValue=\"tinyint\" label=\"Plaintative/Whining\"/>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.communicate.verbal.weeping\" dbValue=\"tinyint\" label=\"Weeping\"/>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.communicate.verbal.screaming\" dbValue=\"tinyint\" label=\"Screaming\"/>\r\n\t\t<heading>Body Movements:</heading>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.communicate.bodyMovement.easeOfMovement\" dbValue=\"tinyint\" label=\"Ease of Movement\"/>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.communicate.bodyMovement.neutral\" dbValue=\"tinyint\" label=\"Neutral\"/>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.communicate.bodyMovement.tense\" dbValue=\"tinyint\" label=\"Tense\" />\r\n\t\t<heading>Facial:</heading>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.communicate.facial.smiling\" dbValue=\"tinyint\" label=\"Smiling\"/>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.communicate.facial.neutral\" dbValue=\"tinyint\" label=\"Neutral\"/>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.communicate.facial.grin\" dbValue=\"tinyint\" label=\"Grin\"/>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.communicate.facial.grittedTeeth\" dbValue=\"tinyint\" label=\"Gritted Teeth\"/>\r\n\t\t<heading>Area of pain:</heading>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.pain.areaNonPalpable\" dbValue=\"tinyint\" label=\"Non-palpable\"/>\r\n\t\t<dataPoint type=\"checkbox\" namespace=\"assessment.pain.areaReagent\" dbValue=\"tinyint\" label=\"Reagent\"/>\r\n\t\t<dataPoint type=\"text\" namespace=\"assessment.pain.areaIndicated\" dbValue=\"varchar:255\" label=\"Indicated:\"/>\r\n\t</question>\r\n</progressNoteTemplate>";
     $clinicalNoteTemplate->persist();
     $this->_objects['noteTemplate'] = $clinicalNoteTemplate;
     $clinicalNoteDefinition = new ClinicalNoteDefinition();
     $clinicalNoteDefinition->title = 'Test Note Definition';
     $clinicalNoteDefinition->clinicalNoteTemplateId = $clinicalNoteTemplate->clinicalNoteTemplateId;
     $clinicalNoteDefinition->active = 1;
     $clinicalNoteDefinition->persist();
     $this->_objects['noteDefinition'] = $clinicalNoteDefinition;
 }
 /**
  * Process the modified clinical notes definition, this must be called using AJAX
  */
 public function processEditDefinitionAction()
 {
     $params = $this->_getParam('cnDefinition');
     if (isset($params['active'])) {
         $params['active'] = 1;
     } else {
         $params['active'] = 0;
     }
     $cnDefinition = new ClinicalNoteDefinition();
     $cnDefinition->populateWithArray($params);
     $cnDefinition->persist();
     $data = array();
     $data['code'] = 200;
     $data['clinicalNoteDefinitionId'] = $cnDefinition->clinicalNoteDefinitionId;
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct($data);
 }