/**
  * @override
  */
 public function getXHtml($backend = false)
 {
     global $objInit;
     $uploadPath = $this->getUploadPath('jump');
     $tpl = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/Upload/template/uploaders');
     $tpl->setErrorHandling(PEAR_ERROR_DIE);
     $tpl->loadTemplateFile('jump.html');
     $basePath = 'index.php?';
     $basePath .= $this->isBackendRequest ? 'cmd=Upload&act' : 'section=Upload&cmd';
     //act and cmd vary
     $appletPath = $basePath . '=jumpUploaderApplet';
     $l10nPath = $basePath . '=jumpUploaderL10n';
     $langId;
     if (!$this->isBackendRequest) {
         $langId = $objInit->getFrontendLangId();
     } else {
         //backend
         $langId = $objInit->getBackendLangId();
     }
     $langCode = \FWLanguage::getLanguageCodeById($langId);
     if (!file_exists(ASCMS_CORE_MODULE_PATH . '/Upload/ressources/uploaders/jump/messages_' . $langCode . '.zip')) {
         $langCode = 'en';
     }
     $l10nPath .= '&lang=' . $langCode;
     $tpl->setVariable('UPLOAD_CHUNK_LENGTH', \FWSystem::getMaxUploadFileSize() - 1000);
     $tpl->setVariable('UPLOAD_APPLET_URL', $appletPath);
     $tpl->setVariable('UPLOAD_LANG_URL', $l10nPath);
     $tpl->setVariable('UPLOAD_URL', $uploadPath);
     $tpl->setVariable('UPLOAD_ID', $this->uploadId);
     return $tpl->get();
 }
 /**
  * Gets the XHTML to display the widget.
  * @param string $containerSelector a jQuery selector defining the element
  *                                  where the widget should be put into.
  */
 public function getXhtml($containerSelector, $instanceName)
 {
     \JS::registerJS('core_modules/Upload/js/folderWidget.js');
     $tpl = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/Upload/template/');
     $tpl->setErrorHandling(PEAR_ERROR_DIE);
     $tpl->loadTemplateFile('folderWidget.html');
     $tpl->setVariable('ID', $this->id);
     //from where the combouploader gets the code on an uploader switch
     $cmdOrSection = $this->isBackendRequest ? 'cmd' : 'section';
     $actOrCmd = $this->isBackendRequest ? 'act' : 'cmd';
     $refreshUrl = ($this->isBackendRequest ? ASCMS_ADMIN_WEB_PATH : ASCMS_PATH_OFFSET) . \Env::get('virtualLanguageDirectory') . '/index.php?' . $cmdOrSection . '=Upload&' . $actOrCmd . '=refreshFolder';
     $deleteUrl = ($this->isBackendRequest ? ASCMS_ADMIN_WEB_PATH : ASCMS_PATH_OFFSET) . \Env::get('virtualLanguageDirectory') . '/index.php?' . $cmdOrSection . '=Upload&' . $actOrCmd . '=deleteFile';
     \ContrexxJavascript::getInstance()->setVariable(array('refreshUrl' => $refreshUrl, 'deleteUrl' => $deleteUrl, 'files' => $this->getFilesJSON(), 'containerSelector' => $containerSelector, 'instanceName' => $instanceName), 'upload/folderWidget_' . $this->id);
     return $tpl->get();
 }
 /**
  * Gets the requested methods
  *
  * @global   array
  * @global   \Cx\Core\Html\Sigma
  * @return   string    Parsed content
  */
 function getLanguagePage()
 {
     global $_CORELANG, $objTemplate;
     if (!isset($_GET['act'])) {
         $_GET['act'] = "";
     }
     switch ($_GET['act']) {
         case 'dellang':
             \Permission::checkAccess(49, 'static');
             $this->deleteLanguage();
             $this->languageOverview();
             break;
         case 'vars':
             $this->listVariables();
             break;
         case 'varOfId':
             $this->_getVarOfId();
             break;
         case 'mod':
             \Permission::checkAccess(48, 'static');
             $this->addUpdateVariable();
             $this->modifyVariables();
             break;
         case 'add':
             \Permission::checkAccess(50, 'static');
             $this->addLanguage();
             $this->languageOverview();
             break;
         case 'del':
             \Permission::checkAccess(48, 'static');
             $this->deleteVariable();
             $this->listVariables();
             break;
         case 'writefiles':
             \Permission::checkAccess(48, 'static');
             $this->createFiles();
             $this->listVariables();
             break;
         default:
             \Permission::checkAccess(50, 'static');
             $this->modifyLanguage();
             $this->languageOverview();
     }
     $objTemplate->setVariable(array('CONTENT_TITLE' => $this->pageTitle, 'CONTENT_OK_MESSAGE' => $this->strOkMessage, 'CONTENT_STATUS_MESSAGE' => $this->strErrMessage, 'ADMIN_CONTENT' => $this->template->get()));
     $this->act = $_GET['act'];
     $this->setNavigation();
 }
 /**
  * @override
  */
 public function getXHtml()
 {
     global $_CORELANG;
     // CSS dependencies
     \JS::activate('cx');
     $uploadPath = $this->getUploadPath('pl');
     $tpl = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/Upload/template/uploaders');
     $tpl->setErrorHandling(PEAR_ERROR_DIE);
     $tpl->loadTemplateFile('pl.html');
     $tpl->setVariable('UPLOAD_FLASH_URL', ASCMS_CORE_MODULE_WEB_PATH . '/Upload/ressources/uploaders/pl/plupload.flash.swf');
     $tpl->setVariable('UPLOAD_CHUNK_LENGTH', \FWSystem::getLiteralSizeFormat(\FWSystem::getMaxUploadFileSize() - 1000));
     $tpl->setVariable('UPLOAD_URL', $uploadPath);
     $tpl->setVariable('UPLOAD_ID', $this->uploadId);
     //I18N
     $tpl->setVariable(array('UPLOAD' => $_CORELANG['UPLOAD'], 'OTHER_UPLOADERS' => $_CORELANG['OTHER_UPLOADERS'], 'FORM_UPLOADER' => $_CORELANG['FORM_UPLOADER'], 'PL_UPLOADER' => $_CORELANG['PL_UPLOADER'], 'JUMP_UPLOADER' => $_CORELANG['JUMP_UPLOADER'], 'SELECT_FILES' => $_CORELANG['SELECT_FILES'], 'ADD_INSTRUCTIONS' => $_CORELANG['ADD_INSTRUCTIONS'], 'FILENAME' => $_CORELANG['FILENAME'], 'STATUS' => $_CORELANG['STATUS'], 'SIZE' => $_CORELANG['SIZE'], 'ADD_FILES' => $_CORELANG['ADD_FILES'], 'STOP_CURRENT_UPLOAD' => $_CORELANG['STOP_CURRENT_UPLOAD'], 'DRAG_FILES_HERE' => $_CORELANG['DRAG_FILES_HERE']));
     return $tpl->get();
 }
 protected function actRenderCM()
 {
     global $_ARRAYLANG, $_CORELANG, $_CONFIG;
     \JS::activate('jqueryui');
     \JS::activate('cx');
     \JS::activate('ckeditor');
     \JS::activate('cx-form');
     \JS::activate('jstree');
     \JS::registerJS('lib/javascript/lock.js');
     \JS::registerJS('lib/javascript/jquery/jquery.history.max.js');
     // this can be used to debug the tree, just add &tree=verify or &tree=fix
     $tree = null;
     if (isset($_GET['tree'])) {
         $tree = contrexx_input2raw($_GET['tree']);
     }
     if ($tree == 'verify') {
         echo '<pre>';
         print_r($this->nodeRepository->verify());
         echo '</pre>';
     } else {
         if ($tree == 'fix') {
             // this should print "bool(true)"
             var_dump($this->nodeRepository->recover());
         }
     }
     $objCx = \ContrexxJavascript::getInstance();
     $themeRepo = new \Cx\Core\View\Model\Repository\ThemeRepository();
     $defaultTheme = $themeRepo->getDefaultTheme();
     $objCx->setVariable('themeId', $defaultTheme->getId(), 'contentmanager/theme');
     foreach ($themeRepo->findAll() as $theme) {
         if ($theme == $defaultTheme) {
             $objCx->setVariable('themeName', $theme->getFoldername(), 'contentmanager/theme');
         }
     }
     $this->template->addBlockfile('ADMIN_CONTENT', 'content_manager', 'Skeleton.html');
     // user has no permission to create new page, hide navigation item in admin navigation
     if (!\Permission::checkAccess(127, 'static', true)) {
         $this->template->hideBlock('content_manager_create_new_page_navigation_item');
     }
     $this->template->touchBlock('content_manager');
     $this->template->addBlockfile('CONTENT_MANAGER_MEAT', 'content_manager_meat', 'Page.html');
     $this->template->touchBlock('content_manager_meat');
     if (\Permission::checkAccess(78, 'static', true)) {
         \JS::registerCode("var publishAllowed = true;");
     } else {
         \JS::registerCode("var publishAllowed = false;");
     }
     if (\Permission::checkAccess(78, 'static', true) && \Permission::checkAccess(115, 'static', true)) {
         \JS::registerCode("var aliasManagementAllowed = true;");
         $alias_permission = "block";
         $alias_denial = "none !important";
     } else {
         \JS::registerCode("var aliasManagementAllowed = false;");
         $alias_permission = "none !important";
         $alias_denial = "block";
     }
     $mediaBrowser = new MediaBrowser();
     $mediaBrowser->setCallback('target_page_callback');
     $mediaBrowser->setOptions(array('type' => 'button', 'data-cx-mb-views' => 'sitestructure', 'id' => 'page_target_browse'));
     $mediaBrowserCkeditor = new MediaBrowser();
     $mediaBrowserCkeditor->setCallback('ckeditor_image_callback');
     $mediaBrowserCkeditor->setOptions(array('id' => 'ckeditor_image_button', 'type' => 'button', 'style' => 'display:none'));
     $this->template->setVariable(array('MEDIABROWSER_BUTTON' => $mediaBrowser->getXHtml($_ARRAYLANG['TXT_CORE_CM_BROWSE']), 'MEDIABROWSER_BUTTON_CKEDITOR' => $mediaBrowserCkeditor->getXHtml($_ARRAYLANG['TXT_CORE_CM_BROWSE'])));
     $this->template->setVariable(array('ALIAS_PERMISSION' => $alias_permission, 'ALIAS_DENIAL' => $alias_denial, 'CONTREXX_BASE_URL' => ASCMS_PROTOCOL . '://' . $_CONFIG['domainUrl'] . ASCMS_PATH_OFFSET . '/', 'CONTREXX_LANG' => \FWLanguage::getLanguageCodeById(BACKEND_LANG_ID)));
     global $_CORELANG;
     $this->template->setVariable($_CORELANG);
     $objCx->setVariable('TXT_CORE_CM_VIEW', $_CORELANG['TXT_CORE_CM_VIEW'], 'contentmanager/lang');
     $objCx->setVariable('TXT_CORE_CM_ACTIONS', $_CORELANG['TXT_CORE_CM_ACTIONS'], 'contentmanager/lang');
     $objCx->setVariable('TXT_CORE_CM_VALIDATION_FAIL', $_CORELANG['TXT_CORE_CM_VALIDATION_FAIL'], 'contentmanager/lang');
     $objCx->setVariable('TXT_CORE_CM_HOME_FAIL', $_CORELANG['TXT_CORE_CM_HOME_FAIL'], 'contentmanager/lang');
     $arrLangVars = array('actions' => array('new' => 'TXT_CORE_CM_ACTION_NEW', 'copy' => 'TXT_CORE_CM_ACTION_COPY', 'activate' => 'TXT_CORE_CM_ACTION_PUBLISH', 'deactivate' => 'TXT_CORE_CM_ACTION_UNPUBLISH', 'publish' => 'TXT_CORE_CM_ACTION_PUBLISH_DRAFT', 'show' => 'TXT_CORE_CM_ACTION_SHOW', 'hide' => 'TXT_CORE_CM_ACTION_HIDE', 'delete' => 'TXT_CORE_CM_ACTION_DELETE', 'recursiveQuestion' => 'TXT_CORE_CM_RECURSIVE_QUESTION'), 'tooltip' => array('TXT_CORE_CM_LAST_MODIFIED' => 'TXT_CORE_CM_LAST_MODIFIED', 'TXT_CORE_CM_PUBLISHING_INFO_STATUSES' => 'TXT_CORE_CM_PUBLISHING_INFO_STATUSES', 'TXT_CORE_CM_PUBLISHING_INFO_ACTION_ACTIVATE' => 'TXT_CORE_CM_PUBLISHING_INFO_ACTION_ACTIVATE', 'TXT_CORE_CM_PUBLISHING_INFO_ACTION_DEACTIVATE' => 'TXT_CORE_CM_PUBLISHING_INFO_ACTION_DEACTIVATE', 'TXT_CORE_CM_PUBLISHING_DRAFT' => 'TXT_CORE_CM_PUBLISHING_DRAFT', 'TXT_CORE_CM_PUBLISHING_DRAFT_WAITING' => 'TXT_CORE_CM_PUBLISHING_DRAFT_WAITING', 'TXT_CORE_CM_PUBLISHING_LOCKED' => 'TXT_CORE_CM_PUBLISHING_LOCKED', 'TXT_CORE_CM_PUBLISHING_PUBLISHED' => 'TXT_CORE_CM_PUBLISHING_PUBLISHED', 'TXT_CORE_CM_PUBLISHING_UNPUBLISHED' => 'TXT_CORE_CM_PUBLISHING_UNPUBLISHED', 'TXT_CORE_CM_PAGE_INFO_STATUSES' => 'TXT_CORE_CM_PAGE_INFO_STATUSES', 'TXT_CORE_CM_PUBLISHING_INFO_TYPES' => 'TXT_CORE_CM_PUBLISHING_INFO_TYPES', 'TXT_CORE_CM_PAGE_INFO_ACTION_SHOW' => 'TXT_CORE_CM_PAGE_INFO_ACTION_SHOW', 'TXT_CORE_CM_PAGE_INFO_ACTION_HIDE' => 'TXT_CORE_CM_PAGE_INFO_ACTION_HIDE', 'TXT_CORE_CM_PAGE_STATUS_BROKEN' => 'TXT_CORE_CM_PAGE_STATUS_BROKEN', 'TXT_CORE_CM_PAGE_STATUS_VISIBLE' => 'TXT_CORE_CM_PAGE_STATUS_VISIBLE', 'TXT_CORE_CM_PAGE_STATUS_INVISIBLE' => 'TXT_CORE_CM_PAGE_STATUS_INVISIBLE', 'TXT_CORE_CM_PAGE_STATUS_PROTECTED' => 'TXT_CORE_CM_PAGE_STATUS_PROTECTED', 'TXT_CORE_CM_PAGE_TYPE_HOME' => 'TXT_CORE_CM_PAGE_TYPE_HOME', 'TXT_CORE_CM_PAGE_TYPE_CONTENT_SITE' => 'TXT_CORE_CM_PAGE_TYPE_CONTENT_SITE', 'TXT_CORE_CM_PAGE_TYPE_APPLICATION' => 'TXT_CORE_CM_PAGE_TYPE_APPLICATION', 'TXT_CORE_CM_PAGE_TYPE_REDIRECTION' => 'TXT_CORE_CM_PAGE_TYPE_REDIRECTION', 'TXT_CORE_CM_PAGE_TYPE_SYMLINK' => 'TXT_CORE_CM_PAGE_TYPE_SYMLINK', 'TXT_CORE_CM_PAGE_TYPE_FALLBACK' => 'TXT_CORE_CM_PAGE_TYPE_FALLBACK', 'TXT_CORE_CM_PAGE_MOVE_INFO' => 'TXT_CORE_CM_PAGE_MOVE_INFO', 'TXT_CORE_CM_TRANSLATION_INFO' => 'TXT_CORE_CM_TRANSLATION_INFO', 'TXT_CORE_CM_PREVIEW_INFO' => 'TXT_CORE_CM_PREVIEW_INFO'));
     foreach ($arrLangVars as $subscope => $arrLang) {
         foreach ($arrLang as $name => $value) {
             $objCx->setVariable($name, $_CORELANG[$value], 'contentmanager/lang/' . $subscope);
         }
     }
     // Mediabrowser
     $mediaBrowser = new \Cx\Core_Modules\MediaBrowser\Model\Entity\MediaBrowser();
     $mediaBrowser->setOptions(array('type' => 'button'));
     $mediaBrowser->setCallback('setWebPageUrlCallback');
     $mediaBrowser->setOptions(array('data-cx-mb-startview' => 'sitestructure', 'id' => 'page_target_browse'));
     $this->template->setVariable(array('CM_MEDIABROWSER_BUTTON' => $mediaBrowser->getXHtml($_ARRAYLANG['TXT_CORE_CM_BROWSE'])));
     $toggleTitles = !empty($_SESSION['contentManager']['toggleStatuses']['toggleTitles']) ? $_SESSION['contentManager']['toggleStatuses']['toggleTitles'] : 'block';
     $toggleType = !empty($_SESSION['contentManager']['toggleStatuses']['toggleType']) ? $_SESSION['contentManager']['toggleStatuses']['toggleType'] : 'block';
     $toggleNavigation = !empty($_SESSION['contentManager']['toggleStatuses']['toggleNavigation']) ? $_SESSION['contentManager']['toggleStatuses']['toggleNavigation'] : 'block';
     $toggleBlocks = !empty($_SESSION['contentManager']['toggleStatuses']['toggleBlocks']) ? $_SESSION['contentManager']['toggleStatuses']['toggleBlocks'] : 'block';
     $toggleThemes = !empty($_SESSION['contentManager']['toggleStatuses']['toggleThemes']) ? $_SESSION['contentManager']['toggleStatuses']['toggleThemes'] : 'block';
     $toggleApplication = !empty($_SESSION['contentManager']['toggleStatuses']['toggleApplication']) ? $_SESSION['contentManager']['toggleStatuses']['toggleApplication'] : 'block';
     $toggleSidebar = !empty($_SESSION['contentManager']['toggleStatuses']['sidebar']) ? $_SESSION['contentManager']['toggleStatuses']['sidebar'] : 'block';
     $objCx->setVariable('toggleTitles', $toggleTitles, 'contentmanager/toggle');
     $objCx->setVariable('toggleType', $toggleType, 'contentmanager/toggle');
     $objCx->setVariable('toggleNavigation', $toggleNavigation, 'contentmanager/toggle');
     $objCx->setVariable('toggleBlocks', $toggleBlocks, 'contentmanager/toggle');
     $objCx->setVariable('toggleThemes', $toggleThemes, 'contentmanager/toggle');
     $objCx->setVariable('toggleApplication', $toggleApplication, 'contentmanager/toggle');
     $objCx->setVariable('sidebar', $toggleSidebar, 'contentmanager/toggle');
     // get initial tree data
     $objJsonData = new \Cx\Core\Json\JsonData();
     $treeData = $objJsonData->jsondata('node', 'getTree', array('get' => $_GET), false);
     $objCx->setVariable('tree-data', $treeData, 'contentmanager/tree');
     if (!empty($_GET['act']) && $_GET['act'] == 'new') {
         $this->template->setVariable(array('TITLES_DISPLAY_STYLE' => 'display: block;', 'TITLES_TOGGLE_CLASS' => 'open', 'TYPE_DISPLAY_STYLE' => 'display: block;', 'TYPE_TOGGLE_CLASS' => 'open', 'NAVIGATION_DISPLAY_STYLE' => 'display: block;', 'NAVIGATION_TOGGLE_CLASS' => 'open', 'BLOCKS_DISPLAY_STYLE' => 'display: block;', 'BLOCKS_TOGGLE_CLASS' => 'open', 'THEMES_DISPLAY_STYLE' => 'display: block;', 'THEMES_TOGGLE_CLASS' => 'open', 'APPLICATION_DISPLAY_STYLE' => 'display: block;', 'APPLICATION_TOGGLE_CLASS' => 'open', 'MULTIPLE_ACTIONS_STRIKE_STYLE' => 'display: none;'));
     } else {
         $this->template->setVariable(array('TITLES_DISPLAY_STYLE' => $toggleTitles == 'none' ? 'display: none;' : 'display: block;', 'TITLES_TOGGLE_CLASS' => $toggleTitles == 'none' ? 'closed' : 'open', 'TYPE_DISPLAY_STYLE' => $toggleType == 'none' ? 'display: none;' : 'display: block;', 'TYPE_TOGGLE_CLASS' => $toggleType == 'none' ? 'closed' : 'open', 'NAVIGATION_DISPLAY_STYLE' => $toggleNavigation == 'none' ? 'display: none;' : 'display: block;', 'NAVIGATION_TOGGLE_CLASS' => $toggleNavigation == 'none' ? 'closed' : 'open', 'BLOCKS_DISPLAY_STYLE' => $toggleBlocks == 'none' ? 'display: none;' : 'display: block;', 'BLOCKS_TOGGLE_CLASS' => $toggleBlocks == 'none' ? 'closed' : 'open', 'THEMES_DISPLAY_STYLE' => $toggleThemes == 'none' ? 'display: none;' : 'display: block;', 'THEMES_TOGGLE_CLASS' => $toggleThemes == 'none' ? 'closed' : 'open', 'APPLICATION_DISPLAY_STYLE' => $toggleApplication == 'none' ? 'display: none;' : 'display: block;', 'APPLICATION_TOGGLE_CLASS' => $toggleApplication == 'none' ? 'closed' : 'open'));
     }
     $modules = $this->db->Execute("SELECT * FROM " . DBPREFIX . "modules WHERE `status` = 'y' ORDER BY `name`");
     while (!$modules->EOF) {
         $this->template->setVariable('MODULE_KEY', $modules->fields['name']);
         //            $this->template->setVariable('MODULE_TITLE', $_CORELANG[$modules->fields['description_variable']]);
         $this->template->setVariable('MODULE_TITLE', ucwords($modules->fields['name']));
         $this->template->parse('module_option');
         $modules->MoveNext();
     }
     $newPageFirstLevel = isset($_GET['act']) && $_GET['act'] == 'new';
     if (\Permission::checkAccess(36, 'static', true)) {
         $this->template->touchBlock('page_permissions_tab');
         $this->template->touchBlock('page_permissions');
     } else {
         $this->template->hideBlock('page_permissions_tab');
         $this->template->hideBlock('page_permissions');
     }
     //show the caching options only if the caching system is actually active
     if ($_CONFIG['cacheEnabled'] == 'on') {
         $this->template->touchBlock('show_caching_option');
     } else {
         $this->template->hideBlock('show_caching_option');
     }
     if (\Permission::checkAccess(78, 'static', true)) {
         $this->template->hideBlock('release_button');
     } else {
         $this->template->hideBlock('publish_button');
         $this->template->hideBlock('refuse_button');
     }
     // show no access page if the user wants to create new page in first level but he does not have enough permissions
     if ($newPageFirstLevel) {
         \Permission::checkAccess(127, 'static');
     }
     $editViewCssClass = '';
     if ($newPageFirstLevel) {
         $editViewCssClass = 'edit_view';
         $this->template->hideBlock('refuse_button');
     }
     $cxjs = \ContrexxJavascript::getInstance();
     $cxjs->setVariable('confirmDeleteQuestion', $_ARRAYLANG['TXT_CORE_CM_CONFIRM_DELETE'], 'contentmanager/lang');
     $cxjs->setVariable('cleanAccessData', $objJsonData->jsondata('page', 'getAccessData', array(), false), 'contentmanager');
     $cxjs->setVariable('contentTemplates', $this->getCustomContentTemplates(), 'contentmanager');
     $cxjs->setVariable('defaultTemplates', $this->getDefaultTemplates(), 'contentmanager/themes');
     $cxjs->setVariable('templateFolders', $this->getTemplateFolders(), 'contentmanager/themes');
     $cxjs->setVariable('availableBlocks', $objJsonData->jsondata('Block', 'getBlocks', array(), false), 'contentmanager');
     // TODO: move including of add'l JS dependencies to cx obj from /cadmin/index.html
     $getLangOptions = $this->getLangOptions();
     $statusPageLayout = '';
     $languageDisplay = '';
     if ((!empty($_GET['act']) && $_GET['act'] == 'new' || !empty($_GET['page'])) && $getLangOptions == "") {
         $statusPageLayout = 'margin0';
         $languageDisplay = 'display:none';
     }
     $this->template->setVariable('ADMIN_LIST_MARGIN', $statusPageLayout);
     $this->template->setVariable('LANGUAGE_DISPLAY', $languageDisplay);
     // TODO: move including of add'l JS dependencies to cx obj from /cadmin/index.html
     $this->template->setVariable('SKIN_OPTIONS', $this->getSkinOptions());
     $this->template->setVariable('LANGSWITCH_OPTIONS', $this->getLangOptions());
     $this->template->setVariable('LANGUAGE_ARRAY', json_encode($this->getLangArray()));
     $this->template->setVariable('FALLBACK_ARRAY', json_encode($this->getFallbackArray()));
     $this->template->setVariable('LANGUAGE_LABELS', json_encode($this->getLangLabels()));
     $this->template->setVariable('EDIT_VIEW_CSS_CLASS', $editViewCssClass);
     $this->template->touchBlock('content_manager_language_selection');
     $editmodeTemplate = new \Cx\Core\Html\Sigma(ASCMS_CORE_PATH . '/ContentManager/View/Template/Backend');
     $editmodeTemplate->loadTemplateFile('content_editmode.html');
     $editmodeTemplate->setVariable(array('TXT_EDITMODE_TEXT' => $_CORELANG['TXT_FRONTEND_EDITING_SELECTION_TEXT'], 'TXT_EDITMODE_CODE' => $_CORELANG['TXT_FRONTEND_EDITING_SELECTION_MODE_PAGE'], 'TXT_EDITMODE_CONTENT' => $_CORELANG['TXT_FRONTEND_EDITING_SELECTION_MODE_CONTENT']));
     $cxjs->setVariable(array('editmodetitle' => $_CORELANG['TXT_FRONTEND_EDITING_SELECTION_TITLE'], 'editmodecontent' => $editmodeTemplate->get(), 'ckeditorconfigpath' => substr(\Env::get('ClassLoader')->getFilePath(ASCMS_CORE_PATH . '/Wysiwyg/ckeditor.config.js.php'), strlen(ASCMS_DOCUMENT_ROOT) + 1), 'regExpUriProtocol' => \FWValidator::REGEX_URI_PROTO, 'contrexxBaseUrl' => ASCMS_PROTOCOL . '://' . $_CONFIG['domainUrl'] . ASCMS_PATH_OFFSET . '/', 'contrexxPathOffset' => ASCMS_PATH_OFFSET), 'contentmanager');
 }
 /**
  * get crm module placeholders
  *
  * @return array
  */
 function getCrmModulePlaceHolders()
 {
     global $_ARRAYLANG;
     $objTemplate = new \Cx\Core\Html\Sigma(\Cx\Core\Core\Controller\Cx::instanciate()->getCodeBaseModulePath() . '/' . $this->moduleName . '/View/Template/Backend');
     $objTemplate->setErrorHandling(PEAR_ERROR_DIE);
     if (!$objTemplate->loadTemplateFile('module_' . $this->moduleNameLC . '_settings_placeholders.html')) {
         die("Failed to load template 'module_'.{$this->moduleNameLC}.'_settings_placeholders.html'");
     }
     $objTemplate->setVariable(array('TXT_CRM_PLACEHOLDERS' => $_ARRAYLANG['TXT_CRM_PLACEHOLDERS'], 'TXT_CRM_GENERAL' => $_ARRAYLANG['TXT_CRM_GENERAL'], 'TXT_CRM_MAIL_TEMPLATE_ONE' => CRM_EVENT_ON_ACCOUNT_UPDATED, 'TXT_CRM_MAIL_TEMPLATE_TWO' => CRM_EVENT_ON_USER_ACCOUNT_CREATED, 'TXT_CRM_MAIL_TEMPLATE_THREE' => CRM_EVENT_ON_TASK_CREATED, 'TXT_CRM_ASSIGNED_USER_EMAIL' => $_ARRAYLANG['TXT_CRM_ASSIGNED_USER_EMAIL'], 'TXT_CRM_ASSIGNED_USER_NAME' => $_ARRAYLANG['TXT_CRM_ASSIGNED_USER_NAME'], 'TXT_CRM_CONTACT_DETAILS_LINK' => $_ARRAYLANG['TXT_CRM_CONTACT_DETAILS_LINK'], 'TXT_CRM_CONTACT_DETAILS_URL' => $_ARRAYLANG['TXT_CRM_CONTACT_DETAILS_URL'], 'TXT_CRM_TASK_NAME' => $_ARRAYLANG['TXT_CRM_TASK_NAME'], 'TXT_CRM_DOMAIN' => $_ARRAYLANG['TXT_CRM_DOMAIN'], 'TXT_CRM_TASK_LINK' => $_ARRAYLANG['TXT_CRM_TASK_LINK'], 'TXT_CRM_TASK_LINK_SOURCE' => $_ARRAYLANG['TXT_CRM_TASK_LINK_SOURCE'], 'TXT_CRM_TASK_DUE_DATE' => $_ARRAYLANG['TXT_CRM_TASK_DUE_DATE'], 'TXT_CRM_TASK_CREATED_USER' => $_ARRAYLANG['TXT_CRM_TASK_CREATED_USER'], 'TXT_CRM_TASK_DESCRIPTION_TEXT_VERSION' => $_ARRAYLANG['TXT_CRM_TASK_DESCRIPTION_TEXT_VERSION'], 'TXT_CRM_TASK_DESCRIPTION_HTML_VERSION' => $_ARRAYLANG['TXT_CRM_TASK_DESCRIPTION_HTML_VERSION'], 'TXT_CRM_CONTACT_FIRSTNAME' => $_ARRAYLANG['TXT_CRM_CONTACT_FIRSTNAME'], 'TXT_CRM_CONTACT_LASTNAME' => $_ARRAYLANG['TXT_CRM_CONTACT_LASTNAME'], 'TXT_CRM_CONTACT_SALUTATION' => $_ARRAYLANG['TXT_CRM_CONTACT_SALUTATION'], 'TXT_CRM_CONTACT_GENDER' => $_ARRAYLANG['TXT_CRM_CONTACT_GENDER'], 'TXT_CRM_CUSTOMER_CONTACT_EMAIL' => $_ARRAYLANG['TXT_CRM_CUSTOMER_CONTACT_EMAIL'], 'TXT_CRM_CUSTOMER_COMPANY' => $_ARRAYLANG['TXT_CRM_CUSTOMER_COMPANY'], 'TXT_CRM_CUSTOMER_CONTACT_USER_NAME' => $_ARRAYLANG['TXT_CRM_CUSTOMER_CONTACT_USER_NAME'], 'TXT_CRM_CUSTOMER_CONTACT_PASSWORD' => $_ARRAYLANG['TXT_CRM_CUSTOMER_CONTACT_PASSWORD'], 'TXT_CRM_CONTACT_KEY' => $_ARRAYLANG['TXT_CRM_CONTACT_KEY']));
     return $objTemplate->get();
 }
 public function getFrameFinishedXHtml()
 {
     global $_CORELANG;
     $tpl = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/Upload/template/uploaders');
     $tpl->setErrorHandling(PEAR_ERROR_DIE);
     $tpl->loadTemplateFile('formFrameFinished.html');
     $tpl->setVariable('FINISHED_MESSAGE', htmlentities($_CORELANG['UPLOAD_FINISHED'], ENT_QUOTES, CONTREXX_CHARSET));
     return $tpl->get();
 }
 /**
  * Add the warning banner
  *
  * @param \Cx\Core\ContentManager\Model\Entity\Page $page Resolved page
  */
 public function postContentLoad(\Cx\Core\ContentManager\Model\Entity\Page $page)
 {
     \JS::registerJS('core_modules/Workbench/View/Script/Warning.js');
     $objTemplate = $this->cx->getTemplate();
     $warning = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/Workbench/View/Template/Backend');
     $warning->loadTemplateFile('Warning.html');
     if ($this->cx->getMode() == \Cx\Core\Core\Controller\Cx::MODE_BACKEND) {
         \JS::registerCSS('core_modules/Workbench/View/Style/WarningBackend.css');
         $objTemplate->_blocks['__global__'] = preg_replace('/<div id="container"[^>]*>/', '\\0' . $warning->get(), $objTemplate->_blocks['__global__']);
     } else {
         \JS::registerCSS('core_modules/Workbench/View/Style/WarningFrontend.css');
         $objTemplate->_blocks['__global__'] = preg_replace('/<body[^>]*>/', '\\0' . $warning->get(), $objTemplate->_blocks['__global__']);
     }
 }
 /**
  * send a mail to the email with the message
  *
  * @static
  * @param integer $uploadId the upload id
  * @param string $subject the subject of the mail for the recipient
  * @param string $email the recipient's mail address
  * @param null|string $message the message for the recipient
  */
 public static function sendMail($uploadId, $subject, $emails, $message = null)
 {
     global $objDatabase, $_CONFIG;
     /**
      * get all file ids from the last upload
      */
     $objResult = $objDatabase->Execute("SELECT `id` FROM " . DBPREFIX . "module_filesharing WHERE `upload_id` = '" . intval($uploadId) . "'");
     if ($objResult !== false && $objResult->RecordCount() > 0) {
         while (!$objResult->EOF) {
             $files[] = $objResult->fields["id"];
             $objResult->MoveNext();
         }
     }
     if (!is_int($uploadId) && empty($files)) {
         $files[] = $uploadId;
     }
     /**
      * init mail data. Mail template, Mailsubject and PhpMailer
      */
     $objMail = $objDatabase->SelectLimit("SELECT `subject`, `content` FROM " . DBPREFIX . "module_filesharing_mail_template WHERE `lang_id` = " . FRONTEND_LANG_ID, 1, -1);
     $content = str_replace(array(']]', '[['), array('}', '{'), $objMail->fields["content"]);
     if (empty($subject)) {
         $subject = $objMail->fields["subject"];
     }
     $cx = \Cx\Core\Core\Controller\Cx::instanciate();
     if (\Env::get('ClassLoader')->loadFile($cx->getCodeBaseLibraryPath() . '/phpmailer/class.phpmailer.php')) {
         $objMail = new \phpmailer();
         /**
          * Load mail template and parse it
          */
         $objTemplate = new \Cx\Core\Html\Sigma('.');
         $objTemplate->setErrorHandling(PEAR_ERROR_DIE);
         $objTemplate->setTemplate($content);
         $objTemplate->setVariable(array("DOMAIN" => $_CONFIG["domainUrl"], 'MESSAGE' => $message));
         if ($objTemplate->blockExists('filesharing_file')) {
             foreach ($files as $file) {
                 $objTemplate->setVariable(array('FILE_DOWNLOAD' => self::getDownloadLink($file)));
                 $objTemplate->parse('filesharing_file');
             }
         }
         if ($_CONFIG['coreSmtpServer'] > 0 && \Env::get('ClassLoader')->loadFile($cx->getCodeBaseCorePath() . '/SmtpSettings.class.php')) {
             if (($arrSmtp = SmtpSettings::getSmtpAccount($_CONFIG['coreSmtpServer'])) !== false) {
                 $objMail->IsSMTP();
                 $objMail->Host = $arrSmtp['hostname'];
                 $objMail->Port = $arrSmtp['port'];
                 $objMail->SMTPAuth = true;
                 $objMail->Username = $arrSmtp['username'];
                 $objMail->Password = $arrSmtp['password'];
             }
         }
         $objMail->CharSet = CONTREXX_CHARSET;
         $objMail->SetFrom($_CONFIG['coreAdminEmail'], $_CONFIG['coreGlobalPageTitle']);
         $objMail->Subject = $subject;
         $objMail->Body = $objTemplate->get();
         foreach ($emails as $email) {
             $objMail->AddAddress($email);
             $objMail->Send();
             $objMail->ClearAddresses();
         }
     }
 }
 /**
  * Get the XHTML to display the widget.
  */
 public function getXhtml()
 {
     \JS::activate('mediabrowser');
     \JS::registerJS('core_modules/MediaBrowser/View/Script/FolderWidget.js');
     \JS::registerCSS('core_modules/MediaBrowser/View/Style/FolderWidget.css');
     $tpl = new \Cx\Core\Html\Sigma(\Cx\Core\Core\Controller\Cx::instanciate()->getCoreModuleFolderName() . '/MediaBrowser/View/Template/');
     $tpl->loadTemplateFile('FolderWidget.html');
     $tpl->setVariable(array('MEDIABROWSER_FOLDER_WIDGET_ID' => $this->id, 'MEDIABROWSER_FOLDER_WIDGET_IS_EDITABLE' => $this->mode != self::MODE_VIEW_ONLY ? 'true' : 'false'));
     return $tpl->get();
 }
Exemple #11
0
 /**
  * Sets up the Country settings page
  * @return  string          The page content
  */
 static function settings()
 {
     global $_CORELANG;
     $objTemplateCountry = new \Cx\Core\Html\Sigma(\Env::get('cx')->getCodeBaseCorePath() . '/Country/View/Template/Generic');
     $objTemplateCountry->loadTemplateFile('Overview.html');
     // Adds messages
     self::storeSettings();
     self::storeFromPost();
     $uri = \Html::getRelativeUri();
     // Let all links in this tab point here again
     \Html::replaceUriParameter($uri, 'active_tab=' . \Cx\Core\Setting\Controller\Setting::tab_index());
     // Create a copy of the URI for the Paging, as this is passed by
     // reference and modified
     $uri_paging = $uri;
     //DBG::log("URI: $uri");
     $objSorting = new Sorting($uri, array('id' => $_CORELANG['TXT_CORE_COUNTRY_ID'], 'active' => $_CORELANG['TXT_CORE_COUNTRY_ACTIVE'], 'ord' => $_CORELANG['TXT_CORE_COUNTRY_ORD'], 'name' => $_CORELANG['TXT_CORE_COUNTRY_NAME'], 'alpha2' => $_CORELANG['TXT_CORE_COUNTRY_ISO2'], 'alpha3' => $_CORELANG['TXT_CORE_COUNTRY_ISO3']), true, 'order_country');
     \Cx\Core\Setting\Controller\Setting::init('core', 'country');
     $limit = \Cx\Core\Setting\Controller\Setting::getValue('numof_countries_per_page_backend', 'core');
     $count = 0;
     $arrCountries = self::getArray($count, null, $limit, \Paging::getPosition(), $objSorting->getOrder());
     if ($arrCountries === false) {
         return \Message::error($_CORELANG['TXT_CORE_COUNTRY_ERROR_INITIALIZING']);
     }
     $objTemplateCountry->setGlobalVariable($_CORELANG + array('CORE_COUNTRY' => $_CORELANG['TXT_CORE_COUNTRY'] . ' ' . sprintf($_CORELANG['TXT_CORE_TOTAL'], $count), 'HEAD_SETTINGS_COUNTRY_ID' => $objSorting->getHeaderForField('id'), 'HEAD_SETTINGS_COUNTRY_ACTIVE' => $objSorting->getHeaderForField('active'), 'HEAD_SETTINGS_COUNTRY_ORD' => $objSorting->getHeaderForField('ord'), 'HEAD_SETTINGS_COUNTRY_NAME' => $objSorting->getHeaderForField('name'), 'HEAD_SETTINGS_COUNTRY_ISO2' => $objSorting->getHeaderForField('alpha2'), 'HEAD_SETTINGS_COUNTRY_ISO3' => $objSorting->getHeaderForField('alpha3'), 'CORE_SETTING_TAB_INDEX' => \Cx\Core\Setting\Controller\Setting::tab_index(), 'SETTINGS_COUNTRY_PAGING' => \Paging::get($uri_paging, '', $count, $limit, true)));
     // Note:  Optionally disable the block 'settings_country_submit'
     // to disable storing changes
     $i = 0;
     foreach ($arrCountries as $country_id => $arrCountry) {
         $objTemplateCountry->setVariable(array('SETTINGS_COUNTRY_ROWCLASS' => ++$i % 2 + 1, 'SETTINGS_COUNTRY_ID' => $country_id, 'SETTINGS_COUNTRY_ACTIVE' => $arrCountry['active'] ? \Html::ATTRIBUTE_CHECKED : '', 'SETTINGS_COUNTRY_ORD' => $arrCountry['ord'], 'SETTINGS_COUNTRY_NAME' => $arrCountry['name'], 'SETTINGS_COUNTRY_ISO2' => $arrCountry['alpha2'], 'SETTINGS_COUNTRY_ISO3' => $arrCountry['alpha3'], 'SETTINGS_FUNCTIONS' => \Html::getBackendFunctions(array('delete' => 'delete_country_id=' . $country_id), array('delete' => $_CORELANG['TXT_CORE_COUNTRY_CONFIRM_DELETE'] . "\\n" . $_CORELANG['TXT_ACTION_IS_IRREVERSIBLE']))));
         $objTemplateCountry->parse('settings_country_row');
     }
     $objTemplateSetting = null;
     \Cx\Core\Setting\Controller\Setting::show_external($objTemplateSetting, $_CORELANG['TXT_CORE_COUNTRY_EDIT'], $objTemplateCountry->get());
     \Cx\Core\Setting\Controller\Setting::show($objTemplateSetting, $uri, $_CORELANG['TXT_CORE_COUNTRY_SETTINGS'], $_CORELANG['TXT_CORE_COUNTRY_SETTINGS']);
     return $objTemplateSetting->get();
 }
 /**
  * Add the necessary divs for the inline editing around the content and around the title
  *
  * @param \Cx\Core\ContentManager\Model\Entity\Page $page
  */
 public function preContentLoad(\Cx\Core\ContentManager\Model\Entity\Page $page)
 {
     // Is frontend editing active?
     if (!$this->frontendEditingIsActive() || !$this->userHasPermissionToEditPage()) {
         return;
     }
     $componentTemplate = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/' . $this->getName() . '/View/Template/Generic');
     $componentTemplate->setErrorHandling(PEAR_ERROR_DIE);
     // add div around content
     // not used at the moment, because we have no proper way to "not parse" blocks in content and
     // it should only print a div around the content without parsing the content at this time
     //        $componentTemplate->loadTemplateFile('ContentDiv.html');
     //        $componentTemplate->setVariable('CONTENT', $page->getContent());
     //        $page->setContent($componentTemplate->get());
     $page->setContent('<div id="fe_content">' . $page->getContent() . '</div>');
     // add div around the title
     $componentTemplate->loadTemplateFile('TitleDiv.html');
     $componentTemplate->setVariable('TITLE', $page->getContentTitle());
     $page->setContentTitle($componentTemplate->get());
 }
 /**
  * Adds the toolbar to the current html structure (after the starting body tag)
  *
  * @param ComponentController $componentController
  */
 private function prepareTemplate(\Cx\Core_Modules\FrontendEditing\Controller\ComponentController $componentController)
 {
     global $_ARRAYLANG, $objTemplate;
     // get necessary objects
     $objInit = \Env::get('init');
     $page = $this->cx->getPage();
     // init component template object
     $componentTemplate = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/' . $componentController->getName() . '/View/Template/Generic');
     $componentTemplate->setErrorHandling(PEAR_ERROR_DIE);
     // add div for toolbar after starting body tag
     $componentTemplate->loadTemplateFile('Toolbar.html');
     // @author: Michael Ritter
     // not used for contrexx 3.1
     //        global $_CORELANG;
     //        $template = $objTemplate;
     //        $root = $componentTemplate->fileRoot;
     //        $componentTemplate->setRoot(ASCMS_ADMIN_TEMPLATE_PATH);
     //        $objTemplate = $componentTemplate;
     //        \Env::get('ClassLoader')->loadFile(ASCMS_DOCUMENT_ROOT . '/lang/en/backend.php');
     //        $langCode = \FWLanguage::getLanguageCodeById(FRONTEND_LANG_ID);
     //        if ($langCode != 'en') {
     //            \Env::get('ClassLoader')->loadFile(ASCMS_DOCUMENT_ROOT . '/lang/' . $langCode . '/backend.php');
     //        }
     //        $_CORELANG = array_merge($_CORELANG, $_ARRAYLANG);
     //        $menu = new \adminMenu('fe');
     //        $menu->getAdminNavbar();
     //        $componentTemplate->setRoot($root);
     //        $objTemplate = $template;
     // end code from Michael Ritter
     $objUser = $this->cx->getUser()->objUser;
     $firstname = $objUser->getProfileAttribute('firstname');
     $lastname = $objUser->getProfileAttribute('lastname');
     $componentTemplate->setGlobalVariable(array('LOGGED_IN_USER' => !empty($firstname) && !empty($lastname) ? $firstname . ' ' . $lastname : $objUser->getUsername(), 'TXT_LOGOUT' => $_ARRAYLANG['TXT_FRONTEND_EDITING_TOOLBAR_LOGOUT'], 'TXT_FRONTEND_EDITING_TOOLBAR_OPEN_CM' => $_ARRAYLANG['TXT_FRONTEND_EDITING_TOOLBAR_OPEN_CM'], 'TXT_FRONTEND_EDITING_HISTORY' => $_ARRAYLANG['TXT_FRONTEND_EDITING_HISTORY'], 'TXT_FRONTEND_EDITING_OPTIONS' => $_ARRAYLANG['TXT_FRONTEND_EDITING_OPTIONS'], 'TXT_FRONTEND_EDITING_ADMINMENU' => $_ARRAYLANG['TXT_FRONTEND_EDITING_ADMINMENU'], 'TXT_FRONTEND_EDITING_CSS_CLASS' => $_ARRAYLANG['TXT_FRONTEND_EDITING_CSS_CLASS'], 'TXT_FRONTEND_EDITING_CUSTOM_CONTENT' => $_ARRAYLANG['TXT_FRONTEND_EDITING_CUSTOM_CONTENT'], 'TXT_FRONTEND_EDITING_THEMES' => $_ARRAYLANG['TXT_FRONTEND_EDITING_THEMES'], 'TXT_FRONTEND_EDITING_TOOLBAR_SAVE_BLOCK' => $_ARRAYLANG['TXT_FRONTEND_EDITING_TOOLBAR_SAVE_BLOCK'], 'SKIN_OPTIONS' => $this->getSkinOptions(), 'LINK_LOGOUT' => $objInit->getUriBy('section', 'logout'), 'LINK_PROFILE' => ASCMS_PATH_OFFSET . '/cadmin/index.php?cmd=Access&amp;act=user&amp;tpl=modify&amp;id=' . $objUser->getId(), 'LINK_CM' => ASCMS_PATH_OFFSET . '/cadmin/index.php?cmd=ContentManager&amp;page=' . $page->getId() . '&amp;tab=content'));
     $objTemplate->_blocks['__global__'] = preg_replace('/<body[^>]*>/', '\\0' . $componentTemplate->get(), $objTemplate->_blocks['__global__']);
 }
 /**
  * This is called by the default ComponentController and does all the repeating work
  * 
  * This loads a template named after current $act and calls parsePage($actTemplate)
  * @todo $this->cx->getTemplate()->setVariable() should not be called here but in Cx class
  * @global array $_ARRAYLANG Language data
  * @global $subMenuTitle
  * @param \Cx\Core\ContentManager\Model\Entity\Page $page Resolved page
  */
 public function getPage(\Cx\Core\ContentManager\Model\Entity\Page $page)
 {
     global $_ARRAYLANG, $subMenuTitle;
     $subMenuTitle = $_ARRAYLANG['TXT_' . strtoupper($this->getType()) . '_' . strtoupper($this->getName())];
     $cmd = array('');
     if (isset($_GET['act'])) {
         $cmd = explode('/', contrexx_input2raw($_GET['act']));
     } else {
         $cmd[0] = 'Wysiwyg';
     }
     $actTemplate = new \Cx\Core\Html\Sigma($this->getDirectory(true) . '/View/Template/Backend');
     $filename = $cmd[0] . '.html';
     $testFilename = $cmd[0];
     if (!\Env::get('ClassLoader')->getFilePath($actTemplate->getRoot() . '/' . $filename)) {
         $filename = 'Default.html';
         $testFilename = 'Default';
     }
     foreach ($cmd as $index => $name) {
         if ($index == 0) {
             continue;
         }
         $testFilename .= $name;
         if (\Env::get('ClassLoader')->getFilePath($actTemplate->getRoot() . '/' . $testFilename . '.html')) {
             $filename = $testFilename . '.html';
         } else {
             break;
         }
     }
     $actTemplate->loadTemplateFile($filename);
     // todo: Messages
     $this->parsePage($actTemplate, $cmd);
     // set tabs
     $navigation = new \Cx\Core\Html\Sigma(\Env::get('cx')->getCodeBaseCorePath() . '/Core/View/Template/Backend');
     $navigation->loadTemplateFile('Navigation.html');
     $commands = array_merge($this->getCommands());
     foreach ($commands as $key => $command) {
         $subnav = array();
         if (is_array($command)) {
             $subnav = array_merge(array(''), $command);
             $command = $key;
         }
         if ($key !== '') {
             if ($cmd[0] == $command) {
                 $navigation->touchBlock('tab_active');
             } else {
                 $navigation->hideBlock('tab_active');
             }
             $act = '&amp;act=' . $command;
             $txt = $command;
             if (empty($command)) {
                 $act = '';
                 $txt = 'DEFAULT';
             }
             $actTxtKey = 'TXT_' . strtoupper($this->getType()) . '_' . strtoupper($this->getName() . '_ACT_' . $txt);
             $actTitle = isset($_ARRAYLANG[$actTxtKey]) ? $_ARRAYLANG[$actTxtKey] : $actTxtKey;
             $navigation->setVariable(array('HREF' => 'index.php?cmd=' . $this->getName() . $act, 'TITLE' => $actTitle));
             $navigation->parse('tab_entry');
         }
         // subnav
         if ($cmd[0] == $command && count($subnav)) {
             $first = true;
             foreach ($subnav as $subcommand) {
                 if (!isset($cmd[1]) && $first || (isset($cmd[1]) ? $cmd[1] : '') == $subcommand) {
                     $navigation->touchBlock('subnav_active');
                 } else {
                     $navigation->hideBlock('subnav_active');
                 }
                 $act = '&amp;act=' . $cmd[0] . '/' . $subcommand;
                 $txt = (empty($cmd[0]) ? 'DEFAULT' : $cmd[0]) . '_';
                 if (empty($subcommand)) {
                     $act = '&amp;act=' . $cmd[0] . '/';
                     $txt .= 'DEFAULT';
                 } else {
                     $txt .= strtoupper($subcommand);
                 }
                 $actTxtKey = 'TXT_' . strtoupper($this->getType()) . '_' . strtoupper($this->getName() . '_ACT_' . $txt);
                 $actTitle = isset($_ARRAYLANG[$actTxtKey]) ? $_ARRAYLANG[$actTxtKey] : $actTxtKey;
                 $navigation->setVariable(array('HREF' => 'index.php?cmd=' . $this->getName() . $act, 'TITLE' => $actTitle));
                 $navigation->parse('subnav_entry');
                 $first = false;
             }
         }
     }
     $txt = $cmd[0];
     if (empty($txt)) {
         $txt = 'DEFAULT';
     }
     // default css and js
     if (file_exists($this->cx->getClassLoader()->getFilePath($this->getDirectory(false) . '/View/Style/Backend.css'))) {
         \JS::registerCSS(substr($this->getDirectory(false, true) . '/View/Style/Backend.css', 1));
     }
     if (file_exists($this->cx->getClassLoader()->getFilePath($this->getDirectory(false) . '/View/Script/Backend.js'))) {
         \JS::registerJS(substr($this->getDirectory(false, true) . '/View/Script/Backend.js', 1));
     }
     // finish
     $actTemplate->setGlobalVariable($_ARRAYLANG);
     \Cx\Core\Csrf\Controller\Csrf::add_placeholder($actTemplate);
     $page->setContent($actTemplate->get());
     $cachedRoot = $this->cx->getTemplate()->getRoot();
     $this->cx->getTemplate()->setRoot(\Env::get('cx')->getCodeBaseCorePath() . '/Core/View/Template/Backend');
     $this->cx->getTemplate()->addBlockfile('CONTENT_OUTPUT', 'content_master', 'ContentMaster.html');
     $this->cx->getTemplate()->setRoot($cachedRoot);
     $this->cx->getTemplate()->setVariable(array('CONTENT_NAVIGATION' => $navigation->get(), 'ADMIN_CONTENT' => $page->getContent(), 'CONTENT_TITLE' => $_ARRAYLANG['TXT_' . strtoupper($this->getType()) . '_' . strtoupper($this->getName() . '_ACT_' . $txt)]));
 }
 /**
  * Sets placeholders for the form view.
  *
  * @param object $objTpl         Template object
  * @param integer $formId        Form id
  * @param integer $intView       request mode frontend or backend
  * @param integer $arrNumSeating number of seating
  *
  * @return null
  */
 function showForm($objTpl, $formId, $intView, $ticketSales = false)
 {
     global $_ARRAYLANG, $_LANGID;
     $objForm = new \Cx\Modules\Calendar\Controller\CalendarForm(intval($formId));
     if (!empty($formId)) {
         $this->formList[$formId] = $objForm;
     }
     switch ($intView) {
         case 1:
             $this->getFrontendLanguages();
             $objTpl->setGlobalVariable(array($this->moduleLangVar . '_FORM_ID' => !empty($formId) ? $objForm->id : '', $this->moduleLangVar . '_FORM_TITLE' => !empty($formId) ? $objForm->title : ''));
             $i = 0;
             $formFields = array();
             if (!empty($formId)) {
                 $defaultLangId = $_LANGID;
                 if (!in_array($defaultLangId, \FWLanguage::getIdArray())) {
                     $defaultLangId = \FWLanguage::getDefaultLangId();
                 }
                 foreach ($objForm->inputfields as $key => $arrInputfield) {
                     $i++;
                     $fieldValue = array();
                     $defaultFieldValue = array();
                     foreach ($this->arrFrontendLanguages as $key => $arrLang) {
                         $fieldValue[$arrLang['id']] = isset($arrInputfield['name'][$arrLang['id']]) ? $arrInputfield['name'][$arrLang['id']] : '';
                         $defaultFieldValue[$arrLang['id']] = isset($arrInputfield['default_value'][$arrLang['id']]) ? $arrInputfield['default_value'][$arrLang['id']] : '';
                     }
                     $formFields[] = array('type' => $arrInputfield['type'], 'id' => $arrInputfield['id'], 'row' => $i % 2 == 0 ? 'row2' : 'row1', 'order' => $arrInputfield['order'], 'name_master' => $fieldValue[$defaultLangId], 'default_value_master' => $defaultFieldValue[$defaultLangId], 'required' => $arrInputfield['required'], 'affiliation' => $arrInputfield['affiliation'], 'field_value' => json_encode($fieldValue), 'default_field_value' => json_encode($defaultFieldValue));
                 }
             }
             foreach ($this->arrFrontendLanguages as $key => $arrLang) {
                 $objTpl->setVariable(array($this->moduleLangVar . '_INPUTFIELD_LANG_ID' => $arrLang['id'], $this->moduleLangVar . '_INPUTFIELD_LANG_NAME' => $arrLang['name'], $this->moduleLangVar . '_INPUTFIELD_LANG_SHORTCUT' => $arrLang['lang']));
                 $objTpl->parse('inputfieldNameList');
                 $objTpl->setVariable(array($this->moduleLangVar . '_INPUTFIELD_LANG_ID' => $arrLang['id'], $this->moduleLangVar . '_INPUTFIELD_LANG_NAME' => $arrLang['name'], $this->moduleLangVar . '_INPUTFIELD_LANG_SHORTCUT' => $arrLang['lang']));
                 $objTpl->parse('inputfieldDefaultValueList');
                 $objTpl->setVariable(array($this->moduleLangVar . '_INPUTFIELD_LANG_NAME' => $arrLang['name']));
                 $objTpl->parse('inputfieldLanguagesList');
             }
             foreach ($this->arrInputfieldTypes as $fieldType) {
                 $objTpl->setVariable(array($this->moduleLangVar . '_FORM_FIELD_TYPE' => $fieldType, 'TXT_' . $this->moduleLangVar . '_FORM_FIELD_TYPE' => $_ARRAYLANG['TXT_CALENDAR_FORM_FIELD_' . strtoupper($fieldType)]));
                 $objTpl->parse('inputfieldTypes');
             }
             foreach ($this->arrRegistrationFields as $fieldType) {
                 $objTpl->setVariable(array($this->moduleLangVar . '_FORM_FIELD_TYPE' => $fieldType, 'TXT_' . $this->moduleLangVar . '_FORM_FIELD_TYPE' => $_ARRAYLANG['TXT_CALENDAR_FORM_FIELD_' . strtoupper($fieldType)]));
                 $objTpl->parse('inputRegfieldTypes');
             }
             /* foreach ($this->arrInputfieldAffiliations as $strAffiliation) {
                    $objTpl->setVariable(array(
                        $this->moduleLangVar.'_FORM_FIELD_TYPE'        =>  $strAffiliation,
                        'TXT_'.$this->moduleLangVar.'_FORM_FIELD_TYPE' =>  $_ARRAYLANG['TXT_CALENDAR_FORM_FIELD_AFFILIATION_'.strtoupper($strAffiliation)],
                    ));
                    $objTpl->parse('fieldAfflications');
                }*/
             $objTpl->setVariable(array($this->moduleLangVar . '_FORM_DATA' => json_encode($formFields), $this->moduleLangVar . '_FRONTEND_LANG_COUNT' => count($this->arrFrontendLanguages), $this->moduleLangVar . '_INPUTFIELD_LAST_ID' => $objForm->getLastInputfieldId(), $this->moduleLangVar . '_INPUTFIELD_LAST_ROW' => $i % 2 == 0 ? "'row2'" : "'row1'", $this->moduleLangVar . '_DISPLAY_EXPAND' => count($this->arrFrontendLanguages) > 1 ? "block" : "none"));
             break;
         case 2:
             $objFieldTemplate = new \Cx\Core\Html\Sigma('.');
             $objFieldTemplate->setTemplate(self::frontendFieldTemplate, true, true);
             $objFieldTemplate->setVariable(array('TXT_' . $this->moduleLangVar . '_FIELD_NAME' => $_ARRAYLANG['TXT_CALENDAR_TYPE'] . '<font class="calendarRequired"> *</font>', $this->moduleLangVar . '_FIELD_INPUT' => '<select class="calendarSelect affiliateForm" name="registrationType"><option value="1" selected="selected"/>' . $_ARRAYLANG['TXT_CALENDAR_REG_REGISTRATION'] . '</option><option value="0"/>' . $_ARRAYLANG['TXT_CALENDAR_REG_SIGNOFF'] . '</option></select>', $this->moduleLangVar . '_FIELD_CLASS' => 'affiliationForm'));
             $objTpl->setVariable($this->moduleLangVar . '_REGISTRATION_FIELD', $objFieldTemplate->get());
             $objTpl->parse('calendarRegistrationField');
             // $selectBillingAddressStatus = false;
             foreach ($objForm->inputfields as $key => $arrInputfield) {
                 $objFieldTemplate->setTemplate(self::frontendFieldTemplate, true, true);
                 $options = array();
                 $options = explode(',', $arrInputfield['default_value'][$_LANGID]);
                 $inputfield = null;
                 $hide = false;
                 $optionSelect = true;
                 $availableSeat = 0;
                 $checkSeating = false;
                 if (isset($_POST['registrationField'][$arrInputfield['id']])) {
                     $value = $_POST['registrationField'][$arrInputfield['id']];
                 } elseif (\FWUser::getFWUserObject()->objUser->login() && in_array($arrInputfield['type'], array('mail', 'firstname', 'lastname'))) {
                     $value = '';
                     switch ($arrInputfield['type']) {
                         case 'mail':
                             $value = \FWUser::getFWUserObject()->objUser->getEmail();
                             break;
                         case 'firstname':
                             $value = \FWUser::getFWUserObject()->objUser->getProfileAttribute('firstname');
                             break;
                         case 'lastname':
                             $value = \FWUser::getFWUserObject()->objUser->getProfileAttribute('lastname');
                             break;
                         default:
                             $value = $arrInputfield['default_value'][$_LANGID];
                             break;
                     }
                 } else {
                     $value = $arrInputfield['default_value'][$_LANGID];
                 }
                 $affiliationClass = 'affiliation' . ucfirst($arrInputfield['affiliation']);
                 switch ($arrInputfield['type']) {
                     case 'inputtext':
                     case 'mail':
                     case 'firstname':
                     case 'lastname':
                         $inputfield = '<input type="text" class="calendarInputText" name="registrationField[' . $arrInputfield['id'] . ']" value="' . $value . '" /> ';
                         break;
                     case 'textarea':
                         $inputfield = '<textarea class="calendarTextarea" name="registrationField[' . $arrInputfield['id'] . ']">' . $value . '</textarea>';
                         break;
                     case 'seating':
                         if (!$ticketSales) {
                             $hide = true;
                         }
                         $optionSelect = false;
                         if ($this->event) {
                             $checkSeating = $this->event->registration && $this->event->numSubscriber;
                             $availableSeat = $this->event->getFreePlaces();
                         }
                     case 'select':
                     case 'salutation':
                         $inputfield = '<select class="calendarSelect" name="registrationField[' . $arrInputfield['id'] . ']">';
                         $selected = empty($_POST) ? 'selected="selected"' : '';
                         $inputfield .= $optionSelect ? '<option value="" ' . $selected . '>' . $_ARRAYLANG['TXT_CALENDAR_PLEASE_CHOOSE'] . '</option>' : '';
                         foreach ($options as $key => $name) {
                             if ($checkSeating && contrexx_input2int($name) > $availableSeat) {
                                 continue;
                             }
                             $selected = $key + 1 == $value ? 'selected="selected"' : '';
                             $inputfield .= '<option value="' . intval($key + 1) . '" ' . $selected . '>' . $name . '</option>';
                         }
                         $inputfield .= '</select>';
                         break;
                     case 'radio':
                         foreach ($options as $key => $name) {
                             $checked = $key + 1 == $value || empty($_POST) && $key == 0 ? 'checked="checked"' : '';
                             $textValue = isset($_POST["registrationFieldAdditional"][$arrInputfield['id']][$key]) ? $_POST["registrationFieldAdditional"][$arrInputfield['id']][$key] : '';
                             $textfield = '<input type="text" class="calendarInputCheckboxAdditional" name="registrationFieldAdditional[' . $arrInputfield['id'] . '][' . $key . ']" value="' . contrexx_input2xhtml($textValue) . '" />';
                             $name = str_replace('[[INPUT]]', $textfield, $name);
                             $inputfield .= '<input type="radio" class="calendarInputCheckbox" name="registrationField[' . $arrInputfield['id'] . ']" value="' . intval($key + 1) . '" ' . $checked . '/>&nbsp;' . $name . '<br />';
                         }
                         break;
                     case 'checkbox':
                         foreach ($options as $key => $name) {
                             $textValue = isset($_POST["registrationFieldAdditional"][$arrInputfield['id']][$key]) ? $_POST["registrationFieldAdditional"][$arrInputfield['id']][$key] : '';
                             $textfield = '<input type="text" class="calendarInputCheckboxAdditional" name="registrationFieldAdditional[' . $arrInputfield['id'] . '][' . $key . ']" value="' . contrexx_input2xhtml($textValue) . '" />';
                             $name = str_replace('[[INPUT]]', $textfield, $name);
                             $checked = in_array($key + 1, $_POST['registrationField'][$arrInputfield['id']]) ? 'checked="checked"' : '';
                             $inputfield .= '<input ' . $checked . ' type="checkbox" class="calendarInputCheckbox" name="registrationField[' . $arrInputfield['id'] . '][]" value="' . intval($key + 1) . '" />&nbsp;' . $name . '<br />';
                         }
                         break;
                     case 'agb':
                         $inputfield = '<input class="calendarInputCheckbox" type="checkbox" name="registrationField[' . $arrInputfield['id'] . '][]" value="1" />&nbsp;' . $_ARRAYLANG['TXT_CALENDAR_AGB'] . '<br />';
                         break;
                         /* case 'selectBillingAddress':
                                                     if(!$selectBillingAddressStatus) {
                                                         if($_REQUEST['registrationField'][$arrInputfield['id']] == 'deviatesFromContact') {
                                                             $selectDeviatesFromContact = 'selected="selected"';
                                                         } else {
                                                             $selectDeviatesFromContact = '';
                                                         }
                         
                                                         $inputfield = '<select id="calendarSelectBillingAddress" class="calendarSelect" name="registrationField['.$arrInputfield['id'].']">';
                                                         $inputfield .= '<option value="sameAsContact">'.$_ARRAYLANG['TXT_CALENDAR_SAME_AS_CONTACT'].'</option>';
                                                         $inputfield .= '<option value="deviatesFromContact" '.$selectDeviatesFromContact.'>'.$_ARRAYLANG['TXT_CALENDAR_DEVIATES_FROM_CONTACT'].'</option>';
                                                         $inputfield .= '</select>';
                                                         $selectBillingAddressStatus = true;
                                                     }
                                                     break; */
                     /* case 'selectBillingAddress':
                                                 if(!$selectBillingAddressStatus) {
                                                     if($_REQUEST['registrationField'][$arrInputfield['id']] == 'deviatesFromContact') {
                                                         $selectDeviatesFromContact = 'selected="selected"';
                                                     } else {
                                                         $selectDeviatesFromContact = '';
                                                     }
                     
                                                     $inputfield = '<select id="calendarSelectBillingAddress" class="calendarSelect" name="registrationField['.$arrInputfield['id'].']">';
                                                     $inputfield .= '<option value="sameAsContact">'.$_ARRAYLANG['TXT_CALENDAR_SAME_AS_CONTACT'].'</option>';
                                                     $inputfield .= '<option value="deviatesFromContact" '.$selectDeviatesFromContact.'>'.$_ARRAYLANG['TXT_CALENDAR_DEVIATES_FROM_CONTACT'].'</option>';
                                                     $inputfield .= '</select>';
                                                     $selectBillingAddressStatus = true;
                                                 }
                                                 break; */
                     case 'fieldset':
                         $inputfield = null;
                         break;
                 }
                 $field = '';
                 if ($arrInputfield['type'] == 'fieldset') {
                     $field = '</fieldset><fieldset><legend>' . $arrInputfield['name'][$_LANGID] . '</legend>';
                     $hide = true;
                 } else {
                     $required = $arrInputfield['required'] == 1 ? '<font class="calendarRequired"> *</font>' : '';
                     $label = $arrInputfield['name'][$_LANGID] . $required;
                 }
                 if (!$hide) {
                     $objFieldTemplate->setVariable(array('TXT_' . $this->moduleLangVar . '_FIELD_NAME' => $label, $this->moduleLangVar . '_FIELD_INPUT' => $inputfield, $this->moduleLangVar . '_FIELD_CLASS' => $affiliationClass));
                     $field = $objFieldTemplate->get();
                 }
                 $objTpl->setVariable($this->moduleLangVar . '_REGISTRATION_FIELD', $field);
                 $objTpl->parse('calendarRegistrationField');
             }
             break;
     }
 }
Exemple #16
0
 /**
  * Sets up the JavsScript cart
  *
  * Searches all $themesPages elements for the first occurrence of the
  * "shopJsCart" template block.
  * Generates the structure of the Javascript cart, puts it in the template,
  * and registers all required JS code.
  * Note that this is only ever called when the JS cart is enabled in the
  * extended settings!
  * @access  public
  * @global  array   $_ARRAYLANG   Language array
  * @global  array   $themesPages  Theme template array
  * @return  void
  * @static
  */
 static function setJsCart()
 {
     global $_ARRAYLANG, $themesPages;
     if (!\Cx\Core\Setting\Controller\Setting::getValue('use_js_cart', 'Shop')) {
         return;
     }
     $objTemplate = new \Cx\Core\Html\Sigma('.');
     $objTemplate->setErrorHandling(PEAR_ERROR_DIE);
     $match = null;
     $div_cart = $div_product = '';
     foreach ($themesPages as $index => $content) {
         //\DBG::log("Shop::setJsCart(): Section $index");
         $objTemplate->setTemplate($content, false, false);
         if (!$objTemplate->blockExists('shopJsCart')) {
             continue;
         }
         //\DBG::log("Shop::setJsCart(): In themespage $index: {$themesPages[$index]}");
         $objTemplate->setCurrentBlock('shopJsCart');
         // Set all language entries and replace formats
         $objTemplate->setGlobalVariable($_ARRAYLANG);
         if ($objTemplate->blockExists('shopJsCartProducts')) {
             $objTemplate->parse('shopJsCartProducts');
             $div_product = $objTemplate->get('shopJsCartProducts');
             //\DBG::log("Shop::setJsCart(): Got Product: $div_product");
             $objTemplate->replaceBlock('shopJsCartProducts', '[[SHOP_JS_CART_PRODUCTS]]');
         }
         $objTemplate->touchBlock('shopJsCart');
         $objTemplate->parse('shopJsCart');
         $div_cart = $objTemplate->get('shopJsCart');
         //\DBG::log("Shop::setJsCart(): Got Cart: $div_cart");
         if (preg_match('#^([\\n\\r]?[^<]*<.*id=["\']shopJsCart["\'][^>]*>)(([\\n\\r].*)*)(</[^>]*>[^<]*[\\n\\r]?)$#', $div_cart, $match)) {
             //\DBG::log("Shop::setJsCart(): Matched DIV {$match[1]}, content: {$match[2]}");
             $themesPages[$index] = preg_replace('@(<!--\\s*BEGIN\\s+(shopJsCart)\\s*-->.*?<!--\\s*END\\s+\\2\\s*-->)@s', $match[1] . $_ARRAYLANG['TXT_SHOP_CART_IS_LOADING'] . $match[4], $content);
             /*
             // Template use won't work, because it kills the remaining <!-- blocks -->!
                             $objTemplate->setTemplate($content, false, false);
                             $objTemplate->replaceBlock('shopJsCart',
                                 $match[1].
                                 $_ARRAYLANG['TXT_SHOP_CART_IS_LOADING'].
                                 $match[4]);
                             $themesPages[$index] = $objTemplate->get();
             */
             //\DBG::log("Shop::setJsCart(): Out themespage $index: {$themesPages[$index]}");
         }
         // One instance only (mind that there's a unique id attribute)
         self::$use_js_cart = true;
         break;
     }
     if (!self::$use_js_cart) {
         return;
     }
     self::registerJavascriptCode();
     \ContrexxJavascript::getInstance()->setVariable('TXT_SHOP_CART_IS_LOADING', $_ARRAYLANG['TXT_SHOP_CART_IS_LOADING'], 'shop/cart');
     \ContrexxJavascript::getInstance()->setVariable('TXT_SHOP_COULD_NOT_LOAD_CART', $_ARRAYLANG['TXT_SHOP_COULD_NOT_LOAD_CART'], 'shop/cart');
     \ContrexxJavascript::getInstance()->setVariable('TXT_EMPTY_SHOPPING_CART', $_ARRAYLANG['TXT_EMPTY_SHOPPING_CART'], 'shop/cart');
     \ContrexxJavascript::getInstance()->setVariable("url", (string) \Cx\Core\Routing\URL::fromModuleAndCMd('Shop' . MODULE_INDEX, 'cart', FRONTEND_LANG_ID, array('remoteJs' => 'addProduct')), 'shop/cart');
     \JS::registerJS(substr(\Cx\Core\Core\Controller\Cx::instanciate()->getModuleFolderName() . '/Shop/View/Script/cart.js', 1));
     \JS::registerCode("cartTpl = '" . preg_replace(array('/\'/', '/[\\n\\r]/', '/\\//'), array('\\\'', '\\n', '\\/'), $div_cart) . "';\n" . "cartProductsTpl = '" . preg_replace(array('/\'/', '/[\\n\\r]/', '/\\//'), array('\\\'', '\\n', '\\/'), $div_product) . "';\n");
 }
Exemple #17
0
 private static function __kill()
 {
     global $_CORELANG;
     $data = $_SERVER['REQUEST_METHOD'] == 'GET' ? $_GET : $_POST;
     self::add_code();
     $tpl = new \Cx\Core\Html\Sigma(\Env::get('cx')->getCodeBaseCorePath() . '/Csrf/View/Template/Generic/');
     $tpl->setErrorHandling(PEAR_ERROR_DIE);
     $tpl->loadTemplateFile('Warning.html');
     $form = '';
     foreach ($data as $key => $value) {
         if ($key == self::$formkey || $key == 'amp;' . self::$formkey || $key == '__cap') {
             continue;
         }
         // There *MUST NOT* be any form element with a name attribute
         // value of "submit" -- this will break the form's submit() method!
         if ($key == 'submit') {
             continue;
         }
         $form .= self::parseRequestParametersForForm($key, $value);
     }
     $csrfContinue = 'javascript:sendData();';
     $csrfAbort = 'index.php' . (isset($_GET['cmd']) ? '?cmd=' . $_GET['cmd'] : '');
     $_CORELANG['TXT_CSRF_DESCR'] = str_replace('%1$s', $csrfContinue . '" tabindex="-1', $_CORELANG['TXT_CSRF_DESCR']);
     $_CORELANG['TXT_CSRF_DESCR'] = str_replace('%2$s', $csrfAbort . '" tabindex="-1', $_CORELANG['TXT_CSRF_DESCR']);
     $action = $_SERVER['REQUEST_URI'];
     $tpl->setGlobalVariable(array('TXT_CSRF_TITLE' => $_CORELANG['TXT_CSRF_TITLE'], 'TXT_CSRF_DESCR' => $_CORELANG['TXT_CSRF_DESCR'], 'TXT_CSRF_CONTINUE' => $_CORELANG['TXT_CSRF_CONTINUE'], 'TXT_CSRF_ABORT' => $_CORELANG['TXT_CSRF_ABORT'], 'CSRF_CONTINUE' => $csrfContinue . '" tabindex="1', 'CSRF_ABORT' => $csrfAbort . '" tabindex="2', 'REQUEST_METHOD' => strtolower($_SERVER['REQUEST_METHOD']), 'ACTION' => $action, 'FORM_ELEMENTS' => $form, 'IMAGES_PATH' => ASCMS_ADMIN_WEB_PATH . '/images/csrfprotection'));
     $tpl->parse();
     $endcode = $tpl->get();
     // replace links from before contrexx 3
     $ls = new \LinkSanitizer(ASCMS_PATH_OFFSET . ASCMS_BACKEND_PATH . '/', $endcode);
     $endcode = $ls->replace();
     echo $endcode;
     die;
 }
 function showQuestions()
 {
     global $objInit;
     $objTpl = new \Cx\Core\Html\Sigma(ASCMS_MODULE_PATH . "/{$this->moduleName}/View/Template/Backend");
     $objTpl->loadTemplateFile("module_survey_questions.html");
     $_ARRAYLANG = $objInit->loadLanguageData('Survey');
     if (empty($this->questions)) {
         $objTpl->setVariable('TXT_SERVEY_NO_QUESTIONS', $_ARRAYLANG['TXT_SERVEY_NO_QUESTIONS']);
         $objTpl->parse('noSurveyQuestions');
     } else {
         $objTpl->hideBlock('noSurveyQuestions');
     }
     foreach ($this->questions as $questionId => $question) {
         $comment = $question['isCommentable'] ? $_ARRAYLANG['TXT_YES'] : $_ARRAYLANG['TXT_NO'];
         $InputType = $question['questionType'];
         if (!empty($InputType)) {
             switch ($InputType) {
                 case "1":
                     $Radio = $_ARRAYLANG['TXT_MULTIPLE_CHOICE_ONE_ANSWER'];
                     break;
                 case "2":
                     $Radio = $_ARRAYLANG['TXT_MULTIPLE_CHOICE_MULTIPLE_ANSWER'];
                     break;
                 case "3":
                     $Radio = $_ARRAYLANG['TXT_MATRIX_CHOICE_ONE_ANSWER_PER_ROW'];
                     break;
                 case "4":
                     $Radio = $_ARRAYLANG['TXT_MATRIX_CHOICE_MULTIPLE_ANSWER_PER_ROW'];
                     break;
                 case "5":
                     $Radio = $_ARRAYLANG['TXT_SINGLE_TEXTBOX'];
                     break;
                 case "6":
                     $Radio = $_ARRAYLANG['TXT_MULTIPLE_TEXTBOX'];
                     break;
                 case "7":
                     $Radio = $_ARRAYLANG['TXT_TEXT_ROW'];
                     break;
             }
         }
         // for question Title with tool tip
         $surveynameVar = contrexx_raw2xhtml($question['question']);
         $surveyTemp = '';
         if ($surveynameVar != "") {
             $surveyShot = substr($surveynameVar, 0, 20);
             if (strlen($surveynameVar) > 20) {
                 $surveyTemp = $surveyShot . '..<a href="#" title="' . $surveynameVar . '" class="tooltip"><img border="0" src="' . ASCMS_PATH_OFFSET . ASCMS_MODULE_FOLDER . '/Survey/View/Media/comment.gif"><a>';
             } else {
                 $surveyTemp = $surveyShot;
             }
         }
         $objTpl->setVariable(array('SURVEY_ID' => contrexx_raw2xhtml($questionId), 'TXT_SURVEY_POS' => contrexx_raw2xhtml($question['pos']), 'SURVEY_QUESTION' => $surveyTemp, 'SURVEY_QUESTION_CREATED_AT' => contrexx_raw2xhtml($question['created']), 'SURVEY_QUESTION_TYPE' => contrexx_raw2xhtml($Radio), 'SURVEY_QUESTION_COMMENTABLE' => contrexx_raw2xhtml($comment), 'SURVEY_COUNTER' => contrexx_raw2xhtml($question['votes']) . " votes", 'ENTRY_ROWCLASS' => $row = $row == 'row1' ? 'row2' : 'row1', 'TXT_ANALYSE_QUESTION_PREVIEW' => $_ARRAYLANG['TXT_ANALYSE_QUESTION_PREVIEW'], 'TXT_SURVEY_EDIT_TXT' => $_ARRAYLANG['TXT_SURVEY_EDIT_TXT'], 'TXT_SURVEY_DELETE_TXT' => $_ARRAYLANG['TXT_SURVEY_DELETE_TXT']));
         $objTpl->parse('ShowQuestions');
     }
     return $objTpl->get();
 }
 /**
  * Get available placeholders in newsletter notification mails
  *
  * @return string Newsletter placehodlers list
  */
 public function getNewsletterPlaceHoldersList()
 {
     global $_ARRAYLANG;
     $objTemplate = new \Cx\Core\Html\Sigma(\Cx\Core\Core\Controller\Cx::instanciate()->getCodeBaseModulePath() . '/Newsletter/View/Template/Backend');
     $objTemplate->setErrorHandling(PEAR_ERROR_DIE);
     $objTemplate->loadTemplateFile('module_newsletter_config_placeholders.html');
     $objTemplate->setVariable(array('TXT_NEWSLETTER_PLACEHOLDERS' => $_ARRAYLANG['TXT_NEWSLETTER_PLACEHOLDERS'], 'TXT_NEWSLETTER_GENERAL' => $_ARRAYLANG['TXT_NEWSLETTER_GENERAL'], 'TXT_NEWSLETTER_USER_TITLE' => $_ARRAYLANG['TXT_TITLE'], 'TXT_NEWSLETTER_USER_SEX' => $_ARRAYLANG['TXT_NEWSLETTER_SEX'], 'TXT_NEWSLETTER_USER_FIRSTNAME' => $_ARRAYLANG['TXT_FIRSTNAME'], 'TXT_NEWSLETTER_USER_LASTNAME' => $_ARRAYLANG['TXT_LASTNAME'], 'TXT_NEWSLETTER_USER_EMAIL' => $_ARRAYLANG['TXT_EMAIL'], 'TXT_NEWSLETTER_DOMAIN_URL' => $_ARRAYLANG['TXT_NEWSLETTER_URL'], 'TXT_NEWSLETTER_CURRENT_DATE' => $_ARRAYLANG['TXT_DATE'], 'TXT_NEWSLETTER_CONFIRM_CODE' => $_ARRAYLANG['TXT_NEWSLETTER_CONFIRM_CODE'], 'TXT_NEWSLETTER_NOTIFICATION_ACTION' => $_ARRAYLANG['TXT_NEWSLETTER_NOTIFICATION_ACTION'], 'TXT_NEWSLETTER_SUBJECT' => $_ARRAYLANG['TXT_NEWSLETTER_SUBJECT'], 'TXT_NEWSLETTER_USER_EDIT_LINK' => $_ARRAYLANG['TXT_NEWSLETTER_USER_EDIT_LINK']));
     return $objTemplate->get();
 }
 /**
  * Returns an HTML formatted attribute string
  * Use Sigma for parsing
  * @param    array   $attributes
  * @return   string
  * @access   private
  */
 function _getAttrString($attributes)
 {
     $template = new \Cx\Core\Html\Sigma(ASCMS_CORE_PATH . '/Html/View/Template/Generic/');
     $template->loadTemplateFile('Attribute.html');
     $strAttr = '';
     if (is_array($attributes)) {
         $charset = HTML_Common::charset();
         foreach ($attributes as $key => $value) {
             $template->setVariable(array('ATTRIBUTE_NAME' => $key, 'ATTRIBUTE_VALUE' => htmlspecialchars($value, ENT_COMPAT, $charset)));
             $template->parse('attribute');
         }
     }
     return $template->get();
 }
 /**
  * This function finds out what we want to render and then renders the form
  *
  * @param boolean $isSingle if we only render one entry
  * @access public
  * @return string rendered view
  */
 public function render(&$isSingle = false)
 {
     global $_ARRAYLANG;
     // this case is used to generate the add entry form, where we can create an new entry
     if (!empty($_GET['add']) && !empty($this->options['functions']['add'])) {
         $isSingle = true;
         return $this->renderFormForEntry(null);
     }
     $renderObject = $this->object;
     $entityId = $this->getEntryId();
     // this case is used to get the right entry if we edit a existing one
     if ($this->object instanceof \Cx\Core_Modules\Listing\Model\Entity\DataSet && $entityId != 0) {
         if ($this->object->entryExists($entityId)) {
             $renderObject = $this->object->getEntry($entityId);
         }
     }
     // this case is used for the overview off all entities
     if ($renderObject instanceof \Cx\Core_Modules\Listing\Model\Entity\DataSet) {
         if (!empty($this->options['order']['overview'])) {
             $renderObject->sortColumns($this->options['order']['overview']);
         }
         $addBtn = '';
         $actionUrl = clone \Env::get('cx')->getRequest()->getUrl();
         if (!empty($this->options['functions']['add'])) {
             $actionUrl->setParam('add', 1);
             //remove the parameter 'vg_increment_number' from actionUrl
             //if the baseUrl contains the parameter 'vg_increment_number'
             $params = $actionUrl->getParamArray();
             if (isset($params['vg_increment_number'])) {
                 \Html::stripUriParam($actionUrl, 'vg_increment_number');
             }
             $addBtn = '<br /><br /><input type="button" name="addEtity" value="' . $_ARRAYLANG['TXT_ADD'] . '" onclick="location.href=' . "'" . $actionUrl . "&csrf=" . \Cx\Core\Csrf\Controller\Csrf::code() . "'" . '" />';
         }
         if (!count($renderObject) || !count(current($renderObject))) {
             // make this configurable
             $tpl = new \Cx\Core\Html\Sigma(\Env::get('cx')->getCodeBaseCorePath() . '/Html/View/Template/Generic');
             $tpl->loadTemplateFile('NoEntries.html');
             return $tpl->get() . $addBtn;
         }
         $listingController = new \Cx\Core_Modules\Listing\Controller\ListingController($renderObject, array(), $this->options['functions']);
         $renderObject = $listingController->getData();
         $this->options['functions']['vg_increment_number'] = $this->viewId;
         $backendTable = new \BackendTable($renderObject, $this->options) . '<br />' . $listingController;
         return $backendTable . $addBtn;
     }
     // render form for single entry view like editEntry
     $isSingle = true;
     return $this->renderFormForEntry($entityId);
 }
Exemple #22
0
 public function render()
 {
     if ($this->output) {
         return $this->output;
     }
     $template = new \Cx\Core\Html\Sigma(\Env::get('cx')->getCodeBaseCorePath() . '/Html/View/Template/Generic');
     $template->loadTemplateFile('HtmlElement.html');
     $parsedChildren = null;
     foreach ($this->getChildren() as $child) {
         $parsedChildren .= $child->render();
     }
     $template->setVariable(array('ELEMENT_NAME' => $this->name));
     if ($parsedChildren === null && $this->allowDirectClose) {
         $template->hideBlock('children');
         $template->touchBlock('nochildren');
     } else {
         $template->hideBlock('nochildren');
         $template->touchBlock('children');
         $template->setVariable(array('CHILDREN' => $parsedChildren));
     }
     foreach ($this->getAttributes() as $name => $value) {
         $template->setVariable(array('ATTRIBUTE_NAME' => $name, 'ATTRIBUTE_VALUE' => preg_replace(array("/{/", "/}/"), array("&#123;", "&#125;"), contrexx_raw2xhtml((string) $value), -1)));
         $template->parse('attribute');
     }
     $template->setVariable(array('ATTRIBUTE_NAME' => 'class', 'ATTRIBUTE_VALUE' => contrexx_raw2xhtml($this->getClasses())));
     $template->parse('attribute');
     $this->output = $template->get();
     return $this->output;
 }
Exemple #23
0
 /**
  * Sends an email with the contact details to the responsible persons
  *
  * This methode sends an email to all email addresses that are defined in the
  * option "Receiver address(es)" of the requested contact form.
  * @access private
  * @global array
  * @global array
  * @param array Details of the contact request
  * @see _getEmailAdressOfString(), phpmailer::From, phpmailer::FromName, phpmailer::AddReplyTo(), phpmailer::Subject, phpmailer::IsHTML(), phpmailer::Body, phpmailer::AddAddress(), phpmailer::Send(), phpmailer::ClearAddresses()
  */
 private function sendMail($arrFormData)
 {
     global $_ARRAYLANG, $_CONFIG;
     $plaintextBody = '';
     $replyAddress = '';
     $firstname = '';
     $lastname = '';
     $senderName = '';
     $isHtml = $arrFormData['htmlMail'] == 1 ? true : false;
     // stop send process in case no real data had been submitted
     if (!isset($arrFormData['data']) && !isset($arrFormData['uploadedFiles'])) {
         return false;
     }
     // check if we shall send the email as multipart (text/html)
     if ($isHtml) {
         // setup html mail template
         $objTemplate = new \Cx\Core\Html\Sigma('.');
         $objTemplate->setErrorHandling(PEAR_ERROR_DIE);
         $objTemplate->setTemplate($arrFormData['mailTemplate']);
         $objTemplate->setVariable(array('DATE' => date(ASCMS_DATE_FORMAT, $arrFormData['meta']['time']), 'HOSTNAME' => contrexx_raw2xhtml($arrFormData['meta']['host']), 'IP_ADDRESS' => contrexx_raw2xhtml($arrFormData['meta']['ipaddress']), 'BROWSER_LANGUAGE' => contrexx_raw2xhtml($arrFormData['meta']['lang']), 'BROWSER_VERSION' => contrexx_raw2xhtml($arrFormData['meta']['browser'])));
     }
     // TODO: check if we have to excape $arrRecipients later in the code
     $arrRecipients = $this->getRecipients(intval($_GET['cmd']));
     // calculate the longest field label.
     // this will be used to correctly align all user submitted data in the plaintext e-mail
     // TODO: check if the label of upload-fields are taken into account as well
     $maxlength = 0;
     foreach ($arrFormData['fields'] as $arrField) {
         $length = strlen($arrField['lang'][FRONTEND_LANG_ID]['name']);
         $maxlength = $maxlength < $length ? $length : $maxlength;
     }
     // try to fetch a user submitted e-mail address to which we will send a copy to
     if (!empty($arrFormData['fields'])) {
         foreach ($arrFormData['fields'] as $fieldId => $arrField) {
             // check if field validation is set to e-mail
             if ($arrField['check_type'] == '2') {
                 $mail = trim($arrFormData['data'][$fieldId]);
                 if (\FWValidator::isEmail($mail)) {
                     $replyAddress = $mail;
                     break;
                 }
             }
             if ($arrField['type'] == 'special') {
                 switch ($arrField['special_type']) {
                     case 'access_firstname':
                         $firstname = trim($arrFormData['data'][$fieldId]);
                         break;
                     case 'access_lastname':
                         $lastname = trim($arrFormData['data'][$fieldId]);
                         break;
                     default:
                         break;
                 }
             }
         }
     }
     if ($arrFormData['useEmailOfSender'] == 1 && (!empty($firstname) || !empty($lastname))) {
         $senderName = trim($firstname . ' ' . $lastname);
     } else {
         $senderName = $_CONFIG['coreGlobalPageTitle'];
     }
     // a recipient mail address which has been picked by sender
     $chosenMailRecipient = null;
     // fill the html and plaintext body with the submitted form data
     foreach ($arrFormData['fields'] as $fieldId => $arrField) {
         if ($fieldId == 'unique_id') {
             //generated for uploader. no interesting mail content.
             continue;
         }
         $htmlValue = '';
         $plaintextValue = '';
         $textAreaKeys = array();
         switch ($arrField['type']) {
             case 'label':
             case 'fieldset':
                 // TODO: parse TH row instead
             // TODO: parse TH row instead
             case 'horizontalLine':
                 // TODO: add visual horizontal line
                 // we need to use a 'continue 2' here to first break out of the switch and then move over to the next iteration of the foreach loop
                 continue 2;
                 break;
             case 'file':
             case 'multi_file':
                 $htmlValue = "";
                 $plaintextValue = "";
                 if (isset($arrFormData['uploadedFiles'][$fieldId])) {
                     $htmlValue = "<ul>";
                     foreach ($arrFormData['uploadedFiles'][$fieldId] as $file) {
                         $htmlValue .= "<li><a href='" . ASCMS_PROTOCOL . "://" . $_CONFIG['domainUrl'] . \Env::get('cx')->getWebsiteOffsetPath() . contrexx_raw2xhtml($file['path']) . "' >" . contrexx_raw2xhtml($file['name']) . "</a></li>";
                         $plaintextValue .= ASCMS_PROTOCOL . "://" . $_CONFIG['domainUrl'] . \Env::get('cx')->getWebsiteOffsetPath() . $file['path'] . "\r\n";
                     }
                     $htmlValue .= "</ul>";
                 }
                 break;
             case 'checkbox':
                 $plaintextValue = !empty($arrFormData['data'][$fieldId]) ? $_ARRAYLANG['TXT_CONTACT_YES'] : $_ARRAYLANG['TXT_CONTACT_NO'];
                 $htmlValue = $plaintextValue;
                 break;
             case 'recipient':
                 // TODO: check for XSS
                 $plaintextValue = $arrRecipients[$arrFormData['data'][$fieldId]]['lang'][FRONTEND_LANG_ID];
                 $htmlValue = $plaintextValue;
                 $chosenMailRecipient = $arrRecipients[$arrFormData['data'][$fieldId]]['email'];
                 break;
             case 'textarea':
                 //we need to know all textareas - they're indented differently then the rest of the other field types
                 $textAreaKeys[] = $fieldId;
             default:
                 $plaintextValue = isset($arrFormData['data'][$fieldId]) ? $arrFormData['data'][$fieldId] : '';
                 $htmlValue = contrexx_raw2xhtml($plaintextValue);
                 break;
         }
         $fieldLabel = $arrField['lang'][FRONTEND_LANG_ID]['name'];
         // try to fetch an e-mail address from submitted form date in case we were unable to fetch one from an input type with e-mail validation
         if (empty($replyAddress)) {
             $mail = $this->_getEmailAdressOfString($plaintextValue);
             if (\FWValidator::isEmail($mail)) {
                 $replyAddress = $mail;
             }
         }
         // parse html body
         if ($isHtml) {
             if (!empty($htmlValue)) {
                 if ($objTemplate->blockExists('field_' . $fieldId)) {
                     // parse field specific template block
                     $objTemplate->setVariable(array('FIELD_' . $fieldId . '_LABEL' => contrexx_raw2xhtml($fieldLabel), 'FIELD_' . $fieldId . '_VALUE' => $htmlValue));
                     $objTemplate->parse('field_' . $fieldId);
                 } elseif ($objTemplate->blockExists('form_field')) {
                     // parse regular field template block
                     $objTemplate->setVariable(array('FIELD_LABEL' => contrexx_raw2xhtml($fieldLabel), 'FIELD_VALUE' => $htmlValue));
                     $objTemplate->parse('form_field');
                 }
             } elseif ($objTemplate->blockExists('field_' . $fieldId)) {
                 // hide field specific template block, if present
                 $objTemplate->hideBlock('field_' . $fieldId);
             }
         }
         // parse plaintext body
         $tabCount = $maxlength - strlen($fieldLabel);
         $tabs = $tabCount == 0 ? 1 : $tabCount + 1;
         // TODO: what is this all about? - $value is undefined
         if ($arrFormData['fields'][$fieldId]['type'] == 'recipient') {
             $value = $arrRecipients[$value]['lang'][FRONTEND_LANG_ID];
         }
         if (in_array($fieldId, $textAreaKeys)) {
             // we're dealing with a textarea, don't indent value
             $plaintextBody .= $fieldLabel . ":\n" . $plaintextValue . "\n";
         } else {
             $plaintextBody .= $fieldLabel . str_repeat(" ", $tabs) . ": " . $plaintextValue . "\n";
         }
     }
     $arrSettings = $this->getSettings();
     // TODO: this is some fixed plaintext message data -> must be ported to html body
     $message = $_ARRAYLANG['TXT_CONTACT_TRANSFERED_DATA_FROM'] . " " . $_CONFIG['domainUrl'] . "\n\n";
     if ($arrSettings['fieldMetaDate']) {
         $message .= $_ARRAYLANG['TXT_CONTACT_DATE'] . " " . date(ASCMS_DATE_FORMAT, $arrFormData['meta']['time']) . "\n\n";
     }
     $message .= $plaintextBody . "\n\n";
     if ($arrSettings['fieldMetaHost']) {
         $message .= $_ARRAYLANG['TXT_CONTACT_HOSTNAME'] . " : " . contrexx_raw2xhtml($arrFormData['meta']['host']) . "\n";
     }
     if ($arrSettings['fieldMetaIP']) {
         $message .= $_ARRAYLANG['TXT_CONTACT_IP_ADDRESS'] . " : " . contrexx_raw2xhtml($arrFormData['meta']['ipaddress']) . "\n";
     }
     if ($arrSettings['fieldMetaLang']) {
         $message .= $_ARRAYLANG['TXT_CONTACT_BROWSER_LANGUAGE'] . " : " . contrexx_raw2xhtml($arrFormData['meta']['lang']) . "\n";
     }
     $message .= $_ARRAYLANG['TXT_CONTACT_BROWSER_VERSION'] . " : " . contrexx_raw2xhtml($arrFormData['meta']['browser']) . "\n";
     if (@(include_once \Env::get('cx')->getCodeBaseLibraryPath() . '/phpmailer/class.phpmailer.php')) {
         $objMail = new \phpmailer();
         if ($_CONFIG['coreSmtpServer'] > 0 && @(include_once \Env::get('cx')->getCodeBaseCorePath() . '/SmtpSettings.class.php')) {
             if (($arrSmtp = \SmtpSettings::getSmtpAccount($_CONFIG['coreSmtpServer'])) !== false) {
                 $objMail->IsSMTP();
                 $objMail->Host = $arrSmtp['hostname'];
                 $objMail->Port = $arrSmtp['port'];
                 $objMail->SMTPAuth = true;
                 $objMail->Username = $arrSmtp['username'];
                 $objMail->Password = $arrSmtp['password'];
             }
         }
         $objMail->CharSet = CONTREXX_CHARSET;
         $objMail->From = $_CONFIG['coreAdminEmail'];
         $objMail->FromName = $senderName;
         if (!empty($replyAddress)) {
             $objMail->AddReplyTo($replyAddress);
             if ($arrFormData['sendCopy'] == 1) {
                 $objMail->AddAddress($replyAddress);
             }
             if ($arrFormData['useEmailOfSender'] == 1) {
                 $objMail->From = $replyAddress;
             }
         }
         $objMail->Subject = $arrFormData['subject'];
         if ($isHtml) {
             $objMail->Body = $objTemplate->get();
             $objMail->AltBody = $message;
         } else {
             $objMail->IsHTML(false);
             $objMail->Body = $message;
         }
         // attach submitted files to email
         if (count($arrFormData['uploadedFiles']) > 0 && $arrFormData['sendAttachment'] == 1) {
             foreach ($arrFormData['uploadedFiles'] as $arrFilesOfField) {
                 foreach ($arrFilesOfField as $file) {
                     $objMail->AddAttachment(\Env::get('cx')->getWebsiteDocumentRootPath() . $file['path'], $file['name']);
                 }
             }
         }
         if ($chosenMailRecipient !== null) {
             if (!empty($chosenMailRecipient)) {
                 $objMail->AddAddress($chosenMailRecipient);
                 $objMail->Send();
                 $objMail->ClearAddresses();
             }
         } else {
             foreach ($arrFormData['emails'] as $sendTo) {
                 if (!empty($sendTo)) {
                     $objMail->AddAddress($sendTo);
                     $objMail->Send();
                     $objMail->ClearAddresses();
                 }
             }
         }
     }
     return true;
 }
 public function render(&$isSingle = false)
 {
     global $_ARRAYLANG;
     if (!empty($_GET['add']) && !empty($this->options['functions']['add'])) {
         $isSingle = true;
         return $this->renderFormForEntry(null);
     }
     $renderObject = $this->object;
     $entityClass = get_class($this->object);
     $entityId = '';
     if ($this->object instanceof \Cx\Core_Modules\Listing\Model\Entity\DataSet && $this->isInEditMode()) {
         $entityClass = $this->object->getDataType();
         $entityId = contrexx_input2raw($this->isInEditMode());
         if ($this->object->entryExists($entityId)) {
             $renderObject = $this->object->getEntry($entityId);
         }
     }
     if ($renderObject instanceof \Cx\Core_Modules\Listing\Model\Entity\DataSet) {
         if (!empty($this->options['order']['overview'])) {
             $renderObject->sortColumns($this->options['order']['overview']);
         }
         $addBtn = '';
         $actionUrl = clone \Env::get('cx')->getRequest()->getUrl();
         if (!empty($this->options['functions']['add'])) {
             $actionUrl->setParam('add', 1);
             $addBtn = '<br /><br /><input type="button" name="addEtity" value="' . $_ARRAYLANG['TXT_ADD'] . '" onclick="location.href=' . "'" . $actionUrl . "&csrf=" . \Cx\Core\Csrf\Controller\Csrf::code() . "'" . '" />';
         }
         if (!count($renderObject) || !count(current($renderObject))) {
             // make this configurable
             $tpl = new \Cx\Core\Html\Sigma(\Env::get('cx')->getCodeBaseCorePath() . '/Html/View/Template/Generic');
             $tpl->loadTemplateFile('NoEntries.html');
             return $tpl->get() . $addBtn;
         }
         $listingController = new \Cx\Core_Modules\Listing\Controller\ListingController($renderObject, array(), $this->options['functions']);
         $renderObject = $listingController->getData();
         $this->options['functions']['vg_increment_number'] = $this->number;
         $backendTable = new \BackendTable($renderObject, $this->options) . '<br />' . $listingController;
         return $backendTable . $addBtn;
     } else {
         $isSingle = true;
         return $this->renderFormForEntry($entityId);
     }
 }