本文整理汇总了PHP中Cx\Core\Html\Sigma::blockExists方法的典型用法代码示例。如果您正苦于以下问题:PHP Sigma::blockExists方法的具体用法?PHP Sigma::blockExists怎么用?PHP Sigma::blockExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cx\Core\Html\Sigma
的用法示例。
在下文中一共展示了Sigma::blockExists方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseNewsletterLists
/**
* 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');
}
}
}
示例2: renderTheme
/**
* Render the option in the frontend.
*
* @param Sigma $template
*/
public function renderTheme($template)
{
$blockName = strtolower('TEMPLATE_EDITOR_' . $this->name);
if ($template->blockExists($blockName) && $this->active) {
$template->touchBlock($blockName);
}
}
示例3: parseDownload
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();
}
示例4: showCategoryOverview
/**
* Show the list of categories
*/
function showCategoryOverview()
{
$arrCategories = $this->createCategoryArray();
$catTree = $this->buildCatTree($arrCategories);
$catList = $this->parseCategoryView($catTree, $arrCategories);
$this->_objTpl->setVariable("CATEGORIES", $catList);
if ($this->_objTpl->blockExists("showDataCategories")) {
$this->_objTpl->parse("showDataCategories");
}
}
示例5: showShipmentTerms
/**
* 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 <reto.kohli@comvation.com>
*/
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');
}
}
}
示例6: parseRelatedNews
/**
* Parsing the related News
*
* @global object $objDatabase
* @global type $_ARRAYLANG
*
* @param Object $objTpl Template Object
* @param Interger $newsId News Id
* @param Interger $langId Language id
* @param type $blockName Block Name
* @param type $limit Limit
*
* @return null
*/
public function parseRelatedNews(\Cx\Core\Html\Sigma $objTpl, $newsId = null, $langId = null, $blockName = 'related_news', $limit = 0)
{
global $_ARRAYLANG, $objDatabase;
if (empty($newsId) || !$objTpl->blockExists($blockName)) {
return;
}
//Getting the related news ids
$relatedNewsIds = $this->getRelatedNews($newsId);
$defaultLangId = \FWLanguage::getDefaultLangId();
//Getting the related news details for the given languages
$relatedNewsDetails = $this->getRelatedNewsDetails($relatedNewsIds, array($langId, $defaultLangId));
if (!empty($relatedNewsDetails)) {
$defaultImage = \Cx\Core\Core\Controller\Cx::instanciate()->getCodeBaseCoreModulePath() . '/News/View/Media/default_news_image.png';
$currentCount = 1;
foreach ($relatedNewsIds as $relatedNewsId) {
//If the limit is reached then the loop is stopped
if (!empty($limit) && $currentCount > $limit) {
break;
}
/*
* Checking the related news is available in the current
* acitve front-end language if not available then the default
* language details are getting used
* Comment/Uncomment the following line if this condition
* is required
*/
//$currentRelatedDetails = isset($relatedNewsDetails[$relatedNewsId][$langId])
// ? $relatedNewsDetails[$relatedNewsId][$langId]
// : $relatedNewsDetails[$relatedNewsId][$defaultLangId];
/*
* Checking the related news is available in the current
* acitve front-end language if not available then the related
* News not listed Comment/Uncomment the following
* line if this condition is required
*/
$currentRelatedDetails = isset($relatedNewsDetails[$relatedNewsId][$langId]) ? $relatedNewsDetails[$relatedNewsId][$langId] : false;
if (!$currentRelatedDetails) {
continue;
}
++$currentCount;
$categories = $this->getCategoriesByNewsId($relatedNewsId);
$newsUrl = empty($currentRelatedDetails['redirect']) ? empty($currentRelatedDetails['newscontent']) ? '' : \Cx\Core\Routing\Url::fromModuleAndCmd('news', $this->findCmdById('details', array_keys($categories)), FRONTEND_LANG_ID, array('newsid' => $relatedNewsId)) : $currentRelatedDetails['redirect'];
$newstitle = $currentRelatedDetails['title'];
$htmlLink = self::parseLink($newsUrl, $newstitle, contrexx_raw2xhtml('[' . $_ARRAYLANG['TXT_NEWS_MORE'] . '...]'));
$htmlLinkTitle = self::parseLink($newsUrl, $newstitle, contrexx_raw2xhtml($newstitle));
// in case that the message is a stub,
// we shall just display the news title instead of a html-a-tag
// with no href target
if (empty($htmlLinkTitle)) {
$htmlLinkTitle = contrexx_raw2xhtml($newstitle);
}
$imagePath = !empty($currentRelatedDetails['teaser_image_path']) ? $currentRelatedDetails['teaser_image_path'] : $defaultImage;
$imageThumbPath = !empty($currentRelatedDetails['teaser_image_thumbnail_path']) ? $currentRelatedDetails['teaser_image_thumbnail_path'] : $defaultImage;
$this->parseImageBlock($objTpl, $imagePath, $newstitle, $newsUrl, 'related_news_image');
$this->parseImageBlock($objTpl, $imageThumbPath, $newstitle, $newsUrl, 'related_news_image_thumb');
$author = \FWUser::getParsedUserTitle($currentRelatedDetails['author_id'], $currentRelatedDetails['author']);
$publisher = \FWUser::getParsedUserTitle($currentRelatedDetails['publisher_id'], $currentRelatedDetails['publisher']);
$objSubResult = $objDatabase->Execute('
SELECT count(`id`) AS `countComments`
FROM `' . DBPREFIX . 'module_news_comments`
WHERE `newsid` = ' . $relatedNewsId);
$objTpl->setVariable(array('NEWS_RELATED_NEWS_ID' => contrexx_raw2xhtml($relatedNewsId), 'NEWS_RELATED_NEWS_URL' => contrexx_raw2xhtml($newsUrl), 'NEWS_RELATED_NEWS_LINK' => $htmlLink, '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']), 'NEWS_RELATED_NEWS_TITLE_LINK' => $htmlLinkTitle, 'NEWS_RELATED_NEWS_TEXT' => $currentRelatedDetails['text'], 'NEWS_RELATED_NEWS_TEXT_SHORT' => strlen($currentRelatedDetails['text']) > 250 ? substr(strip_tags($currentRelatedDetails['text']), 0, 247) . '...' : strip_tags($currentRelatedDetails['text']), 'NEWS_RELATED_NEWS_TEASER_TEXT' => nl2br($currentRelatedDetails['teaser_text']), 'NEWS_RELATED_NEWS_AUTHOR' => contrexx_raw2xhtml($author), 'NEWS_RELATED_NEWS_PUBLISHER' => contrexx_raw2xhtml($publisher), 'NEWS_RELATED_NEWS_CATEGORY_NAMES' => implode(', ', contrexx_raw2xhtml($categories)), 'NEWS_RELATED_NEWS_LONG_DATE' => date(ASCMS_DATE_FORMAT, $currentRelatedDetails['newsdate']), 'NEWS_RELATED_NEWS_DATE' => date(ASCMS_DATE_FORMAT_DATE, $currentRelatedDetails['newsdate']), 'NEWS_RELATED_NEWS_TIME' => date(ASCMS_DATE_FORMAT_TIME, $currentRelatedDetails['newsdate']), 'NEWS_RELATED_NEWS_COUNT_COMMENTS' => $currentRelatedDetails['commentactive'] && $this->arrSettings['news_comments_activated'] ? contrexx_raw2xhtml($objSubResult->fields['countComments'] . ' ' . $_ARRAYLANG['TXT_NEWS_COMMENTS']) : ''));
if (!$objSubResult->fields['countComments'] || !$this->arrSettings['news_comments_activated']) {
if ($objTpl->blockExists('related_news_comments_count')) {
$objTpl->hideBlock('related_news_comments_count');
}
}
if ($this->arrSettings['news_use_teaser_text'] != '1' && $objTpl->blockExists('news_use_teaser_text')) {
$objTpl->hideBlock('news_use_teaser_text');
}
$objTpl->parse($blockName);
}
if ($objTpl->blockExists('related_news_block')) {
$objTpl->setVariable('TXT_NEWS_RELATED_NEWS', $_ARRAYLANG['TXT_NEWS_RELATED_NEWS']);
$objTpl->touchBlock('related_news_block');
}
}
}
示例7: die
/**
* Adds an external settings view to the current template
*
* The content must contain the full view, including the surrounding form
* tags and submit button.
* Note that these are always appended on the right end of the tab list.
* @param \Cx\Core\Html\Sigma $objTemplateLocal Template object
* @param string $tab_name The tab name to add
* @param string $content The external content
* @return boolean True on success
*/
static function show_external(&$objTemplateLocal, $tab_name, $content)
{
if (empty($objTemplateLocal) || !$objTemplateLocal->blockExists('core_setting_row')) {
$objTemplateLocal = new \Cx\Core\Html\Sigma(\Env::get('cx')->getCodeBaseDocumentRootPath() . '/core/Setting/View/Template/Generic');
if (!$objTemplateLocal->loadTemplateFile('Form.html')) {
die("Failed to load template Form.html");
}
}
$active_tab = isset($_REQUEST['active_tab']) ? $_REQUEST['active_tab'] : 1;
// The tabindex must be set in the form name in any case
$objTemplateLocal->setGlobalVariable(array('CORE_SETTING_TAB_INDEX' => self::$tab_index, 'CORE_SETTING_EXTERNAL' => $content));
// Set up the tab, if any
if (!empty($tab_name)) {
$objTemplateLocal->setGlobalVariable(array('CORE_SETTING_TAB_NAME' => $tab_name, 'CORE_SETTING_TAB_INDEX' => self::$tab_index, 'CORE_SETTING_TAB_CLASS' => self::$tab_index == $active_tab ? 'active' : '', 'CORE_SETTING_TAB_DISPLAY' => self::$tab_index++ == $active_tab ? 'block' : 'none', 'CORE_SETTING_CURRENT_TAB' => 'tab-' . $active_tab));
$objTemplateLocal->touchBlock('core_setting_tab_row');
$objTemplateLocal->parse('core_setting_tab_row');
$objTemplateLocal->touchBlock('core_setting_tab_div_external');
$objTemplateLocal->parse('core_setting_tab_div_external');
}
return true;
}
示例8: show_frontend
/**
* 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;
}
示例9: showNews
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']);
//.........这里部分代码省略.........
示例10: intval
/**
* Set up the detail view of the selected order
* @access public
* @param \Cx\Core\Html\Sigma $objTemplate The Template, by reference
* @param boolean $edit Edit if true, view otherwise
* @global ADONewConnection $objDatabase Database connection object
* @global array $_ARRAYLANG Language array
* @return boolean True on success,
* false otherwise
* @static
* @author Reto Kohli <reto.kohli@comvation.com> (parts)
* @version 3.1.0
*/
static function view_detail(&$objTemplate = null, $edit = false)
{
global $objDatabase, $_ARRAYLANG, $objInit;
$backend = $objInit->mode == 'backend';
if ($objTemplate->blockExists('order_list')) {
$objTemplate->hideBlock('order_list');
}
$have_option = false;
// The order total -- in the currency chosen by the customer
$order_sum = 0;
// recalculated VAT total
$total_vat_amount = 0;
$order_id = intval($_REQUEST['order_id']);
if (!$order_id) {
return \Message::error($_ARRAYLANG['TXT_SHOP_ORDER_ERROR_INVALID_ORDER_ID']);
}
if (!$objTemplate) {
$template_name = $edit ? 'module_shop_order_edit.html' : 'module_shop_order_details.html';
$objTemplate = new \Cx\Core\Html\Sigma(\Cx\Core\Core\Controller\Cx::instanciate()->getCodeBaseModulePath() . '/Shop/View/Template/Backend');
//DBG::log("Orders::view_list(): new Template: ".$objTemplate->get());
$objTemplate->loadTemplateFile($template_name);
//DBG::log("Orders::view_list(): loaded Template: ".$objTemplate->get());
}
$objOrder = Order::getById($order_id);
if (!$objOrder) {
//DBG::log("Shop::shopShowOrderdetails(): Failed to find Order ID $order_id");
return \Message::error(sprintf($_ARRAYLANG['TXT_SHOP_ORDER_NOT_FOUND'], $order_id));
}
// lsv data
$query = "\n SELECT `holder`, `bank`, `blz`\n FROM " . DBPREFIX . "module_shop" . MODULE_INDEX . "_lsv\n WHERE order_id={$order_id}";
$objResult = $objDatabase->Execute($query);
if (!$objResult) {
return self::errorHandler();
}
if ($objResult->RecordCount() == 1) {
$objTemplate->setVariable(array('SHOP_ACCOUNT_HOLDER' => contrexx_raw2xhtml($objResult->fields['holder']), 'SHOP_ACCOUNT_BANK' => contrexx_raw2xhtml($objResult->fields['bank']), 'SHOP_ACCOUNT_BLZ' => contrexx_raw2xhtml($objResult->fields['blz'])));
}
$customer_id = $objOrder->customer_id();
if (!$customer_id) {
//DBG::log("Shop::shopShowOrderdetails(): Invalid Customer ID $customer_id");
\Message::error(sprintf($_ARRAYLANG['TXT_SHOP_INVALID_CUSTOMER_ID'], $customer_id));
}
$objCustomer = Customer::getById($customer_id);
if (!$objCustomer) {
//DBG::log("Shop::shopShowOrderdetails(): Failed to find Customer ID $customer_id");
\Message::error(sprintf($_ARRAYLANG['TXT_SHOP_CUSTOMER_NOT_FOUND'], $customer_id));
$objCustomer = new Customer();
// No editing allowed!
$have_option = true;
}
Vat::is_reseller($objCustomer->is_reseller());
Vat::is_home_country(\Cx\Core\Setting\Controller\Setting::getValue('country_id', 'Shop') == $objOrder->country_id());
$objTemplate->setGlobalVariable($_ARRAYLANG + array('SHOP_CURRENCY' => Currency::getCurrencySymbolById($objOrder->currency_id())));
//DBG::log("Order sum: ".Currency::formatPrice($objOrder->sum()));
$objTemplate->setVariable(array('SHOP_CUSTOMER_ID' => $customer_id, 'SHOP_ORDERID' => $order_id, 'SHOP_DATE' => date(ASCMS_DATE_FORMAT_INTERNATIONAL_DATETIME, strtotime($objOrder->date_time())), 'SHOP_ORDER_STATUS' => $edit ? Orders::getStatusMenu($objOrder->status(), false, null, 'swapSendToStatus(this.value)') : $_ARRAYLANG['TXT_SHOP_ORDER_STATUS_' . $objOrder->status()], 'SHOP_SEND_MAIL_STYLE' => $objOrder->status() == Order::STATUS_CONFIRMED ? 'display: inline;' : 'display: none;', 'SHOP_SEND_MAIL_STATUS' => $edit ? $objOrder->status() != Order::STATUS_CONFIRMED ? \Html::ATTRIBUTE_CHECKED : '' : '', 'SHOP_ORDER_SUM' => Currency::formatPrice($objOrder->sum()), 'SHOP_DEFAULT_CURRENCY' => Currency::getDefaultCurrencySymbol(), 'SHOP_GENDER' => $edit ? Customer::getGenderMenu($objOrder->billing_gender(), 'billing_gender') : $_ARRAYLANG['TXT_SHOP_' . strtoupper($objOrder->billing_gender())], 'SHOP_COMPANY' => $objOrder->billing_company(), 'SHOP_FIRSTNAME' => $objOrder->billing_firstname(), 'SHOP_LASTNAME' => $objOrder->billing_lastname(), 'SHOP_ADDRESS' => $objOrder->billing_address(), 'SHOP_ZIP' => $objOrder->billing_zip(), 'SHOP_CITY' => $objOrder->billing_city(), 'SHOP_COUNTRY' => $edit ? \Cx\Core\Country\Controller\Country::getMenu('billing_country_id', $objOrder->billing_country_id()) : \Cx\Core\Country\Controller\Country::getNameById($objOrder->billing_country_id()), 'SHOP_PHONE' => $objOrder->billing_phone(), 'SHOP_FAX' => $objOrder->billing_fax(), 'SHOP_EMAIL' => $objOrder->billing_email(), 'SHOP_SHIP_GENDER' => $edit ? Customer::getGenderMenu($objOrder->gender(), 'shipPrefix') : $_ARRAYLANG['TXT_SHOP_' . strtoupper($objOrder->gender())], 'SHOP_SHIP_COMPANY' => $objOrder->company(), 'SHOP_SHIP_FIRSTNAME' => $objOrder->firstname(), 'SHOP_SHIP_LASTNAME' => $objOrder->lastname(), 'SHOP_SHIP_ADDRESS' => $objOrder->address(), 'SHOP_SHIP_ZIP' => $objOrder->zip(), 'SHOP_SHIP_CITY' => $objOrder->city(), 'SHOP_SHIP_COUNTRY' => $edit ? \Cx\Core\Country\Controller\Country::getMenu('shipCountry', $objOrder->country_id()) : \Cx\Core\Country\Controller\Country::getNameById($objOrder->country_id()), 'SHOP_SHIP_PHONE' => $objOrder->phone(), 'SHOP_PAYMENTTYPE' => Payment::getProperty($objOrder->payment_id(), 'name'), 'SHOP_CUSTOMER_NOTE' => $objOrder->note(), 'SHOP_COMPANY_NOTE' => $objCustomer->companynote(), 'SHOP_SHIPPING_TYPE' => $objOrder->shipment_id() ? Shipment::getShipperName($objOrder->shipment_id()) : ' '));
if ($backend) {
$objTemplate->setVariable(array('SHOP_CUSTOMER_IP' => $objOrder->ip() ? '<a href="index.php?cmd=NetTools&tpl=whois&address=' . $objOrder->ip() . '" title="' . $_ARRAYLANG['TXT_SHOW_DETAILS'] . '">' . $objOrder->ip() . '</a>' : ' ', 'SHOP_CUSTOMER_HOST' => $objOrder->host() ? '<a href="index.php?cmd=NetTools&tpl=whois&address=' . $objOrder->host() . '" title="' . $_ARRAYLANG['TXT_SHOW_DETAILS'] . '">' . $objOrder->host() . '</a>' : ' ', 'SHOP_CUSTOMER_LANG' => \FWLanguage::getLanguageParameter($objOrder->lang_id(), 'name'), 'SHOP_CUSTOMER_BROWSER' => $objOrder->browser() ? $objOrder->browser() : ' ', 'SHOP_LAST_MODIFIED' => $objOrder->modified_on() && $objOrder->modified_on() != '0000-00-00 00:00:00' ? $objOrder->modified_on() . ' ' . $_ARRAYLANG['TXT_EDITED_BY'] . ' ' . $objOrder->modified_by() : $_ARRAYLANG['TXT_ORDER_WASNT_YET_EDITED']));
} else {
// Frontend: Order history ONLY. Repeat the Order, go to cart
$objTemplate->setVariable(array('SHOP_ACTION_URI_ENCODED' => \Cx\Core\Routing\Url::fromModuleAndCmd('Shop', 'cart')));
}
$ppName = '';
$psp_id = Payment::getPaymentProcessorId($objOrder->payment_id());
if ($psp_id) {
$ppName = PaymentProcessing::getPaymentProcessorName($psp_id);
}
$objTemplate->setVariable(array('SHOP_SHIPPING_PRICE' => $objOrder->shipment_amount(), 'SHOP_PAYMENT_PRICE' => $objOrder->payment_amount(), 'SHOP_PAYMENT_HANDLER' => $ppName, 'SHOP_LAST_MODIFIED_DATE' => $objOrder->modified_on()));
if ($edit) {
// edit order
$strJsArrShipment = Shipment::getJSArrays();
$objTemplate->setVariable(array('SHOP_SEND_TEMPLATE_TO_CUSTOMER' => sprintf($_ARRAYLANG['TXT_SEND_TEMPLATE_TO_CUSTOMER'], $_ARRAYLANG['TXT_ORDER_COMPLETE']), 'SHOP_SHIPPING_TYP_MENU' => Shipment::getShipperMenu($objOrder->country_id(), $objOrder->shipment_id(), "calcPrice(0);"), 'SHOP_JS_ARR_SHIPMENT' => $strJsArrShipment, 'SHOP_PRODUCT_IDS_MENU_NEW' => Products::getMenuoptions(null, null, $_ARRAYLANG['TXT_SHOP_PRODUCT_MENU_FORMAT']), 'SHOP_JS_ARR_PRODUCT' => Products::getJavascriptArray($objCustomer->group_id(), $objCustomer->is_reseller())));
}
$options = $objOrder->getOptionArray();
if (!empty($options[$order_id])) {
$have_option = true;
}
// Order items
$total_weight = $i = 0;
$total_net_price = $objOrder->view_items($objTemplate, $edit, $total_weight, $i);
// Show VAT with the individual products:
// If VAT is enabled, and we're both in the same country
// ($total_vat_amount has been set above if both conditions are met)
// show the VAT rate.
// If there is no VAT, the amount is 0 (zero).
//if ($total_vat_amount) {
// distinguish between included VAT, and additional VAT added to sum
$tax_part_percentaged = Vat::isIncluded() ? $_ARRAYLANG['TXT_TAX_PREFIX_INCL'] : $_ARRAYLANG['TXT_TAX_PREFIX_EXCL'];
//.........这里部分代码省略.........
示例11: parseRegistrationPlaceholders
/**
* 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');
}
示例12: view
/**
* 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()));
}
//.........这里部分代码省略.........
示例13: renderTheme
/**
* 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);
}
}
}
示例14: finalize
/**
* 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();
//.........这里部分代码省略.........
示例15: intval
//.........这里部分代码省略.........
foreach ($keys1 as $key) {
$keys[$key] = $_ARRAYLANG[$key];
}
array_walk($keys, array(&$this, 'arrStrToLower'));
$searchterm = contrexx_addslashes($_REQUEST['search']);
if (!empty($searchterm) && strlen($searchterm) <= 3) {
$this->_objTpl->setVariable("TXT_IMMO_SEARCHTERM_TOO_SHORT", $_ARRAYLANG['TXT_IMMO_SEARCHTERM_TOO_SHORT']);
return false;
}
$query = " SELECT immo.id AS `immo_id`, immo.reference AS `reference`, immo.object_type AS otype, immo.new_building AS `new`, immo.property_type AS ptype, logo,\n a.fieldvalue as headline,\n CAST(b.fieldvalue AS UNSIGNED) as price,\n c.fieldvalue as header,\n d.fieldvalue as location,\n e.fieldvalue as rooms,\n f.fieldvalue as foreigner_authorization,\n g.fieldvalue as address,\n img.uri AS imgsrc\n FROM " . DBPREFIX . "module_immo AS immo";
if (!empty($searchterm)) {
$query .= " LEFT JOIN " . DBPREFIX . "module_immo_content AS content on ( content.immo_id = immo.id ) ";
}
$query .= " LEFT JOIN " . DBPREFIX . "module_immo_content AS a ON ( immo.id = a.immo_id\n AND a.field_id = (\n SELECT field_id\n FROM " . DBPREFIX . "module_immo_fieldname\n WHERE name = 'headline'\n AND lang_id = 1 )\n AND a.lang_id = " . $this->frontLang . " )\n LEFT JOIN " . DBPREFIX . "module_immo_content AS b ON ( immo.id = b.immo_id\n AND b.field_id = (\n SELECT field_id\n FROM " . DBPREFIX . "module_immo_fieldname\n WHERE name = 'preis'\n AND lang_id = 1 )\n AND b.lang_id = " . $this->frontLang . " )\n LEFT JOIN " . DBPREFIX . "module_immo_content AS c ON ( immo.id = c.immo_id\n AND c.field_id = (\n SELECT field_id\n FROM " . DBPREFIX . "module_immo_fieldname\n WHERE name = 'kopfzeile'\n AND lang_id = 1 )\n AND c.lang_id = " . $this->frontLang . " )\n LEFT JOIN " . DBPREFIX . "module_immo_content AS d ON ( immo.id = d.immo_id\n AND d.field_id = (\n SELECT field_id\n FROM " . DBPREFIX . "module_immo_fieldname\n WHERE name = 'ort'\n AND lang_id = 1 )\n AND d.lang_id = " . $this->frontLang . " )\n LEFT JOIN " . DBPREFIX . "module_immo_content AS e ON ( immo.id = e.immo_id\n AND e.field_id = (\n SELECT field_id\n FROM " . DBPREFIX . "module_immo_fieldname\n WHERE name = 'anzahl zimmer'\n AND lang_id = 1 )\n AND e.lang_id = " . $this->frontLang . " )\n LEFT JOIN " . DBPREFIX . "module_immo_content AS f ON ( immo.id = f.immo_id\n AND f.field_id = (\n SELECT field_id\n FROM " . DBPREFIX . "module_immo_fieldname\n WHERE name = 'ausl�nder-bewilligung'\n AND lang_id = 1 )\n AND f.lang_id = " . $this->frontLang . " )\n LEFT JOIN " . DBPREFIX . "module_immo_content AS g ON ( immo.id = g.immo_id\n AND g.field_id = (\n SELECT field_id\n FROM " . DBPREFIX . "module_immo_fieldname\n WHERE name = 'adresse'\n AND lang_id = 1 )\n AND g.lang_id = " . $this->frontLang . " )\n LEFT JOIN " . DBPREFIX . "module_immo_image AS img ON ( immo.id = img.immo_id\n AND img.field_id = (\n SELECT field_id\n FROM " . DBPREFIX . "module_immo_fieldname\n WHERE name = 'übersichtsbild' )\n )\n WHERE TRUE\n ";
if (!empty($searchterm)) {
$query .= " AND content.fieldvalue LIKE '%" . $searchterm . "%' ";
}
$query .= " AND immo.visibility != 'disabled' ";
if (!intval($_REQUEST['refnr'])) {
$query .= " AND immo.visibility != 'reference' ";
}
if (!empty($locations) || !empty($obj_type) || !empty($property_type)) {
if (!empty($locations)) {
$query .= " AND d.fieldvalue = '" . $locations . "'";
}
if (!empty($property_type)) {
$query .= " AND immo.property_type = '" . $property_type . "'";
}
if (!empty($obj_type)) {
$query .= " AND immo.object_type = '" . $obj_type . "'";
}
if (!empty($new_building)) {
$query .= " AND immo.new_building = '" . $new_building . "'";
}
if (!empty($foreigner_auth)) {
//max rooms
$query .= " AND f.fieldvalue = '" . $foreigner_auth . "' ";
}
if (!empty($fprice)) {
//min price
$query .= " AND b.fieldvalue >= " . $fprice . " ";
}
if (!empty($tprice)) {
//max price
$query .= " AND b.fieldvalue <= " . $tprice . " ";
}
if (!empty($frooms)) {
//min rooms
$query .= " AND e.fieldvalue >= '" . $frooms . "' ";
}
if (!empty($trooms)) {
//max rooms
$query .= " AND e.fieldvalue <= '" . $trooms . "' ";
}
if (!empty($logo)) {
//max rooms
$query .= " AND logo = '" . $logo . "' ";
}
$query .= ' GROUP BY immo.id ORDER BY ' . $orderBy . ' ASC';
}
} elseif (!empty($_REQUEST['ref_nr'])) {
//advanced search
$orderBy = !empty($_REQUEST['order_by']) ? contrexx_addslashes($_REQUEST['order_by']) : 'immo.id';
$refnr = intval($_REQUEST['ref_nr']);
$query .= ' AND reference = ' . $refnr . " GROUP BY immo.id ORDER BY {$orderBy} ASC";
}
//else { //no where clause => show all }
$objRS = $objDatabase->Execute($query);
if (!$objRS) {
echo "DB error. file: " . __FILE__ . " line: " . __LINE__;
return false;
}
if ($objRS->RecordCount() == 0) {
if ($this->_objTpl->blockExists("no_results")) {
$this->_objTpl->touchBlock("no_results");
$this->_objTpl->parse("no_results");
}
return false;
}
while (!$objRS->EOF) {
$imgdim = '';
$img = $objRS->fields['imgsrc'];
$imgdim = $this->_getImageDim($img, 80);
$this->_objTpl->setVariable(array('IMMO_HEADER' => $objRS->fields['header'], 'IMMO_LOCATION' => $objRS->fields['location'], 'IMMO_PRICE' => $objRS->fields['price'], 'IMMO_REF_NR' => $objRS->fields['reference'], 'IMMO_HEADLINE' => $objRS->fields['headline'], 'IMMO_IMG_PREVIEW_DIM' => $imgdim[0], 'IMMO_IMG_PREVIEW_SRC' => $img, 'IMMO_ID' => $objRS->fields['immo_id']));
if (!empty($objRS->fields['imgsrc'])) {
$this->_objTpl->parse("previewImage");
} else {
$this->_objTpl->hideBlock("previewImage");
}
$this->_objTpl->setVariable('IMMO_HEADER', $objRS->fields['header']);
$this->_objTpl->parse("objectRow");
$objRS->MoveNext();
}
// TODO: Never used
// $limit = $_CONFIG['corePagingLimit'];
$count = '';
$pos = intval($_GET['pos']);
$this->_objTpl->setVariable('IMMO_PAGING', getPaging($count, $pos, '&search=' . $_REQUEST['search'], '', true));
return true;
}