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


PHP Message::generate方法代码示例

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


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

示例1: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     \System::loadLanguageFile('tl_autoload');
     // Process the request
     if (\Input::post('FORM_SUBMIT') == 'tl_autoload') {
         $this->createAutoloadFiles();
         $this->reload();
     }
     $arrModules = array();
     // List all modules
     foreach (scan(TL_ROOT . '/system/modules') as $strFile) {
         if (strncmp($strFile, '.', 1) === 0 || !is_dir(TL_ROOT . '/system/modules/' . $strFile)) {
             continue;
         }
         $arrModules[] = $strFile;
     }
     $this->Template->modules = $arrModules;
     $this->Template->messages = \Message::generate();
     $this->Template->href = $this->getReferer(true);
     $this->Template->title = specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']);
     $this->Template->button = $GLOBALS['TL_LANG']['MSC']['backBT'];
     $this->Template->headline = $GLOBALS['TL_LANG']['tl_autoload']['headline'];
     $this->Template->action = ampersand(\Environment::get('request'));
     $this->Template->available = $GLOBALS['TL_LANG']['tl_autoload']['available'];
     $this->Template->xplAvailable = $GLOBALS['TL_LANG']['tl_autoload']['xplAvailable'];
     $this->Template->selectAll = $GLOBALS['TL_LANG']['MSC']['selectAll'];
     $this->Template->override = $GLOBALS['TL_LANG']['tl_autoload']['override'];
     $this->Template->xplOverride = $GLOBALS['TL_LANG']['tl_autoload']['xplOverride'];
     $this->Template->submitButton = specialchars($GLOBALS['TL_LANG']['MSC']['continue']);
     $this->Template->autoload = $GLOBALS['TL_LANG']['tl_autoload']['autoload'];
     $this->Template->ideCompat = $GLOBALS['TL_LANG']['tl_autoload']['ideCompat'];
 }
开发者ID:eknoes,项目名称:core,代码行数:35,代码来源:ModuleAutoload.php

示例2: compile

 /**
  * Generate module
  */
 protected function compile()
 {
     // Create files
     if (\Input::post('FORM_SUBMIT') == 'tl_newsport') {
         $objModel = NewsportConfigModel::findByPk($this->objDc->id);
         if ($objModel === null) {
             return;
         }
         $importer = new NewsImporter($objModel);
         if ($importer->run()) {
             // Confirm and reload
             \Message::addConfirmation($GLOBALS['TL_LANG']['tl_newsport_config']['confirm']);
             $this->reload();
         }
     }
     $this->Template->base = \Environment::get('base');
     $this->Template->href = $this->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_newsport_config']['import'][0]);
     $this->Template->headline = sprintf($GLOBALS['TL_LANG']['tl_newsport_config']['headline'], \Input::get('id'));
     $this->Template->explain = $GLOBALS['TL_LANG']['tl_newsport_config']['make'][1];
     $this->Template->label = $GLOBALS['TL_LANG']['tl_newsport_config']['label'];
 }
开发者ID:heimrichhannot,项目名称:contao-newsport,代码行数:30,代码来源:ModuleNewsport.php

示例3: run

 /**
  * Run the controller and parse the login template
  */
 public function run()
 {
     $this->Template = new BackendTemplate('be_login');
     // Show a cookie warning
     if (Input::get('referer', true) != '' && empty($_COOKIE)) {
         $this->Template->noCookies = $GLOBALS['TL_LANG']['MSC']['noCookies'];
     }
     $strHeadline = sprintf($GLOBALS['TL_LANG']['MSC']['loginTo'], Config::get('websiteTitle'));
     $this->Template->theme = Backend::getTheme();
     $this->Template->messages = Message::generate();
     $this->Template->base = Environment::get('base');
     $this->Template->language = $GLOBALS['TL_LANGUAGE'];
     $this->Template->languages = System::getLanguages(true);
     $this->Template->title = specialchars($strHeadline);
     $this->Template->charset = Config::get('characterSet');
     $this->Template->action = ampersand(Environment::get('request'));
     $this->Template->userLanguage = $GLOBALS['TL_LANG']['tl_user']['language'][0];
     $this->Template->headline = $strHeadline;
     $this->Template->curLanguage = Input::post('language') ?: str_replace('-', '_', $GLOBALS['TL_LANGUAGE']);
     $this->Template->curUsername = Input::post('username') ?: '';
     $this->Template->uClass = $_POST && empty($_POST['username']) ? ' class="login_error"' : '';
     $this->Template->pClass = $_POST && empty($_POST['password']) ? ' class="login_error"' : '';
     $this->Template->loginButton = specialchars($GLOBALS['TL_LANG']['MSC']['loginBT']);
     $this->Template->username = $GLOBALS['TL_LANG']['tl_user']['username'][0];
     $this->Template->password = $GLOBALS['TL_LANG']['MSC']['password'][0];
     $this->Template->feLink = $GLOBALS['TL_LANG']['MSC']['feLink'];
     $this->Template->frontendFile = Environment::get('base');
     $this->Template->disableCron = Config::get('disableCron');
     $this->Template->ie6warning = sprintf($GLOBALS['TL_LANG']['ERR']['ie6warning'], '<a href="http://ie6countdown.com">', '</a>');
     $this->Template->default = $GLOBALS['TL_LANG']['MSC']['default'];
     $this->Template->output();
 }
开发者ID:iCodr8,项目名称:core,代码行数:35,代码来源:index.php

示例4: generate

 /**
  * Display a wildcard in the back end
  * @return string
  */
 public function generate()
 {
     if (TL_MODE == 'BE') {
         $objTemplate = new \BackendTemplate('be_wildcard');
         $objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['facebook_login'][0]) . ' ###';
         $objTemplate->title = $this->headline;
         $objTemplate->id = $this->id;
         $objTemplate->link = $this->name;
         $objTemplate->href = 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' . $this->id;
         return $objTemplate->parse();
     }
     // Return if a front end user is logged in
     if (FE_USER_LOGGED_IN) {
         return '';
     }
     // Execute the login
     if (\Input::get('fblogin')) {
         if ($this->loginWithFacebook()) {
             $this->jumpToOrReload($this->jumpTo);
         } else {
             $_SESSION['FACEBOOK_LOGIN'] = \Message::generate();
             $this->redirect(preg_replace('/(\\?|&)fblogin=1/', '', \Environment::get('request')));
         }
     }
     return parent::generate();
 }
开发者ID:codefog,项目名称:contao-facebook_login,代码行数:30,代码来源:ModuleFacebookLogin.php

示例5: run

 /**
  * Run the controller and parse the password template
  */
 public function run()
 {
     /** @var \BackendTemplate|object $objTemplate */
     $objTemplate = new \BackendTemplate('be_password');
     if (\Input::post('FORM_SUBMIT') == 'tl_password') {
         $pw = \Input::postUnsafeRaw('password');
         $cnf = \Input::postUnsafeRaw('confirm');
         // The passwords do not match
         if ($pw != $cnf) {
             \Message::addError($GLOBALS['TL_LANG']['ERR']['passwordMatch']);
         } elseif (utf8_strlen($pw) < \Config::get('minPasswordLength')) {
             \Message::addError(sprintf($GLOBALS['TL_LANG']['ERR']['passwordLength'], \Config::get('minPasswordLength')));
         } elseif ($pw == $this->User->username) {
             \Message::addError($GLOBALS['TL_LANG']['ERR']['passwordName']);
         } else {
             // Make sure the password has been changed
             if (\Encryption::verify($pw, $this->User->password)) {
                 \Message::addError($GLOBALS['TL_LANG']['MSC']['pw_change']);
             } else {
                 $this->loadDataContainer('tl_user');
                 // Trigger the save_callback
                 if (is_array($GLOBALS['TL_DCA']['tl_user']['fields']['password']['save_callback'])) {
                     foreach ($GLOBALS['TL_DCA']['tl_user']['fields']['password']['save_callback'] as $callback) {
                         if (is_array($callback)) {
                             $this->import($callback[0]);
                             $pw = $this->{$callback[0]}->{$callback[1]}($pw);
                         } elseif (is_callable($callback)) {
                             $pw = $callback($pw);
                         }
                     }
                 }
                 $objUser = \UserModel::findByPk($this->User->id);
                 $objUser->pwChange = '';
                 $objUser->password = \Encryption::hash($pw);
                 $objUser->save();
                 \Message::addConfirmation($GLOBALS['TL_LANG']['MSC']['pw_changed']);
                 $this->redirect('' . $GLOBALS['TL_CONFIG']['backendPath'] . '/main.php');
             }
         }
         $this->reload();
     }
     $objTemplate->theme = \Backend::getTheme();
     $objTemplate->messages = \Message::generate();
     $objTemplate->base = \Environment::get('base');
     $objTemplate->language = $GLOBALS['TL_LANGUAGE'];
     $objTemplate->title = specialchars($GLOBALS['TL_LANG']['MSC']['pw_new']);
     $objTemplate->charset = \Config::get('characterSet');
     $objTemplate->action = ampersand(\Environment::get('request'));
     $objTemplate->headline = $GLOBALS['TL_LANG']['MSC']['pw_change'];
     $objTemplate->submitButton = specialchars($GLOBALS['TL_LANG']['MSC']['continue']);
     $objTemplate->password = $GLOBALS['TL_LANG']['MSC']['password'][0];
     $objTemplate->confirm = $GLOBALS['TL_LANG']['MSC']['confirm'][0];
     $objTemplate->output();
 }
开发者ID:rheintechnology,项目名称:core,代码行数:57,代码来源:BackendPassword.php

示例6: run

 /**
  * Run the controller and parse the password template
  */
 public function run()
 {
     $this->Template = new BackendTemplate('be_password');
     if (Input::post('FORM_SUBMIT') == 'tl_password') {
         $pw = Input::post('password');
         $cnf = Input::post('confirm');
         // Do not allow special characters
         if (preg_match('/[#\\(\\)\\/<=>]/', html_entity_decode(Input::post('password')))) {
             Message::addError($GLOBALS['TL_LANG']['ERR']['extnd']);
         } elseif ($pw != $cnf) {
             Message::addError($GLOBALS['TL_LANG']['ERR']['passwordMatch']);
         } elseif (utf8_strlen($pw) < $GLOBALS['TL_CONFIG']['minPasswordLength']) {
             Message::addError(sprintf($GLOBALS['TL_LANG']['ERR']['passwordLength'], $GLOBALS['TL_CONFIG']['minPasswordLength']));
         } elseif ($pw == $this->User->username) {
             Message::addError($GLOBALS['TL_LANG']['ERR']['passwordName']);
         } else {
             list(, $strSalt) = explode(':', $this->User->password);
             $strPassword = sha1($strSalt . $pw);
             // Make sure the password has been changed
             if ($strPassword . ':' . $strSalt == $this->User->password) {
                 Message::addError($GLOBALS['TL_LANG']['MSC']['pw_change']);
             } else {
                 $strSalt = substr(md5(uniqid(mt_rand(), true)), 0, 23);
                 $strPassword = sha1($strSalt . $pw);
                 $objUser = UserModel::findByPk($this->User->id);
                 $objUser->pwChange = '';
                 $objUser->password = $strPassword . ':' . $strSalt;
                 $objUser->save();
                 Message::addConfirmation($GLOBALS['TL_LANG']['MSC']['pw_changed']);
                 $this->redirect('contao/main.php');
             }
         }
         $this->reload();
     }
     $this->Template->theme = $this->getTheme();
     $this->Template->messages = Message::generate();
     $this->Template->base = Environment::get('base');
     $this->Template->language = $GLOBALS['TL_LANGUAGE'];
     $this->Template->title = specialchars($GLOBALS['TL_LANG']['MSC']['pw_new']);
     $this->Template->charset = $GLOBALS['TL_CONFIG']['characterSet'];
     $this->Template->action = ampersand(Environment::get('request'));
     $this->Template->headline = $GLOBALS['TL_LANG']['MSC']['pw_change'];
     $this->Template->submitButton = specialchars($GLOBALS['TL_LANG']['MSC']['continue']);
     $this->Template->password = $GLOBALS['TL_LANG']['MSC']['password'][0];
     $this->Template->confirm = $GLOBALS['TL_LANG']['MSC']['confirm'][0];
     $this->Template->output();
 }
开发者ID:rikaix,项目名称:core,代码行数:50,代码来源:password.php

示例7: 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

示例8: import

    /**
     * Imports rules from XML
     *
     * @param \DataContainer $dc
     * @return string
     */
    public function import(\DataContainer $dc)
    {
        $class = \BackendUser::getInstance()->uploader;
        if (!class_exists($class) || $class == 'DropZone') {
            $class = 'FileUpload';
        }
        $uploader = new $class();
        if (\Input::post('FORM_SUBMIT') == 'css_class_replacer_import') {
            $uploaded = $uploader->uploadTo('system/tmp');
            foreach ($uploaded as $file) {
                $this->importRuleSet($file, $dc->id);
            }
            // Let's be nice and update the cache automatically
            $rules = RuleModel::findAll();
            $helper = new BackendHelper();
            $helper->updateCacheableValues($rules);
        }
        // Return the form
        return '
<div id="tl_buttons">
<a href="' . ampersand(str_replace('&key=importCssClassReplacerRules', '', \Environment::get('request'))) . '" class="header_back" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']) . '" accesskey="b">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a>
</div>
' . \Message::generate() . '
<form action="' . ampersand(\Environment::get('request'), true) . '" id="css_class_replacer_import" class="tl_form" method="post" enctype="multipart/form-data">
<div class="tl_formbody_edit">
<input type="hidden" name="FORM_SUBMIT" value="css_class_replacer_import">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">

<div class="tl_tbox">
  <h3>' . $GLOBALS['TL_LANG']['tl_css_class_replacer']['source'][0] . '</h3>' . $uploader->generateMarkup() . (isset($GLOBALS['TL_LANG']['tl_css_class_replacer']['source'][1]) ? '
  <p class="tl_help tl_tip">' . $GLOBALS['TL_LANG']['tl_css_class_replacer']['source'][1] . '</p>' : '') . '
</div>

</div>

<div class="tl_formbody_submit">

<div class="tl_submit_container">
  <input type="submit" name="save" id="save" class="tl_submit" accesskey="s" value="' . specialchars($GLOBALS['TL_LANG']['tl_css_class_replacer']['import'][0]) . '">
</div>

</div>
</form>';
    }
开发者ID:toflar,项目名称:contao-css-class-replacer,代码行数:50,代码来源:XmlImporter.php

示例9: generate

    /**
     * Import images and other media file for products
     *
     * @return string
     */
    public function generate()
    {
        $objTree = new \FileTree(\FileTree::getAttributesFromDca($GLOBALS['TL_DCA']['tl_iso_product']['fields']['source'], 'source', null, 'source', 'tl_iso_product'));
        // Import assets
        if (\Input::post('FORM_SUBMIT') == 'tl_iso_product_import' && \Input::post('source') != '') {
            $objFolder = \FilesModel::findByUuid(\StringUtil::uuidToBin(\Input::post('source')));
            if (null !== $objFolder) {
                $this->importFromPath($objFolder->path);
            }
        }
        // Return form
        return '
<div id="tl_buttons">
<a href="' . ampersand(str_replace('&key=import', '', \Environment::get('request'))) . '" class="header_back" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['backBT']) . '">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a>
</div>

<h2 class="sub_headline">' . $GLOBALS['TL_LANG']['tl_iso_product']['import'][1] . '</h2>

<div class="tl_message"><div class="tl_info">' . $GLOBALS['TL_LANG']['tl_iso_product']['importAssetsDescr'] . '</div></div>
' . \Message::generate() . '

<form action="' . ampersand(\Environment::get('request'), true) . '" id="tl_iso_product_import" class="tl_form" method="post">
<div class="tl_formbody_edit iso_importassets">
<input type="hidden" name="FORM_SUBMIT" value="tl_iso_product_import">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">

<div class="tl_tbox block">
  <h3><label for="source">' . $GLOBALS['TL_LANG']['tl_iso_product']['source'][0] . '</label></h3>
  ' . $objTree->generate() . (strlen($GLOBALS['TL_LANG']['tl_iso_product']['source'][1]) ? '
  <p class="tl_help">' . $GLOBALS['TL_LANG']['tl_iso_product']['source'][1] . '</p>' : '') . '
</div>

</div>

<div class="tl_formbody_submit">

<div class="tl_submit_container">
<input type="submit" name="save" id="save" class="tl_submit" alt="import product assets" accesskey="s" value="' . specialchars($GLOBALS['TL_LANG']['tl_iso_product']['import'][0]) . '">
</div>

</div>
</form>';
    }
开发者ID:ralfhartmann,项目名称:isotope_core,代码行数:48,代码来源:AssetImport.php

示例10: run

 /**
  * Run the controller and parse the password template
  */
 public function run()
 {
     $this->Template = new BackendTemplate('be_password');
     if (Input::post('FORM_SUBMIT') == 'tl_password') {
         $pw = Input::post('password', true);
         $cnf = Input::post('confirm', true);
         // The passwords do not match
         if ($pw != $cnf) {
             Message::addError($GLOBALS['TL_LANG']['ERR']['passwordMatch']);
         } elseif (utf8_strlen($pw) < $GLOBALS['TL_CONFIG']['minPasswordLength']) {
             Message::addError(sprintf($GLOBALS['TL_LANG']['ERR']['passwordLength'], $GLOBALS['TL_CONFIG']['minPasswordLength']));
         } elseif ($pw == $this->User->username) {
             Message::addError($GLOBALS['TL_LANG']['ERR']['passwordName']);
         } else {
             // Make sure the password has been changed
             if (crypt($pw, $this->User->password) == $this->User->password) {
                 Message::addError($GLOBALS['TL_LANG']['MSC']['pw_change']);
             } else {
                 $objUser = UserModel::findByPk($this->User->id);
                 $objUser->pwChange = '';
                 $objUser->password = Encryption::hash($pw);
                 $objUser->save();
                 Message::addConfirmation($GLOBALS['TL_LANG']['MSC']['pw_changed']);
                 $this->redirect('contao/main.php');
             }
         }
         $this->reload();
     }
     $this->Template->theme = $this->getTheme();
     $this->Template->messages = Message::generate();
     $this->Template->base = Environment::get('base');
     $this->Template->language = $GLOBALS['TL_LANGUAGE'];
     $this->Template->title = specialchars($GLOBALS['TL_LANG']['MSC']['pw_new']);
     $this->Template->charset = $GLOBALS['TL_CONFIG']['characterSet'];
     $this->Template->action = ampersand(Environment::get('request'));
     $this->Template->headline = $GLOBALS['TL_LANG']['MSC']['pw_change'];
     $this->Template->submitButton = specialchars($GLOBALS['TL_LANG']['MSC']['continue']);
     $this->Template->password = $GLOBALS['TL_LANG']['MSC']['password'][0];
     $this->Template->confirm = $GLOBALS['TL_LANG']['MSC']['confirm'][0];
     $this->Template->output();
 }
开发者ID:rburch,项目名称:core,代码行数:44,代码来源:password.php

示例11: generateForm

    /**
     * @param \NotificationCenter\Model\Notification[] $notifications
     * @param int[]                                    $ids
     *
     * @return string
     */
    public static function generateForm(array $notifications, array $ids)
    {
        $return = '
<div id="tl_buttons">
<a href="' . \System::getReferer(true) . '" class="header_back" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']) . '" accesskey="b">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a>
</div>

<h2 class="sub_headline">' . $GLOBALS['TL_LANG']['tl_lead']['notification'][0] . '</h2>
' . \Message::generate() . '
<form action="' . ampersand(\Environment::get('request'), true) . '" id="tl_leads_notification" class="tl_form" method="post">
<div class="tl_formbody_edit">
<input type="hidden" name="FORM_SUBMIT" value="tl_leads_notification">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">
<input type="hidden" name="IDS[]" value="' . implode('">
<input type="hidden" name="IDS[]" value="', $ids) . '">

<div class="tl_tbox">
  <h3><label for="notification">' . $GLOBALS['TL_LANG']['tl_lead']['notification_list'][0] . '</label></h3>
  <select name="notification" id="notification" class="tl_select">';
        // Generate options
        foreach ($notifications as $id => $name) {
            $return .= '<option value="' . $id . '">' . $name . '</option>';
        }
        $return .= '
  </select>
  <p class="tl_help tl_tip">' . $GLOBALS['TL_LANG']['tl_lead']['notification_list'][1] . '</p>
</div>

</div>

<div class="tl_formbody_submit">

<div class="tl_submit_container">
  <input type="submit" name="save" id="save" class="tl_submit" accesskey="s" value="' . specialchars($GLOBALS['TL_LANG']['tl_lead']['notification'][0]) . '">
</div>

</div>
</form>';
        return $return;
    }
开发者ID:terminal42,项目名称:contao-leads,代码行数:46,代码来源:NotificationCenterIntegration.php

示例12: 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

示例13: importExt

 public function importExt()
 {
     $this->loadLanguageFile("tl_calendar_events");
     $this->Template = new BackendTemplate('be_importExt_calendar');
     $this->Template->headline = 'Test';
     $this->Template->message = \Message::generate();
     $this->Template->event_type = $this->getEventTypeWidget();
     $this->Template->hrefBack = ampersand(str_replace('&key=import', '', \Environment::get('request')));
     $this->Template->goBack = $GLOBALS['TL_LANG']['MSC']['goBack'];
     $this->Template->headline = $GLOBALS['TL_LANG']['MSC']['import_calendar'][0];
     $this->Template->request = ampersand(\Environment::get('request'), ENCODE_AMPERSANDS);
     $this->Template->submit = specialchars($GLOBALS['TL_LANG']['tl_calendar_events']['importExt'][0]);
     if (\Input::post('FORM_SUBMIT') == 'tl_importExt_calendar') {
         if (empty(\Input::post('event_type'))) {
             \Message::addError($GLOBALS['TL_LANG']['ERR']['all_fields']);
             $this->reload();
         } else {
             $this->Session->set('event_type', \Input::post('event_type'));
             $this->redirect(str_replace('&key=importExt', '&key=import', \Environment::get('request')));
         }
     }
     return $this->Template->parse();
 }
开发者ID:TomGanske,项目名称:calendar_iHoliday,代码行数:23,代码来源:CalendarImportExt.php

示例14: send

    /**
     * Renturn a form to choose an existing style sheet and import it
     * @param \DataContainer
     * @return string
     */
    public function send(\DataContainer $objDc)
    {
        if (TL_MODE == 'BE') {
            $GLOBALS['TL_CSS'][] = 'system/modules/newsletter_content/assets/css/style.css';
            if ($this->isFlexible) {
                $GLOBALS['TL_CSS'][] = 'system/modules/newsletter_content/assets/css/style-flexible.css';
            }
        }
        $objNewsletter = $this->Database->prepare("SELECT n.*, c.useSMTP, c.smtpHost, c.smtpPort, c.smtpUser, c.smtpPass FROM tl_newsletter n LEFT JOIN tl_newsletter_channel c ON n.pid=c.id WHERE n.id=?")->limit(1)->execute($objDc->id);
        // Return if there is no newsletter
        if ($objNewsletter->numRows < 1) {
            return '';
        }
        // Overwrite the SMTP configuration
        if ($objNewsletter->useSMTP) {
            $GLOBALS['TL_CONFIG']['useSMTP'] = true;
            $GLOBALS['TL_CONFIG']['smtpHost'] = $objNewsletter->smtpHost;
            $GLOBALS['TL_CONFIG']['smtpUser'] = $objNewsletter->smtpUser;
            $GLOBALS['TL_CONFIG']['smtpPass'] = $objNewsletter->smtpPass;
            $GLOBALS['TL_CONFIG']['smtpEnc'] = $objNewsletter->smtpEnc;
            $GLOBALS['TL_CONFIG']['smtpPort'] = $objNewsletter->smtpPort;
        }
        // Add default sender address
        if ($objNewsletter->sender == '') {
            list($objNewsletter->senderName, $objNewsletter->sender) = \String::splitFriendlyEmail($GLOBALS['TL_CONFIG']['adminEmail']);
        }
        $arrAttachments = array();
        $blnAttachmentsFormatError = false;
        // Add attachments
        if ($objNewsletter->addFile) {
            $files = deserialize($objNewsletter->files);
            if (!empty($files) && is_array($files)) {
                $objFiles = \FilesModel::findMultipleByUuids($files);
                if ($objFiles === null) {
                    if (!\Validator::isUuid($files[0])) {
                        $blnAttachmentsFormatError = true;
                        \Message::addError($GLOBALS['TL_LANG']['ERR']['version2format']);
                    }
                } else {
                    while ($objFiles->next()) {
                        if (is_file(TL_ROOT . '/' . $objFiles->path)) {
                            $arrAttachments[] = $objFiles->path;
                        }
                    }
                }
            }
        }
        // Get content
        $html = '';
        $objContentElements = \ContentModel::findPublishedByPidAndTable($objNewsletter->id, 'tl_newsletter');
        if ($objContentElements !== null) {
            if (!defined('NEWSLETTER_CONTENT_PREVIEW')) {
                define('NEWSLETTER_CONTENT_PREVIEW', true);
            }
            while ($objContentElements->next()) {
                $html .= $this->getContentElement($objContentElements->id);
            }
        }
        // Replace insert tags
        $text = $this->replaceInsertTags($objNewsletter->text);
        $html = $this->replaceInsertTags($html);
        // Convert relative URLs
        $html = $this->convertRelativeUrls($html);
        // Set back to object
        $objNewsletter->content = $html;
        // Send newsletter
        if (!$blnAttachmentsFormatError && \Input::get('token') != '' && \Input::get('token') == $this->Session->get('tl_newsletter_send')) {
            $referer = preg_replace('/&(amp;)?(start|mpc|token|recipient|preview)=[^&]*/', '', \Environment::get('request'));
            // Preview
            if (isset($_GET['preview'])) {
                // Check the e-mail address
                if (!\Validator::isEmail(\Input::get('recipient', true))) {
                    $_SESSION['TL_PREVIEW_MAIL_ERROR'] = true;
                    $this->redirect($referer);
                }
                // get preview recipient
                $arrRecipient = array();
                $strEmail = urldecode(\Input::get('recipient', true));
                $objRecipient = $this->Database->prepare("SELECT * FROM tl_member m WHERE email=? ORDER BY email")->limit(1)->execute($strEmail);
                if ($objRecipient->num_rows < 1) {
                    $arrRecipient['email'] = $strEmail;
                } else {
                    $arrRecipient = $objRecipient->row();
                }
                $arrRecipient = array_merge($arrRecipient, array('extra' => '&preview=1', 'tracker_png' => \Environment::get('base') . 'tracking/?n=' . $objNewsletter->id . '&e=' . $strEmail . '&preview=1&t=png', 'tracker_gif' => \Environment::get('base') . 'tracking/?n=' . $objNewsletter->id . '&e=' . $strEmail . '&preview=1&t=gif', 'tracker_css' => \Environment::get('base') . 'tracking/?n=' . $objNewsletter->id . '&e=' . $strEmail . '&preview=1&t=css', 'tracker_js' => \Environment::get('base') . 'tracking/?n=' . $objNewsletter->id . '&e=' . $strEmail . '&preview=1&t=js'));
                // Send
                $objEmail = $this->generateEmailObject($objNewsletter, $arrAttachments);
                $objNewsletter->email = $strEmail;
                $this->sendNewsletter($objEmail, $objNewsletter, $arrRecipient, $text, $html);
                // Redirect
                \Message::addConfirmation(sprintf($GLOBALS['TL_LANG']['tl_newsletter']['confirm'], 1));
                $this->redirect($referer);
            }
            // Get the total number of recipients
            $objTotal = $this->Database->prepare("SELECT COUNT(DISTINCT email) AS count FROM tl_newsletter_recipients WHERE pid=? AND active=1")->execute($objNewsletter->pid);
//.........这里部分代码省略.........
开发者ID:naitsirk68,项目名称:newsletter_content,代码行数:101,代码来源:NewsletterContent.php

示例15: listView

    /**
     * List all records of the current table and return them as HTML string
     *
     * @return string
     */
    protected function listView()
    {
        $return = '';
        $table = $GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['mode'] == 6 ? $this->ptable : $this->strTable;
        $orderBy = $GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['fields'];
        $firstOrderBy = preg_replace('/\\s+.*$/', '', $orderBy[0]);
        if (is_array($this->orderBy) && $this->orderBy[0] != '') {
            $orderBy = $this->orderBy;
            $firstOrderBy = $this->firstOrderBy;
        }
        $query = "SELECT * FROM " . $this->strTable;
        if (!empty($this->procedure)) {
            $query .= " WHERE " . implode(' AND ', $this->procedure);
        }
        if (!empty($this->root) && is_array($this->root)) {
            $query .= (!empty($this->procedure) ? " AND " : " WHERE ") . "id IN(" . implode(',', array_map('intval', $this->root)) . ")";
        }
        if (is_array($orderBy) && $orderBy[0] != '') {
            foreach ($orderBy as $k => $v) {
                list($key, $direction) = explode(' ', $v, 2);
                if ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$key]['eval']['findInSet']) {
                    if (is_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$key]['options_callback'])) {
                        $strClass = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$key]['options_callback'][0];
                        $strMethod = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$key]['options_callback'][1];
                        $this->import($strClass);
                        $keys = $this->{$strClass}->{$strMethod}($this);
                    } elseif (is_callable($GLOBALS['TL_DCA'][$this->strTable]['fields'][$key]['options_callback'])) {
                        $keys = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$key]['options_callback']($this);
                    } else {
                        $keys = $GLOBALS['TL_DCA'][$this->strTable]['fields'][$key]['options'];
                    }
                    if ($GLOBALS['TL_DCA'][$this->strTable]['fields'][$key]['eval']['isAssociative'] || array_is_assoc($keys)) {
                        $keys = array_keys($keys);
                    }
                    $orderBy[$k] = $this->Database->findInSet($v, $keys);
                } elseif (in_array($GLOBALS['TL_DCA'][$this->strTable]['fields'][$key]['flag'], array(5, 6, 7, 8, 9, 10))) {
                    $orderBy[$k] = "CAST({$key} AS SIGNED)" . ($direction ? " {$direction}" : "");
                    // see #5503
                }
            }
            if ($GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['mode'] == 3) {
                $firstOrderBy = 'pid';
                $showFields = $GLOBALS['TL_DCA'][$table]['list']['label']['fields'];
                $query .= " ORDER BY (SELECT " . $showFields[0] . " FROM " . $this->ptable . " WHERE " . $this->ptable . ".id=" . $this->strTable . ".pid), " . implode(', ', $orderBy);
                // Set the foreignKey so that the label is translated (also for backwards compatibility)
                if ($GLOBALS['TL_DCA'][$table]['fields']['pid']['foreignKey'] == '') {
                    $GLOBALS['TL_DCA'][$table]['fields']['pid']['foreignKey'] = $this->ptable . '.' . $showFields[0];
                }
                // Remove the parent field from label fields
                array_shift($showFields);
                $GLOBALS['TL_DCA'][$table]['list']['label']['fields'] = $showFields;
            } else {
                $query .= " ORDER BY " . implode(', ', $orderBy);
            }
        }
        if ($GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['mode'] == 1 && $GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['flag'] % 2 == 0) {
            $query .= " DESC";
        }
        $objRowStmt = $this->Database->prepare($query);
        if ($this->limit != '') {
            $arrLimit = explode(',', $this->limit);
            $objRowStmt->limit($arrLimit[1], $arrLimit[0]);
        }
        $objRow = $objRowStmt->execute($this->values);
        $this->bid = $return != '' ? $this->bid : 'tl_buttons';
        // Display buttos
        if (!$GLOBALS['TL_DCA'][$this->strTable]['config']['closed'] || !empty($GLOBALS['TL_DCA'][$this->strTable]['list']['global_operations'])) {
            $return .= '

<div id="' . $this->bid . '">' . (\Input::get('act') == 'select' || $this->ptable ? '
<a href="' . $this->getReferer(true, $this->ptable) . '" class="header_back" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']) . '" accesskey="b" onclick="Backend.getScrollOffset()">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a> ' : (isset($GLOBALS['TL_DCA'][$this->strTable]['config']['backlink']) ? '
<a href="contao/main.php?' . $GLOBALS['TL_DCA'][$this->strTable]['config']['backlink'] . '" class="header_back" title="' . specialchars($GLOBALS['TL_LANG']['MSC']['backBTTitle']) . '" accesskey="b" onclick="Backend.getScrollOffset()">' . $GLOBALS['TL_LANG']['MSC']['backBT'] . '</a> ' : '')) . (\Input::get('act') != 'select' && !$GLOBALS['TL_DCA'][$this->strTable]['config']['closed'] && !$GLOBALS['TL_DCA'][$this->strTable]['config']['notCreatable'] ? '
<a href="' . ($this->ptable != '' ? $this->addToUrl('act=create' . ($GLOBALS['TL_DCA'][$this->strTable]['list']['sorting']['mode'] < 4 ? '&amp;mode=2' : '') . '&amp;pid=' . $this->intId) : $this->addToUrl('act=create')) . '" class="header_new" title="' . specialchars($GLOBALS['TL_LANG'][$this->strTable]['new'][1]) . '" accesskey="n" onclick="Backend.getScrollOffset()">' . $GLOBALS['TL_LANG'][$this->strTable]['new'][0] . '</a> ' : '') . $this->generateGlobalButtons() . '
</div>' . \Message::generate(true);
        }
        // Return "no records found" message
        if ($objRow->numRows < 1) {
            $return .= '
<p class="tl_empty">' . $GLOBALS['TL_LANG']['MSC']['noResult'] . '</p>';
        } else {
            $result = $objRow->fetchAllAssoc();
            $return .= (\Input::get('act') == 'select' ? '

<form action="' . ampersand(\Environment::get('request'), true) . '" id="tl_select" class="tl_form' . (\Input::get('act') == 'select' ? ' unselectable' : '') . '" method="post" novalidate>
<div class="tl_formbody">
<input type="hidden" name="FORM_SUBMIT" value="tl_select">
<input type="hidden" name="REQUEST_TOKEN" value="' . REQUEST_TOKEN . '">' : '') . '

<div class="tl_listing_container list_view">' . (\Input::get('act') == 'select' ? '

<div class="tl_select_trigger">
<label for="tl_select_trigger" class="tl_select_label">' . $GLOBALS['TL_LANG']['MSC']['selectAll'] . '</label> <input type="checkbox" id="tl_select_trigger" onclick="Backend.toggleCheckboxes(this)" class="tl_tree_checkbox">
</div>' : '') . '

<table class="tl_listing' . ($GLOBALS['TL_DCA'][$this->strTable]['list']['label']['showColumns'] ? ' showColumns' : '') . '">';
//.........这里部分代码省略.........
开发者ID:bytehead,项目名称:contao-core,代码行数:101,代码来源:DC_Table.php


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