示例#1
0
 function generateConstructor($code)
 {
     if ($this->mirror && ($mirrored_pager = $this->parent->findUpChild($this->mirror))) {
         return $mirrored_pager->generateConstructor($code);
     } else {
         parent::generateConstructor($code);
     }
     $items = $this->getAttribute('items');
     if (!empty($items)) {
         $code->writePhp($this->getComponentRefCode() . '->setItemsPerPage(' . $items . ');' . "\n");
     }
     $pager_prefix = $this->getAttribute('pager_prefix');
     if (!empty($pager_prefix)) {
         $code->writePhp($this->getComponentRefCode() . '->setPagerPrefix("' . $pager_prefix . '");' . "\n");
     }
     if ($this->findChildByClass('WactPagerElipsesTag')) {
         $code->writePhp($this->getComponentRefCode() . '->useElipses();' . "\n");
         $pages_in_middle = $this->getAttribute('pages_in_middle');
         if (!empty($pages_in_middle)) {
             $code->writePhp($this->getComponentRefCode() . '->setPagesInMiddle(' . $pages_in_middle . ');' . "\n");
         }
         if ($this->hasAttribute('pages_in_sides')) {
             $code->writePhp($this->getComponentRefCode() . '->setPagesInSides(' . (int) $this->getAttribute('pages_in_sides') . ');' . "\n");
         }
     } else {
         $code->writePhp($this->getComponentRefCode() . '->useSections();' . "\n");
         $pages_per_section = $this->getAttribute('pages_per_section');
         if (!empty($pages_per_section)) {
             $code->writePhp($this->getComponentRefCode() . '->setPagesPerSection(' . $pages_per_section . ');' . "\n");
         }
     }
 }
示例#2
0
 /**
  * @param WactCodeWriter
  */
 function generateConstructor($code_writer)
 {
     parent::generateConstructor($code_writer);
     if ($this->getBoolAttribute('hide')) {
         $code_writer->writePHP($this->getComponentRefCode() . '->hide();' . "\n");
     }
 }
示例#3
0
 /**
  * Writes the compiled template constructor from the runtime component,
  * assigning the attributes found at compile time to the runtime component
  * via a serialized string
  */
 function generateConstructor($code_writer)
 {
     parent::generateConstructor($code_writer);
     // Determine which attributes should not propigate to runtime
     $CompileTimeAttributes = $this->tag_info->getSuppressAttributes();
     // Add the runat attribute to the list of attributes to filter out
     $CompileTimeAttributes[] = 'runat';
     $CompileTimeAttributes[] = 'wact:id';
     $code_writer->writePHP($this->getComponentRefCode() . '->setAttributes(unserialize(');
     $code_writer->writePHPLiteral(serialize($this->getAttributesAsArray($CompileTimeAttributes)));
     $code_writer->writePHP('));' . "\n");
 }