%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 Program extends MY_Controller { function __construct() { parent::__construct(); not_logged_res(); $this->checkAccess('manage_programs'); $this->load->model("program_model", "prog"); $this->load->model("master_model", "master"); } function lists(){ $data=$this->prog->lists(); $this->json_data($data); } function save(){ $inf=array('success'=>'F', 'msg'=>'Error!'); $post=trim_array($this->input->post()); if($post){ $id=$post['id']=intval($post['id']); $this->form_validation->set_rules('title', 'Name', "required|is_unique[master_programs.title.id!='$id']", $this->req); $this->form_validation->set_rules('fee', 'Fee', "numeric", $this->req); $inf['success']='F'; 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', 'eligibility', 'highlights', 'fee', 'reg_sms', 'status')); /** Image */ if($_FILES['image']['name'] && check_image_ext($_FILES['image']['name'])){ $this->load->library('Image'); $oldimg=''; if($id){ $oldimg=$this->db->select("image")->get_where("master_programs", array('id'=>$id))->row()->image; } $filename=append_to_filename($_FILES['image']['name'], time()); if($this->image->resize($_FILES['image']['tmp_name'], UP_PATHF.'programs_images/'.$filename, 600)){ $data['image']=$filename; if($oldimg){ del_file(UP_PATHF.'programs_images/'.$oldimg); } } } /** \ */ /** Brochure */ if($_FILES['brochure']['name'] && strtolower(get_ext($_FILES['brochure']['name'])) == 'pdf'){ $oldpdf=''; if($id){ $oldpdf=$this->db->select("brochure")->get_where("master_programs", array('id'=>$id))->row()->brochure; } $filename=append_to_filename($_FILES['brochure']['name'], time()); if(move_uploaded_file($_FILES['brochure']['tmp_name'],UP_PATHF.'brochure/'.$filename)){ $data['brochure']=$filename; if($oldimg){ del_file(UP_PATHF.'brochure/'.$oldpdf); } } } /** \ */ if($program_id=$this->common->save($data, "master_programs")){ $inf['success']='T'; $inf['msg']='Center of Excellence '.($id?'updated':'added').' successfully'; } } $this->json_data($inf); } } function detail($id=0){ $dtl=$this->prog->detail($id); $this->json_data($dtl); } function delete(){ $inf=array('success'=>'F', 'msg'=>'Can not deleted!'); $id=intval($this->input->post('id')); $img=$this->db->select("image")->get_where("master_programs", array('id'=>$id))->row()->image; $brochure=$this->db->select("brochure")->get_where("master_programs", array('id'=>$id))->row()->brochure; if($this->prog->delete($id)){ if($img){ del_file(UP_PATHF.'programs_images/'.$img); } if($brochure){ del_file(UP_PATHF.'brochure/'.$brochure); } $inf['success']='T'; $inf['msg']="Program deleted successfully"; } $this->json_data($inf); } function removeImage(){ $inf=array('success'=>'F', 'msg'=>'Can not removed!'); $id=intval($this->input->post('id')); $img=$this->db->select("image")->get_where("master_programs", array('id'=>$id))->row()->image; if($this->common->save(array('id'=>$id, 'image'=>''), "master_programs")){ if($img){ del_file(UP_PATHF.'programs_images/'.$img); } $inf['success']='T'; $inf['msg']="Image removed successfully"; } $this->json_data($inf); } function removeBrochure(){ $inf=array('success'=>'F', 'msg'=>'Can not removed!'); $id=intval($this->input->post('id')); $img=$this->db->select("brochure")->get_where("master_programs", array('id'=>$id))->row()->brochure; if($this->common->save(array('id'=>$id, 'brochure'=>''), "master_programs")){ if($img){ del_file(UP_PATHF.'brochure/'.$img); } $inf['success']='T'; $inf['msg']="Brochure removed successfully"; } $this->json_data($inf); } } //EOF