%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 date_default_timezone_set("Asia/Kolkata"); class Call_inquiries_model extends CI_Model { public function __construct() { parent::__construct(); } public function deleteProduct($id) { $this->db->trans_begin(); $this->db->where('id', $id); if (!$this->db->delete('health_advisor')) { log_message('error', print_r($this->db->error(), true)); } if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); show_error(lang('database_error')); } else { $this->db->trans_commit(); } } public function productsCount($search_title = null, $category = null) { if ($search_title != null) { $search_title = trim($this->db->escape_like_str($search_title)); $this->db->where("(health_advisor.mobile_number LIKE '%$search_title%')"); } return $this->db->count_all_results('health_advisor'); } public function getProducts($limit, $page, $search_title = null, $orderby = null, $category = null, $to_date, $from_date) { if ($search_title != null) { $search_title = trim($this->db->escape_like_str($search_title)); $this->db->where("(health_advisor.mobile_number LIKE '%$search_title%')"); } if ($orderby !== null) { $ord = explode('=', $orderby); if (isset($ord[0]) && isset($ord[1])) { $this->db->order_by('health_advisor.' . $ord[0], $ord[1]); } } else { $this->db->order_by('id', 'desc'); } if ($category != null) { $this->db->where('type', $category); } if ($vendor != null) { $this->db->where('vendor_id', $vendor); } if ($to_date != null) { $this->db->where('requestedOn>=', $to_date); } if ($from_date != null) { $this->db->where('requestedOn<=', $from_date); } if(!$query = $this->db->select('id,mobile_number,requestedOn,call_response,otp')->get('health_advisor' , $limit, $page)){ log_message('error', print_r($this->db->error(), true)); } //print_r($from_date);die; //echo$qqq=$this->db->last_query(); die; return $query->result(); } public function getAllProducts(){ $this->db->where('shop_categorie', '2'); $query = $this->db->select('id,name,email,contact,company,message')->get('feedback'); return $query->result(); } public function numShopProducts() { return $this->db->count_all_results('health_advisor'); } public function getOneProduct($id) { $this->db->select('vendors.name as vendor_name, vendors.id as vendor_id, products.*'); $this->db->where('products.id', $id); $this->db->join('vendors', 'vendors.id = products.vendor_id', 'left'); $query = $this->db->get('products'); if ($query->num_rows() > 0) { return $query->row_array(); } else { return false; } } public function productStatusChange($id, $to_status) { $this->db->where('id', $id); $result = $this->db->update('products', array('visibility' => $to_status)); return $result; } public function setResponse($post) { //print_r($post); $id=$post['id']; $this->db->trans_begin(); $is_update = false; $history=array(); if ( $id > 0) { if($post['history']!=''){ $history=explode(",",$post['history']); } array_push($history,$post['call_response']); //print_r($history); $call_response=serialize($history); //echo $call_response;die; if(!$result = $this->db->where('id', $id)->update('health_advisor', array('call_response' => $call_response,'modified_on' => date('Y-m-d h:i:s')))){ log_message('error', print_r($this->db->error(), true)); } //echo $qqq=$this->db->last_query();die; return $result; } } private function setProductTranslation($post, $id, $is_update) { $i = 0; $current_trans = $this->getTranslations($id); foreach ($post['translations'] as $abbr) { $arr = array(); $emergency_insert = false; if (!isset($current_trans[$abbr])) { $emergency_insert = true; } $post['title'][$i] = str_replace('"', "'", $post['title'][$i]); $post['tag_line'][$i] = str_replace(' ', '', $post['tag_line'][$i]); $post['price'][$i] = str_replace(' ', '', $post['price'][$i]); $post['price'][$i] = str_replace(',', '', $post['price'][$i]); $arr = array( 'title' => $post['title'][$i], 'tag_line' => $post['tag_line'][$i], 'recommended_for' => $post['recommended_for'][$i], 'gender' => $post['gender'][$i], 'reporting_time' => $post['reporting_time'][$i], 'fasting_time' => $post['fasting_time'][$i], 'precautions' => $post['precautions'][$i], 'basic_description' => $post['basic_description'][$i], 'description' => $post['description'][$i], 'price' => $post['price'][$i], 'old_price' => $post['old_price'][$i], 'abbr' => $abbr, 'for_id' => $id ); if ($is_update === true && $emergency_insert === false) { $abbr = $arr['abbr']; unset($arr['for_id'], $arr['abbr'], $arr['url']); if (!$this->db->where('abbr', $abbr)->where('for_id', $id)->update('products_translations', $arr)) { log_message('error', print_r($this->db->error(), true)); } } else { if (!$this->db->insert('products_translations', $arr)) { log_message('error', print_r($this->db->error(), true)); } } $i++; } } public function getTranslations($id) { $this->db->where('for_id', $id); $query = $this->db->get('products_translations'); $arr = array(); foreach ($query->result() as $row) { $arr[$row->abbr]['title'] = $row->title; $arr[$row->abbr]['tag_line'] = $row->tag_line; $arr[$row->abbr]['fasting_time'] = $row->fasting_time; $arr[$row->abbr]['reporting_time'] = $row->reporting_time; $arr[$row->abbr]['gender'] = $row->gender; $arr[$row->abbr]['recommended_for'] = $row->recommended_for; $arr[$row->abbr]['precautions'] = $row->precautions; $arr[$row->abbr]['basic_description'] = $row->basic_description; $arr[$row->abbr]['description'] = $row->description; $arr[$row->abbr]['price'] = $row->price; $arr[$row->abbr]['old_price'] = $row->old_price; } return $arr; } }