- <?php
- /**
- * 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: 220 $ $Date: 2006-05-19 19:50:30 +0200 (Fr, 19 Mai 2006) $
- * @package Lithron
- * @subpackage WebControls
- */
-
- /**
- * Extended TTranslate control, with uc_first
- *
- * @package System.I18N
- */
- class LTranslate extends TTranslate
- {
-
- /**
- * Sets the ucfirst param
- */
- public function setUcfirst($value)
- {
- $this->setViewstate("Ucfirst", TPropertyValue :: ensureBoolean($value));
- }
-
- /**
- * @return Wheter use uc_first with input string, default is false
- */
- public function getUcfirst()
- {
- return $this->getViewstate("Ucfirst", false);
- }
-
- /**
- * Renders the control
- */
- public function render($writer)
- {
- $textWriter=new TTextWriter;
- $htmlWriter=new THtmlWriter($textWriter);
- $subs = array();
- foreach($this->getControls() as $control)
- {
- if($control instanceof TTranslateParameter)
- $subs['{'.$control->getKey().'}'] = $control->getParameter();
- elseif($control instanceof TControl)
- $control->render($htmlWriter);
- elseif(is_string($control))
- $textWriter->write($control);
- }
-
- $text = $this->getText();
- if(strlen($text)==0)
- $text = $textWriter->flush();
- if($this->getTrim())
- $text = trim($text);
-
- if ($this->getUcfirst())
- {
- $text = ucfirst($this->translateText($text, $subs));
- }
- else
- {
- $text = $this->translateText($text, $subs);
-
- }
- $writer->write($text);
- }
- }
- ?>