%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 Dataset extends MY_Controller { function __construct() { parent::__construct(); not_logged_res(); $this->checkAccess('lead_data_set'); $this->load->model("master_model", "master"); $this->load->model("dataset_model", "dataset"); $this->load->model("Counselor_model", "counselor"); } function init(){ $data['callers']=$this->counselor->lists(true); $data['states']=$this->common->states(); $data['acs']=$this->common->academicCareers(); $data['disciplines']=$this->common->disciplines(); $data['programs']=$this->common->programs(); //$data['plans']=$this->common->plans(); $data['schools']=$this->common->schools(); $data['utm_sources']=$this->common->allUtmSources(true); $data['lead_sources']=$this->master->all_lead_sources(); $data['ps_app_status_list']=$this->db->query("SELECT DISTINCT DESCR1 FROM ps_stu_status WHERE DESCR1!=''")->result_array(); $data['lead_remarks']=$this->db->select("id, title")->from("master_lead_remarks")->where("status",1)->order_by("cat_id")->order_by("disp_odr")->get()->result_array(); $data['leadFields']=leadFields(); $data['my_data_set_id']=(int)$this->db->select("data_set_id")->get_where("users", ['id'=>USER_ID])->row("data_set_id"); $this->json_data($data); } function lists(){ $data=$this->dataset->lists(); $this->json_data($data); } function save(){ $inf=array('success'=>false, 'msg'=>'Error!'); $post=trim_array($this->input->post()); $id=$post['id']=intval($post['id']); if($id){ if($this->db->limit(1)->get_where("data_set_split_leads", ['data_set_id'=>$id])->row_array()){ $inf['msg']="Dataset once splited to callers can not be updated!"; $this->json_data($inf); } } if($post['user_id']){ $this->form_validation->set_rules('user_id', 'User', "required", $this->req); }else{ $this->form_validation->set_rules('title', 'Name', "required|is_unique[leads_data_sets.title.id!='$id']", $this->req); $this->form_validation->set_rules('expiry_date', 'Expiry Date', "required|callback_valid_date", $this->req); $this->form_validation->set_rules('lead_date_from', 'Leads From Date', "required|callback_valid_date", $this->req); $this->form_validation->set_rules('lead_date_to', 'Leads To Date', "required|callback_valid_date", $this->req); } if(@$this->form_validation->run() == FALSE){ $inf['errors']=$this->form_validation->get_errors(); $inf['msg']=reset($inf['errors']); }else{ $data=filter_value($post, array('id', 'title', 'expiry_date', 'lead_date_from', 'lead_date_to', 'for', 'encrypt_mob', 'encrypt_email', 'encrypt_txnid')); $data['expiry_date']=$data['expiry_date']?to_date_format($data['expiry_date']):null; $data['lead_date_from']=$data['lead_date_from']?to_date_format($data['lead_date_from']):null; $data['lead_date_to']=$data['lead_date_to']?to_date_format($data['lead_date_to']):null; $data['states'] =$post['states']?implode(",", $post['states']):''; $data['acs'] =$post['acs']?implode(",", $post['acs']):''; $data['disciplines'] =$post['disciplines']?implode(",", $post['disciplines']):''; $data['programs'] =$post['programs']?implode(",", $post['programs']):''; $data['fields'] =$post['fields']?implode(",", $post['fields']):''; $data['utm_sources'] =$post['utm_sources']?implode(",", $post['utm_sources']):''; $data['steps'] =$post['steps']?implode(",", $post['steps']):''; $data['payment_modes'] =$post['payment_modes']?implode(",", $post['payment_modes']):''; $data['ps_app_status'] =$post['ps_app_status']?implode(",", $post['ps_app_status']):''; $data['followup_done'] =$post['followup_done']; $data['online_offline'] =$post['online_offline']; $data['med_phd'] =$post['med_phd']; $data['show_campus_offline_leads'] =$post['show_campus_offline_leads']; $data['payment_failed'] =$post['payment_failed']?$post['payment_failed']:null; $data['schools'] =$post['schools']?implode(",", $post['schools']):''; $data['lead_sources'] =$post['lead_sources']?implode(",", $post['lead_sources']):''; $data['remarks_ids'] =$post['remarks_ids']?implode(",", $post['remarks_ids']):''; $data['superbot_disposition'] =$post['superbot_disposition']?implode(",", $post['superbot_disposition']):''; $data['exclude_superbot'] =$post['exclude_superbot']; $data['followup_count_max'] =$post['followup_count_max']; $data['encrypt_mob']=(int)$data['encrypt_mob']; $data['encrypt_email']=(int)$data['encrypt_email']; $data['encrypt_txnid']=(int)$data['encrypt_txnid']; $data['is_campaign']=$data['is_webinar']=0; if($data['for']=='C'){ $data['is_campaign']=1; } if($data['for']=='W'){ $data['is_webinar']=1; } if($data['for']=='CALLER'){ $data['is_caller']=1; } if(!$id){ $data['cities']=$post['cities_serialized']; } if($id){ $cities=[]; $dscities=$this->db->get_where("leads_data_sets", array('id'=>$id))->row()->cities; if($dscities){ $dscities=unserialize($dscities); if($post['states']){ foreach($post['states'] as $state_id){ if($dscities[$state_id]){ $cities[$state_id]=$dscities[$state_id]; } } } $data['cities']=$cities?serialize($cities):''; } } if($post['user_id']){ $data['is_hidden']=1; } if($this->dataset->saveDataset($data, $post['user_id'])){ $inf['success']=true; $inf['msg']='Data set '.($id?'updated':'added').' successfully'; } } $this->json_data($inf); } function detail($id=0){ $dtl=$this->dataset->detail($id); $this->json_data($dtl); } function detail_by_user_id($user_id=0){ $dtl=$this->dataset->detail(0, $user_id); $this->json_data($dtl); } function delete(){ $this->checkAccess('edit_lead_data_set'); $inf=array('success'=>'F', 'msg'=>'Can not deleted!'); $id=intval($this->input->post('id')); if($this->dataset->delete($id)){ $inf['success']='T'; $inf['msg']="Data set deleted successfully"; } $this->json_data($inf); } function cities(){ $qs=$this->input->get(); $dtl['cities']=$this->dataset->cities($qs['state_id'], $qs['id']); $this->json_data($dtl); } function saveCities(){ $inf=array('success'=>false, 'msg'=>'Error!'); $post=trim_array($this->input->post()); $id=intval($post['id']); if(!$id){ $inf['msg']="You need to save Data Set before adding cities"; $this->json_data($inf); } if($this->db->limit(1)->get_where("data_set_split_leads", ['data_set_id'=>$id])->row_array()){ $inf['msg']="Dataset once splited to callers can not be updated!"; $this->json_data($inf); } if(!$post['state_id']){ $inf['msg']="Invalid data"; $this->json_data($inf); } $cities=[]; $dscities=$this->db->get_where("leads_data_sets", array('id'=>$id))->row()->cities; if($dscities){ $cities=unserialize($dscities); } $cities[$post['state_id']]=$post['cities']?$post['cities']:[]; $data=replace_null(array( 'id'=>$id, 'cities'=>$cities?serialize($cities):'', )); if($this->common->save($data, "leads_data_sets")){ $inf['success']=true; $inf['msg']='Cities saved successfully'; } $this->json_data($inf); } function plans(){ $qs=$this->input->get(); $dtl['plans']=$this->dataset->plans($qs['program_id'], $qs['id']); $this->json_data($dtl); } function savePlans(){ $inf=array('success'=>false, 'msg'=>'Error!'); $post=trim_array($this->input->post()); $id=intval($post['id']); if(!$id){ $inf['msg']="You need to save Data Set before adding plans"; $this->json_data($inf); } if(!$post['program_id']){ $inf['msg']="Invalid data"; $this->json_data($inf); } $plans=[]; $dsplans=$this->db->get_where("leads_data_sets", array('id'=>$id))->row()->plans; if($dsplans){ $plans=unserialize($dsplans); } $plans[$post['program_id']]=$post['plans']?$post['plans']:[]; $data=replace_null(array( 'id'=>$id, 'plans'=>$plans?serialize($plans):'', )); if($this->common->save($data, "leads_data_sets")){ $inf['success']=true; $inf['msg']='Plans saved successfully'; } $this->json_data($inf); } function splitDataset(){ $res=array('success'=>false, 'msg'=>'Error!'); $post=trim_array($this->input->post()); if(!$post['data']){ $this->json_data($inf); } $data=json_decode($post['data'], true); if($this->dataset->splitDataset($data)){ $res['success']=true; $res['msg']="Dataset splitted successfully"; } $this->json_data($res); } function download_leads($id){ $rs=$this->dataset->dataset_leads($id); $h=['SYSTEM ID', 'VERIFIED BY', 'CREATED', 'LANDING PAGE', 'NAME', 'EMAIL', 'MOBILE', 'STATE', 'STEP COMPLETED', 'LOGIN URL', 'UTM SOURCE']; $dk=['application_no', 'verified_by', 'created', 'lpage', 'name', 'email', 'mob', 'state', 'step_completed', 'login_url', 'utm_source']; download_csv($rs, $h, $dk, "dataset-leads"); } } //EOF