Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Sun, May 11, 11:13 AM

in-portal

Index: trunk/kernel/units/images/image_tag_processor.php
===================================================================
--- trunk/kernel/units/images/image_tag_processor.php (revision 8390)
+++ trunk/kernel/units/images/image_tag_processor.php (revision 8391)
@@ -1,247 +1,250 @@
<?php
class ImageTagProcessor extends kDBTagProcessor {
/**
* Prepares all image parameters as list block parameters (for easy usage)
*
* @param kDBList $object
* @param Array $block_params
* @author Alex
*/
function PrepareListElementParams(&$object, &$block_params)
{
$image_url = $this->ImageSrc($block_params);
if (!$image_url) {
return ;
}
$block_params['img_path'] = $image_url;
$image_dimensions = $this->ImageSize($block_params);
$block_params['img_size'] = $image_dimensions ? $image_dimensions : ' width="'.$block_params['DefaultWidth'].'"';
$block_params['alt'] = htmlspecialchars($object->GetField('AltName')); // really used ?
}
/**
* [AGGREGATED TAG] works as <inp2:CatalogItemPrefix_Image ..../>
*
* @param Array $params
* @return string
*/
function ItemImage($params)
{
$this->LoadItemImage($params);
$params['img_path'] = $this->ImageSrc($params);
$params['img_size'] = $this->ImageSize($params);
if (!$params['img_size']){
if (isset($params['DefaultWidth'])) {
$params['img_size'] = ' width="'.getArrayValue($params, 'DefaultWidth').'"';
}
}
$params['name'] = $this->SelectParam($params, 'render_as,block');
$object =& $this->getObject($params);
if ( !$object->isLoaded() && !$this->SelectParam($params, 'default_image,DefaultImage') ) return false;
$params['alt'] = htmlspecialchars($object->GetField('AltName'));
return $this->Application->ParseBlock($params);
}
function LargeImageExists($params)
{
$object =& $this->getObject($params);
if ( $object->GetDBField('SameImages') == null || $object->GetDBField('SameImages')=='1' )
{
return false;
}
else
{
return true;
}
}
function LoadItemImage($params)
{
$parent_item =& $this->Application->recallObject($params['PrefixSpecial']);
$object =& $this->Application->recallObject($this->getPrefixSpecial(), null, Array('skip_autoload' => true));
+ /* @var $object kDBItem */
+
$object->Clear();
// if we need primary thumbnail which is preloaded with products list
if (
$this->SelectParam($params, 'thumbnail,Thumbnail') &&
(
(
$this->SelectParam($params, 'primary,Primary')
||
!isset($params['name'])
)
&&
!$this->Application->GetVar('img_id')
&&
isset($parent_item->Fields['LocalThumb'])
)
)
{
$object->SetDefaultValues();
- $object->SetDBFieldsFromHash($parent_item->GetFieldValues(), Array('SameImages', 'LocalThumb', 'ThumbPath', 'ThumbUrl', 'LocalImage', 'LocalPath', 'Url') );
+ $object->SetDBField('Url', $parent_item->GetDBField('FullUrl'));
+ $object->SetDBFieldsFromHash($parent_item->GetFieldValues(), Array('SameImages', 'LocalThumb', 'ThumbPath', 'ThumbUrl', 'LocalImage', 'LocalPath') );
$object->Loaded = true;
}
else { // if requested image is not primary thumbnail - load it directly
$id_field = $this->Application->getUnitOption($this->Prefix, 'ForeignKey');
$parent_table_key = $this->Application->getUnitOption($this->Prefix, 'ParentTableKey');
$keys[$id_field] = $parent_item->GetDBField($parent_table_key);
// which image to load?
if ( getArrayValue($params, 'Primary') ) { //load primary image
$keys['DefaultImg'] = 1;
}
elseif ( getArrayValue($params, 'name') ) { //load by name
$keys['Name'] = $params['name'];
}
elseif ( $image_id = $this->Application->GetVar($this->Prefix.'_id') ) {
$keys['ImageId'] = $image_id;
}
else {
$keys['DefaultImg'] = 1; //if primary was not set explicity and name was also not passed - load primary
}
$object->Load($keys);
}
}
function ImageSrc($params)
{
$object =& $this->getObject($params);
$base_url = rtrim($this->Application->BaseURL(), '/');
$ret = '';
// if we need thumb, or full image is same as thumb
if ( $this->SelectParam($params, 'thumbnail,Thumbnail') || $object->GetDBField('SameImages') )
{
// return local image or url
$ret = $object->GetDBField('LocalThumb') ? $base_url.$object->GetDBField('ThumbPath') : $object->GetDBField('ThumbUrl');
if ($object->GetDBField('LocalThumb') && !file_exists(FULL_PATH.$object->GetDBField('ThumbPath')) && !constOn('DBG_IMAGE_RECOVERY')) {
// local thumbnail file is missing
$ret = '';
}
}
else { // if we need full which is not the same as thumb
$ret = $object->GetDBField('LocalImage') ? $base_url.$object->GetDBField('LocalPath') : $object->GetDBField('Url');
if ($object->GetDBField('LocalImage') && !file_exists(FULL_PATH.$object->GetDBField('LocalPath'))) {
// local full image file is missing
$ret = '';
}
}
$default_image = $this->SelectParam($params, 'default_image,DefaultImage');
return ($ret && $ret != $base_url) ? $ret : ($default_image ? $base_url.THEMES_PATH.'/'.$default_image : false);
}
function getFullPath($path)
{
if (!$path) {
return $path;
}
// absolute url
if (preg_match('/^(.*):\/\/(.*)$/U', $path)) {
return preg_replace('/^'.preg_quote($this->Application->BaseURL(), '/').'(.*)/', FULL_PATH.'/\\1', $path);
}
// relative url
return FULL_PATH.'/'.substr(THEMES_PATH, 1).'/'.$path;
}
/**
* Makes size clause for img tag, such as
* ' width="80" height="100"' according to max_width
* and max_heght limits.
*
* @param array $params
* @return string
*/
function ImageSize($params)
{
$img_path = $this->getFullPath($params['img_path']);
if (!file_exists($img_path)) {
return false;
}
$image_info = @getimagesize($img_path);
if (!$image_info) {
trigger_error('Image <b>'.$img_path.'</b> <span class="debug_error">missing or invalid</span>', E_USER_WARNING);
return false;
}
$orig_width = getArrayValue($image_info, 0);
$orig_height = getArrayValue($image_info, 1);
$max_width = getArrayValue($params, 'MaxWidth');
$max_height = getArrayValue($params, 'MaxHeight');
$too_large = is_numeric($max_width) ? ($orig_width > $max_width) : false;
$too_large = $too_large || (is_numeric($max_height) ? ($orig_height > $max_height) : false);
if ($too_large) {
$width_ratio = $max_width ? $max_width / $orig_width : 1;
$height_ratio = $max_height ? $max_height / $orig_height : 1;
$ratio = min($width_ratio, $height_ratio);
$width = ceil($orig_width * $ratio);
$height = ceil($orig_height * $ratio);
}
else {
$width = $orig_width;
$height = $orig_height;
}
return ' width="'.$width.'" height="'.$height.'"';
}
/**
* Prepares image parameters & parses block with them (for admin)
*
* @param Array $params
* @return string
*/
function Image($params)
{
$image_url = $this->ImageSrc($params);
if (!$image_url) {
return ;
}
$object =& $this->getObject($params);
$params['img_path'] = $image_url;
$image_dimensions = $this->ImageSize($params);
$params['img_size'] = $image_dimensions ? $image_dimensions : ' width="'.$params['DefaultWidth'].'"';
$params['alt'] = htmlspecialchars($object->GetField('AltName')); // really used ?
$params['name'] = $this->SelectParam($params, 'block,render_as');
return $this->Application->ParseBlock($params);
}
/**
* Returns url for image in case when image source is url (for admin)
*
* @param Array $params
* @return string
*/
function ImageUrl($params)
{
$object =& $this->getObject($params);
if ($object->GetDBField('SameImages') ? $object->GetDBField('LocalThumb') : $object->GetDBField('LocalImage') ) {
$ret = $this->Application->Phrase(getArrayValue($params,'local_phrase'));
}
else {
$ret = $object->GetDBField('SameImages') ? $object->GetDBField('ThumbUrl') : $object->GetDBField('Url');
}
return $ret;
}
}
?>
\ No newline at end of file
Property changes on: trunk/kernel/units/images/image_tag_processor.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.6
\ No newline at end of property
+1.7
\ No newline at end of property
Index: trunk/themes/default2007/platform/designs/content_boxes.tpl
===================================================================
--- trunk/themes/default2007/platform/designs/content_boxes.tpl (revision 8390)
+++ trunk/themes/default2007/platform/designs/content_boxes.tpl (revision 8391)
@@ -1,50 +1,57 @@
<inp2:m_DefineElement name="menu_element" current="">
<td style="background-color: #F0FFFF">
<inp2:m_if check="m_Param" name="current">
<a href="<inp2:m_param name="menu_href"/>"><strong><inp2:m_param name="menu_title"/></strong></a>
<inp2:m_else/>
<a href="<inp2:m_param name="menu_href"/>"><inp2:m_param name="menu_title"/></a>
</inp2:m_if>
</td>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="box_element" prefix="">
<tr>
<td>-</td>
<td>
<inp2:m_if check="m_Param" name="prefix">
<a href="<inp2:$prefix_SuggestItemLink template="$template"/>"><inp2:m_Phrase label="$title"/></a>
<inp2:m_else/>
<a href="<inp2:m_Link template="$template" m_cat_id="0"/>"><inp2:m_Phrase label="$title"/></a>
</inp2:m_if>
</td>
</tr>
</inp2:m_DefineElement>
<inp2:m_DefineElement name="review_element">
<tr>
<td>
Review By: <strong><inp2:Field name="ReviewedBy"/></strong><br />
Review Text: <inp2:Field name="ReviewText"/>
</td>
</tr>
</inp2:m_DefineElement>
+<inp2:m_DefineElement name="category_path_element">
+ <inp2:m_if check="m_ParamEquals" name="cat_id" value="0" inverse="inverse">
+ <inp2:m_param name="separator"/>
+ </inp2:m_if>
+ <inp2:m_param name="cat_name"/>
+</inp2:m_DefineElement>
+
<inp2:m_DefineElement name="image_element">
<img src="<inp2:m_param name="img_path" />" title="<inp2:m_param name="alt" />" alt="<inp2:m_param name="alt" />" <inp2:m_param name="img_size" /> border="0" />
</inp2:m_DefineElement>
<inp2:m_DefineElement name="content_box">
<table style="width: 100%;">
<tr>
<td style="background-color: #0FFFFF">
<inp2:m_param name="header"/>
</td>
</tr>
<tr>
<td style="background-color: #FFFFF0">
<inp2:m_param name="content"/>
</td>
</tr>
</table>
</inp2:m_DefineElement>
\ No newline at end of file
Property changes on: trunk/themes/default2007/platform/designs/content_boxes.tpl
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.4
\ No newline at end of property
+1.5
\ No newline at end of property
Index: trunk/core/units/images/image_tag_processor.php
===================================================================
--- trunk/core/units/images/image_tag_processor.php (revision 8390)
+++ trunk/core/units/images/image_tag_processor.php (revision 8391)
@@ -1,247 +1,250 @@
<?php
class ImageTagProcessor extends kDBTagProcessor {
/**
* Prepares all image parameters as list block parameters (for easy usage)
*
* @param kDBList $object
* @param Array $block_params
* @author Alex
*/
function PrepareListElementParams(&$object, &$block_params)
{
$image_url = $this->ImageSrc($block_params);
if (!$image_url) {
return ;
}
$block_params['img_path'] = $image_url;
$image_dimensions = $this->ImageSize($block_params);
$block_params['img_size'] = $image_dimensions ? $image_dimensions : ' width="'.$block_params['DefaultWidth'].'"';
$block_params['alt'] = htmlspecialchars($object->GetField('AltName')); // really used ?
}
/**
* [AGGREGATED TAG] works as <inp2:CatalogItemPrefix_Image ..../>
*
* @param Array $params
* @return string
*/
function ItemImage($params)
{
$this->LoadItemImage($params);
$params['img_path'] = $this->ImageSrc($params);
$params['img_size'] = $this->ImageSize($params);
if (!$params['img_size']){
if (isset($params['DefaultWidth'])) {
$params['img_size'] = ' width="'.getArrayValue($params, 'DefaultWidth').'"';
}
}
$params['name'] = $this->SelectParam($params, 'render_as,block');
$object =& $this->getObject($params);
if ( !$object->isLoaded() && !$this->SelectParam($params, 'default_image,DefaultImage') ) return false;
$params['alt'] = htmlspecialchars($object->GetField('AltName'));
return $this->Application->ParseBlock($params);
}
function LargeImageExists($params)
{
$object =& $this->getObject($params);
if ( $object->GetDBField('SameImages') == null || $object->GetDBField('SameImages')=='1' )
{
return false;
}
else
{
return true;
}
}
function LoadItemImage($params)
{
$parent_item =& $this->Application->recallObject($params['PrefixSpecial']);
$object =& $this->Application->recallObject($this->getPrefixSpecial(), null, Array('skip_autoload' => true));
+ /* @var $object kDBItem */
+
$object->Clear();
// if we need primary thumbnail which is preloaded with products list
if (
$this->SelectParam($params, 'thumbnail,Thumbnail') &&
(
(
$this->SelectParam($params, 'primary,Primary')
||
!isset($params['name'])
)
&&
!$this->Application->GetVar('img_id')
&&
isset($parent_item->Fields['LocalThumb'])
)
)
{
$object->SetDefaultValues();
- $object->SetDBFieldsFromHash($parent_item->GetFieldValues(), Array('SameImages', 'LocalThumb', 'ThumbPath', 'ThumbUrl', 'LocalImage', 'LocalPath', 'Url') );
+ $object->SetDBField('Url', $parent_item->GetDBField('FullUrl'));
+ $object->SetDBFieldsFromHash($parent_item->GetFieldValues(), Array('SameImages', 'LocalThumb', 'ThumbPath', 'ThumbUrl', 'LocalImage', 'LocalPath') );
$object->Loaded = true;
}
else { // if requested image is not primary thumbnail - load it directly
$id_field = $this->Application->getUnitOption($this->Prefix, 'ForeignKey');
$parent_table_key = $this->Application->getUnitOption($this->Prefix, 'ParentTableKey');
$keys[$id_field] = $parent_item->GetDBField($parent_table_key);
// which image to load?
if ( getArrayValue($params, 'Primary') ) { //load primary image
$keys['DefaultImg'] = 1;
}
elseif ( getArrayValue($params, 'name') ) { //load by name
$keys['Name'] = $params['name'];
}
elseif ( $image_id = $this->Application->GetVar($this->Prefix.'_id') ) {
$keys['ImageId'] = $image_id;
}
else {
$keys['DefaultImg'] = 1; //if primary was not set explicity and name was also not passed - load primary
}
$object->Load($keys);
}
}
function ImageSrc($params)
{
$object =& $this->getObject($params);
$base_url = rtrim($this->Application->BaseURL(), '/');
$ret = '';
// if we need thumb, or full image is same as thumb
if ( $this->SelectParam($params, 'thumbnail,Thumbnail') || $object->GetDBField('SameImages') )
{
// return local image or url
$ret = $object->GetDBField('LocalThumb') ? $base_url.$object->GetDBField('ThumbPath') : $object->GetDBField('ThumbUrl');
if ($object->GetDBField('LocalThumb') && !file_exists(FULL_PATH.$object->GetDBField('ThumbPath')) && !constOn('DBG_IMAGE_RECOVERY')) {
// local thumbnail file is missing
$ret = '';
}
}
else { // if we need full which is not the same as thumb
$ret = $object->GetDBField('LocalImage') ? $base_url.$object->GetDBField('LocalPath') : $object->GetDBField('Url');
if ($object->GetDBField('LocalImage') && !file_exists(FULL_PATH.$object->GetDBField('LocalPath'))) {
// local full image file is missing
$ret = '';
}
}
$default_image = $this->SelectParam($params, 'default_image,DefaultImage');
return ($ret && $ret != $base_url) ? $ret : ($default_image ? $base_url.THEMES_PATH.'/'.$default_image : false);
}
function getFullPath($path)
{
if (!$path) {
return $path;
}
// absolute url
if (preg_match('/^(.*):\/\/(.*)$/U', $path)) {
return preg_replace('/^'.preg_quote($this->Application->BaseURL(), '/').'(.*)/', FULL_PATH.'/\\1', $path);
}
// relative url
return FULL_PATH.'/'.substr(THEMES_PATH, 1).'/'.$path;
}
/**
* Makes size clause for img tag, such as
* ' width="80" height="100"' according to max_width
* and max_heght limits.
*
* @param array $params
* @return string
*/
function ImageSize($params)
{
$img_path = $this->getFullPath($params['img_path']);
if (!file_exists($img_path)) {
return false;
}
$image_info = @getimagesize($img_path);
if (!$image_info) {
trigger_error('Image <b>'.$img_path.'</b> <span class="debug_error">missing or invalid</span>', E_USER_WARNING);
return false;
}
$orig_width = getArrayValue($image_info, 0);
$orig_height = getArrayValue($image_info, 1);
$max_width = getArrayValue($params, 'MaxWidth');
$max_height = getArrayValue($params, 'MaxHeight');
$too_large = is_numeric($max_width) ? ($orig_width > $max_width) : false;
$too_large = $too_large || (is_numeric($max_height) ? ($orig_height > $max_height) : false);
if ($too_large) {
$width_ratio = $max_width ? $max_width / $orig_width : 1;
$height_ratio = $max_height ? $max_height / $orig_height : 1;
$ratio = min($width_ratio, $height_ratio);
$width = ceil($orig_width * $ratio);
$height = ceil($orig_height * $ratio);
}
else {
$width = $orig_width;
$height = $orig_height;
}
return ' width="'.$width.'" height="'.$height.'"';
}
/**
* Prepares image parameters & parses block with them (for admin)
*
* @param Array $params
* @return string
*/
function Image($params)
{
$image_url = $this->ImageSrc($params);
if (!$image_url) {
return ;
}
$object =& $this->getObject($params);
$params['img_path'] = $image_url;
$image_dimensions = $this->ImageSize($params);
$params['img_size'] = $image_dimensions ? $image_dimensions : ' width="'.$params['DefaultWidth'].'"';
$params['alt'] = htmlspecialchars($object->GetField('AltName')); // really used ?
$params['name'] = $this->SelectParam($params, 'block,render_as');
return $this->Application->ParseBlock($params);
}
/**
* Returns url for image in case when image source is url (for admin)
*
* @param Array $params
* @return string
*/
function ImageUrl($params)
{
$object =& $this->getObject($params);
if ($object->GetDBField('SameImages') ? $object->GetDBField('LocalThumb') : $object->GetDBField('LocalImage') ) {
$ret = $this->Application->Phrase(getArrayValue($params,'local_phrase'));
}
else {
$ret = $object->GetDBField('SameImages') ? $object->GetDBField('ThumbUrl') : $object->GetDBField('Url');
}
return $ret;
}
}
?>
\ No newline at end of file
Property changes on: trunk/core/units/images/image_tag_processor.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.6
\ No newline at end of property
+1.7
\ No newline at end of property
Index: trunk/core/units/general/cat_tag_processor.php
===================================================================
--- trunk/core/units/general/cat_tag_processor.php (revision 8390)
+++ trunk/core/units/general/cat_tag_processor.php (revision 8391)
@@ -1,244 +1,252 @@
<?php
class kCatDBTagProcessor extends kDBTagProcessor {
/**
* Permission Helper
*
* @var kPermissionsHelper
*/
var $PermHelper = null;
function kCatDBTagProcessor()
{
parent::kDBTagProcessor();
$this->PermHelper = $this->Application->recallObject('PermissionsHelper');
}
function ItemIcon($params)
{
$object =& $this->Application->recallObject($this->getPrefixSpecial(),$this->Prefix, $params);
$grids = $this->Application->getUnitOption($this->Prefix,'Grids');
$icons =& $grids[ $params['grid'] ]['Icons'];
$status_fields = $this->Application->getUnitOption($this->Prefix,'StatusField');
if (!$status_fields) return $icons['default'];
$value = $object->GetDBField($status_fields[0]); // sets base status icon
/* @var $object kDBItem */
if ($value == STATUS_ACTIVE) {
if( $object->HasField('IsPop') && $object->GetDBField('IsPop') ) $value = 'POP';
if( $object->HasField('IsHot') && $object->GetDBField('IsHot') ) $value = 'HOT';
if( $object->HasField('IsNew') && $object->GetDBField('IsNew') ) $value = 'NEW';
if( $object->HasField('EditorsPick') && $object->GetDBField('EditorsPick') ) $value = 'PICK';
}
return isset($icons[$value]) ? $icons[$value] : $icons['default'];
}
/**
* Allows to create valid mod-rewrite compatible link to module item
*
* @param Array $params
* @param string $id_prefix
* @return string
*/
function ItemLink($params, $id_prefix)
{
$params = array_merge($params, Array('pass' => 'm,'.$this->Prefix) );
$item_id = isset($params[$id_prefix.'_id']) && $params[$id_prefix.'_id'];
if (!$item_id) {
$item_id = $this->Application->GetVar($this->getPrefixSpecial().'_id');
if (!$item_id) {
$item_id = $this->Application->GetVar($this->Prefix.'_id');
}
}
$params[$this->Prefix.'_id'] = $item_id;
$object =& $this->getObject($params);
$params['m_cat_id'] = $object->GetDBField('CategoryId');
$params['pass_category'] = 1;
return $this->Application->ProcessParsedTag('m', 't', $params);
}
function CategoryPath($params)
{
- if (!isset($params['cat_id'])) {
- $params['cat_id'] = $this->Application->RecallVar($params['session_var'], 0);
+ if ($this->Application->IsAdmin()) {
+ // path for module root category in admin
+ if (!isset($params['cat_id'])) {
+ $params['cat_id'] = $this->Application->RecallVar($params['session_var'], 0);
+ }
+ }
+ else {
+ // path for category item category in front-end
+ $object =& $this->getObject($params);
+ $params['cat_id'] = $object->GetDBField('CategoryId');
}
return $this->Application->ProcessParsedTag('c', 'CategoryPath', $params);
}
function BuildListSpecial($params)
{
if ($this->Special != '') return $this->Special;
if ( isset($params['parent_cat_id']) ) {
$parent_cat_id = $params['parent_cat_id'];
}
else {
$parent_cat_id = $this->Application->GetVar('c_id');
if (!$parent_cat_id) {
$parent_cat_id = $this->Application->GetVar('m_cat_id');
}
}
$recursive = isset($params['recursive']);
$types = $this->SelectParam($params, 'types');
$except = $this->SelectParam($params, 'except');
if ($types.$except.$recursive == '') {
return parent::BuildListSpecial($params);
}
$special = crc32($parent_cat_id.$types.$except.$recursive);
return $special;
}
function CatalogItemCount($params)
{
$object =& $this->GetList($params);
if (!$object->Counted) {
$object->CountRecs();
}
return $object->NoFilterCount != $object->RecordsCount ? $object->RecordsCount.' / '.$object->NoFilterCount : $object->RecordsCount;
}
function ListReviews($params)
{
$prefix = $this->Prefix.'-rev';
$review_tag_processor =& $this->Application->recallObject($prefix.'.item_TagProcessor');
return $review_tag_processor->PrintList($params);
}
function ReviewCount($params)
{
$review_tag_processor =& $this->Application->recallObject('rev.item_TagProcessor');
return $review_tag_processor->TotalRecords($params);
}
function InitCatalogTab($params)
{
$tab_params['mode'] = $this->Application->GetVar('tm'); // single/multi selection possible
$tab_params['special'] = $this->Application->GetVar('ts'); // use special for this tab
$tab_params['dependant'] = $this->Application->GetVar('td'); // is grid dependant on categories grid
// set default params (same as in catalog)
if ($tab_params['mode'] === false) $tab_params['mode'] = 'multi';
if ($tab_params['special'] === false) $tab_params['special'] = '';
if ($tab_params['dependant'] === false) $tab_params['dependant'] = 'yes';
// pass params to block with tab content
$params['name'] = $params['render_as'];
$params['prefix'] = trim($this->Prefix.'.'.($tab_params['special'] ? $tab_params['special'] : $this->Special), '.');
$params['cat_prefix'] = trim('c.'.($tab_params['special'] ? $tab_params['special'] : $this->Special), '.');
$params['tab_mode'] = $tab_params['mode'];
$params['tab_dependant'] = $tab_params['dependant'];
$params['show_category'] = $tab_params['special'] == 'showall' ? 1 : 0; // this is advanced view -> show category name
return $this->Application->ParseBlock($params, 1);
}
/**
* Show CachedNavbar of current item primary category
*
* @param Array $params
* @return string
*/
function CategoryName($params)
{
// show category cachednavbar of
$object =& $this->getObject($params);
$category_id = isset($params['cat_id']) ? $params['cat_id'] : $object->GetDBField('CategoryId');
$category_path = $this->Application->getCache('category_paths', $category_id);
if ($category_path === false) {
// not chached
if ($category_id > 0) {
$category_path = trim($this->CategoryName( Array('cat_id' => 0) ).' > '.str_replace('&|&', ' > ', $object->GetDBField('CachedNavbar')), ' > ');
}
else {
$category_path = $this->Application->Phrase( $this->Application->ConfigValue('Root_Name') );
}
$this->Application->setCache('category_paths', $category_id, $category_path);
}
return $category_path;
}
/**
* Allows to determine if original value should be shown
*
* @param Array $params
* @return bool
*/
function DisplayOriginal($params)
{
// original id found & greather then zero + show original
$display_original = isset($params['display_original']) && $params['display_original'];
$object =& $this->getObject($params);
$perm_value = $this->PermHelper->ModifyCheckPermission($object->GetDBField('CreatedById'), $object->GetDBField('CategoryId'), $this->Prefix);
return $display_original && ($perm_value == 1) && $this->Application->GetVar($this->Prefix.'.original_id');
}
/**
* Checks if user have one of required permissions
*
* @param Array $params
* @return bool
*/
function HasPermission($params)
{
$perm_helper =& $this->Application->recallObject('PermissionsHelper');
/* @var $perm_helper kPermissionsHelper */
$params['raise_warnings'] = 0;
$object =& $this->getObject($params);
/* @var $object kDBItem */
$params['cat_id'] = $object->isLoaded() ? $object->GetDBField('CategoryId') : $this->Application->GetVar('m_cat_id');
return $perm_helper->TagPermissionCheck($params, $this->getPrefixSpecial().'_HasPermission');
}
/**
* Creates link to current category or to module root category, when current category is home
*
* @param Array $params
* @return string
*/
function SuggestItemLink($params)
{
if (!isset($params['cat_id'])) {
$params['cat_id'] = $this->Application->GetVar('m_cat_id');
}
if ($params['cat_id'] == 0) {
$params['cat_id'] = $this->Application->findModule('Var', $this->Prefix, 'RootCat');
}
return $this->Application->ProcessParsedTag('c', 'CategoryLink', $params);
}
/**
* Allows to detect if item has any additional images available
*
* @param Array $params
* @return string
*/
function HasAdditionalImages($params)
{
$object =& $this->getObject($params);
$sql = 'SELECT ImageId
FROM '.$this->Application->getUnitOption('img', 'TableName').'
WHERE ResourceId = '.$object->GetDBField('ResourceId').' AND DefaultImg != 1 AND Enabled = 1';
return $this->Conn->GetOne($sql) ? 1 : 0;
}
}
?>
\ No newline at end of file
Property changes on: trunk/core/units/general/cat_tag_processor.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.21
\ No newline at end of property
+1.22
\ No newline at end of property

Event Timeline