public function replaceAssignmentCodes($text)
{
if ($this->details) {
$flds = json_decode($this->details, true);
$by_id = array();
foreach ($flds as $fld) {
if (@$fld['widget_name']) {
$cls_name = 'OEModule\\PatientTicketing\\widgets\\' . $fld['widget_name'];
$widget = new $cls_name();
$by_id[$fld['id']] = $widget->getReportString($fld['value']);
} else {
$by_id[$fld['id']] = $fld['value'];
}
}
// match for ticketing fields
preg_match_all('/\\[pt_([a-z_]+)\\]/is', $text, $m);
foreach ($m[1] as $el) {
$text = preg_replace('/\\[pt_' . $el . '\\]/is', @$by_id[$el] ? $by_id[$el] : 'Unknown', $text);
}
return $text;
}
}