%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'); /** * Description of VideoUpload * * @author : Sharda Tech Pvt. Ltd */ class Econtent extends CI_Controller { //variable for storing error message private $error; //variable for storing success message private $success; function __construct() { parent::__construct(); $this->load->database(); $this->load->model("Econtent_Model"); $this->load->model("result_model"); $this->lang->load('basic', $this->config->item('language')); // redirect if not loggedin if(!$this->session->userdata('logged_in')){ redirect('login'); } } //appends all error messages private function handle_error($err) { $this->error .= $err . "\r\n"; } //appends all success messages private function handle_success($succ) { $this->success .= $succ . "\r\n"; } public function index(){ $data = array(); $condArray = array(); $logged_in=$this->session->userdata('logged_in'); $assignedModule = assignModuleList($logged_in['role_id']); if(!array_key_exists('econtent',$assignedModule)) { exit($this->lang->line('permission_denied')); } if($_POST['search']){ $condArray['search'] = $_POST['search']; } if($_POST['gid']){ $condArray['gid'] = $_POST['gid']; $data['gid'] = $_POST['gid']; } $uid = ''; $list_gid = ''; if($logged_in['su']=='1') { $uid = $logged_in['uid']; $list_gid = explode(',',$logged_in['gid']); $condArray['admin_id'] = $uid; } else if($logged_in['su']=='0') { $condArray['status'] = '2'; $gid = $logged_in['gid']; $condArray['gid'] = $gid; } // Page Title $data['title'] = $this->lang->line('econtent'); // Get All user Records $data['recorddetails'] = $this->Econtent_Model->getAllEcontent($condArray); // Get Class List $data['groupList'] = $this->Econtent_Model->group_list(NULL, $list_gid); $this->load->view('header',$data); $this->load->view('econtent/index',$data); $this->load->view('footer',$data); setHistory('Go to manage econtent'); } public function addecontent($id='') { $logged_in=$this->session->userdata('logged_in'); $logged_in=$this->session->userdata('logged_in'); $assignedModule = assignModuleList($logged_in['role_id']); if(!array_key_exists('qbank',$assignedModule)) { exit($this->lang->line('permission_denied')); } // Page Title $data['title'] = 'Add '.$this->lang->line('econtent'); if($id>0){ $data['title'] = 'Edit '.$this->lang->line('econtent'); } $uid = ''; $list_gid = ''; //$uid = $logged_in['uid']; if($logged_in['su']=='1') { $uid = $logged_in['uid']; $list_gid = explode(',',$logged_in['gid']); } else if($logged_in['su']=='0') { $uid = $logged_in['admin_id']; } if ($this->input->post('Submit')=='Save e-Content'){ //set preferences //file upload destination $upload_path = './upload/econtent/'; $config['upload_path'] = $upload_path; //allowed file types. * means all types $config['allowed_types'] = '*'; //'wmv|mp4|avi|mov|pdf|jpeg|jpg'; //allowed max file size. 0 means unlimited file size $config['max_size'] = '0'; //max file name size $config['max_filename'] = '255'; //whether file name should be encrypted or not $config['encrypt_name'] = FALSE; //store video info once uploaded $video_data = array(); //check for errors $is_file_error = FALSE; //check if file was selected for upload if (!$_FILES && empty($_POST['old_image'])) { $is_file_error = TRUE; $this->handle_error('Select a e-Content file.'); } //if file was selected then proceed to upload if (!$is_file_error) { //load the preferences $this->load->library('upload', $config); //check file successfully uploaded. 'vfile_name' is the name of the input if (!$this->upload->do_upload('vfile_name')) { //if file upload failed then catch the errors $this->handle_error($this->upload->display_errors()); $is_file_error = TRUE; } else { //store the video file info $video_data = $this->upload->data(); } } // There were errors, we have to delete the uploaded video if ($is_file_error && empty($_POST['old_image'])) { die; if ($video_data) { $file = $upload_path . $video_data['file_name']; if (file_exists($file)) { unlink($file); } } } else { $parms = array(); if($_POST['old_image']!='' && $video_data['file_name']=='') { $parms['vfile_name'] = $_POST['old_image']; } else { $parms['vfile_name'] = $video_data['file_name']; } //$parms['video_path'] = $upload_path; // $parms['video_type'] = $video_data['file_type']; if($uid>0){ $parms['admin_id'] = $uid; } $parms['gid'] = implode(',',$this->input->post('gid')); $parms['title'] = $this->input->post('title'); $parms['description'] = $this->input->post('description'); $parms['tags'] = $this->input->post('tags'); $parms['ltype'] = $this->input->post('ltype'); $parms['status'] = $this->input->post('status'); $parms['notification'] = $this->input->post('notification'); if($this->input->post('id')){ $id = $this->input->post('id'); $this->Econtent_Model->updateinfo($tbl_name='tbl_library_master',$parms,'id',$id); setHistory('E-Content Info Updated successfully'); if($this->input->post('status')=='2' && $this->input->post('notification')=='1') { $parms['id'] = $id; $this->pushalertnotification($parms); } } else { $resp = $this->Econtent_Model->saveinfo($tbl_name='tbl_library_master',$parms); setHistory('E-Content Info Added successfully'); if($this->input->post('status')=='2' && $this->input->post('notification')=='1') { $parms['id'] = $resp; $this->pushalertnotification($parms); } } redirect('econtent'); } } $id = $_GET['edit']; if($id>0){ $data['sd'] = $this->Econtent_Model->getSingleRecord('tbl_library_master',' * ', array('id'=>$id)); } // Get Class List $data['groupList'] = $this->Econtent_Model->group_list(NULL, $list_gid); //load the error and success messages $data['errors'] = $this->error; $data['success'] = $this->success; //load the view along with data $this->load->view('header',$data); $this->load->view('econtent/addcontent',$data); $this->load->view('footer'); setHistory('Go to Add e-content'); } /* * Function : viewcontent * * */ public function viewcontent($vfileName) { $data = array(); $condArray = array(); $logged_in=$this->session->userdata('logged_in'); $assignedModule = assignModuleList($logged_in['role_id']); if(!array_key_exists('econtent',$assignedModule)) { exit($this->lang->line('permission_denied')); } $data['title'] = $this->lang->line('econtent'); $uid = ''; if($logged_in['su']=='1') { $uid = $logged_in['uid']; $condArray['admin_id'] = $uid; } else if($logged_in['su']=='0') { $condArray['status'] = '2'; $gid = $logged_in['gid']; $condArray['gid'] = $gid; } if($vfileName!=''){ $condArray['id'] = $vfileName; } $data['sd'] = $sd = $this->Econtent_Model->getSingleRecord('tbl_library_master',' * ', $condArray); // Get User Details $data['authorArray'] = $this->Econtent_Model->getSingleRecord('savsoft_users',' * ', array('uid'=>$sd['admin_id'])); $data['title'] = $sd['title'].' - '.$this->lang->line('econtent'); // Get Class List if($uid>0){ $data['groupList'] = $this->Econtent_Model->group_list($uid); } // Set Hit counter $this->Econtent_Model->set_counter($sd['id']); $this->load->view('header',$data); $this->load->view('econtent/viewcontent',$data); $this->load->view('footer'); setHistory('Go to view e-content - '.$sd['title']); } /* * * function : pushNotification * */ public function pushalertnotification($data){ $params = array(); $params['gid'] = $data['gid']; $url = site_url('econtent/viewcontent/'.$data['id']); $params['title'] = 'An E-content "'.$data["title"].'" is added to your dashboard'; $params['description'] = 'Dear Students,<br/><br/> An E-Content <strong>"'.$data["title"].'"</strong> has been published on Quizbyte for your usal. For more information please click the below link<br/>'.'<a href="'.$url.'">'.$url.'</a>'; $params['status'] = '2'; $params['admin_id'] = $data['admin_id']; $params['createdon'] = date('Y-m-d H:i:s A'); $resp = $this->Econtent_Model->saveinfo($tbl_name='tbl_notifications_master',$params); setHistory('E-Content Notification Info Added successfully'); } }