Source for file LMenu.php
Documentation is available at LMenu.php
* @license http://opensource.org/licenses/mozilla1.1.php Mozilla Public License
* @copyright 2005, diemeisterei GmbH. All rights reserved.
* @author $Author: schmunk $
* @version $Revision: 313 $ $Date: 2006-07-30 21:04:58 +0000 (So, 30 Jul 2006) $
* @package Phundament.Components
* @subpackage WebControls
* @package System.Web.UI.WebControls
const MODE_DIRECTION = 2;
{ $this->genericSet("_direction", $value, self::MODE_DIRECTION); }
{ return $this->genericGet("_direction", $level, "V"); }
{ $this->genericSet("_width", $value, self::MODE_FLOAT); }
{ return $this->genericGet("_width", $level, null); }
{ $this->genericSet("_height", $value, self::MODE_FLOAT); }
{ return $this->genericGet("_height", $level, null); }
{ $this->genericSet("_style_id", $value, self::MODE_INTEGER); }
{ return $this->genericGet("_style_id", $level, null); }
{ $this->_text = $value; }
while (!$menu instanceof LMenu) $menu = $menu->Parent;
private function genericSet($aname, $values, $mode = self::MODE_INTEGER)
$ar = split(":", $values);
foreach($ar as $key => $dir)
$ar[$key] = TPropertyValue::ensureInteger($dir);
case self::MODE_DIRECTION:
foreach($ar as $key => $dir)
$ar[$key] = TPropertyValue::ensureEnum($dir, array("V", "H"));
foreach($ar as $key => $dir)
$ar[$key] = TPropertyValue::ensureFloat($dir);
private function genericGet($aname, $level, $default)
if (isset ($ar[$level])) return $ar[$level];
return $this->Parent->genericGet($aname, $level+ 1, $default);
$this->Controls[] = $obj;
$obj->_level = $this->_level+ 1;
public function onLoad($param)
$this->_li_class = $this->Menu->registerLIClass($this);
$this->_ul_class = $this->Menu->registerULClass($this);
public function render($writer)
foreach($this->Controls as $control)
$contents[] = $this->_text;
$writer->addAttribute("class", $this->_li_class);
$writer->renderBeginTag('li');
$writer->addAttribute("class", "c". $sid);
$writer->renderBeginTag('a');
foreach($contents as $control)
$writer->write($control);
else if($control instanceof TControl)
$control->renderControl($writer);
else if($control instanceof IRenderable)
$control->render($writer);
$writer->addAttribute("class", $this->_ul_class);
$writer->renderBeginTag('ul');
* @package System.Web.UI.WebControls
protected $_css = array();
if (isset ($styles[$num]))
$styles[$num] = new TPanelStyle();
$d = $node->getDirection();
//$s[] = "background-color:red";
if ($w !== null) $s[] = "width:$w". $this->getUnit();
//$s[] = "background-color:yellow";
if ($w !== null) $s[] = "width:$w". $this->getUnit();
$this->_css[] = $this->getCSSBlock("#". $this->ClientID. " li.". $classname, $s);
$d = $node->getDirection();
$uid = array($w, $h, $d);
$s[] = "margin: -". ($h ? $h. $this->getUnit() : "0"). " 0 0 ". ($w ? $w. $this->getUnit() : "0");
$this->_css[] = $this->getCSSBlock("#". $this->ClientID. " ul.". $classname, $s);
parent::onPreRender($param);
$id = $this->getClientId();
foreach ($this->_styles as $key => $style)
foreach($style->StyleFields as $field => $parm)
$cs = split(";", $style->CustomStyle);
foreach($style->StyleFields as $field => $parm)
$cs = split(";", $style->CustomStyle);
$this->_css[] = $this->getCSSBlock("#". $this->ClientID. " a.c". $key. ":hover", $s);
//"background-color:transparent",
$this->_css[] = $this->getCSSBlock("#$id a:hover", array(
$sel = array("#$id li ul");
for($level = 1; $level < self::MAXLEVEL; $level++ )
$sel[] = "#$id li:hover ". str_repeat("ul ", $level+ 1);
for($level = 0; $level < self::MAXLEVEL; $level++ )
$sel[] = "#$id ". str_repeat("li ", $level). "li:hover ul";
$this->Page->ClientScript->registerStyleSheet($this->ClientID. "_CSS", implode("\n", $this->_css));
public function render($writer)
$writer->addAttribute("id", $this->getClientId());
$writer->addStyleAttribute("width", "50em");
$writer->renderBeginTag('ul');
$this->renderChildren($writer);
$writer->addStyleAttribute("clear", "both");
$writer->renderBeginTag("div");
return $sel. " { ". implode(";", $param). " }";
* @package System.Web.UI.WebControls
* @package System.Web.UI.WebControls
foreach($tpl->getDirective() as $name=> $value)
$this->setSubProperty($name,$value);
throw new TConfigurationException('templatecontrol_directive_invalid',get_class($this),$name);
$tpl->instantiateIn($this);
|