%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: Amit Verma */ if (!defined('BASEPATH')) { exit('No direct script access allowed'); } class Publish extends ADMIN_Controller { public function __construct() { parent::__construct(); $this->load->model(array( 'Products_model', 'Languages_model', 'Brands_model', 'Categories_model' )); } public function index($id = 0) { $this->login_check(); $is_update = false; $trans_load = null; if ($id > 0 && $_POST == null) { $_POST = $this->Products_model->getOneProduct($id); $trans_load = $this->Products_model->getTranslations($id); } if (isset($_POST['submit'])) { $result=$this->check_input($id); if($result==true){ if (isset($_GET['to_lang'])) { $id = 0; } $_POST['image'] = $this->uploadImage(); $_POST['slug'] = valid_seo_friendly_url($_POST['title']); $this->Products_model->setProduct($_POST, $id); $this->session->set_flashdata('result_publish', 'Product is published!'); if ($id == 0) { $this->saveHistory('Success published product'); } else { $this->saveHistory('Success updated product'); } if (isset($_SESSION['filter']) && $id > 0) { $get = ''; foreach ($_SESSION['filter'] as $key => $value) { $get .= trim($key) . '=' . trim($value) . '&'; } redirect(base_url('admin/products?' . $get)); } else { redirect('admin/products'); } } else{ $this->session->set_flashdata('result_error', $this->registerErrors); $this->load->view('_parts/header'); $this->load->view('ecommerce/publish'); $this->load->view('_parts/footer'); } } $data = array(); $head = array(); $head['title'] = 'Administration - Publish Product'; $head['description'] = '!'; $head['keywords'] = ''; $data['id'] = $id; $data['trans_load'] = $trans_load; $data['languages'] = $this->Languages_model->getLanguages(); $data['shop_categories'] = $this->Categories_model->getShopCategories(); $data['risk_categories'] = $this->Categories_model->getTestsCategories(); $data['all_products'] = $this->Products_model->getAllProducts(); $data['brands'] = $this->Brands_model->getBrands(); $data['otherImgs'] = $this->loadOthersImages(); $this->load->view('_parts/header', $head); $this->load->view('ecommerce/publish', $data); $this->load->view('_parts/footer'); $this->saveHistory('Go to publish product'); } private function uploadImage() { $config['upload_path'] = './attachments/shop_images/'; $config['allowed_types'] = $this->allowed_img_types; $this->load->library('upload', $config); $this->upload->initialize($config); if (!$this->upload->do_upload('userfile')) { log_message('error', 'Image Upload Error: ' . $this->upload->display_errors()); } $img = $this->upload->data(); return $img['file_name']; } /* validation */ private function check_input($id) { $errors = array(); $ifexist=$this->Products_model->ifTestExist($_POST['test_code'],$id); if (mb_strlen(trim($_POST['test_code'])) == 0) { $errors[] = 'Test Code cannot be empty'; } else if($ifexist){ $errors[] = 'Test Code Already Exist'; } else if (mb_strlen(trim($_POST['title'])) == 0) { $errors[] = 'Title cannot be empty'; } else if (mb_strlen(trim($_POST['reporting_time'])) == 0) { $errors[] = 'Report Time cannot be empty'; } else if (mb_strlen(trim($_POST['fasting_time'])) == 0) { $errors[] = 'Please Fasting Time'; } else if (mb_strlen(trim($_POST['old_price'])) == 0) { $errors[] = 'Old Price cannot be empty'; } else if (mb_strlen(trim($_POST['price'])) == 0) { $errors[] = 'Price cannot be empty'; } else if (mb_strlen(trim($_POST['shop_categorie'])) == 0) { //$errors[] = 'Category cannot be empty'; } else if (mb_strlen(trim($_POST['sample'])) == 0) { $errors[] = 'Sample cannot null'; } if (!empty($errors)) { $this->registerErrors = $errors; return false; } return true; } /* * called from ajax */ public function do_upload_others_images() { if ($this->input->is_ajax_request()) { $upath = '.' . DIRECTORY_SEPARATOR . 'attachments' . DIRECTORY_SEPARATOR . 'shop_images' . DIRECTORY_SEPARATOR . $_POST['folder'] . DIRECTORY_SEPARATOR; if (!file_exists($upath)) { mkdir($upath, 0777); } $this->load->library('upload'); $files = $_FILES; $cpt = count($_FILES['others']['name']); for ($i = 0; $i < $cpt; $i++) { unset($_FILES); $_FILES['others']['name'] = $files['others']['name'][$i]; $_FILES['others']['type'] = $files['others']['type'][$i]; $_FILES['others']['tmp_name'] = $files['others']['tmp_name'][$i]; $_FILES['others']['error'] = $files['others']['error'][$i]; $_FILES['others']['size'] = $files['others']['size'][$i]; $this->upload->initialize(array( 'upload_path' => $upath, 'allowed_types' => $this->allowed_img_types )); $this->upload->do_upload('others'); } } } public function loadOthersImages() { $output = ''; if (isset($_POST['folder']) && $_POST['folder'] != null) { $dir = 'attachments' . DIRECTORY_SEPARATOR . 'shop_images' . DIRECTORY_SEPARATOR . $_POST['folder'] . DIRECTORY_SEPARATOR; if (is_dir($dir)) { if ($dh = opendir($dir)) { $i = 0; while (($file = readdir($dh)) !== false) { if (is_file($dir . $file)) { $output .= ' <div class="other-img" id="image-container-' . $i . '"> <img src="' . base_url('attachments/shop_images/' . $_POST['folder'] . '/' . $file) . '" style="width:100px; height: 100px;"> <a href="javascript:void(0);" onclick="removeSecondaryProductImage(\'' . $file . '\', \'' . $_POST['folder'] . '\', ' . $i . ')"> <span class="glyphicon glyphicon-remove"></span> </a> </div> '; } $i++; } closedir($dh); } } } if ($this->input->is_ajax_request()) { echo $output; } else { return $output; } } /* * called from ajax */ public function removeSecondaryImage() { if ($this->input->is_ajax_request()) { $img = '.' . DIRECTORY_SEPARATOR . 'attachments' . DIRECTORY_SEPARATOR . 'shop_images' . DIRECTORY_SEPARATOR . '' . $_POST['folder'] . DIRECTORY_SEPARATOR . $_POST['image']; unlink($img); } } public function getServiceList() { $url = 'http://103.101.118.15:2010/api/PatientApp/GetServiceList'; $post = ["HospitalLocationId"=> "1","FacilityId"=>"4","Pincode"=>"0","ServiceId"=>0,"ServiceCategory"=>0,"IsHomeService"=>1,"ServiceType"=>"I"]; $serviceListArray = sdCreatePatient($url, $post); print_r($serviceListArray); die; } }