<?php
/* $Id: inter.class.php,v 1.10 2003/11/09 22:28:06 emailtotom Exp $ */

class Inter{
	var $id = -1; //id of the inter
	var $idTicket = -1; //id of the attached ticket
	var $projId; //project id
	var $state; //status of the intervention  
	var $info; //status of the intervention
	function Inter() {
		//arg 1 : ticket id		
		//arg 2 : $id
		$arguments = func_get_args();
		switch(func_num_args()) {
			case 1:
			//nothing to do
				$this->idTicket = $arguments[0];
			break;
			
			case 2:
				$this->id = $arguments[0];
				$this->idTicket = $arguments[1];
			break;	
		}
	}
	
	function load() {
        global $conn, $smarty, $appconf;		
            $sql="select * from mgw_tts t, mgw_tts_history h where h.id=".$this->getId() ." and t.id = h.id_tts";
            if(!$res = $conn->Execute($sql)) exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));
        
        	$row = $res->FetchRow(); 
			$this->setProjId($row["id_project"]);
			$this->setTicketId($row["id_tts"]);						
			$this->setState($row["state"]);
			$this->setInfo($row["info"]);
	}
	

    function opCreateInternal(	$info,
								$idTts,
								$state) {
        global $conn, $smarty, $appconf;

    	if(queryRights2_bool('root_modules_tts_write')){
            
            $idcategory=0;
        
            $sql="select * from mgw_tts_history where id_tts=".$idTts ." order by id";
            if(!$res = $conn->Execute($sql)) exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));
        
        
            if(!$res->EOF) {
                //set the end date for the last intervention
                $res->movelast();//the last one
                $row = $res->FetchRow();
                $sql="UPDATE mgw_tts_history SET  end_date=".$conn->DBTimeStamp(time())." WHERE id_tts=".$idTts." and id=".$row["id"];
                if(!$res = $conn->Execute($sql)) exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));
            }
        
            $id = $conn->GenID('mgw__seq_tts_history');

            $sql="INSERT INTO mgw_tts_history (id, id_tts, id_owner, start_date,end_date,lu_date, info, state)
                 VALUES (".$id.",".$idTts." , ".$_SESSION["MGW"]->userid.", ".$conn->DBTimeStamp(time()).",'".ISOZERODATE."',".$conn->DBTimeStamp(time()).",".$conn->QMagic($info).", ".$state.")"; //RVT

            if(!$conn->Execute($sql)) exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));
    
    	    return true;
    	}
    	else{
    	    $smarty->assign("errorheader",getLanguageString("permerror"));
    	    $smarty->assign("permerror",getLanguageString("permerrormsg"));
    	    $smarty->display($appconf["gentemplates"] ."/perm_errors.tpl");
    	    exit();
    	}
    }

	function opCreateDefault($idTts) {
		global $conn;
        $state=0;//open
		$info=$conn->QMagic(" ");
		return $this->opCreateInternal(	$info,
										$idTts,
										$state);		

		
	}
	
	function opCreate() {
        $info=(string)$_POST["_infoval"];
        $idTts=(int)$_POST["_idtts"];
        $state=(int)$_POST["_status"];

		return $this->opCreateInternal(	$info,
										$idTts,
										$state);		
	}
	

    function viewNewForm() {
        global $conn,$smarty, $appconf;
        global $status;

    	if(queryRights2_bool('root_modules_tts_write')){
    	    include_once(INCLUDEPATH . "mSelectBox.class.php");
            $id=isset($_GET["id"])?(int)$_GET["id"]:0;
            $projid=isset($_GET["projid"])?(int)$_GET["projid"]:0;    
            $assignedto=isset($_GET["assignedto"])?(int)$_GET["assignedto"]:0;
            
            $smarty->assign("project","addinter");
            $smarty->assign("mode","new");
            $smarty->assign("current_tts",$id);
            $smarty->assign("suname","addinter");
            $smarty->assign("newinter",Lang::getLanguageString("newinter"));
            $smarty->assign("suvalue",Lang::getLanguageString("create"));
            $smarty->assign("suclass","submit");
            $smarty->assign("_idttsval",$id);
        
            //number
            $sql="select count(id) as number from mgw_tts_history where id_tts=".$id;
            if(!$res = $conn->Execute($sql)) exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));
            $row = $res->FetchRow();
            $number=$row["number"];
            $smarty->assign("internumval", $number);
            
            //project
            $sql="select title from mgw_projects where project_id=".$projid;
            if(!$res = $conn->Execute($sql)) exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));
            $row = $res->FetchRow();
            $smarty->assign("projectval",$row["title"]);
            $smarty->assign("_projectval",$projid);
        
        
            //owner of the intervention
            $sql="select * from mgw_users where id=".$_SESSION["MGW"]->userid;
            if(!$res = $conn->Execute($sql)) exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));
            $row = $res->FetchRow();
            $smarty->assign("ownerval",$row["lastname"].", ".$row["firstname"]);
            $smarty->assign("_owneridval",$row["id"]);
        
            //intervention assigned to
        	if(!empty($assignedto)) {
        	    $concat=$conn->Concat("lastname", "', '", "firstname");
        	    $sql="select $concat as name, id from mgw_users where is_ldap=1 and id=".$assignedto;    //need to be modified when there is a table to link users and projects
        		if(!$res2 = $conn->Execute($sql)) exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));
        	    $row = $res2->FetchRow();
        	    $smarty->assign("assignedval",$row["name"]);
        	    $smarty->assign("_assignedval",$row["id"]);
        	}
        	
            $smarty->assign("status", Lang::getLanguageString("status"));
            $sb9 = new mSelectBox("_status",0);
            $sb9->setContentType("arr");
            $sb9->addContent($status);
            $smarty->assign("statussb", $sb9->draw());
            unset($sb9);  
                   
                    
            $smarty->display('tts_inter.tpl');
    
    	    return true;
    	}
    	else{
    	    $smarty->assign("errorheader",Lang::getLanguageString("permerror"));
    	    $smarty->assign("permerror",Lang::getLanguageString("permerrormsg"));
    	    $smarty->display($appconf["gentemplates"] ."/perm_errors.tpl");
    	    exit();
    	}
    }

    function viewDetails() {
        global $conn,$smarty;
        global $status;

    	    include_once(INCLUDEPATH . "mSelectBox.class.php");
            $id=isset($_GET["id"])?(int)$_GET["id"]:0;
            $projid=isset($_GET["projid"])?(int)$_GET["projid"]:0;    

//            $assignedto=isset($_GET["assignedto"])?(int)$_GET["assignedto"]:0;
// emailtotom - commented out - variable not in use
            
            $smarty->assign("mode","detail");
            $smarty->assign("current_tts",$id);
            $smarty->assign("suname","addinter");
            $smarty->assign("newinter",Lang::getLanguageString("details"));
            $smarty->assign("suvalue",Lang::getLanguageString("create"));
            $smarty->assign("suclass","submit");
            $smarty->assign("_idttsval",$id);
        
            //number
            $smarty->assign("internumval", $this->getId());
            
            //project			
            $sql="select title from mgw_projects where project_id=".$this->getProjId();
            if(!$res = $conn->Execute($sql)) exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));
            $row = $res->FetchRow();
            $smarty->assign("projectval",$row["title"]);
            $smarty->assign("_projectval",$this->getProjId());
        
        
            //owner of the intervention
            $sql="select u.* from mgw_tts t, mgw_users u where t.id=".$this->getTicketId()." and t.id_owner = u.id";
            if(!$res = $conn->Execute($sql)) exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));
            $row = $res->FetchRow();
            $smarty->assign("ownerval",$row["lastname"].", ".$row["firstname"]);
            $smarty->assign("_owneridval",$row["id"]);
        
            //intervention assigned to
        	if($row["id_assigned"]>0) {
                $sql="select u.* from mgw_tts t, mgw_users u where t.id=".$this->getTicketId()." and t.id_assigned = u.id";
                if(!$res = $conn->Execute($sql)) exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));
                $row = $res->FetchRow();
                $smarty->assign("assignedval",$row["lastname"].", ".$row["firstname"]);
                $smarty->assign("_assignedval",$row["id"]);
        	}
        	
            $smarty->assign("status", Lang::getLanguageString("status"));
            $smarty->assign("statussb",$status[$this->getState()]);
                   
            $smarty->assign("infoval", $this->getInfo());
                    
            $smarty->display('tts_inter.tpl');

		return true;
    }

    function viewEditForm() {
        global $conn, $smarty, $appconf;
        global $priority, $severity, $resolution;
        
    	$sql = "SELECT * FROM mgw_tts WHERE id=".$this->id;
    	if(!$res = $conn->Execute($sql)) exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));
    	$row = $res->FetchRow();
    
    	if((queryRights2_bool('root_modules_tts_modify') && $row["owner"] == $_SESSION["MGW"]->userid) ||
    	   (queryRights2_bool('root_modules_tts_modifyothers') && $row["owner"] != $_SESSION["MGW"]->userid)){
    	    include_once(INCLUDEPATH . "mSelectBox.class.php");
    
            // Id 
            $smarty->assign("idtxt", Lang::getLanguageString("id"));
            $smarty->assign("idval", isset($_GET["id"])?(int)$_GET["id"]:0);
            
            //project select Box
            $smarty->assign("project","add");
            $smarty->assign("mode","modify");
            $smarty->assign("current_tts",isset($_GET["id"])?(int)$_GET["id"]:0);
            $smarty->assign("suname","modify");
            $smarty->assign("suvalue",Lang::getLanguageString("modify"));
            $smarty->assign("suclass","submit");
            
            $sql="select project_id, title from mgw_projects";
            $sb6 = new mSelectBox("_project",isset($_GET["projid"])?(int)$_GET["projid"]:0);
            $sb6->setContentType("sql");
            $sb6->setSQLvalue("project_id");
            $sb6->setSQLcontent("title");
            $sb6->addContent($sql);
            $sb6->addOption("0", Lang::getLanguageString("chooseproject"), "pre");
            $smarty->assign("projectsb", $sb6->draw());
            unset($sb6);
            
            //owner text
            $sql="select * from mgw_users where id=".$_SESSION["MGW"]->userid;
            if(!$res = $conn->Execute($sql)) exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));
            $row = $res->FetchRow();
            $smarty->assign("ownerval",$row["lastname"].", ".$row["firstname"]);
            $smarty->assign("ownervalid",$row["id"]);
            //user of the project select Box
            
            $concat=$conn->Concat("lastname", "', '", "firstname");
            $name = array();
        
            $sql="select $concat as name, id from mgw_users where is_ldap=1";    //need to be modified when there is a table to link users and projects
            if(!$res = $conn->Execute($sql)) exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));
            $i=1;
            while(!$res->EOF) {
                $name[$res->Fields("id")] = $res->Fields("name");
                $res->movenext();
                $i++;
            }
            
            $sql="select * from mgw_tts where id=".(isset($_GET["id"])?(int)$_GET["id"]:0);    //need to be modified when there is a table to link users and projects
            if(!$res = $conn->Execute($sql)) exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));
            $row = $res->FetchRow();
            
            $sb7 = new mSelectBox("_assigned",isset($_GET["assignedto"])?(int)$_GET["assignedto"]:0);
            $sb7->setContentType("arr");
            $sb7->addContent($name);
            $sb7->addOption("-1", Lang::getLanguageString("chooseassigned"), "pre");
            $smarty->assign("assignedsb", $sb7->draw());
            unset($sb7);
            
            
            //PRIOTITY
            $smarty->assign("priority", Lang::getLanguageString("priority"));
            $sb8 = new mSelectBox("_priority",$row["id_priority"]);
            $sb8->setContentType("arr");
            $sb8->addContent($priority);
            $smarty->assign("prioritysb", $sb8->draw());
            unset($sb8);            
            
            //SEVERITY
            $smarty->assign("severity", Lang::getLanguageString("severity"));
            $sb9 = new mSelectBox("_severity",$row["id_severity"]);
            $sb9->setContentType("arr");
            $sb9->addContent($severity);
            $smarty->assign("severitysb", $sb9->draw());
            unset($sb9);    
            
            //RESOLUTION
            $smarty->assign("resolution", Lang::getLanguageString("resolution"));
            $sb10 = new mSelectBox("_resolution",$row["id_resolution"]);
            $sb10->setContentType("arr");
            $sb10->addContent($resolution);
            $smarty->assign("resolutionsb", $sb10->draw());
            unset($sb10);  
            
            $smarty->assign("short_descval", $row["short_desc"]);
            $smarty->assign("long_descval", $row["long_desc"]);
            
            $smarty->display('tts_ticket.tpl',$_SESSION["MGW"]->userid."_".(isset($_GET["projid"])?(int)$_GET["projid"]:0)."_".isset($_GET["id"])?(int)$_GET["id"]:0);
    
    	    return true;
    	}
    	else{
    	    $smarty->assign("errorheader",Lang::getLanguageString("permerror"));
    	    $smarty->assign("permerror",Lang::getLanguageString("permerrormsg"));
    	    $smarty->display($appconf["gentemplates"] ."/perm_errors.tpl");
    	    exit();
    	}
    }

    function viewList() {
        global $conn, $smarty;
        global $priority, $severity, $resolution, $priorityColor;
        
        //to avoid EALL notice
        $urls=array();
        $list=array();
    
        // =================================================
        //	              List View
        // =================================================
        // if user wants icons, assign icons if not -> not
        if($_SESSION["MGW"]->settings["iconmode"]==1) {
            $detailsym = "<img src=\"". $appconf["imgpathgeneral"]. "/details_". $_SESSION["MGW"]->settings["iconid"]. ".gif\" border=\"0\" alt=\"".Lang::getLanguageString("details")."\" title=\"".Lang::getLanguageString("details")."\">";
            $editsym = "<img src=\"". $appconf["imgpathgeneral"]. "/edit_". $_SESSION["MGW"]->settings["iconid"]. ".gif\" border=\"0\" alt=\"".Lang::getLanguageString("edit")."\" title=\"".Lang::getLanguageString("edit")."\">";
            $delsym = "<img src=\"". $appconf["imgpathgeneral"]. "/delete_". $_SESSION["MGW"]->settings["iconid"]. ".gif\" border=\"0\" alt=\"".Lang::getLanguageString("delete")."\" title=\"".Lang::getLanguageString("delete")."\">";
            $prevsym = "<img src=\"". $appconf["imgpathgeneral"]. "/left_". $_SESSION["MGW"]->settings["iconid"]. ".gif\" border=\"0\">";
            $nextsym = "<img src=\"". $appconf["imgpathgeneral"]. "/right_". $_SESSION["MGW"]->settings["iconid"]. ".gif\" border=\"0\">";
            $privsym = "<img src=\"" . $appconf["imgpathgeneral"] . "/private_". $_SESSION["MGW"]->settings["iconid"]. ".gif\" alt=\"Private\" border=\"0\">";
            $smarty->assign("iconid", $_SESSION["MGW"]->settings["iconid"]);
            $smarty->assign("iconmode", true);
        } else {
            $detailsym = Lang::getLanguageString("details");
            $editsym = Lang::getLanguageString("edit");
            $delsym = Lang::getLanguageString("delete");
            $privsym = Lang::getLanguageString("private");
            $prevsym = "&lt;&lt;--|";
            $nextsym = "|--&gt;&gt;";
            $smarty->assign("iconmode", false);
        }
        $smarty->assign("prevsym", $prevsym);
        $smarty->assign("nextsym", $nextsym);
    
    //no job occupation needed
    
        $sql="SELECT DISTINCT
             a.project_id,
             a.title
             FROM
             mgw_projects a,
             mgw_tts b
             WHERE a.project_id=b.id_project";
             
        //echo $sql;
    
        if(!$res = $conn->Execute($sql)) exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));
        
        $arr_result=array();
        $sav_id_project=0;
        
        while($row = $res->FetchRow()) {
            $counter++;
            $id_project = $row["id"];//$res->Fields("id");
            $index=count($arr_result);
            $arr_result[$index][0]["id"]=$row["id"];
            $myid=$res->Fields("id");
            $arr_result[$index][0]["name"]=$row["title"];
    //      $arr_result[$index][0]["link"]="../projects/index.php?action=details&id=".$res->Fields(id)."&".SID."";
            $sql="select a.*
                 from mgw_tts a
                 where id_project=".$id_project;
    	//echo $sql;
            if(!$res2 = $conn->Execute($sql)) exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));
            //$row = $res2->FetchRow();
            $i=0;
            $arrowner=array();
            $assigned=array();
            $arrid=array();
            while($row2 = $res2->FetchRow()) {
               
                   //echo "<br>aasi : ".$row2["id_assigned"]."  -  ".is_numeric($row2["id_assigned"])."  -" . $row2["short_desc"]."<br>\n";
    
                //is assigned or is the owner member of the bug
                $defassigned[$i]=0;
                $defowner[$i]=0;
    
                if(is_numeric($row2["id_assigned"])){
                    $defassigned[$i]=1;
    		$conass = $conn->Concat('c.lastname', "', '",'c.firstname');
                    $sql="SELECT DISTINCT
                         $conass AS assigned,
                         c.id
                         FROM mgw_tts a,
                         mgw_users c
                         WHERE
                         a.id_assigned=c.id AND
                         a.id=".$row2["id"];
    
                    if(!$res3 = $conn->Execute($sql)) exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));
                    $row3 = $res3->FetchRow();
                    $arrassigned[$i]=$row3;
                    $arrid[$i]=$row3["id"];
                }
                //is assigned or is the owner member of the application
                if($row2["id_owner"]>-1){
                    $defowner[$i]=1;
                    $sql="SELECT ALL
                         $conass AS owner,
                         c.id
                         FROM mgw_tts a,
                         mgw_users c
                         WHERE
                         a.id_owner=c.id and
                         a.id_owner=".$row2["id_owner"];
    
                   if(!$res4 = $conn->Execute($sql)) exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));
                    $row4 = $res4->FetchRow();
                    $arrowner[$i] = $row4;
                    $arrid[$i]=$row4["id"];
    
                } else {//if its own by nobody, take the value submited with the form
                    $defowner[$i]=1;
                    $sql="select distinct a.owner_name as owner, a.owner_email as email, a.id
                         from mgw_tts a
                         where id_project=".$id_project;
                    if(!$res4 = $conn->Execute($sql)) exit(showSQLerror($sql, $conn->ErrorMsg(), __LINE__, __FILE__));
                    $row4 = $res4->FetchRow();
                    $arrowner[$i] = $row4;
                    $arrid[$i]=$row4["id"];
                }
                $arrid[$i]=$row2["id"];
                $i++;
            }
    
    
            $res2->moveFirst();
            if(isset($defassigned)) $res3->moveFirst();
            if(isset($defowner)) $res4->moveFirst();
            //print_r($arrassigned);
            $i=0;
            while(!$res2->EOF) {
                $arr_result[$index][1][$i]=$res2->FetchRow();
                
                if($defassigned[$i]==1) {
                    $arr_result[$index][2][$i]["assigned"]=$arrassigned[$i]["assigned"];
                }
                if($defowner[$i]==1) {
                    if(!empty($row4["email"])) {
                        $arr_result[$index][2][$i]["owner"]="<a href=\"mailto:".$arrowner[$i]["email"]."\">".$arrowner[$i]["owner"]."</a>";
                    } else {
                        $arr_result[$index][2][$i]["owner"]=$arrowner[$i]["owner"];
                    }
                }
    
                
     
                $arr_result[$index][2][$i]["priorityColor"]=$priorityColor[$arr_result[$index][1][$i]["id_priority"]];
                $arr_result[$index][2][$i]["severity"]=$severity[$arr_result[$index][1][$i]["id_severity"]];
                $arr_result[$index][2][$i]["resolution"]=$resolution[$arr_result[$index][1][$i]["id_resolution"]];                        
                
                $myid=$arrid[$i];
                //print_r($arrid);
                // we do this in order not to convert too much of the $row[] fields
    
                // create Action URLs
                $detlink = "<a href=\"index.php?action=detail&id=$myid&projid=".$id_project."&".SID."\" CLASS=\"edit\">$detailsym</a>";
    
                // modify only for user with appropriate rights
    		if((queryRights2_bool('root_modules_tts_modify') and $row2["id_owner"] ==$_SESSION["MGW"]->userid)
    			 || (queryRights2_bool('root_modules_tts_modifyothers') and $row2["id_owner"] <> $_SESSION["MGW"]->userid)) {
                    $editlink = "<a href=\"index.php?action=editform&projid=".$id_project."&id=$myid&assignedto=".$arrassigned[$i]["id"]."&act=$action&searchterm=$searchterm&list=$list&npage=$npage&".SID."\" CLASS=\"edit\">$editsym</a>";
                }
                else {
                    $editlink = "";
                }
    
                // make a new intervention only for user with appropriate rights
                if((queryRights2_bool('root_modules_tts_modify') and $row2["id_owner"] == $_SESSION["MGW"]->userid)
                        || (queryRights2_bool('root_modules_tts_modifyothers') and $row2["id_owner"] <> $_SESSION["MGW"]->userid)) {
                    $interlink = "<a href=\"index.php?action=newinter&projid=".$id_project."&id=$myid&assignedto=".$arrassigned[$i]["id"]."&act=$action&searchterm=$searchterm&list=$list&npage=$npage&".SID."\" CLASS=\"delete\">".Lang::getLanguageString("newinter")."</a>";
                }
                else {
                    $interlink = "";
                }
    
                $historic = "<a href=\"index.php?action=historic&projid=".$id_project."&id=$myid&assignedto=".$arrassigned[$i]["id"]."&act=$action&searchterm=$searchterm&list=$list&npage=$npage&".SID."\" CLASS=\"edit\">".Lang::getLanguageString("historic")."</a>";
    //            $detail = "<a href=\"index.php?action=detail&projid=".($index+1)."&id=$myid&assignedto=".$arrassigned[$i]["id"]."&act=$action&searchterm=$searchterm&list=$list&npage=$npage&".SID."\"CLASS=\"edit\">".Lang::getLanguageString("historic")."</a>";
                $space = "&nbsp;&nbsp;";
                $urls[$index][] = $detlink . $space . $editlink .$space . $interlink . $space . $historic;
    
                $mailto[] = "<a href=\"mailto:" . $row["email"] . "\">" . $row["email"] . "</a>";
    
                if($row["ispublic"]==1) $images[] = "&nbsp;";
                else $images[] = $privsym;
    
                $i++;
                if(isset($defassigned)) $res3->moveNext();// a revoir
            }
        }
    
        $smarty->assign("tout",$arr_result);
        //print_r($arr_result);
    
    
    
    
        $smarty->assign("hascreaterights", queryRights2_bool('root_modules_tts_write'));
        $smarty->assign('urls', $urls);    
        $smarty->assign('list', $list);    
        
        $smarty->assign('action', Lang::getLanguageString("action"));
        $smarty->assign('suvalue', Lang::getLanguageString("search"));
        $smarty->assign('suclass', "submit");
        
        
    
        $smarty->display("tts_list.tpl",$_SESSION["MGW"]->userid);
    
    
    	return true;
    }
    
    /********************
	* GETTER and SETTER * 
	*********************/
    function getId() {
    	return $this->id;	
    }
    
    function setId($id) {
    	$this->id = $id;
    }    

    function getProjId() {
    	return $this->projId;	
    }
    
    function setProjId($id) {
    	$this->projId = $id;
    }
        
    function getTicketId() {
    	return $this->idTicket;	
    }
    
    function setTicketId($id) {
    	$this->idTicket = $id;
    }

    function getState() {
    	return $this->state;	
    }
    
    function setState($id) {
    	$this->state = $id;
    }

    function getInfo() {
    	return $this->info;	
    }
    
    function setInfo($info) {
    	$this->info = $info;
    }            
}
?>