当前位置: 首页>>代码示例>>PHP>>正文


PHP Controller::loadDataContainer方法代码示例

本文整理汇总了PHP中Controller::loadDataContainer方法的典型用法代码示例。如果您正苦于以下问题:PHP Controller::loadDataContainer方法的具体用法?PHP Controller::loadDataContainer怎么用?PHP Controller::loadDataContainer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Controller的用法示例。


在下文中一共展示了Controller::loadDataContainer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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>';
         };
     }
 }
开发者ID:ralfhartmann,项目名称:isotope_core,代码行数:38,代码来源:Permission.php

示例2: 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'];
     }
 }
开发者ID:rhymedigital,项目名称:isotope_direct,代码行数:34,代码来源:Sorting.php

示例3: addShareFields

 public static function addShareFields($strDca)
 {
     \Controller::loadDataContainer($strDca);
     $arrDca =& $GLOBALS['TL_DCA'][$strDca];
     $arrDca['fields']['shareToken'] = array('eval' => array('doNotCopy' => true), 'sql' => "varchar(23) NOT NULL default ''");
     $arrDca['fields']['shareTokenTime'] = array('eval' => array('doNotCopy' => true), 'sql' => "int(10) unsigned NOT NULL default '0'");
 }
开发者ID:heimrichhannot,项目名称:contao-formhybrid_list,代码行数:7,代码来源:FormHybridList.php

示例4: getFilter

 public function getFilter($objModule)
 {
     \Controller::loadDataContainer('tl_calendar_events');
     $arrFilter = array();
     $arrFields = deserialize($objModule->formHybridEditable, true);
     // Return if there are no fields
     if (!is_array($arrFields) || empty($arrFields)) {
         return $arrFilter;
     }
     $objHelper = new EventFilterHelper();
     $arrEventTypeArchives = deserialize($objModule->cal_eventTypesArchive, true);
     foreach ($arrFields as $strKey) {
         $arrData = $GLOBALS['TL_DCA']['tl_calendar_events']['fields'][$strKey];
         if (!is_array($arrData) || empty($arrData)) {
             continue;
         }
         $arrFilter[$strKey] = $objHelper->getValueByDca(\Input::get($strKey), $arrData);
         if (!$objModule->cal_combineEventTypesArchive && count($arrEventTypeArchives) > 0 && strrpos($strKey, 'eventtypes', -strlen($strKey)) !== FALSE) {
             // unset eventtypes
             unset($arrFilter[$strKey]);
             // use multiple eventtypes
             foreach ($arrEventTypeArchives as $intArchive) {
                 $strArchiveKey = $strKey . '_' . $intArchive;
                 $arrFilter[$strArchiveKey] = $objHelper->getValueByDca(\Input::get($strArchiveKey), $arrData);
             }
         }
     }
     return $arrFilter;
 }
开发者ID:heimrichhannot,项目名称:contao-calendar_plus,代码行数:29,代码来源:EventsPlus.php

示例5: 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();
 }
开发者ID:intelligentspark,项目名称:isotope_checkout_step_order_notes,代码行数:37,代码来源:OrderNotes.php

示例6: run

 public static function run()
 {
     $objDatabase = \Database::getInstance();
     \Controller::loadDataContainer('tl_module');
     $arrRenameFields = array('tl_module' => array('jumpToSuccess' => array('name' => 'jumpTo', 'syncValue' => true), 'jumpToSuccessPreserveParams' => array('name' => 'formHybridJumpToPreserveParams', 'syncValue' => false), 'allowIdAsGetParameter' => array('name' => 'formHybridAllowIdAsGetParameter', 'syncValue' => true), 'idGetParameter' => array('name' => 'formHybridIdGetParameter', 'syncValue' => true), 'appendIdToUrlOnCreation' => array('name' => 'formHybridAppendIdToUrlOnCreation', 'syncValue' => true)));
     foreach ($arrRenameFields as $strTable => $arrFields) {
         if (!$objDatabase->tableExists($strTable)) {
             continue;
         }
         foreach ($arrFields as $strOldName => $arrConfig) {
             if (!$objDatabase->fieldExists($strOldName, $strTable)) {
                 continue;
             }
             $strNewName = $arrConfig['name'];
             $sql =& $GLOBALS['TL_DCA']['tl_module']['fields'][$strNewName]['sql'];
             if (!$objDatabase->fieldExists($arrConfig['name'], $strTable) && $sql) {
                 $sql =& $GLOBALS['TL_DCA']['tl_module']['fields'][$strNewName]['sql'];
                 $objDatabase->query("ALTER TABLE {$strTable} ADD `{$strNewName}` {$sql}");
             }
             if (!$arrConfig['syncValue']) {
                 continue;
             }
             $objDatabase->prepare('UPDATE ' . $strTable . ' SET ' . $arrConfig['name'] . ' = ' . $strOldName)->execute();
         }
     }
     return;
 }
开发者ID:heimrichhannot,项目名称:contao-formhybrid,代码行数:27,代码来源:DatabaseUpdater.php

示例7: run

 public function run($blnInstalled)
 {
     if ($blnInstalled) {
         \Controller::loadDataContainer('tl_iso_product');
         $arrFields = array();
         foreach ($GLOBALS['TL_DCA']['tl_iso_product']['fields'] as $field => $config) {
             if ($config['inputType'] == 'mediaManager') {
                 $arrFields[] = $field;
             }
         }
         if (empty($arrFields)) {
             return;
         }
         $objProducts = \Database::getInstance()->query("\n                SELECT * FROM tl_iso_product WHERE language=''\n            ");
         while ($objProducts->next()) {
             foreach ($arrFields as $field) {
                 $arrUpdate = array();
                 $arrData = deserialize($objProducts->{$field});
                 if (!empty($arrData) && is_array($arrData)) {
                     foreach ($arrData as $k => $image) {
                         if ($image['translate'] == '') {
                             $arrData[$k]['translate'] = 'none';
                         }
                     }
                     $arrUpdate[$field] = serialize($arrData);
                 }
             }
             if (!empty($arrUpdate)) {
                 \Database::getInstance()->prepare("UPDATE tl_iso_product %s WHERE id=?")->set($arrUpdate)->execute($objProducts->id);
             }
         }
     }
 }
开发者ID:ralfhartmann,项目名称:isotope_core,代码行数:33,代码来源:To0020010064.php

示例8: run

 public static function run()
 {
     $objDatabase = \Database::getInstance();
     \Controller::loadDataContainer('tl_extcss');
     $arrFields = array('tl_extcss' => array('bootstrapVariablesSRC', 'observeFolderSRC'), 'tl_extcss_file' => array('src'), 'tl_extjs_file' => array('src'));
     if (version_compare(VERSION, '3.2', '>=')) {
         foreach ($arrFields as $strTable => $arrNames) {
             if (!$objDatabase->tableExists($strTable)) {
                 continue;
             }
             // convert file fields
             foreach ($objDatabase->listFields($strTable) as $arrField) {
                 // with extassets 1.1.1 bootstrapVariablesSRC changed to variablesSRC
                 if ($arrField['name'] == 'bootstrapVariablesSRC') {
                     if (!$objDatabase->fieldExists('variablesSRC', $strTable)) {
                         $sql =& $GLOBALS['TL_DCA']['tl_extcss']['fields']['variablesSRC']['sql'];
                         $objDatabase->query("ALTER TABLE {$strTable} ADD `variablesSRC` {$sql}");
                         $sql =& $GLOBALS['TL_DCA']['tl_extcss']['fields']['variablesOrderSRC']['sql'];
                         $objDatabase->query("ALTER TABLE {$strTable} ADD `variablesOrderSRC` {$sql}");
                     }
                     $objGroups = $objDatabase->execute('SELECT * FROM ' . $strTable . ' WHERE bootstrapVariablesSRC IS NOT NULL AND variablesSRC IS NULL');
                     while ($objGroups->next()) {
                         $variables = serialize(array($objGroups->bootstrapVariablesSRC));
                         $objDatabase->prepare('UPDATE ' . $strTable . ' SET variablesSRC = ?, variablesOrderSRC = ? WHERE id = ?')->execute($variables, $variables, $objGroups->id);
                     }
                     $objDatabase->query("ALTER TABLE {$strTable} DROP `bootstrapVariablesSRC`");
                 }
                 if (in_array($arrField['name'], $arrNames)) {
                     \Database\Updater::convertSingleField($strTable, $arrField['name']);
                 }
             }
         }
     }
     return;
 }
开发者ID:heimrichhannot,项目名称:contao-extassets,代码行数:35,代码来源:ExtAssetsUpdater.php

示例9: __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');
     }
 }
开发者ID:bytehead,项目名称:core,代码行数:13,代码来源:Address.php

示例10: getSqlForField

 /**
  * Get SQL statement for a DCA field
  *
  * @param $strField
  * @param $strTable
  *
  * @return string
  */
 private function getSqlForField($strField, $strTable)
 {
     \Controller::loadDataContainer($strTable);
     $strSql = (string) $GLOBALS['TL_DCA'][$strTable]['fields'][$strField]['sql'];
     if ($strSql == '') {
         throw new \LogicException('Field "' . $strField . '" is not defined in "' . $strTable . '"');
     }
     return $strSql;
 }
开发者ID:ralfhartmann,项目名称:isotope_core,代码行数:17,代码来源:Base.php

示例11: loadDataContainerHook

 /**
  * Add fieldpalette fields to tl_fieldpalette
  *
  * @param string $strTable
  *
  * @return boolean false if Datacontainer not supported
  */
 public function loadDataContainerHook($strTable)
 {
     if ($strTable !== \Config::get('fieldpalette_table')) {
         \Controller::loadDataContainer(\Config::get('fieldpalette_table'));
     }
     $dc =& $GLOBALS['TL_DCA'][\Config::get('fieldpalette_table')];
     // dynamically set fieldpalette fields from parent table
     if ($strTable == \Config::get('fieldpalette_table') && \Input::get('table') == \Config::get('fieldpalette_table')) {
         return FieldPalette::loadDynamicPaletteByParentTable(\Input::get('act'), $strTable, $dc);
     }
     FieldPalette::registerFieldPalette($dc, $strTable, $strTable);
 }
开发者ID:heimrichhannot,项目名称:contao-fieldpalette,代码行数:19,代码来源:FieldPaletteHooks.php

示例12: prepareData

 public static function prepareData(\Model $objModel, $strTable, array $arrDca = array(), $objDc = null, $arrFields = array(), array $arrSkipFields = array())
 {
     if ($objDc === null) {
         $objDc = DC_Table::getInstanceFromModel($objModel);
     }
     if (empty($arrDca)) {
         \Controller::loadDataContainer($objModel->getTable());
         $arrDca = $GLOBALS['TL_DCA'][$objModel->getTable()];
     }
     $arrSubmissionData = array();
     $arrRow = $objModel->row();
     $arrSubmission = array();
     foreach (array_keys($arrRow) as $strName) {
         $varValue = $arrRow[$strName];
         if (empty($varValue)) {
             continue;
         }
         $arrData = $arrDca['fields'][$strName];
         $arrFieldData = static::prepareDataField($strName, $varValue, $arrData, $strTable, $objDc);
         $arrSubmissionData[$strName] = $arrFieldData;
         $strSubmission = $arrFieldData['submission'];
         $varValue = deserialize($varValue);
         // multicolumnwizard support
         if ($arrData['inputType'] == 'multiColumnWizard') {
             foreach ($varValue as $arrSet) {
                 if (!is_array($arrSet)) {
                     continue;
                 }
                 // new line
                 $strSubmission .= "\n";
                 foreach ($arrSet as $strSetName => $strSetValue) {
                     $arrSetData = $arrData['eval']['columnFields'][$strSetName];
                     $arrFieldData = static::prepareDataField($strSetName, $strSetValue, $arrSetData, $strTable, $objDc);
                     // intend new line
                     $strSubmission .= "\t" . $arrFieldData['submission'];
                 }
                 // new line
                 $strSubmission .= "\n";
             }
         }
         $arrSubmissionData['submission_all'] .= $strSubmission;
         if (in_array($strName, $arrFields) && !in_array($strName, $arrSkipFields)) {
             $arrSubmission[$strName] = $strSubmission;
         }
     }
     // order submission by arrFields
     $strSubmissionAll = '';
     foreach ($arrFields as $strName) {
         $strSubmissionAll .= $arrSubmission[$strName];
     }
     $arrSubmissionData['submission'] = $strSubmissionAll;
     return $arrSubmissionData;
 }
开发者ID:heimrichhannot,项目名称:contao-haste_plus,代码行数:53,代码来源:FormSubmission.php

示例13: 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();
 }
开发者ID:contaoblackforest,项目名称:contao-calendar-filter,代码行数:13,代码来源:Module.php

示例14: adjustPalettesForLists

 public static function adjustPalettesForLists(\DataContainer $objDc)
 {
     \Controller::loadDataContainer('tl_module');
     \System::loadLanguageFile('tl_module');
     if (($objModule = \ModuleModel::findByPk($objDc->id)) !== null) {
         $arrDca =& $GLOBALS['TL_DCA']['tl_module'];
         if (\HeimrichHannot\Haste\Util\Module::isSubModuleOf($objModule->type, 'HeimrichHannot\\FrontendEdit\\ModuleList')) {
             $arrDca['palettes'][MODULE_FRONTENDEDIT_MEMBER_LIST] = str_replace('filterArchives', 'filterGroups', $arrDca['palettes'][MODULE_FRONTENDEDIT_MEMBER_LIST]);
             // override labels for suiting a list module
             $arrDca['fields']['formHybridAddDefaultValues']['label'] =& $GLOBALS['TL_LANG']['tl_module']['formHybridAddDefaultFilterValues'];
             $arrDca['fields']['formHybridDefaultValues']['label'] =& $GLOBALS['TL_LANG']['tl_module']['formHybridDefaultFilterValues'];
         }
     }
 }
开发者ID:heimrichhannot,项目名称:contao-frontendedit,代码行数:14,代码来源:tl_module.php

示例15: createObjectFromMapping

 protected function createObjectFromMapping($arrSourceItem)
 {
     $objDatabase = \Database::getInstance();
     \Controller::loadDataContainer($this->dbTargetTable);
     $t = $this->dbTargetTable;
     $arrItem = array();
     foreach (deserialize($this->fileFieldMapping, true) as $arrConfig) {
         if ($arrConfig['type'] == 'source') {
             $varValue = $arrSourceItem[$arrConfig['source'] - 1];
         } else {
             if ($arrConfig['type'] == 'value' && !empty($arrConfig['value'])) {
                 $varValue = $arrConfig['value'];
             }
         }
         if ($varValue) {
             $varValue = $arrConfig['transformToArray'] ? serialize(explode($this->arrayDelimiter, $varValue)) : $varValue;
         }
         $this->setObjectValueFromMapping($arrItem, $varValue, $arrConfig['target']);
         if ($varValue === null) {
             unset($arrItem[$arrConfig['target']]);
             continue;
         }
     }
     if (!$this->dryRun) {
         if (!$this->skipInsertion) {
             $strQuery = "INSERT INTO {$t} (" . implode(',', array_keys($arrItem)) . ") VALUES(" . implode(',', array_map(function ($val) {
                 return "'" . str_replace("'", "''", $val) . "'";
             }, array_values($arrItem))) . ")";
             $arrItem['id'] = $objDatabase->execute($strQuery)->insertId;
         }
         // do after item has been created,
         $this->runAfterSaving($arrItem, $arrSourceItem);
         // save updates
         if (!$this->skipUpdateAfterSave) {
             $arrTargetItemPrepared = array();
             foreach ($arrItem as $strKey => $strVal) {
                 if ($strKey == 'id') {
                     continue;
                 }
                 $strVal = str_replace("'", "''", $strVal);
                 $arrTargetItemPrepared[] = "{$this->dbTargetTable}.{$strKey}='{$strVal}'";
             }
             // update all values to the db
             $strQuery = "UPDATE {$this->dbTargetTable} SET " . implode(',', $arrTargetItemPrepared) . " WHERE id=" . $arrItem['id'];
             \Database::getInstance()->execute($strQuery);
         }
     }
     return $arrItem;
 }
开发者ID:heimrichhannot,项目名称:contao-entity_import,代码行数:49,代码来源:CsvImporter.php


注:本文中的Controller::loadDataContainer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。