Esempio n. 1
0
 function generateBeforeContent($code_writer)
 {
     parent::generateBeforeContent($code_writer);
     if ($this->hasAttribute('from')) {
         $code_writer->writePHP($this->getComponentRefCode() . '->registerDataSource(');
         $this->attributeNodes['from']->generateExpression($code_writer);
         $code_writer->writePHP(');');
     }
     $id = $this->getServerId();
     $code_writer->writePHP('$' . $id . ' = ' . $this->getComponentRefCode() . "->getDataSource();\n");
 }
Esempio n. 2
0
 /**
  * @param WactCodeWriter
  */
 function generateConstructor($code_writer)
 {
     parent::generateConstructor($code_writer);
     if ($this->hasAttribute('errorclass')) {
         $code_writer->writePHP($this->getComponentRefCode() . '->errorclass = ');
         $code_writer->writePHPLiteral($this->getAttribute('errorclass'));
         $code_writer->writePHP(';');
     }
     if ($this->hasAttribute('errorstyle')) {
         $code_writer->writePHP($this->getComponentRefCode() . '->errorstyle = ');
         $code_writer->writePHPLiteral($this->getAttribute('errorstyle'));
         $code_writer->writePHP(';');
     }
 }
Esempio n. 3
0
 function generateBeforeOpenTag($code)
 {
     $href = '$' . $code->getTempVariable();
     $route = '$' . $code->getTempVariable();
     $code->writePhp($route . ' = "";');
     if (isset($this->attributeNodes['route'])) {
         $code->writePhp($route . ' = "' . $this->attributeNodes['route']->getValue() . '";');
     }
     $fake_params = '$' . $code->getTempVariable();
     $params = '$' . $code->getTempVariable();
     $code->writePhp($fake_params . ' = array();');
     $code->writePhp($params . ' = array();');
     if (isset($this->attributeNodes['params'])) {
         $code->writePhp($fake_params . ' = lmbArrayHelper :: explode(",", ":",');
         $this->attributeNodes['params']->generateExpression($code);
         $code->writePhp(');');
         $code->writePhp('foreach(' . $fake_params . ' as $key => $value) ' . $params . '[trim($key)] = trim($value);');
     }
     if ($this->getBoolAttribute('skip_controller')) {
         $skip_controller = 'true';
     } else {
         $skip_controller = 'false';
     }
     $this->removeAttribute('skip_controller');
     $code->writePhp($href . '= lmbToolkit :: instance()->getRoutesUrl(' . $params . ', ' . $route . ', ' . $skip_controller . ');');
     $this->removeAttribute('route');
     $this->removeAttribute('params');
     if (isset($this->attributeNodes['extra'])) {
         $params = '$' . $code->getTempVariable();
         $code->writePhp($params . ' = array();');
         $code->writePhp($href . ' .= ');
         $this->attributeNodes['extra']->generateExpression($code);
         $code->writePhp(';');
         $this->removeAttribute('extra');
     }
     $code->writePhp($this->getComponentRefCode() . '->setAttribute("href", ' . $href . ');');
     parent::generateBeforeOpenTag($code);
 }