Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F726582
in-portal
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Jan 5, 8:47 PM
Size
3 KB
Mime Type
text/x-diff
Expires
Tue, Jan 7, 8:47 PM (17 h, 2 m ago)
Engine
blob
Format
Raw Data
Handle
536690
Attached To
rINP In-Portal
in-portal
View Options
Index: branches/5.3.x/core/units/promo_blocks/promo_block_tp.php
===================================================================
--- branches/5.3.x/core/units/promo_blocks/promo_block_tp.php (revision 16529)
+++ branches/5.3.x/core/units/promo_blocks/promo_block_tp.php (revision 16530)
@@ -1,91 +1,123 @@
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2011 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
class PromoBlockTagProcessor extends kDBTagProcessor {
/**
* Returns link that registers promotion click and redirect user to the page, associated with the promotion
*
* @param Array $params
* @return string
* @access protected
*/
protected function PromoLink($params)
{
/** @var kDBItem $object */
$object = $this->getObject($params);
$url_params = Array (
$this->Prefix . '_event' => 'OnFollowLink',
'pass' => 'm,' . $this->Prefix,
'__NO_REWRITE__' => 1,
);
return $this->Application->HREF('index', '', $url_params);
}
/**
* Checks, that link should be opened in new window
*
* @param Array $params
* @return bool
* @access protected
*/
protected function LinkInNewWindow($params)
{
/** @var kDBItem $object */
$object = $this->getObject($params);
if ( $object->GetDBField('LinkType') == 1 ) { // Internal
return false;
}
return $object->GetDBField('OpenInNewWindow');
}
/**
* Get value from corresponding PromoGroupBlocks record
*
* @param Array $params
* @return bool
* @access protected
*/
protected function GetGroupSetting(Array $params)
{
static $group_data = null;
if ( !isset($group_data) ) {
if ( isset($params['group_id']) && $params['group_id'] ) {
$group_id = $params['group_id'];
}
else {
/** @var CategoriesItem $page */
$page = $this->Application->recallObject('st');
$group_id = $page->GetDBField('PromoBlockGroupId');
}
$sql = 'SELECT *
FROM ' . TABLE_PREFIX . 'PromoBlockGroups
WHERE PromoBlockGroupId = ' . (int)$group_id;
$group_data = $this->Conn->GetRow($sql);
}
$setting_name = $params['name'];
return isset($group_data[$setting_name]) ? $group_data[$setting_name] : '';
}
+
+ /**
+ * Image Field
+ *
+ * @param array $params Tag params.
+ *
+ * @return string
+ */
+ protected function ImageField(array $params)
+ {
+ $field = $this->SelectParam($params, 'name,field');
+
+ if ( !$field ) {
+ $field = 'Image';
+ }
+
+ /** @var kMultiLanguage $multi_language_formatter */
+ $multi_language_formatter = $this->Application->recallObject('kMultiLanguage');
+ $current_language_field = $multi_language_formatter->LangFieldname($field);
+
+ /** @var kDBItem $object */
+ $object = $this->getObject($params);
+
+ if ( !$object->GetDBField($current_language_field) ) {
+ $current_language_field = $multi_language_formatter->LangFieldname($field, true);
+ }
+
+ $params['name'] = $current_language_field;
+
+ return $this->Field($params);
+ }
+
}
Event Timeline
Log In to Comment