本文整理汇总了PHP中Cx\Core\Html\Sigma::touchBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP Sigma::touchBlock方法的具体用法?PHP Sigma::touchBlock怎么用?PHP Sigma::touchBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cx\Core\Html\Sigma
的用法示例。
在下文中一共展示了Sigma::touchBlock方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
示例2: 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');
}
}
}
示例3: parseSpecialDownloads
private function parseSpecialDownloads($arrBlocks, $arrFilter, $arrSort, $limit)
{
global $_ARRAYLANG;
if (!$this->objTemplate->blockExists($arrBlocks[0])) {
return;
}
$objDownload = new Download();
$objDownload->loadDownloads($arrFilter, null, $arrSort, null, $limit);
if ($objDownload->EOF) {
$this->objTemplate->hideBlock($arrBlocks[0]);
} else {
$row = 1;
while (!$objDownload->EOF) {
// select category
$arrAssociatedCategories = $objDownload->getAssociatedCategoryIds();
$categoryId = $arrAssociatedCategories[0];
// parse download info
$this->parseDownloadAttributes($objDownload, $categoryId);
$this->objTemplate->setVariable('DOWNLOADS_FILE_ROW_CLASS', 'row' . ($row++ % 2 + 1));
$this->objTemplate->parse($arrBlocks[1]);
$objDownload->next();
}
$this->objTemplate->setVariable(array('TXT_DOWNLOADS_MOST_VIEWED' => $_ARRAYLANG['TXT_DOWNLOADS_MOST_VIEWED'], 'TXT_DOWNLOADS_MOST_DOWNLOADED' => $_ARRAYLANG['TXT_DOWNLOADS_MOST_DOWNLOADED'], 'TXT_DOWNLOADS_NEW_DOWNLOADS' => $_ARRAYLANG['TXT_DOWNLOADS_NEW_DOWNLOADS'], 'TXT_DOWNLOADS_RECENTLY_UPDATED' => $_ARRAYLANG['TXT_DOWNLOADS_RECENTLY_UPDATED']));
$this->objTemplate->touchBlock($arrBlocks[0]);
}
}
示例4: count
/**
* 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 <reto.kohli@comvation.com>
*/
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;
}
示例5: intval
function _newsMLDetails()
{
global $_ARRAYLANG, $_CONFIG;
if (isset($_REQUEST['providerId']) && isset($this->_objNewsML->arrCategories[$_REQUEST['providerId']])) {
$paging = "";
$providerId = intval($_REQUEST['providerId']);
$this->pageTitle = 'NewsML';
$this->_objTpl->loadTemplateFile('module_feed_newsml_details.html');
$this->_objTpl->setVariable('FEED_NEWSML_TITLE', str_replace('%NAME%', $this->_objNewsML->arrCategories[$providerId]['name'], $_ARRAYLANG['TXT_FEED_NEWS_MSG_OF']));
$this->_objNewsML->readDocuments($providerId);
$arrNewsMLDocuments = $this->_objNewsML->getDocuments($providerId);
if (count($arrNewsMLDocuments) > 0) {
$rowNr = 0;
if (count($arrNewsMLDocuments) > intval($_CONFIG['corePagingLimit'])) {
if (isset($_GET['pos'])) {
$pos = intval($_GET['pos']);
} else {
$pos = 0;
}
$paging = $_ARRAYLANG['TXT_FEED_NEWS_MESSAGES'] . ' ' . getPaging(count($arrNewsMLDocuments), $pos, "&cmd=Feed&act=newsML&tpl=details&providerId=" . $providerId, $_ARRAYLANG['TXT_NEWS_MESSAGES'], true);
} else {
$pos = 0;
}
$this->_objTpl->setVariable(array('TXT_FEED_MARKED' => $_ARRAYLANG['TXT_FEED_MARKED'], 'TXT_FEED_MARK_ALL' => $_ARRAYLANG['TXT_FEED_MARK_ALL'], 'TXT_FEED_REMOVE_CHOICE' => $_ARRAYLANG['TXT_FEED_REMOVE_CHOICE'], 'TXT_FEED_DELETE_MARKED' => $_ARRAYLANG['TXT_FEED_DELETE_MARKED'], 'TXT_FEED_BACK' => $_ARRAYLANG['TXT_FEED_BACK'], 'TXT_FEED_TITLE' => $_ARRAYLANG['TXT_FEED_TITLE'], 'TXT_FEED_DATE' => $_ARRAYLANG['TXT_FEED_DATE'], 'TXT_FEED_FUNCTIONS' => $_ARRAYLANG['TXT_FEED_FUNCTIONS'], 'TXT_FEED_ACTION_COULD_NOT_BE_UNDONE' => $_ARRAYLANG['TXT_FEED_ACTION_COULD_NOT_BE_UNDONE'], 'TXT_CONFIRM_DELETE_NEWS_MSG' => $_ARRAYLANG['TXT_CONFIRM_DELETE_NEWS_MSG'], 'TXT_CONFIRM_DELETE_NEWS_MSGS' => $_ARRAYLANG['TXT_CONFIRM_DELETE_NEWS_MSGS']));
$this->_objTpl->setGlobalVariable(array('FEED_NEWSML_PROVIDERID' => $providerId, 'TXT_FEED_SHOW_NEWS_MSG' => $_ARRAYLANG['TXT_FEED_SHOW_NEWS_MSG'], 'TXT_FEED_DELETE_NEWS_MSG' => $_ARRAYLANG['TXT_FEED_DELETE_NEWS_MSG']));
foreach ($arrNewsMLDocuments as $newsMLDocumentId => $arrNewsMLDocument) {
if ($rowNr >= $pos && $rowNr < $pos + intval($_CONFIG['corePagingLimit'])) {
$this->_objTpl->setVariable(array('FEED_NEWSML_ID' => $newsMLDocumentId, 'FEED_NEWSML_CATID' => $providerId, 'FEED_NEWSML_LIST_ROW_CLASS' => $rowNr % 2 == 0 ? "row2" : "row1", 'FEED_NEWSML_TITLE' => $arrNewsMLDocument['headLine'], 'FEED_NEWSML_DATE' => date(ASCMS_DATE_FORMAT, $arrNewsMLDocument['thisRevisionDate']), 'FEED_NEWSML_RANK' => $arrNewsMLDocument['urgency']));
$this->_objTpl->parse('feed_newsml_list');
}
$rowNr++;
}
$this->_objTpl->touchBlock('feed_newsml_data');
$this->_objTpl->hideBlock('feed_newsml_nodata');
} else {
$this->_objTpl->setVariable(array('TXT_FEED_NO_NEWS_MSGS_PRESENT' => $_ARRAYLANG['TXT_FEED_NO_NEWS_MSGS_PRESENT'], 'TXT_FEED_BACK' => $_ARRAYLANG['TXT_FEED_BACK']));
$this->_objTpl->touchBlock('feed_newsml_nodata');
$this->_objTpl->hideBlock('feed_newsml_data');
}
$this->_objTpl->setVariable('FEED_NEWSML_LIST_PARSING', $paging);
} else {
$this->_newsMLOverview();
}
}
示例6: while
/**
* Shows the form for entering the e-mail address
*
* After a valid address has been posted back, creates a new password
* and sends it to the Customer.
* Fails if changing or sending the password fails, and when the
* form isn't posted (i.e. on first loading the page).
* Returns true only after the new password has been sent successfully.
* @return boolean True on success, false otherwise
*/
static function view_sendpass()
{
global $_ARRAYLANG;
while (isset($_POST['shopEmail'])) {
$email = contrexx_input2raw($_POST['shopEmail']);
$password = \User::make_password();
if (!Customer::updatePassword($email, $password)) {
\Message::error($_ARRAYLANG['TXT_SHOP_UNABLE_SET_NEW_PASSWORD']);
break;
}
if (!self::sendLogin($email, $password)) {
\Message::error($_ARRAYLANG['TXT_SHOP_UNABLE_TO_SEND_EMAIL']);
break;
}
return \Message::ok($_ARRAYLANG['TXT_SHOP_ACCOUNT_DETAILS_SENT_SUCCESSFULLY']);
}
self::$objTemplate->setGlobalVariable($_ARRAYLANG);
self::$objTemplate->touchBlock('shop_sendpass');
return false;
}
示例7: parseCurrentNavItem
/**
* 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');
}
示例8: parseDownloadAttributes
private function parseDownloadAttributes($objDownload, $categoryId, $allowDeleteFilesFromCategory = false)
{
global $_ARRAYLANG, $_LANGID;
$description = $objDownload->getDescription($_LANGID);
if (strlen($description) > 100) {
$shortDescription = substr($description, 0, 97) . '...';
} else {
$shortDescription = $description;
}
$imageSrc = $objDownload->getImage();
if (!empty($imageSrc) && file_exists(\Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteDocumentRootPath() . '/' . $imageSrc)) {
$thumb_name = \ImageManager::getThumbnailFilename($imageSrc);
if (file_exists(\Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteDocumentRootPath() . '/' . $thumb_name)) {
$thumbnailSrc = $thumb_name;
} else {
$thumbnailSrc = \ImageManager::getThumbnailFilename($this->defaultCategoryImage['src']);
}
$imageSrc = contrexx_raw2encodedUrl($imageSrc);
$thumbnailSrc = contrexx_raw2encodedUrl($thumbnailSrc);
$image = $this->getHtmlImageTag($imageSrc, htmlentities($objDownload->getName($_LANGID), ENT_QUOTES, CONTREXX_CHARSET));
$thumbnail = $this->getHtmlImageTag($thumbnailSrc, htmlentities($objDownload->getName($_LANGID), ENT_QUOTES, CONTREXX_CHARSET));
} else {
$imageSrc = contrexx_raw2encodedUrl($this->defaultCategoryImage['src']);
$thumbnailSrc = contrexx_raw2encodedUrl(\ImageManager::getThumbnailFilename($this->defaultCategoryImage['src']));
$image = $this->getHtmlImageTag($this->defaultCategoryImage['src'], htmlentities($objDownload->getName($_LANGID), ENT_QUOTES, CONTREXX_CHARSET));
$thumbnail = $this->getHtmlImageTag(\ImageManager::getThumbnailFilename($this->defaultCategoryImage['src']), htmlentities($objDownload->getName($_LANGID), ENT_QUOTES, CONTREXX_CHARSET));
}
// parse delete icon link
if ($allowDeleteFilesFromCategory || $this->userId && $objDownload->getOwnerId() == $this->userId) {
$deleteIcon = $this->getHtmlDeleteLinkIcon($objDownload->getId(), htmlspecialchars(str_replace("'", "\\'", $objDownload->getName($_LANGID)), ENT_QUOTES, CONTREXX_CHARSET), 'downloadsDeleteFile');
} else {
$deleteIcon = '';
}
$this->objTemplate->setVariable(array('TXT_DOWNLOADS_DOWNLOAD' => $_ARRAYLANG['TXT_DOWNLOADS_DOWNLOAD'], 'TXT_DOWNLOADS_ADDED_BY' => $_ARRAYLANG['TXT_DOWNLOADS_ADDED_BY'], 'TXT_DOWNLOADS_LAST_UPDATED' => $_ARRAYLANG['TXT_DOWNLOADS_LAST_UPDATED'], 'TXT_DOWNLOADS_DOWNLOADED' => $_ARRAYLANG['TXT_DOWNLOADS_DOWNLOADED'], 'TXT_DOWNLOADS_VIEWED' => $_ARRAYLANG['TXT_DOWNLOADS_VIEWED'], 'DOWNLOADS_FILE_ID' => $objDownload->getId(), 'DOWNLOADS_FILE_DETAIL_SRC' => CONTREXX_SCRIPT_PATH . $this->moduleParamsHtml . '&category=' . $categoryId . '&id=' . $objDownload->getId(), 'DOWNLOADS_FILE_NAME' => htmlentities($objDownload->getName($_LANGID), ENT_QUOTES, CONTREXX_CHARSET), 'DOWNLOADS_FILE_DESCRIPTION' => nl2br(htmlentities($description, ENT_QUOTES, CONTREXX_CHARSET)), 'DOWNLOADS_FILE_SHORT_DESCRIPTION' => htmlentities($shortDescription, ENT_QUOTES, CONTREXX_CHARSET), 'DOWNLOADS_FILE_IMAGE' => $image, 'DOWNLOADS_FILE_IMAGE_SRC' => $imageSrc, 'DOWNLOADS_FILE_THUMBNAIL' => $thumbnail, 'DOWNLOADS_FILE_THUMBNAIL_SRC' => $thumbnailSrc, 'DOWNLOADS_FILE_ICON' => $this->getHtmlImageTag($objDownload->getIcon(), htmlentities($objDownload->getName($_LANGID), ENT_QUOTES, CONTREXX_CHARSET)), 'DOWNLOADS_FILE_FILE_TYPE_ICON' => $this->getHtmlImageTag($objDownload->getFileIcon(), htmlentities($objDownload->getName($_LANGID), ENT_QUOTES, CONTREXX_CHARSET)), 'DOWNLOADS_FILE_DELETE_ICON' => $deleteIcon, 'DOWNLOADS_FILE_DOWNLOAD_LINK_SRC' => CONTREXX_SCRIPT_PATH . $this->moduleParamsHtml . '&download=' . $objDownload->getId(), 'DOWNLOADS_FILE_OWNER' => $this->getParsedUsername($objDownload->getOwnerId()), 'DOWNLOADS_FILE_OWNER_ID' => $objDownload->getOwnerId(), 'DOWNLOADS_FILE_SRC' => htmlentities($objDownload->getSourceName(), ENT_QUOTES, CONTREXX_CHARSET), 'DOWNLOADS_FILE_LAST_UPDATED' => date(ASCMS_DATE_FORMAT, $objDownload->getMTime()), 'DOWNLOADS_FILE_VIEWS' => $objDownload->getViewCount(), 'DOWNLOADS_FILE_DOWNLOAD_COUNT' => $objDownload->getDownloadCount()));
// parse size
if ($this->arrConfig['use_attr_size']) {
$this->objTemplate->setVariable(array('TXT_DOWNLOADS_SIZE' => $_ARRAYLANG['TXT_DOWNLOADS_SIZE'], 'DOWNLOADS_FILE_SIZE' => $this->getFormatedFileSize($objDownload->getSize())));
$this->objTemplate->touchBlock('download_size_information');
$this->objTemplate->touchBlock('download_size_list');
} else {
$this->objTemplate->hideBlock('download_size_information');
$this->objTemplate->hideBlock('download_size_list');
}
// parse license
if ($this->arrConfig['use_attr_license']) {
$this->objTemplate->setVariable(array('TXT_DOWNLOADS_LICENSE' => $_ARRAYLANG['TXT_DOWNLOADS_LICENSE'], 'DOWNLOADS_FILE_LICENSE' => htmlentities($objDownload->getLicense(), ENT_QUOTES, CONTREXX_CHARSET)));
$this->objTemplate->touchBlock('download_license_information');
$this->objTemplate->touchBlock('download_license_list');
} else {
$this->objTemplate->hideBlock('download_license_information');
$this->objTemplate->hideBlock('download_license_list');
}
// parse version
if ($this->arrConfig['use_attr_version']) {
$this->objTemplate->setVariable(array('TXT_DOWNLOADS_VERSION' => $_ARRAYLANG['TXT_DOWNLOADS_VERSION'], 'DOWNLOADS_FILE_VERSION' => htmlentities($objDownload->getVersion(), ENT_QUOTES, CONTREXX_CHARSET)));
$this->objTemplate->touchBlock('download_version_information');
$this->objTemplate->touchBlock('download_version_list');
} else {
$this->objTemplate->hideBlock('download_version_information');
$this->objTemplate->hideBlock('download_version_list');
}
// parse author
if ($this->arrConfig['use_attr_author']) {
$this->objTemplate->setVariable(array('TXT_DOWNLOADS_AUTHOR' => $_ARRAYLANG['TXT_DOWNLOADS_AUTHOR'], 'DOWNLOADS_FILE_AUTHOR' => htmlentities($objDownload->getAuthor(), ENT_QUOTES, CONTREXX_CHARSET)));
$this->objTemplate->touchBlock('download_author_information');
$this->objTemplate->touchBlock('download_author_list');
} else {
$this->objTemplate->hideBlock('download_author_information');
$this->objTemplate->hideBlock('download_author_list');
}
// parse website
if ($this->arrConfig['use_attr_website']) {
$this->objTemplate->setVariable(array('TXT_DOWNLOADS_WEBSITE' => $_ARRAYLANG['TXT_DOWNLOADS_WEBSITE'], 'DOWNLOADS_FILE_WEBSITE' => $this->getHtmlLinkTag(htmlentities($objDownload->getWebsite(), ENT_QUOTES, CONTREXX_CHARSET), htmlentities($objDownload->getWebsite(), ENT_QUOTES, CONTREXX_CHARSET), htmlentities($objDownload->getWebsite(), ENT_QUOTES, CONTREXX_CHARSET)), 'DOWNLOADS_FILE_WEBSITE_SRC' => htmlentities($objDownload->getWebsite(), ENT_QUOTES, CONTREXX_CHARSET)));
$this->objTemplate->touchBlock('download_website_information');
$this->objTemplate->touchBlock('download_website_list');
} else {
$this->objTemplate->hideBlock('download_website_information');
$this->objTemplate->hideBlock('download_website_list');
}
}
示例9: 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');
}
示例10: 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()));
}
//.........这里部分代码省略.........
示例11: 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();
//.........这里部分代码省略.........
示例12: parseCategoryDownloads
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;
//.........这里部分代码省略.........
示例13: isset
/**
* 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");
//.........这里部分代码省略.........