本文整理汇总了PHP中TAdiantiCoreTranslator类的典型用法代码示例。如果您正苦于以下问题:PHP TAdiantiCoreTranslator类的具体用法?PHP TAdiantiCoreTranslator怎么用?PHP TAdiantiCoreTranslator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TAdiantiCoreTranslator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: __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
示例17: open
/**
* Opens a database connection
*
* @param $database Name of the database (an INI file).
* @return A PDO object if the $database exist,
* otherwise, throws an exception
* @exception Exception
* if the $database is not found
* @author Pablo Dall'Oglio
*/
public static function open($database)
{
// check if the database configuration file exists
if (file_exists("app/config/{$database}.ini")) {
// read the INI and retuns an array
$db = parse_ini_file("app/config/{$database}.ini");
} else {
// if the database doesn't exists, throws an exception
throw new Exception(TAdiantiCoreTranslator::translate('File not found') . ': ' . "'{$database}.ini'");
}
// read the database properties
$user = isset($db['user']) ? $db['user'] : NULL;
$pass = isset($db['pass']) ? $db['pass'] : NULL;
$name = isset($db['name']) ? $db['name'] : NULL;
$host = isset($db['host']) ? $db['host'] : NULL;
$type = isset($db['type']) ? $db['type'] : NULL;
$port = isset($db['port']) ? $db['port'] : NULL;
// each database driver has a different instantiation process
switch ($type) {
case 'pgsql':
$port = $port ? $port : '5432';
$conn = new PDO("pgsql:dbname={$name};user={$user}; password={$pass};host={$host};port={$port}");
break;
case 'mysql':
$port = $port ? $port : '3306';
$conn = new PDO("mysql:host={$host};port={$port};dbname={$name}", $user, $pass);
break;
case 'sqlite':
$conn = new PDO("sqlite:{$name}");
$conn->query('PRAGMA foreign_keys = ON');
// referential integrity must be enabled
break;
case 'ibase':
$name = isset($host) ? "{$host}:{$name}" : $name;
$conn = new PDO("firebird:dbname={$name}", $user, $pass);
break;
case 'oracle':
$port = $port ? $port : '1521';
$conn = new PDO("oci:dbname={$host}:{$port}/{$name}", $user, $pass);
break;
case 'mssql':
if (OS == 'WIN') {
$conn = new PDO("sqlsrv:Server={$host};Database={$name}", $user, $pass);
} else {
$conn = new PDO("dblib:host={$host};dbname={$name}", $user, $pass);
}
break;
case 'dblib':
$conn = new PDO("dblib:host={$host},1433;dbname={$name}", $user, $pass);
break;
}
// define wich way will be used to report errors (EXCEPTION)
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// return the PDO object
return $conn;
}
开发者ID:enieber,项目名称:adianti,代码行数:66,代码来源:TConnection.class.php
示例18: show
public function show()
{
if ($this->changeaction) {
if (empty($this->formName)) {
throw new Exception(TAdiantiCoreTranslator::translate('You must pass the ^1 (^2) as a parameter to ^3', __CLASS__, $this->label, 'TForm::setFields()'));
}
// get the action as URL
$url = $this->changeaction->serialize(FALSE);
$wait_message = TAdiantiCoreTranslator::translate('Loading');
// define the button's action (ajax post)
$action = "\n \$.blockUI({ \n message: '<h1>{$wait_message}</h1>',\n css: { \n border: 'none', \n padding: '15px', \n backgroundColor: '#000', \n 'border-radius': '5px 5px 5px 5px',\n opacity: .5, \n color: '#fff' \n }\n });\n {$this->function};\n \$.post('engine.php?{$url}',\n \$('#{$this->formName}').serialize(),\n function(result)\n {\n __adianti_load_html(result);\n \$.unblockUI();\n });\n return false;";
}
// define the tag properties
$this->tag->name = $this->name;
// tag name
$this->tag->style = "width:{$this->size}px";
// size in pixels
$this->tag->onChange = $action;
// creates an empty <option> tag
$option = new TElement('option');
$option->add('');
$option->value = '';
// tag value
// add the option tag to the combo
$this->tag->add($option);
if ($this->items) {
// iterate the combobox items
foreach ($this->items as $chave => $item) {
if (substr($chave, 0, 3) == '>>>') {
$optgroup = new TElement('optgroup');
$optgroup->label = $item;
// add the option to the combo
$this->tag->add($optgroup);
} else {
// creates an <option> tag
$option = new TElement('option');
$option->value = $chave;
// define the index
$option->add($item);
// add the item label
// verify if this option is selected
if ($chave == $this->value and $this->value !== NULL) {
// mark as selected
$option->selected = 1;
}
if (isset($optgroup)) {
$optgroup->add($option);
} else {
$this->tag->add($option);
}
}
}
}
// shows the combobox
$this->tag->show();
}
开发者ID:jhonleandres,项目名称:pecommerce,代码行数:56,代码来源:PDBComboLook.class.php
示例19: __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
示例20: __construct
/**
* Class Constructor
* @param $name Name of the widget
*/
public function __construct($name)
{
parent::__construct();
$this->wname = $name;
$this->mask = 'yyyy-mm-dd';
$this->validations = array();
// creates the entry field
$this->entry = new TEntry($name);
$this->entry->setSize(200);
//set_size_request(200, 24);
$this->setMask($this->mask);
parent::add($this->entry);
// creates a button with a calendar image
$button = new GtkButton();
$button->set_relief(GTK::RELIEF_NONE);
$imagem = GtkImage::new_from_file('lib/adianti/images/tdate-gtk.png');
$button->set_image($imagem);
// define the button's callback
$button->connect_simple('clicked', array($this, 'onCalendar'));
parent::add($button);
// creates the calendar window
$this->popWindow = new GtkWindow(Gtk::WINDOW_POPUP);
// creates the calendar
$this->calendar = new GtkCalendar();
// define the action when the user selects a date
$this->calendar->connect_simple('day-selected-double-click', array($this, 'onSelectDate'));
$this->month = new TCombo('tdate-month');
$this->month->addItems(array(TAdiantiCoreTranslator::translate('January'), TAdiantiCoreTranslator::translate('February'), TAdiantiCoreTranslator::translate('March'), TAdiantiCoreTranslator::translate('April'), TAdiantiCoreTranslator::translate('May'), TAdiantiCoreTranslator::translate('June'), TAdiantiCoreTranslator::translate('July'), TAdiantiCoreTranslator::translate('August'), TAdiantiCoreTranslator::translate('September'), TAdiantiCoreTranslator::translate('October'), TAdiantiCoreTranslator::translate('November'), TAdiantiCoreTranslator::translate('December')));
$this->month->setCallback(array($this, 'onChangeMonth'));
$this->month->setSize(70);
for ($n = date('Y') - 10; $n <= date('Y') + 10; $n++) {
$years[$n] = $n;
}
$this->year = new TCombo('tdate-year');
$this->year->addItems($years);
$this->year->setCallback(array($this, 'onChangeMonth'));
$this->year->setSize(70);
$hbox = new GtkHBox();
$hbox->pack_start($this->month);
$hbox->pack_start($this->year);
$bt_today = new GtkButton(TAdiantiCoreTranslator::translate('Today'));
$bt_close = new GtkButton(TAdiantiCoreTranslator::translate('Close'));
$bt_today->connect_simple('clicked', array($this, 'selectToday'));
$inst = $this->popWindow;
$bt_close->connect_simple('clicked', array($inst, 'hide'));
$hbox2 = new GtkHBox();
$hbox2->pack_start($bt_today);
$hbox2->pack_start($bt_close);
$vbox = new GtkVBox();
$vbox->pack_start($hbox, FALSE, FALSE);
$vbox->pack_start($this->calendar);
$vbox->pack_start($hbox2, FALSE, FALSE);
// shows the window
$this->popWindow->add($vbox);
}
开发者ID:jhonleandres,项目名称:crmbf,代码行数:59,代码来源:TDate.class.php
注:本文中的TAdiantiCoreTranslator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论