<?php
defined('BASEPATH') or exit('No direct script access allowed');

require_once dirname(__FILE__) . '/../Exhibition_Model.php';

class Da_tag extends Exhibition_Model
{

	public function __construct()
	{
		parent::__construct();
	}

	public function insert_tag($name)
	{
		$sql = "INSERT INTO {$this->db_name}.tag 
		(
            name,
			status
        )
        VALUES (?,?);";
        $this->db->query($sql, [$name, 1]);       
	}

	public function delete_tag($id)
	{
		$sql = "UPDATE {$this->db_name}.tag
        SET is_delete = ?
        WHERE tag_id = ?";
        $this->db->query($sql, [1, $id]);
	}

	public function update_tag($name, $id)
	{
		$sql = "UPDATE {$this->db_name}.tag
        SET name = ?
        WHERE tag_id = ?";
        $this->db->query($sql, [$name, $id]);
	}

	public function change_status($status, $id){
		$sql = "UPDATE {$this->db_name}.tag
        SET status = ?
        WHERE tag_id = ?";
        $this->db->query($sql, [$status, $id]);
	}
}
