%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 Counselor extends MY_Controller { function __construct() { parent::__construct(); not_logged_res(); //$this->checkAccess('manage_counselor'); $this->load->model("Counselor_model", "counselor"); $this->load->model("dataset_model", "dataset"); } function init(){ $data=$this->counselor->lists(); $data['modules']=$this->counselor->system_modules(['Dashboard', 'Leads', 'Report']); $data['datasets']=$this->dataset->all_lists(); $data['caller_managers']=$this->counselor->caller_managers(); $this->json_data($data); } function lists(){ $data=$this->counselor->lists(); $this->json_data($data); } function save(){ $inf=array('success'=>'F', 'msg'=>'Error!'); $post=trim_array($this->input->post()); $id=$post['id']=intval($post['id']); $this->form_validation->set_rules('name', 'Name', 'required', $this->req); $this->form_validation->set_rules('username', 'Username', "is_unique[users.username.id!='$id']", $this->req); $this->form_validation->set_rules('email', 'Email', "required|valid_email|is_unique[users.email.id!='$id']", $this->req); $this->form_validation->set_rules('mobile', 'Mobile No.', "required|integer|exact_length[10]", $this->req); $this->form_validation->set_rules('parent_id', 'Caller Manager', "required", $this->req); //$this->form_validation->set_rules('data_set_id', 'Data Set', "required", $this->req); if(!$id){ $this->form_validation->set_rules('password', 'Password', "required", $this->req); } if(@$this->form_validation->run() == FALSE){ $inf['errors']=$this->form_validation->get_errors(); }else{ $data=filter_value($post, array('id', 'name', 'email', 'mobile', 'username', 'data_set_id', 'type', 'parent_id', 'status')); if($post['password']){ $data['password']=encrypt_password($post['password']); } $data['type']='CALLER'; $data['modules']=''; if($post['modules']){ $data['modules']=implode(",", $post['modules']); } if($user_id=$this->common->save($data, "users")){ $inf['id']=$user_id; $inf['success']='T'; $inf['msg']='Counselor '.($id?'updated':'added').' successfully'; } } $this->json_data($inf); } function detail($id=USER_ID){ $dtl=$this->counselor->detail($id); $this->json_data($dtl); } function delete(){ $inf=array('success'=>'F', 'msg'=>'Can not deleted!'); $id=intval($this->input->post('id')); if($this->counselor->delete($id)){ $inf['success']='T'; $inf['msg']="Counselor deleted successfully"; } $this->json_data($inf); } function assign_dataset(){ $id=intval($this->input->post('id')); $user_id=intval($this->input->post('user_id')); $inf=array('success'=>false, 'msg'=>'Error!'); if(!$user_id || !$id){ $this->json_data($inf); } $d=['id'=>$user_id, 'data_set_id'=>$id]; if($this->common->save($d, "users")){ $inf['data_set']=$this->db->get_where("leads_data_sets", array('id'=>$id))->row()->title; $inf['success']=true; $inf['msg']='Data set assigned'; } $this->json_data($inf); } } //EOF