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


PHP FWLanguage::getIdArray方法代码示例

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


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

示例1: modifyEvent

    /**
     * Add / Edit Event
     * 
     * @param integer $eventId Event id
     * 
     * @return null
     */
    function modifyEvent($eventId = null)
    {
        global $_ARRAYLANG, $_CORELANG, $_LANGID;
        \JS::activate('cx');
        \JS::activate('jqueryui');
        \JS::registerJS('modules/Calendar/View/Script/Frontend.js');
        $this->getFrontendLanguages();
        $this->getSettings();
        $this->_objTpl->setTemplate($this->pageContent, true, true);
        $showFrom = true;
        $objEvent = new \Cx\Modules\Calendar\Controller\CalendarEvent();
        $isEventLoaded = false;
        if (isset($_POST['submitFormModifyEvent'])) {
            $arrData = array();
            $arrData = $_POST;
            $arrData['access'] = 0;
            $arrData['priority'] = 3;
            if ($objEvent->save($arrData)) {
                $showFrom = false;
                $this->_objTpl->hideBlock('calendarEventModifyForm');
                $this->_objTpl->touchBlock('calendarEventOkMessage');
                // refresh event data after save
                $objEvent->get($eventId);
                $objEvent->getData();
                $isEventLoaded = true;
                $objMailManager = new \Cx\Modules\Calendar\Controller\CalendarMailManager();
                $objMailManager->sendMail($objEvent, \Cx\Modules\Calendar\Controller\CalendarMailManager::MAIL_NOTFY_NEW_APP);
            } else {
                $this->_objTpl->touchBlock('calendarEventErrMessage');
            }
        }
        if ($eventId && !$isEventLoaded) {
            $objEvent->get($eventId);
            $objEvent->getData();
        }
        $dateFormat = $this->getDateFormat(1);
        $locationType = $this->arrSettings['placeData'] == 3 ? $eventId != 0 ? $objEvent->locationType : 1 : $this->arrSettings['placeData'];
        $hostType = $this->arrSettings['placeDataHost'] == 3 ? $eventId != 0 ? $objEvent->hostType : 1 : $this->arrSettings['placeDataHost'];
        \ContrexxJavascript::getInstance()->setVariable(array('language_id' => \FWLanguage::getDefaultLangId(), 'active_lang' => implode(',', \FWLanguage::getIdArray())), 'calendar');
        $javascript = <<<EOF
<script language="JavaScript" type="text/javascript">
var defaultLang = cx.variables.get('language_id', 'calendar');
var activeLang = [cx.variables.get('active_lang', 'calendar')];
cx.ready(function() {
    var options = {
        dateFormat: '{$dateFormat}',        
        timeFormat: 'hh:mm',
        showSecond: false,
        onSelect: function(dateText, inst){
            var startDate = cx.jQuery( ".startDate" ).datetimepicker("getDate");
            var endDate   = cx.jQuery( ".endDate" ).datetimepicker("getDate");

            if ( cx.jQuery( this )[0].id == 'startDate' ) {
                var prevStartDate = cx.jQuery( ".startDate" ).data('prevDate');

                if (cx.jQuery(".all_day").is(':checked')) {
                    prevStartDate.setHours(0, 0, 0);
                    startDate.setHours(0, 0, 0);
                    endDate.setHours(0, 0, 0);
                }

                if (prevStartDate.getTime() != startDate.getTime()) {
                    var timeDiff = Math.abs(endDate.getTime() - prevStartDate.getTime());
                    endDate = new Date(startDate.getTime() + timeDiff);
                    cx.jQuery( ".endDate" ).datetimepicker('setDate', endDate);
                }

            } else if (startDate.getTime() > endDate.getTime()) {
                endDate = new Date(startDate.getTime() + (30*60*1000));
                cx.jQuery(".endDate").datetimepicker('setDate', endDate);
            }

            cx.jQuery( ".startDate" ).data('prevDate', cx.jQuery(".startDate").datetimepicker("getDate"));
            cx.jQuery( ".endDate" ).data('prevDate', cx.jQuery(".endDate").datetimepicker("getDate"));
            cx.jQuery( this ).datetimepicker('refresh');
        }
    };
    cx.jQuery('input[name=startDate]')
        .datetimepicker(options)
        .data('prevDate', cx.jQuery(".startDate").datetimepicker("getDate"));
    cx.jQuery('input[name=endDate]')
        .datetimepicker(options)
        .data('prevDate', cx.jQuery(".endDate").datetimepicker("getDate"));
    if ( \$J(".all_day").is(':checked') ) {
        modifyEvent._handleAllDayEvent( \$J(".all_day") );
    }
    showOrHidePlaceFields('{$locationType}', 'place');
    showOrHidePlaceFields('{$hostType}', 'host');
});

</script>
EOF;
        if ($showFrom) {
//.........这里部分代码省略.........
开发者ID:Niggu,项目名称:cloudrexx,代码行数:101,代码来源:Calendar.class.php

示例2: editEntry

 /**
  * Shows the "Edit Entry" page.
  *
  * @global  array
  * @global  array
  * @global  array
  * @global  FWLanguage
  * @param   integer     $intEntryId: The values of this entry will be loaded into the form.
  */
 function editEntry($intEntryId)
 {
     global $_CORELANG, $_ARRAYLANG, $objDatabase;
     $count = $objDatabase->Execute('SELECT message_id
                                     FROM ' . DBPREFIX . 'module_blog_messages
                                     WHERE message_id = "' . $intEntryId . '"');
     if ($count->RecordCount() != 1) {
         \Permission::noAccess();
     }
     $this->_strPageTitle = $_ARRAYLANG['TXT_BLOG_ENTRY_EDIT_TITLE'];
     $this->_objTpl->loadTemplateFile('module_blog_entries_edit.html', true, true);
     $options = array('type' => 'button', 'data-cx-mb-views' => 'filebrowser', 'data-cx-mb-startmediatype' => 'blog', 'id' => 'mediabrowser_button', 'style' => 'display:none');
     $mediaBrowser = self::getMediaBrowserButton($_ARRAYLANG['TXT_BLOG_ENTRY_ADD_IMAGE_BROWSE'], $options, 'blogSetUrl');
     $this->_objTpl->setVariable(array('TXT_EDIT_LANGUAGES' => $_ARRAYLANG['TXT_BLOG_CATEGORY_ADD_LANGUAGES'], 'TXT_EDIT_SUBMIT' => $_ARRAYLANG['TXT_BLOG_SAVE'], 'BLOG_MEDIABROWSER_BUTTON' => $mediaBrowser));
     $arrCategories = $this->createCategoryArray();
     $arrEntries = $this->createEntryArray();
     $intEntryId = intval($intEntryId);
     $forcedLanguage = null;
     if (isset($_GET['langId']) && in_array(contrexx_input2raw($_GET['langId']), \FWLanguage::getIdArray())) {
         $forcedLanguage = contrexx_input2raw($_GET['langId']);
     }
     if ($intEntryId > 0 && key_exists($intEntryId, $arrEntries)) {
         if (count($this->_arrLanguages) > 0) {
             $intLanguageCounter = 0;
             $boolFirstLanguage = true;
             $arrLanguages = array(0 => '', 1 => '', 2 => '');
             $strJsTabToDiv = '';
             foreach ($this->_arrLanguages as $intLanguageId => $arrTranslations) {
                 $boolLanguageIsActive = $arrEntries[$intEntryId]['translation'][$intLanguageId]['is_active'];
                 if (!$boolLanguageIsActive && $forcedLanguage == $intLanguageId) {
                     $boolLanguageIsActive = true;
                 }
                 $arrLanguages[$intLanguageCounter % 3] .= '<input ' . ($boolLanguageIsActive ? 'checked="checked"' : '') . ' type="checkbox" name="frmEditEntry_Languages[]" value="' . $intLanguageId . '" onclick="switchBoxAndTab(this, \'addEntry_' . $arrTranslations['long'] . '\');" />' . $arrTranslations['long'] . ' [' . $arrTranslations['short'] . ']<br />';
                 $strJsTabToDiv .= 'arrTabToDiv["addEntry_' . $arrTranslations['long'] . '"] = "' . $arrTranslations['long'] . '";' . "\n";
                 $activeTab = $boolFirstLanguage;
                 if ($forcedLanguage) {
                     $activeTab = $forcedLanguage == $intLanguageId;
                 }
                 //Parse the TABS at the top of the language-selection
                 $this->_objTpl->setVariable(array('TABS_LINK_ID' => 'addEntry_' . $arrTranslations['long'], 'TABS_DIV_ID' => $arrTranslations['long'], 'TABS_CLASS' => $activeTab && $boolLanguageIsActive ? 'active' : 'inactive', 'TABS_DISPLAY_STYLE' => $boolLanguageIsActive ? 'display: inline;' : 'display: none;', 'TABS_NAME' => $arrTranslations['long']));
                 $this->_objTpl->parse('showLanguageTabs');
                 //Parse the DIVS for every language
                 $this->_objTpl->setVariable(array('TXT_DIV_SUBJECT' => $_ARRAYLANG['TXT_BLOG_ENTRY_ADD_SUBJECT'], 'TXT_DIV_KEYWORDS' => $_ARRAYLANG['TXT_BLOG_ENTRY_ADD_KEYWORDS'], 'TXT_DIV_IMAGE' => $_ARRAYLANG['TXT_BLOG_ENTRY_ADD_IMAGE'], 'TXT_DIV_IMAGE_BROWSE' => $_ARRAYLANG['TXT_BLOG_ENTRY_ADD_IMAGE_BROWSE'], 'TXT_DIV_CATEGORIES' => $_ARRAYLANG['TXT_BLOG_ENTRY_ADD_CATEGORIES']));
                 //Filter out active categories for this language
                 $intCategoriesCounter = 0;
                 $arrCategoriesContent = array(0 => '', 1 => '', 2 => '');
                 foreach ($arrCategories as $intCategoryId => $arrCategoryValues) {
                     if ($arrCategoryValues[$intLanguageId]['is_active']) {
                         $arrCategoriesContent[$intCategoriesCounter % 3] .= '<input type="checkbox" name="frmEditEntry_Categories_' . $intLanguageId . '[]" value="' . $intCategoryId . '" ' . (key_exists($intCategoryId, $arrEntries[$intEntryId]['categories'][$intLanguageId]) ? 'checked="checked"' : '') . ' />' . $arrCategoryValues[$intLanguageId]['name'] . '<br />';
                         ++$intCategoriesCounter;
                     }
                 }
                 $this->_objTpl->setVariable(array('DIV_ID' => $arrTranslations['long'], 'DIV_LANGUAGE_ID' => $intLanguageId, 'DIV_DISPLAY_STYLE' => $boolFirstLanguage && $boolLanguageIsActive ? 'display: block;' : 'display: none;', 'DIV_TITLE' => $arrTranslations['long'], 'DIV_SUBJECT' => $arrEntries[$intEntryId]['translation'][$intLanguageId]['subject'], 'DIV_KEYWORDS' => $arrEntries[$intEntryId]['translation'][$intLanguageId]['tags'], 'DIV_IMAGE' => $arrEntries[$intEntryId]['translation'][$intLanguageId]['image'], 'DIV_CATEGORIES_1' => $arrCategoriesContent[0], 'DIV_CATEGORIES_2' => $arrCategoriesContent[1], 'DIV_CATEGORIES_3' => $arrCategoriesContent[2], 'DIV_CONTENT' => new \Cx\Core\Wysiwyg\Wysiwyg('frmEditEntry_Content_' . $intLanguageId, $arrEntries[$intEntryId]['translation'][$intLanguageId]['content'], 'full', $intLanguageId)));
                 $this->_objTpl->parse('showLanguageDivs');
                 if ($boolLanguageIsActive) {
                     $boolFirstLanguage = false;
                 }
                 ++$intLanguageCounter;
             }
             $this->_objTpl->setVariable(array('EDIT_POST_ACTION' => '?cmd=Blog&amp;act=updateEntry', 'EDIT_MESSAGE_ID' => $intEntryId, 'EDIT_LANGUAGES_1' => $arrLanguages[0], 'EDIT_LANGUAGES_2' => $arrLanguages[1], 'EDIT_LANGUAGES_3' => $arrLanguages[2], 'EDIT_JS_TAB_TO_DIV' => $strJsTabToDiv));
         }
     } else {
         $this->_strErrMessage = $_ARRAYLANG['TXT_BLOG_ENTRY_EDIT_ERROR_ID'];
     }
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:74,代码来源:BlogManager.class.php

示例3: getSearchQueryBuilder

 /**
  * Gets the search query builder.
  * Searches for slug, title and content title by the given search term.
  * 
  * @return  \Doctrine\ORM\QueryBuilder  $qb
  */
 private function getSearchQueryBuilder()
 {
     $qb = $this->em->createQueryBuilder();
     // build query
     $qb->from('Cx\\Core\\ContentManager\\Model\\Entity\\Page', 'p')->where($qb->expr()->andX($qb->expr()->orX($qb->expr()->like('p.slug', ':searchTerm'), $qb->expr()->like('p.title', ':searchTerm'), $qb->expr()->like('p.contentTitle', ':searchTerm'), $qb->expr()->andX($qb->expr()->like('p.content', ':searchTerm'), 'p.type = \'' . \Cx\Core\ContentManager\Model\Entity\Page::TYPE_CONTENT . '\''), $qb->expr()->andX($qb->expr()->orX($qb->expr()->like('p.module', ':searchTerm'), $qb->expr()->like('p.cmd', ':searchTerm')), 'p.type = \'' . \Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION . '\'')), $qb->expr()->orX('p.module = \'\'', 'p.module IS NULL', $qb->expr()->in('p.module', $this->license->getLegalComponentsList())), $qb->expr()->orX($qb->expr()->in('p.lang', \FWLanguage::getIdArray('frontend')), $qb->expr()->eq('p.lang', "''"))))->setParameter('searchTerm', '%' . $this->term . '%')->orderBy('p.title');
     return $qb;
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:13,代码来源:SearchManager.class.php

示例4: getInactiveContentLanguageCheckboxes

 public function getInactiveContentLanguageCheckboxes()
 {
     try {
         $activeLanguageIds = implode(',', \FWLanguage::getIdArray());
         $objResult = \Cx\Lib\UpdateUtil::sql('
             SELECT DISTINCT `lang` FROM `' . DBPREFIX . 'content_navigation`
              WHERE `lang` NOT IN (' . $activeLanguageIds . ')
              UNION DISTINCT
             SELECT DISTINCT `lang` FROM `' . DBPREFIX . 'content_navigation_history`
              WHERE `lang` NOT IN (' . $activeLanguageIds . ')
                    ORDER BY `lang` ASC
         ');
         if ($objResult->RecordCount()) {
             $arrLanguages = \FWLanguage::getLanguageArray();
             $inactiveContentLanguages = '';
             while (!$objResult->EOF) {
                 $inactiveContentLanguages .= '
                     <input style="clear:left;float:left;margin-top:3px;" type="checkbox" name="migrateLangIds" id="migrate-lang-' . $objResult->fields['lang'] . '" value="' . $objResult->fields['lang'] . '" />
                     <label for="migrate-lang-' . $objResult->fields['lang'] . '">' . $arrLanguages[$objResult->fields['lang']]['name'] . '</label><br />
                 ';
                 $objResult->MoveNext();
             }
             return $inactiveContentLanguages;
         } else {
             return '';
         }
     } catch (\Cx\Lib\UpdateException $e) {
         return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
     }
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:30,代码来源:ContentMigration.class.php

示例5: edit

 /**
  * Edit the news, or if $copy is true, it copies an entry
  *
  * @global    ADONewConnection
  * @global    array
  * @global    array
  * @param     string     $pageContent
  */
 function edit($copy = false)
 {
     global $objDatabase, $_ARRAYLANG, $_CONFIG;
     \JS::activate('cx');
     if (!empty($this->arrSettings['news_use_tags'])) {
         \JS::registerJS('lib/javascript/tag-it/js/tag-it.min.js');
         \JS::registerCss('lib/javascript/tag-it/css/tag-it.css');
     }
     $newsTagId = 'newsTags';
     \FWUser::getUserLiveSearch();
     if (!$this->hasCategories()) {
         return $this->manageCategories();
     }
     $objFWUser = \FWUser::getFWUserObject();
     $status = '';
     $this->_objTpl->loadTemplateFile('module_news_modify.html', true, true);
     $this->pageTitle = $copy ? $_ARRAYLANG['TXT_CREATE_NEWS'] : $_ARRAYLANG['TXT_EDIT_NEWS_CONTENT'];
     $catrow = 'row2';
     if ($this->arrSettings['news_use_types'] == 1) {
         $catrow = 'row1';
     }
     $this->_objTpl->setGlobalVariable(array('TXT_CATEGORY_SELECT' => $_ARRAYLANG['TXT_CATEGORY_SELECT'], 'TXT_COPY' => $_ARRAYLANG['TXT_NEWS_COPY'], 'TXT_NEWS_MESSAGE' => $_ARRAYLANG['TXT_NEWS_MESSAGE'], 'TXT_TITLE' => $_ARRAYLANG['TXT_TITLE'], 'TXT_CATEGORY' => $_ARRAYLANG['TXT_CATEGORY'], 'TXT_NEWS_AUTHOR' => $_ARRAYLANG['TXT_NEWS_AUTHOR'], 'TXT_NEWS_PUBLISHER' => $_ARRAYLANG['TXT_NEWS_PUBLISHER'], 'TXT_CORE_SEARCH_USER' => $_ARRAYLANG['TXT_CORE_SEARCH_USER'], 'NEWS_FORM_CAT_ROW' => $catrow, 'TXT_NEWS_TYPE' => $_ARRAYLANG['TXT_NEWS_TYPE'], 'TXT_EXTERNAL_SOURCE' => $_ARRAYLANG['TXT_EXTERNAL_SOURCE'], 'TXT_LINK' => $_ARRAYLANG['TXT_LINK'], 'TXT_NEWS_NEWS_CONTENT' => $_ARRAYLANG['TXT_NEWS_NEWS_CONTENT'], 'TXT_PUBLISHING' => $_ARRAYLANG['TXT_PUBLISHING'], 'TXT_STARTDATE' => $_ARRAYLANG['TXT_STARTDATE'], 'TXT_ENDDATE' => $_ARRAYLANG['TXT_ENDDATE'], 'TXT_OPTIONAL' => $_ARRAYLANG['TXT_OPTIONAL'], 'TXT_ACTIVE' => $_ARRAYLANG['TXT_ACTIVE'], 'TXT_SCHEDULED_PUBLICATION' => $_ARRAYLANG['TXT_SCHEDULED_PUBLICATION'], 'TXT_DATE' => $_ARRAYLANG['TXT_DATE'], 'TXT_HEADLINES' => $_ARRAYLANG['TXT_HEADLINES'], 'TXT_TOPNEWS' => $_ARRAYLANG['TXT_TOPNEWS'], 'TXT_TEASERS' => $_ARRAYLANG['TXT_TEASERS'], 'TXT_NEWS_TEASER_TEXT' => $_ARRAYLANG['TXT_NEWS_TEASER_TEXT'], 'TXT_IMAGE' => $_ARRAYLANG['TXT_IMAGE'], 'TXT_NEWS_THUMBNAIL' => $_ARRAYLANG['TXT_NEWS_THUMBNAIL'], 'TXT_BROWSE' => $_ARRAYLANG['TXT_BROWSE'], 'TXT_NUMBER_OF_CHARS' => $_ARRAYLANG['TXT_NUMBER_OF_CHARS'], 'TXT_TEASER_SHOW_NEWS_LINK' => $_ARRAYLANG['TXT_TEASER_SHOW_NEWS_LINK'], 'TXT_NEWS_DEFINE_LINK_ALT_TEXT' => $_ARRAYLANG['TXT_NEWS_DEFINE_LINK_ALT_TEXT'], 'TXT_NEWS_INSERT_LINK' => $_ARRAYLANG['TXT_NEWS_INSERT_LINK'], 'TXT_NEWS_REDIRECT_TITLE' => $_ARRAYLANG['TXT_NEWS_REDIRECT_TITLE'], 'TXT_NEWS_MESSAGE_TYPE' => $_ARRAYLANG['TXT_NEWS_MESSAGE_TYPE'], 'TXT_NEWS_TYPE_REDIRECT' => $_ARRAYLANG['TXT_NEWS_REDIRECT_TITLE'], 'TXT_NEWS_TYPE_REDIRECT_HELP' => $_ARRAYLANG['TXT_NEWS_TYPE_REDIRECT_HELP'], 'TXT_NEWS_TYPE_DEFAULT' => $_ARRAYLANG['TXT_NEWS_TYPE_DEFAULT'], 'TXT_NEWS_BASIC_DATA' => $_ARRAYLANG['TXT_BASIC_DATA'], 'TXT_NEWS_MORE_OPTIONS' => $_ARRAYLANG['TXT_MORE_OPTIONS'], 'TXT_NEWS_PERMISSIONS' => $_ARRAYLANG['TXT_NEWS_PERMISSIONS'], 'TXT_NEWS_READ_ACCESS' => $_ARRAYLANG['TXT_NEWS_READ_ACCESS'], 'TXT_NEWS_MODIFY_ACCESS' => $_ARRAYLANG['TXT_NEWS_MODIFY_ACCESS'], 'TXT_NEWS_AVAILABLE_USER_GROUPS' => $_ARRAYLANG['TXT_NEWS_AVAILABLE_USER_GROUPS'], 'TXT_NEWS_ASSIGNED_USER_GROUPS' => $_ARRAYLANG['TXT_NEWS_ASSIGNED_USER_GROUPS'], 'TXT_NEWS_CHECK_ALL' => $_ARRAYLANG['TXT_NEWS_CHECK_ALL'], 'TXT_NEWS_UNCHECK_ALL' => $_ARRAYLANG['TXT_NEWS_UNCHECK_ALL'], 'TXT_NEWS_READ_ALL_ACCESS_DESC' => $_ARRAYLANG['TXT_NEWS_READ_ALL_ACCESS_DESC'], 'TXT_NEWS_RELATED_NEWS' => $_ARRAYLANG['TXT_NEWS_RELATED_NEWS'], 'TXT_NEWS_INCLUDE_NEWS' => $_ARRAYLANG['TXT_NEWS_INCLUDE_NEWS'], 'TXT_NEWS_INCLUDE_RELATED_NEWS_DESC' => $_ARRAYLANG['TXT_NEWS_INCLUDE_RELATED_NEWS_DESC'], 'TXT_NEWS_SEARCH_INFO' => $_ARRAYLANG['TXT_NEWS_SEARCH_INFO'], 'TXT_NEWS_SEARCH_PLACEHOLDER' => $_ARRAYLANG['TXT_NEWS_SEARCH_PLACEHOLDER'], 'TXT_NEWS_READ_SELECTED_ACCESS_DESC' => $_ARRAYLANG['TXT_NEWS_READ_SELECTED_ACCESS_DESC'], 'TXT_NEWS_AVAILABLE_USER_GROUPS' => $_ARRAYLANG['TXT_NEWS_AVAILABLE_USER_GROUPS'], 'TXT_NEWS_ASSIGNED_USER_GROUPS' => $_ARRAYLANG['TXT_NEWS_ASSIGNED_USER_GROUPS'], 'TXT_NEWS_MODIFY_ALL_ACCESS_DESC' => $_ARRAYLANG['TXT_NEWS_MODIFY_ALL_ACCESS_DESC'], 'TXT_NEWS_MODIFY_SELECTED_ACCESS_DESC' => $_ARRAYLANG['TXT_NEWS_MODIFY_SELECTED_ACCESS_DESC'], 'TXT_NEWS_TAGS' => $_ARRAYLANG['TXT_NEWS_TAGS'], 'TXT_NEWS_TAGS_ENABLE' => $_ARRAYLANG['TXT_NEWS_TAGS_ENABLE'], 'NEWS_TAG_ID' => $newsTagId));
     $newsid = intval($_REQUEST['newsId']);
     $objResult = $objDatabase->SelectLimit("SELECT  typeid,\n                                                        date,\n                                                        id,\n                                                        redirect,\n                                                        source,\n                                                        url1,\n                                                        url2,\n                                                        publisher,\n                                                        publisher_id,\n                                                        author,\n                                                        author_id,\n                                                        startdate,\n                                                        enddate,\n                                                        status,\n                                                        userid,\n                                                        frontend_access_id,\n                                                        backend_access_id,\n                                                        teaser_only,\n                                                        teaser_show_link,\n                                                        teaser_image_path,\n                                                        teaser_image_thumbnail_path,\n                                                        allow_comments,\n                                                        enable_related_news,\n                                                        enable_tags\n                                                FROM    " . DBPREFIX . "module_news\n                                                WHERE   id = '" . $newsid . "'", 1);
     if ($objResult !== false && !$objResult->EOF && ($this->arrSettings['news_message_protection'] != '1' || \Permission::hasAllAccess() || !$objResult->fields['backend_access_id'] || \Permission::checkAccess($objResult->fields['backend_access_id'], 'dynamic', true) || $objResult->fields['userid'] == $objFWUser->objUser->getId())) {
         $newsType = $objResult->fields['typeid'];
         $id = $objResult->fields['id'];
         $arrLanguages = \FWLanguage::getLanguageArray();
         $langData = $this->getLangData($id);
         $newsComment = $objResult->fields['allow_comments'];
         $newsAuthorName = $objResult->fields['author'];
         $newsAuthorId = $objResult->fields['author_id'];
         $newsPublisherName = $objResult->fields['publisher'];
         $newsPublisherId = $objResult->fields['publisher_id'];
         if ($newsPublisherId != 0 && ($objUser = $objFWUser->objUser->getUser($newsPublisherId))) {
             $newsPublisherName = \FWUser::getParsedUserTitle($objUser);
         } else {
             $newsPublisherId = 0;
         }
         if ($newsAuthorId != 0 && ($objUser = $objFWUser->objUser->getUser($newsAuthorId))) {
             $newsAuthorName = \FWUser::getParsedUserTitle($objUser);
         } else {
             $newsAuthorId = 0;
         }
         $active_lang = array();
         $activeLanguage = null;
         if (isset($_GET['langId']) && in_array($_GET['langId'], \FWLanguage::getIdArray())) {
             if (!in_array($_GET['langId'], $active_lang)) {
                 $active_lang[] = contrexx_input2raw($_GET['langId']);
             }
             $activeLanguage = contrexx_input2raw($_GET['langId']);
         }
         if (count($arrLanguages) > 0) {
             $intLanguageCounter = 0;
             $arrActiveLang = array(0 => '', 1 => '', 2 => '');
             $strJsTabToDiv = '';
             $query = "SELECT `lang_id` FROM `" . DBPREFIX . "module_news_locale`\n                                WHERE `news_id` = " . $newsid . "\n                                AND `is_active` = '1'";
             $activeLangResult = $objDatabase->Execute($query);
             while (!$activeLangResult->EOF) {
                 $active_lang[] = $activeLangResult->fields['lang_id'];
                 $activeLangResult->MoveNext();
             }
             if (isset($_POST['newsManagerLanguages'])) {
                 $active_lang = array_keys($_POST['newsManagerLanguages']);
             }
             foreach ($arrLanguages as $intId => $arrLanguage) {
                 if ($arrLanguage['frontend'] == 1) {
                     $intLanguageId = $arrLanguage['id'];
                     $arrActiveLang[$intLanguageCounter % 3] .= '<input id="languagebar_' . $intLanguageId . '" class="langCheckboxes" ' . (in_array($intLanguageId, $active_lang) ? 'checked="checked"' : '') . ' type="checkbox" name="newsManagerLanguages[' . $intLanguageId . ']" value="1" onclick="switchBoxAndTab(this, \'news_lang_tab_' . $intLanguageId . '\');" /><label for="languagebar_' . $intLanguageId . '">' . $arrLanguage['name'] . ' [' . $arrLanguage['lang'] . ']</label><br />';
                     ++$intLanguageCounter;
                 }
             }
             $this->_objTpl->setVariable(array('TXT_LANGUAGE' => $_ARRAYLANG['TXT_LANGUAGE'], 'EDIT_LANGUAGES_1' => $arrActiveLang[0], 'EDIT_LANGUAGES_2' => $arrActiveLang[1], 'EDIT_LANGUAGES_3' => $arrActiveLang[2]));
         }
         $first = true;
         if (!$activeLanguage) {
             $activeLanguage = current($active_lang);
         }
         foreach ($arrLanguages as $langId => $arrLanguage) {
             if ($arrLanguage['frontend'] == 1) {
                 $isActive = isset($langData[$langId]) && $langData[$langId]['active'] == 1;
                 $display = $langId == $activeLanguage;
                 // parse tabs
                 $this->_objTpl->setVariable(array('NEWS_LANG_ID' => $langId, 'NEWS_LANG_DISPLAY_STATUS' => $display ? 'active' : 'inactive', 'NEWS_LANG_DISPLAY_STYLE' => in_array($arrLanguage['id'], $active_lang) ? 'inline' : 'none', 'NEWS_LANG_NAME' => contrexx_raw2xhtml($arrLanguage['name'])));
                 $this->_objTpl->parse('news_lang_list');
                 // parse title
                 $title = isset($_POST['newsTitle'][$langId]) ? contrexx_input2raw($_POST['newsTitle'][$langId]) : '';
                 if (empty($title)) {
                     $title = isset($langData[$langId]['title']) ? $langData[$langId]['title'] : '';
                 }
                 $this->_objTpl->setVariable(array('NEWS_LANG_ID' => $langId, 'NEWS_TITLE' => contrexx_raw2xhtml($title), 'NEWS_TITLE_DISPLAY' => $display ? 'block' : 'none'));
                 $this->_objTpl->parse('news_title_list');
//.........这里部分代码省略.........
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:101,代码来源:NewsManager.class.php

示例6: showForm

 /**
  * Sets placeholders for the form view.
  *
  * @param object $objTpl         Template object
  * @param integer $formId        Form id
  * @param integer $intView       request mode frontend or backend
  * @param integer $arrNumSeating number of seating
  *
  * @return null
  */
 function showForm($objTpl, $formId, $intView, $ticketSales = false)
 {
     global $_ARRAYLANG, $_LANGID;
     $objForm = new \Cx\Modules\Calendar\Controller\CalendarForm(intval($formId));
     if (!empty($formId)) {
         $this->formList[$formId] = $objForm;
     }
     switch ($intView) {
         case 1:
             $this->getFrontendLanguages();
             $objTpl->setGlobalVariable(array($this->moduleLangVar . '_FORM_ID' => !empty($formId) ? $objForm->id : '', $this->moduleLangVar . '_FORM_TITLE' => !empty($formId) ? $objForm->title : ''));
             $i = 0;
             $formFields = array();
             if (!empty($formId)) {
                 $defaultLangId = $_LANGID;
                 if (!in_array($defaultLangId, \FWLanguage::getIdArray())) {
                     $defaultLangId = \FWLanguage::getDefaultLangId();
                 }
                 foreach ($objForm->inputfields as $key => $arrInputfield) {
                     $i++;
                     $fieldValue = array();
                     $defaultFieldValue = array();
                     foreach ($this->arrFrontendLanguages as $key => $arrLang) {
                         $fieldValue[$arrLang['id']] = isset($arrInputfield['name'][$arrLang['id']]) ? $arrInputfield['name'][$arrLang['id']] : '';
                         $defaultFieldValue[$arrLang['id']] = isset($arrInputfield['default_value'][$arrLang['id']]) ? $arrInputfield['default_value'][$arrLang['id']] : '';
                     }
                     $formFields[] = array('type' => $arrInputfield['type'], 'id' => $arrInputfield['id'], 'row' => $i % 2 == 0 ? 'row2' : 'row1', 'order' => $arrInputfield['order'], 'name_master' => $fieldValue[$defaultLangId], 'default_value_master' => $defaultFieldValue[$defaultLangId], 'required' => $arrInputfield['required'], 'affiliation' => $arrInputfield['affiliation'], 'field_value' => json_encode($fieldValue), 'default_field_value' => json_encode($defaultFieldValue));
                 }
             }
             foreach ($this->arrFrontendLanguages as $key => $arrLang) {
                 $objTpl->setVariable(array($this->moduleLangVar . '_INPUTFIELD_LANG_ID' => $arrLang['id'], $this->moduleLangVar . '_INPUTFIELD_LANG_NAME' => $arrLang['name'], $this->moduleLangVar . '_INPUTFIELD_LANG_SHORTCUT' => $arrLang['lang']));
                 $objTpl->parse('inputfieldNameList');
                 $objTpl->setVariable(array($this->moduleLangVar . '_INPUTFIELD_LANG_ID' => $arrLang['id'], $this->moduleLangVar . '_INPUTFIELD_LANG_NAME' => $arrLang['name'], $this->moduleLangVar . '_INPUTFIELD_LANG_SHORTCUT' => $arrLang['lang']));
                 $objTpl->parse('inputfieldDefaultValueList');
                 $objTpl->setVariable(array($this->moduleLangVar . '_INPUTFIELD_LANG_NAME' => $arrLang['name']));
                 $objTpl->parse('inputfieldLanguagesList');
             }
             foreach ($this->arrInputfieldTypes as $fieldType) {
                 $objTpl->setVariable(array($this->moduleLangVar . '_FORM_FIELD_TYPE' => $fieldType, 'TXT_' . $this->moduleLangVar . '_FORM_FIELD_TYPE' => $_ARRAYLANG['TXT_CALENDAR_FORM_FIELD_' . strtoupper($fieldType)]));
                 $objTpl->parse('inputfieldTypes');
             }
             foreach ($this->arrRegistrationFields as $fieldType) {
                 $objTpl->setVariable(array($this->moduleLangVar . '_FORM_FIELD_TYPE' => $fieldType, 'TXT_' . $this->moduleLangVar . '_FORM_FIELD_TYPE' => $_ARRAYLANG['TXT_CALENDAR_FORM_FIELD_' . strtoupper($fieldType)]));
                 $objTpl->parse('inputRegfieldTypes');
             }
             /* foreach ($this->arrInputfieldAffiliations as $strAffiliation) {
                    $objTpl->setVariable(array(
                        $this->moduleLangVar.'_FORM_FIELD_TYPE'        =>  $strAffiliation,
                        'TXT_'.$this->moduleLangVar.'_FORM_FIELD_TYPE' =>  $_ARRAYLANG['TXT_CALENDAR_FORM_FIELD_AFFILIATION_'.strtoupper($strAffiliation)],
                    ));
                    $objTpl->parse('fieldAfflications');
                }*/
             $objTpl->setVariable(array($this->moduleLangVar . '_FORM_DATA' => json_encode($formFields), $this->moduleLangVar . '_FRONTEND_LANG_COUNT' => count($this->arrFrontendLanguages), $this->moduleLangVar . '_INPUTFIELD_LAST_ID' => $objForm->getLastInputfieldId(), $this->moduleLangVar . '_INPUTFIELD_LAST_ROW' => $i % 2 == 0 ? "'row2'" : "'row1'", $this->moduleLangVar . '_DISPLAY_EXPAND' => count($this->arrFrontendLanguages) > 1 ? "block" : "none"));
             break;
         case 2:
             $objFieldTemplate = new \Cx\Core\Html\Sigma('.');
             $objFieldTemplate->setTemplate(self::frontendFieldTemplate, true, true);
             $objFieldTemplate->setVariable(array('TXT_' . $this->moduleLangVar . '_FIELD_NAME' => $_ARRAYLANG['TXT_CALENDAR_TYPE'] . '<font class="calendarRequired"> *</font>', $this->moduleLangVar . '_FIELD_INPUT' => '<select class="calendarSelect affiliateForm" name="registrationType"><option value="1" selected="selected"/>' . $_ARRAYLANG['TXT_CALENDAR_REG_REGISTRATION'] . '</option><option value="0"/>' . $_ARRAYLANG['TXT_CALENDAR_REG_SIGNOFF'] . '</option></select>', $this->moduleLangVar . '_FIELD_CLASS' => 'affiliationForm'));
             $objTpl->setVariable($this->moduleLangVar . '_REGISTRATION_FIELD', $objFieldTemplate->get());
             $objTpl->parse('calendarRegistrationField');
             // $selectBillingAddressStatus = false;
             foreach ($objForm->inputfields as $key => $arrInputfield) {
                 $objFieldTemplate->setTemplate(self::frontendFieldTemplate, true, true);
                 $options = array();
                 $options = explode(',', $arrInputfield['default_value'][$_LANGID]);
                 $inputfield = null;
                 $hide = false;
                 $optionSelect = true;
                 $availableSeat = 0;
                 $checkSeating = false;
                 if (isset($_POST['registrationField'][$arrInputfield['id']])) {
                     $value = $_POST['registrationField'][$arrInputfield['id']];
                 } elseif (\FWUser::getFWUserObject()->objUser->login() && in_array($arrInputfield['type'], array('mail', 'firstname', 'lastname'))) {
                     $value = '';
                     switch ($arrInputfield['type']) {
                         case 'mail':
                             $value = \FWUser::getFWUserObject()->objUser->getEmail();
                             break;
                         case 'firstname':
                             $value = \FWUser::getFWUserObject()->objUser->getProfileAttribute('firstname');
                             break;
                         case 'lastname':
                             $value = \FWUser::getFWUserObject()->objUser->getProfileAttribute('lastname');
                             break;
                         default:
                             $value = $arrInputfield['default_value'][$_LANGID];
                             break;
                     }
                 } else {
                     $value = $arrInputfield['default_value'][$_LANGID];
//.........这里部分代码省略.........
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:101,代码来源:CalendarFormManager.class.php

示例7: errorHandler

 /**
  * Migrates existing old Shop mailtemplates to the new MailTemplate class
  * @return  boolean         False.  Always.
  * @throws  Cx\Lib\Update_DatabaseException
  */
 static function errorHandler()
 {
     if (!(include_once \Cx\Core\Core\Controller\Cx::instanciate()->getCodeBaseFrameworkPath() . '/UpdateUtil')) {
         return false;
     }
     if (\Cx\Lib\UpdateUtil::table_empty(DBPREFIX . 'core_mail_template')) {
         // Make sure there are no bodies lying around
         \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_NAME);
         \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_FROM);
         \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_SENDER);
         \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_REPLY);
         \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_TO);
         \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_CC);
         \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_BCC);
         \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_SUBJECT);
         \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_MESSAGE);
         \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_MESSAGE_HTML);
         \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_ATTACHMENTS);
         \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_INLINE);
     }
     // Migrate existing templates from the shop to the MailTemplate.
     // These are the keys replacing the IDs.
     // TODO: Migrate the old template using the original IDs, make them unprotected
     // TODO: Add the new default templates with the new keys
     // and have the user migrate changes herself!
     $arrKey = array(1 => 'order_confirmation', 2 => 'order_complete', 3 => 'customer_login', 4 => 'order_confirmation_login');
     $arrLanguageId = \FWLanguage::getIdArray();
     if (empty($arrLanguageId)) {
         throw new \Cx\Lib\Update_DatabaseException("Failed to get frontend language IDs");
     }
     foreach ($arrLanguageId as $lang_id) {
         // Mind that the template name is single language yet!
         $arrTemplates = self::getTemplateArray($lang_id);
         if (empty($arrTemplates)) {
             continue;
         }
         foreach ($arrTemplates as $id => $arrTemplate) {
             // TODO: utf8_encode() may not be necessary in all cases.
             // It worked without it for me earlier, but was necessary for verkehrstheorie.ch
             $arrTemplate = array_map("utf8_encode", $arrTemplate);
             if (isset($arrKey[$id])) {
                 // System templates get their default key
                 $arrTemplate['key'] = $arrKey[$id];
                 if ($id == 4) {
                     // Clear the protected flag, so the obsolete template
                     // #4 may be removed at will
                     $arrTemplate['protected'] = false;
                 }
             } else {
                 // Custom templates:
                 // Make the name lowercase and replace any non-letter
                 $new_key = preg_replace('/[^a-z]/', '_', strtolower($arrTemplate['name']));
                 // Keep it unique!  Use the ID if the key is taken
                 if (in_array($new_key, $arrKey)) {
                     $new_key = $id;
                 }
                 // Remember used keys, and replace the former ID
                 $arrKey[$id] = $new_key;
                 $arrTemplate['key'] = $new_key;
             }
             foreach ($arrTemplate as &$string) {
                 // Replace old <PLACEHOLDERS> with new [PLACEHOLDERS].
                 $string = preg_replace('/\\<([A-Z_]+)\\>/', '[$1]', $string);
                 // TODO: This is completely unreliable.
                 // Use the process as described above, not replacing the old templates,
                 // but adding the new ones instead.
                 //                    $string = str_replace('[ORDER_DATA]', $order_data, $string);
                 //                    $string = preg_replace('/[\\w\\s\\:]+\\[USERNAME\\](?:\\n|<br\\s?\\/?
                 //                          >)*[\\w\\s\\:]+\\[PASSWORD\\]/',
                 //                        $login_data, $string);
             }
             //                $arrTemplate['message_html'] = preg_replace(
             //                    '/(?:\r|\n|\r\n)/', "<br />\n", $arrTemplate['message']);
             $arrTemplate['lang_id'] = $lang_id;
             if (!\Cx\Core\MailTemplate\Controller\MailTemplate::store('Shop', $arrTemplate)) {
                 throw new \Cx\Lib\Update_DatabaseException("Failed to store Mailtemplate");
             }
         }
     }
     // Drop old Mail tables after successful migration
     \Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'module_shop_mail_content');
     \Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'module_shop_mail');
     // Always!
     return false;
 }
开发者ID:Niggu,项目名称:cloudrexx,代码行数:90,代码来源:Mail.class.php

示例8: errorHandler

    /**
     * Migrates existing old Shop mailtemplates to the new MailTemplate class
     * @return  boolean         False.  Always.
     * @throws  Cx\Lib\Update_DatabaseException
     */
    static function errorHandler()
    {
        // Mail
        \Cx\Core\MailTemplate\Controller\MailTemplate::errorHandler();
        if (\Cx\Lib\UpdateUtil::table_empty(DBPREFIX . 'core_mail_template')) {
            // Make sure there are no bodies lying around
            \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_NAME);
            \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_FROM);
            \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_SENDER);
            \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_REPLY);
            \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_TO);
            \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_CC);
            \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_BCC);
            \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_SUBJECT);
            \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_MESSAGE);
            \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_MESSAGE_HTML);
            \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_ATTACHMENTS);
            \Text::deleteByKey('Shop', \Cx\Core\MailTemplate\Controller\MailTemplate::TEXT_INLINE);
        }
        $arrFrom = $arrSender = $arrSubject = array();
        $arrLanguageId = \FWLanguage::getIdArray();
        if (empty($arrLanguageId)) {
            throw new \Cx\Lib\Update_DatabaseException("Failed to get frontend language IDs");
        }
        if (\Cx\Lib\UpdateUtil::table_exist(DBPREFIX . 'module_shop_mail')) {
            // Migrate existing templates from the shop to the MailTemplate,
            // appending "_backup_by_update" to the respective keys.
            // Make them unprotected.
            // These are the keys replacing the IDs:
            $arrKey = array(1 => 'order_confirmation', 2 => 'order_complete', 3 => 'customer_login', 4 => 'order_confirmation_login');
            foreach ($arrLanguageId as $lang_id) {
                // Mind that the template name is single language yet!
                $arrTemplates = self::getTemplateArray($lang_id);
                if (empty($arrTemplates)) {
                    continue;
                }
                foreach ($arrTemplates as $id => $arrTemplate) {
                    // NOTE: utf8_encode() may be necessary in some cases.
                    // It usually works without it, but was necessary on a few installations.
                    //                    $arrTemplate = array_map("utf8_encode", $arrTemplate);
                    if (!empty($arrTemplate['from']) && empty($arrFrom[$id])) {
                        $arrFrom[$id] = $arrTemplate['from'];
                    }
                    if (!empty($arrTemplate['sender']) && empty($arrSender[$id])) {
                        $arrSender[$id] = $arrTemplate['sender'];
                    }
                    if (!empty($arrTemplate['subject']) && empty($arrSubject[$id])) {
                        $arrSubject[$id] = str_replace('<DATE>', '[ORDER_DATE]', $arrTemplate['subject']);
                    }
                    if (isset($arrKey[$id])) {
                        // System templates get their default key
                        $arrTemplate['key'] = $arrKey[$id] . '_backup_by_update';
                        // Clear the protected flag, so the old templates
                        // may be removed at will
                        $arrTemplate['protected'] = false;
                    } else {
                        // Custom templates:
                        // Make the name lowercase and replace any non-letter
                        $new_key = preg_replace('/[^a-z]/', '_', strtolower($arrTemplate['name']));
                        // Keep it unique!  Use the ID if the key is taken
                        if (in_array($new_key, $arrKey)) {
                            $new_key = $id;
                        }
                        // Remember used keys, and replace the former ID
                        $arrKey[$id] = $new_key;
                        $arrTemplate['key'] = $new_key;
                    }
                    // Some installations may contain corrupt templates
                    // causing empty (0 or "") keys.  Those would make
                    // MailTemplate::store() fail!
                    if (empty($arrTemplate['key'])) {
                        $arrTemplate['key'] = uniqid() . '_backup_by_update)';
                    }
                    foreach ($arrTemplate as &$string) {
                        // Replace old <PLACEHOLDERS> with new [PLACEHOLDERS].
                        $string = preg_replace('/\\<([A-Z_]+)\\>/', '[$1]', $string);
                        // This is completely unreliable.
                        // Use the process as described above, not replacing the old templates,
                        // but adding the new ones instead.
                        //                    $string = str_replace('[ORDER_DATA]', $order_data, $string);
                        //                    $string = preg_replace('/[\\w\\s\\:]+\\[USERNAME\\](?:\\n|<br\\s?\\/?
                        //                          >)*[\\w\\s\\:]+\\[PASSWORD\\]/',
                        //                        $login_data, $string);
                    }
                    //                $arrTemplate['message_html'] = preg_replace(
                    //                    '/(?:\r|\n|\r\n)/', "<br />\n", $arrTemplate['message']);
                    $arrTemplate['lang_id'] = $lang_id;
                    if (!\Cx\Core\MailTemplate\Controller\MailTemplate::store('Shop', $arrTemplate)) {
                        throw new \Cx\Lib\Update_DatabaseException("Failed to store Mailtemplate");
                    }
                }
            }
            // Drop old Mail tables after successful migration
            \Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'module_shop_mail_content');
            \Cx\Lib\UpdateUtil::drop_table(DBPREFIX . 'module_shop_mail');
//.........这里部分代码省略.........
开发者ID:Niggu,项目名称:cloudrexx,代码行数:101,代码来源:ShopMail.class.php

示例9: init

 /**
  * Initialize the mail template array for the current module
  *
  * Uses the given language ID $lang_id if not empty, or all active
  * frontend languages otherwise.
  * The $limit value defaults to the value of the
  * mailtemplate_per_page_backend setting from the core settings
  * (@see \Cx\Core\Setting\Controller\Setting}.
  * @param   integer     $section        The section
  * @param   integer     $lang_id        The optional language ID
  * @param   string      $order          The optional sorting order string,
  *                                      SQL syntax
  * @param   integer     $position       The optional position offset,
  *                                      defaults to zero
  * @param   integer     $limit          The optional limit for returned
  *                                      templates
  * @param   integer     $count          The actual count of templates
  *                                      available in total, by reference
  * @return  boolean                     True on success, false otherwise
  */
 static function init($section, $lang_id = null, $order = '', $position = 0, $limit = -1, &$count = 0)
 {
     global $objDatabase;
     if (empty($section)) {
         die("MailTemplate::init(): Empty section!");
     }
     $arrLanguageId = null;
     if ($lang_id) {
         // Init one language
         $arrLanguageId = array($lang_id);
     } else {
         // Load all languages if none is specified
         $arrLanguageId = \FWLanguage::getIdArray();
     }
     self::reset();
     if (empty($limit)) {
         $limit = \Cx\Core\Setting\Controller\Setting::getValue('mailtemplate_per_page_backend');
     }
     if (empty($limit)) {
         $limit = 25;
     }
     $query_from = null;
     self::$arrTemplates = array();
     foreach ($arrLanguageId as $lang_id) {
         $arrSql = \Text::getSqlSnippets('`mail`.`text_id`', $lang_id, $section, array('name' => self::TEXT_NAME, 'from' => self::TEXT_FROM, 'sender' => self::TEXT_SENDER, 'reply' => self::TEXT_REPLY, 'to' => self::TEXT_TO, 'cc' => self::TEXT_CC, 'bcc' => self::TEXT_BCC, 'subject' => self::TEXT_SUBJECT, 'message' => self::TEXT_MESSAGE, 'message_html' => self::TEXT_MESSAGE_HTML, 'attachments' => self::TEXT_ATTACHMENTS, 'inline' => self::TEXT_INLINE));
         $query_from = "\n                  FROM `" . DBPREFIX . "core_mail_template` AS `mail`" . $arrSql['join'] . "\n                 WHERE `mail`.`section`" . (isset($section) ? "='" . addslashes($section) . "'" : ' IS NULL');
         $query_order = $order ? " ORDER BY {$order}" : '';
         // The count of available templates needs to be initialized to zero
         // in case there is a problem with one of the queries ahead.
         // Ignore the code analyzer warning.
         $count = 0;
         $objResult = $objDatabase->SelectLimit("\n                SELECT `mail`.`key`, `mail`.`text_id`, `mail`.`protected`, `mail`.`html`, " . $arrSql['field'] . $query_from . $query_order, $limit, $position);
         if (!$objResult) {
             return self::errorHandler();
         }
         while (!$objResult->EOF) {
             $available = true;
             $key = $objResult->fields['key'];
             $text_id = $objResult->fields['text_id'];
             $strName = $objResult->fields['name'];
             if ($strName === null) {
                 $strName = \Text::getById($text_id, $section, self::TEXT_NAME)->content();
                 if ($strName) {
                     $available = false;
                 }
             }
             $strFrom = $objResult->fields['from'];
             if ($strFrom === null) {
                 $strFrom = \Text::getById($text_id, $section, self::TEXT_FROM)->content();
                 if ($strFrom) {
                     $available = false;
                 }
             }
             $strSender = $objResult->fields['sender'];
             if ($strSender === null) {
                 $strSender = \Text::getById($text_id, $section, self::TEXT_SENDER)->content();
                 if ($strSender) {
                     $available = false;
                 }
             }
             $strReply = $objResult->fields['reply'];
             if ($strReply === null) {
                 $strReply = \Text::getById($text_id, $section, self::TEXT_REPLY)->content();
                 if ($strReply) {
                     $available = false;
                 }
             }
             $strTo = $objResult->fields['to'];
             if ($strTo === null) {
                 $strTo = \Text::getById($text_id, $section, self::TEXT_TO)->content();
                 if ($strTo) {
                     $available = false;
                 }
             }
             $strCc = $objResult->fields['cc'];
             if ($strCc === null) {
                 $strCc = \Text::getById($text_id, $section, self::TEXT_CC)->content();
                 if ($strCc) {
                     $available = false;
                 }
//.........这里部分代码省略.........
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:101,代码来源:MailTemplate.class.php


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