本文整理汇总了PHP中TTi18n类的典型用法代码示例。如果您正苦于以下问题:PHP TTi18n类的具体用法?PHP TTi18n怎么用?PHP TTi18n使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TTi18n类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($orientation = 'P', $unit = 'mm', $format = 'A4', $encoding = 'UTF-8', $diskcache = FALSE)
{
if (TTi18n::getPDFDefaultFont() != 'freeserif' and $encoding == 'ISO-8859-1') {
parent::__construct($orientation, $unit, $format, FALSE, 'ISO-8859-1', $diskcache);
//Make sure TCPDF constructor is called with all the arguments
} else {
parent::__construct($orientation, $unit, $format, TRUE, $encoding, $diskcache);
//Make sure TCPDF constructor is called with all the arguments
}
Debug::Text('PDF Encoding: ' . $encoding, __FILE__, __LINE__, __METHOD__, 10);
/*
if ( TTi18n::getPDFDefaultFont() == 'freeserif' ) {
Debug::Text('Using unicode PDF: Font: freeserif Unicode: '. (int)$unicode .' Encoding: '. $encoding, __FILE__, __LINE__, __METHOD__,10);
} else {
//If we're only using English, default to faster non-unicode settings.
//unicode=FALSE and encoding='ISO-8859-1' is about 20-30% faster.
Debug::Text('Using non-unicode PDF: Font: helvetica Unicode: '. (int)$unicode .' Encoding: '. $encoding, __FILE__, __LINE__, __METHOD__,10);
parent::__construct($orientation, $unit, $format, FALSE, 'ISO-8859-1', $diskcache); //Make sure TCPDF constructor is called with all the arguments
}
*/
//Using freeserif font enabling font subsetting is slow and produces PDFs at least 1mb. Helvetica is fine though.
$this->setFontSubsetting(TRUE);
//When enabled, makes PDFs smaller, but severly slows down TCPDF if enabled. (+6 seconds per PDF)
$this->SetCreator(APPLICATION_NAME . ' ' . getTTProductEditionName() . ' v' . APPLICATION_VERSION);
return TRUE;
}
示例2: _getFactoryOptions
function _getFactoryOptions($name, $parent = NULL)
{
$retval = NULL;
switch ($name) {
case 'columns':
$retval = array('-1100-type' => TTi18n::gettext('Type'), '-1110-status' => TTi18n::gettext('Status'), '-1210-time_stamp' => TTi18n::gettext('Date/Time'), '-1220-date' => TTi18n::gettext('Date'), '-1230-time' => TTi18n::gettext('Time'), '-1239-in_type' => TTi18n::gettext('In Type'), '-1240-in_time_stamp' => TTi18n::gettext('In Date/Time'), '-1250-in_punch_date' => TTi18n::gettext('In Date'), '-1260-in_punch_time' => TTi18n::gettext('In Time'), '-1269-out_type' => TTi18n::gettext('Out Type'), '-1270-out_time_stamp' => TTi18n::gettext('Out Date/Time'), '-1280-out_punch_date' => TTi18n::gettext('Out Date'), '-1290-out_punch_time' => TTi18n::gettext('Out Time'), '-1310-branch' => TTi18n::gettext('Branch'), '-1320-department' => TTi18n::gettext('Department'), '-1410-station_id' => TTi18n::gettext('Station ID'), '-1420-longitude' => TTi18n::gettext('Longitude'), '-1430-latitude' => TTi18n::gettext('Latitude'), '-1500-note' => TTi18n::gettext('Note'));
//Since getOptions() can be called without first setting a company, we don't always know the product edition for the currently
//logged in employee.
if (is_object($this->getCompanyObject()) and $this->getCompanyObject()->getProductEdition() >= TT_PRODUCT_CORPORATE or !is_object($this->getCompanyObject()) and getTTProductEdition() >= TT_PRODUCT_CORPORATE) {
$retval += array('-1330-job' => TTi18n::gettext('Job'), '-1340-job_item' => TTi18n::gettext('Task'), '-1350-quantity' => TTi18n::gettext('Quantity'), '-1360-bad_quantity' => TTi18n::gettext('Bad Quantity'));
}
$retval = Misc::addSortPrefix(Misc::prependArray($this->getUserIdentificationColumns(), Misc::trimSortPrefix($retval)));
ksort($retval);
break;
case 'column_aliases':
//Used for converting column names after they have been parsed.
$retval = array('type' => 'type_id', 'status' => 'status_id', 'branch' => 'branch_id', 'department' => 'department_id', 'job' => 'job_id', 'job_item' => 'job_item_id');
break;
case 'import_options':
$retval = array('-1010-fuzzy_match' => TTi18n::getText('Enable smart matching.'), '-1020-disable_rounding' => TTi18n::getText('Disable rounding.'));
break;
case 'parse_hint':
$upf = TTnew('UserPreferenceFactory');
$retval = array('branch' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'department' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'job' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'job_item' => array('-1010-name' => TTi18n::gettext('Name'), '-1010-manual_id' => TTi18n::gettext('Code')), 'time_stamp' => $upf->getOptions('date_time_format'), 'in_time_stamp' => $upf->getOptions('date_time_format'), 'out_time_stamp' => $upf->getOptions('date_time_format'), 'date' => $upf->getOptions('date_format'), 'in_punch_date' => $upf->getOptions('date_format'), 'out_punch_date' => $upf->getOptions('date_format'), 'time' => $upf->getOptions('time_format'), 'in_punch_time' => $upf->getOptions('time_format'), 'out_punch_time' => $upf->getOptions('time_format'));
break;
}
return $retval;
}
示例3: getOptions
static function getOptions($name, $interval = 1)
{
$all_array_option = array('*' => TTi18n::getText('-- All --'));
$retval = FALSE;
switch ($name) {
case 'minute':
for ($i = 0; $i <= 59; $i += $interval) {
$retval[$i] = $i;
}
$retval = Misc::prependArray($all_array_option, $retval);
break;
case 'hour':
for ($i = 0; $i <= 23; $i += $interval) {
$retval[$i] = $i;
}
$retval = Misc::prependArray($all_array_option, $retval);
break;
case 'day_of_month':
$retval = Misc::prependArray($all_array_option, TTDate::getDayOfMonthArray());
break;
case 'month':
$retval = Misc::prependArray($all_array_option, TTDate::getMonthOfYearArray());
break;
case 'day_of_week':
$retval = Misc::prependArray($all_array_option, TTDate::getDayOfWeekArray());
break;
}
return $retval;
}
示例4: smarty_function_htmlReportSort
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
function smarty_function_htmlReportSort($params, &$smarty)
{
require_once $smarty->_get_plugin_filepath('function', 'html_options');
$filter_data = $params['filter_data'];
$retval .= '<tr onClick="showHelpEntry(\'sort\')">
<td colspan="2" class="cellLeftEditTableHeader">
' . TTi18n::gettext('Sort By:') . '
</td>
<td class="cellRightEditTable">
<select id="columns" name="filter_data[primary_sort]">
{html_options options=$filter_data.sort_options selected=$filter_data.primary_sort}
' . smarty_function_html_options(array('options' => $filter_data['sort_options'], 'selected' => $filter_data['primary_sort']), $smarty) . '
</select>
<select id="columns" name="filter_data[primary_sort_dir]">
' . smarty_function_html_options(array('options' => $filter_data['sort_direction_options'], 'selected' => $filter_data['primary_sort_dir']), $smarty) . '
</select>
<b>' . TTi18n::gettext('then:') . '</b>
<select id="columns" name="filter_data[secondary_sort]">
' . smarty_function_html_options(array('options' => $filter_data['sort_options'], 'selected' => $filter_data['secondary_sort']), $smarty) . '
</select>
<select id="columns" name="filter_data[secondary_sort_dir]">
' . smarty_function_html_options(array('options' => $filter_data['sort_direction_options'], 'selected' => $filter_data['secondary_sort_dir']), $smarty) . '
</select>
</td>
</tr>
';
return $retval;
}
示例5: smarty_function_formatCurrency
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
function smarty_function_formatCurrency($params, &$smarty)
{
$amount = $params['amount'];
$currency_code = $params['currency_code'];
$show_code = $params['show_code'];
return TTi18n::formatCurrency($amount, $currency_code, $show_code);
}
示例6: getByFuzzyValue
static function getByFuzzyValue($value, $options, $value_is_translated = TRUE)
{
// I18n: Calling gettext on the value here enables a match with the translated value in the relevant factory.
// BUT... such string comparisons are messy and we really should be using getByKey for most everything.
// Exceptions can be made by passing false for $value_is_translated.
if ($value_is_translated == TRUE) {
$value = TTi18n::gettext($value);
}
if (is_array($value)) {
return FALSE;
}
if (!is_array($options)) {
return FALSE;
}
$retarr = Misc::findClosestMatch($value, $options, 10, FALSE);
Debug::Arr($retarr, 'RetArr: ', __FILE__, __LINE__, __METHOD__, 10);
/*
//Convert SQL search value ie: 'test%test%' to a regular expression.
$value = str_replace('%', '.*', $value);
foreach( $options as $key => $option_value ) {
if ( preg_match('/^'.$value.'$/i', $option_value) ) {
$retarr[] = $key;
}
}
*/
if (isset($retarr)) {
return $retarr;
}
return FALSE;
}
示例7: setOrder
function setOrder($value)
{
$value = trim($value);
if ($this->Validator->isNumeric('order', $value, TTi18n::gettext('Order is invalid'))) {
$this->data['order_value'] = $value;
return TRUE;
}
return FALSE;
}
示例8: returnFileValidationError
function returnFileValidationError()
{
//Make sure we return a complete validation error to be displayed to the user.
$validator_obj = new Validator();
$validator_stats = array('total_records' => 1, 'valid_records' => 0);
$validator_obj->isTrue('file', FALSE, TTi18n::getText('Please upload file again'));
$validator[0] = $validator_obj->getErrorsArray();
return $this->returnHandler(FALSE, 'IMPORT_FILE', TTi18n::getText('INVALID DATA'), $validator, $validator_stats);
}
示例9: getTemplateSchema
public function getTemplateSchema($name = NULL)
{
$template_schema = array(array('page' => 1, 'template_page' => 1), array('function' => 'drawPiecemeal', 'value' => '_____________________________', 'coordinates' => array(array('x' => 47, 'y' => 245, 'h' => 5, 'w' => 60, 'halign' => 'L'), array('x' => 147, 'y' => 245, 'h' => 5, 'w' => 60, 'halign' => 'L'), array('x' => 147, 'y' => 255, 'h' => 5, 'w' => 60, 'halign' => 'C')), 'font' => array('size' => 10, 'type' => '')), array('function' => 'drawSegments', 'value' => array(TTi18n::gettext('Employee Signature:'), TTi18n::gettext('Supervisor Signature:'), TTi18n::gettext('(print name)')), 'coordinates' => array(array('x' => 7, 'y' => 245, 'h' => 5, 'w' => 40, 'halign' => 'L'), array('x' => 107, 'y' => 245, 'h' => 5, 'w' => 40, 'halign' => 'R'), array('x' => 140, 'y' => 260, 'h' => 5, 'w' => 60, 'halign' => 'C')), 'font' => array('size' => 10, 'type' => '')), 'full_name' => array('function' => 'drawPiecemeal', 'coordinates' => array(array('x' => 20, 'y' => 28, 'h' => 5, 'w' => 100, 'halign' => 'L'), array('x' => 40, 'y' => 250, 'h' => 5, 'w' => 60, 'halign' => 'C')), 'font' => array('size' => 10, 'type' => '')), 'amount_words_cents' => array('function' => array('filterAmountWordsCents', 'drawNormal'), 'coordinates' => array('x' => 20, 'y' => 36, 'h' => 5, 'w' => 100, 'halign' => 'J'), 'font' => array('size' => 10, 'type' => '')), 'date' => array('function' => array('filterDate', 'drawNormal'), 'coordinates' => array('x' => 100, 'y' => 18, 'h' => 5, 'w' => 38, 'halign' => 'L'), 'font' => array('size' => 10, 'type' => '')), 'amount_padded' => array('function' => array('filterAmountPadded', 'drawNormal'), 'coordinates' => array('x' => 136, 'y' => 27, 'h' => 5, 'w' => 24, 'halign' => 'L'), 'font' => array('size' => 10, 'type' => '')), 'stub_left_column' => array('function' => 'drawPiecemeal', 'coordinates' => array(array('x' => 15, 'y' => 105, 'h' => 95, 'w' => 96, 'halign' => 'L'), array('x' => 15, 'y' => 200, 'h' => 45, 'w' => 96, 'halign' => 'L')), 'font' => array('size' => 10, 'type' => ''), 'multicell' => TRUE), 'stub_right_column' => array('function' => 'drawPiecemeal', 'coordinates' => array(array('x' => 111, 'y' => 105, 'h' => 95, 'w' => 96, 'halign' => 'R'), array('x' => 111, 'y' => 200, 'h' => 45, 'w' => 96, 'halign' => 'R')), 'font' => array('size' => 10, 'type' => ''), 'multicell' => TRUE));
if (isset($template_schema[$name])) {
return $name;
} else {
return $template_schema;
}
}
示例10: getTemplateSchema
public function getTemplateSchema($name = NULL)
{
$template_schema = array(array('page' => 1, 'template_page' => 1, 'value' => TTi18n::gettext('Date:') . ' ', 'coordinates' => array('x' => 172, 'y' => 28, 'h' => 10, 'w' => 10, 'halign' => 'C'), 'font' => array('size' => 10, 'type' => '')), 'full_name' => array('coordinates' => array('x' => 25, 'y' => 41, 'h' => 5, 'w' => 100, 'halign' => 'L'), 'font' => array('size' => 10, 'type' => '')), 'amount_words' => array('function' => array('filterAmountWords', 'drawNormal'), 'coordinates' => array('x' => 25, 'y' => 49, 'h' => 10, 'w' => 100, 'halign' => 'L'), 'font' => array('size' => 10, 'type' => '')), 'amount_cents' => array('function' => array('filterAmountCents', 'drawNormal'), 'coordinates' => array('x' => 125, 'y' => 49, 'h' => 10, 'w' => 15, 'halign' => 'L'), 'font' => array('size' => 10, 'type' => '')), 'date' => array('function' => array('filterDate', 'drawNormal'), 'coordinates' => array('x' => 182, 'y' => 28, 'h' => 10, 'w' => 25, 'halign' => 'C'), 'font' => array('size' => 10, 'type' => '')), 'amount_padded' => array('function' => array('filterAmountPadded', 'drawNormal'), 'coordinates' => array('x' => 172, 'y' => 41, 'h' => 10, 'w' => 35, 'halign' => 'C'), 'font' => array('size' => 10, 'type' => '')), 'stub_left_column' => array('function' => 'drawPiecemeal', 'coordinates' => array(array('x' => 15, 'y' => 105, 'h' => 100, 'w' => 96, 'halign' => 'L'), array('x' => 15, 'y' => 205, 'h' => 100, 'w' => 96, 'halign' => 'L')), 'font' => array('size' => 10, 'type' => ''), 'multicell' => TRUE), 'stub_right_column' => array('function' => 'drawPiecemeal', 'coordinates' => array(array('x' => 111, 'y' => 105, 'h' => 100, 'w' => 96, 'halign' => 'R'), array('x' => 111, 'y' => 205, 'h' => 100, 'w' => 96, 'halign' => 'R')), 'font' => array('size' => 10, 'type' => ''), 'multicell' => TRUE));
if (isset($template_schema[$name])) {
return $name;
} else {
return $template_schema;
}
}
示例11: getOptions
function getOptions($name)
{
$retval = NULL;
switch ($name) {
case 'type':
$retval = array('government' => TTi18n::gettext('Government (Multiple Employees/Page)'), 'employee' => TTi18n::gettext('Employee (One Employee/Page)'));
break;
}
return $retval;
}
示例12: setRoundInterValPolicy
function setRoundInterValPolicy($id)
{
$id = trim($id);
$riplf = TTnew('RoundIntervalPolicyListFactory');
if ($id == 0 or $this->Validator->isResultSetWithRows('round_inteval_policy', $riplf->getByID($id), TTi18n::gettext('Selected Interval Rounding Policy is invalid'))) {
$this->data['round_interval_policy_id'] = $id;
return TRUE;
}
return FALSE;
}
示例13: setDepartment
function setDepartment($id)
{
$id = trim($id);
$dlf = new DepartmentListFactory();
if ($this->Validator->isResultSetWithRows('department', $dlf->getByID($id), TTi18n::gettext('Selected Department is invalid'))) {
$this->data['department_id'] = $id;
return TRUE;
}
return FALSE;
}
示例14: setPremiumPolicy
function setPremiumPolicy($id)
{
$id = trim($id);
$pplf = new PremiumPolicyListFactory();
if ($id == 0 or $this->Validator->isResultSetWithRows('premium_policy', $pplf->getByID($id), TTi18n::gettext('Selected Premium Policy is invalid'))) {
$this->data['premium_policy_id'] = $id;
return TRUE;
}
return FALSE;
}
示例15: setBranch
function setBranch($id)
{
$id = trim($id);
$blf = new BranchListFactory();
if ($this->Validator->isResultSetWithRows('branch', $blf->getByID($id), TTi18n::gettext('Selected Branch is invalid'))) {
$this->data['branch_id'] = $id;
return TRUE;
}
return FALSE;
}