Example #1
0
 public function render_template()
 {
     $template = SystemTemplate::get(Router::$node->getProperty('template'));
     if (null === $template) {
         $template = SystemTemplate::get(Config::get('DEFAULT_TEMPLATE'));
     }
     $html = $template->getPHP();
     $tokens = TreeScript::getParse($html);
     $text = '';
     foreach ($tokens as $i => $token) {
         if ($token['type'] == 'tag' && $token['name'] == 'BODY') {
             $text .= $this->html;
         } else {
             $this->tokenDefault($token, $text);
         }
     }
     $this->html = $text;
     $this->css .= $template->getCSS();
     $this->appendJS($template->getJS());
 }
Example #2
0
<?php

$id = $_POST['id_template'];
$code = $_POST['js'];
SystemTemplate::get($id)->setJS($code);
Example #3
0
<?php

$id = $_POST['id_template'];
$code = $_POST['html'];
SystemTemplate::get($id)->setPHP($code);
Example #4
0
<?php

$id = $_POST['id_template'];
SystemTemplate::ROW($id)->DELETE();
 /**
  * Exclude object from result
  *
  * @param     SystemTemplate $systemTemplate Object to remove from the list of results
  *
  * @return    SystemTemplateQuery The current query, for fluid interface
  */
 public function prune($systemTemplate = null)
 {
     if ($systemTemplate) {
         $this->addUsingAlias(SystemTemplatePeer::ID, $systemTemplate->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      SystemTemplate $value A SystemTemplate object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(SystemTemplate $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Example #7
0
<?php

$search = $_POST['search'];
$templates = SystemTemplate::SELECT($search);
$result = array();
foreach ($templates as $t) {
    $result[] = array('id' => $t->getName(), 'name' => $t->getName());
}
echo json_encode($result);
Example #8
0
<?php

$id = $_POST['id_template'];
$template = SystemTemplate::get($id);
$result = array('html' => $template->getPHP(), 'css' => $template->getCSS(), 'js' => $template->getJS());
echo json_encode($result);
Example #9
0
<?php

$name = $_POST['name'];
$template = SystemTemplate::INSERT($name);
echo $template->getName();