<?php
/* ====================
[BEGIN_COT_EXT]
Hooks=admin.home.sidepanel
Order=2
[END_COT_EXT]
==================== */

/**
 * market module
 *
 * @package market
 * @version 2.5.2
 * @author CMSWorks Team
 * @copyright Copyright (c) CMSWorks.ru, littledev.ru
 * @license BSD
 */

defined('COT_CODE') or die('Wrong URL');

require_once cot_incfile('market', 'module');

$tt = new XTemplate(cot_tplfile('market.admin.home', 'module', true));

$tt->assign(array(
	'ADMIN_HOME_MARKET_QUEUED_URL' => cot_url('admin', 'm=market&state=2'),
	'ADMIN_HOME_MARKET_PUBLIC_URL' => cot_url('admin', 'm=market&state=0'),
	'ADMIN_HOME_MARKET_HIDDEN_URL' => cot_url('admin', 'm=market&state=1'),
  'ADMIN_HOME_MARKET_DELETED_URL' => cot_url('admin', 'm=market&state=-1'),
  'ADMIN_HOME_MARKET_REJECTED_URL' => cot_url('admin', 'm=market&state=3'),
	'ADMIN_HOME_MARKET_QUEUED' => $db->query("SELECT COUNT(*) FROM $db_market WHERE item_state='2'")->fetchColumn(),
	'ADMIN_HOME_MARKET_PUBLIC' => $db->query("SELECT COUNT(*) FROM $db_market WHERE item_state='0'")->fetchColumn(),
	'ADMIN_HOME_MARKET_HIDDEN' => $db->query("SELECT COUNT(*) FROM $db_market WHERE item_state='1'")->fetchColumn(),
  'ADMIN_HOME_MARKET_DELETED' => $db->query("SELECT COUNT(*) FROM $db_market WHERE item_state='-1'")->fetchColumn(),
  'ADMIN_HOME_MARKET_REJECTED' => $db->query("SELECT COUNT(*) FROM $db_market WHERE item_state='3'")->fetchColumn(),
));

$tt->parse('MAIN');

$line = $tt->text('MAIN');