/** * Parse a user's newsletter-list subscription interface * @param User User object of whoem the newsletter-list subscriptions shall be parsed */ protected function parseNewsletterLists($objUser) { global $_CONFIG, $objDatabase, $objInit; if (!$this->_objTpl->blockExists('access_newsletter')) { return; } if (\Cx\Core_Modules\License\License::getCached($_CONFIG, $objDatabase)->isInLegalComponents('Newsletter')) { $arrSubscribedNewsletterListIDs = $objUser->getSubscribedNewsletterListIDs(); $arrNewsletterLists = \Cx\Modules\Newsletter\Controller\NewsletterLib::getLists(); if (!count($arrNewsletterLists)) { $this->_objTpl->hideBlock('access_newsletter_list'); return; } $row = 0; foreach ($arrNewsletterLists as $listId => $arrList) { if ($objInit->mode != 'backend' && !$arrList['status'] && !in_array($listId, $arrSubscribedNewsletterListIDs)) { continue; } $this->_objTpl->setVariable(array($this->modulePrefix . 'NEWSLETTER_ID' => $listId, $this->modulePrefix . 'NEWSLETTER_NAME' => contrexx_raw2xhtml($arrList['name']), $this->modulePrefix . 'NEWSLETTER_SELECTED' => in_array($listId, $arrSubscribedNewsletterListIDs) ? 'checked="checked"' : '', $this->modulePrefix . 'NEWSLETTER_ROW_CLASS' => $row++ % 2 + 1)); $this->_objTpl->parse('access_newsletter_list'); } $this->_objTpl->touchBlock('access_newsletter'); if ($this->_objTpl->blockExists('access_newsletter_tab')) { $this->_objTpl->touchBlock('access_newsletter_tab'); } } else { $this->_objTpl->hideBlock('access_newsletter'); if ($this->_objTpl->blockExists('access_newsletter_tab')) { $this->_objTpl->hideBlock('access_newsletter_tab'); } } }
/** * Show the shadowbox */ function shadowbox() { global $objDatabase, $_ARRAYLANG, $objInit; $id = intval($_GET['id']); $lang = intval($_GET['lang']); $entries = $this->createEntryArray(); $entry = $entries[$id]; $settings = $this->createSettingsArray(); $title = $entry['translation'][$lang]['subject']; $content = $entry['translation'][$lang]['content']; $picture = !empty($entry['translation'][$lang]['image']) ? $entry['translation'][$lang]['image'] : "none"; $this->_objTpl = new \Cx\Core\Html\Sigma(ASCMS_THEMES_PATH); \Cx\Core\Csrf\Controller\Csrf::add_placeholder($this->_objTpl); $this->_objTpl->setCurrentBlock("shadowbox"); $objResult = $objDatabase->SelectLimit("\n SELECT foldername\n FROM " . DBPREFIX . "skins\n WHERE id='{$objInit->currentThemesId}'", 1); if ($objResult !== false) { $themesPath = $objResult->fields['foldername']; } $template = preg_replace('/\\[\\[([A-Z_]+)\\]\\]/', '{$1}', $settings['data_template_shadowbox']); $this->_objTpl->setTemplate($template); if ($entry['translation'][$lang]['attachment']) { $this->_objTpl->setVariable(array("HREF" => $entry['translation'][$lang]['attachment'], "TXT_DOWNLOAD" => empty($entry['translation'][$lang]['attachment_desc']) ? $_ARRAYLANG['TXT_DATA_DOWNLOAD_ATTACHMENT'] : $entry['translation'][$lang]['attachment_desc'])); $this->_objTpl->parse("attachment"); } $this->_objTpl->setVariable(array("TITLE" => $title, "CONTENT" => $content, "PICTURE" => $picture, "THEMES_PATH" => $themesPath)); if ($picture != "none") { $this->_objTpl->parse("image"); } else { $this->_objTpl->hideBlock("image"); } $this->_objTpl->parse("shadowbox"); $this->_objTpl->show(); die; }
/** * Show the customer and article group discounts for editing. * * Handles storing of the discounts as well. * @return boolean True on success, false otherwise * @author Reto Kohli <*****@*****.**> */ function view_customer_discounts() { if (!empty($_POST['store'])) { $this->store_discount_customer(); } self::$objTemplate->loadTemplateFile("module_shop_discount_customer.html"); // Discounts overview $arrCustomerGroups = Discount::getCustomerGroupArray(); $arrArticleGroups = Discount::getArticleGroupArray(); $arrRate = null; $arrRate = Discount::getDiscountRateCustomerArray(); $i = 0; // Set up the customer groups header self::$objTemplate->setVariable(array('SHOP_CUSTOMER_GROUP_COUNT' => count($arrCustomerGroups), 'SHOP_DISCOUNT_ROW_STYLE' => 'row' . (++$i % 2 + 1))); foreach ($arrCustomerGroups as $id => $arrCustomerGroup) { self::$objTemplate->setVariable(array('SHOP_CUSTOMER_GROUP_ID' => $id, 'SHOP_CUSTOMER_GROUP_NAME' => $arrCustomerGroup['name'])); self::$objTemplate->parse('customer_group_header_column'); self::$objTemplate->touchBlock('article_group_header_column'); self::$objTemplate->parse('article_group_header_column'); } foreach ($arrArticleGroups as $groupArticleId => $arrArticleGroup) { //DBG::log("Article group ID $groupArticleId"); foreach ($arrCustomerGroups as $groupCustomerId => $arrCustomerGroup) { $rate = isset($arrRate[$groupCustomerId][$groupArticleId]) ? $arrRate[$groupCustomerId][$groupArticleId] : 0; self::$objTemplate->setVariable(array('SHOP_CUSTOMER_GROUP_ID' => $groupCustomerId, 'SHOP_DISCOUNT_RATE' => sprintf('%2.2f', $rate))); self::$objTemplate->parse('discount_column'); } self::$objTemplate->setVariable(array('SHOP_ARTICLE_GROUP_ID' => $groupArticleId, 'SHOP_ARTICLE_GROUP_NAME' => $arrArticleGroup['name'], 'SHOP_DISCOUNT_ROW_STYLE' => 'row' . (++$i % 2 + 1))); self::$objTemplate->parse('article_group_row'); } self::$objTemplate->setGlobalVariable('SHOP_DISCOUNT_ROW_STYLE', 'row' . (++$i % 2 + 1)); // self::$objTemplate->touchBlock('article_group_header_row'); // self::$objTemplate->parse('article_group_header_row'); return true; }
function showCatEdit() { global $objDatabase, $_ARRAYLANG; // check if (!isset($_GET['set'])) { if (!isset($_GET['id']) or $_GET['id'] == '') { $this->goToReplace('&act=category'); die; } } //set if (isset($_GET['set']) and $_GET['set'] == 1) { if ($_POST['form_id'] != '' and $_POST['form_name'] != '' and $_POST['form_status'] != '' and $_POST['form_lang'] != '') { $id = intval($_POST['form_id']); $name = CONTREXX_ESCAPE_GPC ? strip_tags($_POST['form_name']) : addslashes(strip_tags($_POST['form_name'])); $status = intval($_POST['form_status']); $time = time(); $lang = intval($_POST['form_lang']); $this->showCatEditSet($id, $name, $status, $time, $lang); $_SESSION['strOkMessage'] = $_ARRAYLANG['TXT_FEED_MESSAGE_SUCCESSFUL_EDIT_CAT']; $this->goToReplace('&act=category'); die; } else { $_SESSION['strErrMessage'] = $_ARRAYLANG['TXT_FEED_MESSAGE_ERROR_FILL_IN_ALL']; $this->goToReplace('&act=catedit&id=' . $_POST['form_id']); die; } } $query = "SELECT id,\n name,\n status,\n lang\n FROM " . DBPREFIX . "module_feed_category\n WHERE id = '" . intval($_GET['id']) . "'"; $objResult = $objDatabase->Execute($query); $id = $objResult->fields['id']; $name = $objResult->fields['name']; $status = $objResult->fields['status']; $lang = $objResult->fields['lang']; if ($status == 0) { $status0 = ' selected'; $status1 = ''; } else { $status0 = ''; $status1 = ' selected'; } $this->_objTpl->setVariable(array('FEED_ID' => $id, 'FEED_NAME' => $name, 'FEED_STATUS0' => $status0, 'FEED_STATUS1' => $status1)); //lang $query = "SELECT id,\n name\n FROM " . DBPREFIX . "languages\n WHERE id<>0\n ORDER BY id"; $objResult = $objDatabase->Execute($query); while (!$objResult->EOF) { $selected = ''; if ($lang == $objResult->fields['id']) { $selected = ' selected'; } $this->_objTpl->setVariable(array('FEED_LANG_ID' => $objResult->fields['id'], 'FEED_LANG_SELECTED' => $selected, 'FEED_LANG_NAME' => $objResult->fields['name'])); $this->_objTpl->parse('feed_lang'); $objResult->MoveNext(); } //parse $_ARRAYLANG $this->_objTpl->setVariable(array('TXT_FEED_EDIT_CAT' => $_ARRAYLANG['TXT_FEED_EDIT_CAT'], 'TXT_FEED_NAME' => $_ARRAYLANG['TXT_FEED_NAME'], 'TXT_FEED_LANGUAGE' => $_ARRAYLANG['TXT_FEED_LANGUAGE'], 'TXT_FEED_STATUS' => $_ARRAYLANG['TXT_FEED_STATUS'], 'TXT_FEED_INACTIVE' => $_ARRAYLANG['TXT_FEED_INACTIVE'], 'TXT_FEED_ACTIVE' => $_ARRAYLANG['TXT_FEED_ACTIVE'], 'TXT_FEED_RESET' => $_ARRAYLANG['TXT_FEED_RESET'], 'TXT_FEED_SAVE' => $_ARRAYLANG['TXT_FEED_SAVE'], 'TXT_FEED_FORMCHECK_NAME' => $_ARRAYLANG['TXT_FEED_FORMCHECK_NAME'], 'TXT_FEED_FORMCHECK_LANGUAGE' => $_ARRAYLANG['TXT_FEED_FORMCHECK_LANGUAGE'], 'TXT_FEED_FORMCHECK_STATUS' => $_ARRAYLANG['TXT_FEED_FORMCHECK_STATUS'])); }
private function parseDownload($objDownload, $categoryId) { global $_LANGID, $_ARRAYLANG; if (!$this->objTemplate->blockExists('downloads_file_detail')) { return; } $this->parseDownloadAttributes($objDownload, $categoryId); $this->objTemplate->parse('downloads_file_detail'); $objDownload->incrementViewCount(); }
function showEcards() { global $objDatabase, $_ARRAYLANG; \JS::activate('shadowbox'); $this->_objTpl->setTemplate($this->pageContent); // Initialize POST variables $selectedId = isset($_POST['selectedEcard']) ? intval($_POST['selectedEcard']) : 0; $message = !empty($_POST['ecardMessage']) ? htmlentities(contrexx_stripslashes($_POST['ecardMessage']), ENT_QUOTES, CONTREXX_CHARSET) : ""; $recipientSalutation = !empty($_POST['ecardRecipientSalutation']) ? htmlentities(contrexx_stripslashes($_POST['ecardRecipientSalutation']), ENT_QUOTES, CONTREXX_CHARSET) : ""; $senderName = !empty($_POST['ecardSenderName']) ? htmlentities(contrexx_stripslashes($_POST['ecardSenderName']), ENT_QUOTES, CONTREXX_CHARSET) : ""; $senderEmail = !empty($_POST['ecardSenderEmail']) && \FWValidator::isEmail($_POST['ecardSenderEmail']) ? $_POST['ecardSenderEmail'] : ""; $recipientName = !empty($_POST['ecardRecipientName']) ? htmlentities(contrexx_stripslashes($_POST['ecardRecipientName']), ENT_QUOTES, CONTREXX_CHARSET) : ""; $recipientEmail = !empty($_POST['ecardRecipientEmail']) && \FWValidator::isEmail($_POST['ecardRecipientEmail']) ? $_POST['ecardRecipientEmail'] : ""; // Get max. number of characters and lines per message $query = "\n SELECT `setting_name`, `setting_value`\n FROM " . DBPREFIX . "module_ecard_settings"; $objResult = $objDatabase->Execute($query); while (!$objResult->EOF) { switch ($objResult->fields['setting_name']) { case "maxCharacters": $maxCharacters = $objResult->fields['setting_value']; break; case "maxLines": $maxLines = $objResult->fields['setting_value']; break; } $objResult->MoveNext(); } $this->_objTpl->setVariable(array('ECARD_MESSAGE' => $message, 'ECARD_SENDERNAME' => $senderName, 'ECARD_RECIPIENTNAME' => $recipientName, 'ECARD_SENDEREMAIL' => $senderEmail, 'ECARD_RECIPIENTEMAIL' => $recipientEmail, 'ECARD_SALUTATION_SELECTED_MALE' => $recipientSalutation == $_ARRAYLANG['TXT_ECARD_TITLE_MALE'] ? ' checked="checked"' : '', 'ECARD_SALUTATION_SELECTED_FEMALE' => $recipientSalutation == $_ARRAYLANG['TXT_ECARD_TITLE_FEMALE'] ? ' checked="checked"' : '', 'TXT_ECARD_CHOOSE_IMAGE' => $_ARRAYLANG['TXT_ECARD_CHOOSE_IMAGE'], 'TXT_ECARD_ENTER_RECIPIENT_INFO' => $_ARRAYLANG['TXT_ECARD_ENTER_RECIPIENT_INFO'], 'TXT_ECARD_TITLE_MALE' => $_ARRAYLANG['TXT_ECARD_TITLE_MALE'], 'TXT_ECARD_TITLE_FEMALE' => $_ARRAYLANG['TXT_ECARD_TITLE_FEMALE'], 'TXT_ECARD_RECIPIENT_TITLE' => $_ARRAYLANG['TXT_ECARD_RECIPIENT_TITLE'], 'TXT_ECARD_RECIPIENT_NAME' => $_ARRAYLANG['TXT_ECARD_RECIPIENT_NAME'], 'TXT_ECARD_SENDER_NAME' => $_ARRAYLANG['TXT_ECARD_SENDER_NAME'], 'TXT_ECARD_RECIPIENT_EMAIL' => $_ARRAYLANG['TXT_ECARD_RECIPIENT_EMAIL'], 'TXT_ECARD_SENDER_EMAIL' => $_ARRAYLANG['TXT_ECARD_SENDER_EMAIL'], 'TXT_ECARD_ENTER_MESSAGE' => $_ARRAYLANG['TXT_ECARD_ENTER_MESSAGE'], 'TXT_ECARD_NUMBER_OF_CHARACTERS_LEFT' => sprintf($_ARRAYLANG['TXT_ECARD_NUMBER_OF_CHARACTERS_LEFT'], $maxCharacters), 'TXT_ECARD_NUMBER_OF_LINES_LEFT' => sprintf($_ARRAYLANG['TXT_ECARD_NUMBER_OF_LINES_LEFT'], $maxLines), 'TXT_ECARD_PREVIEW' => $_ARRAYLANG['TXT_ECARD_PREVIEW'])); // Select motives from DB $query = "\n SELECT setting_value, setting_name\n FROM " . DBPREFIX . "module_ecard_settings\n WHERE setting_name LIKE 'motive_%'\n ORDER BY setting_name ASC"; $i = 0; $objResult = $objDatabase->Execute($query); // Initialize DATA placeholder while (!$objResult->EOF) { $motive = $objResult->fields['setting_value']; $motive = basename($motive); if (empty($motive)) { $objResult->MoveNext(); continue; } $arrMatch = array(); $id = 0; if (preg_match('/(\\d+)$/', $objResult->fields['setting_name'], $arrMatch)) { $id = $arrMatch[1]; } $this->_objTpl->setVariable(array('ECARD_MOTIVE_OPTIMIZED_PATH' => ASCMS_ECARD_OPTIMIZED_WEB_PATH . '/' . $motive, 'ECARD_MOTIVE_ID' => $id, 'ECARD_THUMBNAIL_PATH' => ASCMS_ECARD_THUMBNAIL_WEB_PATH . '/' . $motive, 'ECARD_CSSNUMBER' => $i % 3 + 1, 'ECARD_IMAGE_SELECTED' => $id == $selectedId ? ' checked="checked"' : '')); $this->_objTpl->parse('motiveBlock'); if ($i % 3 == 0) { $this->_objTpl->parse('motiveRow'); } ++$i; $objResult->MoveNext(); } $this->_objTpl->setVariable('ECARD_JAVASCRIPT', self::getJavascript($maxCharacters)); }
/** * Render the option field in the backend. * * @param Sigma $template */ public function renderOptionField($template) { $subTemplate = new Sigma(); $subTemplate->loadTemplateFile($this->cx->getCodeBaseCoreModulePath() . '/TemplateEditor/View/Template/Backend/AreaOption.html'); $subTemplate->setVariable('TEMPLATEEDITOR_OPTION_VALUE', $this->active ? 'checked' : ''); $subTemplate->setVariable('TEMPLATEEDITOR_OPTION_NAME', $this->name); $subTemplate->setVariable('TEMPLATEEDITOR_OPTION_HUMAN_NAME', $this->humanName); $template->setVariable('TEMPLATEEDITOR_OPTION', $subTemplate->get()); $template->setVariable('TEMPLATEEDITOR_OPTION_TYPE', 'area'); $template->parse('option'); }
/** * List the jobs * @global object $objDatabase * @param integer $newsid * @param string $what * @return string $output */ function overview() { global $objDatabase, $_ARRAYLANG, $_CONFIG; // initialize variables $i = 0; $jobslocationform = ''; $location = ''; $docFilter = ''; $locationFilter = ' WHERE '; $this->pageTitle = $_ARRAYLANG['TXT_JOBS_MANAGER']; $this->_objTpl->loadTemplateFile('module_jobs_list.html', true, true); $this->_objTpl->setVariable(array('TXT_EDIT_JOBS_MESSAGE' => $_ARRAYLANG['TXT_EDIT_DOCUMENTS'], 'TXT_EDIT_JOBS_ID' => $_ARRAYLANG['TXT_DOCUMENT_ID'], 'TXT_ARCHIVE' => $_ARRAYLANG['TXT_ARCHIVE'], 'TXT_DATE' => $_ARRAYLANG['TXT_DATE'], 'TXT_TITLE' => $_ARRAYLANG['TXT_TITLE'], 'TXT_USER' => $_ARRAYLANG['TXT_USER'], 'TXT_LAST_EDIT' => $_ARRAYLANG['TXT_LAST_EDIT'], 'TXT_ACTION' => $_ARRAYLANG['TXT_ACTION'], 'TXT_CATEGORY' => $_ARRAYLANG['TXT_CATEGORY'], 'TXT_CONFIRM_DELETE_DATA' => $_ARRAYLANG['TXT_DOCUMENT_DELETE_CONFIRM'], 'TXT_ACTION_IS_IRREVERSIBLE' => $_ARRAYLANG['TXT_ACTION_IS_IRREVERSIBLE'], 'TXT_SELECT_ALL' => $_ARRAYLANG['TXT_SELECT_ALL'], 'TXT_REMOVE_SELECTION' => $_ARRAYLANG['TXT_REMOVE_SELECTION'], 'TXT_EDIT' => $_ARRAYLANG['TXT_EDIT'], 'TXT_TEMPLATE' => $_ARRAYLANG['TXT_TEMPLATE'], 'TXT_MARKED' => $_ARRAYLANG['TXT_MARKED'], 'TXT_ACTIVATE' => $_ARRAYLANG['TXT_ACTIVATE'], 'TXT_DEACTIVATE' => $_ARRAYLANG['TXT_DEACTIVATE'], 'TXT_STATUS' => $_ARRAYLANG['TXT_STATUS'], 'TXT_AUTHOR' => $_ARRAYLANG['TXT_AUTHOR'], 'TXT_JOBS_SEARCH' => $_ARRAYLANG['TXT_JOBS_SEARCH'])); /* check if locations are activated */ $query = "\n SELECT `value`\n FROM `" . DBPREFIX . "module_jobs_settings`\n WHERE name='show_location_fe'"; $objResult = $objDatabase->Execute($query); //return if location fields are not activated in the backend if (!$objResult->EOF) { if (intval($objResult->fields['value']) == 1) { if (isset($_REQUEST['location']) && is_numeric($_REQUEST['location'])) { $location = $_REQUEST['location']; $locationFilter = ", `" . DBPREFIX . "module_jobs_rel_loc_jobs` AS rel WHERE rel.job = n.id AND rel.location = '" . $location . "' AND "; } $jobslocationform = '<select name="location">' . '<option selected="selected" value="">' . $_ARRAYLANG['TXT_LOCATION'] . '</option>' . $this->getLocationMenu($location) . '</select>'; } } if (isset($_REQUEST['category']) && is_numeric($_REQUEST['category'])) { $category = $_REQUEST['category']; $docFilter = " n.catid='{$category}' AND "; } $jobscategoryform = '<select name="category">' . '<option selected="selected" value="">' . $_ARRAYLANG['TXT_CATEGORY'] . '</option>' . $this->getCategoryMenu($this->langId, $category) . '</select>'; $this->_objTpl->setVariable(array('JOBS_CATEGORY_FORM' => $jobscategoryform, 'JOBS_LOCATION_FORM' => $jobslocationform, 'TXT_SUBMIT' => $_ARRAYLANG['TXT_SUBMIT'])); $this->_objTpl->setGlobalVariable(array('TXT_DELETE' => $_ARRAYLANG['TXT_DELETE'])); $query = "SELECT n.id AS jobsId, n.date, n.changelog,\n n.title, n.status, n.author,\n l.name,\n nc.name AS catname,\n n.userid\n FROM " . DBPREFIX . "module_jobs_categories AS nc,\n " . DBPREFIX . "module_jobs AS n,\n " . DBPREFIX . "languages AS l\n {$locationFilter}\n n.lang=l.id\n AND n.lang={$this->langId}\n AND {$docFilter} nc.catid=n.catid\n ORDER BY n.id DESC"; $objResult = $objDatabase->Execute($query); $count = $objResult->RecordCount(); $pos = isset($_GET['pos']) ? intval($_GET['pos']) : 0; $paging = $count > intval($_CONFIG['corePagingLimit']) ? getPaging($count, $pos, "&cmd=Jobs&location=" . $location . "&category=" . $category . "&", $_ARRAYLANG['TXT_DOCUMENTS '], true) : ""; $objResult = $objDatabase->SelectLimit($query, $_CONFIG['corePagingLimit'], $pos); if (!$objResult || $objResult->EOF) { $this->_objTpl->hideBlock('row'); return; } while ($objResult !== false && !$objResult->EOF) { $statusPicture = $objResult->fields['status'] == 1 ? "status_green.gif" : "status_red.gif"; $jobUser = \FWUser::getFWUserObject()->objUser->getUser($objResult->fields['userid']); $username = $_ARRAYLANG['TXT_ACCESS_UNKNOWN']; if ($jobUser) { $username = $jobUser->getUsername(); } $this->_objTpl->setVariable(array('JOBS_ID' => $objResult->fields['jobsId'], 'JOBS_DATE' => date(ASCMS_DATE_FORMAT, $objResult->fields['date']), 'JOBS_TITLE' => stripslashes($objResult->fields['title']), 'JOBS_AUTHOR' => stripslashes($objResult->fields['author']), 'JOBS_USER' => $username, 'JOBS_CHANGELOG' => date(ASCMS_DATE_FORMAT, $objResult->fields['changelog']), 'JOBS_PAGING' => $paging, 'JOBS_CLASS' => ++$i % 2 ? "row2" : "row1", 'JOBS_CATEGORY' => $objResult->fields['catname'], 'JOBS_STATUS' => $objResult->fields['status'], 'JOBS_STATUS_PICTURE' => $statusPicture, 'TXT_TEMPLATE' => $_ARRAYLANG['TXT_TEMPLATE'], 'TXT_EDIT' => $_ARRAYLANG['TXT_EDIT'])); $this->_objTpl->parse('row'); $objResult->MoveNext(); } }
function setMotives() { global $objDatabase, $_ARRAYLANG; \JS::activate('shadowbox'); $this->_objTpl->loadTemplateFile('module_ecard_overview.html', true, true); $this->_pageTitle = $_ARRAYLANG['TXT_MOTIVE_SELECTION']; $mediaBrowser = new \Cx\Core_Modules\MediaBrowser\Model\Entity\MediaBrowser(); $mediaBrowser->setCallback('mbCallback'); $mediaBrowser->setOptions(array('type' => 'button', 'data-cx-mb-views' => 'filebrowser', 'id' => 'mediabrowser_button', 'style' => 'display: none;')); /* Update progress */ if (!empty($_POST['saveMotives'])) { $i = 0; $motiveInputArray = $_POST['motiveInputArray']; while ($i < 9) { $filepath = $motiveInputArray[$i]; $filename = basename($filepath); $query = "\n UPDATE " . DBPREFIX . "module_ecard_settings\n SET setting_value='" . contrexx_addslashes($filename) . "'\n WHERE setting_name='motive_{$i}'"; $objResult = $objDatabase->Execute($query); /* Create optimized picture for e-card dispatch */ if ($filepath != '' && file_exists(\Env::get('cx')->getWebsitePath() . $filepath)) { $this->resizeMotive(2, \Env::get('cx')->getWebsitePath() . $filepath, ASCMS_ECARD_OPTIMIZED_PATH . '/'); $this->resizeMotive(1, \Env::get('cx')->getWebsitePath() . $filepath, ASCMS_ECARD_THUMBNAIL_PATH . '/'); } ++$i; } $this->_objTpl->setVariable(array('CONTENT_OK_MESSAGE' => $this->strOkMessage = $_ARRAYLANG['TXT_DATA_SAVED'])); } $this->_objTpl->setGlobalVariable(array('TXT_SAVE' => $_ARRAYLANG['TXT_SAVE'], 'TXT_DELETE_MOTIVE' => $_ARRAYLANG['TXT_DELETE_MOTIVE'], 'TXT_PICTURE' => $_ARRAYLANG['TXT_PICTURE'], 'TXT_PATH' => $_ARRAYLANG['TXT_PATH'], 'TXT_BROWSE' => $_ARRAYLANG['TXT_BROWSE'], 'TXT_CHOOSE' => $_ARRAYLANG['TXT_CHOOSE'], 'TXT_DELETE' => $_ARRAYLANG['TXT_DELETE'], 'TXT_ECARD_IMAGES' => $_ARRAYLANG['TXT_ECARD_IMAGES'], 'MEDIABROWSER_BUTTON' => $mediaBrowser->getXHtml($_ARRAYLANG['TXT_CORE_CM_BROWSE']))); /* Display progress */ $query = "\n SELECT `setting_value`\n FROM " . DBPREFIX . "module_ecard_settings\n WHERE setting_name LIKE 'motive_%'\n ORDER BY setting_name ASC"; $objResult = $objDatabase->Execute($query); $i = 0; /* Create thumbnails */ while (!$objResult->EOF) { $motiveFilename = $objResult->fields['setting_value']; $thumbnail = ASCMS_ECARD_THUMBNAIL_WEB_PATH . '/' . "no_picture.gif"; $sourcePath = ''; if ($motiveFilename != '') { $sourcePath = ASCMS_ECARD_OPTIMIZED_WEB_PATH . '/' . $motiveFilename; $thumbnail = ASCMS_ECARD_THUMBNAIL_WEB_PATH . '/' . $motiveFilename; } /* Initialize DATA placeholder */ $this->_objTpl->setVariable(array('MOTIVE_PATH' => $sourcePath, 'MOTIVE_THUMB_PATH' => $thumbnail, 'MOTIVE_ID' => $i++)); $this->_objTpl->parse('motiveBlock'); $objResult->MoveNext(); } $this->_objTpl->replaceBlock('motiveBlock', '', true); }
/** * Render the option field in the backend. * * @param Sigma $template */ public function renderOptionField($template) { global $_ARRAYLANG; $subTemplate = new Sigma(); $subTemplate->loadTemplateFile($this->cx->getCodeBaseCoreModulePath() . '/TemplateEditor/View/Template/Backend/ColorOption.html'); $subTemplate->setVariable('TEMPLATEEDITOR_OPTION_VALUE', $this->color); $subTemplate->setVariable('TEMPLATEEDITOR_OPTION_NAME', $this->name); $subTemplate->setVariable('TEMPLATEEDITOR_OPTION_HUMAN_NAME', $this->humanName); if ($this->choice) { $subTemplate->setVariable('TEMPLATEEDITOR_OPTION_CHOICE', json_encode($this->choice)); } \ContrexxJavascript::getInstance()->setVariable(array('select' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_SELECT'], 'colorError' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_COLOR_WRONG_FORMAT'], 'cancel' => $_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_CANCEL']), 'TemplateEditor'); $template->setVariable('TEMPLATEEDITOR_OPTION', $subTemplate->get()); $template->setVariable('TEMPLATEEDITOR_OPTION_TYPE', 'color'); $template->parse('option'); }
/** * Gets the search results. * * @return mixed Parsed content. */ public function getSearchResults() { global $_ARRAYLANG; $this->template->addBlockfile('ADMIN_CONTENT', 'search', 'Default.html'); if (!empty($this->term)) { $pages = $this->getSearchedPages(); $countPages = $this->countSearchedPages(); usort($pages, array($this, 'sortPages')); if ($countPages > 0) { $parameter = '&cmd=Search' . (empty($this->term) ? '' : '&term=' . contrexx_raw2encodedUrl($this->term)); $paging = \Paging::get($parameter, '', $countPages, 0, true, null, 'pos'); $this->template->setVariable(array('TXT_SEARCH_RESULTS_COMMENT' => sprintf($_ARRAYLANG['TXT_SEARCH_RESULTS_COMMENT'], $this->term, $countPages), 'TXT_SEARCH_TITLE' => $_ARRAYLANG['TXT_NAVIGATION_TITLE'], 'TXT_SEARCH_CONTENT_TITLE' => $_ARRAYLANG['TXT_PAGETITLE'], 'TXT_SEARCH_SLUG' => $_ARRAYLANG['TXT_CORE_CM_SLUG'], 'TXT_SEARCH_LANG' => $_ARRAYLANG['TXT_LANGUAGE'], 'SEARCH_PAGING' => $paging)); foreach ($pages as $page) { // used for alias pages, because they have no language if ($page->getLang() == "") { $languages = ""; foreach (\FWLanguage::getIdArray('frontend') as $langId) { $languages[] = \FWLanguage::getLanguageCodeById($langId); } } else { $languages = array(\FWLanguage::getLanguageCodeById($page->getLang())); } $aliasLanguages = implode(', ', $languages); $originalPage = $page; $link = 'index.php?cmd=ContentManager&page=' . $page->getId(); if ($page->getType() == \Cx\Core\ContentManager\Model\Entity\Page::TYPE_ALIAS) { $pageRepo = \Env::get('em')->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Page'); if ($originalPage->isTargetInternal()) { // is internal target, get target page $originalPage = $pageRepo->getTargetPage($page); } else { // is an external target, set the link to the external targets url $originalPage = new \Cx\Core\ContentManager\Model\Entity\Page(); $originalPage->setTitle($page->getTarget()); $link = $page->getTarget(); } } $this->template->setVariable(array('SEARCH_RESULT_BACKEND_LINK' => $link, 'SEARCH_RESULT_TITLE' => $originalPage->getTitle(), 'SEARCH_RESULT_CONTENT_TITLE' => $originalPage->getContentTitle(), 'SEARCH_RESULT_SLUG' => substr($page->getPath(), 1), 'SEARCH_RESULT_LANG' => $aliasLanguages, 'SEARCH_RESULT_FRONTEND_LINK' => \Cx\Core\Routing\Url::fromPage($page))); $this->template->parse('search_result_row'); } } else { $this->template->setVariable(array('TXT_SEARCH_NO_RESULTS' => sprintf($_ARRAYLANG['TXT_SEARCH_NO_RESULTS'], $this->term))); } } else { $this->template->setVariable(array('TXT_SEARCH_NO_TERM' => $_ARRAYLANG['TXT_SEARCH_NO_TERM'])); } }
/** * Render the option field in the backend. * * @param Sigma $template */ public function renderOptionField($template) { global $_ARRAYLANG; $subTemplate = new Sigma(); $subTemplate->loadTemplateFile($this->cx->getCodeBaseCoreModulePath() . '/TemplateEditor/View/Template/Backend/ImageOption.html'); $subTemplate->setGlobalVariable($_ARRAYLANG); $subTemplate->setVariable('TEMPLATEEDITOR_OPTION_VALUE', $this->url); $subTemplate->setVariable('TEMPLATEEDITOR_OPTION_NAME', $this->name); $subTemplate->setVariable('TEMPLATEEDITOR_OPTION_HUMAN_NAME', $this->humanName); $mediaBrowser = new MediaBrowser(); $mediaBrowser->setOptions(array('views' => 'uploader,filebrowser', 'startView' => 'filebrowser')); $mediaBrowser->setCallback('callback_' . $this->name); $subTemplate->setVariable('MEDIABROWSER_BUTTON', $mediaBrowser->getXHtml($_ARRAYLANG['TXT_CORE_MODULE_TEMPLATEEDITOR_CHOOSE_PICTURE'])); $template->setVariable('TEMPLATEEDITOR_OPTION', $subTemplate->get()); $template->setVariable('TEMPLATEEDITOR_OPTION_TYPE', 'img'); $template->parse('option'); }
/** * Render the option field in the backend. * * @param Sigma $template */ public function renderOptionField($template) { global $_LANGID; $subTemplate = new Sigma(); $subTemplate->loadTemplateFile($this->cx->getCodeBaseCoreModulePath() . '/TemplateEditor/View/Template/Backend/SelectOption.html'); foreach ($this->choice as $value => $choice) { $subTemplate->setVariable('CHOICE_NAME', isset($choice[$_LANGID]) ? $choice[$_LANGID] : (isset($choice[2]) ? $choice[2] : $value)); $subTemplate->setVariable('CHOICE_VALUE', $value); if ($value == $this->activeChoice) { $subTemplate->setVariable('CHOICE_ACTIVE', 'selected'); } $subTemplate->parse('choices'); } $subTemplate->setVariable('TEMPLATEEDITOR_OPTION_VALUE', $this->activeChoice); $subTemplate->setVariable('TEMPLATEEDITOR_OPTION_NAME', $this->name); $subTemplate->setVariable('TEMPLATEEDITOR_OPTION_HUMAN_NAME', $this->humanName); $template->setVariable('TEMPLATEEDITOR_OPTION', $subTemplate->get()); $template->setVariable('TEMPLATEEDITOR_OPTION_TYPE', 'select'); $template->parse('option'); }
/** * Set up the template block with the shipment terms and conditions * * Please *DO NOT* remove this method, despite the site terms and * conditions have been removed from the Shop! * This has been requested by some shopkeepers and may be used at will. * @global array $_ARRAYLANG Language array * @author Reto Kohli <*****@*****.**> */ static function showShipmentTerms() { if (self::$objTemplate->blockExists('shopShipper')) { // TODO: Should be set by the calling view, if any global $_ARRAYLANG; self::$objTemplate->setGlobalVariable($_ARRAYLANG + array('SHOP_CURRENCY_SYMBOL' => Currency::getActiveCurrencySymbol(), 'SHOP_CURRENCY_CODE' => Currency::getActiveCurrencyCode())); $arrShipment = Shipment::getShipmentConditions(); foreach ($arrShipment as $strShipperName => $arrContent) { $strCountries = join(', ', $arrContent['countries']); $arrConditions = $arrContent['conditions']; self::$objTemplate->setCurrentBlock('shopShipment'); foreach ($arrConditions as $arrData) { self::$objTemplate->setVariable(array('SHOP_MAX_WEIGHT' => $arrData['max_weight'], 'SHOP_COST_FREE' => $arrData['free_from'], 'SHOP_COST' => $arrData['fee'])); self::$objTemplate->parse('shopShipment'); } self::$objTemplate->setVariable(array('SHOP_SHIPPER' => $strShipperName, 'SHOP_COUNTRIES' => $strCountries)); self::$objTemplate->parse('shopShipper'); } } }
function chooseReservationProduct() { global $objDatabase, $_ARRAYLANG; $this->objTemplate->loadTemplateFile('module_gov_choose_product.html'); $this->_pageTitle = $_ARRAYLANG['TXT_EGOV_PRODUCT_FOR_RESERVATION']; $this->objTemplate->setVariable(array('TXT_PRODUCT' => $_ARRAYLANG['TXT_PRODUCT'], 'TXT_EGOV_CHOOSE_PRODUCT_FOR_RESERVATION' => $_ARRAYLANG['TXT_EGOV_CHOOSE_PRODUCT_FOR_RESERVATION'])); $query = "\n SELECT *\n FROM " . DBPREFIX . "module_egov_products\n ORDER BY product_orderby, product_name\n "; $objResult = $objDatabase->Execute($query); $i = 0; while (!$objResult->EOF) { $StatusImg = '<img src="../core/Core/View/Media/icons/status_green.gif" width="10" height="10" border="0" alt="" />'; if ($objResult->fields["product_status"] != 1) { $StatusImg = '<img src="../core/Core/View/Media/icons/status_red.gif" width="10" height="10" border="0" alt="" />'; } $this->objTemplate->setVariable(array('ROWCLASS' => ++$i % 2 ? 'row2' : 'row1', 'PRODUCT_ID' => $objResult->fields['product_id'], 'PRODUCT_NAME' => $objResult->fields['product_name'], 'PRODUCT_STATUS' => $StatusImg)); $this->objTemplate->parse('products_list'); $objResult->MoveNext(); } if ($i == 0) { $this->objTemplate->hideBlock('products_list'); } }
/** * Parses the main template in order to finish request * @todo Remove usage of globals * @global type $themesPages * @global null $moduleStyleFile * @global array $_CONFIG * @global type $subMenuTitle * @global type $_CORELANG * @global type $plainCmd * @global type $cmd */ protected function finalize() { global $themesPages, $moduleStyleFile, $_CONFIG, $subMenuTitle, $_CORELANG, $plainCmd, $cmd; if ($this->mode == self::MODE_FRONTEND) { // parse system $parsingTime = $this->stopTimer(); $this->template->setVariable('PARSING_TIME', $parsingTime); $this->parseGlobalPlaceholders($themesPages['sidebar']); $this->template->setVariable(array('SIDEBAR_FILE' => $themesPages['sidebar'], 'JAVASCRIPT_FILE' => $themesPages['javascript'], 'BUILDIN_STYLE_FILE' => $themesPages['buildin_style'], 'DATE_YEAR' => date('Y'), 'DATE_MONTH' => date('m'), 'DATE_DAY' => date('d'), 'DATE_TIME' => date('H:i'), 'BUILDIN_STYLE_FILE' => $themesPages['buildin_style'], 'JAVASCRIPT_LIGHTBOX' => '<script type="text/javascript" src="lib/lightbox/javascript/mootools.js"></script> <script type="text/javascript" src="lib/lightbox/javascript/slimbox.js"></script>', 'JAVASCRIPT_MOBILE_DETECTOR' => '<script type="text/javascript" src="lib/mobiledetector.js"></script>')); if (!empty($moduleStyleFile)) { $this->template->setVariable('STYLE_FILE', "<link rel=\"stylesheet\" href=\"{$moduleStyleFile}\" type=\"text/css\" media=\"screen, projection\" />"); } if (!$this->resolvedPage->getUseSkinForAllChannels() && isset($_GET['pdfview']) && intval($_GET['pdfview']) == 1) { $pageTitle = $this->resolvedPage->getTitle(); $extenstion = empty($pageTitle) ? null : '.pdf'; $objPDF = new \Cx\Core_Modules\Pdf\Model\Entity\PdfDocument(); $objPDF->SetTitle($pageTitle . $extenstion); $objPDF->setContent($this->template->get()); $objPDF->Create(); exit; } // fetch the parsed webpage $this->template->setVariable('JAVASCRIPT', 'javascript_inserting_here'); $endcode = $this->template->get(); /** * Get all javascripts in the code, replace them with nothing, and register the js file * to the javascript lib. This is because we don't want something twice, and there could be * a theme that requires a javascript, which then could be used by a module too and therefore would * be loaded twice. */ /* Finds all uncommented script tags, strips them out of the HTML and * stores them internally so we can put them in the placeholder later * (see JS::getCode() below) */ \JS::findJavascripts($endcode); /* * Proposal: Use this * $endcode = preg_replace_callback('/<script\s.*?src=(["\'])(.*?)(\1).*?\/?>(?:<\/script>)?/i', array('JS', 'registerFromRegex'), $endcode); * and change JS::registerFromRegex to use index 2 */ // i know this is ugly, but is there another way $endcode = str_replace('javascript_inserting_here', \JS::getCode(), $endcode); // do a final replacement of all those node-urls ({NODE_<ID>_<LANG>}- placeholders) that haven't been captured earlier $endcode = preg_replace('/\\[\\[([A-Z0-9_-]+)\\]\\]/', '{\\1}', $endcode); \LinkGenerator::parseTemplate($endcode); // remove the meta tag X-UA-Compatible if the user agent ist neighter internet explorer nor chromeframe if (!preg_match('/(msie|chromeframe)/i', $_SERVER['HTTP_USER_AGENT'])) { $endcode = preg_replace('/<meta.*?X-UA-Compatible.*?>/i', '', $endcode); } // replace links from before contrexx 3 $ls = new \LinkSanitizer($this, $this->getCodeBaseOffsetPath() . \Env::get('virtualLanguageDirectory') . '/', $endcode); $this->endcode = $ls->replace(); } else { // backend meta navigation if ($this->template->blockExists('backend_metanavigation')) { // parse language navigation if ($this->template->blockExists('backend_language_navigation') && $this->template->blockExists('backend_language_navigation_item')) { $backendLanguage = \FWLanguage::getActiveBackendLanguages(); if (count($backendLanguage) > 1) { $this->template->setVariable('TXT_LANGUAGE', $_CORELANG['TXT_LANGUAGE']); foreach ($backendLanguage as $language) { $languageUrl = \Env::get('init')->getUriBy('setLang', $language['id']); $this->template->setVariable(array('LANGUAGE_URL' => contrexx_raw2xhtml($languageUrl), 'LANGUAGE_NAME' => $language['name'], 'LANGUAGE_CSS' => \Env::get('init')->getBackendLangId() == $language['id'] ? 'active' : '')); $this->template->parse('backend_language_navigation_item'); } $this->template->parse('backend_language_navigation'); } else { $this->template->hideBlock('backend_language_navigation'); } } $this->template->touchBlock('backend_metanavigation'); } // page parsing $parsingTime = $this->stopTimer(); // var_dump($parsingTime); /*echo ($finishTime[0] - $startTime[0]) . '<br />'; if (!isset($_SESSION['asdf1']) || isset($_GET['reset'])) { $_SESSION['asdf1'] = 0; $_SESSION['asdf2'] = 0; } echo $_SESSION['asdf1'] . '<br />'; if ($_SESSION['asdf1'] > 0) { echo $_SESSION['asdf2'] / $_SESSION['asdf1']; } $_SESSION['asdf1']++; $_SESSION['asdf2'] += ($finishTime[0] - $startTime[0]);//*/ $objAdminNav = new \adminMenu($plainCmd); $objAdminNav->getAdminNavbar(); $this->template->setVariable(array('SUB_MENU_TITLE' => $subMenuTitle, 'FRONTEND_LANG_MENU' => \Env::get('init')->getUserFrontendLangMenu(), 'TXT_GENERATED_IN' => $_CORELANG['TXT_GENERATED_IN'], 'TXT_SECONDS' => $_CORELANG['TXT_SECONDS'], 'TXT_LOGOUT_WARNING' => $_CORELANG['TXT_LOGOUT_WARNING'], 'PARSING_TIME' => $parsingTime, 'LOGGED_NAME' => htmlentities($this->getUser()->objUser->getProfileAttribute('firstname') . ' ' . $this->getUser()->objUser->getProfileAttribute('lastname'), ENT_QUOTES, CONTREXX_CHARSET), 'TXT_LOGGED_IN_AS' => $_CORELANG['TXT_LOGGED_IN_AS'], 'TXT_LOG_OUT' => $_CORELANG['TXT_LOG_OUT'], 'MODULE_INDEX' => MODULE_INDEX, 'JAVASCRIPT' => \JS::getCode(), 'CX_EDITION' => $_CONFIG['coreCmsEdition'], 'CX_VERSION' => $_CONFIG['coreCmsVersion'], 'CX_CODE_NAME' => $_CONFIG['coreCmsCodeName'], 'CX_STATUS' => $_CONFIG['coreCmsStatus'], 'CX_RELEASE_DATE' => date(ASCMS_DATE_FORMAT_DATE, $_CONFIG['coreCmsReleaseDate']), 'CX_NAME' => $_CONFIG['coreCmsName'])); // Style parsing if (file_exists($this->codeBaseAdminTemplatePath . '/css/' . $cmd . '.css')) { // check if there's a css file in the core section $this->template->setVariable('ADD_STYLE_URL', $this->codeBaseAdminTemplateWebPath . '/css/' . $cmd . '.css'); $this->template->parse('additional_style'); } elseif (file_exists($this->codeBaseModulePath . '/' . $cmd . '/template/backend.css')) { // of maybe in the current module directory $this->template->setVariable('ADD_STYLE_URL', $this->codeBaseModuleWebPath . '/' . $cmd . '/template/backend.css'); $this->template->parse('additional_style'); } elseif (file_exists($this->codeBaseCoreModulePath . '/' . $cmd . '/template/backend.css')) { // or in the core module directory $this->template->setVariable('ADD_STYLE_URL', $this->codeBaseCoreModuleWebPath . '/' . $cmd . '/template/backend.css'); $this->template->parse('additional_style'); } else { $this->template->hideBlock('additional_style'); } /*echo '<pre>'; print_r($_SESSION); /*echo '<b>Overall time: ' . (microtime(true) - $timeAtStart) . 's<br />'; echo 'Max RAM usage: ' . formatBytes(memory_get_peak_usage()) . '<br />'; echo 'End RAM usage: ' . formatBytes(memory_get_usage()) . '<br /></b>';*/ $endcode = $this->template->get(); // replace links from before contrexx 3 $ls = new \LinkSanitizer($this, $this->getCodeBaseOffsetPath() . $this->getBackendFolderName() . '/', $endcode); $this->endcode = $ls->replace(); } \DBG::log("(Cx: {$this->id}) Request parsing completed after {$parsingTime}"); }
/** * Set the registration fields placeholders to the template * * @param \Cx\Core\Html\Sigma $objTpl Template instance * @param integer $regId Registration id */ function showRegistrationInputfields(\Cx\Core\Html\Sigma $objTpl, $regId = null) { global $_LANGID, $_ARRAYLANG; $i = 0; $objForm = new \Cx\Modules\Calendar\Controller\CalendarForm($this->formId); $objRegistration = new \Cx\Modules\Calendar\Controller\CalendarRegistration($this->formId, $regId); // parse the registration type for the add/edit subscription $regType = isset($_POST['registrationType']) ? (int) $_POST['registrationType'] : (!empty($regId) ? $objRegistration->type : 1); $regTypeField = '<select style="width: 208px;" class="calendarSelect" name="registrationType"> <option value="1" ' . ($regType == 1 ? "selected='selected'" : '') . ' />' . $_ARRAYLANG['TXT_CALENDAR_REG_REGISTRATION'] . '</option> <option value="0" ' . ($regType == 0 ? "selected='selected'" : '') . ' />' . $_ARRAYLANG['TXT_CALENDAR_REG_SIGNOFF'] . '</option> <option value="2" ' . ($regType == 2 ? "selected='selected'" : '') . ' />' . $_ARRAYLANG['TXT_CALENDAR_REG_WAITLIST'] . '</option> </select>'; $objTpl->setVariable(array($this->moduleLangVar . '_ROW' => $i % 2 == 0 ? 'row1' : 'row2', $this->moduleLangVar . '_REGISTRATION_INPUTFIELD_NAME' => $_ARRAYLANG['TXT_CALENDAR_TYPE'], $this->moduleLangVar . '_REGISTRATION_INPUTFIELD_VALUE' => $regTypeField)); $objTpl->parse('calendar_registration_inputfield'); $i++; if ($this->event && $this->event->seriesStatus && $this->event->independentSeries) { $endDate = new \DateTime(); $endDate->modify('+10 years'); $eventManager = new CalendarEventManager(null, $endDate); $objEvent = new \Cx\Modules\Calendar\Controller\CalendarEvent($this->event->id); if ($eventManager->_addToEventList($objEvent)) { $eventManager->eventList[] = $objEvent; } $eventManager->_setNextSeriesElement($objEvent); $regEventDateField = '<select style="width: 208px;" class="calendarSelect" name="registrationEventDate">'; foreach ($eventManager->eventList as $event) { $selectedDate = $objRegistration->eventDate == $event->startDate->getTimestamp() ? 'selected="selected"' : ''; $regEventDateField .= '<option value="' . $event->startDate->getTimestamp() . '" ' . $selectedDate . ' />' . $this->format2userDate($event->startDate) . '</option>'; } $regEventDateField .= '</select>'; $objTpl->setVariable(array($this->moduleLangVar . '_ROW' => $i % 2 == 0 ? 'row1' : 'row2', $this->moduleLangVar . '_REGISTRATION_INPUTFIELD_NAME' => $_ARRAYLANG['TXT_CALENDAR_DATE_OF_THE_EVENT'], $this->moduleLangVar . '_REGISTRATION_INPUTFIELD_VALUE' => $regEventDateField)); $objTpl->parse('calendar_registration_inputfield'); $i++; } foreach ($objForm->inputfields as $arrInputfield) { $inputfield = ''; $options = explode(',', $arrInputfield['default_value'][$_LANGID]); $optionSelect = true; if (isset($_POST['registrationField'][$arrInputfield['id']])) { $value = $_POST['registrationField'][$arrInputfield['id']]; } else { $value = $regId != null ? $objRegistration->fields[$arrInputfield['id']]['value'] : ''; } switch ($arrInputfield['type']) { case 'inputtext': case 'mail': case 'firstname': case 'lastname': $inputfield = '<input style="width: 200px;" type="text" class="calendarInputText" name="registrationField[' . $arrInputfield['id'] . ']" value="' . $value . '" />'; break; case 'textarea': $inputfield = '<textarea style="width: 196px;" class="calendarTextarea" name="registrationField[' . $arrInputfield['id'] . ']">' . $value . '</textarea>'; break; case 'seating': $optionSelect = false; case 'select': case 'salutation': $inputfield = '<select style="width: 208px;" class="calendarSelect" name="registrationField[' . $arrInputfield['id'] . ']">'; $selected = empty($_POST) ? 'selected="selected"' : ''; $inputfield .= $optionSelect ? '<option value="" ' . $selected . '>' . $_ARRAYLANG['TXT_CALENDAR_PLEASE_CHOOSE'] . '</option>' : ''; foreach ($options as $key => $name) { $selected = $key + 1 == $value ? 'selected="selected"' : ''; $inputfield .= '<option value="' . intval($key + 1) . '" ' . $selected . '>' . $name . '</option>'; } $inputfield .= '</select>'; break; case 'radio': $arrValue = explode('[[', $value); $value = $arrValue[0]; $input = str_replace(']]', '', $arrValue[1]); foreach ($options as $key => $name) { $checked = $key + 1 == $value || in_array($key + 1, $_POST['registrationField'][$arrInputfield['id']]) ? 'checked="checked"' : ''; $textfield = '<input type="text" class="calendarInputCheckboxAdditional" name="registrationFieldAdditional[' . $arrInputfield['id'] . '][' . $key . ']" value="' . ($checked ? $input : '') . '" />'; $name = str_replace('[[INPUT]]', $textfield, $name); $inputfield .= '<input type="radio" class="calendarInputCheckbox" name="registrationField[' . $arrInputfield['id'] . ']" value="' . intval($key + 1) . '" ' . $checked . '/> ' . $name . '<br />'; } break; case 'checkbox': $results = explode(',', $value); foreach ($results as $result) { list($value, $input) = explode('[[', $result); $value = !empty($value) ? $value : 0; $input = str_replace(']]', '', $input); $newResult[$value] = $input; } foreach ($options as $key => $name) { $checked = array_key_exists($key + 1, $newResult) || in_array($key + 1, $_POST['registrationField'][$arrInputfield['id']]) ? 'checked="checked"' : ''; $textfield = '<input type="text" class="calendarInputCheckboxAdditional" name="registrationFieldAdditional[' . $arrInputfield['id'] . '][' . $key . ']" value="' . ($checked ? $newResult[$key + 1] : '') . '" />'; $name = str_replace('[[INPUT]]', $textfield, $name); $inputfield .= '<input ' . $checked . ' type="checkbox" class="calendarInputCheckbox" name="registrationField[' . $arrInputfield['id'] . '][]" value="' . intval($key + 1) . '" /> ' . $name . '<br />'; } break; case 'agb': $checked = $value ? "checked='checked'" : ''; $inputfield = '<input ' . $checked . ' class="calendarInputCheckbox" type="checkbox" name="registrationField[' . $arrInputfield['id'] . '][]" value="1" /> ' . $_ARRAYLANG['TXT_CALENDAR_AGB'] . '<br />'; break; } if ($arrInputfield['type'] != 'fieldset') { $objTpl->setVariable(array($this->moduleLangVar . '_ROW' => $i % 2 == 0 ? 'row1' : 'row2', $this->moduleLangVar . '_REGISTRATION_INPUTFIELD_NAME' => $arrInputfield['name'][$_LANGID], $this->moduleLangVar . '_REGISTRATION_INPUTFIELD_REQUIRED' => $arrInputfield['required'] == 1 ? '<font class="calendarRequired"> *</font>' : '', $this->moduleLangVar . '_REGISTRATION_INPUTFIELD_VALUE' => $inputfield)); $objTpl->parse('calendar_registration_inputfield'); $i++; } } }
/** * Render the option in the frontend. * * @param Sigma $template */ public function renderTheme($template) { $blockName = strtolower('TEMPLATE_EDITOR_' . $this->name); if ($template->blockExists($blockName)) { foreach ($this->urls as $id => $url) { $template->setVariable(strtoupper('TEMPLATE_EDITOR_' . $this->name), contrexx_raw2xhtml($url)); $template->parse($blockName); } } }
/** * @param Sigma $template */ public function preFinalize(Sigma $template) { if (count($this->mediaBrowserInstances) == 0) { return; } else { global $_ARRAYLANG; /** * @var $init \InitCMS */ $init = \Env::get('init'); $init->loadLanguageData('MediaBrowser'); foreach ($_ARRAYLANG as $key => $value) { if (preg_match("/TXT_FILEBROWSER_[A-Za-z0-9]+/", $key)) { \ContrexxJavascript::getInstance()->setVariable($key, $value, 'mediabrowser'); } } $thumbnailsTemplate = new Sigma(); $thumbnailsTemplate->loadTemplateFile($this->cx->getCoreModuleFolderName() . '/MediaBrowser/View/Template/Thumbnails.html'); $thumbnailsTemplate->setVariable('TXT_FILEBROWSER_THUMBNAIL_ORIGINAL_SIZE', sprintf($_ARRAYLANG['TXT_FILEBROWSER_THUMBNAIL_ORIGINAL_SIZE'])); foreach (UploaderConfiguration::getInstance()->getThumbnails() as $thumbnail) { $thumbnailsTemplate->setVariable(array('THUMBNAIL_NAME' => sprintf($_ARRAYLANG['TXT_FILEBROWSER_THUMBNAIL_' . strtoupper($thumbnail['name']) . '_SIZE'], $thumbnail['size']), 'THUMBNAIL_ID' => $thumbnail['id'], 'THUMBNAIL_SIZE' => $thumbnail['size'])); $thumbnailsTemplate->parse('thumbnails'); } \ContrexxJavascript::getInstance()->setVariable('thumbnails_template', $thumbnailsTemplate->get(), 'mediabrowser'); \JS::activate('mediabrowser'); \JS::registerJS('core_modules/MediaBrowser/View/Script/mediabrowser.js'); } }
/** * @param Sigma $template */ public function preFinalize(Sigma $template) { if (count($this->mediaBrowserInstances) == 0) { return; } global $_ARRAYLANG; /** * @var $init \InitCMS */ $init = \Env::get('init'); $init->loadLanguageData('MediaBrowser'); foreach ($_ARRAYLANG as $key => $value) { if (preg_match("/TXT_FILEBROWSER_[A-Za-z0-9]+/", $key)) { \ContrexxJavascript::getInstance()->setVariable($key, $value, 'mediabrowser'); } } $thumbnailsTemplate = new Sigma(); $thumbnailsTemplate->loadTemplateFile($this->cx->getCoreModuleFolderName() . '/MediaBrowser/View/Template/Thumbnails.html'); $thumbnailsTemplate->setVariable('TXT_FILEBROWSER_THUMBNAIL_ORIGINAL_SIZE', sprintf($_ARRAYLANG['TXT_FILEBROWSER_THUMBNAIL_ORIGINAL_SIZE'])); foreach ($this->cx->getMediaSourceManager()->getThumbnailGenerator()->getThumbnails() as $thumbnail) { $thumbnailsTemplate->setVariable(array('THUMBNAIL_NAME' => sprintf($_ARRAYLANG['TXT_FILEBROWSER_THUMBNAIL_' . strtoupper($thumbnail['name']) . '_SIZE'], $thumbnail['size']), 'THUMBNAIL_ID' => $thumbnail['id'], 'THUMBNAIL_SIZE' => $thumbnail['size'])); $thumbnailsTemplate->parse('thumbnails'); } \ContrexxJavascript::getInstance()->setVariable('thumbnails_template', $thumbnailsTemplate->get(), 'mediabrowser'); \ContrexxJavascript::getInstance()->setVariable('chunk_size', min(floor((\FWSystem::getMaxUploadFileSize() - 1000000) / 1000000), 20) . 'mb', 'mediabrowser'); \ContrexxJavascript::getInstance()->setVariable('languages', \FWLanguage::getActiveFrontendLanguages(), 'mediabrowser'); \ContrexxJavascript::getInstance()->setVariable('language', \FWLanguage::getLanguageCodeById(\FWLanguage::getDefaultLangId()), 'mediabrowser'); \JS::activate('mediabrowser'); \JS::registerJS('core_modules/MediaBrowser/View/Script/MediaBrowser.js'); }
/** * Shows the map * @param int $highlight Id of the Object to be highlighted * @return void */ function _showMap() { global $objDatabase, $_ARRAYLANG, $_CONFIG; $this->_objTpl->loadTemplateFile("modules/immo/template/frontend_map_template.html"); // Check if something has to be highlighted $highlight = isset($_GET['highlight']) ? intval($_GET['highlight']) : 0; // Extract all Placeholders out of the message $subQueryPart = ""; $first = true; $matches = array(); preg_match_all("/%([^%]+)%/", $this->arrSettings['message'], $matches); setlocale(LC_ALL, "de_CH"); foreach ($matches[1] as $match) { if ($first) { $first = false; } else { $subQueryPart .= " OR "; } $subQueryPart .= "lower(name) = '" . strtolower($match) . "'"; } // Get All the immo objects $query = " SELECT immo.id as `id`,\n immo.reference AS `ref` ,\n immo.visibility,\n immo.object_type AS otype,\n immo.new_building AS `new` ,\n immo.property_type AS ptype,\n immo.longitude as `long`,\n immo.latitude as `lat`,\n immo.zoom as `zoom`,\n immo.logo as `logo`\n FROM " . DBPREFIX . "module_immo AS immo\n WHERE immo.visibility = 'listing'"; $objResult = $objDatabase->Execute($query); if ($objResult) { $keyCounter = 0; while (!$objResult->EOF) { unset($data); // This is the one we want to highlight. So we scroll to it if ($objResult->fields['id'] == $highlight) { $startX = $objResult->fields['long']; $startY = $objResult->fields['lat']; $startZoom = $objResult->fields['zoom']; } $data = array('reference' => $objResult->fields['ref'], 'object_type' => $_ARRAYLANG['TXT_IMMO_OBJECTTYPE' . strtoupper($objResult->fields['object_type'])], 'new_building' => $objResult->fields['new_building'] ? $_ARRAYLANG['TXT_IMMO_YES'] : $_ARRAYLANG['TXT_IMMO_NO'], 'property_type' => $_ARRAYLANG['TXT_IMMO_PROPERTYTYPE' . strtoupper($objResult->fields['property_type'])], 'longitude' => $objResult->fields['longitude'], 'latitude' => $objResult->fields['latitude']); $query = " SELECT content.field_id AS `field_id` ,\n fieldnames.name AS `field_name` ,\n fieldvalue AS `value` ,\n image.uri AS `uri` ,\n field.type AS `type`\n FROM " . DBPREFIX . "module_immo_content AS `content`\n INNER JOIN " . DBPREFIX . "module_immo_fieldname AS `fieldnames` ON fieldnames.field_id = content.field_id\n AND fieldnames.lang_id = '" . $this->frontLang . "'\n AND content.lang_id = '" . $this->frontLang . "'\n AND fieldnames.field_id\n IN (\n SELECT field_id\n FROM `" . DBPREFIX . "module_immo_fieldname` AS fieldn\n WHERE\n " . $subQueryPart . "\n )\n AND content.immo_id ='" . $objResult->fields['id'] . "'\n LEFT OUTER JOIN " . DBPREFIX . "module_immo_image AS `image` ON image.field_id = content.field_id\n AND image.immo_id = '" . $objResult->fields['id'] . "'\n LEFT OUTER JOIN " . DBPREFIX . "module_immo_field AS `field` ON content.field_id = field.id"; $objResult2 = $objDatabase->Execute($query); while (!$objResult2->EOF) { $data[strtolower($objResult2->fields['field_name'])] = $objResult2->fields['type'] == "img" || $objResult2->fields['type'] == "panorama" ? !empty($objResult2->fields['uri']) ? $objResult2->fields['uri'] : "../core/Core/View/Media/icons/pixel.gif" : $objResult2->fields['value']; $objResult2->MoveNext(); } // Line breaks are evil $message = str_replace("\r", "", $this->arrSettings['message']); $message = str_replace("\n", "", $message); // get all fieldnames + -contents from the highlighted immo ID if (!empty($highlight)) { $this->_getFieldNames($highlight); } // replace the placeholder in the message with the date (if provided) foreach ($matches[1] as $match) { $toReplace = isset($data[strtolower($match)]) ? $data[strtolower($match)] : ""; //custom values for "price" field if ($match == strtoupper($this->arrFields['price'])) { $toReplace = number_format($toReplace, $this->_arrPriceFormat[$this->frontLang]['dec'], $this->_arrPriceFormat[$this->frontLang]['dec_sep'], $this->_arrPriceFormat[$this->frontLang]['thousand_sep']); $status = $this->_getFieldFromText('status'); if ($this->_getFieldFromText($this->arrFields['price']) == 0) { $status = "null"; } $toReplace = $this->arrSettings['currency_lang_' . $this->frontLang] . " " . $toReplace . " " . $this->_currencySuffix; switch ($status) { case 'verkauft': $toReplace = '<strike>' . $toReplace . '</strike> <span style=\\"color: red;\\">(verkauft)</span>'; break; case 'versteckt': $toReplace = '<span style=\\"color: red;\\">verkauft</span>'; break; // case 'null': // $toReplace = '<span style=\"color: red;\">verkauft</span>'; // break; // case 'null': // $toReplace = '<span style=\"color: red;\">verkauft</span>'; // break; case 'reserviert': $toReplace .= ' <span style=\\"color: red;\\">(reserviert)</span>'; break; } } $message = str_replace("%" . $match . "%", $toReplace, $message); } $this->_objTpl->setVariable(array('IMMO_KEY_NUMBER' => $keyCounter, 'IMMO_MARKER_LAT' => $objResult->fields['lat'], 'IMMO_MARKER_LONG' => $objResult->fields['long'], 'IMMO_MARKER_MSG' => $message, 'IMMO_MARKER_ID' => $objResult->fields['id'], 'IMMO_MARKER_HIGHLIGHT' => $objResult->fields['id'] == $highlight ? 1 : 0, 'IMMO_MARKER_LOGO' => $objResult->fields['logo'])); $this->_objTpl->parse("setmarker"); $keyCounter++; $objResult->MoveNext(); } } // Nothing is highlighted. Start at the default start point if (!$highlight || !isset($startX)) { $startX = $this->arrSettings['lat_frontend']; $startY = $this->arrSettings['lon_frontend']; $startZoom = $this->arrSettings['zoom_frontend']; } $googleKey = empty($this->arrSettings['GOOGLE_API_KEY_' . $_SERVER['SERVER_NAME']]) ? $_CONFIG['googleMapsAPIKey'] : $this->arrSettings['GOOGLE_API_KEY_' . $_SERVER['SERVER_NAME']]; $this->_objTpl->setVariable(array('IMMO_GOOGLE_API_KEY' => $googleKey, 'IMMO_START_X' => $startX, 'IMMO_START_Y' => $startY, 'IMMO_START_ZOOM' => $startZoom, 'IMMO_LANG' => $this->frontLang, 'IMMO_TXT_LOOK' => $_ARRAYLANG['TXT_IMMO_LOOK'])); if (!empty($_GET['bigone']) && $_GET['bigone'] == 1) { $this->_objTpl->touchBlock("big"); $this->_objTpl->parse("big"); } else { $this->_objTpl->touchBlock("small"); $this->_objTpl->parse("small"); } $this->_objTpl->getBlockList(); $this->_objTpl->parse("map"); $this->_objTpl->show("map"); die; }
/** * The Cart view * * Mind that the Cart needs to be {@see update()}d before calling this * method. * @global array $_ARRAYLANG Language array * @param \Cx\Core\Html\Sigma $objTemplate The optional Template */ static function view($objTemplate = null) { global $_ARRAYLANG; if (!$objTemplate) { // TODO: Handle missing or empty Template, load one die("Cart::view(): ERROR: No template"); // return false; } $objTemplate->setGlobalVariable($_ARRAYLANG); $i = 0; if (count(self::$products)) { foreach (self::$products as $arrProduct) { $groupCountId = $arrProduct['group_id']; $groupArticleId = $arrProduct['article_id']; $groupCustomerId = 0; if (Shop::customer()) { $groupCustomerId = Shop::customer()->group_id(); } Shop::showDiscountInfo($groupCustomerId, $groupArticleId, $groupCountId, $arrProduct['quantity']); // product image $arrProductImg = Products::get_image_array_from_base64($arrProduct['product_images']); $shopImagesWebPath = \Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteImagesWebPath() . '/Shop/'; $thumbnailPath = $shopImagesWebPath . ShopLibrary::noPictureName; foreach ($arrProductImg as $productImg) { if (!empty($productImg['img']) && $productImg['img'] != ShopLibrary::noPictureName) { $thumbnailPath = $shopImagesWebPath . \ImageManager::getThumbnailFilename($productImg['img']); break; } } /* UNUSED (and possibly obsolete, too) if (isset($arrProduct['discount_string'])) { //DBG::log("Shop::view_cart(): Product ID ".$arrProduct['id'].": ".$arrProduct['discount_string']); $objTemplate->setVariable( 'SHOP_DISCOUNT_COUPON_STRING', $arrProduct['coupon_string'] ); }*/ // The fields that don't apply have been set to '' // (empty string) already -- see update(). $objTemplate->setVariable(array('SHOP_PRODUCT_ROW' => 'row' . (++$i % 2 + 1), 'SHOP_PRODUCT_ID' => $arrProduct['id'], 'SHOP_PRODUCT_CODE' => $arrProduct['product_id'], 'SHOP_PRODUCT_THUMBNAIL' => $thumbnailPath, 'SHOP_PRODUCT_CART_ID' => $arrProduct['cart_id'], 'SHOP_PRODUCT_TITLE' => str_replace('"', '"', contrexx_raw2xhtml($arrProduct['title'])), 'SHOP_PRODUCT_PRICE' => $arrProduct['price'], 'SHOP_PRODUCT_PRICE_UNIT' => Currency::getActiveCurrencySymbol(), 'SHOP_PRODUCT_QUANTITY' => $arrProduct['quantity'], 'SHOP_PRODUCT_ITEMPRICE' => $arrProduct['itemprice'], 'SHOP_PRODUCT_ITEMPRICE_UNIT' => Currency::getActiveCurrencySymbol(), 'SHOP_REMOVE_PRODUCT' => $_ARRAYLANG['TXT_SHOP_REMOVE_ITEM'])); //DBG::log("Attributes String: {$arrProduct['options_long']}"); if ($arrProduct['options_long']) { $objTemplate->setVariable('SHOP_PRODUCT_OPTIONS', $arrProduct['options_long']); } if (\Cx\Core\Setting\Controller\Setting::getValue('weight_enable', 'Shop')) { $objTemplate->setVariable(array('SHOP_PRODUCT_WEIGHT' => Weight::getWeightString($arrProduct['weight']), 'TXT_WEIGHT' => $_ARRAYLANG['TXT_TOTAL_WEIGHT'])); } if (Vat::isEnabled()) { $objTemplate->setVariable(array('SHOP_PRODUCT_TAX_RATE' => $arrProduct['vat_rate'] ? Vat::format($arrProduct['vat_rate']) : '', 'SHOP_PRODUCT_TAX_AMOUNT' => $arrProduct['vat_amount'] . ' ' . Currency::getActiveCurrencySymbol())); } if (intval($arrProduct['minimum_order_quantity']) > 0) { $objTemplate->setVariable(array('SHOP_PRODUCT_MINIMUM_ORDER_QUANTITY' => $arrProduct['minimum_order_quantity'])); } else { if ($objTemplate->blockExists('orderQuantity')) { $objTemplate->hideBlock('orderQuantity'); } if ($objTemplate->blockExists('minimumOrderQuantity')) { $objTemplate->hideBlock('minimumOrderQuantity'); } } $objTemplate->parse('shopCartRow'); } } else { $objTemplate->hideBlock('shopCart'); if ($objTemplate->blockExists('shopCartEmpty')) { $objTemplate->touchBlock('shopCartEmpty'); $objTemplate->parse('shopCartEmpty'); } if ($_SESSION['shop']['previous_product_ids']) { $ids = $_SESSION['shop']['previous_product_ids']->toArray(); Shop::view_product_overview($ids); } } $objTemplate->setGlobalVariable(array('TXT_PRODUCT_ID' => $_ARRAYLANG['TXT_ID'], 'SHOP_PRODUCT_TOTALITEM' => self::get_item_count(), 'SHOP_PRODUCT_TOTALPRICE' => Currency::formatPrice(self::get_price()), 'SHOP_PRODUCT_TOTALPRICE_PLUS_VAT' => Currency::formatPrice(self::get_price() + (Vat::isEnabled() && !Vat::isIncluded() ? self::get_vat_amount() : 0)), 'SHOP_PRODUCT_TOTALPRICE_UNIT' => Currency::getActiveCurrencySymbol(), 'SHOP_TOTAL_WEIGHT' => Weight::getWeightString(self::get_weight()), 'SHOP_PRICE_UNIT' => Currency::getActiveCurrencySymbol())); // Show the Coupon code field only if there is at least one defined if (Coupon::count_available()) { //DBG::log("Coupons available"); $objTemplate->setVariable(array('SHOP_DISCOUNT_COUPON_CODE' => isset($_SESSION['shop']['coupon_code']) ? $_SESSION['shop']['coupon_code'] : '')); if ($objTemplate->blockExists('shopCoupon')) { $objTemplate->parse('shopCoupon'); } if (self::get_discount_amount()) { $total_discount_amount = self::get_discount_amount(); //DBG::log("Shop::view_cart(): Total: Amount $total_discount_amount"); $objTemplate->setVariable(array('SHOP_DISCOUNT_COUPON_TOTAL' => $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_AMOUNT_TOTAL'], 'SHOP_DISCOUNT_COUPON_TOTAL_AMOUNT' => Currency::formatPrice(-$total_discount_amount))); } } if (Vat::isEnabled()) { $objTemplate->setVariable(array('TXT_TAX_PREFIX' => Vat::isIncluded() ? $_ARRAYLANG['TXT_SHOP_VAT_PREFIX_INCL'] : $_ARRAYLANG['TXT_SHOP_VAT_PREFIX_EXCL'], 'SHOP_TOTAL_TAX_AMOUNT' => self::get_vat_amount() . ' ' . Currency::getActiveCurrencySymbol())); if (Vat::isIncluded()) { $objTemplate->setVariable(array('SHOP_GRAND_TOTAL_EXCL_TAX' => Currency::formatPrice(self::get_price() - self::get_vat_amount()) . ' ' . Currency::getActiveCurrencySymbol())); } } if (self::needs_shipment()) { $objTemplate->setVariable(array('TXT_SHIP_COUNTRY' => $_ARRAYLANG['TXT_SHIP_COUNTRY'], 'SHOP_COUNTRIES_MENU' => \Cx\Core\Country\Controller\Country::getMenu('countryId2', $_SESSION['shop']['countryId2'], true, "document.forms['shopForm'].submit()"), 'SHOP_COUNTRIES_MENUOPTIONS' => \Cx\Core\Country\Controller\Country::getMenuoptions($_SESSION['shop']['countryId2']))); } if (\Cx\Core\Setting\Controller\Setting::getValue('orderitems_amount_min', 'Shop') > 0 && \Cx\Core\Setting\Controller\Setting::getValue('orderitems_amount_min', 'Shop') > self::get_price()) { $objTemplate->setVariable('MESSAGE_TEXT', sprintf($_ARRAYLANG['TXT_SHOP_ORDERITEMS_AMOUNT_MIN'], Currency::formatPrice(\Cx\Core\Setting\Controller\Setting::getValue('orderitems_amount_min', 'Shop')), Currency::getActiveCurrencySymbol())); } elseif (\Cx\Core\Setting\Controller\Setting::getValue('orderitems_amount_max', 'Shop') > 0 && \Cx\Core\Setting\Controller\Setting::getValue('orderitems_amount_max', 'Shop') < self::get_price()) { $objTemplate->setVariable('MESSAGE_TEXT', sprintf($_ARRAYLANG['TXT_SHOP_ORDERITEMS_AMOUNT_MAX'], Currency::formatPrice(\Cx\Core\Setting\Controller\Setting::getValue('orderitems_amount_max', 'Shop')), Currency::getActiveCurrencySymbol())); } else { $objTemplate->setVariable('TXT_NEXT', $_ARRAYLANG['TXT_NEXT']); } }
/** * Parse the registration related palceholders * $hostUri and $hostTarget should be set before calling this method * * @param \Cx\Core\Html\Sigma $objTpl Template instance * @param \Cx\Modules\Calendar\Controller\CalendarEvent $event Event instance * @param string $hostUri Host uri of the event(internal/external) * @param string $hostTarget Host uri target type (_blank/null) * * @return null */ public function parseRegistrationPlaceholders(\Cx\Core\Html\Sigma $objTpl, CalendarEvent $event, $hostUri = '', $hostTarget = '') { global $_ARRAYLANG; $numRegistrations = contrexx_input2int($event->getRegistrationCount()); $numDeregistration = contrexx_input2int($event->getCancellationCount()); $objEscortManager = new \Cx\Modules\Calendar\Controller\CalendarRegistrationManager($event, true, false); $objTpl->setVariable(array($this->moduleLangVar . '_EVENT_COUNT_REG' => $numRegistrations, $this->moduleLangVar . '_EVENT_COUNT_SIGNOFF' => $numDeregistration, $this->moduleLangVar . '_EVENT_COUNT_SUBSCRIBER' => $objEscortManager->getEscortData(), $this->moduleLangVar . '_REGISTRATIONS_SUBSCRIBER' => $event->numSubscriber)); // Only link to registration form if event registration is set up and event lies in the future if (!$event->registration || time() > $event->startDate->getTimestamp()) { $objTpl->hideBlock('calendarEventRegistration'); return; } // Only show registration form if event accepts registrations. // Event accepts registrations, if // - no attendee limit is set // - or if there are still free places available $registrationOpen = true; $regLinkTarget = '_self'; if ($event->registration == CalendarEvent::EVENT_REGISTRATION_EXTERNAL && !$event->registrationExternalFullyBooked || $event->registration == CalendarEvent::EVENT_REGISTRATION_INTERNAL && (empty($event->numSubscriber) || !\FWValidator::isEmpty($event->getFreePlaces()))) { if ($event->registration == CalendarEvent::EVENT_REGISTRATION_EXTERNAL) { $regLinkSrc = \FWValidator::getUrl($event->registrationExternalLink); $regLinkTarget = '_blank'; } elseif ($hostUri) { $regLinkSrc = $hostUri . '/' . CONTREXX_DIRECTORY_INDEX . '?section=' . $this->moduleName . '&cmd=register&id=' . $event->id . '&date=' . $event->startDate->getTimestamp(); } else { $params = array('id' => $event->id, 'date' => $event->startDate->getTimestamp()); $regLinkSrc = \Cx\Core\Routing\Url::fromModuleAndCmd($this->moduleName, 'register', FRONTEND_LANG_ID, $params)->toString(); } $regLink = '<a href="' . $regLinkSrc . '" ' . $hostTarget . '>' . $_ARRAYLANG['TXT_CALENDAR_REGISTRATION'] . '</a>'; } else { $regLink = '<i>' . $_ARRAYLANG['TXT_CALENDAR_EVENT_FULLY_BLOCKED'] . '</i>'; $regLinkSrc = ''; $registrationOpen = false; } $objTpl->setVariable(array($this->moduleLangVar . '_EVENT_REGISTRATION_LINK' => $regLink, $this->moduleLangVar . '_EVENT_REGISTRATION_LINK_SRC' => $regLinkSrc, $this->moduleLangVar . '_EVENT_REGISTRATION_LINK_TARGET' => $regLinkTarget)); if ($objTpl->blockExists('calendarEventRegistrationOpen')) { if ($registrationOpen) { $objTpl->touchBlock('calendarEventRegistrationOpen'); } else { $objTpl->hideBlock('calendarEventRegistrationOpen'); } } if ($objTpl->blockExists('calendarEventRegistrationClosed')) { if (!$registrationOpen) { $objTpl->touchBlock('calendarEventRegistrationClosed'); } else { $objTpl->hideBlock('calendarEventRegistrationClosed'); } } $objTpl->parse('calendarEventRegistration'); }
/** * Parsing the relalated News tags * * @global \Cx\Core_Modules\News\Controller\type $_ARRAYLANG * * @param Object $objTpl Template Object * @param Array $relatedNewsIds Array List of related news Ids * @param Integer $langId * @param String $blockName * * @return null */ public function parseRelatedNewsTags(\Cx\Core\Html\Sigma $objTpl, $relatedNewsIds = array(), $langId = null, $blockName = 'related_news') { if (empty($relatedNewsIds) || !$objTpl->blockExists($blockName)) { return; } $defaultLangId = \FWLanguage::getDefaultLangId(); //Getting the related news details for the given languages $relatedNewsDetails = $this->getRelatedNewsDetails($relatedNewsIds, array($langId, $defaultLangId)); if (empty($relatedNewsDetails)) { return; } foreach ($relatedNewsIds as $relatedNewsId) { $currentRelatedDetails = isset($relatedNewsDetails[$relatedNewsId][$langId]) ? $relatedNewsDetails[$relatedNewsId][$langId] : $relatedNewsDetails[$relatedNewsId][$defaultLangId]; $objTpl->setVariable(array('NEWS_RELATED_NEWS_ID' => contrexx_raw2xhtml($relatedNewsId), 'NEWS_RELATED_NEWS_TITLE' => contrexx_raw2xhtml($currentRelatedDetails['title']), 'NEWS_RELATED_NEWS_TITLE_SHORT' => strlen($currentRelatedDetails['title']) > 35 ? substr(strip_tags($currentRelatedDetails['title']), 0, 35) . '...' : strip_tags($currentRelatedDetails['title']))); $objTpl->parse($blockName); } }
/** * parse the settings dropdown * * @param object $objTemplate template object * @param array $settingValues array of setting values * @param string $selected selected dropdown value * @param string $blockName block name for template parsing * * @return null */ public function parseSettingsDropDown(\Cx\Core\Html\Sigma $objTemplate, $settingValues, $selected, $blockName) { global $_ARRAYLANG; if (empty($settingValues)) { return; } foreach (array_keys($settingValues) as $key) { $selectedOption = $selected == $key ? 'selected="selected"' : ''; $objTemplate->setVariable(array('DOWNLOADS_SETTINGS_DROPDOWN_OPTION_VALUE' => $key, 'DOWNLOADS_SETTINGS_DROPDOWN_OPTION_NAME' => $_ARRAYLANG['TXT_DOWNLOADS_SETTINGS_' . strtoupper($key) . '_LABEL'], 'DOWNLOADS_SETTINGS_DROPDOWN_SELECTED_OPTION' => $selectedOption)); $objTemplate->parse('downloads_settings_sorting_dropdown_' . $blockName); } }
/** * Edit coupons * @param \Cx\Core\Html\Sigma $objTemplate The Template */ static function edit($objTemplate) { global $_ARRAYLANG; //DBG::activate(DBG_ADODB|DBG_LOG_FIREPHP|DBG_PHP); $result = true; if (isset($_GET['delete'])) { list($code, $customer_id) = explode('-', $_GET['delete']); $result &= self::delete(contrexx_input2raw($code), intval($customer_id)); } $edit = isset($_REQUEST['edit']) ? contrexx_input2raw($_REQUEST['edit']) : null; //DBG::log("Edit: ".($edit ? $edit : 'NULL')); $code = isset($_POST['code']) ? contrexx_input2raw($_POST['code']) : null; $payment_id = empty($_POST['payment_id']) ? 0 : intval($_POST['payment_id']); $start_time = empty($_POST['start_date']) ? 0 : strtotime(contrexx_input2raw($_POST['start_date'])); $end_time = empty($_POST['end_date_unlimited']) ? empty($_POST['end_date']) ? 0 : strtotime(contrexx_input2raw($_POST['end_date'])) : 0; $coupon_type = empty($_POST['coupon_type']) ? null : contrexx_input2raw($_POST['coupon_type']); $discount_rate = intval(empty($_POST['discount_rate']) ? 0 : floatval($_POST['discount_rate'])); $discount_amount = Currency::formatPrice(empty($_POST['discount_amount']) ? 0 : floatval($_POST['discount_amount'])); if ($coupon_type == 'rate') { $discount_amount = 0; } if ($coupon_type == 'amount') { $discount_rate = 0; } $minimum_amount = Currency::formatPrice(empty($_POST['minimum_amount']) ? 0 : floatval($_POST['minimum_amount'])); $uses = empty($_POST['unlimited']) ? empty($_POST['uses']) ? 1 : intval($_POST['uses']) : self::USES_UNLIMITED; $customer_id = empty($_POST['customer_id']) ? 0 : intval($_POST['customer_id']); $product_id = empty($_POST['product_id']) ? 0 : intval($_POST['product_id']); $global = !empty($_POST['global_or_customer']); //DBG::log("code $code, start_time $start_time, end_time $end_time, minimum amount $minimum_amount, discount_rate $discount_rate, discount_amount $discount_amount, uses $uses, customer_id $customer_id"); if (isset($code)) { $result &= self::storeCode($code, $payment_id, $minimum_amount, $discount_rate, $discount_amount, $start_time, $end_time, $uses, $global, $customer_id, $product_id, $edit); if ($result) { $code = $edit = null; } else { if (empty($edit)) { $edit = "{$code}-{$customer_id}"; } } } // Reset the end time if it's in the past if ($end_time < time()) { $end_time = 0; } $uri = \Html::getRelativeUri(); \Html::stripUriParam($uri, 'view'); \Html::stripUriParam($uri, 'edit'); \Html::stripUriParam($uri, 'order_coupon'); $arrSortingFields = array('code' => $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_CODE'], 'start_time' => $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_START_TIME'], 'end_time' => $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_END_TIME'], 'minimum_amount' => sprintf($_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_MINIMUM_AMOUNT_FORMAT'], Currency::getDefaultCurrencyCode()), 'discount_rate' => $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_RATE'], 'discount_amount' => sprintf($_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_AMOUNT_FORMAT'], Currency::getDefaultCurrencyCode()), 'uses' => $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_USES'], 'global' => $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_SCOPE'], 'customer_id' => $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_CUSTOMER'], 'product_id' => $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_PRODUCT'], 'payment_id' => $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_PAYMENT']); $objSorting = new \Sorting($uri, $arrSortingFields, true, 'order_coupon'); $objTemplate->setGlobalVariable($_ARRAYLANG + array('TXT_SHOP_DISCOUNT_COUPON_MINIMUM_AMOUNT_CURRENCY' => sprintf($_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_MINIMUM_AMOUNT_FORMAT'], Currency::getDefaultCurrencyCode()), 'TXT_SHOP_DISCOUNT_COUPON_AMOUNT_CURRENCY' => sprintf($_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_AMOUNT_FORMAT'], Currency::getDefaultCurrencyCode()), 'TXT_SHOP_DISCOUNT_COUPON_ADD_OR_EDIT' => $_ARRAYLANG[$edit ? 'TXT_SHOP_DISCOUNT_COUPON_EDIT' : 'TXT_SHOP_DISCOUNT_COUPON_ADD'], 'SHOP_DISCOUNT_COUPON_VIEW_ACTIVE' => $edit ? '' : 'active', 'SHOP_DISCOUNT_COUPON_EDIT_ACTIVE' => $edit ? 'active' : '', 'SHOP_DISCOUNT_COUPON_VIEW_DISPLAY' => $edit ? 'none' : 'block', 'SHOP_DISCOUNT_COUPON_EDIT_DISPLAY' => $edit ? 'block' : 'none', 'HEADER_SHOP_DISCOUNT_COUPON_CODE' => $objSorting->getHeaderForField('code'), 'HEADER_SHOP_DISCOUNT_COUPON_START_TIME' => $objSorting->getHeaderForField('start_time'), 'HEADER_SHOP_DISCOUNT_COUPON_END_TIME' => $objSorting->getHeaderForField('end_time'), 'HEADER_SHOP_DISCOUNT_COUPON_MINIMUM_AMOUNT_CURRENCY' => $objSorting->getHeaderForField('minimum_amount'), 'HEADER_SHOP_DISCOUNT_COUPON_RATE' => $objSorting->getHeaderForField('discount_rate'), 'HEADER_SHOP_DISCOUNT_COUPON_AMOUNT_CURRENCY' => $objSorting->getHeaderForField('discount_amount'), 'HEADER_SHOP_DISCOUNT_COUPON_USES' => $objSorting->getHeaderForField('uses'), 'HEADER_SHOP_DISCOUNT_COUPON_SCOPE' => $objSorting->getHeaderForField('global'), 'HEADER_SHOP_DISCOUNT_COUPON_CUSTOMER' => $objSorting->getHeaderForField('customer_id'), 'HEADER_SHOP_DISCOUNT_COUPON_PRODUCT' => $objSorting->getHeaderForField('product_id'), 'HEADER_SHOP_DISCOUNT_COUPON_PAYMENT' => $objSorting->getHeaderForField('payment_id'))); $count = 0; $limit = \Cx\Core\Setting\Controller\Setting::getValue('numof_coupon_per_page_backend', 'Shop'); if (empty($limit)) { self::errorHandler(); } $arrCoupons = self::getArray(\Paging::getPosition(), $limit, $count, $objSorting->getOrder()); $arrProductName = Products::getNameArray(true, $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_PRODUCT_FORMAT']); $arrPaymentName = Payment::getNameArray(); $i = 0; $row = 0; $objCouponEdit = new Coupon(); $objCouponEdit->code($code); $objCouponEdit->payment_id($payment_id); $objCouponEdit->minimum_amount($minimum_amount); $objCouponEdit->discount_rate($discount_rate); $objCouponEdit->discount_amount($discount_amount); $objCouponEdit->start_time($start_time); $objCouponEdit->end_time($end_time); $objCouponEdit->uses($uses); $objCouponEdit->is_global($global); $objCouponEdit->customer_id($customer_id); $objCouponEdit->product_id($product_id); global $_CONFIG; foreach ($arrCoupons as $index => $objCoupon) { $coupon_uri_id = 'coupon_uri_' . $index; $objTemplate->setVariable(array('SHOP_ROWCLASS' => 'row' . (++$row % 2 + 1), 'SHOP_DISCOUNT_COUPON_CODE' => $objCoupon->code, 'SHOP_DISCOUNT_COUPON_URI_ICON' => '<div class="icon_url"' . '> </div>', 'SHOP_DISCOUNT_COUPON_URI_INPUT' => '<div class="layer_url" id="' . $coupon_uri_id . '">' . \Html::getInputText('dummy', 'http://' . $_CONFIG['domainUrl'] . \Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteOffsetPath() . '/' . CONTREXX_DIRECTORY_INDEX . '?section=Shop' . MODULE_INDEX . '&coupon_code=' . $objCoupon->code, false, 'readonly="readonly"' . ' style="width: 200px;"' . ' onfocus="this.select();"' . ' onblur="cx.jQuery(\'#' . $coupon_uri_id . '\').hide();"') . '</div>', 'SHOP_DISCOUNT_COUPON_START_TIME' => $objCoupon->start_time ? date(ASCMS_DATE_FORMAT_DATE, $objCoupon->start_time) : $_ARRAYLANG['TXT_SHOP_DATE_NONE'], 'SHOP_DISCOUNT_COUPON_END_TIME' => $objCoupon->end_time ? date(ASCMS_DATE_FORMAT_DATE, $objCoupon->end_time) : $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_END_TIME_UNLIMITED'], 'SHOP_DISCOUNT_COUPON_MINIMUM_AMOUNT' => $objCoupon->minimum_amount > 0 ? $objCoupon->minimum_amount : $_ARRAYLANG['TXT_SHOP_AMOUNT_NONE'], 'SHOP_DISCOUNT_COUPON_RATE' => $objCoupon->discount_rate > 0 ? $objCoupon->discount_rate : $_ARRAYLANG['TXT_SHOP_RATE_NONE'], 'SHOP_DISCOUNT_COUPON_AMOUNT' => $objCoupon->discount_amount > 0 ? $objCoupon->discount_amount : $_ARRAYLANG['TXT_SHOP_AMOUNT_NONE'], 'SHOP_DISCOUNT_COUPON_USES' => sprintf($_ARRAYLANG['TXT_SHOP_COUPON_USES_FORMAT'], $objCoupon->used, $objCoupon->uses < 1000000000.0 ? $objCoupon->uses : $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_USES_UNLIMITED']), 'SHOP_DISCOUNT_COUPON_SCOPE' => $objCoupon->global ? $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_GLOBALLY'] : $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_PER_CUSTOMER'], 'SHOP_DISCOUNT_COUPON_PER_CUSTOMER' => !$objCoupon->global ? \Html::getRadio('foo_' . ++$i, '', false, true, '', \Html::ATTRIBUTE_DISABLED) : ' ', 'SHOP_DISCOUNT_COUPON_CUSTOMER' => $objCoupon->customer_id ? Customers::getNameById($objCoupon->customer_id, '%4$s (%3$u)') : $_ARRAYLANG['TXT_SHOP_CUSTOMER_ANY'], 'SHOP_DISCOUNT_COUPON_PRODUCT' => $objCoupon->product_id ? isset($arrProductName[$objCoupon->product_id]) ? $arrProductName[$objCoupon->product_id] : $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_PRODUCT_INVALID'] : $_ARRAYLANG['TXT_SHOP_PRODUCT_ANY'], 'SHOP_DISCOUNT_COUPON_PAYMENT' => $objCoupon->payment_id ? sprintf($_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_PAYMENT_FORMAT'], $objCoupon->payment_id, $arrPaymentName[$objCoupon->payment_id]) : $_ARRAYLANG['TXT_SHOP_PAYMENT_ANY'], 'SHOP_DISCOUNT_COUPON_FUNCTIONS' => \Html::getBackendFunctions(array('edit' => ADMIN_SCRIPT_PATH . '?cmd=Shop&act=settings&tpl=coupon&edit=' . urlencode($index), 'delete' => "javascript:delete_coupon('" . urlencode($index) . "');")))); $objTemplate->parse('shopDiscountCouponView'); if ($index === $edit) { $objCouponEdit = $objCoupon; } } $objTemplate->replaceBlock('shopDiscountCouponView', '', true); $paging = \Paging::get($uri, $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_CODES'], $count, $limit); //DBG::log("Paging: $paging"); $objTemplate->setVariable('SHOP_PAGING', $paging); $attribute_code = 'style="width: 230px; text-align: left;" maxlength="20"'; $attribute_time = 'style="width: 230px; text-align: left;" maxlength="10"'; $attribute_discount_rate = 'style="width: 230px; text-align: right;" maxlength="3"'; $attribute_discount_amount = 'style="width: 230px; text-align: right;" maxlength="9"'; $attribute_minimum_amount = 'style="width: 230px; text-align: right;" maxlength="9"'; $attribute_uses = 'style="width: 230px; text-align: right;" maxlength="6"'; // Superseded by the widget, see below // $attribute_customer = 'style="width: 230px;"'; $attribute_product = 'style="width: 230px;"'; $attribute_payment = 'style="width: 230px;"'; $type = $objCouponEdit->discount_rate > 0 ? 'rate' : 'amount'; $customer_name = ''; //reset the add view if (!$edit) { $objCouponEdit = new Coupon(); } if ($objCouponEdit->customer_id) { $customer_name = Customers::getNameById($objCouponEdit->customer_id, '%4$s (%3$u)'); //DBG::log("Customer ID ".$objCouponEdit->customer_id.": name $customer_name"); } $objTemplate->setVariable(array('SHOP_ROWCLASS' => 'row' . (++$row % 2 + 1), 'SHOP_DISCOUNT_COUPON_INDEX' => $objCouponEdit->getIndex(), 'SHOP_DISCOUNT_COUPON_CODE' => \Html::getInputText('code', $objCouponEdit->code, '', $attribute_code), 'SHOP_DISCOUNT_COUPON_CODE_CREATE' => \Html::getInputButton('code_create', $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_CODE_NEW'], 'button', false, 'onclick="cx.jQuery(\'#code\').val(\'' . Coupon::getNewCode() . '\');' . 'cx.jQuery(this).css(\'display\', \'none\');"'), 'SHOP_DISCOUNT_COUPON_START_TIME' => \Html::getDatepicker('start_date', array('defaultDate' => date(ASCMS_DATE_FORMAT_DATE, $objCouponEdit->start_time ? $objCouponEdit->start_time : time())), $attribute_time), 'SHOP_DISCOUNT_COUPON_END_TIME' => \Html::getDatepicker('end_date', array('defaultDate' => $objCouponEdit->end_time ? date(ASCMS_DATE_FORMAT_DATE, $objCouponEdit->end_time) : ''), $attribute_time), 'SHOP_DISCOUNT_COUPON_END_TIME_UNLIMITED' => \Html::getCheckbox('end_time_unlimited', 1, '', $objCouponEdit->end_time ? '' : \Html::ATTRIBUTE_CHECKED) . \Html::getLabel('end_time_unlimited', $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_END_TIME_UNLIMITED']), 'SHOP_DISCOUNT_COUPON_MINIMUM_AMOUNT' => \Html::getInputText('minimum_amount', $objCouponEdit->minimum_amount, false, $attribute_minimum_amount), 'SHOP_DISCOUNT_COUPON_TYPE' => \Html::getRadioGroup('coupon_type', array('rate' => $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_TYPE_RATE'], 'amount' => $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_TYPE_AMOUNT']), $type), 'SHOP_DISCOUNT_COUPON_TYPE_SELECTED' => $type, 'SHOP_DISCOUNT_COUPON_RATE' => \Html::getInputText('discount_rate', $objCouponEdit->discount_rate, false, $attribute_discount_rate), 'SHOP_DISCOUNT_COUPON_AMOUNT' => \Html::getInputText('discount_amount', number_format($objCouponEdit->discount_amount, 2, '.', ''), false, $attribute_discount_amount), 'SHOP_DISCOUNT_COUPON_USES' => \Html::getInputText('uses', $objCouponEdit->uses < 1000000000.0 ? $objCouponEdit->uses : '', 'uses', $attribute_uses), 'SHOP_DISCOUNT_COUPON_USES_UNLIMITED' => \Html::getCheckbox('unlimited', 1, 'unlimited', $objCouponEdit->uses > 1000000000.0) . \Html::getLabel('unlimited', $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_USES_UNLIMITED']), 'SHOP_DISCOUNT_COUPON_GLOBALLY' => \Html::getRadio('global_or_customer', '1', 'global', $objCouponEdit->global) . \Html::getLabel('global', $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_GLOBALLY']), 'SHOP_DISCOUNT_COUPON_PER_CUSTOMER' => \Html::getRadio('global_or_customer', '0', 'customer', !$objCouponEdit->global) . \Html::getLabel('customer', $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_PER_CUSTOMER']), 'SHOP_DISCOUNT_COUPON_CUSTOMER_ID' => $objCouponEdit->customer_id, 'SHOP_DISCOUNT_COUPON_CUSTOMER_NAME' => $customer_name, 'SHOP_DISCOUNT_COUPON_PRODUCT' => \Html::getSelect('product_id', array(0 => $_ARRAYLANG['TXT_SHOP_PRODUCT_ANY']) + $arrProductName, $objCouponEdit->product_id, false, '', $attribute_product), 'SHOP_DISCOUNT_COUPON_PAYMENT' => \Html::getSelect('payment_id', array(0 => $_ARRAYLANG['TXT_SHOP_PAYMENT_ANY']) + $arrPaymentName, $objCouponEdit->payment_id, false, '', $attribute_payment), 'SHOP_DISCOUNT_COUPON_CUSTOMER_WIDGET_DISPLAY' => $objCouponEdit->global ? \Html::CSS_DISPLAY_NONE : \Html::CSS_DISPLAY_INLINE)); $objTemplate->parse('shopDiscountCouponEdit'); // Depends on, and thus implies loading jQuery as well! \FWUser::getUserLiveSearch(array('minLength' => 3, 'canCancel' => true, 'canClear' => true)); return $result; }
function showNews() { global $objDatabase, $_ARRAYLANG, $_LANGID; $this->_objTpl->setTemplate($this->pageContent, true, true); //feed path $this->feedpath = \Env::get('cx')->getWebsiteFeedPath() . '/'; //active (with $_LANGID) categories $query = "SELECT id,\n name\n FROM " . DBPREFIX . "module_feed_category\n WHERE status = '1'\n AND lang = '" . $_LANGID . "'\n ORDER BY pos"; if ($objResult = $objDatabase->Execute($query)) { while (!$objResult->EOF) { $cat_id[$objResult->fields['id']] = $objResult->fields['id']; $cat_name[$objResult->fields['id']] = $objResult->fields['name']; $objResult->MoveNext(); } } //active news $query = "SELECT id,\n subid,\n name\n FROM " . DBPREFIX . "module_feed_news\n WHERE status = '1'\n ORDER BY pos"; $objResult = $objDatabase->Execute($query); while (!$objResult->EOF) { $news_subid[$objResult->fields['subid']][$objResult->fields['id']] = $objResult->fields['subid']; $news_id[$objResult->fields['subid']][$objResult->fields['id']] = $objResult->fields['id']; $news_name[$objResult->fields['subid']][$objResult->fields['id']] = $objResult->fields['name']; $objResult->MoveNext(); } //no empty categories if (is_array($cat_id)) { foreach ($cat_id as $x) { if (!isset($news_id[$x])) { unset($cat_id[$x]); unset($cat_name[$x]); } } } if (count($cat_id) == 0) { unset($cat_id); } //output structure if (!is_array($cat_id)) { if (!isset($_GET['cat']) and !isset($_GET['news'])) { $this->_objTpl->setVariable('FEED_NO_NEWSFEED', $_ARRAYLANG['TXT_FEED_NO_NEWSFEED']); } else { \Cx\Core\Csrf\Controller\Csrf::header("Location: " . CONTREXX_DIRECTORY_INDEX . "?section=Feed"); } } else { if ($this->_objTpl->blockExists('feed_cat')) { foreach ($cat_id as $x) { //out cat $this->_objTpl->setVariable('FEED_CAT_NAME', $cat_name[$x]); //out news foreach ($news_id[$x] as $y) { $this->_objTpl->setVariable(array('FEED_NEWS_LINK' => CONTREXX_DIRECTORY_INDEX . '?section=Feed&cat=' . $news_subid[$x][$y] . '&news=' . $news_id[$x][$y], 'FEED_NEWS_NAME' => strip_tags($news_name[$x][$y]))); $this->_objTpl->parse('feed_news'); } $this->_objTpl->parse('feed_cat'); } } // first access if (!isset($_GET['cat']) and !isset($_GET['news'])) { reset($cat_id); $_GET['cat'] = current($cat_id); reset($news_id[$_GET['cat']]); $_GET['news'] = current($news_id[$_GET['cat']]); /* foreach($cat_id as $x) { $_GET['cat'] = $cat_id[$x]; foreach($news_id[$x] as $y) { $_GET['news'] = $news_id[$x][$y]; break; } break; }*/ } $getCat = intval($_GET['cat']); $getNews = intval($_GET['news']); //refresh control $query = "SELECT time,\n cache\n FROM " . DBPREFIX . "module_feed_news\n WHERE id = '" . $getNews . "'\n AND subid = '" . $getCat . "'\n AND status = '1'"; $objResult = $objDatabase->Execute($query); if ($objResult->RecordCount() == 0) { \Cx\Core\Csrf\Controller\Csrf::header("Location: " . CONTREXX_DIRECTORY_INDEX . "?section=Feed"); die; } $old_time = $objResult->fields['time'] + $objResult->fields['cache']; $time = time(); if ($time >= $old_time) { $this->showNewsRefresh($getNews, $time, $this->feedpath); } $query = "SELECT name,\n filename,\n time,\n articles,\n image\n FROM " . DBPREFIX . "module_feed_news\n WHERE id = '" . $getNews . "'\n AND subid = '" . $getCat . "'\n AND status = '1'"; $objResult = $objDatabase->Execute($query); //output selected news $news_name = $objResult->fields['name']; $this->_objTpl->setVariable(array('FEED_CAT' => $cat_name[$getCat], 'FEED_PAGE' => $news_name)); $filename = $this->feedpath . $objResult->fields['filename']; //rss class $rss = new \XML_RSS($filename); $rss->parse(); //channel info $out_title = strip_tags($rss->channel['title']); $out_time = date(ASCMS_DATE_FORMAT, $objResult->fields['time']); //image foreach ($rss->getImages() as $img) { if ($img['url'] != '' && $objResult->fields['image'] == 1) { $out_image = '<img src="' . strip_tags($img['url']) . '" alt="" /><br />'; } } $this->_objTpl->setVariable(array('FEED_IMAGE' => $out_image, 'FEED_TITLE' => $out_title, 'FEED_TIME' => $out_time, 'TXT_FEED_LAST_UPTDATE' => $_ARRAYLANG['TXT_FEED_LAST_UPDATE'])); //items $x = 0; foreach ($rss->getItems() as $value) { if ($x < $objResult->fields['articles']) { $this->_objTpl->setVariable(array('FEED_ROWCLASS' => $x % 2 ? 'row2' : 'row1', 'FEED_DATE' => date('d.m.Y', strtotime($value['pubdate'])), 'FEED_LINK' => $value['link'], 'FEED_NAME' => $value['title'])); $this->_objTpl->parse('feed_output_news'); $x++; } } $this->_objTpl->parse('feed_show_news'); } }
/** * Shows the collected messages, if any * * Frontend use only. * Returns a status according to the message classes: * - null, if no message is present * - false, if any message of class CLASS_ERROR is encountered * - true, if no messages of class CLASS_ERROR are found * @param \Cx\Core\Html\Sigma $objTemplateLocal * The optional Template * @return boolean The status */ private static function show_frontend($objTemplateLocal = null) { if (empty($_SESSION['messages'])) { return null; } global $objTemplate; if (empty($objTemplateLocal)) { $objTemplateLocal =& $objTemplate; } foreach (self::$message_classes as $class) { if (empty($_SESSION['messages'][$class])) { continue; } $objTemplateLocal->setVariable(array('MESSAGE_CLASS' => $class, 'MESSAGE_TEXT' => join('<br />', $_SESSION['messages'][$class]->toArray()))); if ($objTemplateLocal->blockExists('messages')) { $objTemplateLocal->parse('messages'); } else { // If no block can be parsed, leave after the first // non-empty message class. // Note: This is why classes are parsed in descending // order of severity! break; } } // Fail when there are error messages if (isset($_SESSION['messages'][self::CLASS_ERROR])) { return false; } return true; }
/** * Parse the current navigation item * * @global array $_ARRAYLANG * * @param \Cx\Core\Html\Sigma $navigation * @param string $blockName * @param string $currentCmd * @param string $mainCmd * @param boolean $isActiveNav * @param boolean $isSubNav */ protected function parseCurrentNavItem(\Cx\Core\Html\Sigma $navigation, $blockName, $currentCmd, $mainCmd, $isActiveNav, $isSubNav) { global $_ARRAYLANG; if (empty($blockName)) { return; } $isActiveNav ? $navigation->touchBlock($blockName . '_active') : $navigation->hideBlock($blockName . '_active'); if (empty($isSubNav)) { $act = empty($currentCmd) ? '' : '&act=' . $currentCmd; $txt = empty($currentCmd) ? 'DEFAULT' : $currentCmd; } else { $act = '&act=' . $mainCmd . '/' . $currentCmd; $txt = (empty($mainCmd) ? 'DEFAULT' : $mainCmd) . '_'; $txt .= empty($currentCmd) ? 'DEFAULT' : strtoupper($currentCmd); } $actTxtKey = 'TXT_' . strtoupper($this->getType()) . '_' . strtoupper($this->getName() . '_ACT_' . $txt); $actTitle = isset($_ARRAYLANG[$actTxtKey]) ? $_ARRAYLANG[$actTxtKey] : $actTxtKey; $navigation->setVariable(array('HREF' => 'index.php?cmd=' . $this->getName() . $act, 'TITLE' => $actTitle)); $navigation->parse($blockName . '_entry'); }
private function parseCategoryDownloads($objCategory, $downloadOrderBy, $downloadOrderDirection, $downloadLimitOffset, $categoryOrderBy, $categoryOrderDirection, $categoryLimitOffset, $searchTerm) { global $_ARRAYLANG, $_LANGID, $_CONFIG; $nr = 0; $arrDownloadOrder = $objCategory->getAssociatedDownloadIds(); $objFWUser = \FWUser::getFWUserObject(); $sortOrder = $this->downloadsSortingOptions[$this->arrConfig['downloads_sorting_order']]; $arrSort = empty($downloadOrderBy) ? $sortOrder : array_merge(array($downloadOrderBy => $downloadOrderDirection), $sortOrder); $objDownload = new Download(); $objDownload->loadDownloads(array('category_id' => $objCategory->getId()), $searchTerm, $arrSort, null, $_CONFIG['corePagingLimit'], $downloadLimitOffset, true); $downloadsAvailable = $objDownload->EOF ? false : true; while (!$objDownload->EOF) { // if (!\Permission::checkAccess(143, 'static', true) && !$objDownload->getVisibility() && $objDownload->getOwnerId() != $objFWUser->objUser->getId()) { // $objDownload->next(); // continue; // } // parse select checkbox & order box if ((\Permission::checkAccess(143, 'static', true) || !$objCategory->getManageFilesAccessId() || \Permission::checkAccess($objCategory->getManageFilesAccessId(), 'dynamic', true) || $objCategory->getOwnerId() == $objFWUser->objUser->getId()) && $objCategory->getId()) { // select checkbox $this->objTemplate->setVariable('DOWNLOADS_DOWNLOAD_ID', $objDownload->getId()); $this->objTemplate->parse('downloads_download_checkbox'); // order box $this->objTemplate->setVariable(array('DOWNLOADS_DOWNLOAD_ID' => $objDownload->getId(), 'DOWNLOADS_DOWNLOAD_ORDER' => $arrDownloadOrder[$objDownload->getId()])); $this->objTemplate->parse('downloads_download_orderbox'); $this->objTemplate->hideBlock('downloads_download_no_orderbox'); $this->objTemplate->parse('downloads_download_no_save_button'); } else { // select checkbox $this->objTemplate->hideBlock('downloads_download_checkbox'); $this->objTemplate->hideBlock('downloads_download_action_dropdown'); // order box $this->objTemplate->setVariable('DOWNLOADS_DOWNLOAD_ORDER', $objCategory->getId() ? $arrDownloadOrder[$objDownload->getId()] : $objDownload->getOrder()); $this->objTemplate->parse('downloads_download_no_orderbox'); $this->objTemplate->hideBlock('downloads_download_orderbox'); $this->objTemplate->hideBlock('downloads_download_no_save_button'); } // parse status link and modify button if (\Permission::checkAccess(143, 'static', true) || $objCategory->getId() && (!$objCategory->getManageFilesAccessId() || \Permission::checkAccess($objCategory->getManageFilesAccessId(), 'dynamic', true) || $objCategory->getModifyAccessByOwner() && $objCategory->getOwnerId() == $objFWUser->objUser->getId()) || $objDownload->getOwnerId() == $objFWUser->objUser->getId()) { $this->objTemplate->setVariable(array('DOWNLOADS_DOWNLOAD_CATEGORY_SORT' => $categoryOrderDirection, 'DOWNLOADS_DOWNLOAD_CATEGORY_SORT_BY' => $categoryOrderBy, 'DOWNLOADS_DOWNLOAD_DOWNLOAD_SORT' => $downloadOrderDirection, 'DOWNLOADS_DOWNLOAD_DOWNLOAD_BY' => $downloadOrderBy, 'DOWNLOADS_DOWNLOAD_CATEGORY_OFFSET' => $categoryLimitOffset, 'DOWNLOADS_DOWNLOAD_DOWNLOAD_OFFSET' => $downloadLimitOffset, 'DOWNLOADS_DOWNLOAD_ID' => $objDownload->getId(), 'DOWNLOADS_DOWNLOAD_CATEGORY_PARENT_ID' => $objCategory->getId(), 'DOWNLOADS_DOWNLOAD_SWITCH_STATUS_DESC' => $objDownload->getActiveStatus() ? $_ARRAYLANG['TXT_DOWNLOADS_DEACTIVATE_DOWNLOAD_DESC'] : $_ARRAYLANG['TXT_DOWNLOADS_ACTIVATE_DOWNLOAD_DESC'], 'DOWNLOADS_DOWNLOAD_SWITCH_STATUS_IMG_DESC' => $objDownload->getActiveStatus() ? $_ARRAYLANG['TXT_DOWNLOADS_DEACTIVATE_DOWNLOAD_DESC'] : $_ARRAYLANG['TXT_DOWNLOADS_ACTIVATE_DOWNLOAD_DESC'])); $this->objTemplate->parse('downloads_download_status_link_open'); $this->objTemplate->touchBlock('downloads_download_status_link_close'); // parse modify icon $this->objTemplate->setVariable(array('DOWNLOADS_DOWNLOAD_CATEGORY_SORT' => $categoryOrderDirection, 'DOWNLOADS_DOWNLOAD_CATEGORY_SORT_BY' => $categoryOrderBy, 'DOWNLOADS_DOWNLOAD_DOWNLOAD_SORT' => $downloadOrderDirection, 'DOWNLOADS_DOWNLOAD_DOWNLOAD_BY' => $downloadOrderBy, 'DOWNLOADS_DOWNLOAD_CATEGORY_OFFSET' => $categoryLimitOffset, 'DOWNLOADS_DOWNLOAD_DOWNLOAD_OFFSET' => $downloadLimitOffset, 'DOWNLOADS_DOWNLOAD_ID' => $objDownload->getId(), 'DOWNLOADS_DOWNLOAD_CATEGORY_PARENT_ID' => $objCategory->getId())); $this->objTemplate->parse('downloads_download_function_modify_link'); $this->objTemplate->hideBlock('downloads_download_function_no_modify_link'); // parse modify link on name attribute $this->objTemplate->setVariable(array('DOWNLOADS_DOWNLOAD_CATEGORY_SORT' => $categoryOrderDirection, 'DOWNLOADS_DOWNLOAD_CATEGORY_SORT_BY' => $categoryOrderBy, 'DOWNLOADS_DOWNLOAD_DOWNLOAD_SORT' => $downloadOrderDirection, 'DOWNLOADS_DOWNLOAD_DOWNLOAD_BY' => $downloadOrderBy, 'DOWNLOADS_DOWNLOAD_CATEGORY_OFFSET' => $categoryLimitOffset, 'DOWNLOADS_DOWNLOAD_DOWNLOAD_OFFSET' => $downloadLimitOffset, 'DOWNLOADS_DOWNLOAD_ID' => $objDownload->getId(), 'DOWNLOADS_DOWNLOAD_CATEGORY_PARENT_ID' => $objCategory->getId())); $this->objTemplate->parse('downloads_download_modify_link_open'); $this->objTemplate->touchBlock('downloads_download_modify_link_close'); } else { $this->objTemplate->setVariable(array('DOWNLOADS_DOWNLOAD_SWITCH_STATUS_DESC' => $objDownload->getActiveStatus() ? $_ARRAYLANG['TXT_DOWNLOADS_ACTIVE'] : $_ARRAYLANG['TXT_DOWNLOADS_INACTIVE'], 'DOWNLOADS_DOWNLOAD_SWITCH_STATUS_IMG_DESC' => $objDownload->getActiveStatus() ? $_ARRAYLANG['TXT_DOWNLOADS_ACTIVE'] : $_ARRAYLANG['TXT_DOWNLOADS_INACTIVE'])); $this->objTemplate->hideBlock('downloads_download_status_link_open'); $this->objTemplate->hideBlock('downloads_download_status_link_close'); // hide modify icon $this->objTemplate->touchBlock('downloads_download_function_no_modify_link'); $this->objTemplate->hideBlock('downloads_download_function_modify_link'); // hide modify linke on name attribute $this->objTemplate->hideBlock('downloads_download_modify_link_open'); $this->objTemplate->hideBlock('downloads_download_modify_link_close'); } // parse download link if (!$objDownload->getAccessId() || $objDownload->getOwnerId() == $objFWUser->objUser->getId() || \Permission::checkAccess($objDownload->getAccessId(), 'dynamic', true) || \Permission::checkAccess(143, 'static', true) || $objCategory->getId() && (!$objCategory->getManageFilesAccessId() || \Permission::checkAccess($objCategory->getManageFilesAccessId(), 'dynamic', true) || $objCategory->getModifyAccessByOwner() && $objCategory->getOwnerId() == $objFWUser->objUser->getId())) { $this->objTemplate->setVariable(array('DOWNLOADS_DOWNLOAD_ID' => $objDownload->getId(), 'DOWNLOADS_DOWNLOAD_DOWNLOAD_ICON' => $objDownload->getIcon(true), 'DOWNLOADS_DOWNLOAD_SOURCE' => htmlentities($objDownload->getSource(), ENT_QUOTES, CONTREXX_CHARSET))); $this->objTemplate->parse('downloads_download_function_download_link'); $this->objTemplate->hideBlock('downloads_download_function_no_download_link'); } else { $this->objTemplate->hideBlock('downloads_download_function_download_link'); $this->objTemplate->touchBlock('downloads_download_function_no_download_link'); } // parse unlink button if (\Permission::checkAccess(143, 'static', true) || $objCategory->getId() && (!$objCategory->getManageFilesAccessId() || \Permission::checkAccess($objCategory->getManageFilesAccessId(), 'dynamic', true) || $objCategory->getOwnerId() == $objFWUser->objUser->getId()) || $objDownload->getOwnerId() == $objFWUser->objUser->getId()) { $this->objTemplate->setVariable(array('TXT_DOWNLOADS_UNLINK' => $_ARRAYLANG['TXT_DOWNLOADS_UNLINK'], 'DOWNLOADS_DOWNLOAD_NAME_JS' => htmlspecialchars($objDownload->getName(), ENT_QUOTES, CONTREXX_CHARSET))); // parse delete icon $this->objTemplate->parse('downloads_download_function_unlink_link'); $this->objTemplate->hideBlock('downloads_download_function_no_unlink_link'); } else { // hide delete icon $this->objTemplate->touchBlock('downloads_download_function_no_unlink_link'); $this->objTemplate->hideBlock('downloads_download_function_unlink_link'); } $description = $objDownload->getDescription(); if (strlen($description) > 100) { $description = substr($description, 0, 97) . '...'; } $this->objTemplate->setVariable(array('DOWNLOADS_DOWNLOAD_ID' => $objDownload->getId(), 'DOWNLOADS_DOWNLOAD_NAME' => htmlentities($objDownload->getName(), ENT_QUOTES, CONTREXX_CHARSET), 'DOWNLOADS_DOWNLOAD_DESCRIPTION' => htmlentities($description, ENT_QUOTES, CONTREXX_CHARSET), 'DOWNLOADS_DOWNLOAD_OWNER' => $this->getParsedUsername($objDownload->getOwnerId()), 'DOWNLOADS_DOWNLOAD_DOWNLOADED' => $objDownload->getDownloadCount(), 'DOWNLOADS_DOWNLOAD_VIEWED' => $objDownload->getViewCount(), 'DOWNLOADS_DOWNLOAD_STATUS_LED' => $objDownload->getActiveStatus() ? 'led_green.gif' : 'led_red.gif', 'DOWNLOADS_DOWNLOAD_ROW_CLASS' => $nr++ % 2 ? 'row1' : 'row2')); $this->objTemplate->parse('downloads_download_list'); $objDownload->next(); } if ($downloadsAvailable && !empty($this->parentCategoryId)) { $this->objTemplate->setVariable('TXT_DOWNLOADS_OF_CATEGORY', sprintf($_ARRAYLANG['TXT_DOWNLOADS_DOWNLOADS_OF_CATEGORY'], '„' . htmlentities($objCategory->getName($_LANGID), ENT_QUOTES, CONTREXX_CHARSET) . '“')); } else { $this->objTemplate->setVariable('TXT_DOWNLOADS_ALL_DOWNLOADS', $_ARRAYLANG['TXT_DOWNLOADS_ALL_DOWNLOADS']); } if ($downloadsAvailable) { $this->objTemplate->setVariable(array('DOWNLOADS_CONFIRM_UNLINK_DOWNLOADS_TXT' => preg_replace('#\\n#', '\\n', addslashes($_ARRAYLANG['TXT_DOWNLOADS_CONFIRM_UNLINK_DOWNLOADS'])), 'TXT_SAVE_CHANGES_DOWNLOADS' => $_ARRAYLANG['TXT_SAVE_CHANGES'], 'TXT_DOWNLOADS_CHECK_ALL' => $_ARRAYLANG['TXT_DOWNLOADS_CHECK_ALL'], 'TXT_DOWNLOADS_UNCHECK_ALL' => $_ARRAYLANG['TXT_DOWNLOADS_UNCHECK_ALL'], 'TXT_DOWNLOADS_SELECT_ACTION' => $_ARRAYLANG['TXT_DOWNLOADS_SELECT_ACTION'], 'TXT_DOWNLOADS_ORDER' => $_ARRAYLANG['TXT_DOWNLOADS_ORDER'], 'TXT_DOWNLOADS_UNLINK_MULTI' => $_ARRAYLANG['TXT_DOWNLOADS_UNLINK_MULTI'])); $this->objTemplate->setVariable(array('TXT_DOWNLOADS_OWNER' => $_ARRAYLANG['TXT_DOWNLOADS_OWNER'], 'TXT_DOWNLOADS_FUNCTIONS' => $_ARRAYLANG['TXT_DOWNLOADS_FUNCTIONS'], 'DOWNLOADS_DOWNLOAD_CATEGORY_ID' => $objCategory->getId(), 'DOWNLOADS_DOWNLOAD_SORT_DIRECTION' => $downloadOrderDirection, 'DOWNLOADS_DOWNLOAD_SORT_BY' => $downloadOrderBy, 'DOWNLOADS_DOWNLOAD_SORT_ID' => $downloadOrderBy == 'id' && $downloadOrderDirection == 'asc' ? 'desc' : 'asc', 'DOWNLOADS_DOWNLOAD_SORT_STATUS' => $downloadOrderBy == 'is_active' && $downloadOrderDirection == 'asc' ? 'desc' : 'asc', 'DOWNLOADS_DOWNLOAD_SORT_ORDER' => $downloadOrderBy == 'order' && $downloadOrderDirection == 'asc' ? 'desc' : 'asc', 'DOWNLOADS_DOWNLOAD_SORT_NAME' => $downloadOrderBy == 'name' && $downloadOrderDirection == 'asc' ? 'desc' : 'asc', 'DOWNLOADS_DOWNLOAD_SORT_DESCRIPTION' => $downloadOrderBy == 'description' && $downloadOrderDirection == 'asc' ? 'desc' : 'asc', 'DOWNLOADS_DOWNLOAD_SORT_DOWNLOADED' => $downloadOrderBy == 'download_count' && $downloadOrderDirection == 'desc' ? 'asc' : 'desc', 'DOWNLOADS_DOWNLOAD_SORT_VIEWED' => $downloadOrderBy == 'views' && $downloadOrderDirection == 'desc' ? 'asc' : 'desc', 'DOWNLOADS_DOWNLOAD_SORT_ID_LABEL' => $_ARRAYLANG['TXT_DOWNLOADS_ID'] . ($downloadOrderBy == 'id' ? $downloadOrderDirection == 'asc' ? ' ↑' : ' ↓' : ''), 'DOWNLOADS_DOWNLOAD_SORT_STATUS_LABEL' => $_ARRAYLANG['TXT_DOWNLOADS_STATUS'] . ($downloadOrderBy == 'is_active' ? $downloadOrderDirection == 'asc' ? ' ↑' : ' ↓' : ''), 'DOWNLOADS_DOWNLOAD_SORT_ORDER_LABEL' => $_ARRAYLANG['TXT_DOWNLOADS_ORDER'] . ($downloadOrderBy == 'order' ? $downloadOrderDirection == 'asc' ? ' ↑' : ' ↓' : ''), 'DOWNLOADS_DOWNLOAD_SORT_NAME_LABEL' => $_ARRAYLANG['TXT_DOWNLOADS_NAME'] . ($downloadOrderBy == 'name' ? $downloadOrderDirection == 'asc' ? ' ↑' : ' ↓' : ''), 'DOWNLOADS_DOWNLOAD_SORT_DESCRIPTION_LABEL' => $_ARRAYLANG['TXT_DOWNLOADS_DESCRIPTION'] . ($downloadOrderBy == 'description' ? $downloadOrderDirection == 'asc' ? ' ↑' : ' ↓' : ''), 'DOWNLOADS_DOWNLOAD_SORT_DOWNLOADED_LABEL' => $_ARRAYLANG['TXT_DOWNLOADS_DOWNLOADED'] . ($downloadOrderBy == 'download_count' ? $downloadOrderDirection == 'asc' ? ' ↑' : ' ↓' : ''), 'DOWNLOADS_DOWNLOAD_SORT_VIEWED_LABEL' => $_ARRAYLANG['TXT_DOWNLOADS_VIEWED'] . ($downloadOrderBy == 'views' ? $downloadOrderDirection == 'asc' ? ' ↑' : ' ↓' : ''), 'DOWNLOADS_DOWNLOAD_CATEGORY_SORT' => $categoryOrderDirection, 'DOWNLOADS_DOWNLOAD_CATEGORY_BY' => $categoryOrderBy, 'DOWNLOADS_DOWNLOAD_CATEGORY_OFFSET' => $categoryLimitOffset)); // parse paging $downloadCount = $objDownload->getFilteredSearchDownloadCount(); if ($downloadCount > $_CONFIG['corePagingLimit']) { $pagingLink = "&cmd=Downloads&act=categories&parent_id=" . $objCategory->getId() . "&category_sort=" . htmlspecialchars($categoryOrderDirection) . "&category_by=" . htmlspecialchars($categoryOrderBy) . "&download_sort=" . htmlspecialchars($downloadOrderDirection) . "&download_by=" . htmlspecialchars($downloadOrderBy) . "&category_pos=" . $categoryLimitOffset; $this->objTemplate->setVariable('DOWNLOADS_DOWNLOAD_PAGING', getPaging($downloadCount, $downloadLimitOffset, $pagingLink, "<b>" . $_ARRAYLANG['TXT_DOWNLOADS_DOWNLOADS'] . "</b>") . '<br />'); } $this->objTemplate->hideBlock('downloads_no_data'); $this->objTemplate->parse('downloads_category_downloads'); $this->objTemplate->parse('downloads_download_action_dropdown'); } else { $this->objTemplate->hideBlock('downloads_category_downloads'); $this->objTemplate->hideBlock('downloads_download_action_dropdown'); $this->objTemplate->parse('downloads_no_data'); } }