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

class Mo_c extends CI_Model {
	
	public function alias_url($alias)
	{
		$this->db->select('f_customer_id,f_customer_name',false);
		$this->db->where('f_customer_link',$alias);
		$sql = $this->db->get('t_customers');
		if($sql->num_rows() > 0)
		{
			return $sql->row();
		}
		else
		{
			return false;
		}
	}
	
	function fnEventExp($idAccount)
	{
		$this->db->where('f_event_start<=',date('Y-m-d'));
		$this->db->where('f_event_end>=',date('Y-m-d'));
		$sql = $this->db->select('f_event_id,f_event_start as ed,f_event_end as dt',false)->where('f_customer_id',$idAccount)->order_by('f_event_id','desc')->get('t_event');
		if($sql->num_rows() >0 )
		{
			return $sql->row();
		}
		else
		{
			return false;
		}
	}
}
