<?php

/**
 * [BEGIN_COT_EXT]
 * Hooks=marketorders.order.tags
 * [END_COT_EXT]
 */

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

if ($usr['id'] > 0)
{
  require_once cot_incfile('mavatars', 'plug');

	$mavatar = new mavatar('marketorders', 'msg', '', 'edit', array());
  $mavatars_tags = $mavatar->tags();
  if(count($mavatars_tags) > 0) {
    $mavtgs = array();
    $mavtgs['MAVATAR'] = array();

    $mavtgs['MAVATARCOUNT'] = 0;
    foreach($mavatars_tags as $mavtg) {
      $mavtg['FILEEXTICON'] = 'doc';
      if(cot_mavatar_is_photo($mavtg['FILEEXT'])) {
        $mavtg['FILEEXTICON'] = 'image';
      } elseif(cot_mavatar_is_audio($mavtg['FILEEXT'])) {
        $mavtg['FILEEXTICON'] = 'audio';
      } elseif($mavtg['FILEEXT'] == 'zip' || $mavtg['FILEEXT'] == 'rar') {
        $mavtg['FILEEXTICON'] = 'zip';
      }
      $mavtgs['MAVATAR'][] = $mavtg;
      $mavtgs['MAVATARCOUNT']++;
    }

    $t->assign('MKT_FORM_MAVATARS', $mavtgs);
  }
}
