예제 #1
0
 /**
  * @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();
 }
 /**
  * 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&act=user&tpl=modify&id=' . $objUser->getId(), 'LINK_CM' => ASCMS_PATH_OFFSET . '/cadmin/index.php?cmd=ContentManager&page=' . $page->getId() . '&tab=content'));
     $objTemplate->_blocks['__global__'] = preg_replace('/<body[^>]*>/', '\\0' . $componentTemplate->get(), $objTemplate->_blocks['__global__']);
 }
 /**
  * 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');
     }
 }
예제 #4
0
 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();
 }
 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 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());
 }
 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());
 }
예제 #9
0
 /**
  * Gets the XHTML to display the widget.
  * @param string $containerSelector a jQuery selector defining the element
  *                                  where the widget should be put into.
  */
 public function getXhtml($containerSelector, $instanceName)
 {
     \JS::registerJS('core_modules/Upload/js/folderWidget.js');
     $tpl = new \Cx\Core\Html\Sigma(ASCMS_CORE_MODULE_PATH . '/Upload/template/');
     $tpl->setErrorHandling(PEAR_ERROR_DIE);
     $tpl->loadTemplateFile('folderWidget.html');
     $tpl->setVariable('ID', $this->id);
     //from where the combouploader gets the code on an uploader switch
     $cmdOrSection = $this->isBackendRequest ? 'cmd' : 'section';
     $actOrCmd = $this->isBackendRequest ? 'act' : 'cmd';
     $refreshUrl = ($this->isBackendRequest ? ASCMS_ADMIN_WEB_PATH : ASCMS_PATH_OFFSET) . \Env::get('virtualLanguageDirectory') . '/index.php?' . $cmdOrSection . '=Upload&' . $actOrCmd . '=refreshFolder';
     $deleteUrl = ($this->isBackendRequest ? ASCMS_ADMIN_WEB_PATH : ASCMS_PATH_OFFSET) . \Env::get('virtualLanguageDirectory') . '/index.php?' . $cmdOrSection . '=Upload&' . $actOrCmd . '=deleteFile';
     \ContrexxJavascript::getInstance()->setVariable(array('refreshUrl' => $refreshUrl, 'deleteUrl' => $deleteUrl, 'files' => $this->getFilesJSON(), 'containerSelector' => $containerSelector, 'instanceName' => $instanceName), 'upload/folderWidget_' . $this->id);
     return $tpl->get();
 }
 /**
  * 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');
     }
 }
예제 #11
0
 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());
 }
예제 #12
0
 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());
 }
 /**
  * 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']));
 }
 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();
 }
 /**
  * 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());
 }
 /**
  * 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());
 }
 /**
  * This is called by the default ComponentController and does all the repeating work
  *
  * This creates a template of the page content and calls parsePage($template)
  * @param \Cx\Core\ContentManager\Model\Entity\Page $page Resolved page
  */
 public function getPage(\Cx\Core\ContentManager\Model\Entity\Page $page)
 {
     global $_ARRAYLANG;
     // init component template
     $componentTemplate = new \Cx\Core\Html\Sigma('.');
     $componentTemplate->setErrorHandling(PEAR_ERROR_DIE);
     $componentTemplate->setTemplate($page->getContent());
     // default css and js
     if (file_exists($this->cx->getClassLoader()->getFilePath($this->getDirectory(false) . '/View/Style/Frontend.css'))) {
         \JS::registerCSS(substr($this->getDirectory(false, true) . '/View/Style/Frontend.css', 1));
     }
     if (file_exists($this->cx->getClassLoader()->getFilePath($this->getDirectory(false) . '/View/Script/Frontend.js'))) {
         \JS::registerJS(substr($this->getDirectory(false, true) . '/View/Script/Frontend.js', 1));
     }
     // parse page
     $componentTemplate->setGlobalVariable($_ARRAYLANG);
     $this->parsePage($componentTemplate, $page->getCmd());
     \Cx\Core\Csrf\Controller\Csrf::add_placeholder($componentTemplate);
     $page->setContent($componentTemplate->get());
 }
예제 #18
0
 /**
  * @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();
 }
 /**
  * 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');
     }
 }
 /**
  * Use this to parse your backend page
  *
  * You will get the template located in /View/Template/{CMD}.html
  * You can access Cx class using $this->cx
  * To show messages, use \Message class
  * @param \Cx\Core\Html\Sigma $template Template for current CMD
  * @param array $cmd CMD separated by slashes
  */
 public function parsePage(\Cx\Core\Html\Sigma $template, array $cmd)
 {
     global $_ARRAYLANG, $objInit;
     $objTpl = new \Cx\Core\Html\Sigma($this->getDirectory(true) . '/View/Template/Backend');
     //merge language
     $langData = $objInit->loadLanguageData('Pdf');
     $_ARRAYLANG = array_merge($_ARRAYLANG, $langData);
     $objTpl->setGlobalVariable($_ARRAYLANG);
     $objTpl->loadTemplatefile('Default.html');
     // Not an entity, parse overview or settings
     switch (current($cmd)) {
         default:
             // Parse entity view generation pages
             $entityClassName = $this->getNamespace() . '\\Model\\Entity\\PdfTemplate';
             $this->parseEntityClassPage($objTpl, $entityClassName, 'PdfTemplate');
             if ($objTpl->blockExists('overview')) {
                 $objTpl->touchBlock('overview');
             }
             break;
     }
     \JS::registerCSS(substr($this->getDirectory(false, true) . '/View/Style/Backend.css', 1));
     $template->setVariable(array('CONTENT_TITLE' => $_ARRAYLANG['TXT_CORE_MODULE_PDF'], 'ADMIN_CONTENT' => $objTpl->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&amp;act=customers&amp;tpl=showcustdetail&amp;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&amp;act=user&amp;tpl=modify&amp;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());
 }
 /**
  * Show all the Domain Alias
  * 
  * @global array $_ARRAYLANG
  */
 public function showDomains()
 {
     global $_ARRAYLANG, $objInit;
     $langData = $objInit->loadLanguageData('Config');
     $_ARRAYLANG = array_merge($_ARRAYLANG, $langData);
     $domainRepository = new \Cx\Core\Net\Model\Repository\DomainRepository();
     $domains = $domainRepository->findAll();
     $view = new \Cx\Core\Html\Controller\ViewGenerator($domains, array('header' => $_ARRAYLANG['TXT_CORE_NETMANAGER'], 'entityName' => $_ARRAYLANG['TXT_CORE_NETMANAGER_ENTITY'], 'fields' => array('name' => array('header' => $_ARRAYLANG['TXT_NAME'], 'table' => array('parse' => function ($value) {
         global $_ARRAYLANG;
         static $mainDomainName;
         if (empty($mainDomainName)) {
             $domainRepository = new \Cx\Core\Net\Model\Repository\DomainRepository();
             $mainDomainName = $domainRepository->getMainDomain()->getName();
         }
         $domainName = contrexx_raw2xhtml(\Cx\Core\Net\Controller\ComponentController::convertIdnToUtf8Format($value));
         if ($domainName != contrexx_raw2xhtml($value)) {
             $domainName .= ' (' . contrexx_raw2xhtml($value) . ')';
         }
         $mainDomainIcon = '';
         if ($value == $mainDomainName) {
             $mainDomainIcon = ' <img src="' . \Env::get('cx')->getCodeBaseCoreWebPath() . '/Core/View/Media/icons/Home.png" title="' . $_ARRAYLANG['TXT_CORE_CONFIG_MAINDOMAINID'] . '" />';
         }
         return $domainName . $mainDomainIcon;
     }), 'formfield' => function ($fieldname, $fieldtype, $fieldlength, $fieldvalue, $fieldoptions) {
         return \Cx\Core\Net\Controller\ComponentController::convertIdnToUtf8Format($fieldvalue);
     }), 'id' => array('showOverview' => false)), 'functions' => array('add' => true, 'edit' => false, 'allowEdit' => true, 'delete' => false, 'allowDelete' => true, 'sorting' => true, 'paging' => true, 'filtering' => false, 'actions' => function ($rowData, $rowId) {
         global $_CORELANG;
         static $mainDomainName;
         if (empty($mainDomainName)) {
             $domainRepository = new \Cx\Core\Net\Model\Repository\DomainRepository();
             $mainDomainName = $domainRepository->getMainDomain()->getName();
         }
         preg_match_all('/\\d+/', $rowId, $ids, null, 0);
         $actionIcons = '';
         $csrfParams = \Cx\Core\Csrf\Controller\Csrf::param();
         if ($mainDomainName !== $rowData['name']) {
             $actionIcons = '<a href="' . \Env::get('cx')->getWebsiteBackendPath() . '/?cmd=NetManager&amp;editid=' . $rowId . '" class="edit" title="Edit entry"></a>';
             $actionIcons .= '<a onclick=" if(confirm(\'' . $_CORELANG['TXT_CORE_RECORD_DELETE_CONFIRM'] . '\'))window.location.replace(\'' . \Env::get('cx')->getWebsiteBackendPath() . '/?cmd=NetManager&amp;deleteid=' . (empty($ids[0][1]) ? 0 : $ids[0][1]) . '&amp;vg_increment_number=' . (empty($ids[0][0]) ? 0 : $ids[0][0]) . '&amp;' . $csrfParams . '\');" href="javascript:void(0);" class="delete" title="Delete entry"></a>';
         }
         return $actionIcons;
     })));
     $this->template->setVariable('DOMAINS_CONTENT', $view->render());
 }
 /**
  * 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']));
 }
예제 #24
0
 /**
  * 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')));
 }
 /**
  * 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());
 }
 /**
  * Parse the navigation
  * 
  * @param array $cmd
  * 
  * @return \Cx\Core\Html\Sigma
  */
 public function parseNavigation(&$cmd = array())
 {
     // set tabs
     $navigation = new \Cx\Core\Html\Sigma(\Env::get('cx')->getCodeBaseCorePath() . '/Core/View/Template/Backend');
     $navigation->loadTemplateFile('Navigation.html');
     $commands = array_merge(array('' => array('permission' => $this->defaultPermission)), $this->getCommands());
     $this->checkAndModifyCmdByPermission($cmd, $commands);
     foreach ($commands as $key => $command) {
         $subNav = array();
         $currentCommand = is_array($command) ? $key : $command;
         if (is_array($command) && isset($command['children'])) {
             $subNav = array_merge(array('' => array('permission' => $this->defaultPermission)), $command['children']);
         } else {
             if (is_array($command) && array_key_exists('permission', $command)) {
                 unset($command['permission']);
                 // navigation might contain only the permission key, unset it
             }
             $subNav = is_array($command) && !empty($command) ? array_merge(array(''), $command) : array();
         }
         //check the main navigation permission
         if (!$this->hasAccessToCommand(array($currentCommand))) {
             continue;
         }
         //parse the main navigation
         $this->parseCurrentNavItem($navigation, 'tab', $currentCommand, '', $cmd[0] == $currentCommand, 0);
         // subnav
         if ($cmd[0] == $currentCommand && count($subNav)) {
             $first = true;
             foreach ($subNav as $subkey => $subValue) {
                 $subcommand = is_array($subValue) ? $subkey : $subValue;
                 if (!$this->hasAccessToCommand(array($currentCommand, $subcommand))) {
                     continue;
                 }
                 $isActiveSubNav = !isset($cmd[1]) && $first || (isset($cmd[1]) ? $cmd[1] : '') == $subcommand;
                 //parse the subnavigation
                 $this->parseCurrentNavItem($navigation, 'subnav', $subcommand, $currentCommand, $isActiveSubNav, 1);
                 $first = false;
             }
         }
     }
     return $navigation;
 }
예제 #27
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;
 }
 /**
  * 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__']);
     }
 }
예제 #29
0
 /**
  * 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);
 }
예제 #30
0
 /**
  * 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();
         }
     }
 }