/**
     *
     */
    function renderBody()
    {
        $contents = trim(parent::renderBody());
        $contents = addslashes($contents);
        $lines = preg_split("/\n|\r/", $contents);
        $jslines = '';
        foreach ($lines as $line) {
            if (!empty($line)) {
                $jslines .= "\"{$line}\" + \n";
            }
        }
        $jslines .= "\"\"";
        //var_dump($jslines);
        $id = $this->ID;
        $value = "{ '{$id}' : {$jslines} }";
        $this->Page->registerArrayDeclaration('TJSTemplate', $value);
        $script = '
		function findTemplateById(name) 
		{
			for(i in TJSTemplate)
			{
				for(index in TJSTemplate[i])
				{
					if(index == name)
						return TJSTemplate[i][index];
				}
			}
			return null;
		}';
        $this->Page->registerEndScript('TJSTemplate', $script);
        return;
    }
示例#2
0
 /**
  * This overrides the parent implementation by rendering the <b>Text</b> property if it is not empty.
  * @return string the rendering result
  */
 public function renderBody()
 {
     $text = $this->getText();
     if (strlen($text)) {
         return $text;
     } else {
         return parent::renderBody();
     }
 }
示例#3
0
 /**
  * Get the contents and add the content to the TTranslate
  * component. This component does not render anything.
  * The parent container must be of TTranslate, otherwise
  * error.
  */
 protected function renderBody()
 {
     $text = parent::renderBody();
     if ($this->doTrim()) {
         $text = trim($text);
     }
     $container = $this->getContainer();
     $container->addParameter($this->getKey(), $text);
 }
 /**
  * Renders the localized number, be it currency or decimal, or percentage.
  * If the culture is not specified, the default application
  * culture will be used.
  * This method overrides parent's implementation.
  */
 protected function renderBody()
 {
     $app = $this->Application->getGlobalization();
     //initialized the default class wide formatter
     if (is_null(self::$formatter)) {
         self::$formatter = new NumberFormat($app->Culture);
     }
     $culture = $this->getCulture();
     $pattern = $this->getPattern();
     $type = $this->getType();
     if (empty($pattern)) {
         $pattern = $type;
     }
     $value = $this->getValue();
     if (strlen($value) == 0) {
         $value = parent::renderBody();
     }
     //return the specific cultural formatted number
     if (!empty($culture) && $app->Culture != $culture) {
         $formatter = new NumberFormat($culture);
         return $formatter->format($value, $pattern, $this->getCurrency());
     }
     //return the application wide culture formatted number.
     return self::$formatter->format($value, $pattern, $this->getCurrency());
 }
 /**
  * Display the translated string.
  */
 protected function renderBody()
 {
     $app = $this->Application->getGlobalization();
     //get the text from either Property Text or the body
     $text = $this->getText();
     if (strlen($text) == 0) {
         $text = parent::renderBody();
     }
     //trim it
     if ($this->doTrim()) {
         $text = trim($text);
     }
     //no translation handler provided
     if (empty($app->Translation)) {
         return strtr($text, $this->getParameters());
     }
     Translation::init();
     $catalogue = $this->getCatalogue();
     if (empty($catalogue) && isset($app->Translation['catalogue'])) {
         $catalogue = $app->Translation['catalogue'];
     }
     $key = $this->getKey();
     if (!empty($key)) {
         $text = $key;
     }
     $charset = $this->getCharset();
     if (empty($charset)) {
         $charset = 'UTF-8';
     }
     //translate it
     return Translation::formatter()->format($text, $this->getParameters(), $catalogue, $charset);
 }
 /**
  * Get the date-time value for this control.
  * @return string date time value. 
  */
 function getValue()
 {
     $value = $this->getViewState('Value', '');
     if (empty($value)) {
         $text = parent::renderBody();
         if (empty($text)) {
             return time();
         } else {
             return $text;
         }
     }
     return $value;
 }
 function renderBody()
 {
     $contents = trim(parent::renderBody());
     $this->Page->registerEndScript('TAJAXScript', $contents);
     return;
 }