%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'); Class Custompage extends CI_Controller { function __construct(){ parent::__construct(); $this->load->model('Common_Model'); if(! $this->session->userdata('adid')) { redirect('admin/login'); } } /* * Function : index * Desc : listing all records */ public function index() { $data = array(); $header = array(); $data['courseArray'] = $this->Common_Model->getCommonIdArray('tbl_course_master'); $data['recordsArray'] = $recordsArray = $this->Common_Model->getCommonQuery('tbl_custompage'); $this->load->view('admin/_parts/header'); $this->load->view('admin/custompage/index',$data); $this->load->view('admin/_parts/footer'); setHistory('Go to Change Password'); } /* * Function : addrecord * Desc : For particular Record */ public function addrecord($id='') { // School Array $data = array(); if($_POST){ $this->form_validation->set_rules('equipment_type','Equipment Type','required'); $this->form_validation->set_rules('department','Department','required'); $this->form_validation->set_rules('location','Location','required'); $this->form_validation->set_rules('manufacture','Manufacture','required'); $this->form_validation->set_rules('sno','SNo','required'); $this->form_validation->set_rules('asset_tag','Asset Tag','required'); $this->form_validation->set_rules('model','Model','required'); $this->form_validation->set_rules('waranty_expiry','Waranty Expiry','required'); $this->form_validation->set_rules('custodian','Custodian','required'); $this->form_validation->set_rules('last_pmdate','Last PM Date','required'); $this->form_validation->set_rules('status','Status','required'); if($this->form_validation->run()) { $equipment_type = $this->input->post('equipment_type'); $department = $this->input->post('department'); $location = $this->input->post('location'); $manufacture = $this->input->post('manufacture'); $sno = $this->input->post('sno'); $asset_tag = $this->input->post('asset_tag'); $model = $this->input->post('model'); $custodian = $this->input->post('custodian'); $last_pmdate = $this->input->post('last_pmdate'); $waranty_expiry = $this->input->post('waranty_expiry'); $status = $this->input->post('status'); $data = array( 'equipment_type'=>$equipment_type, 'custodian'=>$custodian, 'last_pmdate'=>date('Y-m-d',strtotime($last_pmdate)), 'department'=>$department, 'location'=>$location, 'manufacture'=>$manufacture, 'sno'=>$sno, 'asset_tag'=>$asset_tag, 'waranty_expiry'=>$waranty_expiry, 'model'=>$model, 'custom_slug'=>str_replace(' ','-',strtolower($asset_tag)), 'status'=>$status, 'is_deleted'=>'0', 'createdon'=>date('y-m-d H:i:s') ); $records = $this->Common_Model->getSingleRecord('tbl_custompage',' * ', array('asset_tag'=>$asset_tag)); if(!empty($records)){ $id = $records['id']; $this->Common_Model->updateinfo($tbl_name='tbl_custompage',$data,'id',$id); setHistory('Info Auto Updated successfully'); } else { if($this->input->post('id')){ $id = $this->input->post('id'); $this->Common_Model->updateinfo($tbl_name='tbl_custompage',$data,'id',$id); setHistory('Info Updated successfully'); } else { $this->Common_Model->saveinfo($tbl_name='tbl_custompage',$data); setHistory('Info Added successfully'); } } redirect('admin/custompage'); } else { $this->load->view('admin/custompage/addrecord'); setHistory('Error! Add/Edit Custom page'); } } else { $data['sd'] = $this->Common_Model->getSingleRecord('tbl_custompage',' * ', array('id'=>$id)); $this->load->view('admin/_parts/header'); $this->load->view('admin/custompage/addrecord',$data); $this->load->view('admin/_parts/footer'); if($id>0){ setHistory('Go to Edit custom page'); } else { setHistory('Go to Add custom page'); } } } /* * Function : deleterecord * Desc : For records deletion */ public function deleterecord($uid) { $this->Common_Model->deleterecords('tbl_custompage',$uid); $this->session->set_flashdata('success', 'Data deleted'); setHistory('Current record deleted successfully'); redirect('admin/custompage'); } /* * Function : downloadreport */ private function downloadreport($data) { //print_r($data); die; header("Content-Disposition: attachment; filename=programme-po-pso-statement-".time().".csv"); $file = fopen('php://output', 'w'); $header = array("Sr. No.","Programme","Statement Type", "Title","Statement","Status"); fputcsv($file, $header); $i=1; $recordsArray = $data['recordsArray']; $programArray = $data['programmedetails']; foreach ($recordsArray as $row){ $programme_name = $programArray[$row['programme_id']]['program_name'].' ('.$programArray[$row['programme_id']]['program_code'].')'; $status = $row['status']=='1' ? 'Active' : 'Inactive'; $statement_type = $row['statement_type']=='1' ? "PO Statement": "PSO Statement"; $title = strip_tags($row['title']); $statement = strip_tags($row['statement']); $data=array($i,$programme_name,$statement_type, $title,$statement,$status); fputcsv($file,$data); $i++; } fclose($file); exit; } /* * function : bulkupload */ public function bulkupload() { $data = array(); $head = array(); $uid = $this->session->userdata('adid'); if(isset($_POST["submit"])) { $file = $_FILES['program_file']['tmp_name']; $handle = fopen($file, "r"); $c = 0; $postArray = array(); while(($filesop = fgetcsv($handle, 1000, ",")) !== false) { $equipment_type = $filesop[0]; $department = $filesop[1]; $location = $filesop[2]; $manufacture = $filesop[3]; $sno = $filesop[4]; $asset_tag = $filesop[5]; $model = $filesop[6]; $waranty_expiry = $filesop[7]; $custodian = $filesop[8]; $last_pmdate = $filesop[9]; $user_id = $uid->id; // Get All details if($c<>0){ /* SKIP THE FIRST ROW */ // Get Course Details $singleRow = $this->Common_Model->getSingleRecord('tbl_custompage','id', array('status'=>'1', 'is_deleted'=>'0','asset_tag'=>$asset_tag)); if($singleRow['id']>0) { $postArray['equipment_type'] = $equipment_type; $postArray['department'] = $department; $postArray['location'] = $location; $postArray['manufacture'] = $manufacture; $postArray['sno'] = $sno; $postArray['asset_tag'] = $asset_tag; $postArray['model'] = $model; $postArray['waranty_expiry'] = $waranty_expiry; $postArray['custodian'] = $custodian; $postArray['last_pmdate'] = date('Y-m-d',strtotime($last_pmdate)); $postArray['user_id'] = $user_id; $postArray['custom_slug'] = strtolower($asset_tag); $postArray['modifiedon'] = date('Y-m-d H:i:s'); $id = $singleRow['id']; // Set All records //print_r($postArray); die; $this->Common_Model->updateinfo('tbl_custompage',$postArray,'id',$id); } else { $postArray['equipment_type'] = $equipment_type; $postArray['department'] = $department; $postArray['location'] = $location; $postArray['manufacture'] = $manufacture; $postArray['sno'] = $sno; $postArray['asset_tag'] = $asset_tag; $postArray['model'] = $model; $postArray['waranty_expiry'] = $waranty_expiry; $postArray['custodian'] = $custodian; $postArray['last_pmdate'] = date('Y-m-d',strtotime($last_pmdate)); $postArray['custom_slug'] = strtolower($asset_tag); $postArray['user_id'] = $user_id; $postArray['createdon'] = date('Y-m-d H:i:s'); //print_r($postArray); die; // Save All records $this->Common_Model->saveinfo('tbl_custompage',$postArray); //die; } } $c = $c + 1; } $this->session->set_flashdata('success', '<span class="alert alert-success">All record added successfully</span>'); redirect('admin/custompage'); } } }