当前位置: 首页>>代码示例>>PHP>>正文


PHP TAdiantiCoreTranslator::translate方法代码示例

本文整理汇总了PHP中TAdiantiCoreTranslator::translate方法的典型用法代码示例。如果您正苦于以下问题:PHP TAdiantiCoreTranslator::translate方法的具体用法?PHP TAdiantiCoreTranslator::translate怎么用?PHP TAdiantiCoreTranslator::translate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TAdiantiCoreTranslator的用法示例。


在下文中一共展示了TAdiantiCoreTranslator::translate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: show

 /**
  * Show the widget at the screen
  */
 public function show()
 {
     // define the tag properties
     $this->tag->name = $this->name;
     // tag name
     $this->tag->value = $this->value;
     // tag value
     $this->tag->type = 'password';
     // input type
     $this->setProperty('style', "width:{$this->size}px", FALSE);
     //aggregate style info
     // verify if the field is not editable
     if (parent::getEditable()) {
         if (isset($this->exitAction)) {
             if (!TForm::getFormByName($this->formName) instanceof TForm) {
                 throw new Exception(TAdiantiCoreTranslator::translate('You must pass the ^1 (^2) as a parameter to ^3', __CLASS__, $this->name, 'TForm::setFields()'));
             }
             $string_action = $this->exitAction->serialize(FALSE);
             $this->setProperty('onBlur', "serialform=(\$('#{$this->formName}').serialize());\n                                              ajaxLookup('{$string_action}&'+serialform, this)");
         }
     } else {
         // make the field read-only
         $this->tag->readonly = "1";
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
     }
     // show the tag
     $this->tag->show();
 }
开发者ID:jhonleandres,项目名称:pecommerce,代码行数:32,代码来源:TPassword.class.php

示例2: __construct

 /**
  * Handle paths from a XML file
  * @param $xml_file path for the file
  */
 public function __construct($xml_file, $controller)
 {
     parent::__construct();
     $path = array();
     if (file_exists($xml_file)) {
         $menu_string = file_get_contents($xml_file);
         if (utf8_encode(utf8_decode($menu_string)) == $menu_string) {
             $xml = new SimpleXMLElement($menu_string);
         } else {
             $xml = new SimpleXMLElement(utf8_encode($menu_string));
         }
         foreach ($xml as $xmlElement) {
             $atts = $xmlElement->attributes();
             $label = (string) $atts['label'];
             $action = (string) $xmlElement->action;
             $icon = (string) $xmlElement->icon;
             $this->parse($xmlElement->menu->menuitem, array($label));
         }
         if (isset($this->paths[$controller]) and $this->paths[$controller]) {
             $total = count($this->paths[$controller]);
             parent::addHome($path);
             $count = 1;
             foreach ($this->paths[$controller] as $path) {
                 parent::addItem($path, $count == $total);
                 $count++;
             }
         } else {
             throw new Exception(TAdiantiCoreTranslator::translate('Class ^1 not found in ^2', $controller, $xml_file));
         }
     } else {
         throw new Exception(TAdiantiCoreTranslator::translate('File not found') . ': ' . $xml_file);
     }
 }
开发者ID:jhonleandres,项目名称:pecommerce,代码行数:37,代码来源:TXMLBreadCrumb.class.php

示例3: onSave

 public function onSave($param)
 {
     try {
         $this->form->validate();
         $object = $this->form->getData();
         TTransaction::open('permission');
         $user = SystemUser::newFromLogin(TSession::getValue('login'));
         $user->name = $object->name;
         $user->email = $object->email;
         if ($object->password1) {
             if ($object->password1 != $object->password2) {
                 throw new Exception(_t('The passwords do not match'));
             }
             $user->password = md5($object->password1);
         } else {
             unset($user->password);
         }
         $user->store();
         $this->form->setData($object);
         new TMessage('info', TAdiantiCoreTranslator::translate('Record saved'));
         TTransaction::close();
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
 }
开发者ID:edurbs,项目名称:sobcontrole,代码行数:25,代码来源:SystemProfileForm.class.php

示例4: __construct

 /**
  * Class Constructor
  * @param $name Name of the widget
  */
 public function __construct($name)
 {
     $this->wname = $name;
     $this->validations = array();
     parent::__construct(TAdiantiCoreTranslator::translate('Open'), GTK::FILE_CHOOSER_ACTION_OPEN);
     parent::set_size_request(200, -1);
 }
开发者ID:jhonleandres,项目名称:crmbf,代码行数:11,代码来源:TFile.class.php

示例5: onSave

 /**
  * method onSave()
  * Executed whenever the user clicks at the save button
  */
 public function onSave()
 {
     try {
         // open a transaction with database
         TTransaction::open($this->database);
         // get the form data
         $object = $this->form->getData($this->activeRecord);
         // validate data
         $this->form->validate();
         // stores the object
         $object->store();
         // fill the form with the active record data
         $this->form->setData($object);
         // close the transaction
         TTransaction::close();
         // shows the success message
         new TMessage('info', TAdiantiCoreTranslator::translate('Record saved'));
         return $object;
     } catch (Exception $e) {
         // get the form data
         $object = $this->form->getData($this->activeRecord);
         // fill the form with the active record data
         $this->form->setData($object);
         // shows the exception error message
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
         // undo all pending operations
         TTransaction::rollback();
     }
 }
开发者ID:jhonleandres,项目名称:crmbf,代码行数:33,代码来源:TStandardForm.class.php

示例6: validate

 /**
  * Validate a given value
  * @param $label Identifies the value to be validated in case of exception
  * @param $value Value to be validated
  * @param $parameters aditional parameters for validation
  */
 public function validate($label, $value, $parameters = NULL)
 {
     $cnpj = preg_replace("@[./-]@", "", $value);
     if (strlen($cnpj) != 14 or !is_numeric($cnpj)) {
         throw new Exception(TAdiantiCoreTranslator::translate('The field ^1 has not a valid CNPJ', $label));
     }
     $k = 6;
     $soma1 = "";
     $soma2 = "";
     for ($i = 0; $i < 13; $i++) {
         $k = $k == 1 ? 9 : $k;
         $soma2 += $cnpj[$i] * $k;
         $k--;
         if ($i < 12) {
             if ($k == 1) {
                 $k = 9;
                 $soma1 += $cnpj[$i] * $k;
                 $k = 1;
             } else {
                 $soma1 += $cnpj[$i] * $k;
             }
         }
     }
     $digito1 = $soma1 % 11 < 2 ? 0 : 11 - $soma1 % 11;
     $digito2 = $soma2 % 11 < 2 ? 0 : 11 - $soma2 % 11;
     $valid = ($cnpj[12] == $digito1 and $cnpj[13] == $digito2);
     if (!$valid) {
         throw new Exception(TAdiantiCoreTranslator::translate('The field ^1 has not a valid CNPJ', $label));
     }
 }
开发者ID:jhonleandres,项目名称:pecommerce,代码行数:36,代码来源:TCNPJValidator.class.php

示例7: show

 /**
  * Show the widget
  */
 public function show()
 {
     $this->tag->name = $this->name;
     // tag name
     $this->setProperty('style', "width:{$this->size}px", FALSE);
     //aggregate style info
     if ($this->height) {
         $this->setProperty('style', "height:{$this->height}px", FALSE);
         //aggregate style info
     }
     // check if the field is not editable
     if (!parent::getEditable()) {
         // make the widget read-only
         $this->tag->readonly = "1";
         $this->tag->{'class'} = 'tfield_disabled';
         // CSS
     }
     if (isset($this->exitAction)) {
         if (!TForm::getFormByName($this->formName) instanceof TForm) {
             throw new Exception(TAdiantiCoreTranslator::translate('You must pass the ^1 (^2) as a parameter to ^3', __CLASS__, $this->name, 'TForm::setFields()'));
         }
         $string_action = $this->exitAction->serialize(FALSE);
         $this->setProperty('onBlur', "serialform=(\$('#{$this->formName}').serialize());\n                                          ajaxLookup('{$string_action}&'+serialform, this)");
     }
     // add the content to the textarea
     $this->tag->add(htmlspecialchars($this->value));
     // show the tag
     $this->tag->show();
 }
开发者ID:jhonleandres,项目名称:pecommerce,代码行数:32,代码来源:TText.class.php

示例8: onSave

 /**
  * method onSave()
  * Executed whenever the user clicks at the save button
  */
 function onSave()
 {
     try {
         TTransaction::open('app');
         // open a transaction
         // get the form data into an active record SystemUser
         $object = $this->form->getData('StdClass');
         $this->form->validate();
         // form validation
         $senhaatual = $object->current;
         $senhanova = $object->password;
         $confirmacao = $object->confirmation;
         $usuario = new SystemUser(TSession::getValue("userid"));
         if ($usuario->password == md5($senhaatual)) {
             if ($senhanova == $confirmacao) {
                 $usuario->password = md5($senhanova);
                 $usuario->store();
                 new TMessage('info', TAdiantiCoreTranslator::translate('Record saved'));
             } else {
                 new TMessage('error', "A nova senha deve ser igual a sua confirmação.");
             }
         } else {
             new TMessage('error', "A senha atual não confere.");
         }
         TTransaction::close();
         // close the transaction
         // shows the success message
     } catch (Exception $e) {
         // in case of exception
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
         // shows the exception error message
         TTransaction::rollback();
         // undo all pending operations
     }
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:39,代码来源:TrocarSenhaForm.class.php

示例9: validate

 /**
  * Validate a given value
  * @param $label Identifies the value to be validated in case of exception
  * @param $value Value to be validated
  * @param $parameters aditional parameters for validation (length)
  */
 public function validate($label, $value, $parameters = NULL)
 {
     $length = $parameters[0];
     if (strlen($value) > $length) {
         throw new Exception(TAdiantiCoreTranslator::translate('The field ^1 can not be greater than ^2 characters', $label, $length));
     }
 }
开发者ID:jhonleandres,项目名称:pecommerce,代码行数:13,代码来源:TMaxLengthValidator.class.php

示例10: __construct

 /**
  * Class Constructor
  * @param $name Name of the widget
  */
 public function __construct($name)
 {
     parent::__construct($name);
     $this->widget = new GtkFileChooserButton(TAdiantiCoreTranslator::translate('Open'), GTK::FILE_CHOOSER_ACTION_OPEN);
     parent::add($this->widget);
     $this->setSize(200);
 }
开发者ID:jhonleandres,项目名称:pecommerce,代码行数:11,代码来源:TFile.class.php

示例11: validate

 /**
  * Validate a given value
  * @param $label Identifies the value to be validated in case of exception
  * @param $value Value to be validated
  * @param $parameters aditional parameters for validation (max value)
  */
 public function validate($label, $value, $parameters = NULL)
 {
     $maxvalue = $parameters[0];
     if ($value > $maxvalue) {
         throw new Exception(TAdiantiCoreTranslator::translate('The field ^1 can not be greater than ^2', $label, $maxvalue));
     }
 }
开发者ID:jhonleandres,项目名称:pecommerce,代码行数:13,代码来源:TMaxValueValidator.class.php

示例12: onSave

 /**
  * method onSave()
  * Executed whenever the user clicks at the save button
  */
 function onSave()
 {
     try {
         // open a transaction with database 'sample'
         TTransaction::open('sample');
         // get the form data into an active record Usuario
         $object = $this->form->getData('Usuario');
         $this->form->validate();
         // form validation
         $object->senha = md5($object->senha);
         $object->store();
         // stores the object
         $this->form->setData($object);
         // keep form data
         TTransaction::close();
         // close the transaction
         // shows the success message
         new TMessage('info', TAdiantiCoreTranslator::translate('Record saved'));
     } catch (Exception $e) {
         // shows the exception error message
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
         $this->form->setData($this->form->getData());
         // keep form data
         // undo all pending operations
         TTransaction::rollback();
     }
 }
开发者ID:jhonleandres,项目名称:pecommerce,代码行数:31,代码来源:UsuarioForm.class.php

示例13: __construct

 /**
  * Constructor method
  * 
  * @param $path  HTML resource path
  */
 public function __construct($path)
 {
     if (!file_exists($path)) {
         throw new Exception(TAdiantiCoreTranslator::translate('File not found') . ': ' . $path);
     }
     $this->path = $path;
     $this->enabledSections = array();
 }
开发者ID:jhonleandres,项目名称:crmbf,代码行数:13,代码来源:THtmlRenderer.class.php

示例14: __construct

 /**
  * Class Constructor
  * @param $action Callback to be executed
  */
 public function __construct($action)
 {
     $this->action = $action;
     if (!is_callable($this->action)) {
         $action_string = $this->toString();
         throw new Exception(TAdiantiCoreTranslator::translate('Method ^1 must receive a paremeter of type ^2', __METHOD__, 'Callback') . ' <br> ' . TAdiantiCoreTranslator::translate('Check if the action (^1) exists', $action_string));
     }
 }
开发者ID:jhonleandres,项目名称:pecommerce,代码行数:12,代码来源:TAction.class.php

示例15: __construct

 /**
  * Constructor Method
  * Creates the page, the search form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     // creates a new form
     $this->form = new TForm('form_standard_seek');
     // creates a new table
     $table = new TTable();
     // adds the table into the form
     $this->form->add($table);
     // create the form fields
     $display_field = new TEntry('display_field');
     // keeps the field's value
     $display_field->setValue(TSession::getValue('tstandardseek_display_value'));
     // add a row for the filter field
     $row = $table->addRow();
     $row->addCell(new TLabel('Field:'));
     $row->addCell($display_field);
     // create the action button
     $find_button = new TButton('busca');
     // define the button action
     $find_button->setAction(new TAction(array($this, 'onSearch')), TAdiantiCoreTranslator::translate('Search'));
     $find_button->setImage('ico_find.png');
     // add a row for the button in the table
     $row = $table->addRow();
     $row->addCell($find_button);
     // define wich are the form fields
     $this->form->setFields(array($display_field, $find_button));
     // creates a new datagrid
     $this->datagrid = new TDataGrid();
     // create two datagrid columns
     $id = new TDataGridColumn('id', 'ID', 'right', 70);
     $display = new TDataGridColumn('display_field', 'Field', 'left', 220);
     // add the columns to the datagrid
     $this->datagrid->addColumn($id);
     $this->datagrid->addColumn($display);
     // create a datagrid action
     $action1 = new TDataGridAction(array($this, 'onSelect'));
     $action1->setLabel('Selecionar');
     $action1->setImage('ico_apply.png');
     $action1->setField('id');
     // add the actions to the datagrid
     $this->datagrid->addAction($action1);
     // create the datagrid model
     $this->datagrid->createModel();
     // creates the paginator
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // creates the container
     $vbox = new TVBox();
     $vbox->add($this->form);
     $vbox->add($this->datagrid);
     $vbox->add($this->pageNavigation);
     // add the container to the page
     parent::add($vbox);
 }
开发者ID:jhonleandres,项目名称:pecommerce,代码行数:60,代码来源:TStandardSeek.class.php


注:本文中的TAdiantiCoreTranslator::translate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。