Lithron.LContainer
[ class tree: Lithron.LContainer ] [ index: Lithron.LContainer ] [ all elements ]

Source for file LCodeBrick.php

Documentation is available at LCodeBrick.php

  1. <?php
  2.  
  3.  
  4. /**
  5. * LStaticHtmlBrick class file.
  6. *
  7. * @license http://opensource.org/licenses/mozilla1.1.php Mozilla Public License
  8. * @copyright 2005, diemeisterei GmbH. All rights reserved.
  9. * @author $Author: schmunk $
  10. * @version $Revision: 197 $ $Date: 2006-05-11 21:50:24 +0000 (Do, 11 Mai 2006) $
  11. * @package Lithron.LContainer
  12. * @subpackage WebControls
  13. */
  14.  
  15. /**
  16. * Displays a brick with static HTML
  17. * Can also use PRADO tags (testing)
  18. *
  19. * @package System.Web.UI.WebControls
  20. * @subpackage Bricks
  21. */
  22.  
  23. class LCodeBrick extends LBrick
  24. {
  25. /**
  26. * @return string: name of the brick
  27. */
  28. public function getDescriptiveName()
  29. {
  30. return "PRADO & HTML code (No PostBack)";
  31. }
  32.  
  33. /**
  34. * adds admin snippets
  35. */
  36. public function __construct()
  37. {
  38. parent :: __construct();
  39. $admin = '<com:TTextBox ID="HTML" Width="100%" Rows="8" TextMode="MultiLine"/><br/>';
  40. $this->addAdminSnippet($admin);
  41. }
  42.  
  43. /**
  44. * prepares code in TTemplate
  45. */
  46. public function onPreRender($param)
  47. {
  48. parent :: onPreRender($param);
  49.  
  50. // get HTML from brick paramters
  51. $parm= $this->getParameters();
  52. $raw = "";
  53. if ($parm instanceof TMap)
  54. {
  55. $raw = $parm->itemAt("HTML");
  56. }
  57. // TODO: windows path compatibility
  58. $base_arr = explode("/", $this->Application->getBasePath());
  59. array_pop($base_arr);
  60. $base = implode("/", $base_arr);
  61.  
  62. $this->ContentPlaceholder->Controls->clear();
  63. // instantiate code
  64. try
  65. {
  66. $cooked = new TTemplate($raw, $base);
  67. $cooked->instantiateIn($this->ContentPlaceholder);
  68. }
  69. catch (Exception $e)
  70. {
  71. $this->ContentPlaceholder->Controls[] = '<div style="color: red;">'.$e->getErrorMessage().'</div>';
  72. }
  73. }
  74. }
  75. ?>

Documentation generated on Tue, 20 Jun 2006 05:15:01 +0200 by phpDocumentor 1.3.0RC4