<?
/**
 * @Project GoldMU.Net
 * @copyright 03/03/2022
 * @Email: goldmu.net@gmail.com
 * @Zalo: 0923 117 898
*/
 
	if (!defined('GoldWebMU')) die("Ban khong co quyen truy cap he thong");

    $file_host = 'data/daugia_bidding.txt';
    
    _getdaugia_list($file_host);
    
    $line = 0;
	$fopen_host = fopen($file_host, "r");
	while (!feof($fopen_host)) {
		$line++;
		$info = fgets($fopen_host);
		if ( $line == 1 )
		{
			$time_top = gmdate("h:i A d/m/Y", intval($info));
		}
		else {
              $data = $info;
		}
	}
	fclose($fopen_host);
    $data_arr = unserialize_safe($data);
    if(!is_array($data_arr)) {
        $listitem_arr = array();
        $item_group_count = array();
    } else {
        $listitem_arr = $data_arr['listitem'];
        $item_group_count = $data_arr['item_group_count'];
    }
    
    $group_item = array();
    foreach($item_group_count as $group_type => $group_count) {
        switch ($group_type){ 
        	case 0:    $group_name = $lang_itemgroup_sword;
        	break;
        
        	case 1:    $group_name = $lang_itemgroup_axe;
        	break;
            
        	case 2:    $group_name = $lang_itemgroup_mace;
        	break;
            
        	case 3:    $group_name = $lang_itemgroup_crepter;
        	break;
            
        	case 4:    $group_name = $lang_itemgroup_bow;
        	break;
            
        	case 5:    $group_name = $lang_itemgroup_staff;
        	break;
            
        	case 6:    $group_name = $lang_itemgroup_shield;
        	break;
            
        	case 7:    $group_name = $lang_itemgroup_helm;
        	break;
            
        	case 8:    $group_name = $lang_itemgroup_armor;
        	break;
            
        	case 9:    $group_name = $lang_itemgroup_pant;
        	break;
            
        	case 10:    $group_name = $lang_itemgroup_glove;
        	break;
            
        	case 11:    $group_name = $lang_itemgroup_boot;
        	break;
            
        	case 12:    $group_name = "$lang_itemgroup_wing & Misc";
        	break;
            
        	case 13:    $group_name = "Misc";
        	break;
            
        	case 14:    $group_name = "Pots & Misc";
        	break;
            
        	case 15:    $group_name = $lang_itemgroup_scrool;
        	break;            
            
        	default :    $group_name = $lang_itemgroup_other;
        }
        $group_item[] = array(
            'group_type'    =>  $group_type,
            'group_name'    =>  $group_name,
            'group_count'   =>  $group_count
        );
    }
    
if(isset($_GET['type']) && strlen($_GET['type']) > 0) {
    foreach($listitem_arr as $listitem_val) {
        if($listitem_val['item_group'] == $_GET['type']) {
            $item_arr[] = $listitem_val;
        }
    }
    
    $page_template = "templates/com/daugia_biding.tpl";
} else {
    $page_template = "templates/com/daugia_choisetype.tpl";
} 
    
?>