<?php
require_once (PATH_TABLES . "activity/template/JobCentreTemplateTable.php") ;
require_once (PATH_TABLES . "activity/template/JobCentreTaskTemplateTable.php") ;
require_once (PATH_MODELS . "base/MasterBase.php") ;

class JobCentreTaskTemplateClass extends MasterBase {
	function __construct($db) {
		$this->db 		= $db ;
		$this->tbl 		= JobCentreTaskTemplateTable::C_TABLE ;
		$this->fldid 	= JobCentreTaskTemplateTable::C_ID ;
	}

	function __destruct() {
	}

	function getJobCenterTasktemplate($id){

        $sql = "SELECT * FROM " ;
        $sql .= JobCentreTaskTemplateTable::C_TABLE . " WHERE " . JobCentreTaskTemplateTable::C_ID . " = " . $id;
        $sql .= "ORDER BY " . JobCentreTaskTemplateTable::C_PHASE ." ASC";
        
        $rows = $this->db->getTable($sql);

        if(!is_null($rows) && count($rows) > 0){
            return $rows;
        }
        
        return null;
    }

    function deleteTask($id)
    {
        $sql = "DELETE FROM " . JobCentreTaskTemplateTable::C_TABLE . 
                " WHERE " . JobCentreTaskTemplateTable::C_ID . " = " . $id. "";
        
        try{
            $this->db->executeSql($sql);
        } catch (Exception $e){
            Log::write("[ChecklistDetailClass]" . $e->getMessage());
        }
    }
}
?>