- <?php
-
-
- /**
- * LStaticHtmlBrick class file.
- *
- * @license http://opensource.org/licenses/mozilla1.1.php Mozilla Public License
- * @copyright 2005, diemeisterei GmbH. All rights reserved.
- * @author $Author: schmunk $
- * @version $Revision: 197 $ $Date: 2006-05-11 21:50:24 +0000 (Do, 11 Mai 2006) $
- * @package Lithron.LContainer
- * @subpackage WebControls
- */
-
- /**
- * Displays a brick with static HTML
- * Can also use PRADO tags (testing)
- *
- * @package System.Web.UI.WebControls
- * @subpackage Bricks
- */
-
- class LCodeBrick extends LBrick
- {
- /**
- * @return string: name of the brick
- */
- public function getDescriptiveName()
- {
- return "PRADO & HTML code (No PostBack)";
- }
-
- /**
- * adds admin snippets
- */
- public function __construct()
- {
- parent :: __construct();
- $admin = '<com:TTextBox ID="HTML" Width="100%" Rows="8" TextMode="MultiLine"/><br/>';
- $this->addAdminSnippet($admin);
- }
-
- /**
- * prepares code in TTemplate
- */
- public function onPreRender($param)
- {
- parent :: onPreRender($param);
-
- // get HTML from brick paramters
- $parm= $this->getParameters();
- $raw = "";
- if ($parm instanceof TMap)
- {
- $raw = $parm->itemAt("HTML");
- }
- // TODO: windows path compatibility
- $base_arr = explode("/", $this->Application->getBasePath());
- array_pop($base_arr);
- $base = implode("/", $base_arr);
-
- $this->ContentPlaceholder->Controls->clear();
- // instantiate code
- try
- {
- $cooked = new TTemplate($raw, $base);
- $cooked->instantiateIn($this->ContentPlaceholder);
- }
- catch (Exception $e)
- {
- $this->ContentPlaceholder->Controls[] = '<div style="color: red;">'.$e->getErrorMessage().'</div>';
- }
- }
- }
- ?>