<?php
require_once (PATH_TABLES . "campaign/CampaignDetailTable.php") ;
require_once (PATH_MODELS . "base/MasterBase.php") ;

class CampaignDetailClass extends MasterBase {
	function __construct($db) {
		$this->db 		= $db ;
		$this->tbl 		= CampaignDetailTable::C_TABLE;
		$this->fldid 	= CampaignDetailTable::C_DETAIL_ID;
	}
	function __destruct() {
	}
	function deleteCampaignDetailByGiftID($id){
		$sql = "DELETE FROM " . CampaignDetailTable::C_TABLE . " WHERE " . CampaignDetailTable::C_ID . " = " . $id;

		$this->db->executeSql($sql);
	}

	function getCampaignDetailByGiftID($id){
		$sql = "SELECT * FROM " . CampaignDetailTable::C_TABLE . " WHERE " . CampaignDetailTable::C_ID . " = " . $id;
		$rows = $this->db->getTable($sql);

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

	function deleteAttachmentByID($attach_id){
		$sql = "DELETE FROM " . CampaignDetailTable::C_TABLE . " WHERE " . CampaignDetailTable::C_DETAIL_ID . " = " . $attach_id;

		$this->db->executeSql($sql);
	}
}
