<?php
/**
 * [BEGIN_COT_EXT]
 * Hooks=module
 * [END_COT_EXT]
 */

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

$m = cot_import('m', 'G', 'TXT');

cot_block(count($moderauth));

require_once $cfg['system_dir'].'/header.php';

$mfind = false;

/* === Hook === */
foreach (cot_getextplugins('moderation.page.mfind') as $pl)
{
	include $pl;
}
/* ===== */

if(!$mfind) {
  $t = new XTemplate(cot_tplfile('moderation', 'module'));

  /* === Hook === */
  foreach (cot_getextplugins('moderation.page.mnotfind') as $pl)
  {
  	include $pl;
  }
  /* ===== */

  $grps = array(5, 6, 8, 9);
  $grpcnt = count($grps);
  foreach($grps as $group) {
    $grpusers = $db->query("SELECT * FROM $db_users WHERE user_maingrp=".$group.' ORDER BY user_id ASC')->fetchAll();
    $ujj=0;
    foreach($grpusers as $urr) {
      $ujj++;
      $t->assign(cot_generate_usertags($urr, 'MODER_ROW_'));
      $t->parse("MAIN.MODER_BLOCK.MODER_LIST");
    }
    $t->assign(array(
      'MODER_GROUPS_CNT' => $grpcnt,
      'MODER_GROUP_CNT' => $ujj,
      'MODER_GROUP_TITLE' => $cot_groups[$group]['name']
    ));
    $t->parse("MAIN.MODER_BLOCK");
  }

  $t->parse("MAIN");
  echo $t->text("MAIN");
}

require_once $cfg['system_dir'].'/footer.php';
