本文整理汇总了PHP中System::loadLanguageFile方法的典型用法代码示例。如果您正苦于以下问题:PHP System::loadLanguageFile方法的具体用法?PHP System::loadLanguageFile怎么用?PHP System::loadLanguageFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System
的用法示例。
在下文中一共展示了System::loadLanguageFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Load data container and create template
* @param object
*/
public function __construct($objModule)
{
parent::__construct($objModule);
\System::loadLanguageFile(\Isotope\Model\Address::getTable());
$this->loadDataContainer(\Isotope\Model\Address::getTable());
$this->Template = new \Isotope\Template('iso_checkout_address');
}
示例2: generate
/**
* Generate the checkout step
* @return string
*/
public function generate()
{
// Make sure field data is available
\Controller::loadDataContainer('tl_iso_product_collection');
\System::loadLanguageFile('tl_iso_product_collection');
$objTemplate = new Template($this->strTemplate);
$varValue = null;
$objWidget = new FormTextArea(FormTextArea::getAttributesFromDca($GLOBALS['TL_DCA'][$this->strTable]['fields'][$this->strField], $this->strField, $varValue, $this->strField, $this->strTable, $this));
$objWidget->storeValues = true;
if (\Input::post('FORM_SUBMIT') == $this->strFormId) {
$objWidget->validate();
$varValue = $objWidget->value;
// Do not submit the field if there are errors
if ($objWidget->hasErrors()) {
$doNotSubmit = true;
} elseif ($objWidget->submitInput()) {
$objOrder = Isotope::getCart()->getDraftOrder();
// Store the form data
$_SESSION['FORM_DATA'][$this->strField] = $varValue;
// Set the correct empty value (see #6284, #6373)
if ($varValue === '') {
$varValue = $objWidget->getEmptyValue();
}
// Set the new value
if ($varValue !== $objOrder->{$this->strField}) {
$objOrder->{$this->strField};
}
}
}
$objTemplate->headline = $GLOBALS['TL_LANG'][$this->strTable][$this->strField][0];
$objTemplate->customerNotes = $objWidget->parse();
return $objTemplate->parse();
}
示例3: check
/**
* Check permissions for that entry
* @return void
*/
public static function check()
{
$session = \Session::getInstance()->getData();
if (\Input::get('act') == 'delete' && in_array(\Input::get('id'), static::getUndeletableIds())) {
\System::log('Product type ID ' . \Input::get('id') . ' is used in an order and can\'t be deleted', __METHOD__, TL_ERROR);
\Controller::redirect('contao/main.php?act=error');
} elseif (\Input::get('act') == 'deleteAll' && is_array($session['CURRENT']['IDS'])) {
$arrDeletable = array_diff($session['CURRENT']['IDS'], static::getUndeletableIds());
if (count($arrDeletable) != count($session['CURRENT']['IDS'])) {
$session['CURRENT']['IDS'] = array_values($arrDeletable);
\Session::getInstance()->setData($session);
\Message::addInfo($GLOBALS['TL_LANG']['MSC']['undeletableRecords']);
}
}
// Disable variants if no such attributes are available
\Controller::loadDataContainer('tl_iso_product');
$blnVariants = false;
foreach ($GLOBALS['TL_DCA']['tl_iso_product']['fields'] as $strName => $arrConfig) {
$objAttribute = $GLOBALS['TL_DCA']['tl_iso_product']['attributes'][$strName];
if (null !== $objAttribute && $objAttribute->isVariantOption()) {
$blnVariants = true;
break;
}
}
if (!$blnVariants) {
\System::loadLanguageFile('explain');
unset($GLOBALS['TL_DCA']['tl_iso_producttype']['subpalettes']['variants']);
$GLOBALS['TL_DCA']['tl_iso_producttype']['fields']['variants']['input_field_callback'] = function ($dc) {
// Make sure variants are disabled in this product type (see #1114)
\Database::getInstance()->prepare("UPDATE " . $dc->table . " SET variants='' WHERE id=?")->execute($dc->id);
return '<br><p class="tl_info">' . $GLOBALS['TL_LANG']['XPL']['noVariantAttributes'] . '</p>';
};
}
}
示例4: __construct
/**
* Initialize the controller
*
* 1. Import the user
* 2. Call the parent constructor
* 3. Authenticate the user
* 4. Load the language files
* DO NOT CHANGE THIS ORDER!
*/
public function __construct()
{
$this->import('BackendUser', 'User');
parent::__construct();
$this->User->authenticate();
\System::loadLanguageFile('default');
}
示例5: generateTokens
public static function generateTokens($intSubmission, $arrFields = array())
{
$arrTokens = array();
\Controller::loadDataContainer('tl_submission');
\System::loadLanguageFile('tl_submission');
$arrDca =& $GLOBALS['TL_DCA']['tl_submission'];
if (($objSubmission = SubmissionModel::findByPk($intSubmission)) !== null) {
$objDc = new DC_Hybrid('tl_submission');
$objDc->activeRecord = $objSubmission;
// fields
if (($objSubmissionArchive = $objSubmission->getRelated('pid')) !== null) {
\Controller::loadDataContainer('tl_submission');
$arrFields = empty($arrFields) ? deserialize($objSubmissionArchive->submissionFields, true) : $arrFields;
if (isset($GLOBALS['TL_HOOKS']['preGenerateSubmissionTokens']) && is_array($GLOBALS['TL_HOOKS']['preGenerateSubmissionTokens'])) {
foreach ($GLOBALS['TL_HOOKS']['preGenerateSubmissionTokens'] as $arrCallback) {
\System::importStatic($arrCallback[0])->{$arrCallback}[1]($objSubmission, $objSubmissionArchive, $arrFields);
}
}
}
$arrSubmissionData = static::prepareData($objSubmission, 'tl_submission', $GLOBALS['TL_DCA']['tl_submission'], $objDc, $arrFields, Submissions::getSkipFields());
$arrTokens = static::tokenizeData($arrSubmissionData);
// salutation
$arrTokens['salutation_submission'] = NotificationCenterPlus::createSalutation($GLOBALS['TL_LANGUAGE'], array('gender' => $arrTokens['form_value_gender'], 'title' => $arrTokens['form_value_title'], 'lastname' => $arrTokens['form_value_lastname']));
$arrTokens['tl_submission'] = $objSubmission->id;
}
return $arrTokens;
}
示例6: compile
/**
* Generate the module
*/
protected function compile()
{
\System::loadLanguageFile('tl_autoload');
// Process the request
if (\Input::post('FORM_SUBMIT') == 'tl_autoload') {
$this->createAutoloadFiles();
$this->reload();
}
$arrModules = array();
// List all modules
foreach (scan(TL_ROOT . '/system/modules') as $strFile) {
if (strncmp($strFile, '.', 1) === 0 || !is_dir(TL_ROOT . '/system/modules/' . $strFile)) {
continue;
}
$arrModules[] = $strFile;
}
$this->Template->modules = $arrModules;
$this->Template->messages = \Message::generate();
$this->Template->href = $this->getReferer(true);
$this->Template->title = specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']);
$this->Template->button = $GLOBALS['TL_LANG']['MSC']['backBT'];
$this->Template->headline = $GLOBALS['TL_LANG']['tl_autoload']['headline'];
$this->Template->action = ampersand(\Environment::get('request'));
$this->Template->available = $GLOBALS['TL_LANG']['tl_autoload']['available'];
$this->Template->xplAvailable = $GLOBALS['TL_LANG']['tl_autoload']['xplAvailable'];
$this->Template->selectAll = $GLOBALS['TL_LANG']['MSC']['selectAll'];
$this->Template->override = $GLOBALS['TL_LANG']['tl_autoload']['override'];
$this->Template->xplOverride = $GLOBALS['TL_LANG']['tl_autoload']['xplOverride'];
$this->Template->submitButton = specialchars($GLOBALS['TL_LANG']['MSC']['continue']);
$this->Template->autoload = $GLOBALS['TL_LANG']['tl_autoload']['autoload'];
$this->Template->ideCompat = $GLOBALS['TL_LANG']['tl_autoload']['ideCompat'];
}
示例7: getExcludedFields
/**
* Return all excluded fields as HTML drop down menu
*
* @return array
*/
public function getExcludedFields()
{
$processed = array();
/** @var SplFileInfo[] $files */
$files = System::getContainer()->get('contao.resource_finder')->findIn('dca')->depth(0)->files()->name('*.php');
foreach ($files as $file) {
if (in_array($file->getBasename(), $processed)) {
continue;
}
$processed[] = $file->getBasename();
$strTable = $file->getBasename('.php');
System::loadLanguageFile($strTable);
$this->loadDataContainer($strTable);
}
$arrReturn = array();
// Get all excluded fields
foreach ($GLOBALS['TL_DCA'] as $k => $v) {
if (is_array($v['fields'])) {
foreach ($v['fields'] as $kk => $vv) {
if ($vv['exclude'] || $vv['orig_exclude']) {
$arrReturn[$k][StringUtil::specialchars($k . '::' . $kk)] = isset($vv['label'][0]) ? $vv['label'][0] . ' <span style="color:#999;padding-left:3px">[' . $kk . ']</span>' : $kk;
}
}
}
}
ksort($arrReturn);
return $arrReturn;
}
示例8: getDataCols
/**
* @param $dc
* @return array
*/
public function getDataCols(\DataContainer $dc)
{
$pid = $dc->activeRecord->pid;
$options = array();
if (!$pid) {
return $options;
}
$moduleDB = $this->Database->prepare('SELECT * FROM tl_fmodules WHERE id = ?')->execute($pid);
$tablename = '';
while ($moduleDB->next()) {
if ($moduleDB->tablename) {
$tablename = $moduleDB->tablename;
}
}
if (!$tablename) {
return $options;
}
$tableData = $tablename . '_data';
$doNotSetByName = array('pid', 'id', 'tstamp');
// get editable fields
System::loadLanguageFile($tableData);
$this->loadDataContainer($tableData);
$fields = $GLOBALS['TL_DCA'][$tableData]['fields'] ? $GLOBALS['TL_DCA'][$tableData]['fields'] : array();
foreach ($fields as $name => $field) {
if (in_array($name, $doNotSetByName)) {
continue;
}
$options[$name] = $field['label'][0] ? $field['label'][0] . ' (' . $name . ')' : $name;
}
return $options;
}
示例9: getExcludedFields
/**
* Return all excluded fields as HTML drop down menu
*
* @return array
*/
public function getExcludedFields()
{
$included = array();
foreach (ModuleLoader::getActive() as $strModule) {
$strDir = 'system/modules/' . $strModule . '/dca';
if (!is_dir(TL_ROOT . '/' . $strDir)) {
continue;
}
foreach (scan(TL_ROOT . '/' . $strDir) as $strFile) {
// Ignore non PHP files and files which have been included before
if (substr($strFile, -4) != '.php' || in_array($strFile, $included)) {
continue;
}
$included[] = $strFile;
$strTable = substr($strFile, 0, -4);
System::loadLanguageFile($strTable);
$this->loadDataContainer($strTable);
}
}
$arrReturn = array();
// Get all excluded fields
foreach ($GLOBALS['TL_DCA'] as $k => $v) {
if (is_array($v['fields'])) {
foreach ($v['fields'] as $kk => $vv) {
if ($vv['exclude'] || $vv['orig_exclude']) {
$arrReturn[$k][specialchars($k . '::' . $kk)] = $vv['label'][0] ?: $kk;
}
}
}
}
ksort($arrReturn);
return $arrReturn;
}
示例10: generateFilter
/**
* Add this filter to the module's template or get the URL params
* @param array
* @param Contao\Template
* @param Contao\Module
* @param boolean
* @return mixed string|bool|void
*/
public static function generateFilter(&$arrCategories, &$objTemplate, $objModule, $blnGenURL = false)
{
\System::loadLanguageFile(Product::getTable());
\Controller::loadDataContainer(Product::getTable());
$arrFields = deserialize($objModule->iso_sortingFields, true);
if ($blnGenURL) {
//return the URL fragment needed for this filter to pass to the lister
if (\Input::post(static::$strKey) && in_array(str_replace(array('-asc', '-desc'), '', \Input::post(static::$strKey)), $arrFields)) {
return static::$strKey . '/' . urlencode(\Input::post(static::$strKey));
}
return false;
}
$arrAvailable = array('' => $GLOBALS['TL_LANG']['MSC']['relevancyFilterLabel']);
foreach ($arrFields as $field) {
list($asc, $desc) = static::getSortingLabels($field);
$strLabel = is_array($GLOBALS['TL_DCA'][Product::getTable()]['fields'][$field]['label']) ? $GLOBALS['TL_DCA'][Product::getTable()]['fields'][$field]['label'][0] : $field;
$arrAvailable[$field . '-asc'] = $strLabel . ' ' . $asc;
$arrAvailable[$field . '-desc'] = $strLabel . ' ' . $desc;
}
if (count($arrAvailable) > 0) {
$objTemplate->hasSorting = true;
$objTemplate->sort = $arrAvailable;
$objTemplate->sortselected = \Input::get(static::$strKey) ?: ($objModule->iso_listingSortField ? $objModule->iso_listingSortField . '-' . strtolower($objModule->iso_listingSortDirection) : '');
$objTemplate->psortLabel = $GLOBALS['TL_LANG']['MSC'][static::$strKey . 'FilterLabel'];
}
}
示例11: generateWizardList
/**
* @param \Database_Result $records
* @param string $id
* @param \DcaWizard $dcaWizard
*
* @return string
*/
public function generateWizardList($records, $id, $dcaWizard)
{
$return = '';
$rows = $dcaWizard->getRows($records);
// Alter the rows
\System::loadLanguageFile('tl_iso_product_collection');
$rows = array_map(function ($row) {
// Force an algebraic sign for quantity
$row['quantity'] = sprintf('%+d', $row['quantity']);
// Make referenced product collection editable in a popup
$row['product_collection_id'] = $row['product_collection_id'] ? sprintf('<a href="contao/main.php?do=iso_orders&act=edit&id=%1$u&popup=1&nb=1&rt=%4$s" title="%3$s" onclick="Backend.openModalIframe({\'width\':768,\'title\':\'%3$s\',\'url\':this.href});return false">%2$s</a>', $row['product_collection_id'], \Image::getHtml('edit.gif') . $row['product_collection_id'], sprintf($GLOBALS['TL_LANG']['tl_iso_product_collection']['edit'][1], $row['product_collection_id']), REQUEST_TOKEN) : '-';
return $row;
}, $rows);
if ($rows) {
$template = new \BackendTemplate('be_widget_dcawizard');
$template->headerFields = $dcaWizard->getHeaderFields();
$template->hasRows = !empty($rows);
$template->rows = $rows;
$template->fields = $dcaWizard->fields;
$template->showOperations = $dcaWizard->showOperations;
if ($dcaWizard->showOperations) {
$template->operations = $dcaWizard->getActiveRowOperations();
}
$template->generateOperation = function ($operation, $row) use($dcaWizard) {
return $dcaWizard->generateRowOperation($operation, $row);
};
$dom = new \DOMDocument('1.0', 'utf-8');
$dom->loadHTML($template->parse());
$return = $dom->saveHTML($dom->getElementsByTagName('table')->item(0));
}
// Add the member's total bonus points
$return .= sprintf('<strong style="display: inline-block; margin: 4px 0 2px 6px; border-bottom: 3px double">%s</strong>', Stock::getStockForProduct($dcaWizard->currentRecord));
return $return;
}
示例12: __construct
/**
* Construct the model
*
* @param Result $objResult
*/
public function __construct(Result $objResult = null)
{
parent::__construct($objResult);
if (!is_array($GLOBALS['ISO_ADR'])) {
\Controller::loadDataContainer(static::$strTable);
\System::loadLanguageFile('addresses');
}
}
示例13: __construct
/**
* Load database object
* @param array
*/
public function __construct($arrAttributes = false)
{
parent::__construct($arrAttributes);
$this->loadDataContainer('tl_iso_group');
\System::loadLanguageFile('tl_iso_group');
$this->import('Database');
$this->import('BackendUser', 'User');
}
示例14: generate
/**
* Generate the module
* @return string
*/
public function generate()
{
if (!\BackendUser::getInstance()->isAdmin) {
return '<p class="tl_gerror">' . $GLOBALS['TL_LANG']['tl_iso_integrity']['permission'] . '</p>';
}
\System::loadLanguageFile('tl_iso_integrity');
return parent::generate();
}
示例15: runOnValidationError
public function runOnValidationError($arrInvalidFields)
{
$arrDca = $GLOBALS['TL_DCA'][$this->strTable];
\System::loadLanguageFile($this->strTable);
StatusMessage::addError(sprintf($GLOBALS['TL_LANG']['frontendedit']['validationFailed'], '<ul>' . implode('', array_map(function ($val) use($arrDca) {
return '<li>' . ($arrDca['fields'][$val]['label'][0] ?: $val) . '</li>';
}, $arrInvalidFields))) . '</ul>', $this->objModule->id, 'validation-failed');
$this->Template->message = StatusMessage::generate($this->objModule->id);
}