diff options
author | Fabio Bas <ctrlaltca@gmail.com> | 2015-11-09 00:33:08 +0100 |
---|---|---|
committer | Fabio Bas <ctrlaltca@gmail.com> | 2015-11-09 00:33:08 +0100 |
commit | 151b2f7d102a5988b63255d27c9ad78202c16355 (patch) | |
tree | eb5a790407c79ea3a2c74e26c1d97473effae2a2 /demos/site/protected/Common | |
parent | c198ade3610cecd190b74d8519947ad734a0bcca (diff) |
Added (partial) website + misc updates for release
* recreated the prado website in demos/
* updated some docs to reflect the usage of jquery; removed guide to
prototype
* updated composer
* added task for apigen4 (theme still missing)
Diffstat (limited to 'demos/site/protected/Common')
-rw-r--r-- | demos/site/protected/Common/SimpleMenu.php | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/demos/site/protected/Common/SimpleMenu.php b/demos/site/protected/Common/SimpleMenu.php new file mode 100644 index 00000000..bcbc94cf --- /dev/null +++ b/demos/site/protected/Common/SimpleMenu.php @@ -0,0 +1,86 @@ +<?php + +class SimpleMenu extends TControl +{ + public function addParsedObject($object) + { + if ($object instanceof SimpleMenuItem) + parent::addParsedObject($object); + } + + public function render($writer) + { + $writer->renderBeginTag("ul"); + parent::renderChildren($writer); + $writer->renderEndTag(); + } + +} + +class SimpleMenuItem extends TControl +{ + + public function getPath() + { + return $this->getControlState("Path", null); + } + + public function setPath($value) + { + $this->setControlState("Path", TPropertyValue::ensureString($value)); + } + + public function getUrl() + { + return $this->getControlState("Url", null); + } + + public function setUrl($value) + { + $this->setControlState("Url", TPropertyValue::ensureString($value)); + } + + public function getTarget() + { + return $this->getControlState("Target", null); + } + + public function setTarget($value) + { + $this->setControlState("Target", TPropertyValue::ensureString($value)); + } + + public function getText() + { + return $this->getControlState("Text", $this->getID()); + } + + public function setText($value) { + $this->setControlState("Text", TPropertyValue::ensureString($value)); + } + + public function render($writer) + { + $writer->renderBeginTag("li"); + + if(null !== $path = $this->getPath()) + { + $writer->addAttribute('href', $this->Service->constructUrl($path)); + + if($path == $this->Page->getPagePath()) + $writer->addAttribute('class', 'active'); + } elseif(null !== $url = $this->getUrl()) { + $writer->addAttribute('href', $url); + } + + if($this->getTarget() !== null) + $writer->addAttribute('target', $this->getTarget()); + + $writer->renderBeginTag("a"); + + $writer->write(THttpUtility::htmlEncode($this->getText())); + + $writer->renderEndTag(); + $writer->renderEndTag(); + } +} |