예제 #1
0
 /**
  * Renders the label.
  * It overrides the parent implementation by checking if an associated
  * control is visible or not. If not, the label will not be rendered.
  * @param THtmlWriter writer
  */
 public function render($writer)
 {
     if (($aid = $this->getForControl()) !== '') {
         if ($control = $this->findControl($aid)) {
             if ($control->getVisible(true)) {
                 $this->_forControl = $control->getClientID();
                 parent::render($writer);
             }
         } else {
             throw new TInvalidDataValueException('label_associatedcontrol_invalid', $aid);
         }
     } else {
         parent::render($writer);
     }
 }
예제 #2
0
 public function render($writer)
 {
     $this->registerClientScript();
     parent::render($writer);
 }
 /**
  * Renders the menu, and itinitialize top parent nodes css.
  * @return string the rendering result
  */
 function render()
 {
     $page = $this->getPage();
     if ($this->getGenerateCss()) {
         $cssPath = rtrim($this->getCssDirectory(), '/\\') . '/';
         $cssPath = ltrim($cssPath);
         $this->cssFile = new CssStyleSheet();
         $this->cssFile->setFile($cssPath . $this->getID() . '.css');
         $scriptFile = $this->getID() . '.js';
         $jsScript = new JsScript();
         $jsScript->setFile($this->getJsDirectory() . '/' . $scriptFile);
     }
     $body = $this->getBodies();
     foreach ($body as $item) {
         if ($item instanceof TCssDropDownMenuNode) {
             if ($item->getAlign() == null || $item->getAlign() == '') {
                 $item->setAlign($this->getAlign());
             }
             $item->setTopParent(true);
             $item->setTopParentNodeCssClass($this->getTopParentNodeCssClass());
             $item->setParentNodeCssClass($this->getParentNodeCssClass());
             $item->setNodeCssClass($this->getNodeCssClass());
             $item->setDisabledNodeCssClass($this->getDisabledCssClass());
             if ($this->getHeadingWidth() != null || $this->getHeadingWidth() != '') {
                 if ($item->getSubMenuWidth() == null || $item->getSubMenuWidth() == '') {
                     $item->setSubMenuWidth($this->getHeadingWidth());
                 }
             }
             $item->setLevel(1);
             if (!$this->isEnabled()) {
                 $item->setEnabled(false);
             }
             if ($this->getGenerateCss()) {
                 $item->setCssFile($this->cssFile);
                 $item->setJsFile($jsScript);
             }
             if ($this->getForeColor() != null || $this->getForeColor() != '') {
                 if ($item->getForeColor() == null || $item->getForeColor() == '') {
                     $item->setForeColor($item->getForeColor());
                 }
             }
             if ($this->getFontWeight() != null || $this->getFontWeight() != '') {
                 if ($item->getFontWeight() == null || $item->getFontWeight() == '') {
                     $item->setFontWeight($this->getFontWeight());
                 }
             }
         }
     }
     if ($this->getGenerateCss()) {
         $this->getCssAttributesToRender();
         //$cssStyleSheet->generateCss();
         if (!$page->isScriptFileRegistered('CssDropDownMenuJS')) {
             $scriptPath = rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/' . $this->getJsDirectory() . '/';
             $page->registerScriptFile('CssDropDownMenuJS', $scriptPath . $scriptFile);
             $page->registerStyleFile('CssDropDownMenuCss', $cssPath . $this->getID() . '.css');
         }
     } else {
         if (!$page->isScriptFileRegistered('CssDropDownMenuJS')) {
             $scriptPath = rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . '/' . $this->getJsDirectory() . '/';
             $cssPath = rtrim($this->getCssDirectory(), '/\\') . '/';
             $cssPath = ltrim($cssPath);
             if ($this->getHorizontal()) {
                 $cssFile = $this->getCssHorizontalFile();
             } else {
                 $cssFile = $this->getCssVerticalFile();
             }
             $scriptFile = $this->getJsFile();
             $page->registerStyleFile('CssDropDownMenuCSS', $cssPath . $cssFile);
             $page->registerScriptFile('CssDropDownMenuJS', $scriptPath . $scriptFile);
         }
     }
     $result = parent::render();
     if ($this->getGenerateCss()) {
         $jsScript->addElement($this->getID());
         $jsScript->generateJs();
         $this->cssFile->generateCss();
         $this->cssFile->close();
     }
     return $result;
 }
예제 #4
0
 /**
  * Renders the control.
  * The method overrides the parent implementation by rendering
  * the pager only when there are two or more pages.
  * @param THtmlWriter the writer
  */
 public function render($writer)
 {
     if ($this->_pageCount > 1) {
         parent::render($writer);
     }
 }
예제 #5
0
 public function render($writer)
 {
     if ($this->getHasPreRendered()) {
         $this->setDisplay($this->getPageCount() == 1 ? TDisplayStyle::None : TDisplayStyle::Dynamic);
         TWebControl::render($writer);
         if ($this->getActiveControl()->canUpdateClientSide()) {
             $this->getPage()->getCallbackClient()->replaceContent($this, $writer);
         }
     } else {
         $this->getPage()->getAdapter()->registerControlToRender($this, $writer);
     }
 }
예제 #6
0
 public function render($writer)
 {
     parent::render($writer);
     if (($butt = $this->getDefaultButton()) !== '') {
         if (($button = $this->findControl($butt)) === null) {
             throw new TInvalidDataValueException('panel_defaultbutton_invalid', $butt);
         } else {
             $this->getPage()->getClientScript()->registerDefaultButton($this, $button);
         }
     }
 }
 /**
  * Renders the menu item.
  * @return string the rendering result
  */
 function render()
 {
     $content = parent::render();
     $content .= "\n";
     $user = $this->getPage()->getUser();
     if (!is_null($user)) {
         if (!$user->isInRole($this->getRoles())) {
             $content = '';
         }
     }
     return $content;
 }
예제 #8
0
 /**
  * Renders the body content of the control.
  * This method overrides the parent's implementation.
  * @return string the rendering result.
  */
 public function render()
 {
     $rendered = parent::render();
     $text = $this->isEncodeText() ? pradoEncodeData($this->getText()) : $this->getText();
     if (strlen($text)) {
         $name = $this->getUniqueID();
         $label = "<label for=\"{$name}\">{$text}</label>";
         if ($this->getTextAlign() == 'Left') {
             $rendered = $label . $rendered;
         } else {
             $rendered = $rendered . $label;
         }
     }
     return $rendered;
 }
예제 #9
0
 public function render()
 {
     $maxSize = $this->getMaxFileSize();
     if (!empty($maxSize)) {
         $this->getPage()->registerHiddenField('MAX_FILE_SIZE', $maxSize);
     }
     return parent::render();
 }