Source for file LCssDropDownMenuNode.php
Documentation is available at LCssDropDownMenuNode.php
* LCssDropDownMenuNode class file
* This program is free software; you can redistribute it and/or modify
* it under the terms of the BSD License.
* Copyright(c) 2004 by Scott Fuelberth.
* Copyright(c) 2006 by Tobias Munk.
* The latest version of PRADO can be obtained from:
* {@link http://prado.sourceforge.net/}
* @author Scott Fuelberth <skot@bastardcat.org>, Tobias Munk <webmaster@lithron.de>
* @version $Revision: 634 $ $Date: 2007-02-25 02:10:40 +0100 (Sun, 25 Feb 2007) $
* @package Phundament.Components
* @subpackage WebControls
* LCssDropDownMenuNode class
* LCssDropDownMenuNode displays a css driven menu item. You can set the link through the
* through the <b>LinkUrl</b> property. You can set the Text displayed for the item through the <b>Text</b> property.
* You can set the roles that are allowed to access the item through the <b>Roles</b> property.
* Example: <code><com:TCssDropDownMenuNode ID="ViewUsers" LinkUrl="?page=ViewUsersPage"
* Text="View Users" Roles="root,admin" BorderColor="green" BorderStyle="solid" BorderWidth="1" BackColor="white"/></code>
* Namespace: Lithron.Web.UI.WebControls
* - <b>LinkUrl</b>, string, kept in viewstate
* <br/>Set the link for the item.
* - <b>Text</b>, string, kept in viewstate
* <br/>Set the text for the item.
* - <b>Roles</b>, string, kept in viewstate
* <br/>The user roles allowed to view the item.
* @package System.Web.UI.WebControls
private $isTopParent= false;
* top parent css class name
private $topParentNodeCssClass= '';
* parent node css class name
private $parentNodeCssClass= '';
private $nodeCssClass= '';
* disabled node css class name
private $disabledNodeCssClass= '';
* Sets TagName property to 'li'
* @return string the Roles allowd to view this element
return $this->getViewState('Roles', '');
* @param string the Roles allowed to view this element
$this->setViewState('Roles', $value, '');
* @return string the LinkUrl of the node
return $this->getViewState('LinkUrl', '');
* @param string the LinkUrl of the node
$this->setViewState('LinkUrl', $value, '');
* @return string the LinkId of the node (service)
return $this->getViewState('LinkId', '');
* @param string the LinkId of the node (service)
$this->setViewState('LinkId', $value, '');
* @return string the Text of the node
return $this->getViewState('Text', '');
* @param string the Text of the node
$this->setViewState('Text', $value, '');
* @return string the link Target
return $this->getViewState('Target', '');
* @param string the link target
$this->setViewState('Target', $value, '');
* @return bool top parent flag
return $this->isTopParent;
* @param bool the top parent flag
$this->isTopParent= $value;
* @return string the top parent css class
return $this->topParentNodeCssClass;
* #param string the top parent css class
$this->topParentNodeCssClass= $value;
* @return string the parent css class
return $this->parentNodeCssClass;
* @param string the parent css class
$this->parentNodeCssClass= $value;
* @param string the node css class
$this->nodeCssClass= $value;
* @return string the node css class
return $this->nodeCssClass;
* @param string the node css class
$this->disabledNodeCssClass= $value;
* @return string the node css class
return $this->disabledNodeCssClass;
$this->_IsSelected = $value;
return $this->_IsSelected;
* @param sets selected status
$this->setViewState("SelectedPath", $value);
#echo get_class($this->Parent);
$this->Parent->setSelectedPath($value);
* @return gets selected status
return $this->getViewState("SelectedPath");
parent::onPreRender($param);
if (count($this->Controls)) $this->_hasChilds = true; // TODO
$page= $this->Service->constructUrl($this->Service->getServicePage(true));
if (substr($this->LinkUrl, (strlen($page)*- 1)) == $page) // HOTFIX - TODO
* Will go through all TCssDropDownMenuNode children and render them
#echo $this->Text.$this->SelectedPath."<br>";
foreach (explode(",", $roles) AS $role)
if ($user->isInRole($role, $this->getRoles()))
elseif ( count($this->getControls()) )
$style= $this->getStyle();
if (($width= $this->getWidth()) > 0)
$style['width']= $width . 'px';
if (($height= $this->getHeight()) > 0)
$style['height']= $height . 'px';
$foreColor= $this->getForeColor();
$style['color']= $foreColor;
foreach ($style as $k => $v)
if ($s == null || $s == "")
$styleString= 'style="' . $s . '"';
#TODO -------------------------------------
if (substr($_p,0,1) == "/") $_p = substr($_p, 1); // HACK - TODO
$link= $this->Service->constructUrl($_p);
$link= $this->Service->constructUrl($_id);
#$link . "------" . $page."<hr>";
$cssClass= $cssClass . " selected";
$cssClass= $cssClass . " selectedPath"; # TODO does not work, we are already in render :( FIXME
if ($cssClass == null || $cssClass == "")
$cssString= 'class="' . $cssClass . '"';
$link= '<a href="' . $this->getLinkUrl() . '" ' . $styleString . ' ' . $cssString . ' target="' . $this->getTarget() . '" >' . $this->getText() . '</a>';
$link= '<a href="' . $this->getLinkUrl() . '" ' . $styleString . ' ' . $cssString . ' >' . $this->getText() . '</a>';
$link= '<span ' . $styleString . ' ' . $cssString . ' >' . $this->getText() . '</span>';
$body= $this->getControls()->getCount();
$writer->renderBeginTag('ul');
foreach ($this->getControls() as $item)
$item->setTopParent(false);
$writer->renderEndTag('ul');
#Prado :: trace("Returning node children content", 'Lithron.LCssDrownDownMenu');
|