예제 #1
0
 static function parse_template($string, $bean_arr)
 {
     global $beanList;
     $person = array();
     foreach ($bean_arr as $bean_name => $bean_id) {
         $focus = BeanFactory::getBean($bean_name, $bean_id);
         $string = aowTemplateParser::parse_template_bean($string, strtolower($beanList[$bean_name]), $focus);
         if ($focus instanceof Person) {
             $person[] = $focus;
         }
     }
     if (!empty($person)) {
         $focus = $person[0];
     } else {
         $focus = new Contact();
     }
     $string = aowTemplateParser::parse_template_bean($string, 'contact', $focus);
     return $string;
 }
예제 #2
0
 static function parse_template($string, &$bean_arr)
 {
     global $beanFiles, $beanList;
     $person = array();
     foreach ($bean_arr as $bean_name => $bean_id) {
         require_once $beanFiles[$beanList[$bean_name]];
         $focus = new $beanList[$bean_name]();
         $focus->retrieve($bean_id);
         $string = aowTemplateParser::parse_template_bean($string, strtolower($beanList[$bean_name]), $focus);
         if ($focus instanceof Person) {
             $person[] = $focus;
         }
     }
     if (!empty($person)) {
         $focus = $person[0];
     } else {
         $focus = new Contact();
     }
     $string = aowTemplateParser::parse_template_bean($string, 'contact', $focus);
     return $string;
 }