本文整理汇总了PHP中Kwf_Trl类的典型用法代码示例。如果您正苦于以下问题:PHP Kwf_Trl类的具体用法?PHP Kwf_Trl怎么用?PHP Kwf_Trl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Kwf_Trl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initColumns
protected function _initColumns()
{
parent::_initColumns();
$this->_columns->add(new Kwf_Grid_Column('id'));
//shows editDialog
$this->_columns->add(new Kwf_Grid_Column_Button('properties', ' ', 20))->setButtonIcon('/assets/silkicons/newspaper.png')->setTooltip(trlKwf('Properties'));
if (is_instance_of(Kwc_Abstract::getSetting($this->_getParam('class'), 'extConfig'), 'Kwc_Directories_Item_Directory_ExtConfigEditButtons')) {
$extConfigType = 'extConfig';
} else {
if (is_instance_of(Kwc_Abstract::getSetting($this->_getParam('class'), 'extConfigControllerIndex'), 'Kwc_Directories_Item_Directory_ExtConfigEditButtons')) {
$extConfigType = 'extConfigControllerIndex';
}
}
$extConfig = Kwf_Component_Abstract_ExtConfig_Abstract::getInstance($this->_getParam('class'), $extConfigType)->getConfig(Kwf_Component_Abstract_ExtConfig_Abstract::TYPE_DEFAULT);
$extConfig = $extConfig['items'];
if (count($extConfig['countDetailClasses']) > 1 && !$this->_getModel()->hasColumn('component')) {
throw new Kwf_Exception('If you have more than one detail-component your table has to have a column named "component"');
}
$i = 0;
foreach ($extConfig['contentEditComponents'] as $ec) {
$name = Kwf_Trl::getInstance()->trlStaticExecute(Kwc_Abstract::getSetting($ec['componentClass'], 'componentName'));
$icon = Kwc_Abstract::getSetting($ec['componentClass'], 'componentIcon');
$icon = new Kwf_Asset($icon);
$this->_columns->add(new Kwc_Directories_Item_Directory_Trl_ControllerEditButton('edit_' . $i, ' ', 20))->setColumnType('editContent')->setEditComponentClass($ec['componentClass'])->setEditComponent($ec['component'])->setEditType($ec['type'])->setEditIdTemplate($ec['idTemplate'])->setEditComponentIdSuffix($ec['componentIdSuffix'])->setButtonIcon($icon->toString(array('arrow')))->setTooltip(trlKwf('Edit {0}', $name));
$i++;
}
}
示例2: _processInput
protected function _processInput($postData)
{
$users = Kwf_Registry::get('userModel');
$showPassword = false;
//is there a password auth?
foreach ($users->getAuthMethods() as $auth) {
if ($auth instanceof Kwf_User_Auth_Interface_Password) {
$showPassword = true;
}
}
if (!$showPassword) {
throw new Kwf_Exception("No password auth method found");
}
//if a redirect auth doesn't allow password hide it
foreach ($users->getAuthMethods() as $auth) {
if ($auth instanceof Kwf_User_Auth_Interface_Redirect) {
if (!$auth->allowPasswordForUser($users->getAuthedUser())) {
$label = $auth->getLoginRedirectLabel();
$label = Kwf_Trl::getInstance()->trlStaticExecute($label['name']);
$msg = $this->getData()->trlKwf("This user doesn't have a password, he must log in using {0}", $label);
$this->_errors[] = array('messages' => array($msg));
break;
}
}
}
parent::_processInput($postData);
}
示例3: setUp
public function setUp()
{
$trlElements = array();
$trlElements['kwf']['de']['.-decimal separator'] = ',';
$trlElements['kwf']['de']['C-locale'] = 'de_AT.UTF-8, de.UTF-8, de_DE.UTF-8';
Kwf_Trl::getInstance()->setTrlElements($trlElements);
}
示例4: assets
public function assets(Kwf_Assets_Package $assetsPackage, $language = null)
{
if (!$language) {
$language = Kwf_Trl::getInstance()->getTargetLanguage();
}
$indent = str_repeat(' ', 8);
$ret = '';
foreach ($assetsPackage->getPackageUrls('text/css', $language) as $file) {
$ret .= "{$indent}<link rel=\"stylesheet\" type=\"text/css\" href=\"" . htmlspecialchars($file) . "\" />\n";
}
foreach ($assetsPackage->getPackageUrls('text/css; media=print', $language) as $file) {
$ret .= "{$indent}<link rel=\"stylesheet\" type=\"text/css\" href=\"" . htmlspecialchars($file) . "\" ";
if (!Kwf_Config::getValue('debug.assets.usePrintCssForAllMedia')) {
$ret .= "media=\"print\" ";
}
$ret .= "/>\n";
}
foreach ($assetsPackage->getPackageUrls('text/javascript', $language) as $file) {
$ret .= "{$indent}<script type=\"text/javascript\" src=\"" . htmlspecialchars($file) . "\"></script>\n";
}
foreach ($assetsPackage->getPackageUrls('text/javascript; defer', $language) as $file) {
$ret .= "<script type=\"text/javascript\">\n var se=document.createElement('script');se.type='text/javascript';se.async=true;\n se.src='" . $file . "';\n var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(se,s);\n </script>";
}
return $ret;
}
示例5: setUp
public function setUp()
{
parent::setUp('Kwc_Trl_NewsCategories_Root');
$trlElements = array();
$trlElements['kwf']['de'] = array();
Kwf_Trl::getInstance()->setTrlElements($trlElements);
}
示例6: getValue
public static function getValue($key, $what = self::NAME)
{
$language = Kwf_Trl::getInstance()->getTargetLanguage();
$masterFile = KWF_PATH . '/Kwf/Form/Field/SelectCountry/countries.xml';
$cacheId = "countries_{$language}_{$what}";
$cache = Kwf_Cache::factory('File', 'File', array('master_file' => $masterFile, 'lifetime' => null, 'automatic_serialization' => true), array('cache_dir' => 'cache/config'));
$result = $cache->load($cacheId);
if (!$result) {
$xml = simplexml_load_file($masterFile);
$result = array();
$x = 0;
foreach ($xml->country as $country) {
$value = null;
foreach ($country as $k => $c) {
if ($k == $what) {
$attributes = $c->attributes();
if (isset($attributes['language']) && $attributes['language'] == $language) {
$result[(string) $country->iso2] = (string) $c;
}
}
}
}
$cache->save($result, $cacheId);
}
if (isset($result[$key])) {
return $result[$key];
}
return null;
}
示例7: assets
public function assets(Kwf_Assets_Package $assetsPackage, $language = null, $subroot = null)
{
if (!$language) {
$language = Kwf_Trl::getInstance()->getTargetLanguage();
}
$ev = new Kwf_Events_Event_CreateAssetsPackageUrls(get_class($assetsPackage), $assetsPackage, $subroot);
Kwf_Events_Dispatcher::fireEvent($ev);
$prefix = $ev->prefix;
$indent = str_repeat(' ', 8);
$ret = '';
foreach ($assetsPackage->getPackageUrls('text/css', $language) as $file) {
$ret .= "{$indent}<link rel=\"stylesheet\" type=\"text/css\" href=\"" . htmlspecialchars($prefix . $file) . "\" />\n";
}
foreach ($assetsPackage->getPackageUrls('text/css; ie8', $language) as $file) {
$ret .= "{$indent}<!--[if lte IE 8]><link rel=\"stylesheet\" type=\"text/css\" href=\"" . htmlspecialchars($prefix . $file) . "\" /><![endif]-->\n";
}
foreach ($assetsPackage->getPackageUrls('text/javascript; ie8', $language) as $file) {
$ret .= "{$indent}<!--[if lte IE 8]><script type=\"text/javascript\" src=\"" . htmlspecialchars($prefix . $file) . "\"></script><![endif]-->\n";
}
foreach ($assetsPackage->getPackageUrls('text/javascript', $language) as $file) {
$ret .= "{$indent}<script type=\"text/javascript\" src=\"" . htmlspecialchars($prefix . $file) . "\"></script>\n";
}
foreach ($assetsPackage->getPackageUrls('text/javascript; defer', $language) as $file) {
//single line to allow parsing
$ret .= "<script type=\"text/javascript\">var se=document.createElement('script');se.type='text/javascript';se.async=true;se.src='" . $prefix . $file . "';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(se,s);</script>\n";
}
return $ret;
}
示例8: trlStaticExecute
public function trlStaticExecute($language = null)
{
parent::trlStaticExecute($language);
$trl = Kwf_Trl::getInstance();
$values = $this->getValues();
if (is_array($values)) {
foreach ($values as $k => $v) {
$newKey = $k;
$newValue = $v;
if (is_string($k)) {
$newKey = $trl->trlStaticExecute($k, $language);
}
//TODO key nicht (immer) übersetzen
if (is_string($v)) {
$newValue = $trl->trlStaticExecute($v, $language);
} else {
if (is_array($v)) {
foreach ($v as $k2 => $v2) {
if (is_string($v2)) {
$newValue[$k2] = $trl->trlStaticExecute($v2, $language);
}
}
}
}
unset($values[$k]);
$values[$newKey] = $newValue;
}
$this->setProperty('values', $values);
}
}
示例9: _initColumns
protected function _initColumns()
{
$this->_model = Kwf_Model_Abstract::getInstance(Kwc_Abstract::getSetting(Kwf_Component_Data_Root::getInstance()->getComponentByDbId($this->_getParam('componentId'))->parent->componentClass, 'childModel'))->getReferencedModel('Order');
$cc = Kwc_Abstract::getChildComponentClasses($this->_getParam('class'), 'payment');
$paymentsFilterData = array();
$payments = array();
foreach ($cc as $k => $c) {
$payments[$k] = Kwf_Trl::getInstance()->trlStaticExecute(Kwc_Abstract::getSetting($c, 'componentName'));
$paymentsFilterData[] = array($k, $payments[$k]);
}
$this->_filters['text'] = true;
if (count($payments) > 1) {
$this->_filters['payment'] = array('type' => 'ComboBox', 'text' => trlKwf('Payment'), 'data' => $paymentsFilterData, 'width' => 100);
}
$this->_filters['canceled'] = array('type' => 'Button', 'skipWhere' => true, 'cls' => 'x2-btn-text-icon', 'icon' => '/assets/silkicons/stop.png', 'text' => trlKwf('canceled'), 'tooltip' => trlKwf('Show canceled orders'));
$this->_filters['shipped'] = array('type' => 'Button', 'skipWhere' => true, 'cls' => 'x2-btn-text-icon', 'icon' => '/assets/silkicons/package.png', 'text' => trlKwf('shipped'), 'tooltip' => trlKwf('Show shipped orders'));
$this->_columns->add(new Kwf_Grid_Column('order_number', trlKwf('Order Nr'), 50));
$this->_columns->add(new Kwf_Grid_Column('invoice_number', trlKwf('Invoice Nr'), 50))->setHidden(true);
$this->_columns->add(new Kwf_Grid_Column_Datetime('date', trlKwf('Date')));
$this->_columns->add(new Kwf_Grid_Column('firstname', trlKwf('Firstname'), 90));
$this->_columns->add(new Kwf_Grid_Column('lastname', trlKwf('Lastname'), 90));
$this->_columns->add(new Kwf_Grid_Column('country', trlKwf('Country'), 15));
// TODO: Pfusch
$this->_columns->add(new Kwf_Grid_Column('sum_amount', trlKwf('Amt'), 30))->setData(new Kwc_Shop_Cart_Checkout_OrdersController_SumAmount())->setSortable(false);
$this->_columns->add(new Kwf_Grid_Column('sum_price', trlKwf('Sum'), 50))->setData(new Kwc_Shop_Cart_Checkout_OrdersController_SumPrice())->setSortable(false)->setRenderer('euroMoney');
if (count($payments) > 1) {
$this->_columns->add(new Kwf_Grid_Column('payment', trlKwf('Payment'), 80))->setData(new Kwc_Shop_Cart_Checkout_OrdersController_Payment($payments))->setSortable(false);
}
$this->_columns->add(new Kwf_Grid_Column_Date('payed', trlKwf('Payed')));
if (Kwc_Abstract::getSetting($this->_getParam('class'), 'generateInvoices')) {
$this->_columns->add(new Kwf_Grid_Column_Button('invoice', trlcKwf('Invoice', 'IN')));
}
$this->_columns->add(new Kwf_Grid_Column_Button('shipped', trlcKwf('Shipped', 'SH')))->setButtonIcon('/assets/silkicons/package_go.png');
$this->_columns->add(new Kwf_Grid_Column('shipped'));
}
示例10: _initFields
protected function _initFields()
{
parent::_initFields();
$this->setCreateMissingRow(true);
if (!$this->getClass()) {
return;
}
$generators = Kwc_Abstract::getSetting($this->getClass(), 'generators');
$classes = $generators['child']['component'];
foreach ($classes as $key => $class) {
if (!$class) {
continue;
}
$form = Kwc_Abstract_Form::createChildComponentForm($this->getClass(), "-{$key}", $key);
if ($form && count($form->fields)) {
if ($this->_getIdTemplateForChild($key)) {
$form->setIdTemplate($this->_getIdTemplateForChild($key));
}
if (!$this->_createFieldsets || !Kwc_Abstract::hasSetting($class, 'componentName')) {
$this->add($form);
} else {
$name = Kwf_Trl::getInstance()->trlStaticExecute(Kwc_Abstract::getSetting($class, 'componentName'));
$name = str_replace('.', ' ', $name);
$this->add(new Kwf_Form_Container_FieldSet($name))->setName($key)->add($form);
}
}
}
}
示例11: getPlaceholders
public static function getPlaceholders(Kwc_Mail_Recipient_Interface $recipient, $language)
{
$ret = array();
$trl = Kwf_Trl::getInstance();
$ret['firstname'] = $recipient->getMailFirstname();
$ret['lastname'] = $recipient->getMailLastname();
if ($recipient instanceof Kwc_Mail_Recipient_TitleInterface) {
$replace = array($recipient->getMailTitle(), $recipient->getMailLastname());
$politeM = $trl->trlKwf('Dear Mr. {0} {1}', $replace, $language);
$politeF = $trl->trlKwf('Dear Mrs. {0} {1}', $replace, $language);
if ($recipient->getMailGender() == 'male' && $recipient->getMailLastname()) {
$t = $trl->trlKwf('Dear Mr. {0} {1}', $replace, $language);
} else {
if ($recipient->getMailGender() == 'female' && $recipient->getMailLastname()) {
$t = $trl->trlKwf('Dear Mrs. {0} {1}', $replace, $language);
} else {
$t = $trl->trlKwf('Dear Mrs./Mr. {0} {1}', $replace, $language);
}
}
$ret['salutation_polite'] = trim(str_replace(' ', ' ', $t));
if ($recipient->getMailGender() == 'male') {
$t = $trl->trlKwf('Mr. {0}', $recipient->getMailTitle(), $language);
} else {
if ($recipient->getMailGender() == 'female') {
$t = $trl->trlKwf('Mrs. {0}', $recipient->getMailTitle(), $language);
} else {
$t = $recipient->getMailTitle();
}
}
$ret['salutation_title'] = trim(str_replace(' ', ' ', $t));
$ret['title'] = $recipient->getMailTitle();
}
if ($recipient instanceof Kwc_Mail_Recipient_GenderInterface) {
$replace = array($recipient->getMailLastname());
if ($recipient->getMailGender() == 'male') {
$ret['salutation_polite_notitle'] = $trl->trlKwf('Dear Mr. {0}', $replace, $language);
$ret['salutation_hello'] = $trl->trlKwf('Hello Mr. {0}', $replace, $language);
$ret['salutation'] = $trl->trlKwf('Mr.', array(), $language);
$ret['salutation_firstname'] = $trl->trlcKwf('salutation firstname male', 'Dear {0}', array($recipient->getMailFirstname()), $language);
} else {
if ($recipient->getMailGender() == 'female') {
$ret['salutation_polite_notitle'] = $trl->trlKwf('Dear Mrs. {0}', $replace, $language);
$ret['salutation_hello'] = $trl->trlKwf('Hello Mrs. {0}', $replace, $language);
$ret['salutation'] = $trl->trlKwf('Mrs.', array(), $language);
$ret['salutation_firstname'] = $trl->trlcKwf('salutation firstname female', 'Dear {0}', array($recipient->getMailFirstname()), $language);
} else {
$replace = array($recipient->getMailFirstname(), $recipient->getMailLastname());
if ($recipient->getMailFirstname() && $recipient->getMailLastname()) {
$ret['salutation_polite_notitle'] = trim($trl->trlKwf('Dear {0} {1}', $replace, $language));
} else {
$ret['salutation_polite_notitle'] = $trl->trlKwf('Dear Sir or Madam', array(), $language);
}
$ret['salutation_hello'] = trim($trl->trlKwf('Hello {0} {1}', $replace, $language));
$ret['salutation_firstname'] = $trl->trlcKwf('salutation firstname unknown gender', 'Dear {0}', array($recipient->getMailFirstname()), $language);
}
}
}
return $ret;
}
示例12: getCardForms
public function getCardForms()
{
$ret = array();
$title = Kwf_Trl::getInstance()->trlStaticExecute(Kwc_Abstract::getSetting($this->_class, 'componentName'));
$title = str_replace('.', ' ', $title);
$ret['form'] = array('form' => Kwc_Abstract_Form::createComponentForm($this->_class, 'child'), 'title' => $title);
return $ret;
}
示例13: tearDown
public function tearDown()
{
Kwf_Trl::getInstance()->setWebCodeLanguage(null);
Kwf_Trl::getInstance()->unsetTrlElements();
Kwf_Cache_SimpleStatic::clear('trl-');
Kwf_Cache_SimpleStatic::clear('trlp-');
parent::tearDown();
}
示例14: setUp
public function setUp()
{
$trlElements = array();
$trlElements['kwf']['de']['Yes-'] = 'Ja';
$trlElements['kwf']['de']['.-decimal separator'] = ',';
$trlElements['kwf']['de'][',-thousands separator'] = '.';
Kwf_Trl::getInstance()->setTrlElements($trlElements);
}
示例15: trlStaticExecute
public function trlStaticExecute($language = null)
{
parent::trlStaticExecute($language);
if (!$language) {
$language = Kwf_Trl::getInstance()->getTargetLanguage();
}
$this->_floatValidator->setLocale($language);
}