Beispiel #1
0
 /**
  * Copies basic control attributes from another control.
  * Properties including AccessKey, ToolTip, TabIndex, Enabled
  * and Attributes are copied.
  * @param TWebControl source control
  */
 public function copyBaseAttributes(TWebControl $control)
 {
     $this->setAccessKey($control->getAccessKey());
     $this->setToolTip($control->getToolTip());
     $this->setTabIndex($control->getTabIndex());
     if (!$control->getEnabled()) {
         $this->setEnabled(false);
     }
     if ($control->getHasAttributes()) {
         $this->getAttributes()->copyFrom($control->getAttributes());
     }
 }
Beispiel #2
0
 /**
  * Renders the body content of the label.
  * @param THtmlWriter the renderer
  */
 public function renderContents($writer)
 {
     if (($text = $this->getText()) === '') {
         parent::renderContents($writer);
     } else {
         $writer->write($text);
     }
 }
 /**
  * Renders body content.
  * This method overrides the parent implementation by replacing
  * the body content with the processed text content.
  * @param THtmlWriter writer
  */
 public function renderContents($writer)
 {
     if (($text = $this->getText()) === '' && $this->getHasControls()) {
         $textWriter = new TTextWriter();
         parent::renderContents(new THtmlWriter($textWriter));
         $text = $textWriter->flush();
     }
     if ($text !== '') {
         $writer->write($this->processText($text));
     }
 }
Beispiel #4
0
 /**
  * Renders body content.
  * This method overrides the parent implementation by replacing
  * the body content with the processed text content.
  * @param THtmlWriter writer
  */
 public function renderContents($writer)
 {
     if (($text = $this->getText()) === '' && $this->getHasControls()) {
         $htmlWriter = Prado::createComponent($this->GetResponse()->getHtmlWriterType(), new TTextWriter());
         parent::renderContents($htmlWriter);
         $text = $htmlWriter->flush();
     }
     if ($text !== '') {
         $writer->write($this->processText($text));
     }
 }
Beispiel #5
0
 /**
  * Adds attributes related to an HTML image element to renderer.
  * @param THtmlWriter the writer used for the rendering purpose
  */
 protected function addAttributesToRender($writer)
 {
     $writer->addAttribute('src', $this->getImageUrl());
     $writer->addAttribute('alt', $this->getAlternateText());
     if (($desc = $this->getDescriptionUrl()) !== '') {
         $writer->addAttribute('longdesc', $desc);
     }
     if (($align = $this->getImageAlign()) !== '') {
         $writer->addAttribute('align', $align);
     }
     parent::addAttributesToRender($writer);
 }
Beispiel #6
0
 /**
  * Renders the body content of the hyperlink.
  * @param THtmlWriter the writer for rendering
  */
 public function renderContents($writer)
 {
     if (($imageUrl = $this->getImageUrl()) === '') {
         if (($text = $this->getText()) !== '') {
             $writer->write(THttpUtility::htmlEncode($text));
         } else {
             if ($this->getHasControls()) {
                 parent::renderContents($writer);
             } else {
                 $writer->write(THttpUtility::htmlEncode($this->getNavigateUrl()));
             }
         }
     } else {
         $this->createImage($imageUrl)->renderControl($writer);
     }
 }
Beispiel #7
0
 /**
  * Adds attribute name-value pairs to renderer.
  * This overrides the parent implementation with additional button specific attributes.
  * @param THtmlWriter the writer used for the rendering purpose
  */
 protected function addAttributesToRender($writer)
 {
     $page = $this->getPage();
     $page->ensureRenderInForm($this);
     if (($uniqueID = $this->getUniqueID()) !== '') {
         $writer->addAttribute('name', $uniqueID);
     }
     if ($this->getEnabled(true)) {
         if ($this->getEnableClientScript() && $this->needPostBackScript()) {
             $this->renderClientControlScript($writer);
         }
     } else {
         if ($this->getEnabled()) {
             // in this case, parent will not render 'disabled'
             $writer->addAttribute('disabled', 'disabled');
         }
     }
     parent::addAttributesToRender($writer);
 }
Beispiel #8
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);
     }
 }
 public function renderContents($writer)
 {
     parent::renderContents($writer);
 }
Beispiel #10
0
 /**
  * Creates the child controls of the wizard.
  * This method overrides the parent implementation.
  * @param TEventParameter event parameter
  */
 public function onInit($param)
 {
     parent::onInit($param);
     $this->ensureChildControls();
     $this->setEnsureId(true);
     if ($this->getActiveStepIndex() < 0 && $this->getWizardSteps()->getCount() > 0) {
         $this->setActiveStepIndex(0);
     }
 }
Beispiel #11
0
 /**
  * Renders the repeated items.
  * @param THtmlWriter writer for the rendering purpose
  * @param IRepeatInfoUser repeat information user
  */
 public function renderRepeater($writer, IRepeatInfoUser $user)
 {
     if ($this->_repeatLayout === TRepeatLayout::Table) {
         $control = new TTable();
         if ($this->_caption !== '') {
             $control->setCaption($this->_caption);
             $control->setCaptionAlign($this->_captionAlign);
         }
     } else {
         if ($this->_repeatLayout === TRepeatLayout::Raw) {
             $this->renderRawContents($writer, $user);
             return;
         } else {
             $control = new TWebControl();
         }
     }
     $control->setID($user->getClientID());
     $control->copyBaseAttributes($user);
     if ($user->getHasStyle()) {
         $control->getStyle()->copyFrom($user->getStyle());
     }
     $control->renderBeginTag($writer);
     $writer->writeLine();
     if ($this->_repeatDirection === TRepeatDirection::Vertical) {
         $this->renderVerticalContents($writer, $user);
     } else {
         $this->renderHorizontalContents($writer, $user);
     }
     $control->renderEndTag($writer);
 }
Beispiel #12
0
 /**
  * Renders the body content of this table.
  * @return string the rendering result
  */
 protected function renderBody()
 {
     return "\n" . parent::renderBody() . "\n";
 }
Beispiel #13
0
 /**
  * Renders the openning tag for the table control which will render table caption if present.
  * @param THtmlWriter the writer used for the rendering purpose
  */
 public function renderBeginTag($writer)
 {
     parent::renderBeginTag($writer);
     if (($caption = $this->getCaption()) !== '') {
         if (($align = $this->getCaptionAlign()) !== TTableCaptionAlign::NotSet) {
             $writer->addAttribute('align', strtolower($align));
         }
         $writer->renderBeginTag('caption');
         $writer->write($caption);
         $writer->renderEndTag();
     }
 }
Beispiel #14
0
 /**
  * Registers the checkbox to receive postback data during postback.
  * This is necessary because a checkbox if unchecked, when postback,
  * does not have direct mapping between post data and the checkbox name.
  *
  * This method overrides the parent implementation and is invoked before render.
  * @param mixed event parameter
  */
 public function onPreRender($param)
 {
     parent::onPreRender($param);
     if ($this->getEnabled(true)) {
         $this->getPage()->registerRequiresPostData($this);
     }
 }
 /**
  * Returns the attributes to be rendered.
  * @return ArrayObject attributes to be rendered
  */
 protected function getAttributesToRender()
 {
     $attributes = parent::getAttributesToRender();
     unset($attributes['id']);
     return $attributes;
 }
 /**
  * Sets Enctype of the form on the page.
  * This method overrides the parent implementation and is invoked before render.
  * @param mixed event parameter
  */
 public function onPreRender($param)
 {
     parent::onPreRender($param);
     if (($form = $this->getPage()->getForm()) !== null) {
         $form->setEnctype('multipart/form-data');
     }
     $this->getPage()->getClientScript()->registerHiddenField('MAX_FILE_SIZE', $this->getMaxFileSize());
     if ($this->getEnabled(true)) {
         $this->getPage()->registerRequiresPostData($this);
     }
 }
 /**
  * Adds attribute name-value pairs to renderer.
  * This overrides the parent implementation with additional button specific attributes.
  * @param THtmlWriter the writer used for the rendering purpose
  */
 protected function addAttributesToRender($writer)
 {
     $writer->addAttribute('type', 'text/javascript');
     $writer->addAttribute('src', $this->getClientScriptUrl());
     parent::addAttributesToRender($writer);
 }
Beispiel #18
0
 /**
  * Ensure that the ID attribute is rendered and registers the javascript code
  * for initializing the active control.
  */
 protected function addAttributesToRender($writer)
 {
     //calls the TWebControl to avoid rendering other attribute normally render for a textbox.
     TWebControl::addAttributesToRender($writer);
     $writer->addAttribute('id', $this->getLabelClientID());
     $this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(), $this->getPostBackOptions());
 }
 /**
  * Ensures any pending databind is performed.
  * This method overrides the parent implementation.
  * @param TEventParameter event parameter
  */
 public function onPreRender($param)
 {
     $this->_prerendered = true;
     $this->ensureDataBound();
     parent::onPreRender($param);
 }
 protected function renderBody()
 {
     $src = $this->getImageUrl();
     $text = $this->isEncodeText() ? pradoEncodeData($this->getText()) : $this->getText();
     if (strlen($src)) {
         return "<img src=\"{$src}\" border=\"0\" title=\"{$text}\"/>";
     } else {
         if (strlen($text)) {
             return $text;
         } else {
             return parent::renderBody();
         }
     }
 }
Beispiel #21
0
 /**
  * Renders an additional line-break after the opening tag when it
  * is in MultiLine text mode.
  * @param THtmlWriter the writer used for the rendering purpose^M
  */
 public function renderBeginTag($writer)
 {
     parent::renderBeginTag($writer);
     if ($this->getTextMode() === 'MultiLine') {
         $writer->write("\n");
     }
 }
Beispiel #22
0
 /**
  * Renders body contents of the accordion view.
  * @param THtmlWriter the writer used for the rendering purpose.
  */
 public function renderContents($writer)
 {
     if (($text = $this->getText()) !== '') {
         $writer->write($text);
     } else {
         if ($this->getHasControls()) {
             parent::renderContents($writer);
         }
     }
 }
 /**
  * Adds attributes to renderer.
  * @param THtmlWriter the renderer
  * @throws TInvalidDataValueException if default button is not right.
  */
 protected function addAttributesToRender($writer)
 {
     $this->setCssClass('weekScheduler_container');
     parent::addAttributesToRender($writer);
 }
 protected function addAttributesToRender($writer)
 {
     $writer->addAttribute('id', $this->getClientID());
     parent::addAttributesToRender($writer);
 }
Beispiel #25
0
 public function renderContents($writer)
 {
     $writer->write("<div id='" . $this->Id . "'></div>");
     $writer->write("<SCRIPT LANGUAGE='JavaScript' SRC='" . $this->getJsCookMenuPath() . "'></SCRIPT>\n");
     $writer->write("<SCRIPT LANGUAGE='JavaScript' SRC='" . $this->getJsThemePath() . "'></SCRIPT>\n");
     $writer->write("<LINK REL='stylesheet' HREF='" . $this->getStyleSheetThemePath() . "' TYPE='text/css'>\n");
     $writer->write("<script type='text/javascript'>");
     $writer->write("/*<![CDATA[*/");
     $writer->write("var arrMenu=[");
     $str = JsCookMenu::processControls($this);
     $writer->write($str);
     $writer->write("];");
     $writer->write("cmDraw ('" . $this->Id . "', arrMenu, '" . $this->getMenuOrientation() . "', cm" . $this->getThemeName() . ", '" . $this->getThemeName() . "');");
     $writer->write("</script>");
     parent::renderContents($writer);
 }
Beispiel #26
0
 /**
  * Adds attribute name-value pairs to renderer.
  * This method overrides the parent implementation with additional TKeyboard specific attributes.
  * @param THtmlWriter the writer used for the rendering purpose
  */
 protected function addAttributesToRender($writer)
 {
     parent::addAttributesToRender($writer);
     if ($this->getPage()->getClientSupportsJavaScript()) {
         $writer->addAttribute('id', $this->getClientID());
     }
 }
Beispiel #27
0
 /**
  * Adds attribute name-value pairs to renderer.
  * This overrides the parent implementation with additional button specific attributes.
  * @param THtmlWriter the writer used for the rendering purpose
  */
 protected function addAttributesToRender($writer)
 {
     if ($this->getID() !== '') {
         $writer->addAttribute('name', $this->getUniqueID());
     }
     if (($src = $this->getFrameUrl()) !== '') {
         $writer->addAttribute('src', $src);
     }
     if (($align = strtolower($this->getAlign())) !== 'notset') {
         $writer->addAttribute('align', $align);
     }
     $scrollBars = $this->getScrollBars();
     if ($scrollBars === TInlineFrameScrollBars::None) {
         $writer->addAttribute('scrolling', 'no');
     } else {
         if ($scrollBars === TInlineFrameScrollBars::Both) {
             $writer->addAttribute('scrolling', 'yes');
         }
     }
     if (!$this->getShowBorder()) {
         $writer->addAttribute('frameborder', '0');
     }
     if (($longdesc = $this->getDescriptionUrl()) !== '') {
         $writer->addAttribute('longdesc', $longdesc);
     }
     if (($marginheight = $this->getMarginHeight()) !== -1) {
         $writer->addAttribute('marginheight', $marginheight);
     }
     if (($marginwidth = $this->getMarginWidth()) !== -1) {
         $writer->addAttribute('marginwidth', $marginwidth);
     }
     parent::addAttributesToRender($writer);
 }
 /**
  * This overrides the parent implementation by rendering either <b>Text</b> or the body contents.
  * @return string the rendering result
  */
 protected function renderBody()
 {
     $text = $this->isEncodeText() ? pradoEncodeData($this->getText()) : $this->getText();
     return strlen($text) ? $text : parent::renderBody();
 }
Beispiel #29
0
 /**
  * Renders the datagrid.
  * @param THtmlWriter writer for the rendering purpose
  */
 public function render($writer)
 {
     if ($this->getHasControls()) {
         $this->groupCells();
         if ($this->_useEmptyTemplate) {
             $control = new TWebControl();
             $control->setID($this->getClientID());
             $control->copyBaseAttributes($this);
             if ($this->getHasStyle()) {
                 $control->getStyle()->copyFrom($this->getStyle());
             }
             $control->renderBeginTag($writer);
             $this->renderContents($writer);
             $control->renderEndTag($writer);
         } else {
             if ($this->getViewState('ItemCount', 0) > 0) {
                 $this->applyItemStyles();
                 if ($this->_topPager) {
                     $this->_topPager->renderControl($writer);
                     $writer->writeLine();
                 }
                 $this->renderTable($writer);
                 if ($this->_bottomPager) {
                     $writer->writeLine();
                     $this->_bottomPager->renderControl($writer);
                 }
             }
         }
     }
 }
 /**
  * This overrides the parent implementation by rendering more TWebControl-specific attributes.
  * @return ArrayObject the attributes to be rendered
  */
 protected function getAttributesToRender()
 {
     $attributes = parent::getAttributesToRender();
     if ($this->getGenerateCss()) {
         unset($attributes['style']);
     }
     if (!$this->isEnabled()) {
         $attributes['disabled'] = "disabled";
     }
     $tabIndex = $this->getTabIndex();
     if (!empty($tabIndex)) {
         $attributes['tabindex'] = $tabIndex;
     }
     $toolTip = $this->getToolTip();
     if (strlen($toolTip)) {
         $attributes['title'] = $toolTip;
     }
     $accessKey = $this->getAccessKey();
     if (strlen($accessKey)) {
         $attributes['accesskey'] = $accessKey;
     }
     $cssClass = $this->getCssClass();
     if (strlen($cssClass)) {
         $attributes['class'] = $cssClass;
     }
     return $attributes;
 }