コード例 #1
0
ファイル: nscript_tbd.php プロジェクト: pdelbar/onethree
 /**
  * Render the output of the widget and add it to the DOM
  *
  * @param One_Model $model
  * @param One_Dom $d
  */
 protected function _render($model, One_Dom $dom)
 {
     $src = $this->getCfg('src');
     if (trim($src) == '') {
         throw new One_Exception("A field of type 'nscript' should have a 'src'-attribute defining the nanoScript file to parse.");
     }
     One_Script_Factory::saveSearchPath();
     One_Script_Factory::clearSearchPath();
     $useLang = $this->getCfg('language');
     if ('' == trim($useLang)) {
         $useLang = strtolower(One_Config::get('app.language'));
     }
     die('deprecated stuff found in ' . __FILE__ . ':' . __LINE);
     $cps = One_Config::getInstance()->getCustomPaths();
     foreach ($cps as $cp) {
         One_Script_Factory::addSearchPath($cp . '/views/' . One_Config::get('app.name') . '/' . $model->getScheme()->getName() . '/language/' . $useLang . '/');
     }
     foreach ($cps as $cp) {
         One_Script_Factory::addSearchPath($cp . '/views/' . One_Config::get('app.name') . '/' . $model->getScheme()->getName() . '/');
     }
     $ns = new One_Script();
     $ns->load($src);
     if (!$ns->isError()) {
         if ($this->getID()) {
             $ns->set('id', $this->getID());
         }
         if ($this->getName()) {
             $ns->set('name', $this->getName());
         }
         if ($this->getLabel()) {
             $ns->set('label', $this->getLabel());
         }
         if ($this->getValue($model)) {
             $ns->set('value', $this->getValue($model));
         }
         $ns->set('model', $model);
         $dom->add($ns->execute());
     } else {
         throw new One_Exception($ns->error);
     }
     $dom->add($this->value);
     One_Script_Factory::restoreSearchPath();
 }
コード例 #2
0
ファイル: inline_tbd.php プロジェクト: pdelbar/onethree
 /**
  * Render the output of the widget and add it to the DOM
  *
  * @param One_Model $model
  * @param One_Dom $d
  */
 protected function _render($model, One_Dom $dom)
 {
     $src = $this->getCfg('code');
     $ns = new One_Script();
     if ($this->getID()) {
         $ns->set('id', $this->getID());
     }
     if ($this->getName()) {
         $ns->set('name', $this->getName());
     }
     if ($this->getLabel()) {
         $ns->set('label', $this->getLabel());
     }
     if ($this->getValue($model)) {
         $ns->set('value', $this->getValue($model));
     }
     $ns->set('model', $model);
     $s = $ns->executeString($src);
     $dom->add($s);
     $dom->add($this->value);
     One_Script_Factory::restoreSearchPath();
 }