/**
  * Init the frontend editing.
  *
  * Register the javascripts and css files
  * Adds the used language variables to contrexx-js variables, so the toolbar has access to these variables
  *
  * @param ComponentController $componentController
  */
 public function initFrontendEditing(\Cx\Core_Modules\FrontendEditing\Controller\ComponentController $componentController)
 {
     global $_ARRAYLANG;
     // get necessary objects
     $objInit = \Env::get('init');
     $page = $this->cx->getPage();
     // add css and javascript file
     $jsFilesRoot = substr(ASCMS_CORE_MODULE_FOLDER . '/' . $componentController->getName() . '/View/Script', 1);
     \JS::registerCSS(substr(ASCMS_CORE_MODULE_FOLDER . '/' . $componentController->getName() . '/View/Style/Main.css', 1));
     \JS::registerJS($jsFilesRoot . '/Main.js');
     \JS::activate('cx');
     // not used for contrexx version 3.1
     //        \JS::registerJS($jsFilesRoot . '/CKEditorPlugins.js');
     // activate ckeditor
     \JS::activate('ckeditor');
     \JS::activate('jquery-cookie');
     // load language data
     $_ARRAYLANG = $objInit->loadLanguageData('FrontendEditing');
     $langVariables = array('TXT_FRONTEND_EDITING_SHOW_TOOLBAR' => $_ARRAYLANG['TXT_FRONTEND_EDITING_SHOW_TOOLBAR'], 'TXT_FRONTEND_EDITING_HIDE_TOOLBAR' => $_ARRAYLANG['TXT_FRONTEND_EDITING_HIDE_TOOLBAR'], 'TXT_FRONTEND_EDITING_PUBLISH' => $_ARRAYLANG['TXT_FRONTEND_EDITING_PUBLISH'], 'TXT_FRONTEND_EDITING_SUBMIT_FOR_RELEASE' => $_ARRAYLANG['TXT_FRONTEND_EDITING_SUBMIT_FOR_RELEASE'], 'TXT_FRONTEND_EDITING_REFUSE_RELEASE' => $_ARRAYLANG['TXT_FRONTEND_EDITING_REFUSE_RELEASE'], 'TXT_FRONTEND_EDITING_SAVE' => $_ARRAYLANG['TXT_FRONTEND_EDITING_SAVE'], 'TXT_FRONTEND_EDITING_EDIT' => $_ARRAYLANG['TXT_FRONTEND_EDITING_EDIT'], 'TXT_FRONTEND_EDITING_CANCEL_EDIT' => $_ARRAYLANG['TXT_FRONTEND_EDITING_CANCEL_EDIT'], 'TXT_FRONTEND_EDITING_FINISH_EDIT_MODE' => $_ARRAYLANG['TXT_FRONTEND_EDITING_FINISH_EDIT_MODE'], 'TXT_FRONTEND_EDITING_THE_DRAFT' => $_ARRAYLANG['TXT_FRONTEND_EDITING_THE_DRAFT'], 'TXT_FRONTEND_EDITING_SAVE_CURRENT_STATE' => $_ARRAYLANG['TXT_FRONTEND_EDITING_SAVE_CURRENT_STATE'], 'TXT_FRONTEND_EDITING_CONFIRM_BLOCK_SAVE' => $_ARRAYLANG['TXT_FRONTEND_EDITING_CONFIRM_BLOCK_SAVE'], 'TXT_FRONTEND_EDITING_MODULE_PAGE' => $_ARRAYLANG['TXT_FRONTEND_EDITING_MODULE_PAGE'], 'TXT_FRONTEND_EDITING_NO_TITLE_AND_CONTENT' => $_ARRAYLANG['TXT_FRONTEND_EDITING_NO_TITLE_AND_CONTENT'], 'TXT_FRONTEND_EDITING_CONFIRM_UNSAVED_EXIT' => $_ARRAYLANG['TXT_FRONTEND_EDITING_CONFIRM_UNSAVED_EXIT'], 'TXT_FRONTEND_EDITING_DRAFT' => $_ARRAYLANG['TXT_FRONTEND_EDITING_DRAFT'], 'TXT_FRONTEND_EDITING_PUBLISHED' => $_ARRAYLANG['TXT_FRONTEND_EDITING_PUBLISHED']);
     // add toolbar to html
     $this->prepareTemplate($componentController);
     // assign js variables
     $contrexxJavascript = \ContrexxJavascript::getInstance();
     $contrexxJavascript->setVariable('langVars', $langVariables, 'FrontendEditing');
     $contrexxJavascript->setVariable('pageId', $page->getId(), 'FrontendEditing');
     $contrexxJavascript->setVariable('hasPublishPermission', \Permission::checkAccess(78, 'static', true), 'FrontendEditing');
     $contrexxJavascript->setVariable('contentTemplates', $this->getCustomContentTemplates(), 'FrontendEditing');
     $contrexxJavascript->setVariable('defaultTemplate', $this->getDefaultTemplate(), 'FrontendEditing');
     $configPath = ASCMS_PATH_OFFSET . substr(\Env::get('ClassLoader')->getFilePath(ASCMS_CORE_PATH . '/Wysiwyg/ckeditor.config.js.php'), strlen(ASCMS_DOCUMENT_ROOT));
     $contrexxJavascript->setVariable('configPath', $configPath . '?langId=' . FRONTEND_LANG_ID, 'FrontendEditing');
 }
Пример #2
0
 /**
  * @return ContrexxJavascript Singleton instance
  */
 public static function getInstance()
 {
     if (null == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 /**
  * @return \ContrexxJavascript Singleton instance
  */
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Пример #4
0
 /**
  * Set up uploader to only allow one single file to be uploaded
  */
 public function restrictUpload2SingleFile()
 {
     if (!isset($_SESSION['upload']['handlers'][$this->uploadId])) {
         $_SESSION['upload']['handlers'][$this->uploadId] = array();
     }
     // limit upload to 1 file at a time
     \ContrexxJavascript::getInstance()->setVariable('restrictUpload2SingleFile', true, "upload/widget_{$this->uploadId}");
     $_SESSION['upload']['handlers'][$this->uploadId]['singleFileMode'] = true;
 }
 /**
  * sets all i18n variables on target
  * @param ContrexxJavascript $target
  * @throws ContrexxJavascriptI18nException
  */
 public function variablesTo($target)
 {
     $vars = array();
     $providers = scandir(UPDATE_LIB . '/FRAMEWORK/cxjs/i18n');
     foreach ($providers as $provider) {
         if ($provider[0] == '.') {
             //do not open ., .., and linux hidden directories (.*)
             continue;
         }
         //name as used for the scope ('provider')
         $providerName = substr($provider, 0, strpos($provider, '.'));
         //name of the class ('providerProvider')
         $className = ucfirst($providerName . 'I18nProvider');
         try {
             require_once 'i18n/' . $provider;
             $providerInst = new $className();
             //set the variables accordingly on cxjs object
             $target->setVariable($providerInst->getVariables($this->languageCode), $providerName);
         } catch (Exception $e) {
             throw new ContrexxJavascriptI18nException("error parsing i18n module '{$provider}': " . $e->getMessage());
         }
     }
     return $vars;
 }
Пример #6
0
 /**
  * Gets the XHTML to display the widget.
  * @param string $containerSelector a jQuery selector defining the element
  *                                  where the widget should be put into.
  */
 public function getXhtml($containerSelector, $instanceName)
 {
     \JS::registerJS('core_modules/Upload/js/folderWidget.js');
     $tpl = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/Upload/template/');
     $tpl->setErrorHandling(PEAR_ERROR_DIE);
     $tpl->loadTemplateFile('folderWidget.html');
     $tpl->setVariable('ID', $this->id);
     //from where the combouploader gets the code on an uploader switch
     $cmdOrSection = $this->isBackendRequest ? 'cmd' : 'section';
     $actOrCmd = $this->isBackendRequest ? 'act' : 'cmd';
     $refreshUrl = ($this->isBackendRequest ? ASCMS_ADMIN_WEB_PATH : ASCMS_PATH_OFFSET) . \Env::get('virtualLanguageDirectory') . '/index.php?' . $cmdOrSection . '=Upload&' . $actOrCmd . '=refreshFolder';
     $deleteUrl = ($this->isBackendRequest ? ASCMS_ADMIN_WEB_PATH : ASCMS_PATH_OFFSET) . \Env::get('virtualLanguageDirectory') . '/index.php?' . $cmdOrSection . '=Upload&' . $actOrCmd . '=deleteFile';
     \ContrexxJavascript::getInstance()->setVariable(array('refreshUrl' => $refreshUrl, 'deleteUrl' => $deleteUrl, 'files' => $this->getFilesJSON(), 'containerSelector' => $containerSelector, 'instanceName' => $instanceName), 'upload/folderWidget_' . $this->id);
     return $tpl->get();
 }
 public function preFinalize(\Cx\Core\Html\Sigma $template)
 {
     if (count($this->uploaderInstances) == 0) {
         return;
     } else {
         global $_ARRAYLANG;
         \Env::get('init')->loadLanguageData('Uploader');
         foreach ($_ARRAYLANG as $key => $value) {
             if (preg_match("/UPLOADER(_[A-Za-z0-9]+)?/", $key)) {
                 \ContrexxJavascript::getInstance()->setVariable($key, $value, 'mediabrowser');
             }
         }
         \JS::activate('mediabrowser');
         \JS::registerJS('core_modules/Uploader/View/Script/uploader.js');
     }
 }
Пример #8
0
 /**
  * Render the option field in the backend.
  *
  * @param Sigma $template
  */
 public function renderOptionField($template)
 {
     global $_ARRAYLANG;
     $subTemplate = new Sigma();
     $subTemplate->loadTemplateFile($this->cx->getCodeBaseCoreModulePath() . '/TemplateEditor/View/Template/Backend/ColorOption.html');
     $subTemplate->setVariable('TEMPLATEEDITOR_OPTION_VALUE', $this->color);
     $subTemplate->setVariable('TEMPLATEEDITOR_OPTION_NAME', $this->name);
     $subTemplate->setVariable('TEMPLATEEDITOR_OPTION_HUMAN_NAME', $this->humanName);
     if ($this->choice) {
         $subTemplate->setVariable('TEMPLATEEDITOR_OPTION_CHOICE', json_encode($this->choice));
     }
     \ContrexxJavascript::getInstance()->setVariable(array('select' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_SELECT'], 'colorError' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_COLOR_WRONG_FORMAT'], 'cancel' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_CANCEL']), 'TemplateEditor');
     $template->setVariable('TEMPLATEEDITOR_OPTION', $subTemplate->get());
     $template->setVariable('TEMPLATEEDITOR_OPTION_TYPE', 'color');
     $template->parse('option');
 }
 public function preFinalize(\Cx\Core\Html\Sigma $template)
 {
     if (count($this->uploaderInstances) == 0) {
         return;
     }
     global $_ARRAYLANG;
     \Env::get('init')->loadLanguageData('Uploader');
     foreach ($_ARRAYLANG as $key => $value) {
         if (preg_match("/UPLOADER(_[A-Za-z0-9]+)?/", $key)) {
             \ContrexxJavascript::getInstance()->setVariable($key, $value, 'mediabrowser');
         }
     }
     $appendix = "";
     foreach ($this->uploaderInstances as $uploader) {
         if ($uploader->getType() == Uploader::UPLOADER_TYPE_MODAL) {
             $appendix .= $uploader->getContainer();
         }
     }
     $template->_blocks["__global__"] = preg_replace("/<\\/body>/", $appendix . '</body>', $template->_blocks["__global__"]);
     \ContrexxJavascript::getInstance()->setVariable('chunk_size', min(floor((\FWSystem::getMaxUploadFileSize() - 1000000) / 1000000), 20) . 'mb', 'uploader');
     \JS::activate('mediabrowser');
     \JS::registerJS('core_modules/Uploader/View/Script/Uploader.js');
 }
Пример #10
0
    /**
     * 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) {
            try {
                $javascript .= <<<UPLOADER
                {$this->getUploaderCode(self::PICTURE_FIELD_KEY, 'pictureUpload')}
                {$this->getUploaderCode(self::MAP_FIELD_KEY, 'mapUpload')}
                {$this->getUploaderCode(self::ATTACHMENT_FIELD_KEY, 'attachmentUpload', 'uploadFinished', false)}
UPLOADER;
            } catch (Exception $e) {
                \DBG::msg("Error in initializing uploader");
            }
        }
        $this->_objTpl->setGlobalVariable(array($this->moduleLangVar . '_EVENT_LANG_ID' => $_LANGID, $this->moduleLangVar . '_JAVASCRIPT' => $javascript));
        $objCategoryManager = new \Cx\Modules\Calendar\Controller\CalendarCategoryManager(true);
        $objCategoryManager->getCategoryList();
        if ($eventId) {
            $startDate = $objEvent->startDate;
            $endDate = $objEvent->endDate;
        } else {
            $startDate = new \DateTime();
            $endDate = new \DateTime();
        }
        $eventStartDate = $this->format2userDateTime($startDate);
        $eventEndDate = $this->format2userDateTime($endDate);
        $this->_objTpl->setGlobalVariable(array('TXT_' . $this->moduleLangVar . '_EVENT' => $_ARRAYLANG['TXT_CALENDAR_EVENT'], 'TXT_' . $this->moduleLangVar . '_EVENT_DETAILS' => $_ARRAYLANG['TXT_CALENDAR_EVENT_DETAILS'], 'TXT_' . $this->moduleLangVar . '_SAVE' => $_ARRAYLANG['TXT_CALENDAR_SAVE'], 'TXT_' . $this->moduleLangVar . '_EVENT_START' => $_ARRAYLANG['TXT_CALENDAR_START'], 'TXT_' . $this->moduleLangVar . '_EVENT_END' => $_ARRAYLANG['TXT_CALENDAR_END'], 'TXT_' . $this->moduleLangVar . '_EVENT_TITLE' => $_ARRAYLANG['TXT_CALENDAR_TITLE'], 'TXT_' . $this->moduleLangVar . '_EXPAND' => $_ARRAYLANG['TXT_CALENDAR_EXPAND'], 'TXT_' . $this->moduleLangVar . '_MINIMIZE' => $_ARRAYLANG['TXT_CALENDAR_MINIMIZE'], 'TXT_' . $this->moduleLangVar . '_EVENT_PLACE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_PLACE'], 'TXT_' . $this->moduleLangVar . '_EVENT_STREET' => $_ARRAYLANG['TXT_CALENDAR_EVENT_STREET'], 'TXT_' . $this->moduleLangVar . '_EVENT_ZIP' => $_ARRAYLANG['TXT_CALENDAR_EVENT_ZIP'], 'TXT_' . $this->moduleLangVar . '_EVENT_CITY' => $_ARRAYLANG['TXT_CALENDAR_EVENT_CITY'], 'TXT_' . $this->moduleLangVar . '_EVENT_COUNTRY' => $_ARRAYLANG['TXT_CALENDAR_EVENT_COUNTRY'], 'TXT_' . $this->moduleLangVar . '_EVENT_WEBSITE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_WEBSITE'], 'TXT_' . $this->moduleLangVar . '_EVENT_PHONE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_PHONE'], 'TXT_' . $this->moduleLangVar . '_EVENT_MAP' => $_ARRAYLANG['TXT_CALENDAR_EVENT_MAP'], 'TXT_' . $this->moduleLangVar . '_EVENT_USE_GOOGLEMAPS' => $_ARRAYLANG['TXT_CALENDAR_EVENT_USE_GOOGLEMAPS'], 'TXT_' . $this->moduleLangVar . '_EVENT_LINK' => $_ARRAYLANG['TXT_CALENDAR_EVENT_LINK'], 'TXT_' . $this->moduleLangVar . '_EVENT_EMAIL' => $_ARRAYLANG['TXT_CALENDAR_EVENT_EMAIL'], 'TXT_' . $this->moduleLangVar . '_EVENT_PICTURE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_PICTURE'], 'TXT_' . $this->moduleLangVar . '_EVENT_ATTACHMENT' => $_ARRAYLANG['TXT_CALENDAR_EVENT_ATTACHMENT'], 'TXT_' . $this->moduleLangVar . '_EVENT_CATEGORY' => $_ARRAYLANG['TXT_CALENDAR_CAT'], 'TXT_' . $this->moduleLangVar . '_EVENT_DESCRIPTION' => $_ARRAYLANG['TXT_CALENDAR_EVENT_DESCRIPTION'], 'TXT_' . $this->moduleLangVar . '_PLEASE_CHECK_INPUT' => $_ARRAYLANG['TXT_CALENDAR_PLEASE_CHECK_INPUT'], 'TXT_' . $this->moduleLangVar . '_EVENT_HOST' => $_ARRAYLANG['TXT_CALENDAR_EVENT_HOST'], 'TXT_' . $this->moduleLangVar . '_EVENT_NAME' => $_ARRAYLANG['TXT_CALENDAR_EVENT_NAME'], 'TXT_' . $this->moduleLangVar . '_EVENT_ALL_DAY' => $_ARRAYLANG['TXT_CALENDAR_EVENT_ALL_DAY'], 'TXT_' . $this->moduleLangVar . '_LANGUAGE' => $_ARRAYLANG['TXT_CALENDAR_LANG'], 'TXT_' . $this->moduleLangVar . '_EVENT_TYPE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_TYPE'], 'TXT_' . $this->moduleLangVar . '_EVENT_TYPE_EVENT' => $_ARRAYLANG['TXT_CALENDAR_EVENT_TYPE_EVENT'], 'TXT_' . $this->moduleLangVar . '_EVENT_TYPE_REDIRECT' => $_ARRAYLANG['TXT_CALENDAR_EVENT_TYPE_REDIRECT'], 'TXT_' . $this->moduleLangVar . '_EVENT_DESCRIPTION' => $_ARRAYLANG['TXT_CALENDAR_EVENT_DESCRIPTION'], 'TXT_' . $this->moduleLangVar . '_EVENT_REDIRECT' => $_ARRAYLANG['TXT_CALENDAR_EVENT_TYPE_REDIRECT'], 'TXT_' . $this->moduleLangVar . '_PLACE_DATA_DEFAULT' => $_ARRAYLANG['TXT_CALENDAR_PLACE_DATA_DEFAULT'], 'TXT_' . $this->moduleLangVar . '_PLACE_DATA_FROM_MEDIADIR' => $_ARRAYLANG['TXT_CALENDAR_PLACE_DATA_FROM_MEDIADIR'], 'TXT_' . $this->moduleLangVar . '_PREV' => $_ARRAYLANG['TXT_CALENDAR_PREV'], 'TXT_' . $this->moduleLangVar . '_NEXT' => $_ARRAYLANG['TXT_CALENDAR_NEXT'], 'TXT_' . $this->moduleLangVar . '_MORE' => $_ARRAYLANG['TXT_CALENDAR_MORE'], 'TXT_' . $this->moduleLangVar . '_MINIMIZE' => $_ARRAYLANG['TXT_CALENDAR_MINIMIZE'], $this->moduleLangVar . '_EVENT_TYPE_EVENT' => $eventId != 0 ? $objEvent->type == 0 ? 'selected="selected"' : '' : '', $this->moduleLangVar . '_EVENT_TYPE_REDIRECT' => $eventId != 0 ? $objEvent->type == 1 ? 'selected="selected"' : '' : '', $this->moduleLangVar . '_EVENT_START_DATE' => $eventStartDate, $this->moduleLangVar . '_EVENT_END_DATE' => $eventEndDate, $this->moduleLangVar . '_EVENT_PICTURE' => $objEvent->pic, $this->moduleLangVar . '_EVENT_PICTURE_THUMB' => $objEvent->pic != '' ? '<img src="' . $objEvent->pic . '.thumb" alt="' . $objEvent->title . '" title="' . $objEvent->title . '" />' : '', $this->moduleLangVar . '_EVENT_ATTACHMENT' => $objEvent->attach, $this->moduleLangVar . '_EVENT_CATEGORIES' => $objCategoryManager->getCategoryDropdown(intval($objEvent->catId), 2), $this->moduleLangVar . '_EVENT_LINK' => $objEvent->link, $this->moduleLangVar . '_EVENT_PLACE' => $objEvent->place, $this->moduleLangVar . '_EVENT_STREET' => $objEvent->place_street, $this->moduleLangVar . '_EVENT_ZIP' => $objEvent->place_zip, $this->moduleLangVar . '_EVENT_CITY' => $objEvent->place_city, $this->moduleLangVar . '_EVENT_COUNTRY' => $objEvent->place_country, $this->moduleLangVar . '_EVENT_PLACE_WEBSITE' => $objEvent->place_website, $this->moduleLangVar . '_EVENT_PLACE_MAP' => $objEvent->place_map, $this->moduleLangVar . '_EVENT_PLACE_LINK' => $objEvent->place_link, $this->moduleLangVar . '_EVENT_PLACE_PHONE' => $objEvent->place_phone, $this->moduleLangVar . '_EVENT_MAP' => $objEvent->google == 1 ? 'checked="checked"' : '', $this->moduleLangVar . '_EVENT_HOST' => $objEvent->org_name, $this->moduleLangVar . '_EVENT_HOST_ADDRESS' => $objEvent->org_street, $this->moduleLangVar . '_EVENT_HOST_ZIP' => $objEvent->org_zip, $this->moduleLangVar . '_EVENT_HOST_CITY' => $objEvent->org_city, $this->moduleLangVar . '_EVENT_HOST_COUNTRY' => $objEvent->org_country, $this->moduleLangVar . '_EVENT_HOST_WEBSITE' => $objEvent->org_website, $this->moduleLangVar . '_EVENT_HOST_LINK' => $objEvent->org_link, $this->moduleLangVar . '_EVENT_HOST_PHONE' => $objEvent->org_phone, $this->moduleLangVar . '_EVENT_HOST_EMAIL' => $objEvent->org_email, $this->moduleLangVar . '_EVENT_LOCATION_TYPE_MANUAL' => $eventId != 0 ? $objEvent->locationType == 1 ? "checked='checked'" : '' : "checked='checked'", $this->moduleLangVar . '_EVENT_LOCATION_TYPE_MEDIADIR' => $eventId != 0 ? $objEvent->locationType == 2 ? "checked='checked'" : '' : "", $this->moduleLangVar . '_EVENT_HOST_TYPE_MANUAL' => $eventId != 0 ? $objEvent->hostType == 1 ? "checked='checked'" : '' : "checked='checked'", $this->moduleLangVar . '_EVENT_HOST_TYPE_MEDIADIR' => $eventId != 0 ? $objEvent->hostType == 2 ? "checked='checked'" : '' : "", $this->moduleLangVar . '_EVENT_ID' => $eventId, $this->moduleLangVar . '_EVENT_ALL_DAY' => $eventId != 0 && $objEvent->all_day ? 'checked="checked"' : '', $this->moduleLangVar . '_HIDE_ON_SINGLE_LANG' => count($this->arrFrontendLanguages) == 1 ? "display: none;" : ""));
        $multiLingualFields = array('place', 'place_city', 'place_country', 'org_name', 'org_city', 'org_country');
        $isOneActiveLanguage = count($this->arrFrontendLanguages) == 1;
        foreach ($multiLingualFields as $inputField) {
            if ($isOneActiveLanguage) {
                $this->_objTpl->hideBlock('calendar_event_' . $inputField . '_expand');
            } else {
                $this->_objTpl->touchBlock('calendar_event_' . $inputField . '_expand');
            }
        }
        foreach ($this->arrFrontendLanguages as $arrLang) {
            //parse globals
            $this->_objTpl->setGlobalVariable(array($this->moduleLangVar . '_EVENT_LANG_SHORTCUT' => $arrLang['lang'], $this->moduleLangVar . '_EVENT_LANG_ID' => $arrLang['id'], 'TXT_' . $this->moduleLangVar . '_EVENT_LANG_NAME' => $arrLang['name']));
            //parse "show in" checkboxes
            $arrShowIn = explode(",", $objEvent->showIn);
            $langChecked = false;
            if ($eventId != 0) {
                $langChecked = in_array($arrLang['id'], $arrShowIn) ? true : false;
            } else {
                $langChecked = $arrLang['is_default'] == 'true';
            }
            //parse eventTabMenuDescTab
            $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_TAB_DISPLAY' => $langChecked ? 'block' : 'none', $this->moduleLangVar . '_EVENT_TAB_CLASS' => ''));
            $this->_objTpl->parse('eventTabMenuDescTab');
            //parse eventDescTab
            $eventTitle = !empty($objEvent->arrData['title'][$arrLang['id']]) ? $objEvent->arrData['title'][$arrLang['id']] : (!empty($objEvent->arrData['redirect'][$_LANGID]) ? $objEvent->arrData['redirect'][$_LANGID] : '');
            $eventDescription = !empty($objEvent->arrData['description'][$arrLang['id']]) ? $objEvent->arrData['description'][$arrLang['id']] : '';
            $eventRedirect = !empty($objEvent->arrData['redirect'][$arrLang['id']]) ? $objEvent->arrData['redirect'][$arrLang['id']] : (!empty($objEvent->arrData['redirect'][$_LANGID]) ? $objEvent->arrData['redirect'][$_LANGID] : '');
            $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_TAB_DISPLAY' => $langChecked ? 'block' : 'none', $this->moduleLangVar . '_EVENT_TITLE' => contrexx_raw2xhtml($eventTitle), $this->moduleLangVar . '_EVENT_DESCRIPTION' => new \Cx\Core\Wysiwyg\Wysiwyg("description[{$arrLang['id']}]", contrexx_raw2xhtml($eventDescription), $eventId != 0 ? 'small' : 'bbcode'), $this->moduleLangVar . '_EVENT_REDIRECT' => contrexx_raw2xhtml($eventRedirect), $this->moduleLangVar . '_EVENT_TYPE_EVENT_DISPLAY' => $objEvent->type == 0 ? 'block' : 'none', $this->moduleLangVar . '_EVENT_TYPE_REDIRECT_DISPLAY' => $objEvent->type == 1 ? 'block' : 'none'));
            $this->_objTpl->parse('eventDescTab');
            //parse eventLingualFields
            foreach ($multiLingualFields as $inputField) {
                $this->_objTpl->setVariable($this->moduleLangVar . '_EVENT_' . strtoupper($inputField) . '_DEFAULT', $eventId != 0 ? $objEvent->{$inputField} : '');
                $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_VALUE' => !empty($objEvent->arrData[$inputField][$arrLang['id']]) ? $objEvent->arrData[$inputField][$arrLang['id']] : ($eventId != 0 ? $objEvent->{$inputField} : '')));
                $this->_objTpl->parse('calendar_event_' . $inputField);
            }
            $langChecked = $langChecked ? 'checked="checked"' : '';
            $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_LANG_CHECKED' => $langChecked));
            $this->_objTpl->parse('eventShowIn');
        }
        //parse placeSelect
        if ((int) $this->arrSettings['placeData'] > 1) {
            $objMediadirEntries = new \Cx\Modules\MediaDir\Controller\MediaDirectoryEntry('MediaDir');
            $objMediadirEntries->getEntries(null, null, null, null, null, null, true, 0, 'n', null, null, intval($this->arrSettings['placeDataForm']));
            $placeOptions = '<option value="">' . $_ARRAYLANG['TXT_CALENDAR_PLEASE_CHOOSE'] . '</option>';
            foreach ($objMediadirEntries->arrEntries as $key => $arrEntry) {
                $selectedPlace = $arrEntry['entryId'] == $objEvent->place_mediadir_id ? 'selected="selected"' : '';
                $placeOptions .= '<option ' . $selectedPlace . ' value="' . $arrEntry['entryId'] . '">' . $arrEntry['entryFields'][0] . '</option>';
            }
            $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_PLACE_OPTIONS' => $placeOptions));
            $this->_objTpl->parse('eventPlaceSelect');
            if ((int) $this->arrSettings['placeData'] == 2) {
                $this->_objTpl->hideBlock('eventPlaceInput');
                $this->_objTpl->hideBlock('eventPlaceTypeRadio');
            } else {
                $this->_objTpl->touchBlock('eventPlaceInput');
                $this->_objTpl->touchBlock('eventPlaceTypeRadio');
            }
        } else {
            $this->_objTpl->touchBlock('eventPlaceInput');
            $this->_objTpl->hideBlock('eventPlaceSelect');
            $this->_objTpl->hideBlock('eventPlaceTypeRadio');
        }
        //parse placeHostSelect
        if ((int) $this->arrSettings['placeDataHost'] > 1) {
            $objMediadirEntries = new \Cx\Modules\MediaDir\Controller\MediaDirectoryEntry('MediaDir');
            $objMediadirEntries->getEntries(null, null, null, null, null, null, true, 0, 'n', null, null, intval($this->arrSettings['placeDataHostForm']));
            $placeOptions = '<option value="">' . $_ARRAYLANG['TXT_CALENDAR_PLEASE_CHOOSE'] . '</option>';
            foreach ($objMediadirEntries->arrEntries as $key => $arrEntry) {
                $selectedPlace = $arrEntry['entryId'] == $objEvent->host_mediadir_id ? 'selected="selected"' : '';
                $placeOptions .= '<option ' . $selectedPlace . ' value="' . $arrEntry['entryId'] . '">' . $arrEntry['entryFields'][0] . '</option>';
            }
            $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_PLACE_OPTIONS' => $placeOptions));
            $this->_objTpl->parse('eventHostSelect');
            if ((int) $this->arrSettings['placeDataHost'] == 2) {
                $this->_objTpl->hideBlock('eventHostInput');
                $this->_objTpl->hideBlock('eventHostTypeRadio');
            } else {
                $this->_objTpl->touchBlock('eventHostInput');
                $this->_objTpl->touchBlock('eventHostTypeRadio');
            }
        } else {
            $this->_objTpl->touchBlock('eventHostInput');
            $this->_objTpl->hideBlock('eventHostSelect');
            $this->_objTpl->hideBlock('eventHostTypeRadio');
        }
    }
Пример #11
0
    private function showSubmitForm($data, $display)
    {
        global $_ARRAYLANG, $_CORELANG;
        if (!$display) {
            if ($this->_objTpl->blockExists('news_submit_form')) {
                $this->_objTpl->hideBlock('news_submit_form');
            }
            return;
        }
        $newsTagId = 'newsTags';
        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');
            $this->registerTagJsCode();
            if ($this->_objTpl->blockExists('newsTags') && !empty($data['newsTags'])) {
                foreach ($data['newsTags'] as $newsTag) {
                    $this->_objTpl->setVariable(array('NEWS_TAGS' => contrexx_raw2xhtml($newsTag)));
                    $this->_objTpl->parse('newsTags');
                }
            }
            $this->_objTpl->touchBlock('newsTagsBlock');
        } else {
            $this->_objTpl->hideBlock('newsTagsBlock');
        }
        \JS::activate('chosen');
        $jsCodeCategoryChosen = <<<EOF
\$J(document).ready(function() {
                \$J('#newsCat').chosen();
});
EOF;
        \JS::registerCode($jsCodeCategoryChosen);
        if (!empty($this->arrSettings['use_related_news'])) {
            $objCx = \ContrexxJavascript::getInstance();
            $objCx->setVariable(array('noResultsMsg' => $_ARRAYLANG['TXT_NEWS_NOT_FOUND'], 'langId' => FRONTEND_LANG_ID), 'news/news-live-search');
            \JS::registerJS('core_modules/News/View/Script/news-live-search.js');
            if (!empty($data['relatedNews'])) {
                $this->parseRelatedNewsTags($this->_objTpl, $data['relatedNews'], FRONTEND_LANG_ID);
            }
            $this->_objTpl->touchBlock('relatedNewsBlock');
        } else {
            $this->_objTpl->hideBlock('relatedNewsBlock');
        }
        $this->_objTpl->setVariable(array('TXT_NEWS_MESSAGE' => $_ARRAYLANG['TXT_NEWS_MESSAGE'], 'TXT_TITLE' => $_ARRAYLANG['TXT_TITLE'], 'TXT_CATEGORY' => $_ARRAYLANG['TXT_CATEGORY'], 'TXT_TYPE' => $this->arrSettings['news_use_types'] == 1 ? $_ARRAYLANG['TXT_TYPE'] : '', 'TXT_HYPERLINKS' => $_ARRAYLANG['TXT_HYPERLINKS'], 'TXT_EXTERNAL_SOURCE' => $_ARRAYLANG['TXT_EXTERNAL_SOURCE'], 'TXT_LINK' => $_ARRAYLANG['TXT_LINK'], 'TXT_NEWS_REDIRECT_LABEL' => $_ARRAYLANG['TXT_NEWS_REDIRECT_LABEL'], 'TXT_NEWS_NEWS_CONTENT' => $_ARRAYLANG['TXT_NEWS_NEWS_CONTENT'], 'TXT_NEWS_TEASER_TEXT' => $_ARRAYLANG['TXT_NEWS_TEASER_TEXT'], 'TXT_SUBMIT_NEWS' => $_ARRAYLANG['TXT_SUBMIT_NEWS'], 'TXT_NEWS_REDIRECT' => $_ARRAYLANG['TXT_NEWS_REDIRECT'], 'TXT_NEWS_NEWS_URL' => $_ARRAYLANG['TXT_NEWS_NEWS_URL'], 'TXT_TYPE' => $_ARRAYLANG['TXT_TYPE'], '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_TAGS' => $_ARRAYLANG['TXT_NEWS_TAGS'], 'NEWS_TEXT' => new \Cx\Core\Wysiwyg\Wysiwyg('newsText', $data['newsText'], 'bbcode'), 'NEWS_CAT_MENU' => $this->getCategoryMenu($this->nestedSetRootId, array($data['newsCat'])), 'NEWS_TYPE_MENU' => $this->arrSettings['news_use_types'] == 1 ? $this->getTypeMenu($data['newsType']) : '', 'NEWS_TITLE' => contrexx_raw2xhtml($data['newsTitle']), 'NEWS_SOURCE' => contrexx_raw2xhtml($data['newsSource']), 'NEWS_URL1' => contrexx_raw2xhtml($data['newsUrl1']), 'NEWS_URL2' => contrexx_raw2xhtml($data['newsUrl2']), 'NEWS_TEASER_TEXT' => contrexx_raw2xhtml($data['newsTeaserText']), 'NEWS_REDIRECT' => contrexx_raw2xhtml($data['newsRedirect']), 'NEWS_TAG_ID' => $newsTagId));
        if ($this->arrSettings['news_use_teaser_text'] != '1' && $this->_objTpl->blockExists('news_use_teaser_text')) {
            $this->_objTpl->hideBlock('news_use_teaser_text');
        }
        if (\FWUser::getFWUserObject()->objUser->login()) {
            if ($this->_objTpl->blockExists('news_submit_form_captcha')) {
                $this->_objTpl->hideBlock('news_submit_form_captcha');
            }
        } else {
            $this->_objTpl->setVariable(array('TXT_NEWS_CAPTCHA' => $_CORELANG['TXT_CORE_CAPTCHA'], 'NEWS_CAPTCHA_CODE' => \Cx\Core_Modules\Captcha\Controller\Captcha::getInstance()->getCode()));
            if ($this->_objTpl->blockExists('news_submit_form_captcha')) {
                $this->_objTpl->parse('news_submit_form_captcha');
            }
        }
        $this->parseCategoryMenu();
        $this->parseNewsTypeMenu();
        if ($this->_objTpl->blockExists('news_submit_form')) {
            $this->_objTpl->parse('news_submit_form');
        }
    }
Пример #12
0
 /**
  * Shows the image settings page
  *
  * @access  public
  *
  * @param $arrData
  *
  * @throws \Exception
  * @return  boolean  true on success, false otherwise
  */
 public function image($arrData)
 {
     \JS::registerCSS(substr(ASCMS_CORE_MODULE_FOLDER . '/MediaBrowser/View/Style/mediabrowser.css', 1));
     global $objDatabase, $objTemplate, $_ARRAYLANG;
     $this->strPageTitle = $_ARRAYLANG['TXT_SETTINGS_IMAGE'];
     $objTemplate->addBlockfile('ADMIN_CONTENT', 'settings_image', 'settings_image.html');
     \ContrexxJavascript::getInstance()->setVariable(array('publicTempPath' => Cx::instanciate()->getWebsitePublicTempWebPath()), 'config/image');
     // Saves the settings
     if (isset($arrData['submit'])) {
         $arrSettings['image_cut_width'] = contrexx_input2db(intval($arrData['image_cut_width']));
         $arrSettings['image_cut_height'] = contrexx_input2db(intval($arrData['image_cut_height']));
         //$arrSettings['image_scale_width']  = contrexx_input2db(intval($arrData['image_scale_width']));
         //$arrSettings['image_scale_height'] = contrexx_input2db(intval($arrData['image_scale_height']));
         $arrSettings['image_compression'] = contrexx_input2db(intval($arrData['image_compression']));
         foreach ($arrSettings as $name => $value) {
             $query = '
                 UPDATE `' . DBPREFIX . 'settings_image`
                 SET `value` = "' . $value . '"
                 WHERE `name` = "' . $name . '"
             ';
             $objResult = $objDatabase->Execute($query);
             if ($objResult === false) {
                 throw new \Exception('Could not update the settings');
             }
         }
         $this->strOkMessage = $_ARRAYLANG['TXT_SETTINGS_UPDATED'];
     }
     /**
      * @var $cx \Cx\Core\Core\Controller\Cx
      */
     $cx = \Env::get('cx');
     $pdo = $cx->getDb()->getPdoConnection();
     $sth = $pdo->query('SELECT id, name, size FROM  `' . DBPREFIX . 'settings_thumbnail`');
     $thumbnails = $sth->fetchAll();
     $newThumbnailTemplate = new \Cx\Core\Html\Sigma($cx->getCodeBasePath());
     $newThumbnailTemplate->loadTemplateFile($cx->getCodeBaseCorePath() . '/Config/View/Template/Backend/settings_image_edit.html');
     $newThumbnailTemplate->removeUnknownVariables = false;
     $newThumbnailTemplate->setVariable(array('TXT_IMAGE_TITLE' => $_ARRAYLANG['TXT_SETTINGS_IMAGE_TITLE'], 'TXT_IMAGE_CSRF' => \Cx\Core\Csrf\Controller\Csrf::param(), 'TXT_IMAGE_THUMBNAILS_DELETE' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_DELETE'], 'TXT_IMAGE_CUT_WIDTH' => $_ARRAYLANG['TXT_SETTINGS_IMAGE_CUT_WIDTH'], 'TXT_IMAGE_CUT_HEIGHT' => $_ARRAYLANG['TXT_SETTINGS_IMAGE_CUT_HEIGHT'], 'TXT_IMAGE_THUMBNAILS' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS'], 'TXT_IMAGE_COMPRESSION' => $_ARRAYLANG['TXT_SETTINGS_IMAGE_COMPRESSION'], 'TXT_SAVE' => $_ARRAYLANG['TXT_SAVE'], 'TXT_IMAGE_THUMBNAILS_ID' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_ID'], 'TXT_IMAGE_THUMBNAILS_NAME' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_NAME'], 'TXT_IMAGE_THUMBNAILS_SIZE' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_SIZE'], 'TXT_SETTINGS_FUNCTIONS' => $_ARRAYLANG['TXT_SETTINGS_FUNCTIONS'], 'TXT_IMAGE_THUMBNAILS_RELOAD' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_RELOAD'], 'TXT_IMAGE_THUMBNAILS_NEW' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_NEW'], 'TXT_IMAGE_THUMBNAILS_MAX_SIZE' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_MAX_SIZE'], 'SETTINGS_IMAGE_CUT_WIDTH' => !empty($arrSettings['image_cut_width']) ? $arrSettings['image_cut_width'] : 0, 'SETTINGS_IMAGE_CUT_HEIGHT' => !empty($arrSettings['image_cut_height']) ? $arrSettings['image_cut_height'] : 0));
     $objTemplate->setVariable('CONFIG_THUMBNAIL_NEW_TEMPLATE', implode(' ', explode("\n", str_replace("'", "\"", $newThumbnailTemplate->get()))));
     foreach ($thumbnails as $thumbnail) {
         $objTemplate->setVariable(array('IMAGE_THUMBNAIL_ID' => $thumbnail['id'], 'IMAGE_THUMBNAIL_NAME' => $thumbnail['name'], 'IMAGE_THUMBNAIL_SIZE' => $thumbnail['size'], 'TXT_IMAGE_THUMBNAILS_MAXIMUM' => sprintf($_ARRAYLANG['TXT_IMAGE_THUMBNAILS_MAXIMUM'], $thumbnail['size'] . 'px')));
         $objTemplate->parse('settings_image_thumbnails_list');
     }
     // Gets the settings
     $query = '
         SELECT `name`, `value`
         FROM `' . DBPREFIX . 'settings_image`
     ';
     $objResult = $objDatabase->Execute($query);
     if ($objResult !== false) {
         $arrSettings = array();
         while (!$objResult->EOF) {
             // Creates the settings array
             $arrSettings[$objResult->fields['name']] = $objResult->fields['value'];
             $objResult->MoveNext();
         }
     } else {
         throw new \Exception('Could not query the settings.');
     }
     // Defines the compression values
     $arrCompressionOptions = array();
     for ($i = 1; $i <= 20; $i++) {
         $arrCompressionOptions[] = $i * 5;
     }
     // Parses the compression options
     $imageCompression = !empty($arrSettings['image_compression']) ? intval($arrSettings['image_compression']) : 95;
     foreach ($arrCompressionOptions as $compression) {
         $objTemplate->setVariable(array('IMAGE_COMPRESSION_VALUE' => $compression, 'IMAGE_COMPRESSION_NAME' => $compression, 'OPTION_SELECTED' => $compression == $imageCompression ? 'selected="selected"' : ''));
         $objTemplate->parse('settings_image_compression_options');
     }
     // Parses the settings
     $objTemplate->setVariable(array('TXT_IMAGE_TITLE' => $_ARRAYLANG['TXT_SETTINGS_IMAGE_TITLE'], 'TXT_IMAGE_CSRF' => \Cx\Core\Csrf\Controller\Csrf::param(), 'TXT_IMAGE_THUMBNAILS_DELETE' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_DELETE'], 'TXT_IMAGE_CUT_WIDTH' => $_ARRAYLANG['TXT_SETTINGS_IMAGE_CUT_WIDTH'], 'TXT_IMAGE_CUT_HEIGHT' => $_ARRAYLANG['TXT_SETTINGS_IMAGE_CUT_HEIGHT'], 'TXT_IMAGE_THUMBNAILS' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS'], 'TXT_IMAGE_COMPRESSION' => $_ARRAYLANG['TXT_SETTINGS_IMAGE_COMPRESSION'], 'TXT_SAVE' => $_ARRAYLANG['TXT_SAVE'], 'TXT_IMAGE_THUMBNAILS_ID' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_ID'], 'TXT_IMAGE_THUMBNAILS_NAME' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_NAME'], 'TXT_IMAGE_THUMBNAILS_SIZE' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_SIZE'], 'TXT_SETTINGS_FUNCTIONS' => $_ARRAYLANG['TXT_SETTINGS_FUNCTIONS'], 'TXT_IMAGE_THUMBNAILS_RELOAD' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_RELOAD'], 'TXT_IMAGE_THUMBNAILS_NEW' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_NEW'], 'TXT_IMAGE_THUMBNAILS_MAX_SIZE' => $_ARRAYLANG['TXT_IMAGE_THUMBNAILS_MAX_SIZE'], 'SETTINGS_IMAGE_CUT_WIDTH' => !empty($arrSettings['image_cut_width']) ? $arrSettings['image_cut_width'] : 0, 'SETTINGS_IMAGE_CUT_HEIGHT' => !empty($arrSettings['image_cut_height']) ? $arrSettings['image_cut_height'] : 0));
     $objTemplate->parse('settings_image');
     \Cx\Core\Csrf\Controller\Csrf::add_placeholder($objTemplate);
     return true;
 }
Пример #13
0
 /**
  * Registers Javascript used by the shop
  *
  * If at least one Product has an upload field Attribute associated
  * with it, the $flagUpload parameter *MUST* be set to true.  Note that this
  * will force the respective product form to use mutipart/form-data encoding
  * and disable the JSON cart for the complete page.
  * //@param   boolean $flagUpload         Force the POST cart to be used if true
  * @global  array   $_ARRAYLANG         Language array
  * @global  array   $_CONFIGURATION     Core configuration array, see {@link /config/settings.php}
  * @todo    Reimplement the $flagUpload parameter
  */
 static function registerJavascriptCode()
 {
     global $_ARRAYLANG;
     //, $_CONFIGURATION;
     // needed for cart
     \JS::activate('cx');
     \JS::activate('jquery');
     // TODO: Fix this bug in \ContrexxJavascript::setVariable():
     //echo("TESTING<br />");
     //\ContrexxJavascript::getInstance()->setVariable('Test', $a['unset index'], 'shop');
     //die("Never reached!");
     // Update prices with options included
     // TODO Also consider Customer type (reseller, final customer)
     \ContrexxJavascript::getInstance()->setVariable('TXT_SHOP_PRODUCT_ADDED_TO_CART', $_ARRAYLANG['TXT_SHOP_PRODUCT_ADDED_TO_CART'], 'shop');
     \ContrexxJavascript::getInstance()->setVariable('TXT_SHOP_CONFIRM_DELETE_PRODUCT', $_ARRAYLANG['TXT_SHOP_CONFIRM_DELETE_PRODUCT'], 'shop');
     \ContrexxJavascript::getInstance()->setVariable('TXT_MAKE_DECISION_FOR_OPTIONS', $_ARRAYLANG['TXT_MAKE_DECISION_FOR_OPTIONS'], 'shop');
     \JS::registerJS(substr(\Cx\Core\Core\Controller\Cx::instanciate()->getModuleFolderName() . '/Shop/View/Script/shop.js', 1));
 }
 /**
  * Show the last run's crawler result
  * 
  * @global array $_ARRAYLANG 
  */
 public function showCrawlerResult()
 {
     global $_ARRAYLANG;
     \JS::activate('cx');
     $objCx = \ContrexxJavascript::getInstance();
     $objCx->setVariable(array('updateSuccessMsg' => $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_UPDATE_SUCCESS_MSG'], 'loadingLabel' => $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_LABEL_LOADING']), 'LinkManager');
     if (isset($_POST['checkAgain'])) {
         $this->recheckSelectedLinks();
     }
     //show crawler results
     //get parameters
     $pos = isset($_GET['pos']) ? $_GET['pos'] : 0;
     //set the settings value from DB
     \Cx\Core\Setting\Controller\Setting::init('LinkManager', 'config');
     $pageLimit = \Cx\Core\Setting\Controller\Setting::getValue('entriesPerPage', 'LinkManager');
     $parameter = './index.php?cmd=' . $this->moduleName . '&act=crawlerResult';
     $this->template->setVariable('ENTRIES_PAGING', \Paging::get($parameter, $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_LINKS'], $this->linkRepository->brokenLinkCount(), $pageLimit, true, $pos, 'pos'));
     $brokenLinks = $this->linkRepository->getBrokenLinks($pos, $pageLimit);
     $i = 1;
     $objUser = new \Cx\Core_Modules\LinkManager\Controller\User();
     if ($brokenLinks && $brokenLinks->count() > 0) {
         foreach ($brokenLinks as $brokenLink) {
             $this->template->setVariable(array($this->moduleNameLang . '_BROKEN_LINK_ID' => contrexx_raw2xhtml($brokenLink->getId()), $this->moduleNameLang . '_BROKEN_LINK_IMAGE' => $brokenLink->getBrokenLinkText() == $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_NO_IMAGE'] ? 'brokenImage' : 'brokenLinkImage', $this->moduleNameLang . '_BROKEN_LINK_TEXT' => $brokenLink->getBrokenLinkText(), $this->moduleNameLang . '_BROKEN_LINK_URL' => contrexx_raw2xhtml($brokenLink->getRequestedPath()), $this->moduleNameLang . '_BROKEN_LINK_REFERER' => contrexx_raw2xhtml($brokenLink->getLeadPath()) . '&pos=' . $pos . '&csrf=' . \Cx\Core\Csrf\Controller\Csrf::code(), $this->moduleNameLang . '_BROKEN_LINK_MODULE_NAME' => contrexx_raw2xhtml($brokenLink->getModuleName()), $this->moduleNameLang . '_BROKEN_LINK_ENTRY_TITLE' => contrexx_raw2xhtml($brokenLink->getEntryTitle()), $this->moduleNameLang . '_BROKEN_LINK_STATUS_CODE' => $brokenLink->getLinkStatusCode() == 0 ? $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_NON_EXISTING_DOMAIN'] : contrexx_raw2xhtml($brokenLink->getLinkStatusCode()), $this->moduleNameLang . '_BROKEN_LINK_STATUS' => $brokenLink->getLinkStatus() ? $brokenLink->getLinkStatus() : 0, $this->moduleNameLang . '_BROKEN_LINK_STATUS_CHECKED' => $brokenLink->getLinkStatus() ? 'checked' : '', $this->moduleNameLang . '_BROKEN_LINK_DETECTED' => \Cx\Core_Modules\LinkManager\Controller\DateTime::formattedDateAndTime($brokenLink->getDetectedTime()), $this->moduleNameLang . '_BROKEN_LINK_UPDATED_BY' => $brokenLink->getUpdatedBy() ? contrexx_raw2xhtml($objUser->getUpdatedUserName($brokenLink->getUpdatedBy(), 0)) : '', $this->moduleNameLang . '_CRAWLER_BROKEN_LINK' => $brokenLink->getLinkRecheck() && $brokenLink->getLinkStatus() ? 'brokenLink' : '', $this->moduleNameLang . '_CRAWLER_RUN_ROW' => 'row' . (++$i % 2 + 1)));
             $this->template->parse($this->moduleName . 'CrawlerResultList');
         }
         $this->template->hideBlock('LinkManagerNoCrawlerResultFound');
     } else {
         $this->template->touchBlock('LinkManagerNoCrawlerResultFound');
     }
 }
Пример #15
0
 /**
  * Add / Edit of the Event
  *
  * @param integer $eventId Event id
  *
  * @return null
  */
 function modifyEvent($eventId)
 {
     global $objDatabase, $_ARRAYLANG, $_CORELANG, $_LANGID;
     $this->_objTpl->loadTemplateFile('module_calendar_modify_event.html');
     \JS::registerJS("modules/{$this->moduleName}/View/Script/jquery.pagination.js");
     \ContrexxJavascript::getInstance()->setVariable(array('language_id' => \FWLanguage::getDefaultLangId(), 'active_lang' => implode(',', \FWLanguage::getIdArray())), 'calendar');
     $this->getSettings();
     $this->getFrontendLanguages();
     if (isset($_POST['submitModifyEvent']) || isset($_POST['save_and_publish'])) {
         $objEvent = new \Cx\Modules\Calendar\Controller\CalendarEvent();
         if ($objEvent->save($_POST)) {
             $this->okMessage = $_ARRAYLANG['TXT_CALENDAR_EVENT_SUCCESSFULLY_SAVED'];
             if (isset($_POST['save_and_publish'])) {
                 \Permission::checkAccess(180, 'static');
                 if ($objEvent->confirm()) {
                     // do nothing
                 } else {
                     $this->errMessage = $_ARRAYLANG['TXT_CALENDAR_EVENT_CORRUPT_EDITED'];
                 }
             }
             $this->showOverview();
             return;
         } else {
             $this->errMessage = $_ARRAYLANG['TXT_CALENDAR_EVENT_CORRUPT_SAVED'];
         }
         if ($this->arrSettings['rssFeedStatus'] == 1) {
             $objFeedEventManager = new \Cx\Modules\Calendar\Controller\CalendarEventManager(time(), null, null, null, true);
             $objFeed = new \Cx\Modules\Calendar\Controller\CalendarFeed($objFeedEventManager);
             $objFeed->creatFeed();
         }
     }
     $objCategoryManager = new \Cx\Modules\Calendar\Controller\CalendarCategoryManager(true);
     $objCategoryManager->getCategoryList();
     $objFormManager = new \Cx\Modules\Calendar\Controller\CalendarFormManager(true);
     $objFormManager->getFormList();
     $objMail = new \Cx\Modules\Calendar\Controller\CalendarMail();
     $objMail->getTemplateList();
     $copy = isset($_REQUEST['copy']) && !empty($_REQUEST['copy']);
     $this->_pageTitle = $copy || empty($eventId) ? $_ARRAYLANG['TXT_CALENDAR_INSERT_EVENT'] : $_ARRAYLANG['TXT_CALENDAR_EVENT'] . " " . $_ARRAYLANG['TXT_CALENDAR_EDIT'];
     if ($eventId != 0) {
         $objEvent = new \Cx\Modules\Calendar\Controller\CalendarEvent($eventId);
         $objEvent->getData();
     }
     //parse weekdays
     $arrWeekdays = array("1000000" => $_ARRAYLANG['TXT_CALENDAR_DAYS_MONDAY'], "0100000" => $_ARRAYLANG['TXT_CALENDAR_DAYS_TUESDAY'], "0010000" => $_ARRAYLANG['TXT_CALENDAR_DAYS_WEDNESDAY'], "0001000" => $_ARRAYLANG['TXT_CALENDAR_DAYS_THURSDAY'], "0000100" => $_ARRAYLANG['TXT_CALENDAR_DAYS_FRIDAY'], "0000010" => $_ARRAYLANG['TXT_CALENDAR_DAYS_SATURDAY'], "0000001" => $_ARRAYLANG['TXT_CALENDAR_DAYS_SUNDAY']);
     foreach ($arrWeekdays as $value => $name) {
         $selectedWeekday = $value == $objEvent->seriesData['seriesPatternWeekday'] ? 'selected="selected"' : '';
         $weekdays .= '<option value="' . $value . '" ' . $selectedWeekday . '>' . $name . '</option>';
     }
     //parse count
     $arrCount = array(1 => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_FIRST'], 2 => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_SECOND'], 3 => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_THIRD'], 4 => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_FOURTH'], 5 => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_LAST']);
     foreach ($arrCount as $value => $name) {
         $selectedCount = $value == $objEvent->seriesData['seriesPatternCount'] ? 'selected="selected"' : '';
         $count .= '<option value="' . $value . '" ' . $selectedCount . '>' . $name . '</option>';
     }
     if ($eventId) {
         $startDate = $objEvent->startDate;
         $endDate = $objEvent->endDate;
     } else {
         $startDate = new \DateTime();
         $startMin = (int) $startDate->format('i');
         // Adjust the time to next half hour
         if (!in_array($startMin, array(0, 30))) {
             $minAdj = 60 - $startMin > 30 ? 30 - $startMin : 60 - $startMin;
             $startDate->setTime($startDate->format('H'), $startDate->format('i') + $minAdj, 00);
         }
         $endDate = clone $startDate;
         $endDate->modify("+30 mins");
     }
     $eventStartDate = $this->format2userDateTime($startDate);
     $eventEndDate = $this->format2userDateTime($endDate);
     //parse globals
     $this->_objTpl->setGlobalVariable(array('TXT_' . $this->moduleLangVar . '_TITLE' => $this->_pageTitle, 'TXT_' . $this->moduleLangVar . '_EVENT' => $_ARRAYLANG['TXT_CALENDAR_EVENT'], 'TXT_' . $this->moduleLangVar . '_SAVE' => $_ARRAYLANG['TXT_CALENDAR_SAVE'], 'TXT_' . $this->moduleLangVar . '_DELETE' => $_ARRAYLANG['TXT_CALENDAR_DELETE'], 'TXT_' . $this->moduleLangVar . '_CANCEL' => $_CORELANG['TXT_CANCEL'], 'TXT_' . $this->moduleLangVar . '_EXPAND' => $_ARRAYLANG['TXT_CALENDAR_EXPAND'], 'TXT_' . $this->moduleLangVar . '_MINIMIZE' => $_ARRAYLANG['TXT_CALENDAR_MINIMIZE'], 'TXT_' . $this->moduleLangVar . '_EVENT_DETAILS' => $_ARRAYLANG['TXT_CALENDAR_EVENT_DETAILS'], 'TXT_' . $this->moduleLangVar . '_EVENT_INVITE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_INVITE'], 'TXT_' . $this->moduleLangVar . '_EVENT_SERIES' => $_ARRAYLANG['TXT_CALENDAR_EVENT_SERIES'], 'TXT_' . $this->moduleLangVar . '_EVENT_SERIES_TYPE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_SERIES_TYPE'], 'TXT_' . $this->moduleLangVar . '_EVENT_SERIES_PATTERN' => $_ARRAYLANG['TXT_CALENDAR_EVENT_SERIES_PATTERN'], 'TXT_' . $this->moduleLangVar . '_EVENT_SERIES_EXCEPTIONS' => $_ARRAYLANG['TXT_CALENDAR_EVENT_SERIES_EXCEPTIONS'], 'TXT_' . $this->moduleLangVar . '_EVENT_PUBLICATE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_PUBLICATE'], 'TXT_' . $this->moduleLangVar . '_YES' => $_ARRAYLANG['TXT_CALENDAR_YES'], 'TXT_' . $this->moduleLangVar . '_NEXT' => $_ARRAYLANG['TXT_CALENDAR_NEXT'], 'TXT_' . $this->moduleLangVar . '_BACK' => $_ARRAYLANG['TXT_CALENDAR_STEP_BACK'], 'TXT_' . $this->moduleLangVar . '_EVENT_PRIORITY' => $_ARRAYLANG['TXT_CALENDAR_EVENT_PRIORITY'], 'TXT_' . $this->moduleLangVar . '_EVENT_START' => $_ARRAYLANG['TXT_CALENDAR_EVENT_START'], 'TXT_' . $this->moduleLangVar . '_EVENT_END' => $_ARRAYLANG['TXT_CALENDAR_EVENT_END'], 'TXT_' . $this->moduleLangVar . '_EVENT_ACCESS' => $_ARRAYLANG['TXT_CALENDAR_EVENT_ACCESS'], 'TXT_' . $this->moduleLangVar . '_EVENT_WHOLE_DAY' => $_ARRAYLANG['TXT_CALENDAR_EVENT_WHOLE_DAY'], 'TXT_' . $this->moduleLangVar . '_BROWSE' => $_ARRAYLANG['TXT_CALENDAR_BROWSE'], 'TXT_' . $this->moduleLangVar . '_ACTIVATE' => $_ARRAYLANG['TXT_CALENDAR_ACTIVATE'], 'TXT_' . $this->moduleLangVar . '_EVENT_PRICE' => $_ARRAYLANG['TXT_CALENDAR_PRICE'], 'TXT_' . $this->moduleLangVar . '_EVENT_LINK' => $_ARRAYLANG['TXT_CALENDAR_EVENT_LINK'], 'TXT_' . $this->moduleLangVar . '_EVENT_PICTURE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_PICTURE'], 'TXT_' . $this->moduleLangVar . '_EVENT_ATTACHMENT' => $_ARRAYLANG['TXT_CALENDAR_EVENT_ATTACHMENT'], 'TXT_' . $this->moduleLangVar . '_EVENT_CATEGORY' => $_ARRAYLANG['TXT_CALENDAR_CATEGORY'], 'TXT_' . $this->moduleLangVar . '_COMMUNITY_GROUPS' => $_ARRAYLANG['TXT_CALENDAR_COMMUNITY_GROUPS'], 'TXT_' . $this->moduleLangVar . '_PLEASE_CHECK_INPUT' => $_ARRAYLANG['TXT_CALENDAR_PLEASE_CHECK_INPUT'], 'TXT_' . $this->moduleLangVar . '_EVENT_MORE_INVITATIONS' => $_ARRAYLANG['TXT_CALENDAR_EVENT_MORE_INVITATIONS'], 'TXT_' . $this->moduleLangVar . '_EVENT_REGISTRATION' => $_ARRAYLANG['TXT_CALENDAR_EVENT_REGISTRATION'], 'TXT_' . $this->moduleLangVar . '_EVENT_NUM_SUBSCRIBER' => $_ARRAYLANG['TXT_CALENDAR_EVENT_NUM_SUBSCRIBER'], 'TXT_' . $this->moduleLangVar . '_EVENT_NOTIFICATION_TO' => $_ARRAYLANG['TXT_CALENDAR_EVENT_NOTIFICATION_TO'], 'TXT_' . $this->moduleLangVar . '_EVENT_EMAIL_TEMPLATE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_EMAIL_TEMPLATE'], 'TXT_' . $this->moduleLangVar . '_EVENT_TICKET_SALES' => $_ARRAYLANG['TXT_CALENDAR_EVENT_TICKET_SALES'], 'TXT_' . $this->moduleLangVar . '_EVENT_NUM_SEATING' => $_ARRAYLANG['TXT_CALENDAR_EVENT_NUM_SEATING'], 'TXT_' . $this->moduleLangVar . '_SERIES_PATTERN' => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN'], 'TXT_' . $this->moduleLangVar . '_SERIES_PATTERN_DURANCE' => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_DURANCE'], 'TXT_' . $this->moduleLangVar . '_SERIES_ACTIVATE' => $_ARRAYLANG['TXT_CALENDAR_SERIES_ACTIVATE'], 'TXT_' . $this->moduleLangVar . '_SERIES' => $_ARRAYLANG['TXT_CALENDAR_SERIES'], 'TXT_' . $this->moduleLangVar . '_SERIES_PATTERN_DAILY' => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_DAILY'], 'TXT_' . $this->moduleLangVar . '_SERIES_PATTERN_WEEKLY' => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_WEEKLY'], 'TXT_' . $this->moduleLangVar . '_SERIES_PATTERN_MONTHLY' => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_MONTHLY'], 'TXT_' . $this->moduleLangVar . '_DAYS' => $_ARRAYLANG['TXT_CALENDAR_DAYS'], 'TXT_' . $this->moduleLangVar . '_DAYS_DAY' => $_ARRAYLANG['TXT_CALENDAR_DAYS_DAY'], 'TXT_' . $this->moduleLangVar . '_DAYS_MONDAY' => $_ARRAYLANG['TXT_CALENDAR_DAYS_MONDAY'], 'TXT_' . $this->moduleLangVar . '_DAYS_TUESDAY' => $_ARRAYLANG['TXT_CALENDAR_DAYS_TUESDAY'], 'TXT_' . $this->moduleLangVar . '_DAYS_WEDNESDAY' => $_ARRAYLANG['TXT_CALENDAR_DAYS_WEDNESDAY'], 'TXT_' . $this->moduleLangVar . '_DAYS_THURSDAY' => $_ARRAYLANG['TXT_CALENDAR_DAYS_THURSDAY'], 'TXT_' . $this->moduleLangVar . '_DAYS_FRIDAY' => $_ARRAYLANG['TXT_CALENDAR_DAYS_FRIDAY'], 'TXT_' . $this->moduleLangVar . '_DAYS_SATURDAY' => $_ARRAYLANG['TXT_CALENDAR_DAYS_SATURDAY'], 'TXT_' . $this->moduleLangVar . '_DAYS_SUNDAY' => $_ARRAYLANG['TXT_CALENDAR_DAYS_SUNDAY'], 'TXT_' . $this->moduleLangVar . '_DAYS_WORKDAY' => $_ARRAYLANG['TXT_CALENDAR_DAYS_WORKDAY'], 'TXT_' . $this->moduleLangVar . '_AT' => $_ARRAYLANG['TXT_CALENDAR_AT'], 'TXT_' . $this->moduleLangVar . '_EVERY_1' => $_ARRAYLANG['TXT_CALENDAR_EVERY_1'], 'TXT_' . $this->moduleLangVar . '_ALL' => $_ARRAYLANG['TXT_CALENDAR_ALL'], 'TXT_' . $this->moduleLangVar . '_EVERY_2' => $_ARRAYLANG['TXT_CALENDAR_EVERY_2'], 'TXT_' . $this->moduleLangVar . '_WEEKS' => $_ARRAYLANG['TXT_CALENDAR_WEEKS'], 'TXT_' . $this->moduleLangVar . '_MONTHS' => $_ARRAYLANG['TXT_CALENDAR_MONTHS'], 'TXT_' . $this->moduleLangVar . '_SERIES_PATTERN_BEGINS' => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_BEGINS'], 'TXT_' . $this->moduleLangVar . '_SERIES_PATTERN_NO_ENDDATE' => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_NO_ENDDATE'], 'TXT_' . $this->moduleLangVar . '_SERIES_PATTERN_ENDS_AFTER' => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_ENDS_AFTER'], 'TXT_' . $this->moduleLangVar . '_SERIES_PATTERN_APPONTMENTS' => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_APPONTMENTS'], 'TXT_' . $this->moduleLangVar . '_SERIES_PATTERN_ENDS' => $_ARRAYLANG['TXT_CALENDAR_SERIES_PATTERN_ENDS'], 'TXT_' . $this->moduleLangVar . '_EVENT_SEND_INVITATION' => $objEvent->invitationSent == 0 ? $_ARRAYLANG['TXT_CALENDAR_EVENT_SEND_INVITATION'] : $_ARRAYLANG['TXT_CALENDAR_EVENT_SEND_AGAIN_INVITATION'], 'TXT_' . $this->moduleLangVar . '_EVENT_TYPE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_TYPE'], 'TXT_' . $this->moduleLangVar . '_EVENT_TYPE_EVENT' => $_ARRAYLANG['TXT_CALENDAR_EVENT_TYPE_EVENT'], 'TXT_' . $this->moduleLangVar . '_EVENT_TYPE_REDIRECT' => $_ARRAYLANG['TXT_CALENDAR_EVENT_TYPE_REDIRECT'], 'TXT_' . $this->moduleLangVar . '_EVENT_REGISTRATION_FORM' => $_ARRAYLANG['TXT_CALENDAR_REGISTRATION_FORM'], 'TXT_' . $this->moduleLangVar . '_EVENT_MORE_INVITATIONS_INFO' => $_ARRAYLANG['TXT_CALENDAR_EVENT_MORE_INVITATIONS_INFO'], 'TXT_' . $this->moduleLangVar . '_REGISTRATIONS_SUBSCRIBER_INFO' => $_ARRAYLANG['TXT_CALENDAR_REGISTRATIONS_SUBSCRIBER_INFO'], 'TXT_' . $this->moduleLangVar . '_EVENT_NOTIFICATION_TO_INFO' => $_ARRAYLANG['TXT_CALENDAR_EVENT_NOTIFICATION_TO_INFO'], 'TXT_' . $this->moduleLangVar . '_EVENT_EMAIL_TEMPLATE_INFO' => $_ARRAYLANG['TXT_CALENDAR_EVENT_EMAIL_TEMPLATE_INFO'], 'TXT_' . $this->moduleLangVar . '_EVENT_NUM_SEATING_INFO' => $_ARRAYLANG['TXT_CALENDAR_EVENT_NUM_SEATING_INFO'], 'TXT_' . $this->moduleLangVar . '_SHOW_START_DATE' => $_ARRAYLANG['TXT_CALENDAR_SHOW_START_DATE'], 'TXT_' . $this->moduleLangVar . '_SHOW_END_DATE' => $_ARRAYLANG['TXT_CALENDAR_SHOW_END_DATE'], 'TXT_' . $this->moduleLangVar . '_SHOW_TIME_TYPE' => $_ARRAYLANG['TXT_CALENDAR_SHOW_TIME_TYPE'], 'TXT_' . $this->moduleLangVar . '_SHOW_START_TIME' => $_ARRAYLANG['TXT_CALENDAR_SHOW_START_TIME'], 'TXT_' . $this->moduleLangVar . '_SHOW_END_TIME' => $_ARRAYLANG['TXT_CALENDAR_SHOW_END_TIME'], 'TXT_' . $this->moduleLangVar . '_LIST' => $_ARRAYLANG['TXT_CALENDAR_LIST'], 'TXT_' . $this->moduleLangVar . '_DETAIL' => $_ARRAYLANG['TXT_CALENDAR_DETAIL'], 'TXT_' . $this->moduleLangVar . '_BASIC_DATA' => $_ARRAYLANG['TXT_CALENDAR_BASIC_DATA'], 'TXT_' . $this->moduleLangVar . '_LANGUAGE' => $_ARRAYLANG['TXT_CALENDAR_LANG'], 'TXT_' . $this->moduleLangVar . '_ADDITIONAL_OPTIONS' => $_ARRAYLANG['TXT_CALENDAR_ADDITIONAL_OPTIONS'], 'TXT_' . $this->moduleLangVar . '_EVENT_LOCATION' => $_ARRAYLANG['TXT_CALENDAR_EVENT_LOCATION'], 'TXT_' . $this->moduleLangVar . '_EVENT_ALL_DAY' => $_ARRAYLANG['TXT_CALENDAR_EVENT_ALL_DAY'], 'TXT_' . $this->moduleLangVar . '_EVENT_NAME' => $_ARRAYLANG['TXT_CALENDAR_EVENT_NAME'], 'TXT_' . $this->moduleLangVar . '_EVENT_HOST' => $_ARRAYLANG['TXT_CALENDAR_EVENT_HOST'], 'TXT_' . $this->moduleLangVar . '_EVENT_EMAIL' => $_ARRAYLANG['TXT_CALENDAR_EVENT_EMAIL'], 'TXT_' . $this->moduleLangVar . '_SELECT_EXCEPTION_DATE_INFO' => $_ARRAYLANG['TXT_CALENDAR_SELECT_EXCEPTION_DATE_INFO'], 'TXT_' . $this->moduleLangVar . '_OK' => $_ARRAYLANG['TXT_CALENDAR_OK'], 'TXT_' . $this->moduleLangVar . '_CANCEL' => $_ARRAYLANG['TXT_CALENDAR_CANCEL'], 'TXT_' . $this->moduleLangVar . '_MANAGE' => $_ARRAYLANG['TXT_CALENDAR_MANAGE'], 'TXT_' . $this->moduleLangVar . '_EVENT_SHOW_IN' => $_ARRAYLANG['TXT_CALENDAR_EVENT_SHOW_IN'], 'TXT_' . $this->moduleLangVar . '_EVENT_TITLE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_TITLE'], 'TXT_' . $this->moduleLangVar . '_EVENT_TEASER' => $_ARRAYLANG['TXT_CALENDAR_EVENT_TEASER'], 'TXT_' . $this->moduleLangVar . '_EVENT_PLACE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_PLACE'], 'TXT_' . $this->moduleLangVar . '_EVENT_STREET' => $_ARRAYLANG['TXT_CALENDAR_EVENT_STREET'], 'TXT_' . $this->moduleLangVar . '_EVENT_ZIP' => $_ARRAYLANG['TXT_CALENDAR_EVENT_ZIP'], 'TXT_' . $this->moduleLangVar . '_EVENT_CITY' => $_ARRAYLANG['TXT_CALENDAR_EVENT_CITY'], 'TXT_' . $this->moduleLangVar . '_EVENT_COUNTRY' => $_ARRAYLANG['TXT_CALENDAR_EVENT_COUNTRY'], 'TXT_' . $this->moduleLangVar . '_EVENT_WEBSITE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_WEBSITE'], 'TXT_' . $this->moduleLangVar . '_EVENT_PHONE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_PHONE'], 'TXT_' . $this->moduleLangVar . '_EVENT_MAP' => $_ARRAYLANG['TXT_CALENDAR_EVENT_MAP'], 'TXT_' . $this->moduleLangVar . '_EVENT_USE_GOOGLEMAPS' => $_ARRAYLANG['TXT_CALENDAR_EVENT_USE_GOOGLEMAPS'], 'TXT_' . $this->moduleLangVar . '_PLACE_DATA_DEFAULT' => $_ARRAYLANG['TXT_CALENDAR_PLACE_DATA_DEFAULT'], 'TXT_' . $this->moduleLangVar . '_PLACE_DATA_FROM_MEDIADIR' => $_ARRAYLANG['TXT_CALENDAR_PLACE_DATA_FROM_MEDIADIR'], 'TXT_' . $this->moduleLangVar . '_PREV' => $_ARRAYLANG['TXT_CALENDAR_PREV'], 'TXT_' . $this->moduleLangVar . '_NEXT' => $_ARRAYLANG['TXT_CALENDAR_NEXT'], 'TXT_' . $this->moduleLangVar . '_EVENT_DETAIL_VIEW' => $_ARRAYLANG['TXT_CALENDAR_EVENT_DETAIL_VIEW'], 'TXT_' . $this->moduleLangVar . '_EVENT_DETAIL_VIEW_LABEL' => $_ARRAYLANG['TXT_CALENDAR_EVENT_DETAIL_VIEW_LABEL'], 'TXT_' . $this->moduleLangVar . '_EVENT_TREAT_AS_INDEPENDENT' => $_ARRAYLANG['TXT_CALENDAR_EVENT_TREAT_AS_INDEPENDENT'], 'TXT_' . $this->moduleLangVar . '_EVENT_REGISTRATION_NONE' => $_ARRAYLANG['TXT_CALENDAR_EVENT_REGISTRATION_NONE'], 'TXT_' . $this->moduleLangVar . '_EVENT_REGISTRATION_INTERNAL' => $_ARRAYLANG['TXT_CALENDAR_EVENT_REGISTRATION_INTERNAL'], 'TXT_' . $this->moduleLangVar . '_EVENT_REGISTRATION_EXTERNAL' => $_ARRAYLANG['TXT_CALENDAR_EVENT_REGISTRATION_EXTERNAL'], 'TXT_' . $this->moduleLangVar . '_EVENT_REGISTRATION_FULL_BOOKED' => $_ARRAYLANG['TXT_CALENDAR_EVENT_REGISTRATION_FULL_BOOKED'], 'TXT_' . $this->moduleLangVar . '_MORE' => $_ARRAYLANG['TXT_CALENDAR_MORE'], 'TXT_' . $this->moduleLangVar . '_MINIMIZE' => $_ARRAYLANG['TXT_CALENDAR_MINIMIZE'], $this->moduleLangVar . '_EVENT_REDIRECT_BROWSE_BUTTON' => self::showMediaBrowserButton('eventRedirect', 'sitestructure'), $this->moduleLangVar . '_EVENT_PICTURE_BROWSE_BUTTON' => self::showMediaBrowserButton('eventPicture'), $this->moduleLangVar . '_EVENT_ATTACHMENT_BROWSE_BUTTON' => self::showMediaBrowserButton('eventAttachment'), $this->moduleLangVar . '_PLACE_MAP_SOURCE_BROWSE_BUTTON' => self::showMediaBrowserButton('inputPlaceMap'), $this->moduleLangVar . '_EVENT_ID' => $eventId, $this->moduleLangVar . '_EVENT_DEFAULT_LANG_ID' => $_LANGID, $this->moduleLangVar . '_EVENT_DATE_FORMAT' => $this->getDateFormat(1), $this->moduleLangVar . '_EVENT_CURRENCY' => $this->arrSettings['paymentCurrency'], $this->moduleLangVar . '_EVENT_CATEGORIES' => $objCategoryManager->getCategoryDropdown(intval($objEvent->catId), 2), $this->moduleLangVar . '_EVENT_SERIES_PATTERN_MONTHLY_COUNT' => $count, $this->moduleLangVar . '_EVENT_SERIES_PATTERN_MONTHLY_WEEKDAY' => $weekdays, $this->moduleLangVar . '_EVENT_REGISTRATION_FORMS' => $objFormManager->getFormDorpdown(intval($objEvent->registrationForm)), $this->moduleLangVar . '_EVENT_SHOW_DETAIL_VIEW' => $eventId != 0 ? $objEvent->showDetailView == 1 ? 'checked="checked"' : '' : 'checked="checked"', $this->moduleLangVar . '_EVENT_TYPE_EVENT' => $eventId != 0 ? $objEvent->type == 0 ? 'selected="selected"' : '' : '', $this->moduleLangVar . '_EVENT_TYPE_REDIRECT' => $eventId != 0 ? $objEvent->type == 1 ? 'selected="selected"' : '' : '', $this->moduleLangVar . '_EVENT_START_DATE' => $eventStartDate, $this->moduleLangVar . '_EVENT_END_DATE' => $eventEndDate, $this->moduleLangVar . '_EVENT_PRICE' => $eventId != 0 ? $objEvent->price : '', $this->moduleLangVar . '_EVENT_LINK' => $eventId != 0 ? $objEvent->link : '', $this->moduleLangVar . '_EVENT_PICTURE' => $eventId != 0 ? $objEvent->pic : '', $this->moduleLangVar . '_EVENT_ATTACHMENT' => $eventId != 0 ? $objEvent->attach : '', $this->moduleLangVar . '_EVENT_MORE_INVITATIONS' => $eventId != 0 ? $objEvent->invitedMails : '', $this->moduleLangVar . '_EVENT_NUM_SUBSCRIBER' => $eventId != 0 ? $objEvent->numSubscriber : '', $this->moduleLangVar . '_EVENT_NOTIFICATION_TO' => $eventId != 0 ? $objEvent->notificationTo : '', $this->moduleLangVar . '_EVENT_TICKET_SALES' => $eventId != 0 ? $objEvent->ticketSales ? 'checked="checked"' : '' : '', $this->moduleLangVar . '_EVENT_NUM_SEATING' => $eventId != 0 ? $objEvent->numSeating : '', $this->moduleLangVar . '_EVENT_ALL_DAY' => $eventId != 0 && $objEvent->all_day ? 'checked="checked"' : '', $this->moduleLangVar . '_HIDE_ON_SINGLE_LANG' => count($this->arrFrontendLanguages) == 1 ? "display: none;" : "", $this->moduleLangVar . '_LOCATION_TYPE' => $this->arrSettings['placeData'] == 3 ? $eventId != 0 ? $objEvent->locationType : 1 : $this->arrSettings['placeData'], $this->moduleLangVar . '_EVENT_LOCATION_TYPE_MANUAL' => $eventId != 0 ? $objEvent->locationType == 1 ? "checked='checked'" : '' : "checked='checked'", $this->moduleLangVar . '_EVENT_LOCATION_TYPE_MEDIADIR' => $eventId != 0 ? $objEvent->locationType == 2 ? "checked='checked'" : '' : "", $this->moduleLangVar . '_EVENT_PLACE' => $eventId != 0 ? $objEvent->place : '', $this->moduleLangVar . '_EVENT_STREET' => $eventId != 0 ? $objEvent->place_street : '', $this->moduleLangVar . '_EVENT_ZIP' => $eventId != 0 ? $objEvent->place_zip : '', $this->moduleLangVar . '_EVENT_CITY' => $eventId != 0 ? $objEvent->place_city : '', $this->moduleLangVar . '_EVENT_COUNTRY' => $eventId != 0 ? $objEvent->place_country : '', $this->moduleLangVar . '_EVENT_PLACE_WEBSITE' => $eventId != 0 ? $objEvent->place_website : '', $this->moduleLangVar . '_EVENT_PLACE_LINK' => $eventId != 0 ? $objEvent->place_link : '', $this->moduleLangVar . '_EVENT_PLACE_PHONE' => $eventId != 0 ? $objEvent->place_phone : '', $this->moduleLangVar . '_PLACE_MAP_SOURCE' => $eventId != 0 ? $objEvent->place_map : '', $this->moduleLangVar . '_EVENT_MAP' => $objEvent->google == 1 ? 'checked="checked"' : '', $this->moduleLangVar . '_EVENT_HOST_TYPE' => $this->arrSettings['placeDataHost'] == 3 ? $eventId != 0 ? $objEvent->hostType : 1 : $this->arrSettings['placeDataHost'], $this->moduleLangVar . '_EVENT_HOST' => $eventId != 0 ? $objEvent->org_name : '', $this->moduleLangVar . '_EVENT_HOST_ADDRESS' => $eventId != 0 ? $objEvent->org_street : '', $this->moduleLangVar . '_EVENT_HOST_ZIP' => $eventId != 0 ? $objEvent->org_zip : '', $this->moduleLangVar . '_EVENT_HOST_CITY' => $eventId != 0 ? $objEvent->org_city : '', $this->moduleLangVar . '_EVENT_HOST_COUNTRY' => $eventId != 0 ? $objEvent->org_country : '', $this->moduleLangVar . '_EVENT_HOST_WEBSITE' => $eventId != 0 ? $objEvent->org_website : '', $this->moduleLangVar . '_EVENT_HOST_LINK' => $eventId != 0 ? $objEvent->org_link : '', $this->moduleLangVar . '_EVENT_HOST_PHONE' => $eventId != 0 ? $objEvent->org_phone : '', $this->moduleLangVar . '_EVENT_HOST_EMAIL' => $eventId != 0 ? $objEvent->org_email : '', $this->moduleLangVar . '_EVENT_HOST_TYPE_MANUAL' => $eventId != 0 ? $objEvent->hostType == 1 ? "checked='checked'" : '' : "checked='checked'", $this->moduleLangVar . '_EVENT_HOST_TYPE_MEDIADIR' => $eventId != 0 ? $objEvent->hostType == 2 ? "checked='checked'" : '' : "", $this->moduleLangVar . '_EVENT_COPY' => $copy ? 1 : 0, $this->moduleLangVar . '_EVENT_REGISTRATION_NONE_SELECTED' => !empty($eventId) ? $objEvent->registration == CalendarEvent::EVENT_REGISTRATION_NONE ? 'selected="selected"' : '' : 'selected="selected"', $this->moduleLangVar . '_EVENT_REGISTRATION_INTERNAL_SELECTED' => !empty($eventId) && $objEvent->registration == CalendarEvent::EVENT_REGISTRATION_INTERNAL ? 'selected="selected"' : '', $this->moduleLangVar . '_EVENT_REGISTRATION_EXTERNAL_SELECTED' => !empty($eventId) && $objEvent->registration == CalendarEvent::EVENT_REGISTRATION_EXTERNAL ? 'selected="selected"' : '', $this->moduleLangVar . '_EVENT_REGISTRATION_EXTERNAL_LINK' => !empty($eventId) ? $objEvent->registrationExternalLink : '', $this->moduleLangVar . '_EVENT_REGISTRATION_EXTERNAL_FULL_BOOKED' => !empty($eventId) ? $objEvent->registrationExternalFullyBooked ? 'checked="checked"' : '' : ''));
     // parse invitation E-mail template
     foreach ($this->arrFrontendLanguages as $language) {
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_INVITATION_EMAIL_LANG' => \Html::getLanguageIcon($language['id'], 'active', 'javascript:void()'), $this->moduleLangVar . '_EVENT_INVITATION_EMAIL_LANG_ID' => (int) $language['id'], $this->moduleLangVar . '_EVENT_INVITATION_EMAIL_TEMPLATE' => $objMail->getTemplateDropdown(intval($objEvent->invitationTemplate[$language['id']]), \Cx\Modules\Calendar\Controller\CalendarMailManager::MAIL_INVITATION, $language['id'])));
         $this->_objTpl->parse('invitation_email_template');
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_REGISTRATION_EMAIL_LANG' => \Html::getLanguageIcon($language['id'], 'active', 'javascript:void()'), $this->moduleLangVar . '_EVENT_REGISTRATION_EMAIL_LANG_ID' => (int) $language['id'], $this->moduleLangVar . '_EVENT_REGISTRATION_EMAIL_TEMPLATE' => $objMail->getTemplateDropdown(intval($objEvent->emailTemplate[$language['id']]), \Cx\Modules\Calendar\Controller\CalendarMailManager::MAIL_CONFIRM_REG, $language['id'])));
         $this->_objTpl->parse('registration_email_template');
     }
     //parse access
     for ($i = 0; $i < 2; $i++) {
         $selectedAccess = $eventId == 0 && $i == 0 ? 'selected="selected"' : $objEvent->access == $i ? 'selected="selected"' : '';
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_ACCESS' => $i, $this->moduleLangVar . '_EVENT_ACCESS_SELECT' => $selectedAccess, $this->moduleLangVar . '_EVENT_ACCESS_NAME' => $_ARRAYLANG['TXT_CALENDAR_EVENT_ACCESS_' . $i]));
         $this->_objTpl->parse('eventAccess');
     }
     //parse priority
     for ($i = 1; $i <= 5; $i++) {
         $selectedPriority = $eventId == 0 && $i == 3 ? 'selected="selected"' : $objEvent->priority == $i ? 'selected="selected"' : '';
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_PRIORITY' => $i, $this->moduleLangVar . '_EVENT_PRIORITY_SELECT' => $selectedPriority, $this->moduleLangVar . '_EVENT_PRIORITY_NAME' => $_ARRAYLANG['TXT_CALENDAR_EVENT_PRIORITY_' . $i]));
         $this->_objTpl->parse('eventPriority');
     }
     //parse timetypes
     if ($eventId != 0) {
         // list view
         $showStartDateList = $objEvent->showStartDateList;
         $showEndDateList = $objEvent->showEndDateList;
         $showStartTimeList = $objEvent->showStartTimeList;
         $showEndTimeList = $objEvent->showEndTimeList;
         $showTimeTypeList = $objEvent->showTimeTypeList;
         // detail view
         $showStartDateDetail = $objEvent->showStartDateDetail;
         $showEndDateDetail = $objEvent->showEndDateDetail;
         $showStartTimeDetail = $objEvent->showStartTimeDetail;
         $showEndTimeDetail = $objEvent->showEndTimeDetail;
         $showTimeTypeDetail = $objEvent->showTimeTypeDetail;
     } else {
         // list view
         $showStartDateList = $this->arrSettings['showStartDateList'] == 1;
         $showEndDateList = $this->arrSettings['showEndDateList'] == 1;
         $showStartTimeList = $this->arrSettings['showStartTimeList'] == 1;
         $showEndTimeList = $this->arrSettings['showEndTimeList'] == 1;
         // check if start- or endtime is selected in settings to set type "show time" by default
         if (!$_POST['showTimeTypeList'] && ($showStartTimeList == 1 || $showEndTimeList == 1)) {
             $showTimeTypeList = 1;
         } else {
             $showTimeTypeList = $_POST['showTimeTypeList'];
         }
         // detail view
         $showStartDateDetail = $this->arrSettings['showStartDateDetail'] == 1;
         $showEndDateDetail = $this->arrSettings['showEndDateDetail'] == 1;
         $showStartTimeDetail = $this->arrSettings['showStartTimeDetail'] == 1;
         $showEndTimeDetail = $this->arrSettings['showEndTimeDetail'] == 1;
         // check if start- or endtime is selected in settings to set type "show time" by default
         if (!$_POST['showTimeTypeDetail'] && ($showStartTimeDetail == 1 || $showEndTimeDetail == 1)) {
             $showTimeTypeDetail = 1;
         } else {
             $showTimeTypeDetail = $_POST['showTimeTypeDetail'];
         }
     }
     //time type dropdown for list
     $c = 0;
     $arrListOptions = array($_ARRAYLANG['TXT_CALENDAR_TIME_TYPE_NOTHING'], $_ARRAYLANG['TXT_CALENDAR_TIME_TYPE_TIME'], $_ARRAYLANG['TXT_CALENDAR_TIME_TYPE_FULLTIME']);
     $strTimeTypeListDropdown = '<select id="showTimeTypeList" name="showTimeTypeList" onchange="showTimeListSelection();" >';
     foreach ($arrListOptions as $key => $option) {
         $c == $showTimeTypeList ? $selected = 'selected="selected"' : ($selected = '');
         $strTimeTypeListDropdown .= '<option value="' . $c . '" ' . $selected . '  >' . $arrListOptions[$c] . '</option>';
         $c++;
     }
     $strTimeTypeListDropdown .= '</select>';
     //time type dropdown for detail
     $c = 0;
     $arrDetailOptions = array($_ARRAYLANG['TXT_CALENDAR_TIME_TYPE_NOTHING'], $_ARRAYLANG['TXT_CALENDAR_TIME_TYPE_TIME'], $_ARRAYLANG['TXT_CALENDAR_TIME_TYPE_FULLTIME']);
     $strTimeTypeDetailDropdown = '<select id="showTimeTypeDetail" name="showTimeTypeDetail" onchange="showTimeDetailSelection();" >';
     foreach ($arrDetailOptions as $key => $option) {
         $c == $showTimeTypeDetail ? $selected = 'selected="selected"' : ($selected = '');
         $strTimeTypeDetailDropdown .= '<option value="' . $c . '" ' . $selected . '  >' . $arrDetailOptions[$c] . '</option>';
         $c++;
     }
     $strTimeTypeDetailDropdown .= '</select>';
     //time type placeholders
     $this->_objTpl->setVariable(array($this->moduleLangVar . '_USE_CUSTOM_DATE_DISPLAY' => $objEvent->useCustomDateDisplay ? 'checked="checked"' : '', $this->moduleLangVar . '_START_DATE_CHECKED_LIST' => $showStartDateList ? 'checked="checked"' : '', $this->moduleLangVar . '_START_DATE_VALUE_LIST' => 1, $this->moduleLangVar . '_END_DATE_CHECKED_LIST' => $showEndDateList ? 'checked="checked"' : '', $this->moduleLangVar . '_END_DATE_VALUE_LIST' => 1, $this->moduleLangVar . '_SHOW_TIME_TYPE_DROPDOWN_LIST' => $strTimeTypeListDropdown, $this->moduleLangVar . '_START_TIME_CHECKED_LIST' => $showStartTimeList ? 'checked="checked"' : '', $this->moduleLangVar . '_START_TIME_VALUE_LIST' => 1, $this->moduleLangVar . '_END_TIME_CHECKED_LIST' => $showEndTimeList ? 'checked="checked"' : '', $this->moduleLangVar . '_END_TIME_VALUE_LIST' => 1, $this->moduleLangVar . '_START_DATE_CHECKED_DETAIL' => $showStartDateDetail ? 'checked="checked"' : '', $this->moduleLangVar . '_START_DATE_VALUE_DETAIL' => 1, $this->moduleLangVar . '_END_DATE_CHECKED_DETAIL' => $showEndDateDetail ? 'checked="checked"' : '', $this->moduleLangVar . '_END_DATE_VALUE_DETAIL' => 1, $this->moduleLangVar . '_SHOW_TIME_TYPE_DROPDOWN_DETAIL' => $strTimeTypeDetailDropdown, $this->moduleLangVar . '_START_TIME_CHECKED_DETAIL' => $showStartTimeDetail ? 'checked="checked"' : '', $this->moduleLangVar . '_START_TIME_VALUE_DETAIL' => 1, $this->moduleLangVar . '_END_TIME_CHECKED_DETAIL' => $showEndTimeDetail ? 'checked="checked"' : '', $this->moduleLangVar . '_END_TIME_VALUE_DETAIL' => 1));
     //parse series
     $lastExeptionId = 4;
     $seriesStatus = $objEvent->seriesStatus == 1 ? 'checked="checked"' : '';
     $seriesIndependent = empty($eventId) || $objEvent->independentSeries == 1 ? 'checked="checked"' : '';
     $seriesPatternDailyDays = 1;
     $seriesPatternWeeklyWeeks = 1;
     $seriesPatternMonthlyDay = 1;
     $seriesPatternMonthl1 = 1;
     $seriesPatternMonthl2 = 1;
     $seriesPatternEndsEvents = 5;
     if ($eventId != 0 && $objEvent->seriesStatus == 1) {
         $seriesPatternDaily = $objEvent->seriesData['seriesType'] == 1 ? 'selected="selected"' : '';
         $seriesPatternWeekly = $objEvent->seriesData['seriesType'] == 2 ? 'selected="selected"' : '';
         $seriesPatternMonthly = $objEvent->seriesData['seriesType'] == 3 ? 'selected="selected"' : '';
         //daily
         if ($objEvent->seriesData['seriesType'] == 1) {
             $seriesPatternDaily1 = $objEvent->seriesData['seriesPatternType'] == 1 ? 'checked="checked"' : '';
             $seriesPatternDaily2 = $objEvent->seriesData['seriesPatternType'] == 2 ? 'checked="checked"' : '';
             $seriesPatternDailyDays = $objEvent->seriesData['seriesPatternType'] == 1 ? $objEvent->seriesData['seriesPatternDay'] : 1;
         }
         //weekly
         if ($objEvent->seriesData['seriesType'] == 2) {
             $seriesPatternWeeklyWeeks = $objEvent->seriesData['seriesPatternWeek'];
             $seriesPatternWeeklyMon = substr($objEvent->seriesData['seriesPatternWeekday'], 0, 1) == 1 ? 'checked="checked"' : '';
             $seriesPatternWeeklyTue = substr($objEvent->seriesData['seriesPatternWeekday'], 1, 1) == 1 ? 'checked="checked"' : '';
             $seriesPatternWeeklyWed = substr($objEvent->seriesData['seriesPatternWeekday'], 2, 1) == 1 ? 'checked="checked"' : '';
             $seriesPatternWeeklyThu = substr($objEvent->seriesData['seriesPatternWeekday'], 3, 1) == 1 ? 'checked="checked"' : '';
             $seriesPatternWeeklyFri = substr($objEvent->seriesData['seriesPatternWeekday'], 4, 1) == 1 ? 'checked="checked"' : '';
             $seriesPatternWeeklySat = substr($objEvent->seriesData['seriesPatternWeekday'], 5, 1) == 1 ? 'checked="checked"' : '';
             $seriesPatternWeeklySun = substr($objEvent->seriesData['seriesPatternWeekday'], 6, 1) == 1 ? 'checked="checked"' : '';
         }
         //monthly
         if ($objEvent->seriesData['seriesType'] == 3) {
             $seriesPatternMonthly1 = $objEvent->seriesData['seriesPatternType'] == 1 ? 'checked="checked"' : '';
             $seriesPatternMonthly2 = $objEvent->seriesData['seriesPatternType'] == 2 ? 'checked="checked"' : '';
             if ($objEvent->seriesData['seriesPatternType'] == 1) {
                 $seriesPatternMonthlyDay = $objEvent->seriesData['seriesPatternDay'];
                 $seriesPatternMonthl1 = $objEvent->seriesData['seriesPatternMonth'];
             }
             if ($objEvent->seriesData['seriesPatternType'] == 2) {
                 $seriesPatternMonthl2 = $objEvent->seriesData['seriesPatternMonth'];
             }
         }
         //douration
         $seriesPatternDourance1 = $objEvent->seriesData['seriesPatternDouranceType'] == 1 ? 'checked="checked"' : '';
         $seriesPatternDourance2 = $objEvent->seriesData['seriesPatternDouranceType'] == 2 ? 'checked="checked"' : '';
         $seriesPatternDourance3 = $objEvent->seriesData['seriesPatternDouranceType'] == 3 ? 'checked="checked"' : '';
         $seriesPatternEndsEvents = $objEvent->seriesData['seriesPatternDouranceType'] == 2 ? $objEvent->seriesData['seriesPatternEnd'] : 5;
         $seriesPatternEndsDate = $objEvent->seriesData['seriesPatternDouranceType'] == 3 ? $this->format2userDate($objEvent->seriesData['seriesPatternEndDate']) : '';
         foreach ($objEvent->seriesData['seriesPatternExceptions'] as $key => $seriesExceptionDate) {
             if ($seriesExceptionDate != null) {
                 $this->_objTpl->setVariable(array($this->moduleLangVar . '_SERIES_EXEPTION_DATE' => $this->format2userDate($seriesExceptionDate)));
                 $this->_objTpl->parse('eventExeptions');
             }
         }
     } else {
         $seriesPatternDaily = 'checked="checked"';
         $seriesPatternDaily1 = 'checked="checked"';
         $seriesPatternMonthly1 = 'checked="checked"';
         $seriesPatternDourance1 = 'checked="checked"';
         $this->_objTpl->hideBlock('eventExeptions');
     }
     $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_SERIES_STATUS' => $seriesStatus, $this->moduleLangVar . '_EVENT_SERIES_INDEPENDENT' => $seriesIndependent, $this->moduleLangVar . '_SERIES_PATTERN_DAILY' => $seriesPatternDaily, $this->moduleLangVar . '_SERIES_PATTERN_WEEKLY' => $seriesPatternWeekly, $this->moduleLangVar . '_SERIES_PATTERN_MONTHLY' => $seriesPatternMonthly, $this->moduleLangVar . '_SERIES_PATTERN_DAILY_1' => $seriesPatternDaily1, $this->moduleLangVar . '_SERIES_PATTERN_DAILY_2' => $seriesPatternDaily2, $this->moduleLangVar . '_SERIES_PATTERN_DAILY_DAYS' => $seriesPatternDailyDays, $this->moduleLangVar . '_SERIES_PATTERN_MONTHLY_1' => $seriesPatternMonthly1, $this->moduleLangVar . '_SERIES_PATTERN_MONTHLY_DAY' => $seriesPatternMonthlyDay, $this->moduleLangVar . '_SERIES_PATTERN_MONTHLY_MONTH_1' => $seriesPatternMonthl1, $this->moduleLangVar . '_SERIES_PATTERN_MONTHLY_MONTH_2' => $seriesPatternMonthl2, $this->moduleLangVar . '_SERIES_PATTERN_MONTHLY_2' => $seriesPatternMonthly2, $this->moduleLangVar . '_SERIES_PATTERN_DOURANCE_1' => $seriesPatternDourance1, $this->moduleLangVar . '_SERIES_PATTERN_DOURANCE_2' => $seriesPatternDourance2, $this->moduleLangVar . '_SERIES_PATTERN_DOURANCE_3' => $seriesPatternDourance3, $this->moduleLangVar . '_SERIES_PATTERN_ENDS_EVENTS' => $seriesPatternEndsEvents, $this->moduleLangVar . '_SERIES_PATTERN_ENDS_DATE' => $seriesPatternEndsDate, $this->moduleLangVar . '_SERIES_PATTERN_ENDS_INPUT_ID' => $seriesPatternEndsInputId, $this->moduleLangVar . '_SERIES_PATTERN_WEEKLY_WEEKS' => $seriesPatternWeeklyWeeks, $this->moduleLangVar . '_SERIES_PATTERN_WEEKLY_MONDAY' => $seriesPatternWeeklyMon, $this->moduleLangVar . '_SERIES_PATTERN_WEEKLY_TUESDAY' => $seriesPatternWeeklyTue, $this->moduleLangVar . '_SERIES_PATTERN_WEEKLY_WEDNESDAY' => $seriesPatternWeeklyWed, $this->moduleLangVar . '_SERIES_PATTERN_WEEKLY_THURSDAY' => $seriesPatternWeeklyThu, $this->moduleLangVar . '_SERIES_PATTERN_WEEKLY_FRIDAY' => $seriesPatternWeeklyFri, $this->moduleLangVar . '_SERIES_PATTERN_WEEKLY_SATURDAY' => $seriesPatternWeeklySat, $this->moduleLangVar . '_SERIES_PATTERN_WEEKLY_SUNDAY' => $seriesPatternWeeklySun));
     //parse publicate
     $objHostManager = new \Cx\Modules\Calendar\Controller\CalendarHostManager(null, true);
     $objHostManager->getHostList();
     foreach ($objHostManager->hostList as $key => $objHost) {
         if (in_array($objHost->id, $objEvent->relatedHosts)) {
             $selectetHosts .= '<option value="' . $objHost->id . '">' . $objHost->title . '</option>';
         } else {
             $deselectetHosts .= '<option value="' . $objHost->id . '">' . $objHost->title . '</option>';
         }
     }
     $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_DESELECTED_HOSTS' => $deselectetHosts, $this->moduleLangVar . '_EVENT_SELECTED_HOSTS' => $selectetHosts));
     if ($this->arrSettings['publicationStatus'] == 1 && !empty($objHostManager->hostList)) {
         $onsubmitPublications = "selectAll(document.formModifyEvent.elements['selectedHosts[]']);";
         $this->_objTpl->touchBlock('eventPublicateMenu');
         $this->_objTpl->touchBlock('eventPublicateTab');
     } else {
         $onsubmitPublications = "";
         $this->_objTpl->hideBlock('eventPublicateMenu');
         $this->_objTpl->hideBlock('eventPublicateTab');
     }
     //parse ivited groups
     $this->getCommunityGroups();
     foreach ($this->arrCommunityGroups as $key => $arrGroup) {
         if (in_array($arrGroup['id'], $objEvent->invitedGroups)) {
             $selectedGroups .= '<option value="' . $arrGroup['id'] . '">' . htmlentities($arrGroup['name'], ENT_QUOTES, CONTREXX_CHARSET) . '</option>';
         } else {
             $deselectedGroups .= '<option value="' . $arrGroup['id'] . '">' . htmlentities($arrGroup['name'], ENT_QUOTES, CONTREXX_CHARSET) . '</option>';
         }
     }
     $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_DESELECTED_GROUPS' => $deselectedGroups, $this->moduleLangVar . '_EVENT_SELECTED_GROUPS' => $selectedGroups, $this->moduleLangVar . '_EVENT_ONSUBMIT_PUBLICATIONS' => $onsubmitPublications));
     $forcedLanguage = null;
     if (isset($_GET['langId']) && in_array(contrexx_input2raw($_GET['langId']), \FWLanguage::getIdArray())) {
         $forcedLanguage = contrexx_input2raw($_GET['langId']);
     }
     //parse placeSelect
     if ((int) $this->arrSettings['placeData'] > 1) {
         $objMediadirEntries = new \Cx\Modules\MediaDir\Controller\MediaDirectoryEntry('MediaDir');
         $objMediadirEntries->getEntries(null, null, null, null, null, null, true, 0, 'n', null, null, intval($this->arrSettings['placeDataForm']));
         $placeOptions = '<option value="">' . $_ARRAYLANG['TXT_CALENDAR_PLEASE_CHOOSE'] . '</option>';
         foreach ($objMediadirEntries->arrEntries as $key => $arrEntry) {
             $selectedPlace = $arrEntry['entryId'] == $objEvent->place_mediadir_id ? 'selected="selected"' : '';
             $placeOptions .= '<option ' . $selectedPlace . ' value="' . $arrEntry['entryId'] . '">' . $arrEntry['entryFields'][0] . '</option>';
         }
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_PLACE_OPTIONS' => $placeOptions));
         $this->_objTpl->parse('eventPlaceSelect');
         if ((int) $this->arrSettings['placeData'] == 2) {
             $this->_objTpl->hideBlock('eventPlaceInput');
             $this->_objTpl->hideBlock('eventPlaceTypeRadio');
         } else {
             $this->_objTpl->touchBlock('eventPlaceInput');
             $this->_objTpl->touchBlock('eventPlaceTypeRadio');
         }
     } else {
         $this->_objTpl->touchBlock('eventPlaceInput');
         $this->_objTpl->hideBlock('eventPlaceSelect');
         $this->_objTpl->hideBlock('eventPlaceTypeRadio');
     }
     //parse placeHostSelect
     if ((int) $this->arrSettings['placeDataHost'] > 1) {
         $objMediadirEntries = new \Cx\Modules\MediaDir\Controller\MediaDirectoryEntry('MediaDir');
         $objMediadirEntries->getEntries(null, null, null, null, null, null, true, 0, 'n', null, null, intval($this->arrSettings['placeDataHostForm']));
         $placeOptions = '<option value="">' . $_ARRAYLANG['TXT_CALENDAR_PLEASE_CHOOSE'] . '</option>';
         foreach ($objMediadirEntries->arrEntries as $key => $arrEntry) {
             $selectedPlace = $arrEntry['entryId'] == $objEvent->host_mediadir_id ? 'selected="selected"' : '';
             $placeOptions .= '<option ' . $selectedPlace . ' value="' . $arrEntry['entryId'] . '">' . $arrEntry['entryFields'][0] . '</option>';
         }
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_PLACE_OPTIONS' => $placeOptions));
         $this->_objTpl->parse('eventHostSelect');
         if ((int) $this->arrSettings['placeDataHost'] == 2) {
             $this->_objTpl->hideBlock('eventHostInput');
             $this->_objTpl->hideBlock('eventHostTypeRadio');
         } else {
             $this->_objTpl->touchBlock('eventHostInput');
             $this->_objTpl->touchBlock('eventHostTypeRadio');
         }
     } else {
         $this->_objTpl->touchBlock('eventHostInput');
         $this->_objTpl->hideBlock('eventHostSelect');
         $this->_objTpl->hideBlock('eventHostTypeRadio');
     }
     $multiLingualFields = array('place', 'place_city', 'place_country', 'org_name', 'org_city', 'org_country');
     $isOneActiveLanguage = count($this->arrFrontendLanguages) == 1;
     foreach ($multiLingualFields as $inputField) {
         if ($isOneActiveLanguage) {
             $this->_objTpl->hideBlock('calendar_event_' . $inputField . '_expand');
         } else {
             $this->_objTpl->touchBlock('calendar_event_' . $inputField . '_expand');
         }
     }
     foreach ($this->arrFrontendLanguages as $key => $arrLang) {
         //parse globals
         $this->_objTpl->setGlobalVariable(array($this->moduleLangVar . '_EVENT_LANG_SHORTCUT' => $arrLang['lang'], $this->moduleLangVar . '_EVENT_LANG_ID' => $arrLang['id'], 'TXT_' . $this->moduleLangVar . '_EVENT_LANG_NAME' => $arrLang['name']));
         //parse "show in" checkboxes
         $arrShowIn = explode(",", $objEvent->showIn);
         $langChecked = false;
         if ($eventId != 0) {
             $langChecked = in_array($arrLang['id'], $arrShowIn);
             if ($forcedLanguage && !$langChecked) {
                 $langChecked = $forcedLanguage == $arrLang['id'];
             }
         } else {
             $langChecked = $arrLang['is_default'] == 'true';
         }
         if ($langChecked) {
             $langChecked = 'checked="checked"';
         } else {
             $langChecked = '';
         }
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_LANG_CHECKED' => $langChecked));
         $this->_objTpl->parse('eventShowIn');
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_TAB_DISPLAY' => $arrLang['is_default'] == 'true' ? 'block' : 'none', $this->moduleLangVar . '_EVENT_TITLE' => !empty($objEvent->arrData['title'][$arrLang['id']]) ? $objEvent->arrData['title'][$arrLang['id']] : $objEvent->title, $this->moduleLangVar . '_EVENT_TEASER' => !empty($objEvent->arrData['teaser'][$arrLang['id']]) ? $objEvent->arrData['teaser'][$arrLang['id']] : $objEvent->teaser));
         //parse eventTabMenuDescTab
         $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_TAB_CLASS' => $defaultLang ? 'active' : ''));
         $this->_objTpl->parse('eventTabMenuDescTab');
         //parse eventDescTab
         $this->_objTpl->setVariable(array('TXT_' . $this->moduleLangVar . '_EVENT_DESCRIPTION' => $_ARRAYLANG['TXT_CALENDAR_EVENT_DESCRIPTION'], 'TXT_' . $this->moduleLangVar . '_EVENT_REDIRECT' => $_ARRAYLANG['TXT_CALENDAR_EVENT_TYPE_REDIRECT'], $this->moduleLangVar . '_EVENT_TAB_DISPLAY' => $arrLang['is_default'] == 'true' ? 'block' : 'none', $this->moduleLangVar . '_EVENT_DESCRIPTION' => new \Cx\Core\Wysiwyg\Wysiwyg('description[' . $arrLang['id'] . ']', !empty($objEvent->arrData['description'][$arrLang['id']]) ? contrexx_raw2xhtml($objEvent->arrData['description'][$arrLang['id']]) : contrexx_raw2xhtml($objEvent->description), 'full'), $this->moduleLangVar . '_EVENT_REDIRECT' => !empty($objEvent->arrData['redirect'][$arrLang['id']]) ? $objEvent->arrData['redirect'][$arrLang['id']] : $objEvent->arrData['redirect'][$_LANGID], $this->moduleLangVar . '_EVENT_TYPE_EVENT_DISPLAY' => $objEvent->type == 0 ? 'block' : 'none', $this->moduleLangVar . '_EVENT_TYPE_REDIRECT_DISPLAY' => $objEvent->type == 1 ? 'block' : 'none', $this->moduleLangVar . '_ONSUBMIT_PUBLICATION' => $onsubmitPublications));
         $this->_objTpl->parse('eventDescTab');
         //parse eventLingualFields
         foreach ($multiLingualFields as $inputField) {
             $this->_objTpl->setVariable($this->moduleLangVar . '_EVENT_' . strtoupper($inputField) . '_DEFAULT', $eventId != 0 ? $objEvent->{$inputField} : '');
             $this->_objTpl->setVariable(array($this->moduleLangVar . '_EVENT_VALUE' => !empty($objEvent->arrData[$inputField][$arrLang['id']]) ? $objEvent->arrData[$inputField][$arrLang['id']] : ($eventId != 0 ? $objEvent->{$inputField} : '')));
             $this->_objTpl->parse('calendar_event_' . $inputField);
         }
     }
     if (isset($_GET['confirm']) && $_GET['confirm']) {
         $this->_objTpl->setGlobalVariable(array($this->moduleLangVar . '_SAVE_PUBLISH' => "<input type='submit' name='save_and_publish' value='{$_ARRAYLANG['TXT_CALENDAR_SAVE_AND_PUBLISH']}'>", $this->moduleLangVar . '_EVENT_DELETE' => "<input type='button' name='delete' value='{$_ARRAYLANG['TXT_CALENDAR_DELETE']}' onClick='if (confirm(\"{$_ARRAYLANG['TXT_CALENDAR_CONFIRM_DELETE_DATA']}\\n{$_ARRAYLANG['TXT_CALENDAR_ACTION_IS_IRREVERSIBLE']}\")) { window.location.href = \"index.php?cmd={$this->moduleName}&delete={$eventId}&" . \Cx\Core\Csrf\Controller\Csrf::param() . "\"} return false;'>"));
     }
     \Cx\Core\Core\Controller\Cx::instanciate()->getComponent('Cache')->deleteComponentFiles('Calendar');
 }
Пример #16
0
 /**
  * Activates the user live search.
  * @param   array   $arrOptions
  * @return  void
  * @link    http://www.cloudrexx.com/wiki/index.php/User_Live_Search
  */
 public static function getUserLiveSearch($arrOptions = array())
 {
     global $_CORELANG;
     // Options for the dialog
     $arrOptions['minLength'] = empty($arrOptions['minLength']) ? 3 : intval($arrOptions['minLength']);
     $arrOptions['canCancel'] = empty($arrOptions['canCancel']) ? 0 : 1;
     $arrOptions['canClear'] = empty($arrOptions['canClear']) ? 0 : 1;
     $txtUserSearchInfo = sprintf($_CORELANG['TXT_CORE_SEARCH_USER_INFO'], $arrOptions['minLength']);
     $scope = 'user/live-search';
     $objCx = \ContrexxJavascript::getInstance();
     $objCx->setVariable('userMinLength', $arrOptions['minLength'], $scope);
     $objCx->setVariable('userCanCancel', $arrOptions['canCancel'], $scope);
     $objCx->setVariable('userCanClear', $arrOptions['canClear'], $scope);
     $objCx->setVariable('txtUserSearch', $_CORELANG['TXT_CORE_SEARCH_USER'], $scope);
     $objCx->setVariable('txtUserCancel', $_CORELANG['TXT_CANCEL'], $scope);
     $objCx->setVariable('txtUserSearchInfo', $txtUserSearchInfo, $scope);
     \JS::activate('user-live-search');
 }
Пример #17
0
 public function getFrameXHtml()
 {
     global $_CORELANG;
     if (!empty($_SESSION['upload']['handlers'][$this->uploadId]['singleFileMode'])) {
         \ContrexxJavascript::getInstance()->setVariable('restrictUpload2SingleFile', true, "upload/widget_{$this->uploadId}");
     }
     //JS / CSS dependencies
     \JS::activate('cx');
     \JS::registerCSS('core_modules/Upload/css/uploaders/form/formUploader.css');
     \JS::registerJS('core_modules/Upload/js/uploaders/form/formUploader.js');
     $uploadPath = $this->getUploadPath('form');
     $redirectUrl = '';
     if ($this->isBackendRequest) {
         $redirectUrl = ASCMS_ADMIN_WEB_PATH . '/index.php?cmd=Upload&act=formUploaderFrameFinished&uploadId=' . $this->uploadId;
     } else {
         $url = clone \Env::get('cx')->getRequest()->getUrl();
         $url->removeAllParams();
         $url->setParams(array('section' => 'Upload', 'cmd' => 'formUploaderFrameFinished', 'uploadId' => $this->uploadId));
         $redirectUrl = (string) $url;
     }
     $this->setRedirectUrl($redirectUrl);
     $tpl = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/Upload/template/uploaders');
     $tpl->setErrorHandling(PEAR_ERROR_DIE);
     $tpl->loadTemplateFile('formFrame.html');
     $tpl->setVariable('UPLOAD_URL', $uploadPath);
     $tpl->setVariable('INCLUDES', \JS::getCode());
     $tpl->setVariable('CXJS_INIT_JS', \ContrexxJavascript::getInstance()->initJs());
     $tpl->setVariable('UPLOAD_FORM_ADD', $_CORELANG['UPLOAD_FORM_ADD']);
     $tpl->setVariable('UPLOAD', $_CORELANG['UPLOAD']);
     $tpl->setVariable('UPLOAD_ID', $this->uploadId);
     $tpl->setVariable('MAX_FILE_SIZE', \FWSystem::getMaxUploadFileSize() - 1000);
     $cx = \Cx\Core\Core\Controller\Cx::instanciate();
     $ls = new \LinkSanitizer($cx, $cx->getCodeBaseOffsetPath(), $tpl->get());
     return $ls->replace();
 }
Пример #18
0
    /**
     * Creates and returns the HTML Form for requesting the payment service.
     *
     * @access  public     
     * @return  string                      The HTML form code
     */
    static function getForm($arrOrder, $landingPage = null)
    {
        global $_ARRAYLANG;
        if (gettype($landingPage) != 'object' || get_class($landingPage) != 'Cx\\Core\\ContentManager\\Model\\Entity\\Page') {
            self::$arrError[] = 'No landing page passed.';
        }
        if (($sectionName = $landingPage->getModule()) && !empty($sectionName)) {
            self::$sectionName = $sectionName;
        } else {
            self::$arrError[] = 'Passed landing page is not an application.';
        }
        JS::registerJS(self::$paymillJsBridge);
        \ContrexxJavascript::getInstance()->setVariable(array('invalid-card-holder' => $_ARRAYLANG['TXT_SHOP_PAYMILL_INVAILD_CARD_HOLDER'], 'invalid-account-number' => $_ARRAYLANG['TXT_SHOP_PAYMILL_INVALID_ACC_NUMBER'], 'invalid-bank-code' => $_ARRAYLANG['TXT_SHOP_PAYMILL_INVALID_BANK_CODE']), 'shop');
        $testMode = intval(\Cx\Core\Setting\Controller\Setting::getValue('paymill_use_test_account', 'Shop')) == 0;
        $apiKey = $testMode ? \Cx\Core\Setting\Controller\Setting::getValue('paymill_test_public_key', 'Shop') : \Cx\Core\Setting\Controller\Setting::getValue('paymill_live_public_key', 'Shop');
        $mode = $testMode ? 'true' : 'false';
        $code = <<<APISETTING
                var PAYMILL_PUBLIC_KEY = '{$apiKey}';
                var PAYMILL_TEST_MODE  = {$mode};
APISETTING;
        JS::registerCode($code);
        JS::registerCode(self::$formScript);
        $formContent = self::getElement('div', 'class="paymill-error-text"');
        $formContent .= self::fieldset('');
        $formContent .= self::openElement('div', 'class="row"');
        $formContent .= self::getElement('label', '', $_ARRAYLANG['TXT_SHOP_PAYMILL_ELV_ACCOUNT_NUMBER']);
        $formContent .= Html::getInputText('', '', '', 'class="elv-account"');
        $formContent .= self::closeElement('div');
        $formContent .= self::openElement('div', 'class="row"');
        $formContent .= self::getElement('label', '', $_ARRAYLANG['TXT_SHOP_PAYMILL_ELV_BANK_CODE']);
        $formContent .= Html::getInputText('', '', '', 'class ="elv-bankcode"');
        $formContent .= self::closeElement('div');
        $formContent .= self::openElement('div', 'class="row"');
        $formContent .= self::getElement('label', '', $_ARRAYLANG['TXT_SHOP_PAYMILL_ACCOUNT_HOLDER']);
        $formContent .= Html::getInputText('', '', '', 'class="elv-holdername"');
        $formContent .= self::closeElement('div');
        $formContent .= self::openElement('div', 'class="row"');
        $formContent .= self::getElement('label', '', '&nbsp;');
        $formContent .= Html::getInputButton('', $_ARRAYLANG['TXT_SHOP_BUY_NOW'], 'submit', '', 'class="submit-button"');
        $formContent .= self::closeElement('div');
        $formContent .= Html::getHidden('handler', 'paymill_elv');
        $formContent .= self::closeElement('fieldset');
        $form = Html::getForm('', Cx\Core\Routing\Url::fromPage($landingPage)->toString(), $formContent, 'payment-form', 'post');
        return $form;
    }
Пример #19
0
    /**
     * Registers the javascript code to update a license
     * @param array $_CORELANG Core language array
     * @param array $_CONFIG The configuration array
     * @param boolean $autoexec (optional) Wheter to perform update check automaticly or on form submit
     */
    public function addJsUpdateCode(&$_CORELANG, $license, $intern = false, $autoexec = true)
    {
        $v = preg_split('#\\.#', $this->coreCmsVersion);
        $version = current($v);
        unset($v[key($v)]);
        foreach ($v as $part) {
            $version *= 100;
            $version += $part;
        }
        $userAgentRequestArguments = array('data=' . urlencode(json_encode(array('installationId' => $license->getInstallationId(), 'licenseKey' => $license->getLicenseKey(), 'edition' => $license->getEditionName(), 'version' => $this->coreCmsVersion, 'versionstate' => $this->coreCmsStatus, 'domainName' => $this->domainUrl, 'remoteAddr' => $_SERVER['REMOTE_ADDR'], 'sendTemplate' => false))), 'v=' . $version, 'userAgentRequest=true');
        if (!$autoexec || $this->isTimeToUpdate()) {
            if (self::$javascriptRegistered) {
                return;
            }
            self::$javascriptRegistered = true;
            \JS::activate('jquery');
            $objJs = \ContrexxJavascript::getInstance();
            $objJs->setVariable("statusmessage_success", $_CORELANG['TXT_LICENSE_UPDATED'], "core_module/license");
            $jsCode = '
                cx.jQuery(document).ready(function() {
                    var licenseMessage      = cx.jQuery("#license_message");
                    var cloneLicenseMessage = cx.jQuery("#license_message").clone();
                    var reloadManager       = true;
                    
                    var revertMessage = function(setClass, setHref, setTarget, setText) {
                        setTimeout(function() {
                            newLicenseMessage = cloneLicenseMessage.clone();
                            if (setClass) {
                                newLicenseMessage.attr("class", "upgrade " + setClass);
                            }
                            if (setHref) {
                                licenseMessage.children("a:first").attr("href", setHref);
                            }
                            if (setTarget) {
                                licenseMessage.children("a:first").attr("target", setTarget);
                            }
                            if (setText) {
                                licenseMessage.children("a:first").html(setText);
                            }
                            licenseMessage.replaceWith(newLicenseMessage);
                            licenseMessage = newLicenseMessage;
                        }, 1000);
                    }
                    
                    //var versionCheckUrl = "../core_modules/License/versioncheck.php?force=true";
                    var versionCheckUrl = "../api/licup?force=true";
                    var versionCheckResponseHandler = function(data, allowUserAgent) {';
            $sm = new \Cx\Core\Config\Controller\Config();
            if (\FWUser::getFWUserObject()->objUser->getAdminStatus()) {
                $jsCode .= '
                        if (data == "false" && allowUserAgent && ' . ($sm->isWritable() ? 'true' : 'false') . ') {
                            reloadManager = false;
                            cx.jQuery.getScript("http://updatesrv1.contrexx.com/?' . implode('&', $userAgentRequestArguments) . '", function() {
                                cx.jQuery.post(
                                    versionCheckUrl,
                                    {"response": JSON.stringify(licenseUpdateUserAgentRequestResponse)}
                                ).success(function(data) {
                                    reloadManager = true;
                                    versionCheckResponseHandler(data, false)
                                }).error(function(data) {
                                    revertMessage();
                                });
                            }).fail(function(){
                                revertMessage();
                            });
                        }';
            }
            $jsCode .= '
                        var data = cx.jQuery.parseJSON(data);
                        if (!data) {
                            revertMessage();
                            return;
                        }
                        revertMessage(data[\'class\'], data.link, data.target, data.text);
                        cx.jQuery("#jsstatemessage").html(cx.variables.get("statusmessage_success", "core_module/license"));
                        cx.jQuery("#jsstatemessage").addClass("okbox");
                        cx.jQuery("#jsstatemessage").show();
                        if (reloadManager && ' . ($sm->isWritable() ? 'true' : 'false') . ' && data.status != "ERROR") {
                            setTimeout(function() {
                                window.location.href = window.location.href;
                            }, 1500);
                        }
                    }
                    
                    var performRequest = function() {
                        licenseMessage.attr("class", "infobox");
                        licenseMessage.text("' . $_CORELANG['TXT_LICENSE_UPDATING'] . '");
                        licenseMessage.show();

                        cx.jQuery.get(
                            versionCheckUrl
                        ).success(function(data) {
                            versionCheckResponseHandler(data, true);
                        }).error(function(data) {
                            revertMessage();
                        });
                        return false;
                    }' . ($autoexec ? '()' : '') . ';
                    
                    ' . ($intern ? 'cx.jQuery("input[name=update]").click(performRequest);' : '') . '
                });
            ';
            \JS::registerCode($jsCode);
        }
    }
Пример #20
0
 private function getTreeCode()
 {
     if (count($this->arrMigrateLangIds) === 1) {
         return true;
     }
     $jsSimilarPages = array();
     $this->similarPages = $this->findSimilarPages();
     foreach ($this->similarPages as $nodeId => $arrPageIds) {
         $jsSimilarPages[$nodeId] = array_values($arrPageIds);
         foreach ($this->arrMigrateLangIds as $migrateLangId) {
             if (!isset($arrPageIds[$migrateLangId])) {
                 $this->similarPages[$nodeId][$migrateLangId] = 0;
             }
         }
         ksort($this->similarPages[$nodeId]);
     }
     $objCx = \ContrexxJavascript::getInstance();
     $objCx->setVariable('similarPages', json_encode($jsSimilarPages), 'update/contentMigration');
     $objTemplate = new \HTML_Template_Sigma(UPDATE_TPL);
     $objTemplate->setErrorHandling(PEAR_ERROR_DIE);
     $objTemplate->loadTemplateFile('page_grouping.html');
     $groupedBorderWidth = count($this->arrMigrateLangIds) * 325 - 48;
     $objTemplate->setGlobalVariable(array('USERNAME' => $_SESSION['contrexx_update']['username'], 'PASSWORD' => $_SESSION['contrexx_update']['password'], 'CMS_VERSION' => $_SESSION['contrexx_update']['version'], 'MIGRATE_LANG_IDS' => $this->migrateLangIds, 'LANGUAGE_WRAPPER_WIDTH' => 'width: ' . count($this->arrMigrateLangIds) * 330 . 'px;', 'GROUPED_SCROLL_WIDTH' => 'width: ' . count($this->arrMigrateLangIds) * 325 . 'px;', 'GROUPED_BORDER_WIDTH' => 'width: ' . $groupedBorderWidth . 'px;'));
     $cl = \Env::get('ClassLoader');
     $cl->loadFile(ASCMS_CORE_PATH . '/Tree.class.php');
     $cl->loadFile(UPDATE_CORE . '/UpdateTree.class.php');
     $pageRepo = self::$em->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page');
     $nodeRepo = self::$em->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Node');
     foreach ($this->arrMigrateLangIds as $lang) {
         $objContentTree = new \UpdateContentTree($lang);
         foreach ($objContentTree->getTree() as $arrPage) {
             $pageId = $arrPage['catid'];
             $nodeId = $arrPage['node_id'];
             $langId = $arrPage['lang'];
             $level = $arrPage['level'];
             $title = $arrPage['catname'];
             $sort = $nodeRepo->find($nodeId)->getLft();
             $grouped = $this->isGrouppedPage($this->similarPages, $pageId) ? 'grouped' : '';
             $objTemplate->setVariable(array('TITLE' => $title, 'ID' => $pageId, 'NODE' => $nodeId, 'LANG' => strtoupper(\FWLanguage::getLanguageCodeById($langId)), 'LEVEL' => $level + 1, 'SORT' => $sort, 'GROUPED' => $grouped, 'MARGIN' => 'margin-left: ' . $level * 15 . 'px;'));
             $objTemplate->parse('page');
         }
         $langFull = \FWLanguage::getLanguageParameter($lang, 'name');
         $langShort = strtoupper(\FWLanguage::getLanguageParameter($lang, 'lang'));
         $objTemplate->setVariable(array('LANG_FULL' => $langFull, 'LANG_SHORT' => $langShort));
         $objTemplate->parse('language');
     }
     $groupedBorderWidth -= 2;
     foreach ($this->similarPages as $nodeId => $arrPageIds) {
         $node = $nodeRepo->find($nodeId);
         $margin = ($node->getLvl() - 1) * 15;
         $nodeWidth = $groupedBorderWidth - $margin;
         $width = ($groupedBorderWidth - 10) / count($this->arrMigrateLangIds);
         $index = 0;
         $last = count($arrPageIds) - 1;
         foreach ($arrPageIds as $pageLangId => $pageId) {
             if ($index === 0) {
                 $pageWidth = $width - 24;
             } elseif ($index === $last) {
                 $pageWidth = $width - $margin;
             } else {
                 $pageWidth = $width;
             }
             $index++;
             $page = $pageRepo->find($pageId);
             if ($page) {
                 $langCode = strtoupper(\FWLanguage::getLanguageCodeById($page->getLang()));
                 $objTemplate->setVariable(array('CLASS' => '', 'DATA_ID' => 'data-id="' . $pageId . '"', 'DATA_LANG' => 'data-lang="' . $langCode . '"', 'TITLE' => $page->getTitle(), 'LANG' => $langCode, 'WIDTH' => 'width: ' . $pageWidth . 'px;'));
             } else {
                 $langCode = strtoupper(\FWLanguage::getLanguageCodeById($pageLangId));
                 $objTemplate->setVariable(array('CLASS' => 'no-page', 'DATA_ID' => '', 'DATA_LANG' => '', 'TITLE' => 'Keine Seite', 'LANG' => $langCode, 'WIDTH' => 'width: ' . $pageWidth . 'px;'));
             }
             $objTemplate->parse('groupedPage');
         }
         $objTemplate->setVariable(array('ID' => $nodeId, 'LEVEL' => $node->getLvl(), 'SORT' => $node->getLft(), 'STYLE' => 'width: ' . $nodeWidth . 'px; margin-left: ' . $margin . 'px;'));
         $objTemplate->parse('groupedNode');
     }
     return $objTemplate->get();
 }
Пример #21
0
 protected function actRenderCM()
 {
     global $_ARRAYLANG, $_CORELANG, $_CONFIG;
     \JS::activate('jqueryui');
     \JS::activate('cx');
     \JS::activate('ckeditor');
     \JS::activate('cx-form');
     \JS::activate('jstree');
     \JS::registerJS('lib/javascript/lock.js');
     \JS::registerJS('lib/javascript/jquery/jquery.history.max.js');
     // this can be used to debug the tree, just add &tree=verify or &tree=fix
     $tree = null;
     if (isset($_GET['tree'])) {
         $tree = contrexx_input2raw($_GET['tree']);
     }
     if ($tree == 'verify') {
         echo '<pre>';
         print_r($this->nodeRepository->verify());
         echo '</pre>';
     } else {
         if ($tree == 'fix') {
             // this should print "bool(true)"
             var_dump($this->nodeRepository->recover());
         }
     }
     $objCx = \ContrexxJavascript::getInstance();
     $themeRepo = new \Cx\Core\View\Model\Repository\ThemeRepository();
     $defaultTheme = $themeRepo->getDefaultTheme();
     $objCx->setVariable('themeId', $defaultTheme->getId(), 'contentmanager/theme');
     foreach ($themeRepo->findAll() as $theme) {
         if ($theme == $defaultTheme) {
             $objCx->setVariable('themeName', $theme->getFoldername(), 'contentmanager/theme');
         }
     }
     $this->template->addBlockfile('ADMIN_CONTENT', 'content_manager', 'Skeleton.html');
     // user has no permission to create new page, hide navigation item in admin navigation
     if (!\Permission::checkAccess(127, 'static', true)) {
         $this->template->hideBlock('content_manager_create_new_page_navigation_item');
     }
     $this->template->touchBlock('content_manager');
     $this->template->addBlockfile('CONTENT_MANAGER_MEAT', 'content_manager_meat', 'Page.html');
     $this->template->touchBlock('content_manager_meat');
     if (\Permission::checkAccess(78, 'static', true)) {
         \JS::registerCode("var publishAllowed = true;");
     } else {
         \JS::registerCode("var publishAllowed = false;");
     }
     if (\Permission::checkAccess(78, 'static', true) && \Permission::checkAccess(115, 'static', true)) {
         \JS::registerCode("var aliasManagementAllowed = true;");
         $alias_permission = "block";
         $alias_denial = "none !important";
     } else {
         \JS::registerCode("var aliasManagementAllowed = false;");
         $alias_permission = "none !important";
         $alias_denial = "block";
     }
     $mediaBrowser = new MediaBrowser();
     $mediaBrowser->setCallback('target_page_callback');
     $mediaBrowser->setOptions(array('type' => 'button', 'data-cx-mb-views' => 'sitestructure', 'id' => 'page_target_browse'));
     $mediaBrowserCkeditor = new MediaBrowser();
     $mediaBrowserCkeditor->setCallback('ckeditor_image_callback');
     $mediaBrowserCkeditor->setOptions(array('id' => 'ckeditor_image_button', 'type' => 'button', 'style' => 'display:none'));
     $this->template->setVariable(array('MEDIABROWSER_BUTTON' => $mediaBrowser->getXHtml($_ARRAYLANG['TXT_CORE_CM_BROWSE']), 'MEDIABROWSER_BUTTON_CKEDITOR' => $mediaBrowserCkeditor->getXHtml($_ARRAYLANG['TXT_CORE_CM_BROWSE'])));
     $this->template->setVariable(array('ALIAS_PERMISSION' => $alias_permission, 'ALIAS_DENIAL' => $alias_denial, 'CONTREXX_BASE_URL' => ASCMS_PROTOCOL . '://' . $_CONFIG['domainUrl'] . ASCMS_PATH_OFFSET . '/', 'CONTREXX_LANG' => \FWLanguage::getLanguageCodeById(BACKEND_LANG_ID)));
     global $_CORELANG;
     $this->template->setVariable($_CORELANG);
     $objCx->setVariable('TXT_CORE_CM_VIEW', $_CORELANG['TXT_CORE_CM_VIEW'], 'contentmanager/lang');
     $objCx->setVariable('TXT_CORE_CM_ACTIONS', $_CORELANG['TXT_CORE_CM_ACTIONS'], 'contentmanager/lang');
     $objCx->setVariable('TXT_CORE_CM_VALIDATION_FAIL', $_CORELANG['TXT_CORE_CM_VALIDATION_FAIL'], 'contentmanager/lang');
     $objCx->setVariable('TXT_CORE_CM_HOME_FAIL', $_CORELANG['TXT_CORE_CM_HOME_FAIL'], 'contentmanager/lang');
     $arrLangVars = array('actions' => array('new' => 'TXT_CORE_CM_ACTION_NEW', 'copy' => 'TXT_CORE_CM_ACTION_COPY', 'activate' => 'TXT_CORE_CM_ACTION_PUBLISH', 'deactivate' => 'TXT_CORE_CM_ACTION_UNPUBLISH', 'publish' => 'TXT_CORE_CM_ACTION_PUBLISH_DRAFT', 'show' => 'TXT_CORE_CM_ACTION_SHOW', 'hide' => 'TXT_CORE_CM_ACTION_HIDE', 'delete' => 'TXT_CORE_CM_ACTION_DELETE', 'recursiveQuestion' => 'TXT_CORE_CM_RECURSIVE_QUESTION'), 'tooltip' => array('TXT_CORE_CM_LAST_MODIFIED' => 'TXT_CORE_CM_LAST_MODIFIED', 'TXT_CORE_CM_PUBLISHING_INFO_STATUSES' => 'TXT_CORE_CM_PUBLISHING_INFO_STATUSES', 'TXT_CORE_CM_PUBLISHING_INFO_ACTION_ACTIVATE' => 'TXT_CORE_CM_PUBLISHING_INFO_ACTION_ACTIVATE', 'TXT_CORE_CM_PUBLISHING_INFO_ACTION_DEACTIVATE' => 'TXT_CORE_CM_PUBLISHING_INFO_ACTION_DEACTIVATE', 'TXT_CORE_CM_PUBLISHING_DRAFT' => 'TXT_CORE_CM_PUBLISHING_DRAFT', 'TXT_CORE_CM_PUBLISHING_DRAFT_WAITING' => 'TXT_CORE_CM_PUBLISHING_DRAFT_WAITING', 'TXT_CORE_CM_PUBLISHING_LOCKED' => 'TXT_CORE_CM_PUBLISHING_LOCKED', 'TXT_CORE_CM_PUBLISHING_PUBLISHED' => 'TXT_CORE_CM_PUBLISHING_PUBLISHED', 'TXT_CORE_CM_PUBLISHING_UNPUBLISHED' => 'TXT_CORE_CM_PUBLISHING_UNPUBLISHED', 'TXT_CORE_CM_PAGE_INFO_STATUSES' => 'TXT_CORE_CM_PAGE_INFO_STATUSES', 'TXT_CORE_CM_PUBLISHING_INFO_TYPES' => 'TXT_CORE_CM_PUBLISHING_INFO_TYPES', 'TXT_CORE_CM_PAGE_INFO_ACTION_SHOW' => 'TXT_CORE_CM_PAGE_INFO_ACTION_SHOW', 'TXT_CORE_CM_PAGE_INFO_ACTION_HIDE' => 'TXT_CORE_CM_PAGE_INFO_ACTION_HIDE', 'TXT_CORE_CM_PAGE_STATUS_BROKEN' => 'TXT_CORE_CM_PAGE_STATUS_BROKEN', 'TXT_CORE_CM_PAGE_STATUS_VISIBLE' => 'TXT_CORE_CM_PAGE_STATUS_VISIBLE', 'TXT_CORE_CM_PAGE_STATUS_INVISIBLE' => 'TXT_CORE_CM_PAGE_STATUS_INVISIBLE', 'TXT_CORE_CM_PAGE_STATUS_PROTECTED' => 'TXT_CORE_CM_PAGE_STATUS_PROTECTED', 'TXT_CORE_CM_PAGE_TYPE_HOME' => 'TXT_CORE_CM_PAGE_TYPE_HOME', 'TXT_CORE_CM_PAGE_TYPE_CONTENT_SITE' => 'TXT_CORE_CM_PAGE_TYPE_CONTENT_SITE', 'TXT_CORE_CM_PAGE_TYPE_APPLICATION' => 'TXT_CORE_CM_PAGE_TYPE_APPLICATION', 'TXT_CORE_CM_PAGE_TYPE_REDIRECTION' => 'TXT_CORE_CM_PAGE_TYPE_REDIRECTION', 'TXT_CORE_CM_PAGE_TYPE_SYMLINK' => 'TXT_CORE_CM_PAGE_TYPE_SYMLINK', 'TXT_CORE_CM_PAGE_TYPE_FALLBACK' => 'TXT_CORE_CM_PAGE_TYPE_FALLBACK', 'TXT_CORE_CM_PAGE_MOVE_INFO' => 'TXT_CORE_CM_PAGE_MOVE_INFO', 'TXT_CORE_CM_TRANSLATION_INFO' => 'TXT_CORE_CM_TRANSLATION_INFO', 'TXT_CORE_CM_PREVIEW_INFO' => 'TXT_CORE_CM_PREVIEW_INFO'));
     foreach ($arrLangVars as $subscope => $arrLang) {
         foreach ($arrLang as $name => $value) {
             $objCx->setVariable($name, $_CORELANG[$value], 'contentmanager/lang/' . $subscope);
         }
     }
     // Mediabrowser
     $mediaBrowser = new \Cx\Core_Modules\MediaBrowser\Model\Entity\MediaBrowser();
     $mediaBrowser->setOptions(array('type' => 'button'));
     $mediaBrowser->setCallback('setWebPageUrlCallback');
     $mediaBrowser->setOptions(array('data-cx-mb-startview' => 'sitestructure', 'id' => 'page_target_browse'));
     $this->template->setVariable(array('CM_MEDIABROWSER_BUTTON' => $mediaBrowser->getXHtml($_ARRAYLANG['TXT_CORE_CM_BROWSE'])));
     $toggleTitles = !empty($_SESSION['contentManager']['toggleStatuses']['toggleTitles']) ? $_SESSION['contentManager']['toggleStatuses']['toggleTitles'] : 'block';
     $toggleType = !empty($_SESSION['contentManager']['toggleStatuses']['toggleType']) ? $_SESSION['contentManager']['toggleStatuses']['toggleType'] : 'block';
     $toggleNavigation = !empty($_SESSION['contentManager']['toggleStatuses']['toggleNavigation']) ? $_SESSION['contentManager']['toggleStatuses']['toggleNavigation'] : 'block';
     $toggleBlocks = !empty($_SESSION['contentManager']['toggleStatuses']['toggleBlocks']) ? $_SESSION['contentManager']['toggleStatuses']['toggleBlocks'] : 'block';
     $toggleThemes = !empty($_SESSION['contentManager']['toggleStatuses']['toggleThemes']) ? $_SESSION['contentManager']['toggleStatuses']['toggleThemes'] : 'block';
     $toggleApplication = !empty($_SESSION['contentManager']['toggleStatuses']['toggleApplication']) ? $_SESSION['contentManager']['toggleStatuses']['toggleApplication'] : 'block';
     $toggleSidebar = !empty($_SESSION['contentManager']['toggleStatuses']['sidebar']) ? $_SESSION['contentManager']['toggleStatuses']['sidebar'] : 'block';
     $objCx->setVariable('toggleTitles', $toggleTitles, 'contentmanager/toggle');
     $objCx->setVariable('toggleType', $toggleType, 'contentmanager/toggle');
     $objCx->setVariable('toggleNavigation', $toggleNavigation, 'contentmanager/toggle');
     $objCx->setVariable('toggleBlocks', $toggleBlocks, 'contentmanager/toggle');
     $objCx->setVariable('toggleThemes', $toggleThemes, 'contentmanager/toggle');
     $objCx->setVariable('toggleApplication', $toggleApplication, 'contentmanager/toggle');
     $objCx->setVariable('sidebar', $toggleSidebar, 'contentmanager/toggle');
     // get initial tree data
     $objJsonData = new \Cx\Core\Json\JsonData();
     $treeData = $objJsonData->jsondata('node', 'getTree', array('get' => $_GET), false);
     $objCx->setVariable('tree-data', $treeData, 'contentmanager/tree');
     if (!empty($_GET['act']) && $_GET['act'] == 'new') {
         $this->template->setVariable(array('TITLES_DISPLAY_STYLE' => 'display: block;', 'TITLES_TOGGLE_CLASS' => 'open', 'TYPE_DISPLAY_STYLE' => 'display: block;', 'TYPE_TOGGLE_CLASS' => 'open', 'NAVIGATION_DISPLAY_STYLE' => 'display: block;', 'NAVIGATION_TOGGLE_CLASS' => 'open', 'BLOCKS_DISPLAY_STYLE' => 'display: block;', 'BLOCKS_TOGGLE_CLASS' => 'open', 'THEMES_DISPLAY_STYLE' => 'display: block;', 'THEMES_TOGGLE_CLASS' => 'open', 'APPLICATION_DISPLAY_STYLE' => 'display: block;', 'APPLICATION_TOGGLE_CLASS' => 'open', 'MULTIPLE_ACTIONS_STRIKE_STYLE' => 'display: none;'));
     } else {
         $this->template->setVariable(array('TITLES_DISPLAY_STYLE' => $toggleTitles == 'none' ? 'display: none;' : 'display: block;', 'TITLES_TOGGLE_CLASS' => $toggleTitles == 'none' ? 'closed' : 'open', 'TYPE_DISPLAY_STYLE' => $toggleType == 'none' ? 'display: none;' : 'display: block;', 'TYPE_TOGGLE_CLASS' => $toggleType == 'none' ? 'closed' : 'open', 'NAVIGATION_DISPLAY_STYLE' => $toggleNavigation == 'none' ? 'display: none;' : 'display: block;', 'NAVIGATION_TOGGLE_CLASS' => $toggleNavigation == 'none' ? 'closed' : 'open', 'BLOCKS_DISPLAY_STYLE' => $toggleBlocks == 'none' ? 'display: none;' : 'display: block;', 'BLOCKS_TOGGLE_CLASS' => $toggleBlocks == 'none' ? 'closed' : 'open', 'THEMES_DISPLAY_STYLE' => $toggleThemes == 'none' ? 'display: none;' : 'display: block;', 'THEMES_TOGGLE_CLASS' => $toggleThemes == 'none' ? 'closed' : 'open', 'APPLICATION_DISPLAY_STYLE' => $toggleApplication == 'none' ? 'display: none;' : 'display: block;', 'APPLICATION_TOGGLE_CLASS' => $toggleApplication == 'none' ? 'closed' : 'open'));
     }
     $modules = $this->db->Execute("SELECT * FROM " . DBPREFIX . "modules WHERE `status` = 'y' ORDER BY `name`");
     while (!$modules->EOF) {
         $this->template->setVariable('MODULE_KEY', $modules->fields['name']);
         //            $this->template->setVariable('MODULE_TITLE', $_CORELANG[$modules->fields['description_variable']]);
         $this->template->setVariable('MODULE_TITLE', ucwords($modules->fields['name']));
         $this->template->parse('module_option');
         $modules->MoveNext();
     }
     $newPageFirstLevel = isset($_GET['act']) && $_GET['act'] == 'new';
     if (\Permission::checkAccess(36, 'static', true)) {
         $this->template->touchBlock('page_permissions_tab');
         $this->template->touchBlock('page_permissions');
     } else {
         $this->template->hideBlock('page_permissions_tab');
         $this->template->hideBlock('page_permissions');
     }
     //show the caching options only if the caching system is actually active
     if ($_CONFIG['cacheEnabled'] == 'on') {
         $this->template->touchBlock('show_caching_option');
     } else {
         $this->template->hideBlock('show_caching_option');
     }
     if (\Permission::checkAccess(78, 'static', true)) {
         $this->template->hideBlock('release_button');
     } else {
         $this->template->hideBlock('publish_button');
         $this->template->hideBlock('refuse_button');
     }
     // show no access page if the user wants to create new page in first level but he does not have enough permissions
     if ($newPageFirstLevel) {
         \Permission::checkAccess(127, 'static');
     }
     $editViewCssClass = '';
     if ($newPageFirstLevel) {
         $editViewCssClass = 'edit_view';
         $this->template->hideBlock('refuse_button');
     }
     $cxjs = \ContrexxJavascript::getInstance();
     $cxjs->setVariable('confirmDeleteQuestion', $_ARRAYLANG['TXT_CORE_CM_CONFIRM_DELETE'], 'contentmanager/lang');
     $cxjs->setVariable('cleanAccessData', $objJsonData->jsondata('page', 'getAccessData', array(), false), 'contentmanager');
     $cxjs->setVariable('contentTemplates', $this->getCustomContentTemplates(), 'contentmanager');
     $cxjs->setVariable('defaultTemplates', $this->getDefaultTemplates(), 'contentmanager/themes');
     $cxjs->setVariable('templateFolders', $this->getTemplateFolders(), 'contentmanager/themes');
     $cxjs->setVariable('availableBlocks', $objJsonData->jsondata('Block', 'getBlocks', array(), false), 'contentmanager');
     // TODO: move including of add'l JS dependencies to cx obj from /cadmin/index.html
     $getLangOptions = $this->getLangOptions();
     $statusPageLayout = '';
     $languageDisplay = '';
     if ((!empty($_GET['act']) && $_GET['act'] == 'new' || !empty($_GET['page'])) && $getLangOptions == "") {
         $statusPageLayout = 'margin0';
         $languageDisplay = 'display:none';
     }
     $this->template->setVariable('ADMIN_LIST_MARGIN', $statusPageLayout);
     $this->template->setVariable('LANGUAGE_DISPLAY', $languageDisplay);
     // TODO: move including of add'l JS dependencies to cx obj from /cadmin/index.html
     $this->template->setVariable('SKIN_OPTIONS', $this->getSkinOptions());
     $this->template->setVariable('LANGSWITCH_OPTIONS', $this->getLangOptions());
     $this->template->setVariable('LANGUAGE_ARRAY', json_encode($this->getLangArray()));
     $this->template->setVariable('FALLBACK_ARRAY', json_encode($this->getFallbackArray()));
     $this->template->setVariable('LANGUAGE_LABELS', json_encode($this->getLangLabels()));
     $this->template->setVariable('EDIT_VIEW_CSS_CLASS', $editViewCssClass);
     $this->template->touchBlock('content_manager_language_selection');
     $editmodeTemplate = new \Cx\Core\Html\Sigma(ASCMS_CORE_PATH . '/ContentManager/View/Template/Backend');
     $editmodeTemplate->loadTemplateFile('content_editmode.html');
     $editmodeTemplate->setVariable(array('TXT_EDITMODE_TEXT' => $_CORELANG['TXT_FRONTEND_EDITING_SELECTION_TEXT'], 'TXT_EDITMODE_CODE' => $_CORELANG['TXT_FRONTEND_EDITING_SELECTION_MODE_PAGE'], 'TXT_EDITMODE_CONTENT' => $_CORELANG['TXT_FRONTEND_EDITING_SELECTION_MODE_CONTENT']));
     $cxjs->setVariable(array('editmodetitle' => $_CORELANG['TXT_FRONTEND_EDITING_SELECTION_TITLE'], 'editmodecontent' => $editmodeTemplate->get(), 'ckeditorconfigpath' => substr(\Env::get('ClassLoader')->getFilePath(ASCMS_CORE_PATH . '/Wysiwyg/ckeditor.config.js.php'), strlen(ASCMS_DOCUMENT_ROOT) + 1), 'regExpUriProtocol' => \FWValidator::REGEX_URI_PROTO, 'contrexxBaseUrl' => ASCMS_PROTOCOL . '://' . $_CONFIG['domainUrl'] . ASCMS_PATH_OFFSET . '/', 'contrexxPathOffset' => ASCMS_PATH_OFFSET), 'contentmanager');
 }
Пример #22
0
 /**
  * Show modify block
  *
  * Show the block modification page
  *
  * @access private
  * @global array
  * @see blockLibrary::_getBlockContent(), blockLibrary::blockNamePrefix
  */
 private function _showModifyBlock($copy = false)
 {
     global $_ARRAYLANG;
     \JS::activate('cx');
     \JS::activate('ckeditor');
     \JS::activate('jqueryui');
     \JS::registerJS('lib/javascript/tag-it/js/tag-it.min.js');
     \JS::registerCss('lib/javascript/tag-it/css/tag-it.css');
     $mediaBrowserCkeditor = new MediaBrowser();
     $mediaBrowserCkeditor->setCallback('ckeditor_image_button');
     $mediaBrowserCkeditor->setOptions(array('id' => 'ckeditor_image_button', 'type' => 'button', 'style' => 'display:none'));
     $blockId = !empty($_REQUEST['blockId']) ? intval($_REQUEST['blockId']) : 0;
     $blockCat = 0;
     $blockName = '';
     $blockStart = 0;
     $blockEnd = 0;
     $blockRandom = 0;
     $blockRandom2 = 0;
     $blockRandom3 = 0;
     $blockRandom4 = 0;
     $blockGlobal = 0;
     $blockDirect = 0;
     $blockCategory = 0;
     $blockWysiwygEditor = 1;
     $blockContent = array();
     $blockAssociatedPageIds = array();
     $blockLangActive = array();
     $blockGlobalAssociatedPageIds = array();
     $blockDirectAssociatedPageIds = array();
     $blockCategoryAssociatedPageIds = array();
     $this->_objTpl->loadTemplateFile('module_block_modify.html');
     $this->_objTpl->setGlobalVariable(array('TXT_BLOCK_CONTENT' => $_ARRAYLANG['TXT_BLOCK_CONTENT'], 'TXT_BLOCK_NAME' => $_ARRAYLANG['TXT_BLOCK_NAME'], 'TXT_BLOCK_RANDOM' => $_ARRAYLANG['TXT_BLOCK_RANDOM'], 'TXT_BLOCK_GLOBAL' => $_ARRAYLANG['TXT_BLOCK_SHOW_IN_GLOBAL'], 'TXT_BLOCK_SAVE' => $_ARRAYLANG['TXT_BLOCK_SAVE'], 'TXT_BLOCK_DEACTIVATE' => $_ARRAYLANG['TXT_BLOCK_DEACTIVATE'], 'TXT_BLOCK_ACTIVATE' => $_ARRAYLANG['TXT_BLOCK_ACTIVATE'], 'TXT_DONT_SHOW_ON_PAGES' => $_ARRAYLANG['TXT_DONT_SHOW_ON_PAGES'], 'TXT_SHOW_ON_ALL_PAGES' => $_ARRAYLANG['TXT_SHOW_ON_ALL_PAGES'], 'TXT_SHOW_ON_SELECTED_PAGES' => $_ARRAYLANG['TXT_SHOW_ON_SELECTED_PAGES'], 'TXT_BLOCK_CATEGORY' => $_ARRAYLANG['TXT_BLOCK_CATEGORY'], 'TXT_BLOCK_NONE' => $_ARRAYLANG['TXT_BLOCK_NONE'], 'TXT_BLOCK_SHOW_FROM' => $_ARRAYLANG['TXT_BLOCK_SHOW_FROM'], 'TXT_BLOCK_SHOW_UNTIL' => $_ARRAYLANG['TXT_BLOCK_SHOW_UNTIL'], 'TXT_BLOCK_SHOW_TIMED' => $_ARRAYLANG['TXT_BLOCK_SHOW_TIMED'], 'TXT_BLOCK_SHOW_ALWAYS' => $_ARRAYLANG['TXT_BLOCK_SHOW_ALWAYS'], 'TXT_BLOCK_LANG_SHOW' => $_ARRAYLANG['TXT_BLOCK_SHOW_BLOCK_IN_THIS_LANGUAGE'], 'TXT_BLOCK_BASIC_DATA' => $_ARRAYLANG['TXT_BLOCK_BASIC_DATA'], 'TXT_BLOCK_ADDITIONAL_OPTIONS' => $_ARRAYLANG['TXT_BLOCK_ADDITIONAL_OPTIONS'], 'TXT_BLOCK_SELECTED_PAGES' => $_ARRAYLANG['TXT_BLOCK_SELECTED_PAGES'], 'TXT_BLOCK_AVAILABLE_PAGES' => $_ARRAYLANG['TXT_BLOCK_AVAILABLE_PAGES'], 'TXT_BLOCK_SELECT_ALL' => $_ARRAYLANG['TXT_BLOCK_SELECT_ALL'], 'TXT_BLOCK_UNSELECT_ALL' => $_ARRAYLANG['TXT_BLOCK_UNSELECT_ALL'], 'TXT_BLOCK_GLOBAL_PLACEHOLDERS' => $_ARRAYLANG['TXT_BLOCK_GLOBAL_PLACEHOLDERS'], 'TXT_BLOCK_GLOBAL_PLACEHOLDERS_INFO' => $_ARRAYLANG['TXT_BLOCK_GLOBAL_PLACEHOLDERS_INFO'], 'TXT_BLOCK_DIRECT_PLACEHOLDERS' => $_ARRAYLANG['TXT_BLOCK_DIRECT_PLACEHOLDERS'], 'TXT_BLOCK_DIRECT_PLACEHOLDERS_INFO' => $_ARRAYLANG['TXT_BLOCK_DIRECT_PLACEHOLDERS_INFO'], 'TXT_BLOCK_CATEGORY_PLACEHOLDERS' => $_ARRAYLANG['TXT_BLOCK_CATEGORY_PLACEHOLDERS'], 'TXT_BLOCK_CATEGORY_PLACEHOLDERS_INFO' => $_ARRAYLANG['TXT_BLOCK_CATEGORY_PLACEHOLDERS_INFO'], 'TXT_BLOCK_DISPLAY_TIME' => $_ARRAYLANG['TXT_BLOCK_DISPLAY_TIME'], 'TXT_BLOCK_FORM_DESC' => $_ARRAYLANG['TXT_BLOCK_CONTENT'], 'TXT_BLOCK_USE_WYSIWYG_EDITOR' => $_ARRAYLANG['TXT_BLOCK_USE_WYSIWYG_EDITOR'], 'TXT_BLOCK_TARGETING' => $_ARRAYLANG['TXT_BLOCK_TARGETING'], 'TXT_BLOCK_TARGETING_SHOW_PANE' => $_ARRAYLANG['TXT_BLOCK_TARGETING_SHOW_PANE'], 'TXT_BLOCK_TARGETING_ALL_USERS' => $_ARRAYLANG['TXT_BLOCK_TARGETING_ALL_USERS'], 'TXT_BLOCK_TARGETING_VISITOR_CONDITION_BELOW' => $_ARRAYLANG['TXT_BLOCK_TARGETING_VISITOR_CONDITION_BELOW'], 'TXT_BLOCK_TARGETING_INCLUDE' => $_ARRAYLANG['TXT_BLOCK_TARGETING_INCLUDE'], 'TXT_BLOCK_TARGETING_EXCLUDE' => $_ARRAYLANG['TXT_BLOCK_TARGETING_EXCLUDE'], 'TXT_BLOCK_TARGETING_TYPE_LOCATION' => $_ARRAYLANG['TXT_BLOCK_TARGETING_TYPE_LOCATION'], 'TXT_BLOCK_TARGETING_GEOIP_DISABLED_WARNING' => $_ARRAYLANG['TXT_BLOCK_TARGETING_GEOIP_DISABLED_WARNING']));
     $targetingStatus = isset($_POST['targeting_status']) ? contrexx_input2int($_POST['targeting_status']) : 0;
     $targeting = array();
     foreach ($this->availableTargeting as $targetingType) {
         $targetingArr = isset($_POST['targeting'][$targetingType]) ? $_POST['targeting'][$targetingType] : array();
         if (empty($targetingArr)) {
             continue;
         }
         $targeting[$targetingType] = array('filter' => !empty($targetingArr['filter']) && in_array($targetingArr['filter'], array('include', 'exclude')) ? contrexx_input2raw($targetingArr['filter']) : 'include', 'value' => isset($targetingArr['value']) ? contrexx_input2raw($targetingArr['value']) : array());
     }
     if (isset($_POST['block_save_block'])) {
         $blockCat = !empty($_POST['blockCat']) ? intval($_POST['blockCat']) : 0;
         $blockContent = isset($_POST['blockFormText_']) ? array_map('contrexx_input2raw', $_POST['blockFormText_']) : array();
         $blockName = !empty($_POST['blockName']) ? contrexx_input2raw($_POST['blockName']) : $_ARRAYLANG['TXT_BLOCK_NO_NAME'];
         $blockStart = strtotime($_POST['inputStartDate']);
         $blockEnd = strtotime($_POST['inputEndDate']);
         $blockRandom = !empty($_POST['blockRandom']) ? intval($_POST['blockRandom']) : 0;
         $blockRandom2 = !empty($_POST['blockRandom2']) ? intval($_POST['blockRandom2']) : 0;
         $blockRandom3 = !empty($_POST['blockRandom3']) ? intval($_POST['blockRandom3']) : 0;
         $blockRandom4 = !empty($_POST['blockRandom4']) ? intval($_POST['blockRandom4']) : 0;
         $blockWysiwygEditor = isset($_POST['wysiwyg_editor']) ? 1 : 0;
         $blockLangActive = isset($_POST['blockFormLanguages']) ? array_map('intval', $_POST['blockFormLanguages']) : array();
         // placeholder configurations
         // global block
         // 0 = not activated , 1 = on all pages , 2 = selected pages
         $blockGlobal = !empty($_POST['blockGlobal']) ? intval($_POST['blockGlobal']) : 0;
         // direct block and category block placeholders
         // 0 = on all pages , 1 = selected pages
         $blockDirect = !empty($_POST['blockDirect']) ? intval($_POST['blockDirect']) : 0;
         $blockCategory = !empty($_POST['blockCategory']) ? intval($_POST['blockCategory']) : 0;
         // block on page relations for each placeholder
         $blockGlobalAssociatedPageIds = isset($_POST['globalSelectedPagesList']) ? array_map('intval', explode(",", $_POST['globalSelectedPagesList'])) : array();
         $blockDirectAssociatedPageIds = isset($_POST['directSelectedPagesList']) ? array_map('intval', explode(",", $_POST['directSelectedPagesList'])) : array();
         $blockCategoryAssociatedPageIds = isset($_POST['categorySelectedPagesList']) ? array_map('intval', explode(",", $_POST['categorySelectedPagesList'])) : array();
         if ($blockId) {
             if ($this->_updateBlock($blockId, $blockCat, $blockContent, $blockName, $blockStart, $blockEnd, $blockRandom, $blockRandom2, $blockRandom3, $blockRandom4, $blockWysiwygEditor, $blockLangActive)) {
                 if ($this->storePlaceholderSettings($blockId, $blockGlobal, $blockDirect, $blockCategory, $blockGlobalAssociatedPageIds, $blockDirectAssociatedPageIds, $blockCategoryAssociatedPageIds)) {
                     $this->storeTargetingSettings($blockId, $targetingStatus, $targeting);
                     \Cx\Core\Csrf\Controller\Csrf::header('location: index.php?cmd=Block&modified=true&blockname=' . $blockName);
                     exit;
                 }
             }
             $this->_strErrMessage = $_ARRAYLANG['TXT_BLOCK_BLOCK_COULD_NOT_BE_UPDATED'];
         } else {
             if ($blockId = $this->_addBlock($blockCat, $blockContent, $blockName, $blockStart, $blockEnd, $blockRandom, $blockRandom2, $blockRandom3, $blockRandom4, $blockWysiwygEditor, $blockLangActive)) {
                 if ($this->storePlaceholderSettings($blockId, $blockGlobal, $blockDirect, $blockCategory, $blockGlobalAssociatedPageIds, $blockDirectAssociatedPageIds, $blockCategoryAssociatedPageIds)) {
                     $this->storeTargetingSettings($blockId, $targetingStatus, $targeting);
                     \Cx\Core\Csrf\Controller\Csrf::header('location: index.php?cmd=Block&added=true&blockname=' . $blockName);
                     exit;
                 }
             }
             $this->_strErrMessage = $_ARRAYLANG['TXT_BLOCK_BLOCK_COULD_NOT_BE_ADDED'];
         }
     } elseif (($arrBlock = $this->_getBlock($blockId)) !== false) {
         $blockStart = $arrBlock['start'];
         $blockEnd = $arrBlock['end'];
         $blockCat = $arrBlock['cat'];
         $blockRandom = $arrBlock['random'];
         $blockRandom2 = $arrBlock['random2'];
         $blockRandom3 = $arrBlock['random3'];
         $blockRandom4 = $arrBlock['random4'];
         $blockWysiwygEditor = $arrBlock['wysiwyg_editor'];
         $blockContent = $arrBlock['content'];
         $blockLangActive = $arrBlock['lang_active'];
         $blockName = $arrBlock['name'];
         $blockGlobal = $arrBlock['global'];
         $blockDirect = $arrBlock['direct'];
         $blockCategory = $arrBlock['category'];
         $blockGlobalAssociatedPageIds = $this->_getAssociatedPageIds($blockId, 'global');
         $blockDirectAssociatedPageIds = $this->_getAssociatedPageIds($blockId, 'direct');
         $blockCategoryAssociatedPageIds = $this->_getAssociatedPageIds($blockId, 'category');
         $targeting = $this->loadTargetingSettings($blockId);
         if (!empty($targeting)) {
             $targetingStatus = 1;
         }
     }
     $pageTitle = $blockId != 0 ? sprintf($copy ? $_ARRAYLANG['TXT_BLOCK_COPY_BLOCK'] : $_ARRAYLANG['TXT_BLOCK_MODIFY_BLOCK'], contrexx_raw2xhtml($blockName)) : $_ARRAYLANG['TXT_BLOCK_ADD_BLOCK'];
     $this->_pageTitle = $pageTitle;
     if ($copy) {
         $blockId = 0;
     }
     $this->_objTpl->setVariable(array('BLOCK_ID' => $blockId, 'BLOCK_MODIFY_TITLE' => $pageTitle, 'BLOCK_NAME' => contrexx_raw2xhtml($blockName), 'BLOCK_CATEGORIES_PARENT_DROPDOWN' => $this->_getCategoriesDropdown($blockCat), 'BLOCK_START' => !empty($blockStart) ? strftime('%Y-%m-%d %H:%M', $blockStart) : $blockStart, 'BLOCK_END' => !empty($blockEnd) ? strftime('%Y-%m-%d %H:%M', $blockEnd) : $blockEnd, 'BLOCK_WYSIWYG_EDITOR' => $blockWysiwygEditor == 1 ? 'checked="checked"' : '', 'BLOCK_RANDOM' => $blockRandom == '1' ? 'checked="checked"' : '', 'BLOCK_RANDOM_2' => $blockRandom2 == '1' ? 'checked="checked"' : '', 'BLOCK_RANDOM_3' => $blockRandom3 == '1' ? 'checked="checked"' : '', 'BLOCK_RANDOM_4' => $blockRandom4 == '1' ? 'checked="checked"' : '', 'BLOCK_GLOBAL_0' => $blockGlobal == '0' ? 'checked="checked"' : '', 'BLOCK_GLOBAL_1' => $blockGlobal == '1' ? 'checked="checked"' : '', 'BLOCK_GLOBAL_2' => $blockGlobal == '2' ? 'checked="checked"' : '', 'BLOCK_GLOBAL_SHOW_PAGE_SELECTOR' => $blockGlobal == '2' ? 'block' : 'none', 'BLOCK_DIRECT_0' => $blockDirect == '0' ? 'checked="checked"' : '', 'BLOCK_DIRECT_1' => $blockDirect == '1' ? 'checked="checked"' : '', 'BLOCK_DIRECT_SHOW_PAGE_SELECTOR' => $blockDirect == '1' ? 'block' : 'none', 'BLOCK_CATEGORY_0' => $blockCategory == '0' ? 'checked="checked"' : '', 'BLOCK_CATEGORY_1' => $blockCategory == '1' ? 'checked="checked"' : '', 'BLOCK_CATEGORY_SHOW_PAGE_SELECTOR' => $blockCategory == '1' ? 'block' : 'none', 'BLOCK_WYSIWYG_MEDIABROWSER' => $mediaBrowserCkeditor->getXHtml(), 'BLOCK_TARGETING_ALL_USERS' => $targetingStatus == 0 ? 'checked="checked"' : '', 'BLOCK_TARGETING_VISITOR_CONDITION_BELOW' => $targetingStatus == 1 ? 'checked="checked"' : '', 'BLOCK_TARGETING_COUNTRY_INCLUDE' => !empty($targeting['country']) && $targeting['country']['filter'] == 'include' ? 'selected="selected"' : '', 'BLOCK_TARGETING_COUNTRY_EXCLUDE' => !empty($targeting['country']) && $targeting['country']['filter'] == 'exclude' ? 'selected="selected"' : ''));
     if (!empty($targeting['country']) && !empty($targeting['country']['value'])) {
         foreach ($targeting['country']['value'] as $countryId) {
             $countryName = \Cx\Core\Country\Controller\Country::getNameById($countryId);
             if (empty($countryName)) {
                 continue;
             }
             $this->_objTpl->setVariable(array('BLOCK_TARGET_COUNTRY_ID' => contrexx_raw2xhtml($countryId), 'BLOCK_TARGET_COUNTRY_NAME' => contrexx_raw2xhtml($countryName)));
             $this->_objTpl->parse('block_targeting_country');
         }
     }
     $jsonData = new \Cx\Core\Json\JsonData();
     $pageTitlesTree = $jsonData->data('node', 'getPageTitlesTree');
     $pageTitlesTree = $pageTitlesTree['data'];
     $objJs = \ContrexxJavascript::getInstance();
     $blockGlobalPageSelects = $this->getPageSelections($pageTitlesTree, $blockGlobalAssociatedPageIds);
     $blockDirectPageSelects = $this->getPageSelections($pageTitlesTree, $blockDirectAssociatedPageIds);
     $blockCategoryPageSelects = $this->getPageSelections($pageTitlesTree, $blockCategoryAssociatedPageIds);
     $objJs->setVariable('globalPagesUnselectedOptions', $jsonData->json($blockGlobalPageSelects[1]), 'block');
     $objJs->setVariable('globalPagesSelectedOptions', $jsonData->json($blockGlobalPageSelects[0]), 'block');
     $objJs->setVariable('directPagesUnselectedOptions', $jsonData->json($blockDirectPageSelects[1]), 'block');
     $objJs->setVariable('directPagesSelectedOptions', $jsonData->json($blockDirectPageSelects[0]), 'block');
     $objJs->setVariable('categoryPagesUnselectedOptions', $jsonData->json($blockCategoryPageSelects[1]), 'block');
     $objJs->setVariable('categoryPagesSelectedOptions', $jsonData->json($blockCategoryPageSelects[0]), 'block');
     $objJs->setVariable('ckeditorconfigpath', substr(\Env::get('ClassLoader')->getFilePath(ASCMS_CORE_PATH . '/Wysiwyg/ckeditor.config.js.php'), strlen(ASCMS_DOCUMENT_ROOT) + 1), 'block');
     $arrActiveSystemFrontendLanguages = \FWLanguage::getActiveFrontendLanguages();
     $this->parseLanguageOptionsByPlaceholder($arrActiveSystemFrontendLanguages, 'global');
     $this->parseLanguageOptionsByPlaceholder($arrActiveSystemFrontendLanguages, 'direct');
     $this->parseLanguageOptionsByPlaceholder($arrActiveSystemFrontendLanguages, 'category');
     if (count($arrActiveSystemFrontendLanguages) > 0) {
         $intLanguageCounter = 0;
         $arrLanguages = array(0 => '', 1 => '', 2 => '');
         $strJsTabToDiv = '';
         foreach ($arrActiveSystemFrontendLanguages as $langId => $arrLanguage) {
             $boolLanguageIsActive = $blockId == 0 && $intLanguageCounter == 0 ? true : (isset($blockLangActive[$langId]) && $blockLangActive[$langId] == 1 ? true : false);
             $arrLanguages[$intLanguageCounter % 3] .= '<input id="languagebar_' . $langId . '" ' . ($boolLanguageIsActive ? 'checked="checked"' : '') . ' type="checkbox" name="blockFormLanguages[' . $langId . ']" value="1" onclick="switchBoxAndTab(this, \'lang_blockContent_' . $langId . '\');" /><label for="languagebar_' . $langId . '">' . contrexx_raw2xhtml($arrLanguage['name']) . ' [' . $arrLanguage['lang'] . ']</label><br />';
             $strJsTabToDiv .= 'arrTabToDiv["lang_blockContent_' . $langId . '"] = "langTab_' . $langId . '";' . "\n";
             ++$intLanguageCounter;
         }
         $this->_objTpl->setVariable(array('TXT_BLOCK_LANGUAGE' => $_ARRAYLANG['TXT_BLOCK_LANGUAGE'], 'EDIT_LANGUAGES_1' => $arrLanguages[0], 'EDIT_LANGUAGES_2' => $arrLanguages[1], 'EDIT_LANGUAGES_3' => $arrLanguages[2], 'EDIT_JS_TAB_TO_DIV' => $strJsTabToDiv));
     }
     $arrLanguages = \FWLanguage::getLanguageArray();
     $i = 0;
     $activeFlag = 0;
     foreach ($arrLanguages as $langId => $arrLanguage) {
         if ($arrLanguage['frontend'] != 1) {
             continue;
         }
         $tmpBlockContent = isset($blockContent[$langId]) ? $blockContent[$langId] : '';
         $tmpBlockLangActive = isset($blockLangActive[$langId]) ? $blockLangActive[$langId] : 0;
         $tmpBlockContent = preg_replace('/\\{([A-Z0-9_-]+)\\}/', '[[\\1]]', $tmpBlockContent);
         if ($blockId != 0) {
             if (!$activeFlag && isset($blockLangActive[$langId])) {
                 $activeClass = 'active';
                 $activeFlag = 1;
             }
         } elseif (!$activeFlag) {
             $activeClass = 'active';
             $activeFlag = 1;
         }
         $this->_objTpl->setVariable(array('BLOCK_LANG_TAB_LANG_ID' => intval($langId), 'BLOCK_LANG_TAB_CLASS' => isset($activeClass) ? $activeClass : '', 'TXT_BLOCK_LANG_TAB_LANG_NAME' => contrexx_raw2xhtml($arrLanguage['name']), 'BLOCK_LANGTAB_DISPLAY' => $tmpBlockLangActive == 1 ? 'display:inline;' : ($blockId == 0 && $i == 0 ? 'display:inline;' : 'display:none;')));
         $this->_objTpl->parse('block_language_tabs');
         $this->_objTpl->setVariable(array('BLOCK_LANG_ID' => intval($langId), 'BLOCK_CONTENT_TEXT_HIDDEN' => contrexx_raw2xhtml($tmpBlockContent)));
         $this->_objTpl->parse('block_language_content');
         $activeClass = '';
         $i++;
     }
     if (!$this->getGeoIpComponent() || !$this->getGeoIpComponent()->getGeoIpServiceStatus()) {
         $this->_objTpl->touchBlock('warning_geoip_disabled');
     } else {
         $this->_objTpl->hideBlock('warning_geoip_disabled');
     }
 }
 /**
  * @param Sigma $template
  */
 public function preFinalize(Sigma $template)
 {
     if (count($this->mediaBrowserInstances) == 0) {
         return;
     } else {
         global $_ARRAYLANG;
         /**
          * @var $init \InitCMS
          */
         $init = \Env::get('init');
         $init->loadLanguageData('MediaBrowser');
         foreach ($_ARRAYLANG as $key => $value) {
             if (preg_match("/TXT_FILEBROWSER_[A-Za-z0-9]+/", $key)) {
                 \ContrexxJavascript::getInstance()->setVariable($key, $value, 'mediabrowser');
             }
         }
         $thumbnailsTemplate = new Sigma();
         $thumbnailsTemplate->loadTemplateFile($this->cx->getCoreModuleFolderName() . '/MediaBrowser/View/Template/Thumbnails.html');
         $thumbnailsTemplate->setVariable('TXT_FILEBROWSER_THUMBNAIL_ORIGINAL_SIZE', sprintf($_ARRAYLANG['TXT_FILEBROWSER_THUMBNAIL_ORIGINAL_SIZE']));
         foreach (UploaderConfiguration::getInstance()->getThumbnails() as $thumbnail) {
             $thumbnailsTemplate->setVariable(array('THUMBNAIL_NAME' => sprintf($_ARRAYLANG['TXT_FILEBROWSER_THUMBNAIL_' . strtoupper($thumbnail['name']) . '_SIZE'], $thumbnail['size']), 'THUMBNAIL_ID' => $thumbnail['id'], 'THUMBNAIL_SIZE' => $thumbnail['size']));
             $thumbnailsTemplate->parse('thumbnails');
         }
         \ContrexxJavascript::getInstance()->setVariable('thumbnails_template', $thumbnailsTemplate->get(), 'mediabrowser');
         \JS::activate('mediabrowser');
         \JS::registerJS('core_modules/MediaBrowser/View/Script/mediabrowser.js');
     }
 }
 /**
  * Do GeoIp processing after content is loaded from DB
  *
  * @param \Cx\Core\ContentManager\Model\Entity\Page $page the resolved page
  */
 public function postContentLoad(\Cx\Core\ContentManager\Model\Entity\Page $page)
 {
     //skip the process incase mode is not frontend or GeoIp is deactivated or client record not found
     if (!$this->isGeoIpEnabled() || !$this->getClientRecord()) {
         return;
     }
     $cache = $this->getComponent('Cache');
     // TODO: ESI variable should be registered in another way
     $countryCodeEsi = '$(GEO{\'country_code\'})';
     $countryNameEsi = $cache->getEsiContent($this->getName(), 'getCountryName', array('country' => '$(GEO{\'country_code\'})'));
     //Parse the country name and code
     $objTemplate = $this->cx->getTemplate();
     $objTemplate->setVariable(array('GEOIP_COUNTRY_NAME' => $countryNameEsi, 'GEOIP_COUNTRY_CODE' => $countryCodeEsi));
     //Set the country name and code as cx.variables
     $objJS = \ContrexxJavascript::getInstance();
     $objJS->setVariable(array('countryName' => trim($cache->internalEsiParsing($countryNameEsi)), 'countryCode' => trim($cache->internalEsiParsing($countryCodeEsi))), 'geoIp');
 }
Пример #25
0
 /**
  * Set the language list page
  *
  * @global    array
  * @global    ADONewConnection
  * @global    \Cx\Core\Html\Sigma
  * @return    void
  */
 function languageOverview()
 {
     global $_ARRAYLANG, $objDatabase;
     // init vars
     $i = 0;
     \JS::activate('cx');
     $cxjs = \ContrexxJavascript::getInstance();
     $cxjs->setVariable('copyTitle', $_ARRAYLANG['TXT_LANGUAGE_COPY_TITLE'], 'language/lang');
     $cxjs->setVariable('copyText', $_ARRAYLANG['TXT_LANGUAGE_COPY_TEXT'], 'language/lang');
     $cxjs->setVariable('copySuccess', $_ARRAYLANG['TXT_LANGUAGE_COPY_SUCCESS'], 'language/lang');
     $cxjs->setVariable('linkTitle', $_ARRAYLANG['TXT_LANGUAGE_LINK_TITLE'], 'language/lang');
     $cxjs->setVariable('linkText', $_ARRAYLANG['TXT_LANGUAGE_LINK_TEXT'], 'language/lang');
     $cxjs->setVariable('linkSuccess', $_ARRAYLANG['TXT_LANGUAGE_LINK_SUCCESS'], 'language/lang');
     $cxjs->setVariable('warningTitle', $_ARRAYLANG['TXT_LANGUAGE_WARNING_TITLE'], 'language/lang');
     $cxjs->setVariable('warningText', $_ARRAYLANG['TXT_LANGUAGE_WARNING_TEXT'], 'language/lang');
     $cxjs->setVariable('waitTitle', $_ARRAYLANG['TXT_LANGUAGE_WAIT_TITLE'], 'language/lang');
     $cxjs->setVariable('waitText', $_ARRAYLANG['TXT_LANGUAGE_WAIT_TEXT'], 'language/lang');
     $cxjs->setVariable('yesOption', $_ARRAYLANG['TXT_YES'], 'language/lang');
     $cxjs->setVariable('noOption', $_ARRAYLANG['TXT_NO'], 'language/lang');
     $cxjs->setVariable('langRemovalLabel', $_ARRAYLANG['TXT_LANGUAGE_MANAGER_LABEL_LANG_REMOVAL'], 'language/lang');
     $cxjs->setVariable('langRemovalContent', $_ARRAYLANG['TXT_LANGUAGE_MANAGER_LANG_REMOVAL_CONTENT'], 'language/lang');
     $this->template->loadTemplateFile('language_langlist.html');
     $this->pageTitle = $_ARRAYLANG['TXT_LANGUAGE_LIST'];
     if (!$this->isInFullMode()) {
         $this->hideVariables = true;
         $this->template->hideBlock('extendedTitles');
         $this->template->hideBlock('extendedHeaders');
     } else {
         $this->template->touchBlock('extendedTitles');
     }
     //begin language variables
     $this->template->setVariable(array('TXT_ADD_NEW_LANGUAGE' => $_ARRAYLANG['TXT_ADD_NEW_LANGUAGE'], 'TXT_NAME' => $_ARRAYLANG['TXT_NAME'], 'TXT_SHORT_NAME' => $_ARRAYLANG['TXT_SHORT_NAME'], 'TXT_CHARSET' => $_ARRAYLANG['TXT_CHARSET'], 'TXT_ADD' => $_ARRAYLANG['TXT_ADD'], 'TXT_LANGUAGE_LIST' => $_ARRAYLANG['TXT_LANGUAGE_LIST'], 'TXT_ID' => $_ARRAYLANG['TXT_ID'], 'TXT_SHORT_FORM' => $_ARRAYLANG['TXT_SHORT_FORM'], 'TXT_STANDARD_LANGUAGE' => $_ARRAYLANG['TXT_STANDARD_LANGUAGE'], 'TXT_ACTION' => $_ARRAYLANG['TXT_ACTION'], 'TXT_ACCEPT_CHANGES' => $_ARRAYLANG['TXT_ACCEPT_CHANGES'], 'TXT_REMARK' => $_ARRAYLANG['TXT_REMARK'], 'TXT_ADD_DELETE_LANGUAGE_REMARK' => $_ARRAYLANG['TXT_ADD_DELETE_LANGUAGE_REMARK'], 'TXT_CONFIRM_DELETE_DATA' => $_ARRAYLANG['TXT_CONFIRM_DELETE_DATA'], 'TXT_ACTION_IS_IRREVERSIBLE' => $_ARRAYLANG['TXT_ACTION_IS_IRREVERSIBLE'], 'TXT_VALUE' => $_ARRAYLANG['TXT_VALUE'], 'TXT_MODULE' => $_ARRAYLANG['TXT_MODULE'], 'TXT_LANGUAGE' => $_ARRAYLANG['TXT_LANGUAGE'], 'TXT_STATUS' => $_ARRAYLANG['TXT_STATUS'], 'TXT_VIEW' => $_ARRAYLANG['TXT_VIEW'], 'TXT_CONTROLLED' => $_ARRAYLANG['TXT_CONTROLLED'], 'TXT_OPEN_ISSUE' => $_ARRAYLANG['TXT_OPEN_ISSUE'], 'TXT_SHORT_NAME' => $_ARRAYLANG['TXT_SHORT_NAME'], 'TXT_LANGUAGE_DEPENDANT_SYSTEM_VARIABLES' => $_ARRAYLANG['TXT_LANGUAGE_DEPENDANT_SYSTEM_VARIABLES'], 'TXT_ADMINISTRATION_PAGES' => $_ARRAYLANG['TXT_ADMINISTRATION_PAGES'], 'TXT_WEB_PAGES' => $_ARRAYLANG['TXT_WEB_PAGES'], 'TXT_SECTION' => $_ARRAYLANG['TXT_SECTION'], 'TXT_CORE_FALLBACK' => $_ARRAYLANG['TXT_CORE_FALLBACK'], 'TXT_LANGUAGE_MANAGER_OK' => $_ARRAYLANG['TXT_LANGUAGE_MANAGER_OK']));
     $this->template->setGlobalVariable(array('TXT_DEFAULT_LANGUAGE' => $_ARRAYLANG['TXT_STANDARD_LANGUAGE'], 'TXT_CORE_NONE' => $_ARRAYLANG['TXT_CORE_NONE'], 'CMD' => contrexx_input2xhtml($_GET['cmd']), 'TXT_LANGUAGE_ACTION_COPY' => $_ARRAYLANG['TXT_LANGUAGE_ACTION_COPY'], 'TXT_LANGUAGE_ACTION_LINK' => $_ARRAYLANG['TXT_LANGUAGE_ACTION_LINK']));
     //end language variables
     if ($this->hideVariables == true) {
         $this->template->setGlobalVariable(array('LANGUAGE_ADMIN_STYLE' => 'display: none'));
     } else {
         $this->template->setGlobalVariable(array('LANGUAGE_ADMIN_STYLE' => 'display: block'));
     }
     $arrLanguages = \FWLanguage::getActiveFrontendLanguages();
     $this->template->setVariable('LANGUAGE_MANAGER_ACTIVE_LANGIDS', implode(', ', array_keys($arrLanguages)));
     $objResult = $objDatabase->Execute("SELECT * FROM " . DBPREFIX . "languages ORDER BY id");
     if ($objResult !== false) {
         while (!$objResult->EOF) {
             $checked = "";
             if ($objResult->fields['is_default'] == "true") {
                 $checked = "checked";
             }
             $status = "<input type='radio' name='langDefaultStatus' onchange='updateCurrent();' value='" . $objResult->fields['id'] . "' {$checked} />";
             $checked = "";
             if ($objResult->fields['frontend'] == 1) {
                 $checked = "checked";
             }
             $activeStatus = "<input type='checkbox' name='langActiveStatus[" . $objResult->fields['id'] . "]' onchange='updateCurrent();' value='1' {$checked} />";
             $checked = "";
             if ($objResult->fields['backend'] == 1) {
                 $checked = "checked";
             }
             $selectedLang = '';
             switch ($objResult->fields['fallback']) {
                 case '':
                     $this->template->setVariable('NONE_SELECTED', 'selected="selected"');
                     break;
                 case '0':
                     $this->template->setVariable('LANGUAGE_DEFAULT_SELECTED', 'selected="selected"');
                     break;
                 default:
                     $selectedLang = $objResult->fields['fallback'];
             }
             // set fallback language drop down
             foreach ($arrLanguages as $langId => $arrLanguage) {
                 $selected = $langId == $selectedLang ? 'selected="selected"' : '';
                 $this->template->setVariable(array('LANGUAGE_LANG_ID' => $langId, 'LANGUAGE_LANG_OPTION' => contrexx_raw2xhtml($arrLanguage['name']), 'LANGUAGE_OPTION_SELECTED' => $selected));
                 $this->template->parse('fallbackLanguages');
             }
             $adminStatus = "<input type='checkbox' name='langAdminStatus[" . $objResult->fields['id'] . "]' value='1' {$checked} />";
             $this->template->setVariable(array('LANGUAGE_ROWCLASS' => 'row' . ($i++ % 2 + 1), 'LANGUAGE_LANG_ID' => $objResult->fields['id'], 'LANGUAGE_LANG_NAME' => $objResult->fields['name'], 'LANGUAGE_LANG_SHORTNAME' => $objResult->fields['lang'], 'LANGUAGE_LANG_CHARSET' => $objResult->fields['charset'], 'LANGUAGE_LANG_STATUS' => $status, 'LANGUAGE_ACTIVE_STATUS' => $activeStatus, 'LANGUAGE_ADMIN_STATUS' => $adminStatus));
             if (!$this->isInFullMode()) {
                 $this->template->hideBlock('extendedOptions');
             }
             $this->template->parse('languageRow');
             $objResult->MoveNext();
         }
     }
 }
Пример #26
0
 /**
  * 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');
                 // parse teaser text
                 $teaserText = isset($_POST['newsTeaserText'][$langId]) ? contrexx_input2raw($_POST['newsTeaserText'][$langId]) : null;
                 if (!isset($teaserText)) {
                     $teaserText = isset($langData[$langId]['teaser_text']) ? $langData[$langId]['teaser_text'] : '';
                 }
                 $this->_objTpl->setVariable(array('NEWS_LANG_ID' => $langId, 'NEWS_TEASER_TEXT' => contrexx_raw2xhtml($teaserText), 'NEWS_TEASER_TEXT_LENGTH' => !empty($teaserText) ? strlen($teaserText) : 0, 'NEWS_TITLE_DISPLAY' => $display ? 'block' : 'none'));
                 $this->_objTpl->parse('news_teaser_text_list');
                 // parse text
                 $text = isset($_POST['news_text'][$langId]) ? $_POST['news_text'][$langId] : null;
                 if (!isset($text)) {
                     $text = isset($langData[$langId]['text']) ? $langData[$langId]['text'] : '';
                 }
                 $this->_objTpl->setVariable(array('NEWS_LANG_ID' => $langId, 'NEWS_TEXT' => contrexx_raw2xhtml($text)));
                 $this->_objTpl->parse('news_text_list');
                 if ($display) {
                     $selectedLangId = $langId;
                     $newsText = contrexx_raw2xhtml($text);
                     $first = false;
                 }
             }
         }
         if ($intLanguageCounter == 1) {
             $this->_objTpl->setVariable('NEWS_LANG_TAB_DISPLAY_STYLE', 'none');
             $this->_objTpl->hideBlock('news_language_checkboxes');
         }
         $this->_objTpl->setVariable('NEWS_DEFAULT_LANG', contrexx_raw2xhtml(\FWLanguage::getLanguageParameter($selectedLangId, 'name')));
         if ($this->arrSettings['news_use_teaser_text'] != 1) {
             $this->_objTpl->hideBlock('news_use_teaser_text');
         }
         $teaserShowLink = $objResult->fields['teaser_show_link'];
         if ($objResult->fields['status'] == 1) {
             $status = 'checked="checked"';
         }
         $startDate = $objResult->fields['startdate'] !== '0000-00-00 00:00:00' ? strtotime($objResult->fields['startdate']) : 0;
         $endDate = $objResult->fields['enddate'] !== '0000-00-00 00:00:00' ? strtotime($objResult->fields['enddate']) : 0;
         if (!empty($startDate) || !empty($endDate)) {
             $this->_objTpl->setVariable(array('NEWS_SCHEDULED' => 'checked="checked"', 'NEWS_SCHEDULED_DISPLAY' => 'display: block;'));
         } else {
             $this->_objTpl->setVariable('NEWS_SCHEDULED_DISPLAY', 'display: none;');
         }
         if (empty($objResult->fields['redirect'])) {
             $this->_objTpl->setVariable(array('NEWS_TYPE_SELECTION_CONTENT' => 'style="display: block;"', 'NEWS_TYPE_SELECTION_REDIRECT' => 'style="display: none;"', 'NEWS_TYPE_CHECKED_CONTENT' => 'checked="checked"', 'NEWS_TYPE_CHECKED_REDIRECT' => ''));
         } else {
             $this->_objTpl->setVariable(array('NEWS_TYPE_SELECTION_CONTENT' => 'style="display: none;"', 'NEWS_TYPE_SELECTION_REDIRECT' => 'style="display: block;"', 'NEWS_TYPE_CHECKED_CONTENT' => '', 'NEWS_TYPE_CHECKED_REDIRECT' => 'checked="checked"'));
         }
         $objTeaser = new \Cx\Core_Modules\News\Controller\Teasers(true);
         $frameIds = '';
         $associatedFrameIds = '';
         $arrAssociatedFrameIds = explode(';', $objTeaser->arrTeasers[$newsid]['teaser_frames']);
         foreach ($arrAssociatedFrameIds as $teaserFrameId) {
             if (empty($teaserFrameId)) {
                 continue;
             }
             $associatedFrameIds .= "<option value=\"" . $teaserFrameId . "\">" . $objTeaser->arrTeaserFrames[$teaserFrameId]['name'] . "</option>\n";
         }
         foreach ($objTeaser->arrTeaserFrameNames as $frameName => $frameId) {
             if (!in_array($frameId, $arrAssociatedFrameIds)) {
                 $frameIds .= "<option value=\"" . $frameId . "\">" . $frameName . "</option>\n";
             }
         }
         $this->_objTpl->setVariable(array('NEWS_ID' => $copy ? '' : $id, 'NEWS_STORED_ID' => $copy ? '' : $id, 'NEWS_TEXT_PREVIEW' => new \Cx\Core\Wysiwyg\Wysiwyg('newsText', $newsText, 'full'), 'NEWS_REDIRECT' => contrexx_raw2xhtml($objResult->fields['redirect']), 'NEWS_SOURCE' => contrexx_raw2xhtml($objResult->fields['source']), 'NEWS_URL1' => contrexx_raw2xhtml($objResult->fields['url1']), 'NEWS_URL2' => contrexx_raw2xhtml($objResult->fields['url2']), 'NEWS_PUBLISHER_NAME' => contrexx_raw2xhtml($newsPublisherName), 'NEWS_PUBLISHER_ID' => contrexx_raw2xhtml($newsPublisherId), 'NEWS_AUTHOR_NAME' => contrexx_raw2xhtml($newsAuthorName), 'NEWS_AUTHOR_ID' => contrexx_raw2xhtml($newsAuthorId), 'NEWS_CREATE_DATE' => $this->valueFromDate($objResult->fields['date']), 'NEWS_STARTDATE' => $this->valueFromDate($startDate), 'NEWS_ENDDATE' => $this->valueFromDate($endDate), 'NEWS_STATUS' => isset($_GET['validate']) ? 'checked="checked"' : $status, 'NEWS_TEASER_SHOW_LINK_CHECKED' => $teaserShowLink ? 'checked="checked"' : '', 'NEWS_TEASER_IMAGE_PATH' => contrexx_raw2xhtml($objResult->fields['teaser_image_path']), 'NEWS_TEASER_IMAGE_THUMBNAIL_PATH' => contrexx_raw2xhtml($objResult->fields['teaser_image_thumbnail_path']), 'NEWS_DATE' => date('Y-m-d H:i:s'), 'NEWS_SUBMIT_NAME' => isset($_GET['validate']) ? 'validate' : 'store', 'NEWS_SUBMIT_NAME_TEXT' => isset($_GET['validate']) ? $_ARRAYLANG['TXT_CONFIRM'] : $_ARRAYLANG['TXT_STORE'], 'NEWS_MEDIA_BROWSER_BROWSE_BUTTON' => self::getMediaBrowserButton(array('type' => 'button', 'id' => 'newsMediaBrowser', 'style' => 'display:none;'), 'SetUrl'), 'NEWS_RELATED_NEWS_ENABLED_CHECKED' => !empty($objResult->fields['enable_related_news']) ? 'checked="checked"' : '', 'NEWS_TAGS_ENABLED_CHECKED' => !empty($objResult->fields['enable_tags']) ? 'checked="checked"' : ''));
         if ($this->arrSettings['news_message_protection'] == '1') {
             if ($this->arrSettings['news_message_protection_restricted'] == '1') {
                 $userGroupIds = $objFWUser->objUser->getAssociatedGroupIds();
             }
             if ($objResult->fields['frontend_access_id']) {
                 $objFrontendGroups = $objFWUser->objGroup->getGroups(array('dynamic' => $objResult->fields['frontend_access_id']));
                 $arrFrontendGroups = $objFrontendGroups ? $objFrontendGroups->getLoadedGroupIds() : array();
             } else {
                 $arrFrontendGroups = array();
             }
             if ($objResult->fields['backend_access_id']) {
                 $objBackendGroups = $objFWUser->objGroup->getGroups(array('dynamic' => $objResult->fields['backend_access_id']));
                 $arrBackendGroups = $objBackendGroups ? $objBackendGroups->getLoadedGroupIds() : array();
             } else {
                 $arrBackendGroups = array();
             }
             $readAccessGroups = '';
             $readNotAccessGroups = '';
             $modifyAccessGroups = '';
             $modifyNotAccessGroups = '';
             $objGroup = $objFWUser->objGroup->getGroups();
             if ($objGroup) {
                 while (!$objGroup->EOF) {
                     ${$objGroup->getType() == 'frontend' ? in_array($objGroup->getId(), $arrFrontendGroups) ? 'readAccessGroups' : 'readNotAccessGroups' : (in_array($objGroup->getId(), $arrBackendGroups) ? 'modifyAccessGroups' : 'modifyNotAccessGroups')} .= '<option value="' . $objGroup->getId() . '"' . (!\Permission::hasAllAccess() && $this->arrSettings['news_message_protection_restricted'] == '1' && !in_array($objGroup->getId(), $userGroupIds) ? ' disabled="disabled"' : '') . '>' . htmlentities($objGroup->getName(), ENT_QUOTES, CONTREXX_CHARSET) . '</option>';
                     $objGroup->next();
                 }
             }
             $this->_objTpl->setVariable(array('NEWS_READ_ACCESS_NOT_ASSOCIATED_GROUPS' => $readNotAccessGroups, 'NEWS_READ_ACCESS_ASSOCIATED_GROUPS' => $readAccessGroups, 'NEWS_READ_ACCESS_ALL_CHECKED' => $objResult->fields['frontend_access_id'] ? '' : 'checked="checked"', 'NEWS_READ_ACCESS_SELECTED_CHECKED' => $objResult->fields['frontend_access_id'] ? 'checked="checked"' : '', 'NEWS_READ_ACCESS_DISPLAY' => $objResult->fields['frontend_access_id'] ? '' : 'none', 'NEWS_MODIFY_ACCESS_NOT_ASSOCIATED_GROUPS' => $modifyNotAccessGroups, 'NEWS_MODIFY_ACCESS_ASSOCIATED_GROUPS' => $modifyAccessGroups, 'NEWS_MODIFY_ACCESS_ALL_CHECKED' => $objResult->fields['backend_access_id'] ? '' : 'checked="checked"', 'NEWS_MODIFY_ACCESS_SELECTED_CHECKED' => $objResult->fields['backend_access_id'] ? 'checked="checked"' : '', 'NEWS_MODIFY_ACCESS_DISPLAY' => $objResult->fields['backend_access_id'] ? '' : 'none'));
             $this->_objTpl->touchBlock('news_permission_tab');
         } else {
             $this->_objTpl->hideBlock('news_permission_tab');
         }
         //Customized News Module Improvements
         if (!empty($this->arrSettings['news_use_tags'])) {
             $this->registerTagJsCode();
             $newsTagDetails = $this->getNewsTags($id);
             $newsTags = $newsTagDetails['tagList'];
             if ($this->_objTpl->blockExists('newsTags')) {
                 foreach ($newsTags as $newsTag) {
                     $this->_objTpl->setVariable('NEWS_TAGS', $newsTag);
                     $this->_objTpl->parse('newsTags');
                 }
             }
             $this->_objTpl->touchBlock('newsTagsBlock');
         } else {
             $this->_objTpl->hideBlock('newsTagsBlock');
         }
         if (!empty($this->arrSettings['use_related_news'])) {
             $objCx = \ContrexxJavascript::getInstance();
             $objCx->setVariable('noResultsMsg', $_ARRAYLANG['TXT_NEWS_NOT_FOUND'], 'news/news-live-search');
             \JS::registerJS('core_modules/News/View/Script/news-live-search.js');
             \JS::registerCss('core_modules/News/View/Style/news-live-search.css');
             //Parsing the related news tags
             $relatedNewsIds = isset($_POST['relatedNews']) ? contrexx_input2raw($_POST['relatedNews']) : $this->getRelatedNews($id);
             //Getting the related news ids
             $this->parseRelatedNewsTags($this->_objTpl, $relatedNewsIds, LANG_ID);
             $this->_objTpl->touchBlock('relatedNewsBlock');
         } else {
             $this->_objTpl->hideBlock('relatedNewsBlock');
         }
     } else {
         $this->strErrMessage = $_ARRAYLANG['TXT_NEWS_ENTRY_NOT_FOUND'];
         $this->overview();
         return;
     }
     if ($_CONFIG['newsTeasersStatus'] == '1') {
         $this->_objTpl->parse('newsTeaserOptions');
         $this->_objTpl->setVariable(array('TXT_USAGE' => $_ARRAYLANG['TXT_USAGE'], 'TXT_USE_ONLY_TEASER_TEXT' => $_ARRAYLANG['TXT_USE_ONLY_TEASER_TEXT'], 'TXT_TEASER_TEASER_BOXES' => $_ARRAYLANG['TXT_TEASER_TEASER_BOXES'], 'TXT_AVAILABLE_BOXES' => $_ARRAYLANG['TXT_AVAILABLE_BOXES'], 'TXT_SELECT_ALL' => $_ARRAYLANG['TXT_SELECT_ALL'], 'TXT_DESELECT_ALL' => $_ARRAYLANG['TXT_DESELECT_ALL'], 'TXT_ASSOCIATED_BOXES' => $_ARRAYLANG['TXT_ASSOCIATED_BOXES'], 'NEWS_HEADLINES_TEASERS_TXT' => $_ARRAYLANG['TXT_HEADLINES'] . ' / ' . $_ARRAYLANG['TXT_TEASERS'], 'NEWS_USE_ONLY_TEASER_CHECKED' => $objResult->fields['teaser_only'] == '1' ? 'checked="checked"' : '', 'NEWS_TEASER_FRAMES' => $frameIds, 'NEWS_TEASER_ASSOCIATED_FRAMES' => $associatedFrameIds));
     } else {
         $this->_objTpl->hideBlock('newsTeaserOptions');
         $this->_objTpl->setVariable('NEWS_HEADLINES_TEASERS_TXT', $_ARRAYLANG['TXT_HEADLINES']);
     }
     $categoryRelatedToNews = $this->getNewsRelCategories($id);
     $this->_objTpl->setVariable('NEWS_CAT_MENU', $this->getCategoryMenu($this->nestedSetRootId, $categoryRelatedToNews));
     $news_type_menu = '';
     if ($this->arrSettings['news_use_types'] == 1) {
         $news_type_menu = "<tr class=\"row2\">\n<td nowrap=\"nowrap\">{$_ARRAYLANG['TXT_NEWS_TYPE']}</td><td><select name=\"newsType\"><option value=\"0\">{$_ARRAYLANG['TXT_NO_TYPE']}</option>" . $this->getTypeMenu($newsType) . "</select></td></tr>";
     }
     // Activate Comments
     $news_comment = '';
     if ($this->arrSettings['news_comments_activated'] == 1) {
         $commentsChecked = $newsComment == 1 ? 'checked="checked"' : '';
         $this->_objTpl->setVariable(array('TXT_NEWS_ALLOW_COMMENTS' => $_ARRAYLANG['TXT_NEWS_ALLOW_COMMENTS'], 'NEWS_COMMENT_CHECKED' => $commentsChecked));
     } else {
         $this->_objTpl->hideBlock('news_allow_comments_option');
     }
     $this->_objTpl->setVariable('NEWS_TYPE_MENU', $news_type_menu);
     $this->_objTpl->setVariable('NEWS_FORM_ACTION', $copy ? 'add' : 'update');
     $this->_objTpl->setVariable('NEWS_STORED_FORM_ACTION', 'update');
     $this->_objTpl->setVariable('NEWS_TOP_TITLE', $_ARRAYLANG['TXT_EDIT_NEWS_CONTENT']);
 }
Пример #27
0
 /**
  * Return the code for the placeholder
  * @access public
  * @static
  * @return string
  */
 public static function getCode()
 {
     $cssfiles = array();
     // TODO: Unused
     //        $jsfiles = array();
     //        $specialcode = array();
     $lazyLoadingFiles = array();
     $retstring = '';
     $jsScripts = array();
     if (count(self::$active) > 0) {
         // check for lazy dependencies, if there are lazy dependencies, activate cx
         // cx provides the lazy loading mechanism
         // this should be here because the cx variable have to be set before cx is initialized
         foreach (self::$active as $name) {
             $data = self::$available[$name];
             if (!empty($data['lazyDependencies'])) {
                 foreach ($data['lazyDependencies'] as $dependency) {
                     if (!in_array($dependency, self::$active)) {
                         // if the lazy dependency is not activated so far
                         $lazyLoadingFiles = array_merge($lazyLoadingFiles, self::$available[$dependency]['jsfiles']);
                     }
                     if (!empty(self::$available[$dependency]['cssfiles'])) {
                         $cssfiles = array_merge($cssfiles, self::$available[$dependency]['cssfiles']);
                     }
                 }
             }
         }
         if (!empty($lazyLoadingFiles)) {
             JS::activate('cx');
         }
         // set cx.variables with lazy loading file paths
         ContrexxJavascript::getInstance()->setVariable('lazyLoadingFiles', $lazyLoadingFiles, 'contrexx');
         // Note the "reverse" here.  Dependencies are at the end of the
         // array, and must be loaded first!
         foreach (array_reverse(self::$active) as $name) {
             $data = self::$available[$name];
             if (!isset($data['jsfiles']) && !isset($data['versions'])) {
                 self::$error = "A JS entry should at least contain one js file...";
                 return false;
             }
             // get js files which are specified or the js files from first version
             if (!isset($data['jsfiles'])) {
                 // get data from default version and load the files from there
                 $versionData = end($data['versions']);
                 $data = array_merge($data, $versionData);
             }
             $jsScripts[] = self::makeJSFiles($data['jsfiles']);
             if (!empty($data['cssfiles'])) {
                 $cssfiles = array_merge($cssfiles, $data['cssfiles']);
             }
             if (isset($data['specialcode']) && strlen($data['specialcode']) > 0) {
                 $jsScripts[] = self::makeSpecialCode(array($data['specialcode']));
             }
             if (isset($data['makecallback'])) {
                 self::$data['makecallback']();
             }
             // Special case cloudrexx-API: fetch specialcode if activated
             if ($name == 'cx') {
                 $jsScripts[] = self::makeSpecialCode(array(ContrexxJavascript::getInstance()->initJs()));
             }
         }
     }
     $jsScripts[] = self::makeJSFiles(self::$customJS);
     // if jquery is activated, do a noConflict
     if (array_search('jquery', self::$active) !== false) {
         $jsScripts[] = self::makeSpecialCode('if (typeof jQuery != "undefined") { jQuery.noConflict(); }');
     }
     $jsScripts[] = self::makeJSFiles(self::$templateJS);
     // no conflict for normal jquery version which has been included in template or by theme dependency
     $jsScripts[] = self::makeSpecialCode('if (typeof jQuery != "undefined") { jQuery.noConflict(); }');
     $retstring .= self::makeCSSFiles($cssfiles);
     $retstring .= self::makeCSSFiles(self::$customCSS);
     // Add javscript files
     $retstring .= implode(' ', $jsScripts);
     $retstring .= self::makeJSFiles(self::$customJS);
     $retstring .= self::makeSpecialCode(self::$customCode);
     return $retstring;
 }
 /**
  * @param Sigma $template
  */
 public function preFinalize(Sigma $template)
 {
     if (count($this->mediaBrowserInstances) == 0) {
         return;
     }
     global $_ARRAYLANG;
     /**
      * @var $init \InitCMS
      */
     $init = \Env::get('init');
     $init->loadLanguageData('MediaBrowser');
     foreach ($_ARRAYLANG as $key => $value) {
         if (preg_match("/TXT_FILEBROWSER_[A-Za-z0-9]+/", $key)) {
             \ContrexxJavascript::getInstance()->setVariable($key, $value, 'mediabrowser');
         }
     }
     $thumbnailsTemplate = new Sigma();
     $thumbnailsTemplate->loadTemplateFile($this->cx->getCoreModuleFolderName() . '/MediaBrowser/View/Template/Thumbnails.html');
     $thumbnailsTemplate->setVariable('TXT_FILEBROWSER_THUMBNAIL_ORIGINAL_SIZE', sprintf($_ARRAYLANG['TXT_FILEBROWSER_THUMBNAIL_ORIGINAL_SIZE']));
     foreach ($this->cx->getMediaSourceManager()->getThumbnailGenerator()->getThumbnails() as $thumbnail) {
         $thumbnailsTemplate->setVariable(array('THUMBNAIL_NAME' => sprintf($_ARRAYLANG['TXT_FILEBROWSER_THUMBNAIL_' . strtoupper($thumbnail['name']) . '_SIZE'], $thumbnail['size']), 'THUMBNAIL_ID' => $thumbnail['id'], 'THUMBNAIL_SIZE' => $thumbnail['size']));
         $thumbnailsTemplate->parse('thumbnails');
     }
     \ContrexxJavascript::getInstance()->setVariable('thumbnails_template', $thumbnailsTemplate->get(), 'mediabrowser');
     \ContrexxJavascript::getInstance()->setVariable('chunk_size', min(floor((\FWSystem::getMaxUploadFileSize() - 1000000) / 1000000), 20) . 'mb', 'mediabrowser');
     \ContrexxJavascript::getInstance()->setVariable('languages', \FWLanguage::getActiveFrontendLanguages(), 'mediabrowser');
     \ContrexxJavascript::getInstance()->setVariable('language', \FWLanguage::getLanguageCodeById(\FWLanguage::getDefaultLangId()), 'mediabrowser');
     \JS::activate('mediabrowser');
     \JS::registerJS('core_modules/MediaBrowser/View/Script/MediaBrowser.js');
 }
Пример #29
0
    /**
     * This function returns the DataElement
     *
     * @param string $name name of the DataElement
     * @param string $type type of the DataElement
     * @param int $length length of the DataElement
     * @param mixed $value value of the DataElement
     * @param array $options options for the DataElement
     * @param int $entityId id of the DataElement
     * @return \Cx\Core\Html\Model\Entity\DataElement
     */
    public function getDataElement($name, $type, $length, $value, &$options, $entityId)
    {
        global $_ARRAYLANG, $_CORELANG;
        if (isset($options['formfield'])) {
            $formFieldGenerator = $options['formfield'];
            $formField = '';
            /* We use json to do the callback. The 'else if' is for backwards compatibility so you can declare
             * the function directly without using json. This is not recommended and not working over session */
            if (is_array($formFieldGenerator) && isset($formFieldGenerator['adapter']) && isset($formFieldGenerator['method'])) {
                $json = new \Cx\Core\Json\JsonData();
                $jsonResult = $json->data($formFieldGenerator['adapter'], $formFieldGenerator['method'], array('name' => $name, 'type' => $type, 'length' => $length, 'value' => $value, 'options' => $options));
                if ($jsonResult['status'] == 'success') {
                    $formField = $jsonResult["data"];
                }
            } else {
                if (is_callable($formFieldGenerator)) {
                    $formField = $formFieldGenerator($name, $type, $length, $value, $options);
                }
            }
            if (is_a($formField, 'Cx\\Core\\Html\\Model\\Entity\\HtmlElement')) {
                return $formField;
            } else {
                $value = $formField;
            }
        }
        if (isset($options['showDetail']) && $options['showDetail'] === false) {
            return '';
        }
        switch ($type) {
            case 'bool':
            case 'boolean':
                // yes/no checkboxes
                $fieldset = new \Cx\Core\Html\Model\Entity\HtmlElement('div');
                $inputYes = new \Cx\Core\Html\Model\Entity\DataElement($name, 'yes');
                $inputYes->setAttribute('type', 'radio');
                $inputYes->setAttribute('value', '1');
                $inputYes->setAttribute('id', 'form-' . $this->formId . '-' . $name . '_yes');
                if (isset($options['attributes'])) {
                    $inputYes->setAttributes($options['attributes']);
                }
                $fieldset->addChild($inputYes);
                $labelYes = new \Cx\Core\Html\Model\Entity\HtmlElement('label');
                $labelYes->setAttribute('for', 'form-' . $this->formId . '-' . $name . '_yes');
                $labelYes->addChild(new \Cx\Core\Html\Model\Entity\TextElement($_ARRAYLANG['TXT_YES']));
                $fieldset->addChild($labelYes);
                $inputNo = new \Cx\Core\Html\Model\Entity\DataElement($name, 'no');
                $inputNo->setAttribute('id', 'form-' . $this->formId . '-' . $name . '_no');
                $inputNo->setAttribute('type', 'radio');
                $inputNo->setAttribute('value', '0');
                if (isset($options['attributes'])) {
                    $inputNo->setAttributes($options['attributes']);
                }
                $fieldset->addChild($inputNo);
                $labelNo = new \Cx\Core\Html\Model\Entity\HtmlElement('label');
                $labelNo->setAttribute('for', 'form-' . $this->formId . '-' . $name . '_no');
                $labelNo->addChild(new \Cx\Core\Html\Model\Entity\TextElement($_ARRAYLANG['TXT_NO']));
                $fieldset->addChild($labelNo);
                if ($value) {
                    $inputYes->setAttribute('checked');
                } else {
                    $inputNo->setAttribute('checked');
                }
                return $fieldset;
                break;
            case 'int':
            case 'integer':
                // input field with type number
                $inputNumber = new \Cx\Core\Html\Model\Entity\DataElement($name, $value, \Cx\Core\Html\Model\Entity\DataElement::TYPE_INPUT, new \Cx\Core\Validate\Model\Entity\RegexValidator('/-?[0-9]*/'));
                if (isset($options['attributes'])) {
                    $inputNumber->setAttributes($options['attributes']);
                }
                $inputNumber->setAttribute('type', 'number');
                return $inputNumber;
                break;
            case 'Cx\\Model\\Base\\EntityBase':
                $associatedClass = get_class($value);
                \JS::registerJS('core/Html/View/Script/Backend.js');
                \ContrexxJavascript::getInstance()->setVariable('Form/Error', $_ARRAYLANG['TXT_CORE_HTML_FORM_VALIDATION_ERROR'], 'core/Html/lang');
                if (\Env::get('em')->getClassMetadata($this->entityClass)->isSingleValuedAssociation($name)) {
                    // this case is used to create a select field for 1 to 1 associations
                    $entities = \Env::get('em')->getRepository($associatedClass)->findAll();
                    $foreignMetaData = \Env::get('em')->getClassMetadata($associatedClass);
                    $primaryKeyName = $foreignMetaData->getSingleIdentifierFieldName();
                    $selected = $foreignMetaData->getFieldValue($value, $primaryKeyName);
                    $arrEntities = array();
                    $closeMetaData = \Env::get('em')->getClassMetadata($this->entityClass);
                    $assocMapping = $closeMetaData->getAssociationMapping($name);
                    $validator = null;
                    if (!isset($assocMapping['joinColumns'][0]['nullable']) || $assocMapping['joinColumns'][0]['nullable']) {
                        $arrEntities['NULL'] = $_ARRAYLANG['TXT_CORE_NONE'];
                    } else {
                        $validator = new \Cx\Core\Validate\Model\Entity\RegexValidator('/^(?!null$|$)/');
                    }
                    foreach ($entities as $entity) {
                        $arrEntities[\Env::get('em')->getClassMetadata($associatedClass)->getFieldValue($entity, $primaryKeyName)] = $entity;
                    }
                    $select = new \Cx\Core\Html\Model\Entity\DataElement($name, \Html::getOptions($arrEntities, $selected), \Cx\Core\Html\Model\Entity\DataElement::TYPE_SELECT, $validator);
                    if (isset($options['attributes'])) {
                        $select->setAttributes($options['attributes']);
                    }
                    return $select;
                } else {
                    // this case is used to list all existing values and show an add button for 1 to many associations
                    $closeMetaData = \Env::get('em')->getClassMetadata($this->entityClass);
                    $assocMapping = $closeMetaData->getAssociationMapping($name);
                    $mainDiv = new \Cx\Core\Html\Model\Entity\HtmlElement('div');
                    $mainDiv->setAttribute('class', 'entityList');
                    $addButton = new \Cx\Core\Html\Model\Entity\HtmlElement('input');
                    $addButton->setAttribute('type', 'button');
                    $addButton->setClass(array('form-control', 'add_' . $this->createCssClassNameFromEntity($associatedClass), 'mappedAssocciationButton'));
                    $addButton->setAttribute('value', $_CORELANG['TXT_ADD']);
                    $addButton->setAttribute('data-params', 'entityClass:' . $associatedClass . ';' . 'mappedBy:' . $assocMapping['mappedBy'] . ';' . 'cssName:' . $this->createCssClassNameFromEntity($associatedClass) . ';' . 'sessionKey:' . $this->entityClass);
                    if (!isset($_SESSION['vgOptions'])) {
                        $_SESSION['vgOptions'] = array();
                    }
                    $_SESSION['vgOptions'][$this->entityClass] = $this->componentOptions;
                    if ($entityId != 0) {
                        // if we edit the main form, we also want to show the existing associated values we already have
                        $existingValues = $this->getIdentifyingDisplayValue($assocMapping, $associatedClass, $entityId);
                    }
                    if (!empty($existingValues)) {
                        foreach ($existingValues as $existingValue) {
                            $mainDiv->addChild($existingValue);
                        }
                    }
                    $mainDiv->addChild($addButton);
                    // if standard tooltip is not disabled, we load the one to n association text
                    if (!isset($options['showstanardtooltip']) || $options['showstanardtooltip']) {
                        if (!empty($options['tooltip'])) {
                            $options['tooltip'] = $options['tooltip'] . '<br /><br /> ' . $_ARRAYLANG['TXT_CORE_RECORD_ONE_TO_N_ASSOCIATION'];
                        } else {
                            $options['tooltip'] = $_ARRAYLANG['TXT_CORE_RECORD_ONE_TO_N_ASSOCIATION'];
                        }
                    }
                    $cxjs = \ContrexxJavascript::getInstance();
                    $cxjs->setVariable('TXT_CANCEL', $_CORELANG['TXT_CANCEL'], 'Html/lang');
                    $cxjs->setVariable('TXT_SUBMIT', $_CORELANG['TXT_SUBMIT'], 'Html/lang');
                    $cxjs->setVariable('TXT_EDIT', $_CORELANG['TXT_EDIT'], 'Html/lang');
                    $cxjs->setVariable('TXT_DELETE', $_CORELANG['TXT_DELETE'], 'Html/lang');
                    return $mainDiv;
                }
                break;
            case 'Country':
                // this is for customizing only:
                $data = \Cx\Core\Country\Controller\Country::getNameById($value);
                if (empty($data)) {
                    $value = 204;
                }
                $options = \Cx\Core\Country\Controller\Country::getMenuoptions($value);
                $select = new \Cx\Core\Html\Model\Entity\DataElement($name, $options, \Cx\Core\Html\Model\Entity\DataElement::TYPE_SELECT);
                if (isset($options['attributes'])) {
                    $select->setAttributes($options['attributes']);
                }
                return $select;
                break;
            case 'DateTime':
            case 'datetime':
            case 'date':
                // input field with type text and class datepicker
                if ($value instanceof \DateTime) {
                    $value = $value->format(ASCMS_DATE_FORMAT);
                }
                if (is_null($value)) {
                    $value = '';
                }
                $input = new \Cx\Core\Html\Model\Entity\DataElement($name, $value);
                $input->setAttribute('type', 'text');
                $input->setAttribute('class', 'datepicker');
                if (isset($options['readonly']) && $options['readonly']) {
                    $input->setAttribute('disabled');
                }
                if (isset($options['attributes'])) {
                    $input->setAttributes($options['attributes']);
                }
                \DateTimeTools::addDatepickerJs();
                \JS::registerCode('
                        cx.jQuery(function() {
                          cx.jQuery(".datepicker").datetimepicker();
                        });
                        ');
                return $input;
                break;
            case 'multiselect':
            case 'select':
                $values = array();
                if (isset($options['validValues'])) {
                    if (is_array($options['validValues'])) {
                        $values = $options['validValues'];
                    } else {
                        $values = explode(',', $options['validValues']);
                        $values = array_combine($values, $values);
                    }
                }
                if ($type == 'multiselect') {
                    $value = explode(',', $value);
                    $value = array_combine($value, $value);
                }
                $selectOptions = \Html::getOptions($values, $value);
                $select = new \Cx\Core\Html\Model\Entity\DataElement($name, $selectOptions, \Cx\Core\Html\Model\Entity\DataElement::TYPE_SELECT);
                if ($type == 'multiselect') {
                    $select->setAttribute('multiple');
                }
                if (isset($options['attributes'])) {
                    $select->setAttributes($options['attributes']);
                }
                return $select;
                break;
            case 'slider':
                // this code should not be here
                // create sorrounding div
                $element = new \Cx\Core\Html\Model\Entity\HtmlElement('div');
                // create div for slider
                $slider = new \Cx\Core\Html\Model\Entity\HtmlElement('div');
                $slider->setAttribute('class', 'slider');
                $element->addChild($slider);
                // create hidden input for slider value
                $input = new \Cx\Core\Html\Model\Entity\DataElement($name, $value + 0, \Cx\Core\Html\Model\Entity\DataElement::TYPE_INPUT);
                $input->setAttribute('type', 'hidden');
                if (isset($options['attributes'])) {
                    $input->setAttributes($options['attributes']);
                }
                $element->addChild($input);
                // add javascript to update input value
                $min = 0;
                $max = 10;
                if (isset($options['validValues'])) {
                    $values = explode(',', $options['validValues']);
                    $min = $values[0];
                    if (isset($values[1])) {
                        $max = $values[1];
                    }
                }
                if (!isset($value)) {
                    $value = 0;
                }
                $script = new \Cx\Core\Html\Model\Entity\HtmlElement('script');
                $script->addChild(new \Cx\Core\Html\Model\Entity\TextElement('
                    cx.jQuery("#form-' . $this->formId . '-' . $name . ' .slider").slider({
                        value: ' . ($value + 0) . ',
                        min: ' . ($min + 0) . ',
                        max: ' . ($max + 0) . ',
                        slide: function( event, ui ) {
                            cx.jQuery("input[name=' . $name . ']").val(ui.value);
                            cx.jQuery("input[name=' . $name . ']").change();
                        }
                    });
                '));
                $element->addChild($script);
                return $element;
                break;
            case 'checkboxes':
                $dataElementGroupType = \Cx\Core\Html\Model\Entity\DataElementGroup::TYPE_CHECKBOX;
            case 'radio':
                $values = array();
                if (isset($options['validValues'])) {
                    $values = explode(',', $options['validValues']);
                    $values = array_combine($values, $values);
                }
                if (!isset($dataElementGroupType)) {
                    $dataElementGroupType = \Cx\Core\Html\Model\Entity\DataElementGroup::TYPE_RADIO;
                }
                $radio = new \Cx\Core\Html\Model\Entity\DataElementGroup($name, $values, $value, $dataElementGroupType);
                if (isset($options['attributes'])) {
                    $radio->setAttributes($options['attributes']);
                }
                return $radio;
                break;
            case 'text':
                // textarea
                $textarea = new \Cx\Core\Html\Model\Entity\HtmlElement('textarea');
                $textarea->setAttribute('name', $name);
                if (isset($options['readonly']) && $options['readonly']) {
                    $textarea->setAttribute('disabled');
                }
                $textarea->addChild(new \Cx\Core\Html\Model\Entity\TextElement($value));
                if (isset($options['attributes'])) {
                    $textarea->setAttributes($options['attributes']);
                }
                return $textarea;
                break;
            case 'phone':
                // input field with type phone
                $input = new \Cx\Core\Html\Model\Entity\DataElement($name, $value);
                $input->setAttribute('type', 'phone');
                if (isset($options['readonly']) && $options['readonly']) {
                    $input->setAttribute('disabled');
                }
                if (isset($options['attributes'])) {
                    $input->setAttributes($options['attributes']);
                }
                return $input;
                break;
            case 'mail':
                // input field with type mail
                $emailValidator = new \Cx\Core\Validate\Model\Entity\EmailValidator();
                $input = new \Cx\Core\Html\Model\Entity\DataElement($name, $value, 'input', $emailValidator);
                $input->setAttribute('onkeyup', $emailValidator->getJavaScriptCode());
                $input->setAttribute('type', 'mail');
                if (isset($options['attributes'])) {
                    $input->setAttributes($options['attributes']);
                }
                if (isset($options['readonly']) && $options['readonly']) {
                    $input->setAttribute('disabled');
                }
                return $input;
                break;
            case 'uploader':
                \JS::registerCode('
                    function javascript_callback_function(data) {
                        if(data.type=="file") {
                                cx.jQuery("#' . $name . '").val(data.data[0].datainfo.filepath);
                        }
                    }

                ');
                $mediaBrowser = new \Cx\Core_Modules\MediaBrowser\Model\Entity\MediaBrowser();
                $mediaBrowser->setOptions(array('type' => 'button'));
                $mediaBrowser->setCallback('javascript_callback_function');
                $mediaBrowser->setOptions(array('data-cx-mb-views' => 'filebrowser,uploader', 'id' => 'page_target_browse', 'cxMbStartview' => 'MediaBrowserList'));
                $input = new \Cx\Core\Html\Model\Entity\DataElement($name, $value);
                $input->setAttribute('type', 'text');
                $input->setAttribute('id', $name);
                $div = new \Cx\Core\Html\Model\Entity\HtmlElement('div');
                $div->addChild($input);
                $div->addChild(new \Cx\Core\Html\Model\Entity\TextElement($mb = $mediaBrowser->getXHtml($_ARRAYLANG['TXT_CORE_CM_BROWSE'])));
                return $div;
                break;
            case 'image':
                \JS::registerCode('
                    function javascript_callback_function(data) {
                        if ( data.data[0].datainfo.extension=="Jpg"
                            || data.data[0].datainfo.extension=="Gif"
                            || data.data[0].datainfo.extension=="Png"
                        ) {
                            cx.jQuery("#' . $name . '").attr(\'value\', data.data[0].datainfo.filepath);
                            cx.jQuery("#' . $name . '").prevAll(\'.deletePreviewImage\').first().css(\'display\', \'inline-block\');
                            cx.jQuery("#' . $name . '").prevAll(\'.previewImage\').first().attr(\'src\', data.data[0].datainfo.filepath);
                        }
                    }

                    jQuery(document).ready(function(){
                        jQuery(\'.deletePreviewImage\').click(function(){
                            cx.jQuery("#' . $name . '").attr(\'value\', \'\');
                            cx.jQuery(this).prev(\'img\').attr(\'src\', \'/images/Downloads/no_picture.gif\');
                            cx.jQuery(this).css(\'display\', \'none\');
                            cx.jQuery(this).nextAll(\'input\').first().attr(\'value\', \'\');
                        });
                    });

                ');
                $mediaBrowser = new \Cx\Core_Modules\MediaBrowser\Model\Entity\MediaBrowser();
                $mediaBrowser->setOptions(array('type' => 'button'));
                $mediaBrowser->setCallback('javascript_callback_function');
                $defaultOptions = array('data-cx-mb-views' => 'filebrowser,uploader', 'id' => 'page_target_browse', 'cxMbStartview' => 'MediaBrowserList');
                $mediaBrowser->setOptions(is_array($options['options']) ? array_merge($defaultOptions, $options['options']) : $defaultOptions);
                // create hidden input to save image
                $input = new \Cx\Core\Html\Model\Entity\DataElement($name, $value);
                $input->setAttribute('type', 'hidden');
                $input->setAttribute('id', $name);
                $div = new \Cx\Core\Html\Model\Entity\HtmlElement('div');
                if (isset($value) && in_array(pathinfo($value, PATHINFO_EXTENSION), array('gif', 'jpg', 'png')) || $name == 'imagePath') {
                    // this image is meant to be a preview of the selected image
                    $previewImage = new \Cx\Core\Html\Model\Entity\HtmlElement('img');
                    $previewImage->setAttribute('class', 'previewImage');
                    $previewImage->setAttribute('src', $value != '' ? $value : '/images/Downloads/no_picture.gif');
                    // this image is uesd as delete function for the selected image over javascript
                    $deleteImage = new \Cx\Core\Html\Model\Entity\HtmlElement('img');
                    $deleteImage->setAttribute('class', 'deletePreviewImage');
                    $deleteImage->setAttribute('src', '/core/Core/View/Media/icons/delete.gif');
                    $div->addChild($previewImage);
                    $div->addChild($deleteImage);
                    $div->addChild(new \Cx\Core\Html\Model\Entity\HtmlElement('br'));
                }
                $div->addChild($input);
                $div->addChild(new \Cx\Core\Html\Model\Entity\TextElement($mediaBrowser->getXHtml($_ARRAYLANG['TXT_CORE_CM_BROWSE'])));
                return $div;
                break;
            case 'sourcecode':
                //set mode
                $mode = 'html';
                if (isset($options['options']['mode'])) {
                    switch ($options['options']['mode']) {
                        case 'js':
                            $mode = 'javascript';
                            break;
                        case 'yml':
                        case 'yaml':
                            $mode = 'yaml';
                            break;
                    }
                }
                //define textarea
                $textarea = new \Cx\Core\Html\Model\Entity\HtmlElement('textarea');
                $textarea->setAttribute('name', $name);
                $textarea->setAttribute('id', $name);
                $textarea->setAttribute('style', 'display:none;');
                $textarea->addChild(new \Cx\Core\Html\Model\Entity\TextElement($value));
                //define pre
                $pre = new \Cx\Core\Html\Model\Entity\HtmlElement('pre');
                $pre->setAttribute('id', 'editor-' . $name);
                $pre->addChild(new \Cx\Core\Html\Model\Entity\TextElement(contrexx_raw2xhtml($value)));
                //set readonly if necessary
                $readonly = '';
                if (isset($options['readonly']) && $options['readonly']) {
                    $readonly = 'editor.setReadOnly(true);';
                    $textarea->setAttribute('disabled');
                }
                //create div and add all stuff
                $div = new \Cx\Core\Html\Model\Entity\HtmlElement('div');
                //     required for the Ace editor to work. Otherwise
                //     it won't be visible as the DIV does have a width of 0px.
                $div->setAttribute('style', 'display:block;');
                $div->addChild($textarea);
                $div->addChild($pre);
                //register js
                $jsCode = <<<CODE
var editor;
\$J(function(){
if (\$J("#editor-{$name}").length) {
    editor = ace.edit("editor-{$name}");
    editor.getSession().setMode("ace/mode/{$mode}");
    editor.setShowPrintMargin(false);
    editor.focus();
    editor.gotoLine(1);
    {$readonly}
}

\$J('form').submit(function(){
    \$J('#{$name}').val(editor.getSession().getValue());
});

});
CODE;
                \JS::activate('ace');
                \JS::registerCode($jsCode);
                return $div;
                break;
            case 'string':
            case 'hidden':
            default:
                // convert NULL to empty string
                if (is_null($value)) {
                    $value = '';
                }
                // input field with type text
                $input = new \Cx\Core\Html\Model\Entity\DataElement($name, $value);
                if (isset($options['validValues'])) {
                    $input->setValidator(new \Cx\Core\Validate\Model\Entity\RegexValidator('/^' . $options['validValues'] . '$/'));
                }
                if ($type == 'hidden') {
                    $input->setAttribute('type', 'hidden');
                } else {
                    $input->setAttribute('type', 'text');
                    $input->setClass('form-control');
                }
                if (isset($options['readonly']) && $options['readonly']) {
                    $input->setAttribute('disabled');
                }
                if (isset($options['attributes'])) {
                    $input->setAttributes($options['attributes']);
                }
                return $input;
                break;
        }
    }
Пример #30
0
 /**
  * Load the registered map markers into JavaScript
  */
 protected function loadMapMarkers()
 {
     $markers = array();
     foreach ($this->mapMarkers as $id => $marker) {
         if ($marker['lon'] >= 0 && $marker['lat'] >= 0) {
             $markers[$id] = $marker;
         }
     }
     \ContrexxJavascript::getInstance()->setVariable('map_' . $this->mapIndex . '_markers', $markers, $this->mapId);
 }