[490] | 1 | <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
---|
| 2 | |
---|
| 3 | class Servicepackage_model extends MY_Model |
---|
| 4 | { |
---|
| 5 | |
---|
| 6 | protected $table_name = 'tblservicepackage'; |
---|
| 7 | protected $id_name = 'p_id'; |
---|
| 8 | const TOKENPW = 'violet'; |
---|
| 9 | |
---|
[499] | 10 | function __construct() |
---|
| 11 | { |
---|
[490] | 12 | parent::__construct(); |
---|
| 13 | $this->vservices->setApiUrl($this->config->item('api_url')); |
---|
| 14 | $this->vservices->setConnection($this->curl); |
---|
| 15 | } |
---|
| 16 | |
---|
| 17 | function getAllPackages() |
---|
| 18 | { |
---|
[501] | 19 | $this->db->query('UNLOCK TABLES'); |
---|
[654] | 20 | $sql="SELECT * FROM ".$this->table_name." WHERE p_period > 0"; |
---|
[490] | 21 | return $this->db->query($sql)->result_array(); |
---|
| 22 | } |
---|
[662] | 23 | function getTrialPackage() |
---|
| 24 | { |
---|
| 25 | $this->db->query('UNLOCK TABLES'); |
---|
| 26 | $sql="SELECT * FROM ".$this->table_name." WHERE p_period < 0 LIMIT 1"; |
---|
| 27 | return $this->db->query($sql)->row_array(); |
---|
| 28 | } |
---|
[490] | 29 | function getPackage($p_id) |
---|
| 30 | { |
---|
[501] | 31 | $this->db->query('UNLOCK TABLES'); |
---|
[490] | 32 | $sql="SELECT * FROM ".$this->table_name." WHERE ".$this->id_name."=".$p_id; |
---|
| 33 | return $this->db->query($sql)->row_array(); |
---|
| 34 | } |
---|
[499] | 35 | |
---|
| 36 | function getPackagePriceByCode ($p_code) |
---|
| 37 | { |
---|
[501] | 38 | $this->db->query('UNLOCK TABLES'); |
---|
[499] | 39 | $sql='SELECT p_price FROM '. $this->table_name .' WHERE p_code = ?'; |
---|
| 40 | $query = $this->db->query($sql , array($p_code)); |
---|
| 41 | $row = $query->row_array(); |
---|
| 42 | return $row['p_price']; |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | function getPackageByCode ($p_code) |
---|
| 46 | { |
---|
[501] | 47 | $this->db->query('UNLOCK TABLES'); |
---|
[499] | 48 | $sql='SELECT * FROM '. $this->table_name .' WHERE p_code = ?'; |
---|
| 49 | $query = $this->db->query($sql , array($p_code)); |
---|
| 50 | $row = $query->row_array(); |
---|
| 51 | return $row; |
---|
| 52 | } |
---|
[490] | 53 | |
---|
| 54 | } |
---|