Example #1
0
 /**
  * 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');
 }
 /**
  * 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();
 }
Example #3
0
 /**
  * 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>';
         };
     }
 }
Example #4
0
 /**
  * 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');
 }
 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;
 }
Example #6
0
 /**
  * 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'];
 }
Example #7
0
 /**
  * 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;
 }
Example #8
0
 /**
  * @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;
 }
Example #9
0
 /**
  * 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;
 }
Example #10
0
 /**
  * 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'];
     }
 }
 /**
  * @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&amp;act=edit&amp;id=%1$u&amp;popup=1&amp;nb=1&amp;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;
 }
Example #12
0
 /**
  * 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');
     }
 }
Example #13
0
 public function __construct(\Database\Result $objResult = null)
 {
     parent::__construct($objResult);
     if (!is_array($GLOBALS['ISO_ADR'])) {
         Haste::getInstance()->call('loadDataContainer', static::$strTable);
         \System::loadLanguageFile('addresses');
     }
 }
Example #14
0
 /**
  * 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');
 }
Example #15
0
 /**
  * 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();
 }
 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);
 }
 /**
  * __construct function.
  *
  * @access protected
  * @return void
  */
 protected function __construct()
 {
     parent::__construct();
     // Load language file
     \System::loadLanguageFile('default');
     // Set static urls
     $this->setStaticUrls();
     // Init response
     $this->response = new JsonResponse();
 }
 public function getTableHeader(\DataContainer $dc)
 {
     \System::loadLanguageFile('tl_anystores');
     $arrLabels = array();
     $arrFields = \DcaExtractor::getInstance('tl_anystores')->getFields();
     foreach ($arrFields as $key => $value) {
         $arrLabels[$key] = $GLOBALS['TL_LANG']['tl_anystores'][$key][0] ?: $key;
     }
     return $arrLabels;
 }
Example #19
0
 /**
  * Generate module:
  * - Display a wildcard in the back end
  * - Declare actionlist with templates and compilers in the front end
  * @return string
  */
 public function generate()
 {
     if (!extension_loaded('soap')) {
         System::loadLanguageFile('tl_repository');
         return '<p class="tl_empty">' . $GLOBALS['TL_LANG']['tl_repository']['missingSoapModule'] . '</p>';
     }
     // if
     $this->actions = array(array('', 'repository_catlist', 'listExtensions'), array('view', 'repository_catview', 'viewExtension'));
     return parent::generate();
 }
Example #20
0
 /**
  * Initialize the controller.
  *
  * Sequence is:
  * 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()
 {
     \BackendUser::getInstance();
     \Config::getInstance();
     \Session::getInstance();
     \Database::getInstance();
     \BackendUser::getInstance()->authenticate();
     \System::loadLanguageFile('default');
     \Backend::setStaticUrls();
 }
Example #21
0
 /**
  * Initialize the controller
  */
 public function __construct()
 {
     $this->import('Config');
     $this->import('Session');
     Config::set('showHelp', false);
     Config::set('displayErrors', false);
     $this->setStaticUrls();
     System::loadLanguageFile('default');
     System::loadLanguageFile('tl_install');
 }
 /**
  * Spread Fields to existing DataContainers
  * @param string $strName
  * @return boolean false if Datacontainer not supported
  */
 public function loadDataContainerHook($strName)
 {
     if (!is_array($GLOBALS['TL_OWLCAROUSEL']['SUPPORTED']) || !in_array($strName, array_keys($GLOBALS['TL_OWLCAROUSEL']['SUPPORTED']))) {
         return false;
     }
     $this->loadDataContainer(static::$strSpreadDca);
     if (!is_array($GLOBALS['TL_DCA'][static::$strSpreadDca]['fields'])) {
         return false;
     }
     $dc =& $GLOBALS['TL_DCA'][$strName];
     foreach ($GLOBALS['TL_OWLCAROUSEL']['SUPPORTED'][$strName] as $strPalette => $replace) {
         $arrFields = array();
         $arrFieldKeys = array();
         $arrSelectors = array();
         $arrSubFields = array();
         preg_match_all('#\\[\\[(?P<constant>.+)\\]\\]#', $replace, $matches);
         if (!isset($matches['constant'][0])) {
             continue;
         }
         $strConstant = $matches['constant'][0];
         $strReplacePalette = @constant($matches['constant'][0]);
         $pos = strpos($replace, '[[' . $strConstant . ']]');
         $search = str_replace('[[' . $strConstant . ']]', '', $replace);
         // prepend owl config palette
         if ($pos < 1) {
             $replace = $GLOBALS['TL_DCA'][static::$strSpreadDca]['palettes'][$strReplacePalette] . $search;
         } else {
             $replace = $search . $GLOBALS['TL_DCA'][static::$strSpreadDca]['palettes'][$strReplacePalette];
         }
         $arrFields = static::getPaletteFields($strReplacePalette, $dc);
         $arrFieldKeys = array_keys($arrFields);
         // inject palettes
         // create palette if not existing
         if (!isset($dc['palettes'][$strPalette])) {
             $dc['palettes'][$strPalette] = $replace;
         } else {
             $dc['palettes'][$strPalette] = str_replace($search, $replace, $dc['palettes'][$strPalette]);
         }
         // inject subplattes & selectors
         $arrSelectors = array_intersect($GLOBALS['TL_DCA'][static::$strSpreadDca]['palettes']['__selector__'], $arrFieldKeys);
         if (!empty($arrSelectors)) {
             $dc['palettes']['__selector__'] = array_merge(is_array($dc['palettes']['__selector__']) ? $dc['palettes']['__selector__'] : array(), $arrSelectors);
             foreach ($arrSelectors as $key) {
                 $arrFields = array_merge($arrFields, static::getPaletteFields($key, $dc, 'subpalettes'));
             }
             $dc['subpalettes'] = array_merge(is_array($dc['subpalettes']) ? $dc['subpalettes'] : array(), $GLOBALS['TL_DCA'][static::$strSpreadDca]['subpalettes']);
         }
         // inject fields
         $dc['fields'] = array_merge($arrFields, $dc['fields']);
     }
     \System::loadLanguageFile(static::$strSpreadDca);
     // add language to TL_LANG palette
     $GLOBALS['TL_LANG'][$strName] = array_merge($GLOBALS['TL_LANG'][$strName], $GLOBALS['TL_LANG'][static::$strSpreadDca]);
 }
Example #23
0
 public function generate()
 {
     \System::loadLanguageFile('iso_upgrade');
     $this->Template = new \BackendTemplate($this->strTemplate);
     $this->Template->base = \Environment::get('base');
     $this->Template->action = \Environment::get('request');
     $this->Template->slabel = $GLOBALS['TL_LANG']['UPG']['submit'];
     $this->compile();
     $this->Template->output();
     exit;
 }
 /**
  * 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');
     $strFile = \Input::get('src', true);
     $strFile = base64_decode($strFile);
     $strFile = preg_replace('@^/+@', '', rawurldecode($strFile));
     $this->strFile = $strFile;
 }
 /**
  * Load the database object
  * @param array
  */
 public function __construct($arrAttributes = null)
 {
     $this->import('Database');
     parent::__construct($arrAttributes);
     if (!$this->foreignTable) {
         throw new \Exception('The foreign table is not specified');
     }
     $this->loadDataContainer($this->foreignTable);
     \System::loadLanguageFile($this->foreignTable);
     // Add the scripts
     $GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/widget_tree_picker/assets/treepicker.min.js';
 }
Example #26
0
 /**
  * Show a hint if a JavaScript library needs to be included in the page layout
  */
 public function showJsLibraryHint()
 {
     if ($_POST || Input::get('act') != 'edit') {
         return;
     }
     // Return if the user cannot access the layout module (see #6190)
     if (!$this->User->hasAccess('themes', 'modules') || !$this->User->hasAccess('layout', 'themes')) {
         return;
     }
     System::loadLanguageFile('tl_layout');
     Message::addInfo(sprintf($GLOBALS['TL_LANG']['tl_image_size']['picturefill'], $GLOBALS['TL_LANG']['tl_layout']['picturefill'][0]));
 }
 /**
  * Gets attributes for the cumulative filter including their type (single or multiple choice).
  *
  * @return array
  */
 public function getAttributes()
 {
     $this->loadDataContainer('tl_iso_product');
     \System::loadLanguageFile('tl_iso_product');
     $arrAttributes = array();
     foreach ($GLOBALS['TL_DCA']['tl_iso_product']['fields'] as $field => $arrData) {
         if ($arrData['attributes']['fe_filter']) {
             $arrAttributes[$field] = sprintf('%s (%s)', strlen($arrData['label'][0]) ? $arrData['label'][0] : $field, $arrData['eval']['multiple'] ? 'multiple choice' : 'single choice');
         }
     }
     return $arrAttributes;
 }
Example #28
0
 /**
  * Return all editable fields of table tl_member
  *
  * @return array
  */
 public function getEditableMemberProperties()
 {
     $return = array();
     System::loadLanguageFile('tl_member');
     $this->loadDataContainer('tl_member');
     foreach ($GLOBALS['TL_DCA']['tl_member']['fields'] as $k => $v) {
         if ($v['eval']['feEditable']) {
             $return[$k] = $GLOBALS['TL_DCA']['tl_member']['fields'][$k]['label'][0];
         }
     }
     return $return;
 }
Example #29
0
 /**
  * @param $strField
  */
 protected function addTranslationContentToField($strField)
 {
     if ($this->Config->get($strField) === null) {
         $arrValues = array();
         \System::loadLanguageFile('tl_email', 'de', true);
         $arrValues['de'] = $GLOBALS['TL_LANG']['tl_email']['defaultContents'][$strField];
         \System::loadLanguageFile('tl_email', 'en', true);
         $arrValues['en'] = $GLOBALS['TL_LANG']['tl_email']['defaultContents'][$strField];
         // Load translation file by current language
         \System::loadLanguageFile('tl_email', null, true);
         $this->Config->persist($strField, \TranslationFieldsWidgetHelper::saveValuesAndReturnFid($arrValues));
     }
 }
 /**
  * For each call, return the name of the next address field in the wizard (for input_field_callback)
  *
  * @param \Widget $objWidget
  *
  * @return string
  */
 public function getNextName($objWidget)
 {
     static $arrValues;
     static $i = 0;
     if (empty($arrValues)) {
         \System::loadLanguageFile(\Isotope\Model\Address::getTable());
         $arrValues = $objWidget->value;
         $i = 0;
     }
     $arrField = array_shift($arrValues);
     $strName = $arrField['name'];
     return sprintf('<input type="hidden" name="%s[%s][name]" id="ctrl_%s_row%s_name" value="%s"><div style="width:344px">%s <span style="color:#b3b3b3; padding-left:3px;">[%s]</span></div>', $objWidget->name, $i, $objWidget->name, $i++, $strName, $GLOBALS['TL_DCA'][\Isotope\Model\Address::getTable()]['fields'][$strName]['label'][0] ?: $strName, $strName);
 }