/** * @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(); }
/** * Show all the runs and last runs detail * * @global array $_ARRAYLANG */ public function showCrawlerRuns() { global $_ARRAYLANG; //show the last runs details $lastRunResult = $this->crawlerRepository->getLatestRunDetails(); if ($lastRunResult) { $this->template->setVariable(array($this->moduleNameLang . '_LAST_RUN_STARTTIME' => \Cx\Core_Modules\LinkManager\Controller\DateTime::formattedDateAndTime($lastRunResult[0]->getStartTime()), $this->moduleNameLang . '_LAST_RUN_ENDTIME' => \Cx\Core_Modules\LinkManager\Controller\DateTime::formattedDateAndTime($lastRunResult[0]->getEndTime()), $this->moduleNameLang . '_LAST_RUN_DURATION' => \Cx\Core_Modules\LinkManager\Controller\DateTime::diffTime($lastRunResult[0]->getStartTime(), $lastRunResult[0]->getEndTime()), $this->moduleNameLang . '_LAST_RUN_TOTAL_LINKS' => $lastRunResult[0]->getTotalLinks(), $this->moduleNameLang . '_LAST_RUN_BROKEN_LINKS' => $lastRunResult[0]->getTotalBrokenLinks())); } else { if ($this->template->blockExists('showLastRun')) { $this->template->hideBlock('showLastRun'); } } //show Crawler Runs table //get parameters $pos = isset($_GET['pos']) ? $_GET['pos'] : 0; $langArray = \FWLanguage::getLanguageArray(); //set the settings value from DB \Cx\Core\Setting\Controller\Setting::init('LinkManager', 'config'); $pageLimit = \Cx\Core\Setting\Controller\Setting::getValue('entriesPerPage', 'LinkManager'); $parameter = './index.php?cmd=' . $this->moduleName; $this->template->setVariable('ENTRIES_PAGING', \Paging::get($parameter, $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_LINKS'], $this->crawlerRepository->crawlerEntryCount(), $pageLimit, true, $pos, 'pos')); $crawlers = $this->crawlerRepository->getCrawlerRunEntries($pos, $pageLimit); $i = 1; if ($crawlers && $crawlers->count() > 0) { foreach ($crawlers as $crawler) { $this->template->setVariable(array($this->moduleNameLang . '_CRAWLER_RUN_ID' => $crawler->getId(), $this->moduleNameLang . '_CRAWLER_RUN_LANGUAGE' => $langArray[$crawler->getLang()]['name'], $this->moduleNameLang . '_CRAWLER_RUN_STARTTIME' => \Cx\Core_Modules\LinkManager\Controller\DateTime::formattedDateAndTime($crawler->getStartTime()), $this->moduleNameLang . '_CRAWLER_RUN_ENDTIME' => \Cx\Core_Modules\LinkManager\Controller\DateTime::formattedDateAndTime($crawler->getEndTime()), $this->moduleNameLang . '_CRAWLER_RUN_DURATION' => \Cx\Core_Modules\LinkManager\Controller\DateTime::diffTime($crawler->getStartTime(), $crawler->getEndTime()), $this->moduleNameLang . '_CRAWLER_RUN_TOTAL_LINKS' => $crawler->getTotalLinks(), $this->moduleNameLang . '_CRAWLER_RUN_BROKEN_LINKS' => $crawler->getTotalBrokenLinks(), $this->moduleNameLang . '_CRAWLER_RUN_STATUS' => ucfirst($crawler->getRunStatus()), $this->moduleNameLang . '_CRAWLER_RUN_ROW' => 'row' . (++$i % 2 + 1))); $this->template->parse($this->moduleName . 'CrawlerRuns'); } $this->template->hideBlock($this->moduleName . 'NoCrawlerRunsFound'); } else { $this->template->touchBlock($this->moduleName . 'NoCrawlerRunsFound'); } }
public function showPayments() { global $_ARRAYLANG; $payments = $this->paymentRepo->findAll(); if (empty($payments)) { $payments = new \Cx\Modules\Order\Model\Entity\Payment(); } $view = new \Cx\Core\Html\Controller\ViewGenerator($payments, array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_ACT_PAYMENT'], 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false))); $this->template->setVariable('PAYMENT_CONTENT', $view->render()); }
public function showProducts() { global $_ARRAYLANG; $products = $this->productRepository->findAll(); if (empty($products)) { $products = new \Cx\Modules\Pim\Model\Entity\Product(); } $view = new \Cx\Core\Html\Controller\ViewGenerator($products, array('header' => $_ARRAYLANG['TXT_MODULE_PIM_ACT_DEFAULT'], 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false))); $this->template->setVariable('PRODUCTS_CONTENT', $view->render()); }
public function showInvoices() { global $_ARRAYLANG; $invoices = $this->invoiceRepo->findAll(); if (empty($invoices)) { $invoices = new \Cx\Modules\Order\Model\Entity\Invoice(); } $view = new \Cx\Core\Html\Controller\ViewGenerator($invoices, array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_ACT_INVOICE'], 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false))); $this->template->setVariable('INVOICE_CONTENT', $view->render()); }
/** * Show the last run's crawler result * * @global array $_ARRAYLANG */ public function showCrawlerResult() { global $_ARRAYLANG; \JS::activate('cx'); $objCx = \ContrexxJavascript::getInstance(); $objCx->setVariable(array('updateSuccessMsg' => $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_UPDATE_SUCCESS_MSG'], 'loadingLabel' => $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_LABEL_LOADING']), 'LinkManager'); if (isset($_POST['checkAgain'])) { $this->recheckSelectedLinks(); } //show crawler results //get parameters $pos = isset($_GET['pos']) ? $_GET['pos'] : 0; //set the settings value from DB \Cx\Core\Setting\Controller\Setting::init('LinkManager', 'config'); $pageLimit = \Cx\Core\Setting\Controller\Setting::getValue('entriesPerPage', 'LinkManager'); $parameter = './index.php?cmd=' . $this->moduleName . '&act=crawlerResult'; $this->template->setVariable('ENTRIES_PAGING', \Paging::get($parameter, $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_LINKS'], $this->linkRepository->brokenLinkCount(), $pageLimit, true, $pos, 'pos')); $brokenLinks = $this->linkRepository->getBrokenLinks($pos, $pageLimit); $i = 1; $objUser = new \Cx\Core_Modules\LinkManager\Controller\User(); if ($brokenLinks && $brokenLinks->count() > 0) { foreach ($brokenLinks as $brokenLink) { $this->template->setVariable(array($this->moduleNameLang . '_BROKEN_LINK_ID' => contrexx_raw2xhtml($brokenLink->getId()), $this->moduleNameLang . '_BROKEN_LINK_IMAGE' => $brokenLink->getBrokenLinkText() == $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_NO_IMAGE'] ? 'brokenImage' : 'brokenLinkImage', $this->moduleNameLang . '_BROKEN_LINK_TEXT' => $brokenLink->getBrokenLinkText(), $this->moduleNameLang . '_BROKEN_LINK_URL' => contrexx_raw2xhtml($brokenLink->getRequestedPath()), $this->moduleNameLang . '_BROKEN_LINK_REFERER' => contrexx_raw2xhtml($brokenLink->getLeadPath()) . '&pos=' . $pos . '&csrf=' . \Cx\Core\Csrf\Controller\Csrf::code(), $this->moduleNameLang . '_BROKEN_LINK_MODULE_NAME' => contrexx_raw2xhtml($brokenLink->getModuleName()), $this->moduleNameLang . '_BROKEN_LINK_ENTRY_TITLE' => contrexx_raw2xhtml($brokenLink->getEntryTitle()), $this->moduleNameLang . '_BROKEN_LINK_STATUS_CODE' => $brokenLink->getLinkStatusCode() == 0 ? $_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_NON_EXISTING_DOMAIN'] : contrexx_raw2xhtml($brokenLink->getLinkStatusCode()), $this->moduleNameLang . '_BROKEN_LINK_STATUS' => $brokenLink->getLinkStatus() ? $brokenLink->getLinkStatus() : 0, $this->moduleNameLang . '_BROKEN_LINK_STATUS_CHECKED' => $brokenLink->getLinkStatus() ? 'checked' : '', $this->moduleNameLang . '_BROKEN_LINK_DETECTED' => \Cx\Core_Modules\LinkManager\Controller\DateTime::formattedDateAndTime($brokenLink->getDetectedTime()), $this->moduleNameLang . '_BROKEN_LINK_UPDATED_BY' => $brokenLink->getUpdatedBy() ? contrexx_raw2xhtml($objUser->getUpdatedUserName($brokenLink->getUpdatedBy(), 0)) : '', $this->moduleNameLang . '_CRAWLER_BROKEN_LINK' => $brokenLink->getLinkRecheck() && $brokenLink->getLinkStatus() ? 'brokenLink' : '', $this->moduleNameLang . '_CRAWLER_RUN_ROW' => 'row' . (++$i % 2 + 1))); $this->template->parse($this->moduleName . 'CrawlerResultList'); } $this->template->hideBlock('LinkManagerNoCrawlerResultFound'); } else { $this->template->touchBlock('LinkManagerNoCrawlerResultFound'); } }
public function showProducts() { // Create view for product. This must be done in component, because ViewGenerator don't support views in first // tab. This can be delete as soon as the ViewGenerator can handle the first tab. $view = new \Cx\Core\Html\Controller\ViewGenerator('\\Cx\\Modules\\Pim\\Model\\Entity\\Product', $this->getController('Backend')->getAllViewGeneratorOptions()); $this->template->setVariable('PRODUCTS_CONTENT', $view->render()); }
public function showOrders() { global $_ARRAYLANG; $term = isset($_GET['filter-term']) ? contrexx_input2raw($_GET['filter-term']) : ''; $filterUserId = isset($_GET['filter-user-id']) ? contrexx_input2raw($_GET['filter-user-id']) : 0; $objFilterUser = null; if (!empty($term) || !empty($filterUserId)) { if ($filterUserId) { $objFilterUser = \FWUser::getFWUserObject()->objUser->getUser($filterUserId); } $orders = $this->orderRepository->findOrdersBySearchTerm($term, $objFilterUser); } else { $orders = $this->orderRepository->getAllByDesc(); } $orders = new \Cx\Core_Modules\Listing\Model\Entity\DataSet($orders); // setDataType is used to make the ViewGenerator load the proper options if $orders is empty $orders->setDataType('Cx\\Modules\\Order\\Model\\Entity\\Order'); $options = $this->getController('Backend')->getAllViewGeneratorOptions(); $view = new \Cx\Core\Html\Controller\ViewGenerator($orders, $options); if (isset($_GET['editid']) && !empty($_GET['editid']) || isset($_GET['add']) && !empty($_GET['add'])) { $this->template->hideBlock("order_filter"); } else { \FWUser::getUserLiveSearch(array('minLength' => 1, 'canCancel' => true, 'canClear' => true)); $this->template->setVariable(array('TXT_MODULE_ORDER_SEARCH' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH'], 'TXT_MODULE_ORDER_FILTER' => $_ARRAYLANG['TXT_MODULE_ORDER_FILTER'], 'TXT_MODULE_ORDER_SEARCH_TERM' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH_TERM'], 'ORDER_SEARCH_VALUE' => isset($_GET['filter-term']) ? contrexx_input2xhtml($_GET['filter-term']) : '', 'ORDER_USER_ID' => contrexx_raw2xhtml($filterUserId), 'ORDER_USER_NAME' => $objFilterUser ? contrexx_raw2xhtml(\FWUser::getParsedUserTitle($objFilterUser)) : '')); } $this->template->setVariable('ORDERS_CONTENT', $view->render()); }
/** * Display the time of the newest SysLog entry from Cron * * @global type $_ARRAYLANG */ public function showSettings() { global $_ARRAYLANG; $logRepo = $this->em->getRepository('Cx\\Core_Modules\\SysLog\\Model\\Entity\\Log'); $nameSpace = explode('\\', $this->getNamespace()); array_shift($nameSpace); $logger = implode('/', $nameSpace); $cronSysLogs = $logRepo->findLatestLogEntryByLogger($logger); $lastSysLogExecutionTime = $_ARRAYLANG['TXT_CORE_MODULE_CRON_NEVER']; if (!empty($cronSysLogs)) { $lastSysLogEntry = current($cronSysLogs); $lastSysLogExecutionTime = $lastSysLogEntry->getTimestamp()->format(ASCMS_DATE_FORMAT_DATETIME); } else { \Message::warning($_ARRAYLANG['TXT_CORE_MODULE_CRON_ERROR_MSG']); } $this->template->setVariable(array('CRON_LAST_EXECUTION' => $_ARRAYLANG['TXT_CORE_MODULE_CRON_LAST_EXECUTION'], 'CRON_LAST_EXECUTION_TIME' => $lastSysLogExecutionTime, 'CRON_SETTINGS' => $_ARRAYLANG['TXT_CORE_MODULE_CRON_ACT_SETTINGS'])); }
/** * @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(); }
public function getBackendViewMessage() { $template = new \Cx\Core\Html\Sigma(); $template->setErrorHandling(PEAR_ERROR_DIE); $template->loadTemplateFile($this->templateFile); $template->setVariable($this->templatePlaceholders); \Cx\Core\Csrf\Controller\Csrf::add_placeholder($template); return $template->get(); }
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(); }
/** * 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(); $options = $this->getController('Backend')->getAllViewGeneratorOptions(); $view = new \Cx\Core\Html\Controller\ViewGenerator($domains, $options); $this->template->setVariable('DOMAINS_CONTENT', $view->render()); }
/** * Displaying entities of job using ViewGenerator. * * @global type $_ARRAYLANG */ public function showCronJobs() { global $_ARRAYLANG; $cronJob = $this->jobRepository->findAll(); if (empty($cronJob)) { $cronJob = new \Cx\Core_Modules\Cron\Model\Entity\Job(); } $options = $this->getController('Backend')->getAllViewGeneratorOptions(); $view = new \Cx\Core\Html\Controller\ViewGenerator($cronJob, $options); $this->template->setVariable('CRON_CONTENT', $view->render()); }
/** * Get search filter dropdown * * @param mixed $filterDropDownValues * @param mixed $selected * @param string $block */ public function getSearchFilterDropDown($filterDropDownValues, $selected, $block) { foreach ($filterDropDownValues as $filterDropDownValue) { $filterDropDownName = $filterDropDownValue; if (is_object($filterDropDownValue)) { $filterDropDownName = $filterDropDownValue->getName(); $filterDropDownValue = $filterDropDownValue->getId(); } $selectedVal = in_array($filterDropDownValue, $selected) ? 'selected' : ''; $this->template->setVariable(array('ORDER_SUBSCRIPTION_' . strtoupper($block) . '_NAME' => contrexx_raw2xhtml($filterDropDownName), 'ORDER_SUBSCRIPTION_' . strtoupper($block) . '_VALUE' => contrexx_raw2xhtml($filterDropDownValue), 'ORDER_SUBSCRIPTION_' . strtoupper($block) . '_SELECTED' => $selectedVal)); $this->template->parse('subscription_' . $block . '_filter'); } }
/** * Gets the XHTML to display the widget. * @param string $containerSelector a jQuery selector defining the element * where the widget should be put into. */ public function getXhtml($containerSelector, $instanceName) { \JS::registerJS('core_modules/Upload/js/folderWidget.js'); $tpl = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/Upload/template/'); $tpl->setErrorHandling(PEAR_ERROR_DIE); $tpl->loadTemplateFile('folderWidget.html'); $tpl->setVariable('ID', $this->id); //from where the combouploader gets the code on an uploader switch $cmdOrSection = $this->isBackendRequest ? 'cmd' : 'section'; $actOrCmd = $this->isBackendRequest ? 'act' : 'cmd'; $refreshUrl = ($this->isBackendRequest ? ASCMS_ADMIN_WEB_PATH : ASCMS_PATH_OFFSET) . \Env::get('virtualLanguageDirectory') . '/index.php?' . $cmdOrSection . '=Upload&' . $actOrCmd . '=refreshFolder'; $deleteUrl = ($this->isBackendRequest ? ASCMS_ADMIN_WEB_PATH : ASCMS_PATH_OFFSET) . \Env::get('virtualLanguageDirectory') . '/index.php?' . $cmdOrSection . '=Upload&' . $actOrCmd . '=deleteFile'; \ContrexxJavascript::getInstance()->setVariable(array('refreshUrl' => $refreshUrl, 'deleteUrl' => $deleteUrl, 'files' => $this->getFilesJSON(), 'containerSelector' => $containerSelector, 'instanceName' => $instanceName), 'upload/folderWidget_' . $this->id); return $tpl->get(); }
public function showOrders() { global $_ARRAYLANG; $term = isset($_GET['filter-term']) ? contrexx_input2raw($_GET['filter-term']) : ''; $filterUserId = isset($_GET['filter-user-id']) ? contrexx_input2raw($_GET['filter-user-id']) : 0; $objFilterUser = null; if (!empty($term) || !empty($filterUserId)) { if ($filterUserId) { $objFilterUser = \FWUser::getFWUserObject()->objUser->getUser($filterUserId); } $orders = $this->orderRepository->findOrdersBySearchTerm($term, $objFilterUser); } else { $orders = $this->orderRepository->getAllByDesc(); } $view = new \Cx\Core\Html\Controller\ViewGenerator($orders, array('header' => $_ARRAYLANG['TXT_MODULE_ORDER_ACT_DEFAULT'], 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false), 'fields' => array('contactId' => array('header' => 'contactId', 'table' => array('parse' => function ($value) { global $_ARRAYLANG; $userId = \Cx\Modules\Crm\Controller\CrmLibrary::getUserIdByCrmUserId($value); $userName = \FWUser::getParsedUserTitle($userId); $crmDetailLink = "<a href='index.php?cmd=Crm&act=customers&tpl=showcustdetail&id={$value}' \n title='{$_ARRAYLANG['TXT_MODULE_ORDER_CRM_CONTACT']}'>\n <img \n src='" . \Env::get('cx')->getCodeBaseCoreWebPath() . "/Core/View/Media/navigation_level_1_189.png' \n width='16' height='16' \n alt='{$_ARRAYLANG['TXT_MODULE_ORDER_CRM_CONTACT']}'\n />\n </a>"; $url = "<a href='index.php?cmd=Access&act=user&tpl=modify&id={$userId}'\n title='{$_ARRAYLANG['TXT_MODULE_ORDER_MODIY_USER_ACCOUNT']}'>" . $userName . "</a>" . $crmDetailLink; return $url; })), 'subscriptions' => array('header' => 'subscriptions', 'table' => array('parse' => function ($subscriptions) { $result = array(); foreach ($subscriptions as $subscription) { $productEntity = $subscription->getProductEntity(); $productEntityName = $subscription->getProduct()->getName(); if (!$productEntity) { continue; } $productEditLink = $productEntity; if (method_exists($productEntity, 'getEditLink')) { $productEditLink = $productEntity->getEditLink(); } $subscriptionEditUrl = '<a href=index.php?cmd=Order&act=subscription&editid=' . $subscription->getId() . '>' . $productEntityName . '</a>'; $result[] = $subscriptionEditUrl . ' (' . $productEditLink . ')'; } return implode(', ', $result); }))))); if (isset($_GET['editid']) && !empty($_GET['editid']) || isset($_GET['add']) && !empty($_GET['add'])) { $this->template->hideBlock("order_filter"); } else { \FWUser::getUserLiveSearch(array('minLength' => 1, 'canCancel' => true, 'canClear' => true)); $this->template->setVariable(array('TXT_MODULE_ORDER_SEARCH' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH'], 'TXT_MODULE_ORDER_FILTER' => $_ARRAYLANG['TXT_MODULE_ORDER_FILTER'], 'TXT_MODULE_ORDER_SEARCH_TERM' => $_ARRAYLANG['TXT_MODULE_ORDER_SEARCH_TERM'], 'ORDER_SEARCH_VALUE' => isset($_GET['filter-term']) ? contrexx_input2xhtml($_GET['filter-term']) : '', 'ORDER_USER_ID' => contrexx_raw2xhtml($filterUserId), 'ORDER_USER_NAME' => $objFilterUser ? contrexx_raw2xhtml(\FWUser::getParsedUserTitle($objFilterUser)) : '')); } $this->template->setVariable('ORDERS_CONTENT', $view->render()); }
public function getXHtml() { global $_CORELANG; \JS::registerCSS('core_modules/Upload/css/uploaders/exposedCombo/exposedCombo.css'); \JS::registerJS('core_modules/Upload/js/uploaders/exposedCombo/exposedCombo.js'); //back up instance name, we're going to set a temporary name for the combo uploader $instanceNameBak = $this->jsInstanceName; $this->jsInstanceName = 'exposedCombo_comboUploader_' . $this->uploadId; $comboXHtml = parent::getXHtml(); $this->jsInstanceName = $instanceNameBak; $tpl = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/Upload/template/uploaders'); $tpl->setErrorHandling(PEAR_ERROR_DIE); $tpl->loadTemplateFile('exposedCombo.html'); $tpl->setVariable(array('COMBO_CODE' => $comboXHtml, 'DIALOG_TITLE' => $_CORELANG['UPLOAD_EXPOSED_DIALOG_TITLE'])); //see Uploader::handleInstanceBusiness $this->handleInstanceBusiness($tpl, 'exposedCombo'); return $tpl->get(); }
/** * FeedBack Form * * @global array $_ARRAYLANG */ public function showFeedBackForm() { global $_ARRAYLANG; $objUser = \FWUser::getFWUserObject(); //feed back types $feedBackTypes = array($_ARRAYLANG['TXT_SUPPORT_FEEDBACK_SELECT_FEEDBACK'], $_ARRAYLANG['TXT_SUPPORT_FEEDBACK_BUG_REPORT'], $_ARRAYLANG['TXT_SUPPORT_FEEDBACK_FEATURE_REQUEST'], $_ARRAYLANG['TXT_SUPPORT_FEEDBACK_HAVE_QUESTION']); \Cx\Core\Setting\Controller\Setting::init('Support', 'setup', 'Yaml'); $faqUrl = \Cx\Core\Setting\Controller\Setting::getValue('faqUrl', 'Support'); $recipientMailAddress = \Cx\Core\Setting\Controller\Setting::getValue('recipientMailAddress', 'Support'); $faqLink = '<a target="_blank" title="click to FAQ page" href=' . $faqUrl . '>' . $_ARRAYLANG['TXT_SUPPORT_FEEDBACK_FAQ'] . '</a>'; //Get License information $license = \Env::get('cx')->getLicense(); $licenseName = $license->getEditionName(); $licenseValid = date(ASCMS_DATE_FORMAT_DATE, $license->getValidToDate()); $licenseVersion = $license->getVersion()->getNumber(); //get the input datas $feedBackType = isset($_POST['feedBackType']) ? contrexx_input2raw($_POST['feedBackType']) : ''; $feedBackSubject = isset($_POST['feedBackSubject']) ? contrexx_input2raw($_POST['feedBackSubject']) : ''; $feedBackComment = isset($_POST['feedBackComment']) ? contrexx_input2raw($_POST['feedBackComment']) : ''; $customerName = isset($_POST['customerName']) ? contrexx_input2raw($_POST['customerName']) : ''; $customerEmailId = isset($_POST['customerEmailId']) ? contrexx_input2raw($_POST['customerEmailId']) : ''; $feedBackUrl = isset($_POST['feedBackUrl']) ? contrexx_input2raw($_POST['feedBackUrl']) : ''; if (isset($_POST['sendAndSave'])) { if (!empty($feedBackSubject) && !empty($feedBackComment)) { //get the hostname domain $domainRepo = new \Cx\Core\Net\Model\Repository\DomainRepository(); $domain = $domainRepo->findOneBy(array('id' => 0)); $arrFields = array('name' => contrexx_raw2xhtml($customerName), 'fromEmail' => contrexx_raw2xhtml($customerEmailId), 'feedBackType' => $feedBackType != 0 ? contrexx_raw2xhtml($feedBackTypes[$feedBackType]) : '', 'url' => $faqUrl, 'comments' => contrexx_raw2xhtml($feedBackComment), 'subject' => contrexx_raw2xhtml($feedBackSubject), 'firstName' => $objUser->objUser->getProfileAttribute('firstname'), 'lastName' => $objUser->objUser->getProfileAttribute('lastname'), 'phone' => !$objUser->objUser->getProfileAttribute('phone_office') ? $objUser->objUser->getProfileAttribute('phone_mobile') : $objUser->objUser->getProfileAttribute('phone_office'), 'company' => $objUser->objUser->getProfileAttribute('company'), 'toEmail' => $recipientMailAddress, 'licenseName' => $licenseName, 'licenseValid' => $licenseValid, 'licenseVersion' => $licenseVersion, 'domainName' => $domain ? $domain->getName() : ''); //send the feedBack mail $this->sendMail($arrFields) ? \Message::ok($_ARRAYLANG['TXT_SUPPORT_FEEDBACK_EMAIL_SEND_SUCESSFULLY']) : \Message::error($_ARRAYLANG['TXT_SUPPORT_FEEDBACK_EMAIL_SEND_FAILED']); } else { \Message::error($_ARRAYLANG['TXT_SUPPORT_ERROR_MSG_FIELDS_EMPTY']); $this->template->setVariable(array('TXT_SUPPORT_ERROR_CLASS_SUBJECT' => !empty($feedBackSubject) ? "" : "errBoxStyle", 'TXT_SUPPORT_ERROR_CLASS_COMMENT' => !empty($feedBackComment) ? "" : "errBoxStyle", 'SUPPORT_FEEDBACK_SUBJECT' => contrexx_raw2xhtml($feedBackSubject), 'SUPPORT_FEEDBACK_COMMENT' => contrexx_raw2xhtml($feedBackComment))); } } //show FeedBack Types foreach ($feedBackTypes as $key => $feedbackType) { $this->template->setVariable(array('SUPPORT_FEEDBACK_TYPES' => $feedbackType, 'SUPPORT_FEEDBACK_SELECTED_TYPE' => !empty($feedBackType) && $feedBackType == $key ? 'selected' : '', 'SUPPORT_FEEDBACK_ID' => $key)); $this->template->parse('showFeedBackTypes'); } $this->template->setVariable(array('SUPPORT_FEEDBACK_FAQ' => $faqLink, 'SUPPORT_FEEDBACK_CUSTOMER_NAME' => $objUser->objUser->getUsername(), 'SUPPORT_FEEDBACK_CUSTOMER_EMAIL' => $objUser->objUser->getEmail())); $this->template->setVariable(array('TXT_SUPPORT_FEEDBACK' => $_ARRAYLANG['TXT_SUPPORT_FEEDBACK'], 'TXT_SUPPORT_FEEDBACK_SUBJECT' => $_ARRAYLANG['TXT_SUPPORT_FEEDBACK_SUBJECT'], 'TXT_SUPPORT_FEEDBACK_COMMENTS' => $_ARRAYLANG['TXT_SUPPORT_FEEDBACK_COMMENTS'])); }
/** * Show the general setting options * * @global array $_ARRAYLANG */ public function showDefault() { global $_ARRAYLANG; \Cx\Core\Setting\Controller\Setting::init('LinkManager', 'config'); //get post values $settings = isset($_POST['setting']) ? $_POST['setting'] : array(); if (isset($_POST['save'])) { $includeFromSave = array('entriesPerPage'); foreach ($settings as $settingName => $settingValue) { if (in_array($settingName, $includeFromSave)) { \Cx\Core\Setting\Controller\Setting::set($settingName, $settingValue); \Cx\Core\Setting\Controller\Setting::update($settingName); \Message::ok($_ARRAYLANG['TXT_CORE_MODULE_LINKMANAGER_SUCCESS_MSG']); } } } //get the settings values from DB $this->template->setVariable(array($this->moduleNameLang . '_ENTRIES_PER_PAGE' => \Cx\Core\Setting\Controller\Setting::getValue('entriesPerPage', 'LinkManager'))); }
/** * 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&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&deleteid=' . (empty($ids[0][1]) ? 0 : $ids[0][1]) . '&vg_increment_number=' . (empty($ids[0][0]) ? 0 : $ids[0][0]) . '&' . $csrfParams . '\');" href="javascript:void(0);" class="delete" title="Delete entry"></a>'; } return $actionIcons; }))); $this->template->setVariable('DOMAINS_CONTENT', $view->render()); }
/** * Displaying entities of job using ViewGenerator. * * @global type $_ARRAYLANG */ public function showCronJobs() { global $_ARRAYLANG; $cronJob = $this->jobRepository->findAll(); if (empty($cronJob)) { $cronJob = new \Cx\Core_Modules\Cron\Model\Entity\Job(); } $view = new \Cx\Core\Html\Controller\ViewGenerator($cronJob, array('header' => $_ARRAYLANG['TXT_CORE_MODULE_CRON_ACT_DEFAULT'], 'functions' => array('add' => true, 'edit' => true, 'delete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false), 'fields' => array('id' => array('showOverview' => false), 'active' => array('header' => $_ARRAYLANG['TXT_CORE_MODULE_CRON_ACTIVE']), 'expression' => array('header' => $_ARRAYLANG['TXT_CORE_MODULE_CRON_EXPRESSION']), 'command' => array('header' => $_ARRAYLANG['TXT_CORE_MODULE_CRON_COMMAND'], 'storecallback' => function ($value) { return $value['command'] . ' ' . $value['arguments']; }, 'formfield' => function ($name, $type, $length, $value, $options) { $field = new \Cx\Core\Html\Model\Entity\HtmlElement('span'); $commandSelectOptions = array_keys($this->cx->getCommands()); $value = explode(' ', $value, 2); $commandSelect = new \Cx\Core\Html\Model\Entity\DataElement($name . '[command]', \Html::getOptions(array_combine(array_values($commandSelectOptions), array_values($commandSelectOptions)), isset($value[0]) ? $value[0] : ''), \Cx\Core\Html\Model\Entity\DataElement::TYPE_SELECT); $commandArguments = new \Cx\Core\Html\Model\Entity\DataElement($name . '[arguments]', isset($value[1]) ? $value[1] : ''); $field->addChild($commandSelect); $field->addChild($commandArguments); return $field; }), 'lastRan' => array('header' => $_ARRAYLANG['TXT_CORE_MODULE_CRON_LAST_RUN'])))); $this->template->setVariable('CRON_CONTENT', $view->render()); }
/** * 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; }
/** * Loads backend view Controllers (BETA) * @param \Cx\Core\ContentManager\Model\Entity\Page $page * @todo YAML assistant * @todo Cx/Module sandbox * @todo Language var checker (/translation helper) * @todo Component analysis (/testing) */ public function load(\Cx\Core\ContentManager\Model\Entity\Page $page) { $objTemplate = $this->cx->getTemplate(); $cachedRoot = $this->cx->getTemplate()->getRoot(); $this->cx->getTemplate()->setRoot(ASCMS_CORE_PATH . '/Core/View/Template/Backend'); $this->cx->getTemplate()->addBlockfile('CONTENT_OUTPUT', 'content_master', 'ContentMaster.html'); $this->cx->getTemplate()->setRoot($cachedRoot); $_ARRAYLANG = \Env::get('init')->loadLanguageData($this->getName()); // Initialize if (!isset($_GET['act'])) { $_GET['act'] = ''; } $cmd = explode('/', $_GET['act']); if (!isset($cmd[0])) { $cmd[0] = 'development'; } $controller = $cmd[0]; if (!isset($cmd[1])) { $cmd[1] = ''; } $act = $cmd[1]; // Load controller specific things switch ($controller) { case 'sandbox': // The following code is for sandbox only: if ($act == '') { $act = 'dql'; } $navEntries = array('index.php?cmd=Workbench&act=sandbox/dql' => 'DQL', 'index.php?cmd=Workbench&act=sandbox/php' => 'PHP'); $objTemplate->setVariable('ADMIN_CONTENT', new Sandbox($_ARRAYLANG, $act, $_POST)); break; case 'development': if ($act == '') { $act = 'yaml'; } default: $navEntries = array('index.php?cmd=Workbench&act=development/yaml' => 'YAML', 'index.php?cmd=Workbench&act=development/components' => 'Components'); $objTemplate->setVariable('ADMIN_CONTENT', new Toolbox($_ARRAYLANG, $act, $_POST)); break; } // set tabs $navigation = new \Cx\Core\Html\Sigma(ASCMS_CORE_PATH . '/Core/View/Template/Backend'); $navigation->loadTemplateFile('Navigation.html'); foreach ($navEntries as $href => $title) { $navigation->setVariable(array('HREF' => $href, 'TITLE' => $title)); if (strtolower($title) == $act) { $navigation->touchBlock('tab_active'); } $navigation->parse('tab_entry'); } $objTemplate->setVariable('CONTENT_NAVIGATION', $navigation->get()); }
/** * Sets up the Shop Navbar content and returns it as a string * * Note that {@see init()} must have been called before. * The content is created once and stored statically. * Repeated calls will always return the same string, unless either * a non-empty template is given, or $use_cache is set to false. * @global array $_ARRAYLANG * @global array $themesPages * @global array $_CONFIGURATION * @staticvar string $strContent Caches created content * @param type $template Replaces the default template * ($themesPages['shopnavbar']) and sets * $use_cache to false unless empty. * Defaults to NULL * @param type $use_cache Does not use any cached content, but builds * it new from scratch if false. * Defaults to true. * @return string The Shop Navbar content * @static */ static function getNavbar($template = NULL, $use_cache = true) { global $_ARRAYLANG, $themesPages; static $strContent = NULL; if (!$use_cache) { $strContent = NULL; } // Note: This is valid only as long as the content is the same every // time this method is called! if ($strContent) { return $strContent; } $objTpl = new \Cx\Core\Html\Sigma('.'); $objTpl->setErrorHandling(PEAR_ERROR_DIE); $objTpl->setTemplate(empty($template) ? $themesPages['shopnavbar'] : $template); $objTpl->setGlobalVariable($_ARRAYLANG); $loginInfo = $loginStatus = $redirect = ''; //\DBG::log("Shop::getNavbar(): Customer: ".(self::$objCustomer ? "Logged in" : "nada")); if (self::$objCustomer) { if (self::$objCustomer->company()) { $loginInfo = self::$objCustomer->company() . '<br />'; } else { $loginInfo = $_ARRAYLANG['TXT_SHOP_' . strtoupper(self::$objCustomer->gender())] . ' ' . self::$objCustomer->lastname() . '<br />'; } $loginStatus = $_ARRAYLANG['TXT_LOGGED_IN_AS']; // Show link to change the password if ($objTpl->blockExists('shop_changepass')) { $objTpl->touchBlock('shop_changepass'); } } else { // Show login form if the customer is not logged in already. $loginStatus = $_ARRAYLANG['TXT_LOGGED_IN_AS_SHOP_GUEST']; // $redirect contains something like "section=Shop&cmd=details&productId=1" if (isset($_REQUEST['redirect'])) { $redirect = $_REQUEST['redirect']; } else { $queryString = $_SERVER['QUERY_STRING']; $redirect = base64_encode(preg_replace('/\\&?act\\=\\w*/', '', $queryString)); } $objTpl->setVariable('SHOP_LOGIN_ACTION', \Cx\Core\Routing\Url::fromModuleAndCmd('Shop', 'login') . '?redirect=' . $redirect); } $objTpl->setVariable(array('SHOP_LOGIN_STATUS' => $loginStatus, 'SHOP_LOGIN_INFO' => $loginInfo)); // Currencies if (self::$show_currency_navbar && $objTpl->blockExists('shopCurrencies')) { $curNavbar = Currency::getCurrencyNavbar(); if (!empty($curNavbar)) { $objTpl->setVariable('SHOP_CURRENCIES', $curNavbar); } } if ($objTpl->blockExists('shopNavbar')) { $selectedCatId = 0; if (isset($_REQUEST['catId'])) { $selectedCatId = intval($_REQUEST['catId']); $objCategory = ShopCategory::getById($selectedCatId); if (!$objCategory) { $selectedCatId = 0; } } if (empty($selectedCatId) && isset($_REQUEST['productId'])) { $product_id = intval($_REQUEST['productId']); if (isset($_REQUEST['referer']) && $_REQUEST['referer'] == 'cart') { $product_id = Cart::get_product_id($product_id); } $objProduct = Product::getById($product_id); if ($objProduct) { $selectedCatId = $objProduct->category_id(); $selectedCatId = preg_replace('/,.+$/', '', $selectedCatId); } } // If there is no distinct Category ID, use the previous one, if any if (is_numeric($selectedCatId)) { $_SESSION['shop']['previous_category_id'] = $selectedCatId; } else { if (isset($_SESSION['shop']['previous_category_id'])) { $selectedCatId = $_SESSION['shop']['previous_category_id']; } } // Only the visible ShopCategories are present $arrShopCategoryTree = ShopCategories::getTreeArray(false, true, true, $selectedCatId, 0, 0); // The trail of IDs from root to the selected ShopCategory, // built along with the tree array when calling getTreeArray(). $arrTrail = ShopCategories::getTrailArray($selectedCatId); // Display the ShopCategories foreach ($arrShopCategoryTree as $arrShopCategory) { $level = $arrShopCategory['level']; // Skip levels too deep: if ($level >= 2) { continue; } $id = $arrShopCategory['id']; $style = 'shopnavbar' . ($level + 1); if (in_array($id, $arrTrail)) { $style .= '_active'; } $objTpl->setVariable(array('SHOP_CATEGORY_STYLE' => $style, 'SHOP_CATEGORY_ID' => $id, 'SHOP_CATEGORY_NAME' => str_repeat(' ', 3 * $level) . str_replace('"', '"', $arrShopCategory['name']))); $objTpl->parse("shopNavbar"); } } // Only show the cart info when the JS cart is not active! if (!self::$use_js_cart) { $objTpl->setVariable(array('SHOP_CART_INFO' => self::cart_info())); } // if ($objTpl->blockExists('shopJsCart')) { // $objTpl->touchBlock('shopJsCart'); // } $strContent = $objTpl->get(); return $strContent; }
/** * 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(); } } }
/** * Sets up the Payment settings view * @param \Cx\Core\Html\Sigma $objTemplate The optional Template, * by reference * @return boolean True on success, * false otherwise */ static function view_settings(&$objTemplate = null) { if (!$objTemplate) { $objTemplate = new \Cx\Core\Html\Sigma(); $objTemplate->loadTemplateFile('module_shop_settings_payment.html'); } else { $objTemplate->addBlockfile('SHOP_SETTINGS_FILE', 'settings_block', 'module_shop_settings_payment.html'); } $i = 0; foreach (Payment::getArray() as $payment_id => $arrPayment) { $zone_id = Zones::getZoneIdByPaymentId($payment_id); $objTemplate->setVariable(array('SHOP_PAYMENT_STYLE' => 'row' . (++$i % 2 + 1), 'SHOP_PAYMENT_ID' => $arrPayment['id'], 'SHOP_PAYMENT_NAME' => $arrPayment['name'], 'SHOP_PAYMENT_HANDLER_MENUOPTIONS' => PaymentProcessing::getMenuoptions($arrPayment['processor_id']), 'SHOP_PAYMENT_COST' => $arrPayment['fee'], 'SHOP_PAYMENT_COST_FREE_SUM' => $arrPayment['free_from'], 'SHOP_ZONE_SELECTION' => Zones::getMenu($zone_id, "zone_id[{$payment_id}]"), 'SHOP_PAYMENT_STATUS' => intval($arrPayment['active']) ? \Html::ATTRIBUTE_CHECKED : '')); $objTemplate->parse('shopPayment'); } $objTemplate->setVariable(array('SHOP_PAYMENT_HANDLER_MENUOPTIONS_NEW' => PaymentProcessing::getMenuoptions(-1), 'SHOP_ZONE_SELECTION_NEW' => Zones::getMenu(0, 'zone_id_new'))); // Payment Service Providers $objTemplate->setVariable(array('SHOP_PAYMILL_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('paymill_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_PAYMILL_TEST_SELECTED' => \Cx\Core\Setting\Controller\Setting::getValue('paymill_use_test_account', 'Shop') == 0 ? \Html::ATTRIBUTE_SELECTED : '', 'SHOP_PAYMILL_LIVE_SELECTED' => \Cx\Core\Setting\Controller\Setting::getValue('paymill_use_test_account', 'Shop') == 1 ? \Html::ATTRIBUTE_SELECTED : '', 'SHOP_PAYMILL_TEST_PRIVATE_KEY' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paymill_test_private_key', 'Shop')), 'SHOP_PAYMILL_TEST_PUBLIC_KEY' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paymill_test_public_key', 'Shop')), 'SHOP_PAYMILL_LIVE_PRIVATE_KEY' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paymill_live_private_key', 'Shop')), 'SHOP_PAYMILL_LIVE_PUBLIC_KEY' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paymill_live_public_key', 'Shop')), 'SHOP_PAYMILL_PRIVATE_KEY' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paymill_private_key', 'Shop')), 'SHOP_PAYMILL_PUBLIC_KEY' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paymill_public_key', 'Shop')), 'SHOP_SAFERPAY_ID' => \Cx\Core\Setting\Controller\Setting::getValue('saferpay_id', 'Shop'), 'SHOP_SAFERPAY_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('saferpay_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_SAFERPAY_TEST_ID' => \Cx\Core\Setting\Controller\Setting::getValue('saferpay_use_test_account', 'Shop'), 'SHOP_SAFERPAY_TEST_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('saferpay_use_test_account', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_SAFERPAY_FINALIZE_PAYMENT' => \Cx\Core\Setting\Controller\Setting::getValue('saferpay_finalize_payment', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_SAFERPAY_WINDOW_MENUOPTIONS' => \Saferpay::getWindowMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('saferpay_window_option', 'Shop')), 'SHOP_PAYREXX_INSTANCE_NAME' => \Cx\Core\Setting\Controller\Setting::getValue('payrexx_instance_name', 'Shop'), 'SHOP_PAYREXX_API_SECRET' => \Cx\Core\Setting\Controller\Setting::getValue('payrexx_api_secret', 'Shop'), 'SHOP_PAYREXX_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('payrexx_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_YELLOWPAY_SHOP_ID' => \Cx\Core\Setting\Controller\Setting::getValue('postfinance_shop_id', 'Shop'), 'SHOP_YELLOWPAY_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('postfinance_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_YELLOWPAY_HASH_SIGNATURE_IN' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('postfinance_hash_signature_in', 'Shop')), 'SHOP_YELLOWPAY_HASH_SIGNATURE_OUT' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('postfinance_hash_signature_out', 'Shop')), 'SHOP_YELLOWPAY_AUTHORIZATION_TYPE_OPTIONS' => \Yellowpay::getAuthorizationMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('postfinance_authorization_type', 'Shop')), 'SHOP_YELLOWPAY_USE_TESTSERVER_CHECKED' => \Cx\Core\Setting\Controller\Setting::getValue('postfinance_use_testserver', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_POSTFINANCE_MOBILE_WEBUSER' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('postfinance_mobile_webuser', 'Shop')), 'SHOP_POSTFINANCE_MOBILE_SIGN' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('postfinance_mobile_sign', 'Shop')), 'SHOP_POSTFINANCE_MOBILE_IJUSTWANTTOTEST_CHECKED' => \Cx\Core\Setting\Controller\Setting::getValue('postfinance_mobile_ijustwanttotest', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_POSTFINANCE_MOBILE_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('postfinance_mobile_status', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_DATATRANS_AUTHORIZATION_TYPE_OPTIONS' => \Datatrans::getReqtypeMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('datatrans_request_type', 'Shop')), 'SHOP_DATATRANS_MERCHANT_ID' => \Cx\Core\Setting\Controller\Setting::getValue('datatrans_merchant_id', 'Shop'), 'SHOP_DATATRANS_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('datatrans_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_DATATRANS_USE_TESTSERVER_YES_CHECKED' => \Cx\Core\Setting\Controller\Setting::getValue('datatrans_use_testserver', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_DATATRANS_USE_TESTSERVER_NO_CHECKED' => \Cx\Core\Setting\Controller\Setting::getValue('datatrans_use_testserver', 'Shop') ? '' : \Html::ATTRIBUTE_CHECKED, 'SHOP_PAYPAL_EMAIL' => contrexx_raw2xhtml(\Cx\Core\Setting\Controller\Setting::getValue('paypal_account_email', 'Shop')), 'SHOP_PAYPAL_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('paypal_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_PAYPAL_DEFAULT_CURRENCY_MENUOPTIONS' => \PayPal::getAcceptedCurrencyCodeMenuoptions(\Cx\Core\Setting\Controller\Setting::getValue('paypal_default_currency', 'Shop')), 'SHOP_PAYMENT_LSV_STATUS' => \Cx\Core\Setting\Controller\Setting::getValue('payment_lsv_active', 'Shop') ? \Html::ATTRIBUTE_CHECKED : '', 'SHOP_PAYMENT_DEFAULT_CURRENCY' => Currency::getDefaultCurrencySymbol(), 'SHOP_CURRENCY_CODE' => Currency::getCurrencyCodeById(Currency::getDefaultCurrencyId()))); return true; }
/** * 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(); }
/** * Set the language list page * * @global array * @global ADONewConnection * @global \Cx\Core\Html\Sigma * @return void */ function languageOverview() { global $_ARRAYLANG, $objDatabase; // init vars $i = 0; \JS::activate('cx'); $cxjs = \ContrexxJavascript::getInstance(); $cxjs->setVariable('copyTitle', $_ARRAYLANG['TXT_LANGUAGE_COPY_TITLE'], 'language/lang'); $cxjs->setVariable('copyText', $_ARRAYLANG['TXT_LANGUAGE_COPY_TEXT'], 'language/lang'); $cxjs->setVariable('copySuccess', $_ARRAYLANG['TXT_LANGUAGE_COPY_SUCCESS'], 'language/lang'); $cxjs->setVariable('linkTitle', $_ARRAYLANG['TXT_LANGUAGE_LINK_TITLE'], 'language/lang'); $cxjs->setVariable('linkText', $_ARRAYLANG['TXT_LANGUAGE_LINK_TEXT'], 'language/lang'); $cxjs->setVariable('linkSuccess', $_ARRAYLANG['TXT_LANGUAGE_LINK_SUCCESS'], 'language/lang'); $cxjs->setVariable('warningTitle', $_ARRAYLANG['TXT_LANGUAGE_WARNING_TITLE'], 'language/lang'); $cxjs->setVariable('warningText', $_ARRAYLANG['TXT_LANGUAGE_WARNING_TEXT'], 'language/lang'); $cxjs->setVariable('waitTitle', $_ARRAYLANG['TXT_LANGUAGE_WAIT_TITLE'], 'language/lang'); $cxjs->setVariable('waitText', $_ARRAYLANG['TXT_LANGUAGE_WAIT_TEXT'], 'language/lang'); $cxjs->setVariable('yesOption', $_ARRAYLANG['TXT_YES'], 'language/lang'); $cxjs->setVariable('noOption', $_ARRAYLANG['TXT_NO'], 'language/lang'); $cxjs->setVariable('langRemovalLabel', $_ARRAYLANG['TXT_LANGUAGE_MANAGER_LABEL_LANG_REMOVAL'], 'language/lang'); $cxjs->setVariable('langRemovalContent', $_ARRAYLANG['TXT_LANGUAGE_MANAGER_LANG_REMOVAL_CONTENT'], 'language/lang'); $this->template->loadTemplateFile('language_langlist.html'); $this->pageTitle = $_ARRAYLANG['TXT_LANGUAGE_LIST']; if (!$this->isInFullMode()) { $this->hideVariables = true; $this->template->hideBlock('extendedTitles'); $this->template->hideBlock('extendedHeaders'); } else { $this->template->touchBlock('extendedTitles'); } //begin language variables $this->template->setVariable(array('TXT_ADD_NEW_LANGUAGE' => $_ARRAYLANG['TXT_ADD_NEW_LANGUAGE'], 'TXT_NAME' => $_ARRAYLANG['TXT_NAME'], 'TXT_SHORT_NAME' => $_ARRAYLANG['TXT_SHORT_NAME'], 'TXT_CHARSET' => $_ARRAYLANG['TXT_CHARSET'], 'TXT_ADD' => $_ARRAYLANG['TXT_ADD'], 'TXT_LANGUAGE_LIST' => $_ARRAYLANG['TXT_LANGUAGE_LIST'], 'TXT_ID' => $_ARRAYLANG['TXT_ID'], 'TXT_SHORT_FORM' => $_ARRAYLANG['TXT_SHORT_FORM'], 'TXT_STANDARD_LANGUAGE' => $_ARRAYLANG['TXT_STANDARD_LANGUAGE'], 'TXT_ACTION' => $_ARRAYLANG['TXT_ACTION'], 'TXT_ACCEPT_CHANGES' => $_ARRAYLANG['TXT_ACCEPT_CHANGES'], 'TXT_REMARK' => $_ARRAYLANG['TXT_REMARK'], 'TXT_ADD_DELETE_LANGUAGE_REMARK' => $_ARRAYLANG['TXT_ADD_DELETE_LANGUAGE_REMARK'], 'TXT_CONFIRM_DELETE_DATA' => $_ARRAYLANG['TXT_CONFIRM_DELETE_DATA'], 'TXT_ACTION_IS_IRREVERSIBLE' => $_ARRAYLANG['TXT_ACTION_IS_IRREVERSIBLE'], 'TXT_VALUE' => $_ARRAYLANG['TXT_VALUE'], 'TXT_MODULE' => $_ARRAYLANG['TXT_MODULE'], 'TXT_LANGUAGE' => $_ARRAYLANG['TXT_LANGUAGE'], 'TXT_STATUS' => $_ARRAYLANG['TXT_STATUS'], 'TXT_VIEW' => $_ARRAYLANG['TXT_VIEW'], 'TXT_CONTROLLED' => $_ARRAYLANG['TXT_CONTROLLED'], 'TXT_OPEN_ISSUE' => $_ARRAYLANG['TXT_OPEN_ISSUE'], 'TXT_SHORT_NAME' => $_ARRAYLANG['TXT_SHORT_NAME'], 'TXT_LANGUAGE_DEPENDANT_SYSTEM_VARIABLES' => $_ARRAYLANG['TXT_LANGUAGE_DEPENDANT_SYSTEM_VARIABLES'], 'TXT_ADMINISTRATION_PAGES' => $_ARRAYLANG['TXT_ADMINISTRATION_PAGES'], 'TXT_WEB_PAGES' => $_ARRAYLANG['TXT_WEB_PAGES'], 'TXT_SECTION' => $_ARRAYLANG['TXT_SECTION'], 'TXT_CORE_FALLBACK' => $_ARRAYLANG['TXT_CORE_FALLBACK'], 'TXT_LANGUAGE_MANAGER_OK' => $_ARRAYLANG['TXT_LANGUAGE_MANAGER_OK'])); $this->template->setGlobalVariable(array('TXT_DEFAULT_LANGUAGE' => $_ARRAYLANG['TXT_STANDARD_LANGUAGE'], 'TXT_CORE_NONE' => $_ARRAYLANG['TXT_CORE_NONE'], 'CMD' => contrexx_input2xhtml($_GET['cmd']), 'TXT_LANGUAGE_ACTION_COPY' => $_ARRAYLANG['TXT_LANGUAGE_ACTION_COPY'], 'TXT_LANGUAGE_ACTION_LINK' => $_ARRAYLANG['TXT_LANGUAGE_ACTION_LINK'])); //end language variables if ($this->hideVariables == true) { $this->template->setGlobalVariable(array('LANGUAGE_ADMIN_STYLE' => 'display: none')); } else { $this->template->setGlobalVariable(array('LANGUAGE_ADMIN_STYLE' => 'display: block')); } $arrLanguages = \FWLanguage::getActiveFrontendLanguages(); $this->template->setVariable('LANGUAGE_MANAGER_ACTIVE_LANGIDS', implode(', ', array_keys($arrLanguages))); $objResult = $objDatabase->Execute("SELECT * FROM " . DBPREFIX . "languages ORDER BY id"); if ($objResult !== false) { while (!$objResult->EOF) { $checked = ""; if ($objResult->fields['is_default'] == "true") { $checked = "checked"; } $status = "<input type='radio' name='langDefaultStatus' onchange='updateCurrent();' value='" . $objResult->fields['id'] . "' {$checked} />"; $checked = ""; if ($objResult->fields['frontend'] == 1) { $checked = "checked"; } $activeStatus = "<input type='checkbox' name='langActiveStatus[" . $objResult->fields['id'] . "]' onchange='updateCurrent();' value='1' {$checked} />"; $checked = ""; if ($objResult->fields['backend'] == 1) { $checked = "checked"; } $selectedLang = ''; switch ($objResult->fields['fallback']) { case '': $this->template->setVariable('NONE_SELECTED', 'selected="selected"'); break; case '0': $this->template->setVariable('LANGUAGE_DEFAULT_SELECTED', 'selected="selected"'); break; default: $selectedLang = $objResult->fields['fallback']; } // set fallback language drop down foreach ($arrLanguages as $langId => $arrLanguage) { $selected = $langId == $selectedLang ? 'selected="selected"' : ''; $this->template->setVariable(array('LANGUAGE_LANG_ID' => $langId, 'LANGUAGE_LANG_OPTION' => contrexx_raw2xhtml($arrLanguage['name']), 'LANGUAGE_OPTION_SELECTED' => $selected)); $this->template->parse('fallbackLanguages'); } $adminStatus = "<input type='checkbox' name='langAdminStatus[" . $objResult->fields['id'] . "]' value='1' {$checked} />"; $this->template->setVariable(array('LANGUAGE_ROWCLASS' => 'row' . ($i++ % 2 + 1), 'LANGUAGE_LANG_ID' => $objResult->fields['id'], 'LANGUAGE_LANG_NAME' => $objResult->fields['name'], 'LANGUAGE_LANG_SHORTNAME' => $objResult->fields['lang'], 'LANGUAGE_LANG_CHARSET' => $objResult->fields['charset'], 'LANGUAGE_LANG_STATUS' => $status, 'LANGUAGE_ACTIVE_STATUS' => $activeStatus, 'LANGUAGE_ADMIN_STATUS' => $adminStatus)); if (!$this->isInFullMode()) { $this->template->hideBlock('extendedOptions'); } $this->template->parse('languageRow'); $objResult->MoveNext(); } } }
/** * Set the registration list place holder to the template * * @param object $objTpl Template object * @param string tpl Template type * * @return null */ function showRegistrationList($objTpl, $tpl) { global $objDatabase, $_LANGID, $_ARRAYLANG; $objResult = $objDatabase->Execute('SELECT count(DISTINCT `field_id`) AS `count_form_fields` FROM `' . DBPREFIX . 'module_' . $this->moduleTablePrefix . '_registration_form_field_name` WHERE `form_id` = ' . $this->formId); $objTpl->setVariable($this->moduleLangVar . '_COUNT_FORM_FIELDS', $objResult->fields['count_form_fields'] + 4); $query = ' SELECT `formField`.`id`, ( SELECT `fieldName`.`name` FROM `' . DBPREFIX . 'module_' . $this->moduleTablePrefix . '_registration_form_field_name` AS `fieldName` WHERE `fieldName`.`field_id` = `formField`.`id` AND `fieldName`.`form_id` = `formField`.`form` ORDER BY CASE `fieldName`.`lang_id` WHEN ' . $_LANGID . ' THEN 1 ELSE 2 END LIMIT 1 ) AS `name`, ( SELECT `fieldDefault`.`default` FROM `' . DBPREFIX . 'module_' . $this->moduleTablePrefix . '_registration_form_field_name` AS `fieldDefault` WHERE `fieldDefault`.`field_id` = `formField`.`id` AND `fieldDefault`.`form_id` = `formField`.`form` ORDER BY CASE `fieldDefault`.`lang_id` WHEN ' . $_LANGID . ' THEN 1 ELSE 2 END LIMIT 1 ) AS `default`, `formField`.`type` FROM `' . DBPREFIX . 'module_' . $this->moduleTablePrefix . '_registration_form_field` AS `formField` WHERE `formField`.`form` = ' . $this->formId . ' ORDER BY `formField`.`order` '; $objResult = $objDatabase->Execute($query); if ($objResult !== false) { $objTpl->setVariable($this->moduleLangVar . '_REGISTRATION_NAME', '#'); $objTpl->parse('eventRegistrationName'); $dateFilterTpl = new \Cx\Core\Html\Sigma(\Cx\Core\Core\Controller\Cx::instanciate()->getCodeBaseModulePath() . '/' . $this->moduleName . '/View/Template/Backend'); $dateFilterTpl->loadTemplateFile('module_calendar_registration_date_filter.html'); $dateFilterTpl->setVariable('TXT_CALENDAR_DATE', $_ARRAYLANG['TXT_CALENDAR_DATE']); $eventStats = $this->getEventStats(); $selectedDateFilter = $this->defaultView && isset($_GET['date']) ? contrexx_input2raw($_GET['date']) : ''; $this->parseEventRegistrationStats($dateFilterTpl, $eventStats, $selectedDateFilter); $objTpl->setVariable($this->moduleLangVar . '_REGISTRATION_NAME', $dateFilterTpl->get()); $objTpl->parse('eventRegistrationName'); //display the registration submission date header $objTpl->setVariable($this->moduleLangVar . '_REGISTRATION_NAME', $_ARRAYLANG['TXT_CALENDAR_EVENT_REGISTRATION_SUBMISSION']); $objTpl->parse('eventRegistrationName'); $arrFieldColumns = array(); $arrDefaults = array(); while (!$objResult->EOF) { if (!in_array($objResult->fields['type'], array('agb', 'fieldset'))) { $arrFieldColumns[] = $objResult->fields['id']; $arrDefaults[$objResult->fields['id']] = !empty($objResult->fields['default']) ? explode(',', $objResult->fields['default']) : array(); $objTpl->setVariable($this->moduleLangVar . '_REGISTRATION_NAME', contrexx_raw2xhtml($objResult->fields['name'])); $objTpl->parse('eventRegistrationName'); } $objResult->MoveNext(); } //$objTpl->setVariable($this->moduleLangVar.'_REGISTRATION_NAME', $_ARRAYLANG['TXT_CALENDAR_PAYMENT_METHOD']); $objTpl->setVariable(array($this->moduleLangVar . '_REGISTRATION_NAME' => $_ARRAYLANG['TXT_CALENDAR_ACTION'], $this->moduleLangVar . '_REG_COL_ATTRIBUTES' => "style='text-align:right;'")); $objTpl->parse('eventRegistrationName'); } $query = ' SELECT `v`.`reg_id`, `v`.`field_id`, `v`.`value`, `f`.`type` FROM `' . DBPREFIX . 'module_' . $this->moduleTablePrefix . '_registration_form_field_value` AS `v` INNER JOIN `' . DBPREFIX . 'module_' . $this->moduleTablePrefix . '_registration_form_field` AS `f` ON `v`.`field_id` = `f`.`id` WHERE `f`.`form` = ' . $this->formId . ' ORDER BY `f`.`order` '; $objResult = $objDatabase->Execute($query); $arrValues = array(); if ($objResult !== false) { while (!$objResult->EOF) { if (!in_array($objResult->fields['type'], array('agb', 'fieldset'))) { $options = $arrDefaults[$objResult->fields['field_id']]; $value = ''; switch ($objResult->fields['type']) { case 'firstname': case 'lastname': case 'inputtext': case 'textarea': case 'mail': // case 'selectBillingAddress': $value = $objResult->fields['value']; break; case 'salutation': case 'seating': case 'select': $value = $options[$objResult->fields['value'] - 1]; break; case 'radio': case 'checkbox': $output = array(); $input = ''; foreach (explode(',', $objResult->fields['value']) as $value) { $arrValue = explode('[[', $value); $value = $arrValue[0]; $input = str_replace(']]', '', $arrValue[1]); $newOptions = explode('[[', $options[$value - 1]); if (!empty($input)) { $output[] = $newOptions[0] . ": " . $input; } else { if ($newOptions[0] == '') { $newOptions[0] = $value == 1 ? $_ARRAYLANG['TXT_CALENDAR_YES'] : $_ARRAYLANG['TXT_CALENDAR_NO']; } $output[] = $newOptions[0]; } $value = implode(", ", $output); } break; } $arrValues[$objResult->fields['reg_id']][$objResult->fields['field_id']] = $value; } $objResult->MoveNext(); } } $i = 0; //$paymentMethods = explode(',', $_ARRAYLANG["TXT_PAYMENT_METHODS"]); if (empty($this->registrationList)) { $objTpl->touchBlock("emptyEventRegistrationList"); } else { $objTpl->hideBlock("emptyEventRegistrationList"); } foreach ($this->registrationList as $objRegistration) { $checkbox = '<input type="checkbox" name="selectedRegistrationId[]" class="selectedRegistrationId" value="' . $objRegistration->id . '" />'; $objTpl->setVariable($this->moduleLangVar . '_REGISTRATION_VALUE', $checkbox); $objTpl->parse('eventRegistrationValue'); $objTpl->setVariable($this->moduleLangVar . '_REGISTRATION_VALUE', date("d.m.Y", $objRegistration->eventDate)); $objTpl->parse('eventRegistrationValue'); //display the registration submission date value $objTpl->setVariable($this->moduleLangVar . '_REGISTRATION_VALUE', $objRegistration->submissionDate instanceof \DateTime ? $this->format2userDateTime($objRegistration->submissionDate) : ''); $objTpl->parse('eventRegistrationValue'); foreach ($arrFieldColumns as $fieldId) { $objTpl->setVariable($this->moduleLangVar . '_REGISTRATION_VALUE', isset($arrValues[$objRegistration->id][$fieldId]) ? contrexx_raw2xhtml($arrValues[$objRegistration->id][$fieldId]) : ''); $objTpl->parse('eventRegistrationValue'); } /*unset($paymentMethod); switch ($objRegistration->paymentMethod) { case 1: $paymentMethod = $paymentMethods[1]; break; case 2: $paymentMethod = $paymentMethods[2]; break; default: $paymentMethod = $paymentMethods[0]; break; }*/ //$objTpl->setVariable($this->moduleLangVar.'_REGISTRATION_VALUE', $paymentMethod . " (" . ($objRegistration->paid ? $_ARRAYLANG["TXT_PAYMENT_COMPLETED"] : $_ARRAYLANG["TXT_PAYMENT_INCOMPLETED"]) . ")"); //$objTpl->parse('eventRegistrationValue'); $links = ' <a style="float: right;" class="delete_registration" href="index.php?cmd=' . $this->moduleName . '&act=event_registrations&tpl=' . $tpl . '&id=' . $this->eventId . '&delete=' . $objRegistration->id . '" title="' . $_ARRAYLANG['TXT_CALENDAR_DELETE'] . '"><img src="../core/Core/View/Media/icons/delete.gif" width="17" height="17" border="0" alt="' . $_ARRAYLANG['TXT_CALENDAR_DELETE'] . '" /></a> <a style="float: right;" href="index.php?cmd=' . $this->moduleName . '&act=modify_registration&tpl=' . $tpl . '&event_id=' . $this->eventId . '&reg_id=' . $objRegistration->id . '" title="' . $_ARRAYLANG['TXT_CALENDAR_EDIT'] . '"><img src="../core/Core/View/Media/icons/edit.gif" width="16" height="16" border="0" alt="' . $_ARRAYLANG['TXT_CALENDAR_EDIT'] . '" /></a> '; $objTpl->setVariable($this->moduleLangVar . '_REGISTRATION_VALUE', $links); $objTpl->parse('eventRegistrationValue'); $objTpl->setVariable($this->moduleLangVar . '_REGISTRATION_ROW', $i % 2 == 0 ? 'row1' : 'row2'); $objTpl->parse('eventRegistrationList'); $i++; } }