<?
class clsUser{
    var 
$userID;            //เปลี่ยนเมื่อ login
    
var $userLogin;
    var 
$userPassword;
    var 
$userIP    ;
    var 
$userName;
    var 
$userDptCode;
    var 
$userDptName;
    var 
$userPosCode;
    var 
$userPosName;
    var 
$userPsCode;
    var 
$Lang "th";
    
    var 
$WgID;        //is set when login
    
var $StID;            //StID ของระบบที่เลือกจากเมนูสไลด์ด้านข้าง    ถูกเปลี่ยนโดน slide menu
    
var $GpID;            //GpID กลุ่มระบบงานที่เลือก            ถูกเปลี่ยนโดน slide menu
    
var $MnID;            //ถูกเปลี่ยนโดยเมนู
    
var $X;
    var 
$C;
    var 
$R;
    var 
$U;
    var 
$D;    
    
    function 
clsUser(){    }    
    function 
getLoginName(){    return $this->userLogin; }
    function 
getUserIP(){ return $this->userIP; }
    function 
getName(){ return $this->userName; }
    function 
getDptCode(){ return $this->userDptCode; }
    function 
getDptName(){ return $this->userDptName;    }
    function 
checkAA(){ return true; }
    function 
isExpire(){     return false;    }
    function 
isLock(){ return false; }
    function 
GetRightsByMenu(){
        
/*if ($this->MnID<>""){
            include_once("clsConnection.php");
            include_once("clsUmPermission.php");
            include_once("clsUmGPermission.php");
            $oC = new Connection();
            $oUp = new umpermission($oC->c);
            $oGp = new umgpermission($oC->c);
            $this->X = 1;
            $this->C = 1; 
            $this->R = 1;     
            $this->U = 1; 
            $this->D = 1;
            $oUp->SearchByKey($this->userID, $this->MnID);
            if ($oUp->GetRecord()){
                $this->X = $oUp->pmX;    
                $this->C = $oUp->pmC;
                $this->R = $oUp->pmR;    
                $this->U = $oUp->pmU;
                $this->D = $oUp->pmD;
            } else {
                $oGp->SearchByKey($this->GpID, $this->MnID);
                if ($oGp->GetRecord()){
                    $this->X = $oGp->gpX;    
                    $this->C = $oGp->gpC;
                    $this->R = $oGp->gpR;    
                    $this->U = $oGp->gpU;
                    $this->D = $oGp->gpD;
                }        
            }
            $oUp->Close();
            $oGp->Close();
            $oC->Disconnect();
        }*/
    
}
    
    function 
CRUD($link$linktype){
        
/*$linktype=strtolower($linktype);
        if (strpos("crud",$linktype)===false) die("linktype ผิด");
        $flg = false;
        if ($linktype=="c" and $this->C==0)
             $flg=true;
        elseif ($linktype=="r" and $this->R==0) 
            $flg=true;
        elseif ($linktype=="u" and $this->U==0)
            $flg=true;
        elseif ($linktype=="d" and $this->D==0) 
            $flg=true;
        if ($flg==false){
            echo $link;
        }else{
            $link=trim($link);            
            $s = strtolower($link);
            //----------------------------------------------------------------
            //find image name
//            $input="images/del.gif";
//            $output = "images/delgrey.gif";        // use explode fn
//            $this->createGreyFromGifJpg($input, $output);
            //---------------------------------------------------------------
            
            //rename imagename.gif to imagenamegrey.gif
            $pGif = strpos($s,".gif");
            if ($pGif===false){
            }else{
                $s = substr_replace($link, "grey", $pGif).substr($link, $pGif);
                $link = $s;
            }
            
            //rename imagename.jpg to imagenamegrey.jpg
            $pJpg = strpos($s,".jp");
            if ($pJpg===false){
            }else{
                $s = substr_replace($link, "grey", $pJpg).substr($link, $pJpg);
                $link = $s;
            }            
            //disable tag A 
            $pHref = strpos($s,"href");
            if ($pHref===false){
            }else{
                $s = substr_replace($link, "href1", $pHref).substr($link,$pHref+4);
                $link = $s;
            }            
            //disable text betweem tag A and not have tag img 
            $pImg = strpos($s,"<img")===false;
            if ($pImg===false){            
                if (substr($s,0,2)=="<a"){
                    $p1 = strpos($link,">");
                    $p2 = strpos($link,"</");
                    $s = "<font color=#999999>".substr($link, $p1+1,$p2)."</font>";
                    $link =  $s;
                }
            }
            //check tag INPUT type button or submit
            if (substr($s,1,5)=="input"){
                $p1 = strpos($s,">");
                $s = substr_replace($link, " Disabled>", $p1);
                $link = $s;
            }
            echo  $link;
        }*/
    
}
}



?>