From d30d70afd95653bb356603612db6519d6e6ebead Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Sat, 3 Dec 2011 12:30:25 +0000 Subject: improved i18n --- h-source/Application/Models/GenericModel.php | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'h-source/Application/Models/GenericModel.php') diff --git a/h-source/Application/Models/GenericModel.php b/h-source/Application/Models/GenericModel.php index 9a619fd..002149b 100644 --- a/h-source/Application/Models/GenericModel.php +++ b/h-source/Application/Models/GenericModel.php @@ -66,4 +66,39 @@ class GenericModel extends Model_Tree { $this->_popupWhere[$field] = 'type="'.$this->type.'" and deleted="no" and cleared="no"'; } } + + //set the fuction to be applied upon each popup name + public function setPopupFunctions() + { + foreach ($this->_popupItemNames as $name => $field) + { + $this->_popupFunctions[$name] = $this->getTranslationFunction($name); + } + } + + public function getPopupLabel($viewArgs) + { + $html = null; + foreach ($viewArgs as $field => $value) + { + $html .= "
$value
\n"; + } + return $html; + } + + //get the translation function + public function getTranslationFunction($fieldName) + { + $fieldsFunc = array( + "vendor" => "betterVendor", + "interface" => "translate", + ); + + if (array_key_exists($fieldName,$fieldsFunc)) + { + return $fieldsFunc[$fieldName]; + } + + return "gtext"; + } } \ No newline at end of file -- cgit v1.2.3