Work on Email and other major consistency work
This commit is contained in:
@@ -13,11 +13,26 @@ class Model_Email_Template_Translate extends ORM_OSB {
|
||||
protected $_created_column = FALSE;
|
||||
protected $_updated_column = FALSE;
|
||||
|
||||
protected $_belongs_to = array(
|
||||
'template'=>array('model'=>'Email_Template','foreign_key'=>'email_template_id'),
|
||||
);
|
||||
|
||||
protected $_save_message = TRUE;
|
||||
|
||||
public function complete($data,$column) {
|
||||
$output = $this->display($column);
|
||||
|
||||
foreach ($this->variables($column) as $k => $v)
|
||||
$output = str_replace('$'.$v.'$',$data[$v],$output);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
public function variables($field) {
|
||||
$results = array();
|
||||
$matches = array();
|
||||
|
||||
preg_match_all('/%([A-Z0-9_]+)%/U',$this->$field,$matches,PREG_OFFSET_CAPTURE);
|
||||
preg_match_all('/\$([A-Z0-9_]+)\$/U',$this->$field,$matches,PREG_OFFSET_CAPTURE);
|
||||
|
||||
foreach ($matches[1] as $k => $v)
|
||||
$results[$v[1]] = $v[0];
|
||||
@@ -27,14 +42,5 @@ class Model_Email_Template_Translate extends ORM_OSB {
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
public function rresolve($data,$column) {
|
||||
$output = $this->display($column);
|
||||
|
||||
foreach ($this->variables($column) as $k => $v)
|
||||
$output = str_replace('%'.$v.'%',$data[$v],$output);
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user