本文整理汇总了PHP中Controller::loadLanguageFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::loadLanguageFile方法的具体用法?PHP Controller::loadLanguageFile怎么用?PHP Controller::loadLanguageFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Controller
的用法示例。
在下文中一共展示了Controller::loadLanguageFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getArticleOptions
public function getArticleOptions(CreateOptionsEvent $event)
{
\Controller::loadLanguageFile('tl_article');
$database = \Database::getInstance();
$dataContainer = $event->getDataContainer();
$options = $event->getOptions();
// add articles in this page to options array
$resultSet = $database->prepare('SELECT a.id, a.title, a.inColumn
FROM tl_article a
INNER JOIN tl_article b
ON a.pid = b.pid
INNER JOIN tl_content c
ON c.pid = b.id
WHERE c.id = ?
ORDER BY a.inColumn, a.sorting')->execute($dataContainer->id);
while ($resultSet->next()) {
if (isset($GLOBALS['TL_LANG']['tl_article'][$resultSet->inColumn])) {
$sectionName = $GLOBALS['TL_LANG']['tl_article'][$resultSet->inColumn];
} else {
$sectionName = $resultSet->inColumn;
}
if (isset($GLOBALS['TL_LANG']['tl_article'][$sectionName])) {
$sectionName = $GLOBALS['TL_LANG']['tl_article'][$sectionName];
}
$options[$sectionName][$resultSet->id] = $resultSet->title;
}
}
示例2: handle
/**
* Get all provided config names for the backend config.
*
* @param GetMultipleConfigNamesEvent $event Event being handled.
*
* @return void
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
public static function handle(GetMultipleConfigNamesEvent $event)
{
$model = $event->getModel();
if ($model->type != 'form_widget') {
return;
}
if ($model->override) {
$typeManager = static::getTypeManager();
$names = $typeManager->getExistingNames($model->type);
// filter not existing values. basically to remove widgets which only exists in Contao 3.3 when being in
// Contao 3.2
$names = array_intersect($names, array_keys($GLOBALS['TL_FFL']));
} else {
$names = array_keys($GLOBALS['TL_FFL']);
}
\Controller::loadLanguageFile('tl_form_field');
$options = array();
foreach ($names as $name) {
if (isset($GLOBALS['TL_LANG']['FFL'][$name][0])) {
$options[$name] = $GLOBALS['TL_LANG']['FFL'][$name][0];
} else {
$options[$name] = $name;
}
}
$event->setOptions($options);
$event->stopPropagation();
}
示例3: __construct
/**
* Constructor
*/
public function __construct()
{
// If we are in the Backend-Mode use the BackendUser.
if (TL_MODE == 'FE') {
$this->user = \FrontendUser::getInstance();
} else {
$this->user = \BackendUser::getInstance();
}
// Language
\Controller::loadLanguageFile("default");
\Controller::loadLanguageFile('tl_synccto_clients');
// Instance a list for regex from the blacklist for folders.
$this->arrPreparedBlacklistFolder = array();
foreach ($this->getBlacklistFolder() as $key => $value) {
$this->arrPreparedBlacklistFolder[$key] = str_replace($this->arrSearch, $this->arrReplace, $value);
}
// Instance a list for regex from the blacklist for files.
$this->arrPreparedBlacklistFiles = array();
foreach ($this->getBlacklistFile() as $key => $value) {
$this->arrPreparedBlacklistFiles[$key] = str_replace($this->arrSearch, $this->arrReplace, $value);
}
// Instance a list for regex from the hidden table list.
$this->arrPreparedHiddenTablePlaceholder = array();
foreach ($this->getHiddenTablePlaceholder() as $key => $value) {
$this->arrPreparedHiddenTablePlaceholder[$key] = str_replace($this->arrSearch, $this->arrReplace, $value);
}
// Replace some elements in TL_ROOT for regex.
$this->strPreparedTlRoot = str_replace('\\', '\\\\', TL_ROOT);
}
示例4: getAllArticles
/**
* Get all articles and return them as array
* @param \DataContainer
* @return array
*/
public function getAllArticles(\DataContainer $dc)
{
$user = \BackendUser::getInstance();
$pids = array();
$articles = array();
// Limit pages to the user's pagemounts
if ($user->isAdmin) {
$objArticle = \Database::getInstance()->execute("SELECT a.id, a.pid, a.title, a.inColumn, p.title AS parent FROM tl_article a LEFT JOIN tl_page p ON p.id=a.pid ORDER BY parent, a.sorting");
} else {
foreach ($user->pagemounts as $id) {
$pids[] = $id;
$pids = array_merge($pids, \Database::getInstance()->getChildRecords($id, 'tl_page'));
}
if (empty($pids)) {
return $articles;
}
$objArticle = \Database::getInstance()->execute("SELECT a.id, a.pid, a.title, a.inColumn, p.title AS parent FROM tl_article a LEFT JOIN tl_page p ON p.id=a.pid WHERE a.pid IN(" . implode(',', array_map('intval', array_unique($pids))) . ") ORDER BY parent, a.sorting");
}
// Edit the result
if ($objArticle->numRows) {
\Controller::loadLanguageFile('tl_article');
while ($objArticle->next()) {
$key = $objArticle->parent . ' (ID ' . $objArticle->pid . ')';
$articles[$key][$objArticle->id] = $objArticle->title . ' (' . ($GLOBALS['TL_LANG']['tl_article'][$objArticle->inColumn] ?: $objArticle->inColumn) . ', ID ' . $objArticle->id . ')';
}
}
return $articles;
}
示例5: __construct
/**
* Construct.
*
* @param Manager $manager Data container manager.
* @param \Database $database Database connection.
* @param array $layers Leaflet layer configuration.
*/
public function __construct(Manager $manager, \Database $database, array $layers)
{
parent::__construct($manager);
$this->database = $database;
$this->layers = $layers;
\Controller::loadLanguageFile('leaflet_layer');
}
示例6: __construct
public function __construct($arrAttributes = null)
{
parent::__construct($arrAttributes);
\Controller::loadLanguageFile(\Config::get('fieldpalette_table'));
\Controller::loadLanguageFile($this->strTable);
$this->import('Database');
$this->arrDca = \HeimrichHannot\FieldPalette\FieldPalette::getDca($this->strTable, $this->strName);
$this->viewMode = $this->arrDca['list']['viewMode'] ?: 0;
}
示例7: __construct
/**
* Construct.
*
* @param Manager $manager Data container manager.
* @param \Database $database Database connection.
* @param Translator $translator Translator.
* @param array $layers Leaflet layer configuration.
* @param array $tileProviders Tile providers.
* @param array $amenities OSM amenities.
*/
public function __construct(Manager $manager, \Database $database, Translator $translator, array $layers, array $tileProviders, array $amenities)
{
parent::__construct($manager);
\Controller::loadLanguageFile('leaflet_layer');
$this->database = $database;
$this->layers = $layers;
$this->tileProviders = $tileProviders;
$this->translator = $translator;
$this->amenities = $amenities;
}
示例8: getFieldDefinition
/**
* {@inheritdoc}
*
* @SuppressWarnings(PHPMD.Superglobals)
* @SuppressWarnings(PHPMD.CamelCaseVariableName)
*/
public function getFieldDefinition($arrOverrides = array())
{
// Load the language files.
\Controller::loadLanguageFile('tl_metamodel_attribute');
\Controller::loadLanguageFile('default');
$arrFieldDef = parent::getFieldDefinition($arrOverrides);
$arrFieldDef['inputType'] = 'multiColumnWizard';
$arrFieldDef['eval'] = array('columnFields' => array('gp_mode' => array('inputType' => 'select', 'eval' => array('style' => 'width:180px', 'includeBlankOption' => true, 'columnPos' => 'first'), 'options' => array('gp_show' => $GLOBALS['TL_LANG']['tl_metamodel_attribute']['gp_show'], 'gp_hide' => $GLOBALS['TL_LANG']['tl_metamodel_attribute']['gp_hide'])), 'gp_countries' => array('inputType' => 'checkbox', 'options' => $this->getSelectedCountries(), 'eval' => array('multiple' => true, 'columnPos' => 'first'))), 'buttons' => array('copy' => false, 'delete' => false, 'up' => false, 'down' => false));
return $arrFieldDef;
}
示例9: outputBackendTemplate
public function outputBackendTemplate($content, $template)
{
if ($GLOBALS['TL_CONFIG']['live_system_warning_enabled']) {
\Controller::loadLanguageFile('live_system_warning');
$template = new \BackendTemplate('be_live_system_warning');
$template->url = $GLOBALS['TL_CONFIG']['live_system_warning_url'];
$content = preg_replace('~<body[^>]*>~', '$0' . $template->parse(), $content);
$content = str_replace('</head>', '<link rel="stylesheet" href="assets/live-system-warning/css/backend.css">
</head>', $content);
}
return $content;
}
示例10: getConfigTypes
/**
* Get config type options.
*
* @return array
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
public function getConfigTypes()
{
\Controller::loadLanguageFile('tl_bootstrap_config');
$options = array();
$collection = BootstrapConfigModel::findBy(array('(type = ? OR type=?)'), array('form_widget', 'form'), array('order' => 'name'));
if ($collection) {
foreach ($collection as $model) {
$type = isset($GLOBALS['TL_LANG']['bootstrap_config_type'][$model->type]) ? $GLOBALS['TL_LANG']['bootstrap_config_type'][$model->type] : $model->type;
$options[$model->id] = sprintf('%s (%s): %s %s (%s)', $model->getRelated('pid')->name, $model->pid, $type, $model->name, $model->id);
}
}
return $options;
}
示例11: getFilterFields
public function getFilterFields(\DataContainer $dataContainer)
{
\Controller::loadDataContainer('tl_calendar_events');
\Controller::loadLanguageFile('tl_calendar_events');
global $container, $TL_LANG;
$options = array('pid' => $TL_LANG['tl_module']['filterPropertyCalendar'], 'author' => $TL_LANG['tl_module']['filterPropertyAuthor'], 'startDate' => $TL_LANG['tl_module']['filterPropertyMonth']);
/** @var EventDispatcher $eventDispatcher */
$eventDispatcher = $container['event-dispatcher'];
$event = new GetFilterOptionsEvent();
$event->setOptions($options);
$eventDispatcher->dispatch(GetFilterOptionsEvent::NAME, $event);
return $event->getOptions();
}
示例12: __construct
/**
* Initialize the object
*
* @param \ParticipationModel $objConfig
*/
public function __construct($objConfig)
{
parent::__construct();
if ($objConfig instanceof \Model) {
$this->objModel = $objConfig;
} elseif ($objConfig instanceof \Model\Collection) {
$this->objModel = $objConfig->current();
}
$this->arrData = $objConfig->row();
\Controller::loadDataContainer($objConfig->type);
\Controller::loadLanguageFile('default');
$this->strTable = $objConfig->type;
$this->ptable = $GLOBALS['TL_DCA'][$this->strTable]['config']['ptable'];
$this->ctable = $GLOBALS['TL_DCA'][$this->strTable]['config']['ctable'];
}
示例13: __construct
/**
* Initialize the object
*
* @param \ParticipationModel $objParticipation
*/
public function __construct($objParticipation)
{
parent::__construct();
if ($objParticipation instanceof \Model) {
$this->objParticipation = $objParticipation;
} elseif ($objParticipation instanceof \Model\Collection) {
$this->objParticipation = $objParticipation->current();
}
$this->objParticipationArchive = $this->objParticipation->getRelated('pid');
$this->arrData = $objParticipation->row();
\Controller::loadDataContainer($objParticipation->targetType);
\Controller::loadLanguageFile('default');
$this->strTable = $objParticipation->targetType;
$this->ptable = $GLOBALS['TL_DCA'][$this->targetType]['config']['ptable'];
$this->ctable = $GLOBALS['TL_DCA'][$this->targetType]['config']['ctable'];
}
示例14: createDataContainer
/**
* Create the data container of a metamodel table.
*
* @param string $strTableName the name of the meta model table that shall be created.
*
* @return bool true on success, false otherwise.
*/
public function createDataContainer($strTableName)
{
if (!in_array($strTableName, MetaModelFactory::getAllTables())) {
return false;
}
// call the loadDataContainer from Controller.php for the base DCA.
parent::loadDataContainer('tl_metamodel_item');
parent::loadLanguageFile('tl_metamodel_item');
$GLOBALS['TL_DCA'][$strTableName] = array_replace_recursive($GLOBALS['TL_DCA']['tl_metamodel_item'], (array) $GLOBALS['TL_DCA'][$strTableName]);
$arrDCA =& $GLOBALS['TL_DCA'][$strTableName];
$arrDCA['dca_config']['data_provider']['default']['source'] = $strTableName;
$objMetaModel = MetaModelFactory::byTableName($strTableName);
if ($objMetaModel->isTranslated()) {
$this->loadLanguageFile('languages');
}
$arrDCASettings = MetaModelDcaBuilder::getInstance()->getDca($objMetaModel->get('id'));
$arrViewSettings = MetaModelDcaBuilder::getInstance()->getView($objMetaModel->get('id'));
if (!$arrDCASettings) {
$strMessage = sprintf($GLOBALS['TL_LANG']['ERR']['no_palette'], $objMetaModel->getName(), self::getUser()->username);
MetaModelBackendModule::addMessageEntry($strMessage, METAMODELS_ERROR, $this->addToUrl('do=metamodels&table=tl_metamodel_dca&id=' . $objMetaModel->get('id')));
$this->log($strMessage, 'MetaModelDatabase createDataContainer()', TL_ERROR);
return true;
}
if (!$arrViewSettings) {
$strMessage = sprintf($GLOBALS['TL_LANG']['ERR']['no_view'], $objMetaModel->getName(), self::getUser()->username);
MetaModelBackendModule::addMessageEntry($strMessage, METAMODELS_ERROR, $this->addToUrl('do=metamodels&table=tl_metamodel_rendersettings&id=' . $objMetaModel->get('id')));
$this->log($strMessage, 'MetaModelDatabase createDataContainer()', TL_ERROR);
return true;
}
$arrDCA['config']['metamodel_view'] = $arrViewSettings['id'];
$arrDCA['palettes']['default'] = $this->getPaletteAndFields($arrDCASettings['id'], $objMetaModel, $arrDCA);
if ($arrDCASettings['backendcaption']) {
$arrCaptions = deserialize($arrDCASettings['backendcaption'], true);
foreach ($arrCaptions as $arrLangEntry) {
if ($arrLangEntry['label'] != '' && $arrLangEntry['langcode'] == $objMetaModel->getActiveLanguage()) {
$arrDCA['config']['label'] = $arrLangEntry['label'];
} else {
if ($arrLangEntry['label'] != '' && !$arrDCA['config']['label'] && $arrLangEntry['langcode'] == $objMetaModel->getFallbackLanguage()) {
$arrDCA['config']['label'] = $arrLangEntry['label'];
}
}
}
}
if (!$arrDCA['config']['label']) {
$arrDCA['config']['label'] = $objMetaModel->get('name');
}
// Check access level.
if ($arrDCASettings['isclosed']) {
$arrDCA['config']['closed'] = true;
$arrDCA['config']['notDeletable'] = true;
unset($arrDCA['list']['operations']['delete']);
}
// FIXME: if we have variants, we force mode 5 here, no matter what the DCA configs say.
if ($objMetaModel->hasVariants()) {
$this->createDataContainerWithVariants($objMetaModel, $arrDCASettings, $arrDCA);
} else {
$this->createDataContainerNormal($objMetaModel, $arrDCASettings, $arrDCA);
}
$GLOBALS['TL_LANG'][$objMetaModel->getTableName()] = array_replace_recursive($GLOBALS['TL_LANG']['tl_metamodel_item'], (array) $GLOBALS['TL_LANG'][$objMetaModel->getTableName()]);
// TODO: add a HOOK here for extensions to manipulate the DCA. loadMetaModelDataContainer($objMetaModel)
//$GLOBALS['METAMODEL_HOOKS']['loadDataContainer']
return true;
}
示例15: array
<?php
/**
* xNavigation - Highly extendable and flexible navigation module for the Contao Open Source CMS
*
* Copyright (C) 2013 bit3 UG <http://bit3.de>
*
* @package xNavigation
* @author Tristan Lins <tristan.lins@bit3.de>
* @link http://www.themeplus.de
* @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL
*/
\Controller::loadLanguageFile('xnavigation_condition');
\Controller::loadLanguageFile('xnavigation_provider');
/**
* Table tl_xnavigation_condition
*/
$GLOBALS['TL_DCA']['tl_xnavigation_condition'] = array('config' => array('dataContainer' => 'Table', 'enableVersioning' => true, 'sql' => array('keys' => array('id' => 'primary', 'pid' => 'index', 'type' => 'index'))), 'list' => array('sorting' => array('mode' => 5, 'icon' => 'system/modules/xnavigation/assets/images/condition.png', 'paste_button_callback' => array('Bit3\\Contao\\XNavigation\\DataContainer\\Condition', 'pasteButton'), 'panelLayout' => 'filter'), 'label' => array('fields' => array('type', 'title'), 'label_callback' => array('Bit3\\Contao\\XNavigation\\DataContainer\\Condition', 'getLabel')), 'global_operations' => array('create_default_condition' => array('label' => &$GLOBALS['TL_LANG']['tl_xnavigation_condition']['create_default_condition'], 'href' => 'key=create_default_condition', 'class' => 'header_new', 'attributes' => 'onclick="Backend.getScrollOffset();"'), 'menus' => array('label' => &$GLOBALS['TL_LANG']['tl_xnavigation_condition']['menus'], 'href' => 'table=tl_xnavigation_menu', 'class' => 'header_xnavigation_menus', 'attributes' => 'onclick="Backend.getScrollOffset();" accesskey="m"'), 'providers' => array('label' => &$GLOBALS['TL_LANG']['tl_xnavigation_condition']['providers'], 'href' => 'table=tl_xnavigation_provider', 'class' => 'header_xnavigation_providers', 'attributes' => 'onclick="Backend.getScrollOffset();" accesskey="p"'), 'all' => array('label' => &$GLOBALS['TL_LANG']['MSC']['all'], 'href' => 'act=select', 'class' => 'header_edit_all', 'attributes' => 'onclick="Backend.getScrollOffset();" accesskey="e"')), 'operations' => array('edit' => array('label' => &$GLOBALS['TL_LANG']['tl_xnavigation_condition']['edit'], 'href' => 'act=edit', 'icon' => 'edit.gif'), 'copy' => array('label' => &$GLOBALS['TL_LANG']['tl_xnavigation_condition']['copy'], 'href' => 'act=copy', 'icon' => 'copy.gif'), 'copyChilds' => array('label' => &$GLOBALS['TL_LANG']['tl_xnavigation_condition']['copyChilds'], 'href' => 'act=paste&mode=copy&childs=1', 'icon' => 'copychilds.gif', 'attributes' => 'onclick="Backend.getScrollOffset()"'), 'cut' => array('label' => &$GLOBALS['TL_LANG']['tl_xnavigation_condition']['cut'], 'href' => 'act=paste&mode=cut', 'icon' => 'cut.gif', 'attributes' => 'onclick="Backend.getScrollOffset()"'), 'delete' => array('label' => &$GLOBALS['TL_LANG']['tl_xnavigation_condition']['delete'], 'href' => 'act=delete', 'icon' => 'delete.gif', 'attributes' => 'onclick="if (!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] . '\')) return false; Backend.getScrollOffset();"'), 'show' => array('label' => &$GLOBALS['TL_LANG']['tl_xnavigation_condition']['show'], 'href' => 'act=show', 'icon' => 'show.gif'))), 'palettes' => array('__selector__' => array('type')), 'metapalettes' => array('default' => array('condition' => array('type')), 'parent' => array('condition' => array('type', 'title')), 'and' => array('condition' => array('type', 'title'), 'settings' => array('invert')), 'or' => array('condition' => array('type', 'title'), 'settings' => array('invert')), 'item_type' => array('condition' => array('type', 'title'), 'type' => array('item_type_accepted_type'), 'settings' => array('invert')), 'level' => array('condition' => array('type', 'title'), 'settings' => array('level_min', 'level_max', 'invert')), 'member_login' => array('condition' => array('type', 'title'), 'settings' => array('member_login_accepted_login_status', 'invert')), 'link' => array('condition' => array('type', 'title'), 'settings' => array('link_condition_id', 'invert'))), 'fields' => array('id' => array('sql' => "int(10) unsigned NOT NULL auto_increment"), 'pid' => array('sql' => "int(10) unsigned NOT NULL default '0'"), 'sorting' => array('sql' => "int(10) unsigned NOT NULL default '0'"), 'tstamp' => array('sql' => "int(10) unsigned NOT NULL default '0'"), 'type' => array('label' => &$GLOBALS['TL_LANG']['tl_xnavigation_condition']['type'], 'inputType' => 'select', 'filter' => true, 'sorting' => true, 'flag' => 11, 'options' => array_keys($GLOBALS['XNAVIGATION_CONDITION']), 'reference' => &$GLOBALS['TL_LANG']['xnavigation_condition'], 'eval' => array('mandatory' => true, 'chosen' => true, 'helpwizard' => true, 'includeBlankOption' => true, 'submitOnChange' => true, 'tl_class' => 'w50'), 'sql' => "varchar(32) NOT NULL default ''"), 'title' => array('label' => &$GLOBALS['TL_LANG']['tl_xnavigation_condition']['title'], 'inputType' => 'text', 'search' => true, 'sorting' => true, 'flag' => 1, 'eval' => array('tl_class' => 'w50', 'maxlength' => 255), 'sql' => "varchar(255) NOT NULL default ''"), 'item_type_accepted_type' => array('label' => &$GLOBALS['TL_LANG']['tl_xnavigation_condition']['item_type_accepted_type'], 'inputType' => 'select', 'options' => array_keys($GLOBALS['XNAVIGATION_PROVIDER']), 'reference' => &$GLOBALS['TL_LANG']['xnavigation_provider'], 'eval' => array('tl_class' => 'w50', 'includeBlankOption' => true, 'mandatory' => true), 'sql' => "varchar(64) NOT NULL default ''"), 'level_min' => array('label' => &$GLOBALS['TL_LANG']['tl_xnavigation_condition']['level_min'], 'inputType' => 'text', 'eval' => array('tl_class' => 'w50', 'maxlength' => 10, 'rgxp' => 'digit'), 'sql' => "char(10) NOT NULL default ''"), 'level_max' => array('label' => &$GLOBALS['TL_LANG']['tl_xnavigation_condition']['level_max'], 'inputType' => 'text', 'eval' => array('tl_class' => 'w50', 'maxlength' => 10, 'rgxp' => 'digit'), 'sql' => "char(10) NOT NULL default ''"), 'member_login_accepted_login_status' => array('label' => &$GLOBALS['TL_LANG']['tl_xnavigation_condition']['member_login_accepted_login_status'], 'inputType' => 'select', 'options' => array('logged_in', 'logged_out'), 'reference' => &$GLOBALS['TL_LANG']['tl_xnavigation_condition']['member_login_accepted_login_statuses'], 'eval' => array('mandatory' => true, 'tl_class' => 'w50'), 'sql' => "varchar(10) NOT NULL default ''"), 'link_condition_id' => array('label' => &$GLOBALS['TL_LANG']['tl_xnavigation_condition']['link_condition_id'], 'inputType' => 'select', 'options_callback' => array('Bit3\\Contao\\XNavigation\\DataContainer\\OptionsBuilder', 'getConditionOptions'), 'eval' => array('includeBlankOption' => true, 'mandatory' => true, 'tl_class' => 'w50'), 'sql' => "varchar(10) NOT NULL default ''"), 'invert' => array('label' => &$GLOBALS['TL_LANG']['tl_xnavigation_condition']['invert'], 'inputType' => 'checkbox', 'eval' => array('tl_class' => 'w50 m12'), 'sql' => "char(1) NOT NULL default ''")));