Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/units/promo_blocks/promo_block_tp.php
Show All 19 Lines | |||||
* Returns link that registers promotion click and redirect user to the page, associated with the promotion | * Returns link that registers promotion click and redirect user to the page, associated with the promotion | ||||
* | * | ||||
* @param Array $params | * @param Array $params | ||||
* @return string | * @return string | ||||
* @access protected | * @access protected | ||||
*/ | */ | ||||
protected function PromoLink($params) | protected function PromoLink($params) | ||||
{ | { | ||||
/** @var kDBItem $object */ | |||||
$object = $this->getObject($params); | $object = $this->getObject($params); | ||||
/* @var $object kDBItem */ | |||||
$url_params = Array ( | $url_params = Array ( | ||||
$this->Prefix . '_event' => 'OnFollowLink', | $this->Prefix . '_event' => 'OnFollowLink', | ||||
'pass' => 'm,' . $this->Prefix, | 'pass' => 'm,' . $this->Prefix, | ||||
'__NO_REWRITE__' => 1, | '__NO_REWRITE__' => 1, | ||||
); | ); | ||||
return $this->Application->HREF('index', '', $url_params); | return $this->Application->HREF('index', '', $url_params); | ||||
} | } | ||||
/** | /** | ||||
* Checks, that link should be opened in new window | * Checks, that link should be opened in new window | ||||
* | * | ||||
* @param Array $params | * @param Array $params | ||||
* @return bool | * @return bool | ||||
* @access protected | * @access protected | ||||
*/ | */ | ||||
protected function LinkInNewWindow($params) | protected function LinkInNewWindow($params) | ||||
{ | { | ||||
/** @var kDBItem $object */ | |||||
$object = $this->getObject($params); | $object = $this->getObject($params); | ||||
/* @var $object kDBItem */ | |||||
if ( $object->GetDBField('LinkType') == 1 ) { // Internal | if ( $object->GetDBField('LinkType') == 1 ) { // Internal | ||||
return false; | return false; | ||||
} | } | ||||
return $object->GetDBField('OpenInNewWindow'); | return $object->GetDBField('OpenInNewWindow'); | ||||
} | } | ||||
/** | /** | ||||
* Get value from corresponding PromoGroupBlocks record | * Get value from corresponding PromoGroupBlocks record | ||||
* | * | ||||
* @param Array $params | * @param Array $params | ||||
* @return bool | * @return bool | ||||
* @access protected | * @access protected | ||||
*/ | */ | ||||
protected function GetGroupSetting(Array $params) | protected function GetGroupSetting(Array $params) | ||||
{ | { | ||||
static $group_data = null; | static $group_data = null; | ||||
if ( !isset($group_data) ) { | if ( !isset($group_data) ) { | ||||
if ( isset($params['group_id']) && $params['group_id'] ) { | if ( isset($params['group_id']) && $params['group_id'] ) { | ||||
$group_id = $params['group_id']; | $group_id = $params['group_id']; | ||||
} | } | ||||
else { | else { | ||||
/** @var CategoriesItem $page */ | |||||
$page = $this->Application->recallObject('st'); | $page = $this->Application->recallObject('st'); | ||||
/* @var $page CategoriesItem */ | |||||
$group_id = $page->GetDBField('PromoBlockGroupId'); | $group_id = $page->GetDBField('PromoBlockGroupId'); | ||||
} | } | ||||
$sql = 'SELECT * | $sql = 'SELECT * | ||||
FROM ' . TABLE_PREFIX . 'PromoBlockGroups | FROM ' . TABLE_PREFIX . 'PromoBlockGroups | ||||
WHERE PromoBlockGroupId = ' . (int)$group_id; | WHERE PromoBlockGroupId = ' . (int)$group_id; | ||||
$group_data = $this->Conn->GetRow($sql); | $group_data = $this->Conn->GetRow($sql); | ||||
} | } | ||||
$setting_name = $params['name']; | $setting_name = $params['name']; | ||||
return isset($group_data[$setting_name]) ? $group_data[$setting_name] : ''; | return isset($group_data[$setting_name]) ? $group_data[$setting_name] : ''; | ||||
} | } | ||||
} | } |