%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php class Cleads_model extends CI_Model { function __construct() { parent::__construct(); } function lookups(){ $consultants=$this->db->select("id, name")->get_where("users", ['type'=>'CONSULTANT', 'status'=>1])->result_array(); $acs=$this->db->select("id, title name")->order_by("disp_odr")->get_where("master_academic_careers", ['status'=>1])->result_array(); $programs=$this->db->select("id, ac_id, title name")->get_where("master_programs", ['status'=>1])->result_array(); $plans=$this->db->select("id, program_id, title name")->get_where("master_program_plans", ['status'=>1])->result_array(); $states=$this->db->select("id, title name")->get_where("master_states", ['status'=>1])->result_array(); $cities=$this->db->select("id, state_id, title name")->get_where("master_cities", ['status'=>1])->result_array(); return [ 'consultants'=>$consultants, 'acs'=>$acs, 'programs'=>$programs, 'plans'=>$plans, 'states'=>$states, 'cities'=>$cities, ]; } function setCond($id=0){ $qs=trimArray($this->input->get()); if(IS_CONSULTANT){ $qs['consultant_id']=USER_ID; } if($id){ $this->db->where("c.id", $id); } if($qs['consultant_id']){ $this->db->where("c.consultant_id", $qs['consultant_id']); } if($qs['status']){ $this->db->where("c.status", $qs['status']); } if($qs['state_id']){ $this->db->where("c.state_id", $qs['state_id']); } if($qs['plan_id']){ $this->db->where("c.plan_id", $qs['plan_id']); } if($qs['program_id']){ $this->db->where("c.program_id", $qs['program_id']); } if($qs['ac_id']){ $this->db->where("c.ac_id", $qs['ac_id']); } if($qs['from_date']){ $this->db->where("c.created>=", date('Y-m-d', strtotime($qs['from_date']))); } if($qs['to_date']){ $this->db->where("c.created<=", date('Y-m-d 23:59:59', strtotime($qs['to_date']))); } if($qs['k']){ $this->db->group_start(); $this->db->like("c.name", $qs['k'])->or_like("c.email", $qs['k'])->or_like("c.mob", $qs['k']); $this->db->group_end(); } } function lists($all=false, $id=0){ $qs=trimArray($this->input->get()); $this->setCond($id); $this->db->select("c.*, u.name consultant, s.title state, ac.title ac, p.title program, pp.title plan, u1.name action_by_name") ->from("consultant_leads c") ->join("users u", "c.consultant_id=u.id") ->join("master_states s", "c.state_id=s.id") ->join("master_program_plans pp", "c.plan_id=pp.id") ->join("master_programs p", "c.program_id=p.id") ->join("master_academic_careers ac", "c.ac_id=ac.id") ->join("users u1", "c.action_by=u1.id", "LEFT") ->order_by("c.id", "DESC"); if($all){ $rs['data']=$this->db->get()->result_array(); }else{ $rs=$this->dba->pagedRowsNew($qs['p'], $qs['ps']); } foreach($rs['data'] as &$r){ $r['application_no']=''; if($r['app_id']){ $r['application_no']=$this->db->select("application_no")->get_where("applications", ['id'=>$r['app_id']])->row("application_no"); } } return $rs; } function rowDetail($id){ $rs=$this->lists(TRUE, $id); if($rs['data']){ return $rs['data'][0]; } return null; } function delete($id){ $this->db->db_debug=FALSE; $this->db->delete("consultant_leads", ['id'=>$id]); return $this->db->affected_rows()>0; } } //End of file