本文整理汇总了PHP中Adianti\Core\AdiantiCoreTranslator类的典型用法代码示例。如果您正苦于以下问题:PHP AdiantiCoreTranslator类的具体用法?PHP AdiantiCoreTranslator怎么用?PHP AdiantiCoreTranslator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AdiantiCoreTranslator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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 (min value)
*/
public function validate($label, $value, $parameters = NULL)
{
$minvalue = $parameters[0];
if ($value < $minvalue) {
throw new Exception(AdiantiCoreTranslator::translate('The field ^1 can not be less than ^2', $label, $minvalue));
}
}
开发者ID:kiibe,项目名称:linkERP,代码行数:13,代码来源:TMinValueValidator.php
示例2: __construct
/**
* Class Constructor
* @param $type Type of the message (info, error)
* @param $message Message to be shown
* @param $action Action to be processed when closing the dialog
* @param $title_msg Dialog Title
*/
public function __construct($type, $message, TAction $action = NULL, $title_msg = '')
{
$this->id = 'tmessage_' . mt_rand(1000000000, 1999999999);
$modal_wrapper = new TElement('div');
$modal_wrapper->{'class'} = 'modal';
$modal_wrapper->{'id'} = $this->id;
$modal_wrapper->{'style'} = 'padding-top: 10%; z-index:4000';
$modal_wrapper->{'tabindex'} = '-1';
$modal_dialog = new TElement('div');
$modal_dialog->{'class'} = 'modal-dialog';
$modal_content = new TElement('div');
$modal_content->{'class'} = 'modal-content';
$modal_header = new TElement('div');
$modal_header->{'class'} = 'modal-header';
if ($type == 'info') {
$image = new TImage("fa:fa fa-info-circle fa-5x blue");
} else {
$image = new TImage("fa:fa fa-exclamation-circle fa-5x red");
}
$image->{'style'} = 'float:left; margin-right: 10px;';
$close = new TElement('button');
$close->{'type'} = 'button';
$close->{'class'} = 'close';
$close->{'data-dismiss'} = 'modal';
$close->{'aria-hidden'} = 'true';
$close->add('×');
$title = new TElement('h4');
$title->{'class'} = 'modal-title';
$title->{'style'} = 'display:inline';
$title->add($title_msg ? $title_msg : ($type == 'info' ? AdiantiCoreTranslator::translate('Information') : AdiantiCoreTranslator::translate('Error')));
$body = new TElement('div');
$body->{'style'} = 'text-align:left';
$body->{'class'} = 'modal-body';
$body->add($image);
$span = new TElement('span');
$span->add($message);
$body->add($span);
$button = new TElement('button');
$button->{'class'} = 'btn btn-default';
$button->{'data-dismiss'} = 'modal';
$button->{'onclick'} = "\$( '.modal-backdrop' ).last().remove(); \$('#{$this->id}').modal('hide'); \$('body').removeClass('modal-open');";
$button->add('OK');
if ($action) {
$button->{'onclick'} .= "__adianti_load_page('{$action->serialize()}');";
$button->{'data-toggle'} = "modal";
}
$footer = new TElement('div');
$footer->{'class'} = 'modal-footer';
$modal_wrapper->add($modal_dialog);
$modal_dialog->add($modal_content);
$modal_content->add($modal_header);
$modal_header->add($close);
$modal_header->add($title);
$modal_content->add($body);
$modal_content->add($footer);
$footer->add($button);
$modal_wrapper->show();
$callback = 'function () {' . $button->{'onclick'} . '}';
TScript::create("tdialog_start( '#{$this->id}', {$callback} );");
}
开发者ID:kiibe,项目名称:linkERP,代码行数:67,代码来源:TMessage.php
示例3: __construct
/**
* Class Constructor
* @param $name name of the form field
* @param $database name of the database connection
* @param $form name of the parent form
* @param $model name of the Active Record to be searched
* @param $display_field name of the field to be searched and shown
* @param $receive_key name of the form field to receive the primary key
* @param $receive_display_field name of the form field to receive the "display field"
* @param $display_field2 name of the #2 field to be searched and shown
*/
public function __construct($name, $database, $form, $model, $display_field, $receive_key, $receive_display_field, TCriteria $criteria = NULL, $display_field2 = NULL)
{
parent::__construct($name);
if (empty($database)) {
throw new Exception(AdiantiCoreTranslator::translate('The parameter (^1) of ^2 is required', 'database', __CLASS__));
}
if (empty($model)) {
throw new Exception(AdiantiCoreTranslator::translate('The parameter (^1) of ^2 is required', 'model', __CLASS__));
}
if (empty($display_field)) {
throw new Exception(AdiantiCoreTranslator::translate('The parameter (^1) of ^2 is required', 'display_field', __CLASS__));
}
$obj = new TStandardSeek2();
// define the action parameters
$action = new TAction(array($obj, 'onSetup'));
$action->setParameter('database', $database);
$action->setParameter('parent', $form);
$action->setParameter('model', $model);
$action->setParameter('display_field', $display_field);
$action->setParameter('receive_key', $receive_key);
$action->setParameter('receive_field', $receive_display_field);
$action->setParameter('criteria', base64_encode(serialize($criteria)));
$action->setParameter('display_field2', $display_field2);
parent::setAction($action);
}
开发者ID:edurbs,项目名称:sobcontrole,代码行数:36,代码来源:TDBSeekButton2.php
示例4: 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
if (strstr($this->size, '%') !== FALSE) {
$this->setProperty('style', "width:{$this->size};", FALSE);
//aggregate style info
} else {
$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(AdiantiCoreTranslator::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', "__adianti_post_lookup('{$this->formName}', '{$string_action}', this)");
}
} else {
// make the field read-only
$this->tag->readonly = "1";
$this->tag->{'class'} = 'tfield_disabled';
// CSS
}
// show the tag
$this->tag->show();
}
开发者ID:kiibe,项目名称:linkERP,代码行数:37,代码来源:TPassword.php
示例5: onSave
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', AdiantiCoreTranslator::translate('Record saved'));
parent::add(new TAlert('info', AdiantiCoreTranslator::translate('Record saved')));
$this->form->clear();
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', $e->getMessage());
// undo all pending operations
TTransaction::rollback();
}
}
开发者ID:edurbs,项目名称:sobcontrole,代码行数:31,代码来源:TStandardFormWAM.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(AdiantiCoreTranslator::translate('The field ^1 can not be greater than ^2 characters', $label, $length));
}
}
开发者ID:cbsistem,项目名称:adiantiframework,代码行数:13,代码来源:TMaxLengthValidator.php
示例7: __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(AdiantiCoreTranslator::translate('Class ^1 not found in ^2', $controller, $xml_file));
}
} else {
throw new Exception(AdiantiCoreTranslator::translate('File not found') . ': ' . $xml_file);
}
}
开发者ID:cbsistem,项目名称:adiantiframework,代码行数:37,代码来源:TXMLBreadCrumb.php
示例8: 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(AdiantiCoreTranslator::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(AdiantiCoreTranslator::translate('The field ^1 has not a valid CNPJ', $label));
}
}
开发者ID:kiibe,项目名称:linkERP,代码行数:36,代码来源:TCNPJValidator.php
示例9: __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(AdiantiCoreTranslator::translate('Method ^1 must receive a paremeter of type ^2', __METHOD__, 'Callback') . ' <br> ' . AdiantiCoreTranslator::translate('Check if the action (^1) exists', $action_string));
}
}
开发者ID:kiibe,项目名称:linkERP,代码行数:12,代码来源:TAction.php
示例10: setActiveRecord
/**
* method setActiveRecord()
* Define wich Active Record class will be used
*/
public function setActiveRecord($activeRecord)
{
if (is_subclass_of($activeRecord, 'TRecord')) {
$this->activeRecord = $activeRecord;
} else {
throw new Exception(AdiantiCoreTranslator::translate('The class ^1 must be subclass of ^2', $activeRecord, 'TRecord'));
}
}
开发者ID:kiibe,项目名称:linkERP,代码行数:12,代码来源:AdiantiStandardControlTrait.php
示例11: __construct
/**
* Constructor Method
* Creates the page, the search form and the listing
*/
public function __construct()
{
parent::__construct();
parent::setTitle(AdiantiCoreTranslator::translate('Search record'));
parent::setSize(800, 500);
// 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');
$display_field->setSize(370);
// keeps the field's value
$display_field->setValue(TSession::getValue('tstandardseek_display_value'));
// create the action button
$find_button = new TButton('busca');
// define the button action
$find_button->setAction(new TAction(array($this, 'onSearch')), AdiantiCoreTranslator::translate('Search'));
$find_button->setImage('ico_find.png');
// add a row for the filter field
$table->addRowSet(new TLabel(_t('Search') . ': '), $display_field, $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', AdiantiCoreTranslator::translate('Field'), 'left', 570);
// 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:cbsistem,项目名称:adiantiframework,代码行数:58,代码来源:TStandardSeek.php
示例12: addCell
/**
* Add a new cell (TTableCell) to the Table Row
* @param $value Cell Content
* @return TTableCell
*/
public function addCell($value)
{
if (is_null($value)) {
throw new Exception(AdiantiCoreTranslator::translate('Method ^1 does not accept null values', __METHOD__));
} else {
// creates a new Table Cell
$cell = new TTableCell($value);
parent::add($cell);
// returns the cell object
return $cell;
}
}
开发者ID:kiibe,项目名称:linkERP,代码行数:17,代码来源:TTableRow.php
示例13: TTable
/**
* Constructor method
*/
function __construct(Exception $e)
{
$error_array = $e->getTrace();
$table = new TTable();
$row = $table->addRow();
$row->addCell('<b>' . $e->getMessage() . '</b><br>');
$row = $table->addRow();
$row->addCell(' ');
foreach ($error_array as $error) {
$file = isset($error['file']) ? $error['file'] : '';
$line = isset($error['line']) ? $error['line'] : '';
$file = str_replace(PATH, '', $file);
$row = $table->addRow();
$row->addCell('File: ' . $file . ' : ' . $line);
$row = $table->addRow();
$args = array();
if ($error['args']) {
foreach ($error['args'] as $arg) {
if (is_object($arg)) {
$args[] = get_class($arg) . ' object';
} else {
if (is_array($arg)) {
$array_param = array();
foreach ($arg as $value) {
if (is_object($value)) {
$array_param[] = get_class($value);
} else {
if (is_array($value)) {
$array_param[] = 'array';
} else {
$array_param[] = $value;
}
}
}
$args[] = implode(',', $array_param);
} else {
$args[] = (string) $arg;
}
}
}
}
$class = isset($error['class']) ? $error['class'] : '';
$type = isset($error['type']) ? $error['type'] : '';
$row->addCell(' <i>' . '<font color=green>' . $class . '</font>' . '<font color=olive>' . $type . '</font>' . '<font color=darkblue>' . $error['function'] . '</font>' . '(' . '<font color=maroon>' . implode(',', $args) . '</font>' . ')</i>');
}
$scroll = new TScroll();
$scroll->setSize(690, 390);
$scroll->add($table);
ob_start();
$table->show();
$content = ob_get_clean();
new TMessage('error', $content, NULL, AdiantiCoreTranslator::translate('Exception'));
}
开发者ID:kiibe,项目名称:linkERP,代码行数:56,代码来源:TExceptionView.php
示例14: addCell
/**
* Add a new cell (TTableCell) to the Table Row
* @param $value Cell Content
* @return TTableCell
*/
public function addCell($content)
{
if (is_null($content)) {
throw new Exception(AdiantiCoreTranslator::translate('Method ^1 does not accept null values', __METHOD__));
} else {
if (is_string($content)) {
$content = new GtkLabel($content);
}
$cell = new TTableCell($content);
$this->cells[] = $cell;
return $cell;
}
}
开发者ID:klausetgeton,项目名称:esales-gtk,代码行数:18,代码来源:TTableRow.php
示例15: setFieldsByRow
/**
* Define the field quantity per row
* @param $count Field count
*/
public function setFieldsByRow($count)
{
if (is_int($count) and $count >= 1 and $count <= 3) {
$this->fieldsByRow = $count;
if (!empty($this->titleCell)) {
$this->titleCell->{'colspan'} = 2 * $this->fieldsByRow;
}
if (!empty($this->actionCell)) {
$this->actionCell->{'colspan'} = 2 * $this->fieldsByRow;
}
} else {
throw new Exception(AdiantiCoreTranslator::translate('The method (^1) just accept values of type ^2 between ^3 and ^4', __METHOD__, 'integer', 1, 3));
}
}
开发者ID:jhonleandres,项目名称:Atividades,代码行数:18,代码来源:TQuickForm.php
示例16: openFile
/**
* Open a File Dialog
* @param $file File Name
*/
public function openFile($file)
{
$ini = parse_ini_file('application.ini');
$viewer = $ini['viewer'];
if (file_exists($viewer)) {
if (OS != 'WIN') {
exec("{$viewer} {$file} >/dev/null &");
} else {
$WshShell = new COM("WScript.Shell");
$WshShell->Run("{$file}", 0, true);
}
} else {
throw new Exception(AdiantiCoreTranslator::translate('File not found') . ': ' . $viewer);
}
}
开发者ID:klausetgeton,项目名称:esales-gtk,代码行数:19,代码来源:TPage.php
示例17: run
public static function run($debug = FALSE)
{
$class = isset($_REQUEST['class']) ? $_REQUEST['class'] : '';
$static = isset($_REQUEST['static']) ? $_REQUEST['static'] : '';
$method = isset($_REQUEST['method']) ? $_REQUEST['method'] : '';
$content = '';
set_error_handler(array('AdiantiCoreApplication', 'errorHandler'));
if (class_exists($class)) {
if ($static) {
$rf = new ReflectionMethod($class, $method);
if ($rf->isStatic()) {
call_user_func(array($class, $method), $_REQUEST);
} else {
call_user_func(array(new $class($_GET), $method), $_REQUEST);
}
} else {
try {
$page = new $class($_GET);
ob_start();
$page->show($_GET);
$content = ob_get_contents();
ob_end_clean();
} catch (Exception $e) {
ob_start();
if ($debug) {
new TExceptionView($e);
$content = ob_get_contents();
} else {
new TMessage('error', $e->getMessage());
$content = ob_get_contents();
}
ob_end_clean();
}
}
} else {
if (function_exists($method)) {
call_user_func($method, $_REQUEST);
} else {
new TMessage('error', AdiantiCoreTranslator::translate('Class ^1 not found', " <b><i><u>{$class}</u></i></b>") . '.<br>' . AdiantiCoreTranslator::translate('Check the class name or the file name') . '.');
}
}
if (!$static) {
echo TPage::getLoadedCSS();
}
echo TPage::getLoadedJS();
echo $content;
}
开发者ID:cbsistem,项目名称:adiantiframework,代码行数:47,代码来源:AdiantiCoreApplication.php
示例18: __construct
/**
* Class Constructor
* @param $name name of the field
*/
public function __construct($name)
{
if (empty($name)) {
$rc = new ReflectionClass($this);
$classname = $rc->getShortName();
throw new Exception(AdiantiCoreTranslator::translate('The parameter (^1) of ^2 constructor is required', 'name', $classname));
}
// define some default properties
self::setEditable(TRUE);
self::setName(trim($name));
self::setSize(200);
// initialize validations array
$this->validations = array();
// creates a <input> tag
$this->tag = new TElement('input');
$this->tag->{'class'} = 'tfield';
// classe CSS
}
开发者ID:kiibe,项目名称:linkERP,代码行数:22,代码来源:TField.php
示例19: __construct
/**
* Class Constructor
* @param $name widget's name
* @param $database database name
* @param $model model class name
* @param $value table field to be listed in the combo
* @param $ordercolumn column to order the fields (optional)
* @param $criteria criteria (TCriteria object) to filter the model (optional)
*/
public function __construct($name, $database, $model, $value, $orderColumn = NULL, TCriteria $criteria = NULL)
{
// executes the parent class constructor
parent::__construct($name);
if (empty($database)) {
throw new Exception(AdiantiCoreTranslator::translate('The parameter (^1) of ^2 is required', 'database', __CLASS__));
}
if (empty($model)) {
throw new Exception(AdiantiCoreTranslator::translate('The parameter (^1) of ^2 is required', 'model', __CLASS__));
}
if (empty($value)) {
throw new Exception(AdiantiCoreTranslator::translate('The parameter (^1) of ^2 is required', 'value', __CLASS__));
}
$this->minLength = 1;
$this->database = $database;
$this->model = $model;
$this->column = $value;
$this->operator = 'like';
$this->orderColumn = isset($orderColumn) ? $orderColumn : NULL;
$this->criteria = $criteria;
}
开发者ID:kiibe,项目名称:linkERP,代码行数:30,代码来源:TDBEntry.php
示例20: __construct
/**
* Class Constructor
* @param $caption Button caption
* @param $form Dialog form body
* @param $action Action to be processed when closing the dialog
* @param $title_msg Dialog Title
*/
public function __construct($title_msg, TForm $form, TAction $action = NULL, $caption = '')
{
parent::__construct('', NULL, Gtk::DIALOG_MODAL);
parent::set_position(Gtk::WIN_POS_CENTER);
parent::set_title($title_msg ? $title_msg : AdiantiCoreTranslator::translate('Input'));
$actions = array();
$action_counter = 0;
if ($form instanceof TQuickForm) {
$form->delActions();
$actionButtons = $form->getActionButtons();
foreach ($actionButtons as $key => $button) {
parent::add_button($button->getLabel(), $action_counter);
$actions[] = $button->getAction();
$action_counter++;
}
} else {
parent::add_button($caption, $action_counter);
$actions[] = $action;
}
$this->vbox->pack_start($form);
$form->show();
$this->show_all();
parent::connect('key_press_event', array($this, 'onClose'));
$result = parent::run();
foreach ($actions as $actionIndex => $buttonAction) {
if ($result == $actionIndex) {
if ($buttonAction) {
$parameters = $buttonAction->getParameters();
$data = $form->getData();
foreach ($data as $key => $value) {
$parameters[$key] = $value;
}
parent::destroy();
call_user_func_array($buttonAction->getAction(), array($parameters));
return;
}
}
}
parent::destroy();
}
开发者ID:klausetgeton,项目名称:esales-gtk,代码行数:47,代码来源:TInputDialog.php
注:本文中的Adianti\Core\AdiantiCoreTranslator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论