<commit_before><?php
/**
 * @version $Id$
 * @package Abricos
 * @subpackage EShop
 * @copyright Copyright (C) 2011 Abricos All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @author <NAME> <<EMAIL>>
 */

$brick = Brick::$builder->brick;
$db = Abricos::$db;
$p = &$brick->param->param;

$mod = Abricos::GetModule('eshop');

$catalog = $mod->GetCatalog();
$catalogManager = $mod->GetCatalogManager();


$smMenu = Abricos::GetModule('sitemap')->GetManager()->GetMenu();
$rootMenu = $smMenu->menuLine[count($smMenu->menuLine)-1];

$catItemMenu = null;
$adress = Abricos::$adress;

if ($adress->level == 0){
	foreach ($rootMenu->child as $child){
		if ($child->name == 'eshop'){
			$catItemMenu = $child;
			break;
		}
	}
}else {
	$catItemMenu = $rootMenu;
}

if (is_null($catItemMenu)){
	$brick->content = "";
	return;
}
$catItem = $catItemMenu->source;

$link = $baseUrl = $catItemMenu->link; 
$imgWidth = bkint($p['imgw']);
$imgHeight = bkint($p['imgh']);

foreach ($catItemMenu->child as $child){
	$link = $child->link;
	$imageid = $child->source['img'];
	
	if (empty($imageid)){
		$image = $brick->param->var["imgempty"];
	}else{
		$thumb = CatalogModule::FotoThumbInfoParse($imginfo['thumb']);
		
		$image = Brick::ReplaceVarByData($brick->param->var["img"], array(
			"src" => CatalogModule::FotoThumbLink($imageid, $imgWidth, $imgHeight, 'image')
		));
	}
	
	$image = Brick::ReplaceVarByData($image, array(
		"w" => $imgWidth,
		"h" => $imgHeight
	));
	
	$lst .= Brick::ReplaceVarByData($brick->param->var['row'], array(
		"image" => $image, 
		"title" => addslashes(htmlspecialchars($child->source['tl'])),
		"link" => $link
	));
}
$brick->content = Brick::ReplaceVarByData($brick->content, array(
	"result" => Brick::ReplaceVarByData($brick->param->var['table'], array(
		"rows" => $lst
	)) 
));

?><commit_msg>Модуль eshop: добавление переменных cattitle и catdesc в catalog_list.php<commit_after><?php
/**
 * @version $Id$
 * @package Abricos
 * @subpackage EShop
 * @copyright Copyright (C) 2011 Abricos All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
 * @author <NAME> <<EMAIL>>
 */

$brick = Brick::$builder->brick;
$db = Abricos::$db;
$p = &$brick->param->param;

$mod = Abricos::GetModule('eshop');

$catalog = $mod->GetCatalog();
$catalogManager = $mod->GetCatalogManager();


$smMenu = Abricos::GetModule('sitemap')->GetManager()->GetMenu();
$rootMenu = $smMenu->menuLine[count($smMenu->menuLine)-1];

$catItemMenu = null;
$adress = Abricos::$adress;

if ($adress->level == 0){
	foreach ($rootMenu->child as $child){
		if ($child->name == 'eshop'){
			$catItemMenu = $child;
			break;
		}
	}
}else {
	$catItemMenu = $rootMenu;
}

if (is_null($catItemMenu)){
	$brick->content = "";
	return;
}
$catItem = $catItemMenu->source;

$link = $baseUrl = $catItemMenu->link; 
$imgWidth = bkint($p['imgw']);
$imgHeight = bkint($p['imgh']);

foreach ($catItemMenu->child as $child){
	$link = $child->link;
	$imageid = $child->source['img'];
	
	if (empty($imageid)){
		$image = $brick->param->var["imgempty"];
	}else{
		$thumb = CatalogModule::FotoThumbInfoParse($imginfo['thumb']);
		
		$image = Brick::ReplaceVarByData($brick->param->var["img"], array(
			"src" => CatalogModule::FotoThumbLink($imageid, $imgWidth, $imgHeight, 'image')
		));
	}
	
	$image = Brick::ReplaceVarByData($image, array(
		"w" => $imgWidth,
		"h" => $imgHeight
	));

	$lst .= Brick::ReplaceVarByData($brick->param->var['row'], array(
		"cattitle" => $child->source['tl'],
		"catdesc" => $child->source['dsc'],
		"image" => $image, 
		"title" => addslashes(htmlspecialchars($child->source['tl'])),
		"link" => $link
	));
	
}
$brick->content = Brick::ReplaceVarByData($brick->content, array(
	"result" => Brick::ReplaceVarByData($brick->param->var['table'], array(
		"rows" => $lst
	)) 
));

?>
{'fraction_non_alphanumeric': 0.22561448900388098, 'fraction_numerical': 0.0031047865459249676, 'mean_word_length': 5.245557350565428, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 89, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6479261', 'n_tokens_mistral': 1535, 'n_tokens_neox': 1470, 'n_words': 250}