<?php

if(!defined('BASEPATH')) exit('Hacking Attempt : Get Out of the system ..!');

class Cronjob_model extends CI_Model
{
	public function __construct(){
		parent::__construct();
	}

	public function getmessages2(){
		$sql='SELECT messages.*,templates.`name`,templates.`header_type`,templates.`btn_1_type`,templates.`btn_1_text`,templates.`btn_1_url`,
templates.`btn_2_type`,templates.`btn_2_text`,templates.`btn_2_url`,templates.`parameters` as temppara,templates.`operator`
 FROM messages LEFT JOIN templates ON templates.`templateId`=messages.`templateId`
WHERE messages.`status`=0';
		 $query = $this->db->query($sql);
    	 return $query->result();
	}

	public function getmessages(){
		$sql='SELECT messages.*,templates.`name`,templates.`header_type`,templates.`btn_1_type`,templates.`btn_1_text`,templates.`btn_1_url`,
templates.`btn_2_type`,templates.`btn_2_text`,templates.`btn_2_url`,templates.`parameters` as temppara,templates.`operator`
 FROM messages LEFT JOIN templates ON templates.`templateId`=messages.`templateId`
WHERE messages.`sendon`<"'.date('Y-m-d H:i:s').'" AND messages.`status`=0 limit 200';
		 $query = $this->db->query($sql);
    	 return $query->result();
	}
	
	public function getkey($id){
		$sql='SELECT headerkeyINFOBIP,scenariokeyINFOBIP,headerkeyRML,headerkeyAirtel from merchant where merchantId="'.$id.'"';
//to add header key from Airtel
		 $query = $this->db->query($sql);
    	 return $query->result();
	}
}
