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


PHP TAdiantiCoreTranslator类代码示例

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


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

示例1: __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

示例2: 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

示例3: __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

示例4: 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

示例5: 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

示例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 (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

示例7: onLogin

 /**
  * Validate the login
  */
 function onLogin()
 {
     try {
         TTransaction::open('library');
         $data = $this->form->getData('StdClass');
         // validate form data
         $this->form->validate();
         $language = $data->language ? $data->language : 'en';
         TAdiantiCoreTranslator::setLanguage($language);
         TApplicationTranslator::setLanguage($language);
         $auth = User::autenticate($data->{'user'}, $data->{'password'});
         if ($auth) {
             TSession::setValue('logged', TRUE);
             TSession::setValue('login', $data->{'user'});
             TSession::setValue('language', $data->language);
             // reload page
             TApplication::executeMethod('SetupPage', 'onSetup');
         }
         TTransaction::close();
         // finaliza a transação
     } catch (Exception $e) {
         TSession::setValue('logged', FALSE);
         // exibe a mensagem gerada pela exceção
         new TMessage('error', '<b>Erro</b> ' . $e->getMessage());
         // desfaz todas alterações no banco de dados
         TTransaction::rollback();
     }
 }
开发者ID:jhonleandres,项目名称:crmbf,代码行数:31,代码来源:LoginForm.class.php

示例8: __construct

 /**
  * Constructor Method
  */
 function __construct()
 {
     parent::__construct();
     parent::set_size_request(840, 640);
     parent::set_position(GTK::WIN_POS_CENTER);
     parent::connect_simple('delete-event', array($this, 'onClose'));
     parent::connect_simple('destroy', array('Gtk', 'main_quit'));
     parent::set_title(self::APP_TITLE);
     parent::set_icon(GdkPixbuf::new_from_file('favicon.png'));
     $gtk = GtkSettings::get_default();
     $gtk->set_long_property("gtk-button-images", TRUE, 0);
     $gtk->set_long_property("gtk-menu-images", TRUE, 0);
     self::$inst = $this;
     $ini = parse_ini_file('application.ini');
     $lang = $ini['language'];
     TAdiantiCoreTranslator::setLanguage($lang);
     TApplicationTranslator::setLanguage($lang);
     date_default_timezone_set($ini['timezone']);
     $this->content = new GtkFixed();
     $vbox = new GtkVBox();
     parent::add($vbox);
     $vbox->pack_start(GtkImage::new_from_file('app/images/pageheader-gtk.png'), false, false);
     $MenuBar = TMenuBar::newFromXML('menu.xml');
     $vbox->pack_start($MenuBar, false, false);
     $vbox->pack_start($this->content, true, true);
     parent::show_all();
 }
开发者ID:enieber,项目名称:adianti,代码行数:30,代码来源:index.gtk.php

示例9: 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

示例10: __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

示例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: 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

示例13: 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

示例14: 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

示例15: __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


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