Example #1
0
 /**
  * Constructor
  * @access  public
  * @return  shopmanager
  */
 function __construct()
 {
     global $_ARRAYLANG, $objTemplate;
     \Cx\Core\Setting\Controller\Setting::init('Shop', 'config');
     $this->checkProfileAttributes();
     $cx = \Cx\Core\Core\Controller\Cx::instanciate();
     self::$defaultImage = file_exists($cx->getWebsiteImagesShopPath() . '/' . ShopLibrary::noPictureName) ? $cx->getWebsiteImagesShopWebPath() . '/' . ShopLibrary::noPictureName : $cx->getCodeBaseOffsetPath() . '/images/Shop/' . ShopLibrary::noPictureName;
     self::$objTemplate = new \Cx\Core\Html\Sigma($cx->getCodeBaseModulePath() . '/Shop/View/Template/Backend');
     self::$objTemplate->setErrorHandling(PEAR_ERROR_DIE);
     //DBG::log("ARRAYLANG: ".var_export($_ARRAYLANG, true));
     self::$objTemplate->setGlobalVariable($_ARRAYLANG + array('SHOP_CURRENCY' => Currency::getActiveCurrencySymbol(), 'CSRF_PARAM' => \Cx\Core\Csrf\Controller\Csrf::param()));
 }
 /**
  * PHP5 constructor
  * @global \Cx\Core\Html\Sigma
  * @global array
  * @global array
  */
 function __construct()
 {
     global $objTemplate, $_ARRAYLANG, $_CONFIG;
     $this->em = \Env::get('em');
     $this->_objTpl = new \Cx\Core\Html\Sigma(\Env::get('cx')->getCodeBaseCoreModulePath() . '/Contact/View/Template/Backend');
     \Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->_objTpl);
     $this->_objTpl->setErrorHandling(PEAR_ERROR_DIE);
     $this->_objTpl->setGlobalVariable('CSRF_PARAM', \Cx\Core\Csrf\Controller\Csrf::param());
     $this->_arrFormFieldTypes = array('text' => $_ARRAYLANG['TXT_CONTACT_TEXTBOX'], 'label' => $_ARRAYLANG['TXT_CONTACT_TEXT'], 'checkbox' => $_ARRAYLANG['TXT_CONTACT_CHECKBOX'], 'checkboxGroup' => $_ARRAYLANG['TXT_CONTACT_CHECKBOX_GROUP'], 'country' => $_ARRAYLANG['TXT_CONTACT_COUNTRY'], 'date' => $_ARRAYLANG['TXT_CONTACT_DATE'], 'datetime' => $_ARRAYLANG['TXT_CONTACT_DATETIME'], 'file' => $_ARRAYLANG['TXT_CONTACT_FILE_UPLOAD_SINGLE'], 'multi_file' => $_ARRAYLANG['TXT_CONTACT_FILE_UPLOAD_MULTI'], 'fieldset' => $_ARRAYLANG['TXT_CONTACT_FIELDSET'], 'hidden' => $_ARRAYLANG['TXT_CONTACT_HIDDEN_FIELD'], 'horizontalLine' => $_ARRAYLANG['TXT_CONTACT_HORIZONTAL_LINE'], 'password' => $_ARRAYLANG['TXT_CONTACT_PASSWORD_FIELD'], 'radio' => $_ARRAYLANG['TXT_CONTACT_RADIO_BOXES'], 'select' => $_ARRAYLANG['TXT_CONTACT_SELECTBOX'], 'textarea' => $_ARRAYLANG['TXT_CONTACT_TEXTAREA'], 'recipient' => $_ARRAYLANG['TXT_CONTACT_RECEIVER_ADDRESSES_SELECTION']);
     $objUserAttribute = \FWUser::getFWUserObject()->objUser->objAttribute;
     $this->_arrUserAccountData = array('access_email' => $_ARRAYLANG['TXT_CONTACT_EMAIL'], 'access_gender' => contrexx_raw2xhtml($objUserAttribute->getById('gender')->getName()), 'access_title' => contrexx_raw2xhtml($objUserAttribute->getById('title')->getName()), 'access_firstname' => contrexx_raw2xhtml($objUserAttribute->getById('firstname')->getName()), 'access_lastname' => contrexx_raw2xhtml($objUserAttribute->getById('lastname')->getName()), 'access_company' => contrexx_raw2xhtml($objUserAttribute->getById('company')->getName()), 'access_address' => contrexx_raw2xhtml($objUserAttribute->getById('address')->getName()), 'access_city' => contrexx_raw2xhtml($objUserAttribute->getById('city')->getName()), 'access_zip' => contrexx_raw2xhtml($objUserAttribute->getById('zip')->getName()), 'access_country' => contrexx_raw2xhtml($objUserAttribute->getById('country')->getName()), 'access_phone_office' => contrexx_raw2xhtml($objUserAttribute->getById('phone_office')->getName()), 'access_phone_private' => contrexx_raw2xhtml($objUserAttribute->getById('phone_private')->getName()), 'access_phone_mobile' => contrexx_raw2xhtml($objUserAttribute->getById('phone_mobile')->getName()), 'access_phone_fax' => contrexx_raw2xhtml($objUserAttribute->getById('phone_fax')->getName()), 'access_birthday' => contrexx_raw2xhtml($objUserAttribute->getById('birthday')->getName()), 'access_website' => contrexx_raw2xhtml($objUserAttribute->getById('website')->getName()), 'access_profession' => contrexx_raw2xhtml($objUserAttribute->getById('profession')->getName()), 'access_interests' => contrexx_raw2xhtml($objUserAttribute->getById('interests')->getName()), 'access_signature' => contrexx_raw2xhtml($objUserAttribute->getById('signature')->getName()));
     $this->initContactForms();
     $this->initCheckTypes();
 }
    function JSedituser()
    {
        global $_ARRAYLANG;
        \JS::registerCode('
function DeleteUser(UserID, email) {
  strConfirmMsg = "' . $_ARRAYLANG['TXT_NEWSLETTER_CONFIRM_DELETE_RECIPIENT_OF_ADDRESS'] . '";
  if (confirm(strConfirmMsg.replace("%s", email)+"\\n' . $_ARRAYLANG['TXT_NEWSLETTER_CANNOT_UNDO_OPERATION'] . '")) {
    document.location.href = "index.php?cmd=Newsletter&' . \Cx\Core\Csrf\Controller\Csrf::param() . '&act=users&delete=1&id="+UserID;
  }
}

function MultiAction() {
  with (document.userlist) {
    switch (userlist_MultiAction.value) {
      case "delete":
        if (confirm(\'' . $_ARRAYLANG['TXT_NEWSLETTER_CONFIRM_DELETE_SELECTED_RECIPIENTS'] . '\\n' . $_ARRAYLANG['TXT_NEWSLETTER_CANNOT_UNDO_OPERATION'] . '\')) {
          submit();
        }
        break;
    }
  }
}
');
    }
Example #4
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;
 }
Example #5
0
 function getHomePage()
 {
     global $_CORELANG, $_CONFIG, $objTemplate, $objDatabase;
     $objTemplate->addBlockfile('ADMIN_CONTENT', 'content', 'index_home.html');
     \JS::activate('jquery-bootstrap');
     \JS::activate('jquery-jqplot');
     $arrAccessIDs = array(5, 10, 76, '84_1', 6, 19, 75, '84_2', 17, 18, 7, 32, 21);
     foreach ($arrAccessIDs as $id) {
         $accessID = strpos($id, '_') ? substr($id, 0, strpos($id, '_')) : $id;
         if (\Permission::checkAccess($accessID, 'static', true)) {
             $objTemplate->touchBlock('check_access_' . $id);
         } else {
             $objTemplate->hideBlock('check_access_' . $id);
         }
     }
     $objTemplate->setVariable(array('CSRF' => \Cx\Core\Csrf\Controller\Csrf::param(), 'TXT_LAST_LOGIN' => htmlentities($_CORELANG['TXT_LAST_LOGIN'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_CONTREXX_NEWS' => htmlentities($_CORELANG['TXT_CONTREXX_NEWS'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_CREATING_AND_PUBLISHING' => htmlentities($_CORELANG['TXT_CREATING_AND_PUBLISHING'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_EVALUATE_AND_VIEW' => htmlentities($_CORELANG['TXT_EVALUATE_AND_VIEW'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_MANAGE' => htmlentities($_CORELANG['TXT_MANAGE'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_NEW_SITE' => htmlentities($_CORELANG['TXT_NEW_PAGE'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_ADD_NEWS' => htmlentities($_CORELANG['TXT_ADD_NEWS'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_ADD_BLOCK' => htmlentities($_CORELANG['TXT_ADD_BLOCK'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_ADD_FORM' => htmlentities($_CORELANG['TXT_ADD_FORM'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_CONTENT_MANAGER' => htmlentities($_CORELANG['TXT_CONTENT_MANAGER'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_STATS' => htmlentities($_CORELANG['TXT_STATS'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_WORKFLOW' => htmlentities($_CORELANG['TXT_WORKFLOW'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_FORMS' => htmlentities($_CORELANG['TXT_FORMS'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_SYSTEM_SETTINGS' => htmlentities($_CORELANG['TXT_SYSTEM_SETTINGS'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_USER_MANAGER' => htmlentities($_CORELANG['TXT_USER_ADMINISTRATION'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_MEDIA_MANAGER' => htmlentities($_CORELANG['TXT_MEDIA_MANAGER'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_IMAGE_ADMINISTRATION' => htmlentities($_CORELANG['TXT_IMAGE_ADMINISTRATION'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_SKINS' => htmlentities($_CORELANG['TXT_DESIGN_MANAGEMENT'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_VISITORS' => htmlentities($_CORELANG['TXT_CORE_VISITORS'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_REQUESTS' => htmlentities($_CORELANG['TXT_CORE_REQUESTS'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_DASHBOARD_NEWS_ALERT' => htmlentities($_CORELANG['TXT_DASHBOARD_NEWS_ALERT'], ENT_QUOTES, CONTREXX_CHARSET), 'TXT_DASHBOARD_STATS_ALERT' => htmlentities($_CORELANG['TXT_DASHBOARD_STATS_ALERT'], ENT_QUOTES, CONTREXX_CHARSET)));
     $objTemplate->setGlobalVariable('TXT_LOGOUT', $_CORELANG['TXT_LOGOUT']);
     if (\Permission::checkAccess(17, 'static', true)) {
         $objTemplate->touchBlock('news_delete');
         $objTemplate->touchBlock('stats_delete');
     } else {
         $objTemplate->hideBlock('news_delete');
         $objTemplate->hideBlock('stats_delete');
     }
     $license = \Cx\Core_Modules\License\License::getCached($_CONFIG, $objDatabase);
     $message = $license->getMessage(true, \FWLanguage::getLanguageCodeById(BACKEND_LANG_ID), $_CORELANG);
     if ($message instanceof \Cx\Core_Modules\License\Message && strlen($message->getText()) && $message->showInDashboard()) {
         $licenseManager = new \Cx\Core_Modules\License\LicenseManager('', null, $_CORELANG, $_CONFIG, $objDatabase);
         $objTemplate->setVariable('MESSAGE_TITLE', contrexx_raw2xhtml($licenseManager->getReplacedMessageText($message)));
         $licenseType = $message->getType();
         switch ($licenseType) {
             case '--this case is not defined by license --':
                 $bsCalloutType = 'danger';
                 break;
             case 'alertbox':
                 $bsCalloutType = 'warning';
                 break;
             case 'okbox':
             default:
                 $bsCalloutType = 'info';
                 break;
         }
         $objTemplate->setVariable('MESSAGE_TYPE', $bsCalloutType);
         $objTemplate->setVariable('MESSAGE_LINK', contrexx_raw2xhtml($message->getLink()));
         $objTemplate->setVariable('MESSAGE_LINK_TARGET', contrexx_raw2xhtml($message->getLinkTarget()));
     }
     // TODO: Unused
     //        $objFWUser = \FWUser::getFWUserObject();
     $objResult = $objDatabase->SelectLimit('SELECT `logs`.`datetime`, `users`.`username`
         FROM `' . DBPREFIX . 'log` AS `logs`
         LEFT JOIN `' . DBPREFIX . 'access_users` AS `users`
         ON `users`.`id`=`logs`.`userid`
         ORDER BY `logs`.`id` DESC', 1);
     if ($objResult && $objResult->RecordCount() > 0) {
         $objTemplate->setVariable(array('LAST_LOGIN_USERNAME' => contrexx_raw2xhtml($objResult->fields['username']), 'LAST_LOGIN_TIME' => date('d.m.Y', strtotime($objResult->fields['datetime']))));
         $objTemplate->parse('last_login');
     } else {
         $objTemplate->setVariable('LOG_ERROR_MESSAGE', $_CORELANG['TXT_NO_DATA_FOUND']);
     }
     if ($_CONFIG['dashboardStatistics'] == 'on') {
         $arrStatistics = $this->getStatistics();
         $objTemplate->setVariable(array('STATS_TITLE' => $_CORELANG['TXT_CORE_STATS_FROM'] . ' ' . reset($arrStatistics['dates']) . ' - ' . end($arrStatistics['dates']), 'STATS_TICKS' => json_encode($arrStatistics['ticks']), 'STATS_DATES' => json_encode($arrStatistics['dates']), 'STATS_VISITORS' => json_encode($arrStatistics['visitors']), 'STATS_REQUESTS' => json_encode($arrStatistics['requests']), 'STATS_TOTAL_VISITORS' => array_sum($arrStatistics['visitors']), 'STATS_TOTAL_REQUESTS' => array_sum($arrStatistics['requests'])));
     } else {
         $objTemplate->hideBlock('stats');
         $objTemplate->hideBlock('stats_javascript');
     }
     $arrItems = null;
     // This index may be unset
     if (!empty($_CONFIG['dashboardNewsSrc'])) {
         $objRss = new \XML_RSS($_CONFIG['dashboardNewsSrc'] . '?version=' . $_CONFIG['coreCmsVersion']);
         $objRss->parse();
         $arrItems = $objRss->getItems();
     }
     if (!empty($arrItems) && $_CONFIG['dashboardNews'] == 'on') {
         if (empty($arrItems[0]['description'])) {
             $objTemplate->setVariable(array('NEWS_CONTENT' => $arrItems[0]['title'], 'NEWS_LINK' => $arrItems[0]['link']));
             $objTemplate->hideBlock('news_title');
         } else {
             $objTemplate->setVariable(array('NEWS_TITLE' => $arrItems[0]['title'], 'NEWS_CONTENT' => $arrItems[0]['description'], 'NEWS_LINK' => $arrItems[0]['link']));
         }
         $objTemplate->parse('news');
     } else {
         $objTemplate->hideBlock('news');
     }
 }
 /**
  * Edit the task type
  *
  * @global array $_ARRAYLANG
  * @global object $objDatabase
  * @return true
  */
 function editTaskType()
 {
     global $objDatabase, $_ARRAYLANG;
     \JS::activate("jquery");
     // Activate validation scripts
     \JS::registerCSS("lib/javascript/validationEngine/css/validationEngine.jquery.css");
     \JS::registerJS("lib/javascript/validationEngine/js/languages/jquery.validationEngine-en.js");
     \JS::registerJS("lib/javascript/validationEngine/js/jquery.validationEngine.js");
     \JS::registerCSS("lib/javascript/chosen/chosen.css");
     \JS::registerJS("lib/javascript/chosen/chosen.jquery.js");
     $id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
     if ($_POST['saveTaskType']) {
         $this->saveTaskTypes($id);
         $msg = "taskUpdated";
         \Cx\Core\Csrf\Controller\Csrf::header("Location:./index.php?cmd=" . $this->moduleName . "&act=settings&tpl=tasktypes&msg=" . base64_encode($msg));
         exit;
     }
     $objTpl = $this->_objTpl;
     $this->_pageTitle = $_ARRAYLANG['TXT_CRM_EDIT_TASK_TYPE'];
     $objTpl->addBlockfile('CRM_SETTINGS_FILE', 'settings_block', "module_{$this->moduleNameLC}_settings_edit_task_types.html");
     $this->getModifyTaskTypes($id);
     $objTpl->setVariable(array('TXT_CRM_ADD_TASK_TYPE' => $_ARRAYLANG['TXT_CRM_EDIT_TASK_TYPE'], 'TXT_CRM_BACK1' => $_ARRAYLANG['TXT_CRM_BACK1'], 'CSRF_PARAM' => \Cx\Core\Csrf\Controller\Csrf::param(), 'TXT_BROWSE' => $_ARRAYLANG['TXT_BROWSE'], 'TXT_CRM_MANDATORY_FIELDS_NOT_FILLED_OUT' => $_ARRAYLANG['TXT_CRM_MANDATORY_FIELDS_NOT_FILLED_OUT']));
 }
Example #7
0
    function showMedium($blockFirst = false)
    {
        global $_ARRAYLANG, $_CONFIG, $_LANGID;
        $categoryId = isset($_REQUEST['cid']) ? intval($_REQUEST['cid']) == 0 ? false : intval($_REQUEST['cid']) : false;
        $mediumId = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
        if ($mediumId > 0) {
            $this->_updateViews($mediumId);
        }
        $this->_objTpl->setGlobalVariable(array('TXT_PODCAST_PLAY' => $_ARRAYLANG['TXT_PODCAST_PLAY'], 'TXT_PODCAST_MEDIA_VIEWS' => $_ARRAYLANG['TXT_PODCAST_MEDIA_VIEWS']));
        $maxSize = $this->_arrSettings['thumb_max_size'];
        $tmpOnload = $blockFirst ? 'try{tmp();}catch(e){}' : '';
        $embedCode = <<<EOF
<script type="text/javascript">
//<![CDATA[
    var thumbSizeMax = {$maxSize};
    var previewSizeMax = 180;

    tmp = window.onload;
    if(tmp == null){
        tmp = function(){};
    }
    window.onload = function(){
        try{
            elPodcastContainer = document.getElementById("podcast_container");
            elPodcastContainerLength = elPodcastContainer.childNodes.length;
            document.getElementById("podcast_container").innerHTML += '%s';
            for (childNr = elPodcastContainerLength - 1; childNr >= 0; childNr--) {
                elPodcastContainer.removeChild(elPodcastContainer.childNodes[childNr]);
            }

        }catch(e){}
        setSize(document.getElementById("podcast_preview"), previewSizeMax);
        mThumbnails = document.getElementsByName("podcast_thumbnails");
        for(i=0;i<mThumbnails.length;i++){
            setSize(mThumbnails[i], thumbSizeMax);
        }
        {$tmpOnload}
    }

//]]>
</script>
EOF;
        if (($arrMedium =& $this->_getMedium($mediumId, true)) !== false) {
            if ($this->_objTpl->blockExists('podcast_medium')) {
                $arrTemplate =& $this->_getTemplate($arrMedium['template_id']);
                $mediumCode = sprintf($embedCode, addcslashes($this->_getHtmlTag($arrMedium, $arrTemplate['template']), "\r\n'"));
                $this->_objTpl->setVariable(array('PODCAST_MEDIUM_ID' => $mediumId, 'PODCAST_MEDIUM_CATEGORY_ID' => $categoryId, 'PODCAST_MEDIUM_TITLE' => htmlentities($arrMedium['title'], ENT_QUOTES, CONTREXX_CHARSET), 'PODCAST_MEDIUM_AUTHOR' => empty($arrMedium['author']) ? '-' : htmlentities($arrMedium['author'], ENT_QUOTES, CONTREXX_CHARSET), 'PODCAST_MEDIUM_DESCRIPTION' => htmlentities($arrMedium['description'], ENT_QUOTES, CONTREXX_CHARSET), 'PODCAST_MEDIUM_CODE' => $mediumCode, 'PODCAST_MEDIUM_DATE' => date(ASCMS_DATE_FORMAT, $arrMedium['date_added']), 'PODCAST_MEDIUM_SHORT_DATE' => date(ASCMS_DATE_FORMAT_DATE, $arrMedium['date_added']), 'PODCAST_MEDIUM_THUMBNAIL' => htmlentities($arrMedium['thumbnail'], ENT_QUOTES, CONTREXX_CHARSET), 'PODCAST_MEDIUM_URL' => htmlentities($arrMedium['source'], ENT_QUOTES, CONTREXX_CHARSET), 'PODCAST_MEDIUM_PLAYLENGHT' => $this->_getPlaylengthFormatOfTimestamp($arrMedium['playlength']), 'PODCAST_MEDIUM_PLAYLENGTH' => $this->_getPlaylengthFormatOfTimestamp($arrMedium['playlength']), 'PODCAST_MEDIUM_VIEWS' => $this->_getViews($mediumId), 'PODCAST_MEDIUM_FILESIZE' => $this->_formatFileSize($arrMedium['size'])));
                $this->_objTpl->parse('podcast_medium');
            }
            if ($this->_objTpl->blockExists('podcast_no_medium')) {
                $this->_objTpl->hideBlock('podcast_no_medium');
            }
        } else {
            $podcastJavascript = sprintf($embedCode, '');
            if ($this->_objTpl->blockExists('podcast_no_medium')) {
                $this->_objTpl->touchBlock('podcast_no_medium');
            }
            if ($this->_objTpl->blockExists('podcast_medium')) {
                $this->_objTpl->hideBlock('podcast_medium');
            }
        }
        $menu = $this->_getCategoriesMenu($categoryId, 'id="podcast_category_menu"', true, true);
        if ($menu !== false) {
            $this->_objTpl->setVariable('PODCAST_CATEGORY_MENU', $menu . ' <input type="button" onclick="window.location.href=\'index.php?section=Podcast&amp;' . \Cx\Core\Csrf\Controller\Csrf::param() . '&amp;cid=\'+document.getElementById(\'podcast_category_menu\').value" value="' . $_ARRAYLANG['TXT_PODCAST_SHOW'] . '" />');
        }
        if (intval($categoryId) == 0) {
            $categories = array_keys($this->_getCategories(true, false, $_LANGID));
        } else {
            $categories = $categoryId;
        }
        if ($this->_objTpl->blockExists('podcast_media')) {
            $pos = isset($_GET['pos']) ? intval($_GET['pos']) : 0;
            $arrMedia =& $this->_getMedia($categories, true, $_CONFIG['corePagingLimit'], $pos);
            if (count($arrMedia) > 0) {
                foreach ($arrMedia as $mediumId => $arrMedium) {
                    $this->_objTpl->setVariable(array('PODCAST_MEDIUM_ROW' => $i % 2 == 0 ? 'row1' : 'row2', 'PODCAST_MEDIA_ID' => $mediumId, 'PODCAST_MEDIA_CATEGORY_ID' => $categoryId, 'PODCAST_MEDIA_TITLE' => htmlentities($arrMedium['title'], ENT_QUOTES, CONTREXX_CHARSET), 'PODCAST_MEDIA_AUTHOR' => htmlentities($arrMedium['author'], ENT_QUOTES, CONTREXX_CHARSET), 'PODCAST_MEDIA_DESCRIPTION' => empty($arrMedium['description']) ? '-' : htmlentities($arrMedium['description'], ENT_QUOTES, CONTREXX_CHARSET), 'PODCAST_MEDIA_DATE' => date(ASCMS_DATE_FORMAT, $arrMedium['date_added']), 'PODCAST_MEDIA_SHORT_DATE' => date(ASCMS_DATE_FORMAT_DATE, $arrMedium['date_added']), 'PODCAST_MEDIA_URL' => htmlentities($arrMedium['source'], ENT_QUOTES, CONTREXX_CHARSET), 'PODCAST_MEDIA_THUMBNAIL' => htmlentities($arrMedium['thumbnail'], ENT_QUOTES, CONTREXX_CHARSET), 'PODCAST_MEDIA_VIEWS' => $this->_getViews($mediumId), 'PODCAST_MEDIA_PLAYLENGHT' => $this->_getPlaylengthFormatOfTimestamp($arrMedium['playlength']), 'PODCAST_MEDIA_PLAYLENGTH' => $this->_getPlaylengthFormatOfTimestamp($arrMedium['playlength']), 'PODCAST_MEDIA_SHORT_PLAYLENGHT' => $this->_getShortPlaylengthFormatOfTimestamp($arrMedium['playlength']), 'PODCAST_MEDIA_SHORT_PLAYLENGTH' => $this->_getShortPlaylengthFormatOfTimestamp($arrMedium['playlength'])));
                    $i++;
                    $this->_objTpl->parse('podcast_media');
                }
            }
            $mediaCount =& $this->_getMediaCount($categoryId, true);
            if ($mediaCount > $_CONFIG['corePagingLimit']) {
                $paging = getPaging($mediaCount, $pos, '&section=Podcast&cid=' . $categoryId, $_ARRAYLANG['TXT_PODCAST_MEDIA']);
                $this->_objTpl->setVariable('PODCAST_PAGING', $paging);
            }
        }
        $setSizeFunction = $this->_getSetSizeJS();
        $podcastJavascript .= <<<EOF
    <script type="text/javascript">
    //<![CDATA[
    if(typeof(setSize == 'undefined')){
        {$setSizeFunction}
    }
    //]]>
    </script>
EOF;
        $this->_objTpl->setVariable('PODCAST_JAVASCRIPT', $podcastJavascript);
    }
Example #8
0
 /**
  * prepare and show the edit category page
  *
  */
 function editCategory()
 {
     global $_ARRAYLANG, $_CORELANG;
     $catId = !empty($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
     $this->_pageTitle = $_ARRAYLANG['TXT_BLOCK_CATEGORIES_EDIT'];
     $this->_objTpl->loadTemplateFile('module_block_categories_edit.html');
     $arrCategory = $this->_getCategory($_GET['id']);
     $this->_objTpl->setVariable(array('TXT_BLOCK_NAME' => $_ARRAYLANG['TXT_BLOCK_NAME'], 'TXT_BLOCK_SAVE' => $_ARRAYLANG['TXT_BLOCK_SAVE'], 'TXT_BLOCK_PARENT' => $_ARRAYLANG['TXT_BLOCK_PARENT'], 'TXT_BLOCK_NONE' => $_ARRAYLANG['TXT_BLOCK_NONE'], 'TXT_BLOCK_CATEGORIES_EDIT' => $_ARRAYLANG['TXT_BLOCK_CATEGORIES_EDIT'], 'TXT_BLOCK_BACK' => $_CORELANG['TXT_BACK'], 'TXT_BLOCK_CATEGORY_SEPERATOR' => $_ARRAYLANG['TXT_BLOCK_CATEGORY_SEPERATOR'], 'BLOCK_CATEGORY_ID' => $catId, 'BLOCK_CATEGORIES_PARENT_DROPDOWN' => $this->_getCategoriesDropdown($arrCategory['parent'], $catId), 'BLOCK_CATEGORY_NAME' => contrexx_raw2xhtml($arrCategory['name']), 'BLOCK_CATEGORY_SEPERATOR' => contrexx_raw2xhtml($arrCategory['seperator']), 'DIRECTORY_INDEX' => CONTREXX_DIRECTORY_INDEX, 'CSRF_PARAM' => \Cx\Core\Csrf\Controller\Csrf::param()));
 }
    /**
     * Get customer type script
     *
     * @return String $javascript
     */
    function getCustomerTypeJavascript()
    {
        global $_CORELANG, $_ARRAYLANG, $objDatabase;
        $TXT_CRM_SURE_TO_DELETE_SELECTED_ENTRIES = $_ARRAYLANG['TXT_CRM_SURE_TO_DELETE_SELECTED_ENTRIES'];
        $TXT_CRM_ENTER_LABEL_FIELD = $_ARRAYLANG['TXT_CRM_ENTER_LABEL_FIELD'];
        $TXT_CRM_ENTER_LABEL_FIELD_WITHOUT_SPECIAL_CHARACTERS = $_ARRAYLANG['TXT_CRM_ENTER_LABEL_FIELD_WITHOUT_SPECIAL_CHARACTERS'];
        $TXT_CRM_ENTER_DISCOUNT_PERCENT = $_ARRAYLANG['TXT_CRM_ENTER_DISCOUNT_PERCENT'];
        $TXT_CRM_PLEASE_ENTER_DISCOUNT_PERCENT_IN_NUMBER = $_ARRAYLANG['TXT_CRM_PLEASE_ENTER_DISCOUNT_PERCENT_IN_NUMBER'];
        $TXT_CRM_ARE_YOU_SURE_TO_DELETE_THE_ENTRY = $_ARRAYLANG['TXT_CRM_ARE_YOU_SURE_TO_DELETE_THE_ENTRY'];
        $TXT_CRM_NOTHING_SELECTED = $_ARRAYLANG['TXT_CRM_NOTHING_SELECTED'];
        $TXT_CRM_SAME_SORTVALUE = $_ARRAYLANG['TXT_CRM_SAME_SORTVALUE'];
        $TXT_ENTER_SORTING = $_ARRAYLANG['TXT_ENTER_SORTING'];
        $TXT_SORTING_NUMERIC = $_ARRAYLANG['TXT_SORTING_NUMERIC'];
        $TXT_MANDATORY_ERROR = $_ARRAYLANG['TXT_CRM_MANDATORY_FIELDS_NOT_FILLED_OUT'];
        $MODULE_NAME = $this->moduleName;
        $CSRFPARAM = \Cx\Core\Csrf\Controller\Csrf::param();
        $javascript = <<<END
        <script type="text/javascript" src="../lib/javascript/jquery.js"></script> 
        <script language="JavaScript" type="text/javascript">
          var \$j  = jQuery.noConflict(); 
          \$j(document).ready(function () {
          \$j("input").keyup(function () {
                \$j(this).css("border","1px solid #0A50A1");
          });
          \$j("select").change(function () {
                \$j(this).css("border","1px solid #0A50A1");
          });          
          });
                  
        //<![CDATA[
        function trim(sString)
{
while (sString.substring(0,1) == ' ')
{
sString = sString.substring(1, sString.length);
}
while (sString.substring(sString.length-1, sString.length) == ' ')
{
sString = sString.substring(0,sString.length-1);
}
return sString;
}

function ltrim(s)
{
\tvar l=0;
\twhile(l < s.length && s[l] == ' ')
\t{\tl++; }
\treturn s.substring(l, s.length);
}

function rtrim(s)
{
\tvar r=s.length -1;
\twhile(r > 0 && s[r] == ' ')
\t{\tr-=1;\t}
\treturn s.substring(0, r+1);
}

function IsNumeric(strString)
   //  check for valid numeric strings
   {
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }


function selectMultiAction() {


\twith (document.frmShowCustomerEntries) {
                             var chks = document.getElementsByName('selectedEntriesId[]');
                             var hasChecked = false;
                             // Get the checkbox array length and iterate it to see if any of them is selected
                             for (var i = 0; i < chks.length; i++){
                                if (chks[i].checked){
                                      hasChecked = true;
                                      break;
                                }
                             }
                               if (!hasChecked) {
                                      alert("{$TXT_CRM_NOTHING_SELECTED}");
                                      document.frmShowCustomerEntries.frmShowEntries_MultiAction.value=0;
                                      document.frmShowCustomerEntries.frmShowEntries_MultiAction.focus();
                                      return false;
                               }
\t\tswitch (frmShowEntries_MultiAction.value) {
\t\t\tcase 'delete':
                if (confirm("{$TXT_CRM_SURE_TO_DELETE_SELECTED_ENTRIES}")) {
\t\t\t\t\taction='index.php?cmd={$MODULE_NAME}&act=deleteCustomerTypes&{$CSRFPARAM}';
\t\t\t\t\tsubmit();
\t\t\t\t}
\t\t\t\telse{
                frmShowEntries_MultiAction.value=0;
                }
\t\t\tbreak;
\t\t\tdefault: //do nothing
\t\t}
                if(frmShowEntries_MultiAction.value == "activate"){
\t\taction='index.php?cmd={$MODULE_NAME}&act=settings&tpl=customerTypeChangeStatus&type=activate';
\t\t\t\t\tsubmit();
                }
                if(frmShowEntries_MultiAction.value == "deactivate"){
\t\t\t\taction='index.php?cmd={$MODULE_NAME}&act=settings&tpl=customerTypeChangeStatus&type=deactivate';
\t\t\t\t\tsubmit();
                }
                if(frmShowEntries_MultiAction.value == "sort"){
                             var sortText = document.getElementsByName('form_pos[]');
\t\t\t     var SortArray = new Array();
                             var cond=0;
                             for (var i = 0; i < sortText.length; i++){

\t\t\t\t\tif(sortText[i].value==""){
                                            alert("{$TXT_ENTER_SORTING}");
                                      document.frmShowCustomerEntries.frmShowEntries_MultiAction.value=0;
                                      document.frmShowCustomerEntries.frmShowEntries_MultiAction.focus();
                                            cond=1;
                                            return false;
                                            break;
                                       }
                                      else if(IsNumeric(sortText[i].value) == false){
\t\t\t                alert("{$TXT_SORTING_NUMERIC}");
\t\t\t\t\t document.frmShowCustomerEntries.frmShowEntries_MultiAction.value=0;
                                         document.frmShowCustomerEntries.frmShowEntries_MultiAction.focus();
                                            cond=1;
                                            return false;
                                            break;
                                       }

                                      if(cond == 1){
                                         break;
                                      }
                             }
\t\t\t\t\taction='index.php?cmd={$MODULE_NAME}&act=settings&tpl=customertypes&chg=1';
\t\t\t\t\tsubmit();
                  }
\t}
}

function showList(id) {

    document.getElementById(id).style.display="block";
    return false;
}

function deleteEntry(entryId){
            if(confirm("{$TXT_CRM_ARE_YOU_SURE_TO_DELETE_THE_ENTRY}"))
        //alert("index.php?cmd={$MODULE_NAME}&act=deleteCustomerTypes&{$CSRFPARAM}&id="+entryId);
                 window.location.replace("index.php?cmd={$MODULE_NAME}&act=deleteCustomerTypes&{$CSRFPARAM}&id="+entryId);
        }

function checkValidations() {

          \$j("input, select").css("border","1px solid #0A50A1");
           var errors =new  Array();
           var errChk;           
           var label           = document.getElementById("label").value;
           //var discountPercent = document.getElementById("discount").value;
           var sorting         = document.getElementById("sortingNumber").value;

           if(trim(label) == "") {
            errChk = 1;
           document.getElementById("label").style.border = "1px solid red";
           document.getElementById("label").value="";
        }
        if((trim(sorting) != "") && (IsNumeric(sorting) == false)) {
                errors.push("{$TXT_SORTING_NUMERIC}");
                errChk = 1;
\t        document.getElementById("sortingNumber").style.border = "1px solid red";
                document.getElementById("sortingNumber").value = "";
        }
       /*if(trim(discountPercent) == "") {
        errChk = 1;
        document.getElementById("discount").style.border = "1px solid red";
\t\tdocument.getElementById("discount").value="";

    } else if(discountPercent.search(/^[0-9.]+\$/)) {
        errors.push("{$TXT_CRM_PLEASE_ENTER_DISCOUNT_PERCENT_IN_NUMBER}");
\t\tdocument.getElementById("discount").style.border = "1px solid red";
\t\tdocument.getElementById("discount").value="";
    }*/
    if ( errors.length >= 1 || errChk == 1) {
                if (errChk == 1 && errors.length >= 1) {
                    errString = errors.join('<br />');
                    \$j('#formerr').html("{$TXT_MANDATORY_ERROR}<br />"+errString);
                } else if (  errors.length >= 1) {
                    errString = errors.join('<br />');
                    \$j('#formerr').html(errString);       
                } else {
                    \$j('#formerr').html("{$TXT_MANDATORY_ERROR}");
                }       
       \$j('#formerr').css('display','block');
        return false;
    } else {
        \$j('#formerr').html('');
        \$j('#formerr').css('display', 'none');
        return true;
    }

}

//]]>
</script>
END;
        return $javascript;
    }
Example #10
0
 function showCurrent()
 {
     global $objDatabase, $_ARRAYLANG;
     $this->_objTpl->loadTemplateFile('voting_results.html');
     $query = "SELECT COUNT(1) as `count` FROM " . DBPREFIX . "voting_system";
     $objResult = $objDatabase->Execute($query);
     if ($objResult) {
         $totalrows = $objResult->fields['count'];
     }
     $votingId = (!isset($_GET['act']) || $_GET['act'] != "delete") && isset($_GET['votingid']) ? intval($_GET['votingid']) : 0;
     $query = "SELECT id, date as datesec, question, votes FROM " . DBPREFIX . "voting_system where " . ($votingId > 0 ? "id=" . $votingId : "status=1");
     $objResult = $objDatabase->SelectLimit($query, 1);
     if ($objResult->RecordCount() == 0 && $totalrows == 0) {
         \Cx\Core\Csrf\Controller\Csrf::header("Location: ?cmd=Voting&act=add");
         exit;
     } else {
         $votingId = $objResult->fields['id'];
         $votingTitle = stripslashes($objResult->fields['question']);
         $votingVotes = $objResult->fields['votes'];
         $votingDate = strtotime($objResult->fields['datesec']);
         $images = 1;
         $query = "SELECT id, question, votes FROM " . DBPREFIX . "voting_results WHERE voting_system_id='{$votingId}' ORDER BY id";
         $objResult = $objDatabase->Execute($query);
         $votingResultText = '';
         while (!$objResult->EOF) {
             $votes = intval($objResult->fields['votes']);
             $percentage = 0;
             $imagewidth = 1;
             //Mozilla Bug if image width=0
             if ($votes > 0) {
                 $percentage = round($votes / $votingVotes * 10000) / 100;
                 $imagewidth = round($percentage, 0);
             }
             $votingResultText .= stripslashes($objResult->fields['question']) . "<br />\n";
             $votingResultText .= "<img src='../core/Core/View/Media/icons/{$images}.gif' width='{$imagewidth}%' height=\"10\" alt=\"{$votes} " . $_ARRAYLANG['TXT_VOTES'] . " / {$percentage} %\" />";
             $votingResultText .= "&nbsp;<font size='1'>{$votes} " . $_ARRAYLANG['TXT_VOTES'] . " / {$percentage} %</font><br />\n";
             $objResult->MoveNext();
         }
         $this->_objTpl->setVariable(array('VOTING_TITLE' => $votingTitle, 'VOTING_DATE' => showFormattedDate($votingDate), 'VOTING_RESULTS_TEXT' => $votingResultText, 'VOTING_RESULTS_TOTAL_VOTES' => $votingVotes, 'VOTING_TOTAL_TEXT' => $_ARRAYLANG['TXT_VOTING_TOTAL'], 'TXT_DATE' => $_ARRAYLANG['TXT_DATE'], 'TXT_TITLE' => $_ARRAYLANG['TXT_TITLE'], 'TXT_VOTES' => $_ARRAYLANG['TXT_VOTES'], 'TXT_ACTION' => $_ARRAYLANG['TXT_ACTION'], 'TXT_ACTIVATION' => $_ARRAYLANG['TXT_ACTIVATION'], 'TXT_CREATE_HTML' => $_ARRAYLANG['TXT_CREATE_HTML'], 'TXT_CONFIRM_DELETE_DATA' => $_ARRAYLANG['TXT_CONFIRM_DELETE_DATA'], 'TXT_ACTION_IS_IRREVERSIBLE' => $_ARRAYLANG['TXT_ACTION_IS_IRREVERSIBLE'], 'TXT_EXPORT_ADDITIONAL' => $_ARRAYLANG['TXT_EXPORT_ADDITIONAL']));
         $this->_objTpl->setGlobalVariable('TXT_HTML_CODE', $_ARRAYLANG['TXT_HTML_CODE']);
         // show other Voting entries
         $query = "SELECT id,status,submit_check, date as datesec, title, votes FROM " . DBPREFIX . "voting_system order by id desc";
         $objResult = $objDatabase->Execute($query);
         $i = 0;
         while (!$objResult->EOF) {
             $votingid = $objResult->fields['id'];
             $votingTitle = stripslashes($objResult->fields['title']);
             $votingVotes = $objResult->fields['votes'];
             $votingDate = strtotime($objResult->fields['datesec']);
             $votingStatus = $objResult->fields['status'];
             if ($votingStatus == 0) {
                 $radio = " onclick=\"Javascript: window.location.replace('index.php?cmd=Voting&amp;" . \Cx\Core\Csrf\Controller\Csrf::param() . "&amp;act=changestatus&amp;votingid={$votingid}');\" />";
             } else {
                 $radio = " checked=\"checked\" />";
             }
             if ($i % 2 == 0) {
                 $class = "row1";
             } else {
                 $class = "row2";
             }
             $this->_objTpl->setVariable(array('VOTING_OLDER_TEXT' => "<a href='?cmd=Voting&amp;votingid={$votingid}'>" . $votingTitle . "</a>", 'VOTING_OLDER_DATE' => showFormattedDate($votingDate), 'VOTING_OLDER_VOTES' => $votingVotes > 0 && $objResult->fields['submit_check'] == 'email' ? '<a href="?cmd=Voting&amp;act=detail&amp;id=' . $votingid . '" title="' . $_ARRAYLANG['TXT_VOTING_SHOW_EMAIL_ADRESSES'] . '">' . $votingVotes . '</a>' : $votingVotes, 'VOTING_ID' => $votingid, 'VOTING_LIST_CLASS' => $class, 'VOTING_RADIO' => "<input type='radio' name='voting_selected' value='radiobutton'" . $radio, 'TXT_EXPORT_CSV' => $_ARRAYLANG['TXT_EXPORT_CSV']));
             $this->_objTpl->parse("votingRow");
             $i++;
             $objResult->MoveNext();
         }
     }
 }
Example #11
0
    function getCreateSurveyJavascript()
    {
        global $_CORELANG, $_ARRAYLANG, $objDatabase;
        $TXT_SURVEY_NOITEM_SELECTED_ERR = $_ARRAYLANG['TXT_SURVEY_NOITEM_SELECTED_ERR'];
        $TXT_SURVEY_CONFIRM_DELETE_ERR = $_ARRAYLANG['TXT_SURVEY_CONFIRM_DELETE_ERR'];
        $TXT_SURVEY_SORTING_NUMBER_ERR = $_ARRAYLANG['TXT_SURVEY_SORTING_NUMBER_ERR'];
        $TXT_SURVEY_SORTING_NUMBER_NUM_ERR = $_ARRAYLANG['TXT_SURVEY_SORTING_NUMBER_NUM_ERR'];
        $TXT_SURVEY_SORTING_NUMBER_NOTSAME_ERR = $_ARRAYLANG['TXT_SURVEY_SORTING_NUMBER_NOTSAME_ERR'];
        $TXT_SURVEY_SELECT_ANSWER_INPUT_ERR = $_ARRAYLANG['TXT_SURVEY_SELECT_ANSWER_INPUT_ERR'];
        $TXT_SURVEY_ENTER_QUESTION_ERR = $_ARRAYLANG['TXT_SURVEY_ENTER_QUESTION_ERR'];
        $TXT_SURVEY_ENTER_ANSWER_ERR = $_ARRAYLANG['TXT_SURVEY_ENTER_ANSWER_ERR'];
        $TXT_SURVEY_ENTER_COLUMN_ERR = $_ARRAYLANG['TXT_SURVEY_ENTER_COLUMN_ERR'];
        $TXT_SURVEY_ENTER_TITLE_ERR = $_ARRAYLANG['TXT_SURVEY_ENTER_TITLE_ERR'];
        $TXT_SURVEY_HOMEBOX_ERR = $_ARRAYLANG['TXT_SURVEY_HOMEBOX_ERR'];
        $TXT_SURVEY_SELECT_EMAIL_ERR = $_ARRAYLANG['TXT_SURVEY_SELECT_EMAIL_ERR'];
        $TXT_SHOW = $_ARRAYLANG['TXT_SHOW'];
        $TXT_HIDE = $_ARRAYLANG['TXT_HIDE'];
        $CSRF_PARAM = \Cx\Core\Csrf\Controller\Csrf::param();
        $javascript = <<<END
        <script language="JavaScript" type="text/javascript">
       
        function trim(sString){
              while (sString.substring(0,1) == ' '){
               sString = sString.substring(1, sString.length);
              }
              while (sString.substring(sString.length-1, sString.length) == ' '){
               sString = sString.substring(0,sString.length-1);
              }
         return sString;
        }
        function ltrim(s){
       \tvar l=0;
\t       while(l < s.length && s[l] == ' ')
\t       {\tl++; }
       \treturn s.substring(l, s.length);
        }
        function rtrim(s){
       \tvar r=s.length -1;
\t       while(r > 0 && s[r] == ' ')
\t       {\tr-=1;\t}
\t       return s.substring(0, r+1);
        }
       function IsNumeric(strString){
        //  check for valid numeric strings\t
        var strValidChars = "0123456789";
          var strChar;
          var blnResult = true;
          if (strString.length == 0) return false;
          //  test strString consists of valid characters listed above
          for (i = 0; i < strString.length && blnResult == true; i++)
             {
             strChar = strString.charAt(i);
             if (strValidChars.indexOf(strChar) == -1)
                {
                blnResult = false;
                }
             }
          return blnResult;
       }
       function showColumnTab(){
         var matrix = document.getElementById("questionType").value;
       
         var helplink;
   \t if((matrix == 3) || (matrix == 4)){

         document.getElementById("col").style.display='';

         }else{
         document.getElementById("col").style.display='none';
         }

\t if(matrix == 5){
         document.getElementById("answer").style.display='none';
\t  document.getElementById("addComent").style.display='';
          document.getElementById("RowTextfield").style.display='none';
  \t document.getElementById("qTextfield").style.display='';
         }
\telse if(matrix == 7){
\t  document.getElementById("addComent").style.display='none';
         document.getElementById("answer").style.display='none';
\t document.getElementById("qTextfield").style.display='none';
         document.getElementById("RowTextfield").style.display='';
         }
   \telse{
\t  document.getElementById("addComent").style.display='';
         document.getElementById("answer").style.display='';
         document.getElementById("RowTextfield").style.display='none';
\t document.getElementById("qTextfield").style.display='';
         }

\t if(matrix == 1){
\t\tdocument.getElementById("help1").style.display="";
\t\tdocument.getElementById("help2").style.display="none";
\t\tdocument.getElementById("help3").style.display="none";
\t\tdocument.getElementById("help4").style.display="none";
\t\tdocument.getElementById("help5").style.display="none";
\t\tdocument.getElementById("help6").style.display="none";
\t\tdocument.getElementById("help7").style.display="none";
\t }else if(matrix == 2){
\t\tdocument.getElementById("help1").style.display="none";
\t\tdocument.getElementById("help2").style.display="";
\t\tdocument.getElementById("help3").style.display="none";
\t\tdocument.getElementById("help4").style.display="none";
\t\tdocument.getElementById("help5").style.display="none";
\t\tdocument.getElementById("help6").style.display="none";
\t\tdocument.getElementById("help7").style.display="none";
\t }else if(matrix == 3){
\t\tdocument.getElementById("help1").style.display="none";
\t\tdocument.getElementById("help2").style.display="none";
\t\tdocument.getElementById("help3").style.display="";
\t\tdocument.getElementById("help4").style.display="none";
\t\tdocument.getElementById("help5").style.display="none";
\t\tdocument.getElementById("help6").style.display="none";
\t\tdocument.getElementById("help7").style.display="none";
\t }else if(matrix == 4){
\t\tdocument.getElementById("help1").style.display="none";
\t\tdocument.getElementById("help2").style.display="none";
\t\tdocument.getElementById("help3").style.display="none";
\t\tdocument.getElementById("help4").style.display="";
\t\tdocument.getElementById("help5").style.display="none";
\t\tdocument.getElementById("help6").style.display="none";
\t\tdocument.getElementById("help7").style.display="none";
\t }else if(matrix == 5){
\t\tdocument.getElementById("help1").style.display="none";
\t\tdocument.getElementById("help2").style.display="none";
\t\tdocument.getElementById("help3").style.display="none";
\t\tdocument.getElementById("help4").style.display="none";
\t\tdocument.getElementById("help5").style.display="";
\t\tdocument.getElementById("help6").style.display="none";
\t\tdocument.getElementById("help7").style.display="none";
\t }else if(matrix == 6){
\t\tdocument.getElementById("help1").style.display="none";
\t\tdocument.getElementById("help2").style.display="none";
\t\tdocument.getElementById("help3").style.display="none";
\t\tdocument.getElementById("help4").style.display="none";
\t\tdocument.getElementById("help5").style.display="none";
\t\tdocument.getElementById("help6").style.display="";
\t\tdocument.getElementById("help7").style.display="none";
\t }else if(matrix == 7){
\t\tdocument.getElementById("help1").style.display="none";
\t\tdocument.getElementById("help2").style.display="none";
\t\tdocument.getElementById("help3").style.display="none";
\t\tdocument.getElementById("help4").style.display="none";
\t\tdocument.getElementById("help5").style.display="none";
\t\tdocument.getElementById("help6").style.display="none";
\t\tdocument.getElementById("help7").style.display="";
\t} else {
\t\tdocument.getElementById("help1").style.display="none";
\t\tdocument.getElementById("help2").style.display="none";
\t\tdocument.getElementById("help3").style.display="none";
\t\tdocument.getElementById("help4").style.display="none";
\t\tdocument.getElementById("help5").style.display="none";
\t\tdocument.getElementById("help6").style.display="none";
\t\tdocument.getElementById("help7").style.display="none";
\t }
       }

       function checkValidations_one() {
           var title = document.getElementById("title").value;
           var Restrict = document.getElementById("votingRestrictionMethod").checked;

\t   if(Restrict == false) {\t\t
\t\tvar emailFiled = document.getElementById("additional_email").checked;
\t\tif(emailFiled == false) {
\t\t\talert("{$TXT_SURVEY_SELECT_EMAIL_ERR}");\t\t
\t\t\treturn false;
\t\t}
\t   }
\t\t
           if(trim(title) == "") {           
             alert("{$TXT_SURVEY_ENTER_TITLE_ERR}");
             document.getElementById("title").focus();
             document.getElementById("title").value="";
\t\t   return false;
           }
           return true;
       }
        
       function checkValidations() {
        
           var questionType    = document.getElementById("questionType").value;
           var Question        = document.getElementById("Question").value;
\t   var QuestionRow     = document.getElementById("QuestionRow").value;\t
           var QuestionAnswers = document.getElementById("QuestionAnswers").value;
           
\t\t
           if(trim(questionType) == "") {
             alert("{$TXT_SURVEY_SELECT_ANSWER_INPUT_ERR}");
             document.getElementById("questionType").focus();
             document.getElementById("questionType").value="";
\t\t   return false;           
           }if((trim(Question) == "") && (questionType != 7)) {
             alert("{$TXT_SURVEY_ENTER_QUESTION_ERR}");
             document.getElementById("Question").focus();
             document.getElementById("Question").value="";
\t\t   return false;           
           }if((trim(QuestionRow) == "") && (questionType == 7)) {
             alert("{$TXT_SURVEY_ENTER_QUESTION_ERR}");
             document.getElementById("QuestionRow").focus();
             document.getElementById("QuestionRow").value="";
\t\t   return false;           
           }
\t   if(trim(QuestionAnswers) == "") {
            if((questionType != 5) && (questionType != 7)){
             alert("{$TXT_SURVEY_ENTER_ANSWER_ERR}");
             document.getElementById("QuestionAnswers").focus();
             document.getElementById("QuestionAnswers").value="";
\t\t   return false;           
\t     }
           }
           if(questionType == 3){
             var ColumnChoices = document.getElementById("ColumnChoices").value;
             if(trim(ColumnChoices) == '') {
                    alert("{$TXT_SURVEY_ENTER_COLUMN_ERR}");
                    document.getElementById("ColumnChoices").focus();
                    document.getElementById("ColumnChoices").value="";
\t             return false;                           
\t      }   
           }    
           if(questionType == 4){
             var ColumnChoices = document.addsurvey.ColumnChoices.value;
             var chio = trim(ColumnChoices);
             if(chio == '') {
                    alert("{$TXT_SURVEY_ENTER_COLUMN_ERR}");
                    document.getElementById("ColumnChoices").focus();
                    document.getElementById("ColumnChoices").value="";
                    return false;
                           
\t      }   
           }                   
             return true;
           
       }       
       
       function selectMultiAction() {
           with (document.frmShowSurveyEntries) {
                             var chks = document.getElementsByName('selectedEntriesId[]');
                             var hasChecked = false;
                             // Get the checkbox array length and iterate it to see if any of them is selected
                             for (var i = 0; i < chks.length; i++){
                                if (chks[i].checked){
                                      hasChecked = true;
                                      break;
                                }
                             }
                               if (!hasChecked) {
                                      alert("{$TXT_SURVEY_NOITEM_SELECTED_ERR}");
                                      document.frmShowSurveyEntries.frmShowEntries_MultiAction.value=0;
                                      document.frmShowSurveyEntries.frmShowEntries_MultiAction.focus();
                                      return false;
                               }
\t\tswitch (frmShowEntries_MultiAction.value) {

\t\t\tcase 'delete':
                if (confirm("{$TXT_SURVEY_CONFIRM_DELETE_ERR}")) {
\t\t\t\t\taction='index.php?cmd=Survey&act=deletesurvey&{$CSRF_PARAM}';
\t\t\t\t\tsubmit();
\t\t\t\t}
\t\t\t\telse{
                  frmShowEntries_MultiAction.value=0;
                }

\t\t\tbreak;
\t\t\tdefault: //do nothing
\t\t}

                if(frmShowEntries_MultiAction.value == "activate"){
\t\t\t\t\taction='index.php?cmd=Survey&act=SurveyChangeStatus&type=activate&{$CSRF_PARAM}';
\t\t\t\t\tsubmit();
                }   
                if(frmShowEntries_MultiAction.value == "deactivate"){
\t\t\t\t\taction='index.php?cmd=Survey&act=SurveyChangeStatus&type=deactivate&{$CSRF_PARAM}';
\t\t\t\t\tsubmit();
                }                
\t}
}
       
       function deleteEntry(entryId){
            if(confirm("{$TXT_SURVEY_CONFIRM_DELETE_ERR}"))
                 window.location.replace("index.php?cmd=Survey&{$CSRF_PARAM}&act=deletesurvey&id="+entryId);
        }
        function displayToggle(tag, elem){
            if (document.getElementById(elem).style.display == "none") {
                document.getElementById(elem).style.display="block";
                tag.innerHTML = "{$TXT_HIDE}";
                tag.title = "{$TXT_HIDE}";
            } else {
                document.getElementById(elem).style.display = "none";
                tag.innerHTML = "{$TXT_SHOW}";
                tag.title = "{$TXT_SHOW}";
            }
        }
        function activateSurvey() { 
            for (var i=0; i < document.frmShowSurveyEntries.Yeshome.length; i++)
            {
                if (document.frmShowSurveyEntries.Yeshome[i].checked)
                {
                    var rad_val = document.frmShowSurveyEntries.Yeshome[i].value;
                }
            }
            document.frmShowSurveyEntries.action='index.php?cmd=Survey&act=SurveyHomeChange&id='+rad_val;
            document.frmShowSurveyEntries.submit();
        }
      </script>
END;
        return $javascript;
    }
 function _media()
 {
     global $_ARRAYLANG, $_CONFIG;
     $this->_objTpl->loadTemplatefile('module_podcast_media.html');
     $this->_pageTitle = $_ARRAYLANG['TXT_PODCAST_MEDIA'];
     $this->_objTpl->setVariable(array('TXT_PODCAST_STATUS' => $_ARRAYLANG['TXT_PODCAST_STATUS'], 'TXT_PODCAST_TITLE' => $_ARRAYLANG['TXT_PODCAST_TITLE'], 'TXT_PODCAST_AUTHOR' => $_ARRAYLANG['TXT_PODCAST_AUTHOR'], 'TXT_PODCAST_DATE' => $_ARRAYLANG['TXT_PODCAST_DATE'], 'TXT_PODCAST_TEMPLATE' => $_ARRAYLANG['TXT_PODCAST_TEMPLATE'], 'TXT_PODCAST_FUNCTIONS' => $_ARRAYLANG['TXT_PODCAST_FUNCTIONS'], 'TXT_PODCAST_ADD_MEDIUM' => $_ARRAYLANG['TXT_PODCAST_ADD_MEDIUM'], 'TXT_PODCAST_CONFIRM_DELETE_MEDIUM_MSG' => $_ARRAYLANG['TXT_PODCAST_CONFIRM_DELETE_MEDIUM_MSG'], 'TXT_PODCAST_OPERATION_IRREVERSIBLE' => $_ARRAYLANG['TXT_PODCAST_OPERATION_IRREVERSIBLE'], 'TXT_PODCAST_CHECK_ALL' => $_ARRAYLANG['TXT_PODCAST_CHECK_ALL'], 'TXT_PODCAST_UNCHECK_ALL' => $_ARRAYLANG['TXT_PODCAST_UNCHECK_ALL'], 'TXT_PODCAST_WITH_SELECTED' => $_ARRAYLANG['TXT_PODCAST_WITH_SELECTED'], 'TXT_PODCAST_DELETE' => $_ARRAYLANG['TXT_PODCAST_DELETE'], 'TXT_PODCAST_CONFIRM_DELETE_MEDIA_MSG' => $_ARRAYLANG['TXT_PODCAST_CONFIRM_DELETE_MEDIA_MSG'], 'TXT_PODCAST_SHOW_MEDIUM' => $_ARRAYLANG['TXT_PODCAST_SHOW_MEDIUM']));
     $this->_objTpl->setGlobalVariable(array('TXT_PODCAST_SHOW_HTML_SOURCE_CODE' => $_ARRAYLANG['TXT_PODCAST_SHOW_HTML_SOURCE_CODE'], 'TXT_PODCAST_MODIFY_MEDIUM' => $_ARRAYLANG['TXT_PODCAST_MODIFY_MEDIUM'], 'TXT_PODCAST_DELETE_MEDIUM' => $_ARRAYLANG['TXT_PODCAST_DELETE_MEDIUM']));
     $rowNr = 0;
     $paging = "";
     $categoryId = false;
     $arrCategory = false;
     if (isset($_GET['categoryId']) && ($arrCategory =& $this->_getCategory(intval($_GET['categoryId']))) !== false) {
         $categoryId = intval($_GET['categoryId']);
         $this->_objTpl->setVariable('PODCAST_MEDIA_TITLE_TXT', sprintf($_ARRAYLANG['TXT_PODCAST_MEDIA_OF_CATEGORY'], $arrCategory['title']));
     } else {
         $this->_objTpl->setVariable('PODCAST_MEDIA_TITLE_TXT', $_ARRAYLANG['TXT_PODCAST_MEDIA']);
     }
     $pos = isset($_GET['pos']) ? intval($_GET['pos']) : 0;
     $arrMedia =& $this->_getMedia($categoryId, false, $_CONFIG['corePagingLimit'], $pos);
     $mediaCount =& $this->_getMediaCount($categoryId);
     if ($mediaCount > $_CONFIG['corePagingLimit']) {
         $paging = getPaging($mediaCount, $pos, '&cmd=Podcast&categoryId=' . $categoryId, $_ARRAYLANG['TXT_PODCAST_MEDIA']);
         $this->_objTpl->setVariable('PODCAST_PAGING', $paging . "<br /><br />\n");
     }
     if ($mediaCount > 0) {
         $arrTemplates =& $this->_getTemplates();
         foreach ($arrMedia as $mediumId => $arrMedium) {
             $this->_objTpl->setVariable(array('PODCAST_ROW_CLASS' => $rowNr % 2 == 1 ? 'row1' : 'row2', 'PODCAST_MEDIUM_ID' => $mediumId, 'PODCAST_MEDIUM_STATUS_IMG' => $arrMedium['status'] == 1 ? 'led_green.gif' : 'led_red.gif', 'PODCAST_MEDIUM_STATUS_TXT' => $arrMedium['status'] == 1 ? $_ARRAYLANG['TXT_PODCAST_ACTIVE'] : $_ARRAYLANG['TXT_PODCAST_INACTIVE'], 'PODCAST_MEDIUM_DATE' => date(ASCMS_DATE_FORMAT, $arrMedium['date_added']), 'PODCAST_MEDIUM_TITLE' => htmlentities($arrMedium['title'], ENT_QUOTES, CONTREXX_CHARSET), 'PODCAST_MEDIUM_AUTHOR' => !empty($arrMedium['author']) ? htmlentities($arrMedium['author'], ENT_QUOTES, CONTREXX_CHARSET) : '-', 'PODCAST_MEDIUM_TEMPLATE' => htmlentities($arrTemplates[$arrMedium['template_id']]['description'], ENT_QUOTES, CONTREXX_CHARSET)));
             $this->_objTpl->parse('podcast_media_list');
             $rowNr++;
         }
         $this->_objTpl->hideBlock('podcast_media_no_data');
         $this->_objTpl->touchBlock('podcast_media_data');
         $this->_objTpl->touchBlock('podcast_media_multi_select_action');
     } else {
         if ($arrCategory) {
             $this->_objTpl->setVariable('PODCAST_EMPTY_CATEGORY_MSG_TXT', sprintf($_ARRAYLANG['TXT_PODCAST_EMPTY_CATEGORY_MSG'], $arrCategory['title']));
         } else {
             $this->_objTpl->setVariable('PODCAST_EMPTY_CATEGORY_MSG_TXT', 'Die Medien Bibliothek ist leer!');
         }
         $this->_objTpl->touchBlock('podcast_media_no_data');
         $this->_objTpl->hideBlock('podcast_media_data');
         $this->_objTpl->hideBlock('podcast_media_multi_select_action');
     }
     if ($mediaCount > 0 || $categoryId) {
         $this->_objTpl->setVariable('PODCAST_CATEGORY_MENU', $this->_getCategoriesMenu($categoryId, 'onchange="window.location.href=\'index.php?cmd=Podcast&amp;' . \Cx\Core\Csrf\Controller\Csrf::param() . '&amp;categoryId=\'+this.value"'));
         $this->_objTpl->touchBlock('podcast_category_menu');
     } else {
         $this->_objTpl->hideBlock('podcast_category_menu');
     }
 }
 /**
  * This function returns the ViewGeneration options for a given entityClass
  *
  * @access protected
  * @global $_ARRAYLANG
  * @param $entityClassName contains the FQCN from entity
  * @return array with options
  */
 protected function getViewGeneratorOptions($entityClassName)
 {
     global $_ARRAYLANG;
     $classNameParts = explode('\\', $entityClassName);
     $classIdentifier = end($classNameParts);
     $langVarName = 'TXT_' . strtoupper($this->getType() . '_' . $this->getName() . '_ACT_' . $classIdentifier);
     $header = '';
     if (isset($_ARRAYLANG[$langVarName])) {
         $header = $_ARRAYLANG[$langVarName];
     }
     switch ($entityClassName) {
         case 'Cx\\Core\\Net\\Model\\Entity\\Domain':
             return array('header' => $_ARRAYLANG['TXT_CORE_NETMANAGER'], 'entityName' => $_ARRAYLANG['TXT_CORE_NETMANAGER_ENTITY'], 'fields' => array('name' => array('header' => $_ARRAYLANG['TXT_NAME'], 'table' => array('parse' => function ($value) {
                 global $_ARRAYLANG;
                 static $mainDomainName;
                 if (empty($mainDomainName)) {
                     $domainRepository = new \Cx\Core\Net\Model\Repository\DomainRepository();
                     $mainDomainName = $domainRepository->getMainDomain()->getName();
                 }
                 $domainName = contrexx_raw2xhtml(\Cx\Core\Net\Controller\ComponentController::convertIdnToUtf8Format($value));
                 if ($domainName != contrexx_raw2xhtml($value)) {
                     $domainName .= ' (' . contrexx_raw2xhtml($value) . ')';
                 }
                 $mainDomainIcon = '';
                 if ($value == $mainDomainName) {
                     $mainDomainIcon = ' <img src="' . \Env::get('cx')->getCodeBaseCoreWebPath() . '/Core/View/Media/icons/Home.png" title="' . $_ARRAYLANG['TXT_CORE_CONFIG_MAINDOMAINID'] . '" />';
                 }
                 return $domainName . $mainDomainIcon;
             }), 'formfield' => function ($fieldname, $fieldtype, $fieldlength, $fieldvalue, $fieldoptions) {
                 return \Cx\Core\Net\Controller\ComponentController::convertIdnToUtf8Format($fieldvalue);
             }), 'id' => array('showOverview' => false)), 'functions' => array('add' => true, 'edit' => false, 'allowEdit' => true, 'delete' => false, 'allowDelete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false, 'actions' => function ($rowData, $rowId) {
                 global $_CORELANG;
                 static $mainDomainName;
                 if (empty($mainDomainName)) {
                     $domainRepository = new \Cx\Core\Net\Model\Repository\DomainRepository();
                     $mainDomainName = $domainRepository->getMainDomain()->getName();
                 }
                 preg_match_all('/\\d+/', $rowId, $ids, null, 0);
                 $actionIcons = '';
                 $csrfParams = \Cx\Core\Csrf\Controller\Csrf::param();
                 if ($mainDomainName !== $rowData['name']) {
                     $actionIcons = '<a ' . 'href="' . \Env::get('cx')->getWebsiteBackendPath() . '/?cmd=NetManager&amp;editid=' . $rowId . '"' . 'class="edit" title="Edit entry">' . '</a>';
                     $actionIcons .= '<a
                                 onclick=" if(confirm(\'' . $_CORELANG['TXT_CORE_RECORD_DELETE_CONFIRM'] . '\'))' . 'window.location.replace(\'' . \Env::get('cx')->getWebsiteBackendPath() . '/?cmd=NetManager&amp;deleteid=' . (empty($ids[0][1]) ? 0 : $ids[0][1]) . '&amp;vg_increment_number=' . (empty($ids[0][0]) ? 0 : $ids[0][0]) . '&amp;' . $csrfParams . '\');" href="javascript:void(0);"' . 'class="delete"' . 'title="Delete entry">
                                 </a>';
                 }
                 return $actionIcons;
             }));
         default:
             return array('header' => $header, 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false));
             break;
     }
 }
Example #14
0
 /**
  * show membership menu
  *
  * @global array $_ARRAYLANG
  * @global object $objDatabase
  * @return true
  */
 function showMembership()
 {
     global $objDatabase, $_ARRAYLANG, $_LANGID;
     \JS::activate("jquery");
     $tpl = isset($_GET['subTpl']) ? $_GET['subTpl'] : '';
     if (!empty($tpl)) {
         switch ($tpl) {
             case 'modify':
                 $this->_modifyMembership();
                 break;
         }
         return;
     }
     $action = isset($_REQUEST['actionType']) ? $_REQUEST['actionType'] : '';
     $memberEntries = isset($_REQUEST['memberEntry']) ? array_map('intval', $_REQUEST['memberEntry']) : 0;
     $memberEntriesorting = isset($_REQUEST['sorting']) ? array_map('intval', $_REQUEST['sorting']) : 0;
     if (isset($_SESSION['strOkMessage'])) {
         $strMessage = is_array($_SESSION['strOkMessage']) ? implode("<br>", $_SESSION['strOkMessage']) : $_SESSION['strOkMessage'];
         $this->_strOkMessage = $strMessage;
         unset($_SESSION['strOkMessage']);
     }
     switch ($action) {
         case 'changestatus':
             $this->activateMembership((int) $_GET['id']);
             if (isset($_GET['ajax'])) {
                 exit;
             }
         case 'activate':
             $this->activateMembership($memberEntries);
             break;
         case 'deactivate':
             $this->activateMembership($memberEntries, true);
             break;
         case 'delete':
             $this->deleteMemberships($memberEntries);
             break;
         case 'deleteMembership':
             $this->deleteMembership();
             if (isset($_GET['ajax'])) {
                 exit;
             }
             break;
         default:
             break;
     }
     if (!empty($action) || isset($_POST['save_entries'])) {
         $this->saveSortingMembership($memberEntriesorting);
     }
     $objTpl = $this->_objTpl;
     $objTpl->addBlockfile('CRM_SETTINGS_FILE', 'settings_block', 'module_' . $this->moduleNameLC . '_settings_membership.html');
     $this->_pageTitle = $_ARRAYLANG['TXT_CRM_SETTINGS'];
     $objTpl->setGlobalVariable(array('MODULE_NAME' => $this->moduleName, 'TXT_CRM_IMAGE_EDIT' => $_ARRAYLANG['TXT_CRM_IMAGE_EDIT'], 'TXT_CRM_IMAGE_DELETE' => $_ARRAYLANG['TXT_CRM_IMAGE_DELETE']));
     // tab 2
     $id = isset($_GET['id']) ? (int) $_GET['id'] : 0;
     $name = isset($_POST['name']) ? contrexx_input2raw($_POST['name']) : '';
     $sorting = isset($_POST['sortingNumber']) ? (int) $_POST['sortingNumber'] : '';
     $status = isset($_POST['activeStatus']) ? 1 : (empty($_POST) ? 1 : 0);
     $inputField = isset($_POST['Inputfield']) ? $_POST['Inputfield'] : array();
     if (isset($_POST['save_entry'])) {
         $fields = array('sorting' => $sorting, 'status' => $status);
         $field_set = '';
         foreach ($fields as $col => $val) {
             if ($val !== null) {
                 $field_set[] = "`{$col}` = '" . contrexx_input2db($val) . "'";
             }
         }
         $field_set = implode(', ', $field_set);
         if (!empty($id)) {
             $query = "UPDATE `" . DBPREFIX . "module_{$this->moduleNameLC}_memberships` SET\n                        {$field_set}\n                  WHERE `id` = {$id}";
             $_SESSION['strOkMessage'] = $_ARRAYLANG['TXT_CRM_ENTRY_UPDATED_SUCCESS'];
         } else {
             $query = "INSERT INTO `" . DBPREFIX . "module_{$this->moduleNameLC}_memberships` SET\n                        {$field_set}";
         }
         $db = $objDatabase->Execute($query);
         $entryId = !empty($id) ? $id : $objDatabase->INSERT_ID();
         // Insert the name locale
         if ($db) {
             $objDatabase->Execute("DELETE FROM `" . DBPREFIX . "module_{$this->moduleNameLC}_membership_local` WHERE entry_id = {$entryId}");
             foreach ($this->_arrLanguages as $langId => $langValue) {
                 $value = empty($inputField[$langId]) ? contrexx_input2db($inputField[0]) : contrexx_input2db($inputField[$langId]);
                 $objDatabase->Execute("\n                        INSERT INTO `" . DBPREFIX . "module_{$this->moduleNameLC}_membership_local` SET\n                            `entry_id` = {$entryId},\n                            `lang_id`   = {$langId},\n                            `value`    = '{$value}'\n                            ");
             }
         }
         if ($db) {
             $_SESSION['strOkMessage'] = $_ARRAYLANG['TXT_CRM_ENTRY_ADDED_SUCCESS'];
         } else {
             $this->_strErrMessage = "Error in saving Data";
         }
     }
     $first = true;
     foreach ($this->_arrLanguages as $langId => $langValue) {
         $first ? $objTpl->touchBlock("minimize") : $objTpl->hideBlock("minimize");
         $first = false;
         $objTpl->setVariable(array('LANG_ID' => $langId, 'LANG_LONG_NAME' => $langValue['long'], 'LANG_SHORT_NAME' => $langValue['short'], 'CRM_SETTINGS_VALUE' => isset($inputField[$langId]) ? contrexx_raw2xhtml($inputField[$langId]) : ''));
         $objTpl->parse("settingsNames");
     }
     //show all records
     $query = "SELECT membership.*,\n                         memberLoc.value,\n                         (SELECT COUNT(1) FROM\n                            `" . DBPREFIX . "module_{$this->moduleNameLC}_customer_membership` as m\n                            WHERE m.membership_id = membership.id)\n                         as cusCount\n                     FROM `" . DBPREFIX . "module_{$this->moduleNameLC}_memberships` AS membership\n                     LEFT JOIN `" . DBPREFIX . "module_{$this->moduleNameLC}_membership_local` AS memberLoc\n                        ON membership.id = memberLoc.entry_id\n                     WHERE memberLoc.lang_id = " . $_LANGID . " ORDER BY sorting ASC ";
     $objResult = $objDatabase->Execute($query);
     if ($objResult && $objResult->RecordCount() == 0) {
         $objTpl->setVariable(array('TXT_NO_RECORDS_FOUND' => $_ARRAYLANG['TXT_CRM_NO_RECORDS_FOUND']));
     }
     while (!$objResult->EOF) {
         $activeImage = $objResult->fields['status'] ? '../core/Core/View/Media/icons/led_green.gif' : '../core/Core/View/Media/icons/led_red.gif';
         $objTpl->setVariable(array('ENTRY_ID' => $objResult->fields['id'], 'CRM_SORTING' => (int) $objResult->fields['sorting'], 'CRM_SUCCESS_STATUS' => $activeImage, 'CRM_CUSTOMER_COUNT' => (int) $objResult->fields['cusCount'], 'CRM_INDUSTRY_NAME' => contrexx_raw2xhtml($objResult->fields['value'])));
         $objTpl->parse("membershipEntries");
         $objResult->MoveNext();
     }
     $objTpl->setGlobalVariable(array('TXT_CRM_MORE' => $_ARRAYLANG['TXT_CRM_MORE'], 'TXT_CRM_MINIMIZE' => $_ARRAYLANG['TXT_CRM_MINIMIZE']));
     $objTpl->setVariable(array('DEFAULT_LANG_ID' => $_LANGID, 'LANG_ARRAY' => implode(',', array_keys($this->_arrLanguages)), 'CSRF_PARAM' => \Cx\Core\Csrf\Controller\Csrf::param(), 'TXT_CRM_CUSTOMER_MEMBERSHIP' => $_ARRAYLANG['TXT_CRM_CUSTOMER_MEMBERSHIP'], 'TXT_CRM_ADD_MEMBERSHIP' => $_ARRAYLANG['TXT_CRM_ADD_MEMBERSHIP'], 'TXT_STATUS' => $_ARRAYLANG['TXT_STATUS'], 'TXT_CRM_LABEL' => $_ARRAYLANG['TXT_CRM_LABEL'], 'TXT_CRM_SAVE' => $_ARRAYLANG['TXT_CRM_SAVE'], 'TXT_CRM_SORTING' => $_ARRAYLANG['TXT_CRM_SORTING'], 'TXT_CRM_FUNCTIONS' => $_ARRAYLANG['TXT_CRM_FUNCTIONS'], 'TXT_CRM_SELECT_ALL' => $_ARRAYLANG['TXT_CRM_SELECT_ALL'], 'TXT_CRM_REMOVE_SELECTION' => $_ARRAYLANG['TXT_CRM_REMOVE_SELECTION'], 'TXT_CRM_SELECT_ACTION' => $_ARRAYLANG['TXT_CRM_SELECT_ACTION'], 'TXT_CRM_ACTIVATESELECTED' => $_ARRAYLANG['TXT_CRM_ACTIVATESELECTED'], 'TXT_CRM_DEACTIVATESELECTED' => $_ARRAYLANG['TXT_CRM_DEACTIVATESELECTED'], 'TXT_CRM_DELETE_SELECTED' => $_ARRAYLANG['TXT_CRM_DELETE_SELECTED'], 'TXT_CRM_CHANGE_STATUS' => $_ARRAYLANG['TXT_CRM_CHANGE_STATUS'], 'TXT_CRM_ENTRY_DELETED_SUCCESS' => $_ARRAYLANG['TXT_CRM_ENTRY_DELETED_SUCCESS'], 'TXT_CRM_NOTHING_SELECTED' => $_ARRAYLANG['TXT_CRM_NOTHING_SELECTED'], 'TXT_CRM_NAME' => $_ARRAYLANG['TXT_CRM_LABEL'], 'TXT_CRM_TITLEACTIVE' => $_ARRAYLANG['TXT_CRM_TITLEACTIVE'], 'TXT_CRM_SORTING_NUMBER' => $_ARRAYLANG['TXT_CRM_SORTING_NUMBER'], 'TXT_CRM_ARE_YOU_SURE_DELETE_ENTRIES' => $_ARRAYLANG['TXT_CRM_ARE_YOU_SURE_DELETE_ENTRIES'], 'TXT_CRM_MANDATORY_FIELDS_NOT_FILLED_OUT' => $_ARRAYLANG['TXT_CRM_MANDATORY_FIELDS_NOT_FILLED_OUT'], 'TXT_CRM_ARE_YOU_SURE_DELETE_SELECTED_ENTRIES' => $_ARRAYLANG['TXT_CRM_ARE_YOU_SURE_DELETE_SELECTED_ENTRIES']));
 }
Example #15
0
    /**
     * Returns needed javascripts for the forum-module
     *
     * @param     string         $type
     * @return    string        $strJavaScript
     */
    function getJavascript($type = '', $data = '')
    {
        global $_ARRAYLANG;
        switch ($type) {
            case 'scrollto':
                $strJavaScript = '
                <script type="text/javascript" language="JavaScript">
                //<![CDATA[
                    function setScrollPos(){
                        if (typeof(window.pageYOffset) != \'undefined\') {
                            offset = window.pageYOffset;
                        } else {
                            offset = document.documentElement.scrollTop;
                        }
                        if(document.getElementById("scrollpos")){
                            document.getElementById("scrollpos").value = offset;
                        }
                    }
                //]]>
                </script>
                ';
                break;
            case 'goto':
                $strJavaScript = '
                            <script type="text/javascript" language="JavaScript">
                            //<![CDATA[
                                function gotoForum(objSelect){
                                    id = objSelect.options[objSelect.selectedIndex].value;
                                    if(id==0){return top.location.href="index.php?section=Forum&' . \Cx\Core\Csrf\Controller\Csrf::param() . '";}
                                    if(id.indexOf("_cat") > -1){
                                        return top.location.href="index.php?section=Forum&cmd=cat&' . \Cx\Core\Csrf\Controller\Csrf::param() . '&id="+parseInt(id);
                                    }else{
                                        return top.location.href="index.php?section=Forum&cmd=board&' . \Cx\Core\Csrf\Controller\Csrf::param() . '&id="+id;
                                    }
                                }
                            //]]>
                            </script>
                        ';
                break;
            case 'deletePost':
                $strJavaScript = '
                            <script type="text/javascript" language="JavaScript">
                            //<![CDATA[
                                function deletePost(thread_id, post_id){
                                    if(confirm("' . $_ARRAYLANG['TXT_FORUM_CONFIRM_DELETE'] . '\\n' . $_ARRAYLANG['TXT_FORUM_CANNOT_UNDO_OPERATION'] . '")){
                                        window.location.href = "?section=Forum&cmd=thread&' . \Cx\Core\Csrf\Controller\Csrf::param() . '&id="+thread_id+"&act=delete&postid="+post_id;
                                    }
                                }
                            //]]>
                            </script>
                        ';
                break;
            case 'deleteThread':
                $strJavaScript = '
                            <script type="text/javascript" language="JavaScript">
                            //<![CDATA[
                                function deleteThread(category_id, thread_id){
                                    if(confirm("' . $_ARRAYLANG['TXT_FORUM_CONFIRM_DELETE'] . '\\n' . $_ARRAYLANG['TXT_FORUM_CANNOT_UNDO_OPERATION'] . '")){
                                        window.location.href = "?section=Forum&cmd=board&' . \Cx\Core\Csrf\Controller\Csrf::param() . '&id="+category_id+"&act=delete&threadid="+thread_id;
                                    }
                                }
                            //]]>
                            </script>
                        ';
                break;
            case 'notification':
                $strJavaScript = '
                            <script type="text/javascript" language="JavaScript">
                            //<![CDATA[
                                function AddToTheList(from,dest,add,remove){
                                    if(from.selectedIndex < 0){
                                        if(from.options[0] != null){
                                            from.options[0].selected = true;
                                        }
                                        from.focus();
                                        return false;
                                    }else{
                                        for(var i=0; i<from.length; i++){
                                            if (from.options[i].selected){
                                                dest.options[dest.length] = new Option( from.options[i].text, from.options[i].value, false, false);
                                               }
                                        }
                                        for (var i=from.length-1; i>=0; i--){
                                            if (from.options[i].selected){
                                               from.options[i] = null;
                                               }
                                        }
                                    }
                                    disableButtons(from,dest,add,remove);
                                }

                                function RemoveFromTheList(from,dest,add,remove){
                                    if ( dest.selectedIndex < 0){
                                        if (dest.options[0] != null){
                                            dest.options[0].selected = true;
                                        }
                                        dest.focus();
                                        return false;
                                    }else{
                                        for (var i=0; i<dest.options.length; i++){
                                            if (dest.options[i].selected){
                                                from.options[from.options.length] = new Option( dest.options[i].text, dest.options[i].value, false, false);
                                               }
                                        }
                                        for (var i=dest.options.length-1; i>=0; i--){
                                            if (dest.options[i].selected){
                                               dest.options[i] = null;
                                               }
                                        }
                                    }
                                    disableButtons(from,dest,add,remove);
                                }

                                function disableButtons(from,dest,add,remove){
                                    if (from.options.length > 0 ){
                                        add.disabled = 0;
                                    }else{
                                        add.disabled = 1;
                                    }
                                    if (dest.options.length > 0){
                                        remove.disabled = 0;
                                    }else{
                                        remove.disabled = 1;
                                    }
                                }

                                function SelectAllList(CONTROL){
                                    for(var i = 0;i < CONTROL.length;i++){
                                        CONTROL.options[i].selected = true;
                                    }
                                }

                                function DeselectAllList(CONTROL){
                                    for(var i = 0;i < CONTROL.length;i++){
                                        CONTROL.options[i].selected = false;
                                    }
                                }
                            //]]>
                            </script>';
                break;
            case 'insertText':
                $boardId = $data[0];
                $threadId = $data[1];
                $firstPost = $data[2];
                $thanks = $_ARRAYLANG['TXT_FORUM_RATING_THANKS'];
                $confirmClose = $_ARRAYLANG['TXT_FORUM_THREAD_ACTION_CLOSE_CONFIRM_' . $firstPost['is_locked']];
                $confirmSticky = $_ARRAYLANG['TXT_FORUM_THREAD_ACTION_STICKY_CONFIRM_' . $firstPost['is_sticky']];
                $confirmDelete = $_ARRAYLANG['TXT_FORUM_THREAD_ACTION_DELETE_CONFIRM'] . "\\n" . $_ARRAYLANG['TXT_FORUM_CANNOT_UNDO_OPERATION'];
                $allowedExtensions = str_replace(',', ', ', $this->_arrSettings['allowed_extensions']);
                $csrf = \Cx\Core\Csrf\Controller\Csrf::param();
                $strJavaScript = <<<EOJS
<script type="text/javascript" language="JavaScript">
//<![CDATA[

    var doAction = function(action){
        switch(action){
         case 'move':
            location.href = 'index.php?section=Forum&{$csrf}&cmd=thread&thread_actions=move&id={$threadId}';
         break;
         case 'close':
            if(confirm('{$confirmClose}')){
                location.href = 'index.php?section=Forum&{$csrf}&cmd=thread&thread_actions=close&id={$threadId}';
            }
         break;
         case 'delete':
            if(confirm('{$confirmDelete}')){
                location.href = 'index.php?section=Forum&{$csrf}&cmd=board&id={$boardId}&act=delete&threadid={$threadId}';
            }
         break;
         case 'sticky':
            if(confirm('{$confirmSticky}')){
                location.href = 'index.php?section=Forum&{$csrf}&cmd=thread&thread_actions=sticky&id={$threadId}';
            }
         break;
        }
        try{
            document.getElementsByName('thread_actions')[0].options.selectedIndex=0;
        }catch(e){}
    }

    var ratePost = function(postId, delta, obj){
        var d = document;
        var dl=document.location;
        var abs = dl.protocol+'//'+dl.host+dl.href.split(/index\\.php/)[0].split(dl.host)[1]
        var url=abs+'index.php?section=Forum&{$csrf}&cmd=thread&act=rate&value='+delta+'&postId='+postId;
        var i = d.createElement("img");
        i.src = url;
        i.id = 'tmp_Img';
        d.body.appendChild(i);
        d.body.removeChild(d.getElementById(i.id));
        document.getElementById("forum_current_rating_"+postId).innerHTML=document.getElementById("forum_current_rating_"+postId).innerHTML*1+delta;
        document.getElementById("forum_rating_"+postId).innerHTML="{$thanks}";
        x=setTimeout('document.getElementById("forum_rating_'+postId+'").parentNode.removeChild(document.getElementById("forum_rating_'+postId+'"))', 2000);
    }

    var showToolTip = function(txt, node, id){
        d=document;
        oTxt=d.createTextNode(txt);
        oDiv=d.createElement('div');
        oDiv.id=id;
        oDiv.appendChild(oTxt);
        node.parentNode.appendChild(oDiv);
    }

    var hideToolTip = function(id){
        document.getElementById(id).parentNode.removeChild(document.getElementById(id));
    }

    var showAllowedExtensions = function(){
        try{
            forumAllowedExtPopUp = window.open('about:blank', 'forumAllowedExtPopUp', 'menubar=1,directories=0,toolbar=1,resizeable=1,location=1,status=1,scrollbars=1,width=600,height=200');
            //IE
            forumAllowedExtPopUp.document.body.innerHTML = '<div>{$allowedExtensions}</div>';
            //others
            forumAllowedExtPopUp.onload = function(){ //others
                try{
                    forumAllowedExtPopUp.document.body.appendChild(document.createElement('div'));
                    forumAllowedExtPopUp.document.body.childNodes[0].innerHTML = '{$allowedExtensions}';
                }catch(e){}
            }
        //fallback to alert if all else fails
        }catch(e){ alert('{$allowedExtensions}'); }
    }

//]]>
</script>
EOJS;
                break;
            default:
                $strJavaScript = '
                            <script type="text/javascript" language="JavaScript">
                            //<![CDATA[
                                function toggleCategory(categoryId){
                                    objDiv     = document.getElementById("maincat_"+categoryId);
                                    objImg     = document.getElementById("maincat_"+categoryId+"_img");

                                    if (objDiv.style.display == "block") {
                                        objDiv.style.display = "none";
                                        objImg.src = "' . ASCMS_MODULE_WEB_PATH . '/Forum/View/Media/arrow_down.gif";
                                    } else {
                                        objDiv.style.display = "block";
                                        objImg.src = "' . ASCMS_MODULE_WEB_PATH . '/Forum/View/Media/arrow_up.gif";
                                    }
                                 }
                            //]]>
                            </script>
                        ';
                break;
        }
        return $strJavaScript;
    }
 /**
  * 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');
 }
Example #17
0
 /**
  * Shows the image manipulation component.
  *
  * @global  array   $_ARRAYLANG
  * @return  string  Parsed content.
  */
 function editMedia()
 {
     global $_ARRAYLANG;
     $this->_objTpl->loadTemplateFile('module_media_edit.html', true, true);
     $this->pageTitle = $_ARRAYLANG['TXT_MEDIA_EDIT_FILE'];
     if (isset($_GET['saveError']) && $_GET['saveError'] === 'true') {
         $this->_objTpl->setVariable(array('TXT_MEDIA_ERROR_OCCURED' => $_ARRAYLANG['TXT_MEDIA_ERROR_OCCURED'], 'TXT_MEDIA_ERROR_MESSAGE' => $_ARRAYLANG['TXT_MEDIA_CANNOT_SAVE_IMAGE']));
         $this->_objTpl->parse('mediaErrorFile');
         return;
     }
     // Activate cx
     \JS::activate('cx');
     // Activate jQuery and imgAreaSelect
     \JS::activate('jquery');
     \JS::activate('jquery-imgareaselect');
     try {
         // Get quality options from the settings
         $arrImageSettings = $this->getImageSettings();
     } catch (\Exception $e) {
         \DBG::msg('Could not query image settings: ' . $e->getMessage());
     }
     $check = true;
     empty($this->getFile) ? $check = false : '';
     empty($this->getPath) ? $check = false : '';
     !file_exists($this->path . $this->getFile) ? $check = false : '';
     if ($check) {
         // File exists
         $this->_objTpl->setVariable(array('TXT_MEDIA_SAVE' => $_ARRAYLANG['TXT_MEDIA_SAVE'], 'TXT_MEDIA_SAVE_AS' => $_ARRAYLANG['TXT_MEDIA_SAVE_AS'], 'TXT_MEDIA_RESET' => $_ARRAYLANG['TXT_MEDIA_RESET'], 'TXT_MEDIA_PREVIEW' => $_ARRAYLANG['TXT_PREVIEW'], 'MEDIA_EDIT_ACTION' => 'index.php?cmd=Media&amp;archive=' . $this->archive . '&amp;act=editImage&amp;path=' . $this->webPath, 'MEDIA_DIR' => $this->webPath, 'MEDIA_FILE' => $this->getFile));
         $icon = $this->_getIcon($this->path . $this->getFile);
         $info = pathinfo($this->getFile);
         $fileExt = $info['extension'];
         $ext = !empty($fileExt) ? '.' . $fileExt : '';
         $fileName = substr($this->getFile, 0, strlen($this->getFile) - strlen($ext));
         // Icon, file & extension name
         $this->_objTpl->setVariable(array('MEDIA_FILE_ICON' => self::_getIconWebPath() . $icon . '.png', 'MEDIA_FILE_DIR' => $this->webPath, 'MEDIA_FILE_NAME' => $fileName, 'MEDIA_FILE_EXT' => $fileExt));
         // Edit image
         $imageSize = @getimagesize($this->path . $this->getFile);
         $this->_objTpl->setVariable(array('TXT_MEDIA_IMAGE_MANIPULATION' => $_ARRAYLANG['TXT_MEDIA_IMAGE_MANIPULATION'], 'TXT_MEDIA_WIDTH' => $_ARRAYLANG['TXT_MEDIA_WIDTH'], 'TXT_MEDIA_HEIGHT' => $_ARRAYLANG['TXT_MEDIA_HEIGHT'], 'TXT_MEDIA_BALANCE' => $_ARRAYLANG['TXT_MEDIA_BALANCE'], 'TXT_MEDIA_QUALITY' => $_ARRAYLANG['TXT_MEDIA_QUALITY'], 'TXT_MEDIA_SAVE' => $_ARRAYLANG['TXT_MEDIA_SAVE'], 'TXT_MEDIA_RESET' => $_ARRAYLANG['TXT_MEDIA_RESET'], 'TXT_MEDIA_SET_IMAGE_NAME' => $_ARRAYLANG['TXT_MEDIA_SET_IMAGE_NAME'], 'TXT_MEDIA_CONFIRM_REPLACE_IMAGE' => $_ARRAYLANG['TXT_MEDIA_CONFIRM_REPLACE_IMAGE'], 'TXT_MEDIA_REPLACE' => $_ARRAYLANG['TXT_MEDIA_REPLACE'], 'TXT_MEDIA_OR' => $_ARRAYLANG['TXT_MEDIA_OR'], 'TXT_MEDIA_SAVE_NEW_COPY' => $_ARRAYLANG['TXT_MEDIA_SAVE_NEW_COPY'], 'TXT_MEDIA_CROP' => $_ARRAYLANG['TXT_MEDIA_CROP'], 'TXT_MEDIA_CROP_INFO' => $_ARRAYLANG['TXT_MEDIA_CROP_INFO'], 'TXT_MEDIA_CANCEL' => $_ARRAYLANG['TXT_MEDIA_CANCEL'], 'TXT_MEDIA_ROTATE' => $_ARRAYLANG['TXT_MEDIA_ROTATE'], 'TXT_MEDIA_ROTATE_INFO' => $_ARRAYLANG['TXT_MEDIA_ROTATE_INFO'], 'TXT_MEDIA_SCALE_COMPRESS' => $_ARRAYLANG['TXT_MEDIA_SCALE_COMPRESS'], 'TXT_MEDIA_SCALE_INFO' => $_ARRAYLANG['TXT_MEDIA_SCALE_INFO'], 'TXT_MEDIA_PREVIEW' => $_ARRAYLANG['TXT_MEDIA_PREVIEW'], 'MEDIA_IMG_WIDTH' => $imageSize[0], 'MEDIA_IMG_HEIGHT' => $imageSize[1]));
         foreach ($this->arrImageQualityValues as $value) {
             $this->_objTpl->setVariable(array('IMAGE_QUALITY_VALUE' => $value, 'IMAGE_QUALITY_OPTION_CHECKED' => $value == $arrImageSettings['image_compression'] ? 'selected="selected"' : ''));
             $this->_objTpl->parse('mediaEditImageQualityOptions');
         }
         $this->_objTpl->parse('mediaEditImage');
     } else {
         // File doesn't exist
         $this->_objTpl->setVariable(array('TXT_MEDIA_ERROR_OCCURED' => $_ARRAYLANG['TXT_MEDIA_ERROR_OCCURED'], 'TXT_MEDIA_ERROR_MESSAGE' => $_ARRAYLANG['TXT_MEDIA_FILE_DONT_EXISTS']));
         $this->_objTpl->parse('mediaErrorFile');
     }
     // Variables
     $this->_objTpl->setVariable(array('CSRF' => \Cx\Core\Csrf\Controller\Csrf::param(), 'MEDIA_EDIT_AJAX_ACTION' => 'index.php?cmd=Media&archive=' . $this->archive . '&act=editImage&path=' . $this->webPath, 'MEDIA_EDIT_REDIRECT' => 'index.php?cmd=Media&archive=' . $this->archive . '&path=' . $this->webPath, 'MEDIA_BACK_HREF' => 'index.php?cmd=Media&amp;archive=' . $this->archive . '&amp;path=' . $this->webPath, 'MEDIA_FILE_IMAGE_SRC' => 'index.php?cmd=Media&archive=' . $this->archive . '&act=getImage&path=' . $this->webPath . '&file=' . $this->getFile . '&' . \Cx\Core\Csrf\Controller\Csrf::param(), 'MEDIA_IMAGE_WIDTH' => !empty($imageSize) ? intval($imageSize[0]) : 0, 'MEDIA_IMAGE_HEIGHT' => !empty($imageSize) ? intval($imageSize[1]) : 0, 'MEDIA_IMAGE_CROP_WIDTH' => $arrImageSettings['image_cut_width'], 'MEDIA_IMAGE_CROP_HEIGHT' => $arrImageSettings['image_cut_height'], 'MEDIA_IMAGE_RESIZE_QUALITY' => $arrImageSettings['image_compression']));
 }
 /**
  * Show all the Domain Alias
  * 
  * @global array $_ARRAYLANG
  */
 public function showDomains()
 {
     global $_ARRAYLANG, $objInit;
     $langData = $objInit->loadLanguageData('Config');
     $_ARRAYLANG = array_merge($_ARRAYLANG, $langData);
     $domainRepository = new \Cx\Core\Net\Model\Repository\DomainRepository();
     $domains = $domainRepository->findAll();
     $view = new \Cx\Core\Html\Controller\ViewGenerator($domains, array('header' => $_ARRAYLANG['TXT_CORE_NETMANAGER'], 'entityName' => $_ARRAYLANG['TXT_CORE_NETMANAGER_ENTITY'], 'fields' => array('name' => array('header' => $_ARRAYLANG['TXT_NAME'], 'table' => array('parse' => function ($value) {
         global $_ARRAYLANG;
         static $mainDomainName;
         if (empty($mainDomainName)) {
             $domainRepository = new \Cx\Core\Net\Model\Repository\DomainRepository();
             $mainDomainName = $domainRepository->getMainDomain()->getName();
         }
         $domainName = contrexx_raw2xhtml(\Cx\Core\Net\Controller\ComponentController::convertIdnToUtf8Format($value));
         if ($domainName != contrexx_raw2xhtml($value)) {
             $domainName .= ' (' . contrexx_raw2xhtml($value) . ')';
         }
         $mainDomainIcon = '';
         if ($value == $mainDomainName) {
             $mainDomainIcon = ' <img src="' . \Env::get('cx')->getCodeBaseCoreWebPath() . '/Core/View/Media/icons/Home.png" title="' . $_ARRAYLANG['TXT_CORE_CONFIG_MAINDOMAINID'] . '" />';
         }
         return $domainName . $mainDomainIcon;
     }), 'formfield' => function ($fieldname, $fieldtype, $fieldlength, $fieldvalue, $fieldoptions) {
         return \Cx\Core\Net\Controller\ComponentController::convertIdnToUtf8Format($fieldvalue);
     }), 'id' => array('showOverview' => false)), 'functions' => array('add' => true, 'edit' => false, 'allowEdit' => true, 'delete' => false, 'allowDelete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false, 'actions' => function ($rowData, $rowId) {
         global $_CORELANG;
         static $mainDomainName;
         if (empty($mainDomainName)) {
             $domainRepository = new \Cx\Core\Net\Model\Repository\DomainRepository();
             $mainDomainName = $domainRepository->getMainDomain()->getName();
         }
         preg_match_all('/\\d+/', $rowId, $ids, null, 0);
         $actionIcons = '';
         $csrfParams = \Cx\Core\Csrf\Controller\Csrf::param();
         if ($mainDomainName !== $rowData['name']) {
             $actionIcons = '<a href="' . \Env::get('cx')->getWebsiteBackendPath() . '/?cmd=NetManager&amp;editid=' . $rowId . '" class="edit" title="Edit entry"></a>';
             $actionIcons .= '<a onclick=" if(confirm(\'' . $_CORELANG['TXT_CORE_RECORD_DELETE_CONFIRM'] . '\'))window.location.replace(\'' . \Env::get('cx')->getWebsiteBackendPath() . '/?cmd=NetManager&amp;deleteid=' . (empty($ids[0][1]) ? 0 : $ids[0][1]) . '&amp;vg_increment_number=' . (empty($ids[0][0]) ? 0 : $ids[0][0]) . '&amp;' . $csrfParams . '\');" href="javascript:void(0);" class="delete" title="Delete entry"></a>';
         }
         return $actionIcons;
     })));
     $this->template->setVariable('DOMAINS_CONTENT', $view->render());
 }