/leganto/app/WebModule/components/BaseComponent.php

http://preader.googlecode.com/ · PHP · 47 lines · 22 code · 10 blank · 15 comment · 0 complexity · 27cc5fdf47b6b6cf3b318ad624f1ae16 MD5 · raw file

  1. <?php
  2. /**
  3. * The source file is subject to the license located on web
  4. * "http://code.google.com/p/preader/".
  5. *
  6. * @copyright Copyright (c) 2009 Jan Papou??ek (jan.papousek@gmail.com),
  7. * Jan Dr??bek (repli2dev@gmail.com)
  8. * @link http://code.google.com/p/preader/
  9. * @license http://code.google.com/p/preader/
  10. */
  11. /**
  12. * @author Jan Papousek
  13. * @author Jan Drabek
  14. * @version $Id$
  15. *
  16. */
  17. abstract class BaseComponent extends Control
  18. {
  19. public function __construct(/*Nette\*/IComponentContainer $parent = NULL, $name = NULL) {
  20. parent::__construct($parent, $name);
  21. $this->init();
  22. }
  23. public function render(){
  24. $this->getTemplate()->render();
  25. }
  26. protected function createTemplate() {
  27. $template = parent::createTemplate();
  28. $componentName = strtr($this->getClass(), array("Component" => ""));
  29. $template->setFile(
  30. dirname(__FILE__) . "/" .
  31. $componentName . "/" .
  32. ExtraString::lowerFirst($componentName) . ".phtml"
  33. );
  34. return LegantoTemplate::loadTemplate($template);
  35. }
  36. protected function init() {}
  37. }