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


PHP Controller::reload方法代码示例

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


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

示例1: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     /** @var IsotopeIntegrityCheck[] $arrChecks */
     $arrChecks = array();
     $arrTasks = array();
     $blnReload = false;
     if (\Input::post('FORM_SUBMIT') == 'tl_iso_integrity') {
         $arrTasks = (array) \Input::post('tasks');
     }
     $this->Template->hasFixes = false;
     foreach ($GLOBALS['ISO_INTEGRITY'] as $strClass) {
         /** @var IsotopeIntegrityCheck $objCheck */
         $objCheck = new $strClass();
         if (!$objCheck instanceof IsotopeIntegrityCheck) {
             throw new \LogicException('Class "' . $strClass . '" must implement IsotopeIntegrityCheck interface');
         }
         if (in_array($objCheck->getId(), $arrTasks) && $objCheck->hasError() && $objCheck->canRepair()) {
             $objCheck->repair();
             $blnReload = true;
         } else {
             $blnError = $objCheck->hasError();
             $blnRepair = $objCheck->canRepair();
             $arrChecks[] = array('id' => $objCheck->getId(), 'name' => $objCheck->getName(), 'description' => $objCheck->getDescription(), 'error' => $blnError, 'repair' => $blnError && $blnRepair);
             if ($blnError && $blnRepair) {
                 $this->Template->hasFixes = true;
             }
         }
     }
     if ($blnReload) {
         \Controller::reload();
     }
     $this->Template->checks = $arrChecks;
     $this->Template->action = \Environment::get('request');
     $this->Template->back = str_replace('&mod=integrity', '', \Environment::get('request'));
 }
开发者ID:ralfhartmann,项目名称:isotope_core,代码行数:38,代码来源:Integrity.php

示例2: run

 /**
  * Generate the module
  *
  * @return string
  */
 public function run()
 {
     $template = new \BackendTemplate('be_css_class_replacer_update');
     $template->isActive = $this->isActive();
     $template->action = ampersand(\Environment::get('request'));
     $template->message = \Message::generate();
     $template->headline = specialchars($GLOBALS['TL_LANG']['tl_maintenance']['css-class-replacer-headline']);
     $template->description = specialchars($GLOBALS['TL_LANG']['tl_maintenance']['css-class-replacer-description']);
     $template->submit = specialchars($GLOBALS['TL_LANG']['tl_maintenance']['css-class-replacer-submit']);
     if ($this->isActive()) {
         $rules = RuleModel::findAll();
         $helper = new BackendHelper();
         $helper->updateCacheableValues($rules);
         \Message::addConfirmation(sprintf($GLOBALS['TL_LANG']['tl_maintenance']['css-class-replacer-message'], $rules->count()));
         \Controller::reload();
     }
     return $template->parse();
 }
开发者ID:toflar,项目名称:contao-css-class-replacer,代码行数:23,代码来源:RuleUpdate.php

示例3: login

 /**
  * @param Database_Result $objPage
  * @param Database_Result $objLayout
  * @param PageRegular $objPageRegular
  */
 public function login($objPage, $objLayout, $objPageRegular)
 {
     $time = time();
     $objMember = \Database::getInstance()->prepare("SELECT * FROM tl_member WHERE loginLink = ? AND (loginLinkExpire > ? OR loginLinkExpire = '')")->execute($this->authKey, $time);
     $objMemberModel = \MemberModel::findById($objMember->id);
     if ($objMember->numRows != 1 || $objMember->loginLink != $this->authKey) {
         return;
     }
     if (!FE_USER_LOGGED_IN) {
         // Generate the cookie hash
         $this->strHash = sha1(session_id() . (!\Config::get('disableIpCheck') ? \Environment::get('ip') : '') . 'FE_USER_AUTH');
         // Clean up old sessions
         \Database::getInstance()->prepare("DELETE FROM tl_session WHERE tstamp<? OR hash=?")->execute($time - \Config::get('sessionTimeout'), $this->strHash);
         // Save the session in the database
         \Database::getInstance()->prepare("INSERT INTO tl_session (pid, tstamp, name, sessionID, ip, hash) VALUES (?, ?, ?, ?, ?, ?)")->execute($objMember->id, $time, 'FE_USER_AUTH', session_id(), \Environment::get('ip'), $this->strHash);
         // Set the authentication cookie
         \System::setCookie('FE_USER_AUTH', $this->strHash, $time + \Config::get('sessionTimeout'), null, null, false, true);
         // Set the login status (backwards compatibility)
         $_SESSION['TL_USER_LOGGED_IN'] = true;
         // Save the login status
         $_SESSION['TL_USER_LOGGED_IN'] = true;
         \System::log('User "' . $objMember->username . '" logged in by authKey', 'LoginLink()', TL_ACCESS);
         \Controller::reload();
     }
     if ($objMember->jumpTo) {
         $objPage = \PageModel::findByPk($objMember->jumpTo);
     }
     $strUrl = \Controller::generateFrontendUrl($objPage->row());
     $strParam = '';
     foreach ($_GET as $index => $value) {
         if ($index == 'key') {
             continue;
         }
         if (!$strParam) {
             $strParam .= '?' . $index . '=' . \Input::get($index);
         } else {
             $strParam .= '&' . $index . '=' . \Input::get($index);
         }
     }
     \Controller::redirect($strUrl . $strParam);
 }
开发者ID:thescrat,项目名称:login_link,代码行数:46,代码来源:LoginLink.php

示例4: compile

 /**
  * Generate module
  */
 protected function compile()
 {
     // Create files
     if (\Input::post('FORM_SUBMIT') == 'tl_entity_import') {
         $objModel = EntityImportConfigModel::findByPk($this->objDc->id);
         if ($objModel === null) {
             return;
         }
         if (class_exists($objModel->importerClass)) {
             // use a particular importer (e.g. NewsImporter)
             \Message::addInfo(sprintf($GLOBALS['TL_LANG']['tl_entity_import_config']['importerInfo'], $objModel->importerClass));
             $importer = new $objModel->importerClass($objModel);
         } else {
             \Message::addInfo(sprintf($GLOBALS['TL_LANG']['tl_entity_import_config']['importerInfo'], 'Importer'));
             $importer = new Importer($objModel);
         }
         if ($importer->run(\Input::post('dry-run'))) {
             // Confirm and reload
             $strMessage = $GLOBALS['TL_LANG']['tl_entity_import_config']['confirm'];
             if (\Input::post('dry-run')) {
                 $strMessage = $GLOBALS['TL_LANG']['tl_entity_import_config']['confirmDry'];
             }
             \Message::addConfirmation($strMessage);
             \Controller::reload();
         }
     }
     $this->Template->base = \Environment::get('base');
     $this->Template->href = \Controller::getReferer(true);
     $this->Template->title = specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']);
     $this->Template->action = ampersand(\Environment::get('request'));
     $this->Template->selectAll = $GLOBALS['TL_LANG']['MSC']['selectAll'];
     $this->Template->button = $GLOBALS['TL_LANG']['MSC']['backBT'];
     $this->Template->message = \Message::generate();
     $this->Template->submit = specialchars($GLOBALS['TL_LANG']['tl_entity_import_config']['import'][0]);
     $this->Template->dryRun = specialchars($GLOBALS['TL_LANG']['tl_entity_import_config']['dryRun'][0]);
     $this->Template->headline = sprintf($GLOBALS['TL_LANG']['tl_entity_import_config']['headline'], \Input::get('id'));
     $this->Template->explain = $GLOBALS['TL_LANG']['tl_entity_import_config']['make'][1];
     $this->Template->label = $GLOBALS['TL_LANG']['tl_entity_import_config']['label'];
 }
开发者ID:heimrichhannot,项目名称:contao-entity_import,代码行数:42,代码来源:ModuleEntityImport.php

示例5: compile

    public function compile()
    {
        \System::loadLanguageFile('tl_iso_gallery');
        $strBuffer = '
<table style="width:100%">
<thead>
    <tr>
        <th>' . $GLOBALS['TL_LANG']['tl_iso_gallery']['name'][0] . '</th>
        <th>' . $GLOBALS['TL_LANG']['tl_iso_gallery']['lightbox_template'][0] . '<span class="mandatory">*</span></th>
    </tr>
</thead>
<tbody>';
        foreach ($this->objGaleries as $objGallery) {
            $objSelect = new \SelectMenu(\Widget::getAttributesFromDca(array('options' => array_merge(\Controller::getTemplateGroup('moo_'), \Controller::getTemplateGroup('j_')), 'eval' => array('includeBlankOption' => true, 'mandatory' => true)), 'gallery[' . $objGallery->id . ']'));
            if (\Input::post('FORM_SUBMIT') == 'tl_iso_upgrade_20010000') {
                $objSelect->validate();
                if (!$objSelect->hasErrors()) {
                    $objGallery->lightbox_template = serialize(array($objSelect->value));
                    $objGallery->save();
                }
            }
            $strBuffer .= '
    <tr>
        <td>' . $objGallery->name . '</td>
        <td>' . $objSelect->generateWithError() . '</td>
    </tr>';
        }
        $strBuffer .= '
</tbody>
</table>';
        $this->Template->formSubmit = 'tl_iso_upgrade_20010000';
        $this->Template->fields = $strBuffer;
        $this->Template->matter = $GLOBALS['TL_LANG']['UPG']['20010000'];
        if (\Input::post('FORM_SUBMIT') == 'tl_iso_upgrade_20010000') {
            \Controller::reload();
        }
    }
开发者ID:Aziz-JH,项目名称:core,代码行数:37,代码来源:To0020010000.php

示例6: authenticate

 /**
  * Authenticate a user
  *
  * @return boolean
  */
 public function authenticate()
 {
     // Default authentication
     if (parent::authenticate()) {
         return true;
     }
     // Check whether auto login is enabled
     if (\Config::get('autologin') > 0 && ($strCookie = \Input::cookie('FE_AUTO_LOGIN')) != '') {
         // Try to find the user by his auto login cookie
         if ($this->findBy('autologin', $strCookie) !== false) {
             // Check the auto login period
             if ($this->createdOn >= time() - \Config::get('autologin')) {
                 // Validate the account status
                 if ($this->checkAccountStatus() !== false) {
                     $this->setUserFromDb();
                     // Last login date
                     $this->lastLogin = $this->currentLogin;
                     $this->currentLogin = time();
                     $this->save();
                     // Generate the session
                     $this->generateSession();
                     $this->log('User "' . $this->username . '" was logged in automatically', __METHOD__, TL_ACCESS);
                     // Reload the page
                     \Controller::reload();
                     return true;
                 }
             }
         }
         // Remove the cookie if it is invalid to enable loading cached pages
         $this->setCookie('FE_AUTO_LOGIN', $strCookie, time() - 86400, null, null, \Environment::get('ssl'), true);
     }
     return false;
 }
开发者ID:contao,项目名称:core-bundle,代码行数:38,代码来源:FrontendUser.php

示例7: reload

 /**
  * Reload the current page
  *
  * @deprecated Use Controller::reload() instead
  */
 public static function reload()
 {
     \Controller::reload();
 }
开发者ID:Jobu,项目名称:core,代码行数:9,代码来源:System.php

示例8: importFromPath

 /**
  * Import files from selected folder
  *
  * @param string $strPath
  */
 protected function importFromPath($strPath)
 {
     $arrFiles = scan(TL_ROOT . '/' . $strPath);
     if (empty($arrFiles)) {
         \Message::addError($GLOBALS['TL_LANG']['MSC']['noFilesInFolder']);
         \Controller::reload();
     }
     $blnEmpty = true;
     $arrDelete = array();
     $objProducts = \Database::getInstance()->prepare("SELECT * FROM tl_iso_product WHERE pid=0")->execute();
     while ($objProducts->next()) {
         $arrImageNames = array();
         $arrImages = deserialize($objProducts->images);
         if (!is_array($arrImages)) {
             $arrImages = array();
         } else {
             foreach ($arrImages as $row) {
                 if ($row['src']) {
                     $arrImageNames[] = $row['src'];
                 }
             }
         }
         $arrPattern = array();
         $arrPattern[] = $objProducts->alias ? standardize($objProducts->alias) : null;
         $arrPattern[] = $objProducts->sku ? $objProducts->sku : null;
         $arrPattern[] = $objProducts->sku ? standardize($objProducts->sku) : null;
         $arrPattern[] = !empty($arrImageNames) ? implode('|', $arrImageNames) : null;
         // !HOOK: add custom import regex patterns
         if (isset($GLOBALS['ISO_HOOKS']['addAssetImportRegexp']) && is_array($GLOBALS['ISO_HOOKS']['addAssetImportRegexp'])) {
             foreach ($GLOBALS['ISO_HOOKS']['addAssetImportRegexp'] as $callback) {
                 $objCallback = \System::importStatic($callback[0]);
                 $arrPattern = $objCallback->{$callback}[1]($arrPattern, $objProducts);
             }
         }
         $strPattern = '@^(' . implode('|', array_filter($arrPattern)) . ')@i';
         $arrMatches = preg_grep($strPattern, $arrFiles);
         if (!empty($arrMatches)) {
             $arrNewImages = array();
             foreach ($arrMatches as $file) {
                 if (is_dir(TL_ROOT . '/' . $strPath . '/' . $file)) {
                     $arrSubfiles = scan(TL_ROOT . '/' . $strPath . '/' . $file);
                     if (!empty($arrSubfiles)) {
                         foreach ($arrSubfiles as $subfile) {
                             if (is_file($strPath . '/' . $file . '/' . $subfile)) {
                                 $objFile = new \File($strPath . '/' . $file . '/' . $subfile);
                                 if ($objFile->isGdImage) {
                                     $arrNewImages[] = $strPath . '/' . $file . '/' . $subfile;
                                 }
                             }
                         }
                     }
                 } elseif (is_file(TL_ROOT . '/' . $strPath . '/' . $file)) {
                     $objFile = new \File($strPath . '/' . $file);
                     if ($objFile->isGdImage) {
                         $arrNewImages[] = $strPath . '/' . $file;
                     }
                 }
             }
             if (!empty($arrNewImages)) {
                 foreach ($arrNewImages as $strFile) {
                     $pathinfo = pathinfo(TL_ROOT . '/' . $strFile);
                     // Will recursively create the folder
                     $objFolder = new \Folder('isotope/' . strtolower(substr($pathinfo['filename'], 0, 1)));
                     $strCacheName = $pathinfo['filename'] . '-' . substr(md5_file(TL_ROOT . '/' . $strFile), 0, 8) . '.' . $pathinfo['extension'];
                     \Files::getInstance()->copy($strFile, $objFolder->path . '/' . $strCacheName);
                     $arrImages[] = array('src' => $strCacheName);
                     $arrDelete[] = $strFile;
                     \Message::addConfirmation(sprintf($GLOBALS['TL_LANG']['MSC']['assetImportConfirmation'], $pathinfo['filename'] . '.' . $pathinfo['extension'], $objProducts->name));
                     $blnEmpty = false;
                 }
                 \Database::getInstance()->prepare("UPDATE tl_iso_product SET images=? WHERE id=?")->execute(serialize($arrImages), $objProducts->id);
             }
         }
     }
     if (!empty($arrDelete)) {
         $arrDelete = array_unique($arrDelete);
         foreach ($arrDelete as $file) {
             \Files::getInstance()->delete($file);
         }
     }
     if ($blnEmpty) {
         \Message::addInfo($GLOBALS['TL_LANG']['MSC']['assetImportNoFilesFound']);
     }
     \Controller::reload();
 }
开发者ID:ralfhartmann,项目名称:isotope_core,代码行数:90,代码来源:AssetImport.php

示例9: compile

 /**
  * Generate module
  */
 protected function compile()
 {
     if (Isotope::getCart()->isEmpty()) {
         $this->Template->empty = true;
         $this->Template->type = 'empty';
         $this->Template->message = $this->iso_emptyMessage ? $this->iso_noProducts : $GLOBALS['TL_LANG']['MSC']['noItemsInCart'];
         return;
     }
     // Remove from cart
     if (\Input::get('remove') > 0 && Isotope::getCart()->deleteItemById((int) \Input::get('remove'))) {
         \Controller::redirect(preg_replace('/([?&])remove=[^&]*(&|$)/', '$1', \Environment::get('request')));
     }
     $objTemplate = new \Isotope\Template($this->iso_collectionTpl);
     Isotope::getCart()->addToTemplate($objTemplate, array('gallery' => $this->iso_gallery, 'sorting' => Isotope::getCart()->getItemsSortingCallable($this->iso_orderCollectionBy)));
     $blnReload = false;
     $arrQuantity = \Input::post('quantity');
     $arrItems = $objTemplate->items;
     foreach ($arrItems as $k => $arrItem) {
         // Update cart data if form has been submitted
         if (\Input::post('FORM_SUBMIT') == $this->strFormId && is_array($arrQuantity) && isset($arrQuantity[$arrItem['id']])) {
             $blnReload = true;
             Isotope::getCart()->updateItemById($arrItem['id'], array('quantity' => $arrQuantity[$arrItem['id']]));
             continue;
             // no need to generate $arrProductData, we reload anyway
         }
         $arrItem['remove_href'] = \Haste\Util\Url::addQueryString('remove=' . $arrItem['id']);
         $arrItem['remove_title'] = specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['removeProductLinkTitle'], $arrItem['name']));
         $arrItem['remove_link'] = $GLOBALS['TL_LANG']['MSC']['removeProductLinkText'];
         $arrItems[$k] = $arrItem;
     }
     $arrButtons = $this->generateButtons();
     // Reload the page if no button has handled it
     if ($blnReload) {
         // Unset payment and shipping method because they could get invalid due to the change
         // @todo change this to check availability, but that's an API/BC break
         if (($objShipping = Isotope::getCart()->getShippingMethod()) !== null && !$objShipping->isAvailable()) {
             Isotope::getCart()->setShippingMethod(null);
         }
         if (($objPayment = Isotope::getCart()->getPaymentMethod()) !== null && !$objPayment->isAvailable()) {
             Isotope::getCart()->setPaymentMethod(null);
         }
         \Controller::reload();
     }
     $objTemplate->items = $arrItems;
     $objTemplate->isEditable = true;
     $objTemplate->linkProducts = true;
     $objTemplate->formId = $this->strFormId;
     $objTemplate->formSubmit = $this->strFormId;
     $objTemplate->action = \Environment::get('request');
     $objTemplate->buttons = $arrButtons;
     $objTemplate->custom = '';
     // HOOK: order status has been updated
     if (isset($GLOBALS['ISO_HOOKS']['compileCart']) && is_array($GLOBALS['ISO_HOOKS']['compileCart'])) {
         $strCustom = '';
         foreach ($GLOBALS['ISO_HOOKS']['compileCart'] as $callback) {
             $objCallback = \System::importStatic($callback[0]);
             $strCustom .= $objCallback->{$callback}[1]($this);
         }
         $objTemplate->custom = $strCustom;
     }
     $this->Template->empty = false;
     $this->Template->collection = Isotope::getCart();
     $this->Template->products = $objTemplate->parse();
 }
开发者ID:Aziz-JH,项目名称:core,代码行数:67,代码来源:Cart.php

示例10: handleReload

 /**
  * Reload the current page.
  *
  * @return void
  */
 public static function handleReload()
 {
     \Controller::reload();
 }
开发者ID:ContaoBlackForest-archive,项目名称:events-contao-bindings,代码行数:9,代码来源:ControllerSubscriber.php

示例11: executePreActions

 /**
  * Check the Ajax pre actions
  *
  * @param string $action
  *
  * @return string
  */
 public function executePreActions($action)
 {
     switch ($action) {
         // Move the product
         case 'moveProduct':
             \Session::getInstance()->set('iso_products_gid', intval(\Input::post('value')));
             \Controller::redirect(html_entity_decode(\Input::post('redirect')));
             break;
             // Move multiple products
         // Move multiple products
         case 'moveProducts':
             \Session::getInstance()->set('iso_products_gid', intval(\Input::post('value')));
             exit;
             break;
             // Filter the groups
         // Filter the groups
         case 'filterGroups':
             \Session::getInstance()->set('iso_products_gid', intval(\Input::post('value')));
             $this->reload();
             break;
             // Filter the pages
         // Filter the pages
         case 'filterPages':
             $filter = \Session::getInstance()->get('filter');
             $filter['tl_iso_product']['iso_page'] = (int) \Input::post('value');
             \Session::getInstance()->set('filter', $filter);
             $this->reload();
             break;
             // Sorty products by page
         // Sorty products by page
         case 'sortByPage':
             if (\Input::post('value') > 0) {
                 \Controller::redirect(\Backend::addToUrl('table=tl_iso_product_category&amp;id=' . (int) \Input::post('value') . '&amp;page_id=' . (int) \Input::post('value')));
             } else {
                 \Controller::reload();
             }
     }
 }
开发者ID:ralfhartmann,项目名称:isotope_core,代码行数:45,代码来源:Backend.php

示例12: reviseTable

 /**
  * Delete all incomplete and unrelated records
  */
 protected function reviseTable()
 {
     $reload = false;
     $ptable = $this->arrDca['config']['ptable'];
     $ctable = $this->arrDca['config']['ctable'];
     $new_records = $this->Session->get('new_records');
     // HOOK: add custom logic
     if (isset($GLOBALS['TL_HOOKS']['reviseTable']) && is_array($GLOBALS['TL_HOOKS']['reviseTable'])) {
         foreach ($GLOBALS['TL_HOOKS']['reviseTable'] as $callback) {
             $status = null;
             if (is_array($callback)) {
                 $this->import($callback[0]);
                 $status = $this->{$callback[0]}->{$callback[1]}($this->strTable, $new_records[$this->strTable], $ptable, $ctable);
             } elseif (is_callable($callback)) {
                 $status = $callback($this->strTable, $new_records[$this->strTable], $ptable, $ctable);
             }
             if ($status === true) {
                 $reload = true;
             }
         }
     }
     // Delete all new but incomplete fieldpalette records (tstamp=0)
     if (!empty($new_records[\Config::get('fieldpalette_table')]) && is_array($new_records[\Config::get('fieldpalette_table')])) {
         $objStmt = $this->Database->prepare("DELETE FROM " . \Config::get('fieldpalette_table') . " WHERE id IN(" . implode(',', array_map('intval', $new_records[\Config::get('fieldpalette_table')])) . ") AND tstamp=0 AND (? IS NULL OR id != ?)")->execute($this->activeRecord->id, $this->activeRecord->id);
         if ($objStmt->affectedRows > 0) {
             $reload = true;
         }
     }
     // Delete all fieldpalette records whose child record isn't existing
     if ($ptable != '') {
         if ($this->arrDca['config']['dynamicPtable']) {
             $objStmt = $this->Database->execute("DELETE FROM " . \Config::get('fieldpalette_table') . " WHERE ptable='" . $ptable . "' AND NOT EXISTS (SELECT * FROM (SELECT * FROM " . $ptable . ") AS fpp WHERE " . \Config::get('fieldpalette_table') . ".pid = fpp.id)");
         } else {
             $objStmt = $this->Database->execute("DELETE FROM " . \Config::get('fieldpalette_table') . " WHERE NOT EXISTS " . "(SELECT * FROM (SELECT * FROM " . $ptable . ") AS fpp WHERE " . \Config::get('fieldpalette_table') . ".pid = fpp.id)");
         }
         if ($objStmt->affectedRows > 0) {
             $reload = true;
         }
     }
     // Delete all records of the child table that are not related to the current table
     if (!empty($ctable) && is_array($ctable)) {
         foreach ($ctable as $v) {
             if ($v != '') {
                 // Load the DCA configuration so we can check for "dynamicPtable"
                 if (!isset($GLOBALS['loadDataContainer'][$v])) {
                     \Controller::loadDataContainer($v);
                 }
                 if ($GLOBALS['TL_DCA'][$v]['config']['dynamicPtable']) {
                     $objStmt = $this->Database->execute("DELETE FROM {$v} WHERE ptable='" . \Config::get('fieldpalette_table') . "' AND NOT EXISTS (SELECT * FROM " . "(SELECT * FROM " . \Config::get('fieldpalette_table') . ") AS fp WHERE {$v}.pid = fp.id)");
                 } else {
                     $objStmt = $this->Database->execute("DELETE FROM {$v} WHERE NOT EXISTS (SELECT * FROM (SELECT * FROM " . \Config::get('fieldpalette_table') . ") AS fp WHERE {$v}.pid = fp.id)");
                 }
                 if ($objStmt->affectedRows > 0) {
                     $reload = true;
                 }
             }
         }
     }
     // Reload the page
     if ($reload) {
         if (\Environment::get('isAjaxRequest')) {
             return;
         }
         \Controller::reload();
     }
 }
开发者ID:heimrichhannot,项目名称:contao-fieldpalette,代码行数:69,代码来源:FieldPaletteWizard.php

示例13: importFile

 public function importFile()
 {
     if (\Input::get('key') != 'import') {
         return '';
     }
     if (null === $this->arrImportIgnoreFields) {
         $this->arrImportIgnoreFields = array('id', 'pid', 'tstamp', 'form', 'ip', 'date', 'confirmationSent', 'confirmationDate', 'import_source');
     }
     if (null === $this->arrImportableFields) {
         $arrFdFields = array_merge($this->arrBaseFields, $this->arrDetailFields);
         $arrFdFields = array_diff($arrFdFields, $this->arrImportIgnoreFields);
         foreach ($arrFdFields as $strFdField) {
             $this->arrImportableFields[$strFdField] = $GLOBALS['TL_DCA']['tl_formdata']['fields'][$strFdField]['label'][0];
         }
     }
     $arrSessionData = $this->Session->get('EFG');
     if (null == $arrSessionData) {
         $arrSessionData = array();
     }
     $this->Session->set('EFG', $arrSessionData);
     // Import CSV
     if ($_POST['FORM_SUBMIT'] == 'tl_formdata_import') {
         $this->loadDataContainer('tl_files');
         $strMode = 'preview';
         $arrSessionData['import'][$this->strFormKey]['separator'] = $_POST['separator'];
         $arrSessionData['import'][$this->strFormKey]['csv_has_header'] = $_POST['csv_has_header'] == '1' ? '1' : '';
         $this->Session->set('EFG', $arrSessionData);
         if (intval(\Input::post('import_source')) == 0) {
             \Message::addError($GLOBALS['TL_LANG']['tl_formdata']['error_select_source']);
             \Controller::reload();
         }
         $objFileModel = \FilesModel::findById(\Input::post('import_source'));
         $objFile = new \File($objFileModel->path, true);
         if ($objFile->extension != 'csv') {
             \Message::addError(sprintf($GLOBALS['TL_LANG']['ERR']['filetype'], $objFile->extension));
             setcookie('BE_PAGE_OFFSET', 0, 0, '/');
             \Controller::reload();
         }
         // Get separator
         switch (\Input::post('separator')) {
             case 'semicolon':
                 $strSeparator = ';';
                 break;
             case 'tabulator':
                 $strSeparator = '\\t';
                 break;
             case 'comma':
             default:
                 $strSeparator = ',';
                 break;
         }
         if ($_POST['FORM_MODE'] == 'import') {
             $strMode = 'import';
             $time = time();
             $intTotal = null;
             $intInvalid = 0;
             $intValid = 0;
             $arrImportCols = \Input::post('import_cols');
             $arrSessionData['import'][$this->strFormKey]['import_cols'] = $arrImportCols;
             $this->Session->set('EFG', $arrSessionData);
             $arrMapFields = array_flip($arrImportCols);
             if (isset($arrMapFields['__IGNORE__'])) {
                 unset($arrMapFields['__IGNORE__']);
             }
             $blnUseCsvHeader = $arrSessionData['import'][$this->strFormKey]['csv_has_header'] == '1' ? true : false;
             $arrEntries = array();
             $resFile = $objFile->handle;
             $timeNow = time();
             $strFormTitle = $this->Formdata->arrFormsDcaKey[substr($this->strFormKey, 3)];
             $strAliasField = strlen($this->Formdata->arrStoringForms[substr($this->strFormKey, 3)]['efgAliasField']) ? $this->Formdata->arrStoringForms[substr($this->strFormKey, 3)]['efgAliasField'] : '';
             $objForm = \FormModel::findOneBy('title', $strFormTitle);
             if ($objForm !== null) {
                 $arrFormFields = $this->Formdata->getFormfieldsAsArray($objForm->id);
             }
             while (($arrRow = @fgetcsv($resFile, null, $strSeparator)) !== false) {
                 if (null === $intTotal) {
                     $intTotal = 0;
                     if ($blnUseCsvHeader) {
                         continue;
                     }
                 }
                 $strAlias = '';
                 if (isset($arrRow[$arrMapFields['alias']]) && strlen($arrRow[$arrMapFields['alias']])) {
                     $strAlias = $arrRow[$arrMapFields['alias']];
                 } elseif (isset($arrRow[$arrMapFields[$strAliasField]]) && strlen($arrRow[$arrMapFields[$strAliasField]])) {
                     \Input::setPost($strAliasField, $arrRow[$arrMapFields[$strAliasField]]);
                 }
                 $arrDetailSets = array();
                 // prepare base data
                 $arrSet = array('tstamp' => $timeNow, 'fd_member' => 0, 'fd_user' => intval($this->User->id), 'form' => $strFormTitle, 'ip' => \Environment::get('ip'), 'date' => $timeNow, 'published' => $GLOBALS['TL_DCA']['tl_formdata']['fields']['published']['default'] == '1' ? '1' : '');
                 foreach ($arrMapFields as $strField => $intCol) {
                     if (in_array($strField, $this->arrImportIgnoreFields)) {
                         continue;
                     }
                     if (in_array($strField, $this->arrBaseFields)) {
                         $arrField = $GLOBALS['TL_DCA']['tl_formdata']['fields'][$strField];
                         if (in_array($strField, $this->arrOwnerFields)) {
                             switch ($strField) {
                                 case 'fd_user':
                                     $array = 'arrUsers';
//.........这里部分代码省略.........
开发者ID:byteworks-ch,项目名称:contao-efg,代码行数:101,代码来源:DC_Formdata.php

示例14: purgeAdvancedAssetCache

 /**
  * Purge the advanced asset cache.
  *
  * @return void
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  */
 public function purgeAdvancedAssetCache()
 {
     if ($this->cache instanceof CacheProvider) {
         $this->cache->deleteAll();
     } else {
         $_SESSION['CLEAR_CACHE_CONFIRM'] = $GLOBALS['TL_LANG']['tl_maintenance_jobs']['theme_plus_aac'][2];
         \Controller::reload();
     }
 }
开发者ID:bit3,项目名称:contao-theme-plus,代码行数:16,代码来源:BackendIntegration.php

示例15: validateStockCollectionUpdate

 public function validateStockCollectionUpdate($objItem, $arrSet)
 {
     $objProduct = Product::findPublishedByPk($objItem->product_id);
     if (!static::validateQuantity($objProduct, $arrSet['quantity'])) {
         \Controller::reload();
     }
     return $arrSet;
 }
开发者ID:heimrichhannot,项目名称:contao-isotope_plus,代码行数:8,代码来源:IsotopePlus.php


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