backoffice/application/models/Nano_health_model.php

53 lines
1.6 KiB
PHP

<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Created by PhpStorm.
* User: capp
* Date: 29/05/2018
* Time: 15:49
*/
class Nano_health_model extends CI_Model
{
public function createConfig($id_network){
$this->db->insert('nh_networks_configs', ['network_id' => $id_network]);
return $this->db->insert_id();
}
public function getConfig($id_network){
return $this->db->get_where('nh_networks_configs',['network_id'=> $id_network]);
}
public function updateConfig($configId, $data){
$this->db->where('id', $configId);
return $this->db->update('nh_networks_configs', $data);
}
public function getConfigYearsPricesGrid($configId){
return $this->db->get_where('nh_years_prices_grid',['nh_network_config_id'=> $configId]);
}
public function getConfigMonthsPricesGrid($configId){
return $this->db->get_where('nh_months_prices_grid',['nh_network_config_id'=> $configId]);
}
public function getConfigActs($configId){
return $this->db->get_where('nh_acts',['nh_network_config_id'=> $configId]);
}
// Nano sante
public function getAllIlinkWorldNetworks()
{
$query = $this->db->query("SELECT networks.name AS network,networks.status AS status,networks.id,cc.name AS country,networks.country_id , configWallet.id_network , configWallet.type,cc.currency_code,
configWallet.has_nano_health FROM `networks`
INNER JOIN countries_currencies cc ON networks.country_id=cc.id LEFT JOIN configWallet ON configWallet.id_network = networks.id WHERE status = 1 AND configWallet.type = 'ilink'");
if ($query->num_rows() > 0) {
return $query;
} else {
return false;
}
}
}