Exemplo n.º 1
0
 public function process($data)
 {
     $com_content_id = fx::component('floxim.main.content')->get('id');
     $res = array();
     foreach ($this->getFields() as $f) {
         $type = $f['type'];
         $field_keyword = $f['keyword'];
         if (!in_array($type, array('string', 'text'))) {
             continue;
         }
         if ($f['component_id'] === $com_content_id) {
             continue;
         }
         if ($field_keyword === 'keyword') {
             continue;
         }
         $prop_tpl = $this[$field_keyword];
         $tpl_obj = fx::template()->virtual($prop_tpl);
         $tpl_obj->isAdmin(false);
         $res[$field_keyword] = $tpl_obj->render($data);
     }
     return $res;
 }
Exemplo n.º 2
0
 public function load(array $config = array())
 {
     static $loaded = false;
     if (isset($config['disable'])) {
         $config['disable'] = $this->prepareDisableConfig($config['disable']);
     }
     $this->config = array_merge($this->config, $config);
     if (!$loaded) {
         if (!$this->config['dev.on'] && !defined("FX_ALLOW_DEBUG")) {
             define("FX_ALLOW_DEBUG", false);
         }
         if (!isset($this->config['db.dsn'])) {
             $this->config['db.dsn'] = 'mysql:dbname=' . $this->config['db.name'] . ';host=' . $this->config['db.host'];
         }
         define('FX_JQUERY_PATH', $this->config['path.jquery']);
         define('FX_JQUERY_PATH_HTTP', $this->config['path.jquery.http']);
         define('FX_JQUERY_UI_PATH', $this->config['path.jquery-ui']);
     }
     ini_set('date.timezone', $this->config['date.timezone']);
     fx::template()->registerSource('admin', fx::path('@floxim/Admin/templates'));
     $loaded = true;
     return $this;
 }
Exemplo n.º 3
0
 public function render($template)
 {
     if (is_string($template)) {
         $template = fx::template($template);
     }
     $res = $this->process();
     $output = $template->render($res);
     $output = $this->postprocess($output);
     return $output;
 }
Exemplo n.º 4
0
 public function processTemplate()
 {
     if (!$this->mail_template) {
         return;
     }
     $tpl = $this->mail_template;
     $props = array('subject', 'message');
     $res = array();
     foreach ($props as $prop) {
         $prop_tpl = $tpl[$prop];
         $tpl_obj = fx::template()->virtual($prop_tpl);
         $tpl_obj->isAdmin(false);
         $res[$prop] = $tpl_obj->render($this->data);
     }
     $this->subject($res['subject']);
     $this->message($res['message']);
     if ($tpl['from']) {
         $this->from($tpl['from']);
     }
     if ($tpl['bcc']) {
         $this->bcc($tpl['bcc']);
     }
 }