<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=moderation.page.mnotfind
 * [END_COT_EXT]
 */

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

if(in_array('marketorders', $moderauth)) {

  require_once cot_incfile('marketorders', 'plug');

  $querytpl = "SELECT COUNT(*) FROM $db_market_orders AS o";

  $t->assign(array(
    "MRKTORDERS_CNT_ALL" => $db->query($querytpl ." WHERE o.order_status!='new'")->fetchColumn(),
    "MRKTORDERS_CNT_PAID" => $db->query($querytpl ." WHERE o.order_status='paid'")->fetchColumn(),
    "MRKTORDERS_CNT_CANCEL" => $db->query($querytpl ." WHERE o.order_status='cancel'")->fetchColumn(),
    "MRKTORDERS_CNT_CLAIM" => $db->query($querytpl ." WHERE o.order_status='claim'")->fetchColumn(),
    "MRKTORDERS_CNT_CHECK" => $db->query($querytpl ." WHERE o.order_status='check'")->fetchColumn(),
    "MRKTORDERS_CNT_START" => $db->query($querytpl ." WHERE o.order_status='start'")->fetchColumn(),
    "MRKTORDERS_CNT_DONE" => $db->query($querytpl ." WHERE o.order_status='done'")->fetchColumn(),
    "MRKTORDERS_CNT_QUEUE" => $db->query($querytpl ." WHERE o.order_status='queue'")->fetchColumn(),
  ));

  $t->parse('MAIN.LINE_MRKTORDERS');
}