%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 defined('BASEPATH') OR exit('No direct script access allowed'); error_reporting(0); class PatientStory extends CI_Controller { /** * Index Page for this controller. * * Maps to the following URL * http://example.com/index.php/welcome * - or - * http://example.com/index.php/welcome/index * - or - * Since this controller is set as the default controller in * config/routes.php, it's displayed at http://example.com/ * * So any other public methods not prefixed with an underscore will * map to /index.php/welcome/<method_name> * @see https://codeigniter.com/user_guide/general/urls.html */ function __construct() { parent::__construct(); if((!isset($_SESSION['is_logged']))||($_SESSION['is_logged']==false)) { $_SESSION['redirect'] = base_url()."admin/PatientStory/view_patient_stories"; redirect(base_url().'admin/login'); } $this->load->model('patient_story_model', 'patient_story'); //$this->load->model('nationality_model', 'nationality'); $this->load->model('department_model', 'department'); $this->load->model('health_library_model', 'condition'); $this->load->model('Common_Model'); } public function index() { $this->view_patient_stories(); } public function add_patient_story($id=0) { $data = array(); $data['data_string'] = ''; $patient_storyID = $id; echo '<script>console.log("add patient_story")</script>'; if($id){ $records = $this->patient_story->get_patient_story($id); echo '<script>console.log("update patient_story")</script>'; if(!$records){ show_404(); } else{ $data = array( 'PatientStoryID' => $records['PatientStoryID'], 'PatientStoryTitle' => $records['PatientStoryTitle'], 'PatientStoryDepartment' => $records['PatientStoryDepartment'], 'PatientStoryContent' => $records['PatientStoryContent'], 'PatientStoryCondition' => $records['PatientStoryCondition'], 'PatientStoryTestimonial' => $records['PatientStoryTestimonial'], 'PatientStoryNationality' => $records['PatientStoryNationality'], 'PatientStoryDate' => $records['PatientStoryDate'], 'PatientStoryThumbnail' => $records['PatientStoryThumbnail'], 'PatientStoryBanner' => $records['PatientStoryBanner'], 'PatientStoryPriorityOrder' => $records['PatientStoryPriorityOrder'], 'Status' => $records['Status'], 'PatientStoryPageURL' => $records['PatientStoryPageURL'] ); } } $post=$this->input->post(); if($post){ echo '<script>console.log("post")</script>'; $this->form_validation->set_rules('PatientStoryTitle', 'Patient Story Title', 'required'); $this->form_validation->set_rules('PatientStoryDepartment', 'Patient Story Department', 'required'); $this->form_validation->set_rules('PatientStoryContent', 'Patient Story Content', 'required'); // $this->form_validation->set_rules('PatientStoryCondition', 'Patient Story Condition', 'required'); // $this->form_validation->set_rules('PatientStoryNationality', 'Patient Story Nationality', 'required'); $this->form_validation->set_rules('PatientStoryPageURL', 'Slug', 'required'); if ($this->form_validation->run() == FALSE) { echo '<script>console.log("Error in validating doctor")</script>'; //console.log("Error in validating doctor"); $this->load->view('admin/addPatientStory'); } else { $banner = ''; $thumbnail = ''; if($_FILES['banner']['name']){ $banner = $this->do_upload('banner', './uploads/patient_story', 'pst_bn_'.$post['PatientStoryPageURL']); $data['error'] = array('error' => $this->upload->display_errors()); } if($_FILES['thumbnail']['name']){ $thumbnail = $this->do_upload('thumbnail', './uploads/patient_story', 'pst_thumb_'.$post['PatientStoryPageURL']); $data['error'] = array('error' => $this->upload->display_errors()); } if( (($_FILES['banner']['name'])&&(!$banner)) || (($_FILES['thumbnail']['name'])&&(!$thumbnail)) ){ echo '<script>console.log("fail upload")</script>'; $this->load->view('admin/AddPatientStory',$data); } else{ if(isset($post['PatientStoryID'])){ $patient_storyID = $post['PatientStoryID']; } $insert_data = array( 'PatientStoryTitle' => $post['PatientStoryTitle'], 'PatientStoryDepartment' => $post['PatientStoryDepartment'], 'PatientStoryContent' => addslashes($post['PatientStoryContent']), 'PatientStoryCondition' => $post['PatientStoryCondition'], 'PatientStoryTestimonial' => $post['PatientStoryTestimonial'], 'PatientStoryNationality' => $post['PatientStoryNationality'], 'PatientStoryDate' => $post['PatientStoryDate'], 'PatientStoryThumbnail' => $thumbnail, 'PatientStoryBanner' => $banner, 'PatientStoryPriorityOrder' => $post['PatientStoryPriorityOrder'], 'Status' => $post['Status'], 'PatientStoryPageURL' => $post['PatientStoryPageURL'] ); $success = ''; echo '<script>console.log("'.$patient_storyID.'")</script>'; if($patient_storyID){ $success = $this->patient_story->update_patient_story($insert_data,$patient_storyID); } else{ $success = $this->patient_story->insert_patient_story($insert_data); echo '<script>console.log("'.$success.'")</script>'; } if($success){ redirect(base_url()."admin/PatientStory/view_patient_stories"); } } } } $data['nationalities'] = $this->Common_Model->getCommonQuery('SH_Nationalities'); $data['conditions'] = $this->condition->get_health_conditions(); $data['departments'] = $this->department->get_departments('DepartmentID, DepartmentName', array('Sub-department','Speciality')); $this->load->view('admin/AddPatientStory',$data); } public function update_patient_story($id){ $this->add_patient_story($id); } public function view_patient_story($id=0) { $data = array(); $data['data_string'] = ''; if($id){ $data = $this->patient_story->get_patient_stories(); if(!$records){ show_404(); } else{ $data = array( 'PatientStoryID' => $records['PatientStoryID'], 'PatientStoryTitle' => $records['PatientStoryTitle'], 'PatientStoryDepartment' => $records['PatientStoryDepartment'], 'PatientStoryContent' => $records['PatientStoryContent'], 'PatientStoryCondition' => $records['PatientStoryCondition'], 'PatientStoryTestimonial' => $records['PatientStoryTestimonial'], 'PatientStoryNationality' => $records['PatientStoryNationality'], 'PatientStoryDate' => $records['PatientStoryDate'], 'PatientStoryThumbnail' => $records['PatientStoryThumbnail'], 'PatientStoryBanner' => $records['PatientStoryBanner'], 'PatientStoryPriorityOrder' => $records['PatientStoryPriorityOrder'], 'Status' => $records['Status'], 'PatientStoryPageURL' => $records['PatientStoryPageURL'] ); } } $this->load->view('admin/ViewPatientStory',$data); } public function view_patient_stories() { $data = array(); $data['records'] = $this->patient_story->get_patient_stories(); if(!$data){ show_404(); } $this->load->view('admin/ViewPatientStories',$data); } public function remove_patient_story($id) { $data = array(); if($this->patient_story->delete_patient_story($id)){ $data['msg'] = 'Patient Story deleted succesfully'; } else{ $data['msg'] = 'Patient Story could not be deleted'; } $data['records'] = $this->patient_story->get_patient_stories(); if(!$data){ show_404(); } $this->load->view('admin/ViewHealthConditions',$data); } }