diff options
Diffstat (limited to 'framework/Web/UI/WebControls/TAccordion.php')
-rw-r--r-- | framework/Web/UI/WebControls/TAccordion.php | 205 |
1 files changed, 0 insertions, 205 deletions
diff --git a/framework/Web/UI/WebControls/TAccordion.php b/framework/Web/UI/WebControls/TAccordion.php index fc794cd4..cf8abfe2 100644 --- a/framework/Web/UI/WebControls/TAccordion.php +++ b/framework/Web/UI/WebControls/TAccordion.php @@ -533,208 +533,3 @@ class TAccordion extends TWebControl implements IPostBackDataHandler } } - -/** - * Class TAccordionView. - * - * TAccordionView represents a single view in a {@link TAccordion}. - * - * TAccordionView is represented inside the {@link TAccordion} with an header label whose text is defined by - * the {@link setCaption Caption} property; optionally the label can be an hyperlink: use the - * {@link setNavigateUrl NavigateUrl} property to define the destination url. - * - * @author Gabor Berczi, DevWorx Hungary <gabor.berczi@devworx.hu> - * @package System.Web.UI.WebControls - * @since 3.2 - */ -class TAccordionView extends TWebControl -{ - private $_active=false; - - /** - * @return the tag name for the view element - */ - protected function getTagName() - { - return 'div'; - } - - /** - * Adds attributes to renderer. - * @param THtmlWriter the renderer - */ - protected function addAttributesToRender($writer) - { - if(!$this->getActive() && $this->getPage()->getClientSupportsJavaScript()) - $this->getStyle()->setStyleField('display','none'); - - $this->getStyle()->mergeWith($this->getParent()->getViewStyle()); - - parent::addAttributesToRender($writer); - - $writer->addAttribute('id',$this->getClientID()); - } - - /** - * @return string the caption displayed on this header. Defaults to ''. - */ - public function getCaption() - { - return $this->getViewState('Caption',''); - } - - /** - * @param string the caption displayed on this header - */ - public function setCaption($value) - { - $this->setViewState('Caption',TPropertyValue::ensureString($value),''); - } - - /** - * @return string the URL of the target page. Defaults to ''. - */ - public function getNavigateUrl() - { - return $this->getViewState('NavigateUrl',''); - } - - /** - * Sets the URL of the target page. - * If not empty, clicking on this header will redirect the browser to the specified URL. - * @param string the URL of the target page. - */ - public function setNavigateUrl($value) - { - $this->setViewState('NavigateUrl',TPropertyValue::ensureString($value),''); - } - - /** - * @return string the text content displayed on this view. Defaults to ''. - */ - public function getText() - { - return $this->getViewState('Text',''); - } - - /** - * Sets the text content to be displayed on this view. - * If this is not empty, the child content of the view will be ignored. - * @param string the text content displayed on this view - */ - public function setText($value) - { - $this->setViewState('Text',TPropertyValue::ensureString($value),''); - } - - /** - * @return boolean whether this accordion view is active. Defaults to false. - */ - public function getActive() - { - return $this->_active; - } - - /** - * @param boolean whether this accordion view is active. - */ - public function setActive($value) - { - $this->_active=TPropertyValue::ensureBoolean($value); - } - - /** - * 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); - } - - /** - * Renders the header associated with the accordion view. - * @param THtmlWriter the writer for rendering purpose. - */ - public function renderHeader($writer) - { - if($this->getVisible(false) && $this->getPage()->getClientSupportsJavaScript()) - { - $writer->addAttribute('id',$this->getClientID().'_0'); - - $style=$this->getActive()?$this->getParent()->getActiveHeaderStyle():$this->getParent()->getHeaderStyle(); - - $style->addAttributesToRender($writer); - - $writer->renderBeginTag($this->getTagName()); - - $this->renderHeaderContent($writer); - - $writer->renderEndTag(); - } - } - - /** - * Renders the content in the header. - * By default, a hyperlink is displayed. - * @param THtmlWriter the HTML writer - */ - protected function renderHeaderContent($writer) - { - $url = $this->getNavigateUrl(); - if(($caption=$this->getCaption())==='') - $caption=' '; - - if ($url!='') - $writer->write("<a href=\"{$url}\">"); - $writer->write("{$caption}"); - if ($url!='') - $writer->write("</a>"); - } -} - -/** - * Class TAccordionViewCollection. - * - * TAccordionViewCollection is a collection of {@link TAccordionView} to be used inside a {@link TAccordion}. - * - * @author Gabor Berczi, DevWorx Hungary <gabor.berczi@devworx.hu> - * @package System.Web.UI.WebControls - * @since 3.2 - */ -class TAccordionViewCollection extends TControlCollection -{ - /** - * Inserts an item at the specified position. - * This overrides the parent implementation by performing sanity check on the type of new item. - * @param integer the speicified position. - * @param mixed new item - * @throws TInvalidDataTypeException if the item to be inserted is not a {@link TAccordionView} object. - */ - public function insertAt($index,$item) - { - if($item instanceof TAccordionView) - parent::insertAt($index,$item); - else - throw new TInvalidDataTypeException('tabviewcollection_tabview_required'); - } - - /** - * Finds the index of the accordion view whose ID is the same as the one being looked for. - * @param string the explicit ID of the accordion view to be looked for - * @return integer the index of the accordion view found, -1 if not found. - */ - public function findIndexByID($id) - { - foreach($this as $index=>$view) - { - if($view->getID(false)===$id) - return $index; - } - return -1; - } -} - |