/** * Ajax action to expand shortcodes in letter string for a patient. * * @throws Exception */ public function actionExpandStrings() { if (!($patient = Patient::model()->findByPk(@$_POST['patient_id']))) { throw new Exception('Patient not found: ' . @$_POST['patient_id']); } $text = @$_POST['text']; $textNew = OphCoCorrespondence_Substitution::replace($text, $patient); if ($text != $textNew) { echo $textNew; } }
public function substitute($patient) { $this->body = OphCoCorrespondence_Substitution::replace($this->body, $patient); }