<?php

class wizard_friend extends SYSTEM\PAGE\Page {
    
    private function js(){        
        return  '';
   }
   
   public static function getfriend($friend_name){
        $con = new \SYSTEM\DB\Connection(new \DBD\mangos_chars());
        $res = $con->prepare(   'selCharByName',
                                'SELECT * FROM `mangos_chars_characters` WHERE `name` = ?;',
                                array($friend_name));        
        $result = array();                                               
        return $result;
    }
    
   public function friend_tolist(){
        $result = "";
        $friend = votes::getfriend(1);        
        foreach($friend_name as $friend){
            $vars = array('name' => $friend['name'], 'race' => $friend['race'], 'gender' => $friend['gender'], 'class' => $friend['class']);
            $result .= SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'default_page/added_friend.tpl'), $vars);
        }
        return $result;
    }
      
   private function css (){
       return '';
   }

    public function html(){
        $vars = array();               
        $vars['js'] = $this->js();
        $vars['css'] = $this->css();
        $vars['PICPATH'] = \SYSTEM\WEBPATH(new PPAGE(),'wizard_friend/img/');
        $vars['WOWICONS'] = \SYSTEM\IMG\img::getURL('wowicons');
        $vars['BUTTONS'] = \SYSTEM\IMG\img::getURL('buttons');
        $vars['BG'] = \SYSTEM\IMG\img::getURL('backgrounds');
        $vars = array_merge($vars,  \SYSTEM\locale::getStrings(DBD\locale_string::VALUE_CATEGORY_MAINPAGE));
        return SYSTEM\PAGE\replace::replaceFile(SYSTEM\SERVERPATH(new PPAGE(),'wizard_friend/friend.tpl'), $vars);
        
    }
}