%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 /* * @Author: Sharda Tech */ if (!defined('BASEPATH')) { exit('No direct script access allowed'); } class Unplanned_Return_to_OT extends MY_Controller { public function __construct() { parent::__construct(); $this->load->library('form_validation','session'); $this->load->Model(array('Common_model','Form_model')); } /* * Function : index * Desc : listing all records */ public function index() { $data = array(); $header = array(); $custom_name = $this->uri->segment(1); $folder_name = $custom_name; $table = 'tbl_'.$custom_name; if (isset($_GET['delete'])) { $this->Common_model->deleterecords($table,$_GET['delete']); setHistory('Selected record '.$_GET['delete'].' is deleted!'); redirect('admin/'.$folder_name); } // Get Form ID from module Table $data['moduleArray'] = $this->Common_model->getSingleRecord('module_list',' * ', array('module_name'=>$custom_name)); $data['recordsArray'] = $recordsArray = $this->Common_model->getAllRecords($table,'*',array('is_deleted'=>'0')); $head['title'] = 'Manage '.$moduleArray['display_name']; $head['description'] = 'Manage '.$moduleArray['display_name']; $head['keywords'] = ''; setHistory('Go to manage '.$folder_name.' module'); $this->load->view('_parts/new_header', $head); $this->load->view($folder_name.'/index',$data); $this->load->view('_parts/new_empty_footer'); } /* * Function: addrecord */ public function addrecord($uid='') { $data = array(); $head = array(); $cs_text = $this->uri->segment(1); $data['moduleArray'] = $moduleArray = $this->Common_model->getSingleRecord('module_list',' * ', array('module_name'=>$cs_text)); $tbl_name = 'tbl_'.$moduleArray['module_name']; $folder_name = $moduleArray['module_name']; $this->form_validation->set_rules('status', 'Status', 'trim|required'); $this->form_validation->set_rules('display_order', 'Display order', 'trim|required'); if ($this->form_validation->run($this)) { unset($_POST['table']); unset($_POST['addrecord']); if($_POST['edit']=='') { $_POST['created_on'] = date('Y-m-d H:i:s'); $this->Common_model->saveinfo($tbl_name,$_POST); } else { $_POST['modifiedon'] = date('Y-m-d H:i:s'); $id = $this->input->post('edit'); unset($_POST['edit']); $this->Common_model->updateinfo($tbl_name,$_POST,'id',$id); } setHistory('Created new '.$folder_name); redirect($folder_name); } $_POST = array(); if(isset($uid)) { $_POST = $this->Common_model->getSingleRecord($tbl_name,' * ', array('id'=>$uid)); } setHistory('Go to Add/Edit '.$folder_name.' module'); $head['title'] = 'Add/Edit '.$folder_name; $head['description'] = 'Add/Edit '.$folder_name; $head['keywords'] = ''; $this->load->view('_parts/new_header', $head); $this->load->view($folder_name.'/add_record',$data); $this->load->view('_parts/new_empty_footer'); } /* * Function : downloadreport */ private function downloadreport($recordsArray) { header("Content-Disposition: attachment; filename=export-records-".time().".csv"); $file = fopen('php://output', 'w'); $header = array("ID","Product Name","Product Description","Display Order","Status"); fputcsv($file, $header); $i=1; foreach ($recordsArray as $value){ $status = $value['status']=='1' ? 'Active' : 'Inactive'; $data=array($i,$value['product_name'], $value['product_description'] ,$value['display_order'],$status); fputcsv($file,$data); $i++; } fclose($file); exit; } /* * Function : uploadImage */ private function uploadImage($image_name, $folder_name) { $config['upload_path'] = './attachments/'.$folder_name.'/'; $config['allowed_types'] = $this->config->item('allowed_img_types'); $this->load->library('upload', $config); $this->upload->initialize($config); if (!$this->upload->do_upload($image_name)) { log_message('error', 'Image Upload Error: '.$this->upload->display_errors()); print_r($this->upload->display_errors()); if($this->upload->display_errors()=='The filetype you are attempting to upload is not allowed.'){ return $this->upload->display_errors(); } } $img = $this->upload->data(); return $img['file_name']; } /* * Function: addManagetermForm */ public function addCstForm() { // //set data $data = ['form_data' => $_POST['formData'], 'addedon' => date('Y-m-d G:i:s'), 'table' => $_POST['table_name'], 'criteria_id' => $_POST['criteria_id'], 'edit' => $_POST['form_id'], 'sub_table' => $_POST['sub_criteria_table']]; print_r($data); $response = $this->Form_model->setForm($data); echo json_encode($response); } public function getCustForm() { // //set data echo json_encode($this->Form_model->getForm($_POST['formId'])); } /* * Function : ajaxgetrecord */ public function ajaxgetrecord() { $school_id = $_POST['school_id']; if ($school_id > 0) { $dataArray = $this->Common_model->getcommonrecorddetail('su_departments', array('school_id' => $school_id)); $response = array(); foreach ($dataArray as $row) { $response[$row['name']] = $row['name']; } header('Content-type: application/json'); echo json_encode($response); } die; } function convertToObject($array) { $object = new stdClass(); foreach ($array as $key => $value) { if (is_array($value)) { $value = convertToObject($value); } $object->$key = $value; } return $object; } //function : removecustomfile function removecustomfile(){ $imgname = $_POST['filename']; $folder = $_POST['filefolder']; $id = $_POST['id']; $table = $_POST['table']; $column = $_POST['column']; $path='attachments/naaccriterias_pdf/'.$folder.'/'.$imgname; $record = $this->Common_model->getSingleRecord($table,'*',array('id'=>$id)); if($record){ $this->Common_model->updateinfo($table,array($column=> NULL,'modifiedon'=>date('Y-m-d H:i:s')),'id',$id); unlink($path); } exit(); } }