limite_credit_min, 2), $currency_code, $context)->formatTo('fr_FR') ?>
+lang->line('minimum_credit_limit') ?>
+limite_credit_max, 2), $currency_code, $context)->formatTo('fr_FR'); ?>
+lang->line('maximum_credit_limit') ?>
+diff --git a/application/controllers/Gestion.php b/application/controllers/Gestion.php index 4989bee8..9d1e71e3 100755 --- a/application/controllers/Gestion.php +++ b/application/controllers/Gestion.php @@ -2058,6 +2058,55 @@ class Gestion extends CI_Controller } } + public function nano_credit() + { + if ($this->isLogged()) { + $data['active'] = "nano_credit"; + $data['alert'] = ""; + $data['game_pays'] = $this->user_model->getGameCountry(); + $data['networks'] = $this->user_model->getAllIlinkWorldNetworks(); + $this->load->view('header_gestion', $data); + $this->load->view('nano_credit/gestion_nano_credits'); + $this->load->view('footer'); + + } + } + + public function activate_nano_credit() + { + if ($this->isLogged()) { + if (isset($_POST)) { + + $id_network = $_POST['id_network']; + $this->user_model->insertCreditLimit(0, 0, '1', $id_network); + $res = true; + + if ($res) { + echo json_encode("200"); + } else { + echo json_encode("500"); + } + } + } + } + + public function delete_nano_credit() + { + if ($this->isLogged()) { + if (isset($_POST)) { + $id_network = $_POST['id_network']; + + $this->user_model->insertCreditLimit(0, 0, '0', $id_network); + $res = true; + + if ($res) { + echo json_encode("200"); + } else { + echo json_encode("500"); + } + } + } + } } diff --git a/application/controllers/Hyperviseur_dash.php b/application/controllers/Hyperviseur_dash.php index 61236e35..0ab482c0 100755 --- a/application/controllers/Hyperviseur_dash.php +++ b/application/controllers/Hyperviseur_dash.php @@ -1175,7 +1175,7 @@ class Hyperviseur_dash extends CI_Controller $config_id = $_POST['config_id']; $rate = $_POST['rate']; $url = $_POST['url']; - $res = $this->user_model->setSharingRate($network_id,$config_id,$rate,$url); + $res = $this->user_model->setSharingRate($network_id, $config_id, $rate, $url); if ($res) { echo json_encode("200"); @@ -1186,6 +1186,50 @@ class Hyperviseur_dash extends CI_Controller } } } + + public function nano_credit() + { + if ($this->isLogged()) { + $data['hasWallet'] = $this->user_model->getConfigWallet($this->session->userdata('network_id')); + $data['active'] = "nano_credit"; + $data['alert'] = ""; + $data['game_pays'] = $this->user_model->getGameCountry(); + $data['network'] = $this->session->userdata('network'); + $data['country'] = $this->session->userdata('current_pays'); + $data['network_id'] = $this->session->userdata('network_id'); + $data['firstname'] = $this->session->userdata('firstname'); + $data['lastname'] = $this->session->userdata('lastname'); + $data['currency_code'] = $this->session->userdata('currency_code'); + $data['token'] = $this->session->userdata('token'); + $data['email'] = $this->session->userdata('email'); + $data['configWallet'] = $data['hasWallet']->first_row(); + $data['villes'] = $this->user_model->getVilleByUserGeo($data['network'], $this->session->userdata('current_pays')); + $this->load->view('header_hyp', $data); + $this->load->view('nano_credit/gestion_nano_credit_hyp'); + $this->load->view('footer'); + + } + } + + public function saveCreditLimit() + { + if ($this->isLogged()) { + if (isset($_POST)) { + $limit_min = $_POST['limit_min']; + $limit_max = $_POST['limit_max']; + $id_network = $_POST['id_network']; + + $this->user_model->insertCreditLimit($limit_min, $limit_max, '1', $id_network); + $res = true; + + if ($res) { + echo json_encode("200"); + } else { + echo json_encode("500"); + } + } + } + } } class Operation diff --git a/application/language/english/message_lang.php b/application/language/english/message_lang.php index 47e55a9c..a1d89bb5 100755 --- a/application/language/english/message_lang.php +++ b/application/language/english/message_lang.php @@ -444,4 +444,16 @@ $lang['incoming_requests'] = 'Incoming requests'; $lang['outgoing_requests'] = 'Outgoing requests'; $lang['incoming_credits_requests'] = 'Incoming credit requests'; $lang['outgoing_credits_requests'] = 'Outgoing credit requests'; +$lang['nanocredit_management'] = 'Nanocredit management'; +$lang['change_the_credit_limit'] = 'Change the credit limit'; +$lang['minimum_credit_limit'] = 'Minimum credit limit'; +$lang['maximum_credit_limit'] = 'Maximum credit limit'; +$lang['credit_limit_rule'] = 'The maximum credit limit must be greater than the minimum limit'; +$lang['update_credit_limit'] = 'Update credit limits'; +$lang['activate_nano_credit'] = 'Activation of Nano credit'; +$lang['ilink_world_networks'] = 'iLink World type networks'; +$lang['credit_limit'] = 'Credit limit'; +$lang['nano_credit_removal'] = 'Removal of nano credit'; +$lang['set_credit_limit'] = 'Set the credit limit'; +$lang['nano_credit_deleted'] = 'Nano credit deleted'; ?> diff --git a/application/language/french/message_lang.php b/application/language/french/message_lang.php index 15a5c44e..8aa0e2e5 100755 --- a/application/language/french/message_lang.php +++ b/application/language/french/message_lang.php @@ -456,5 +456,16 @@ $lang['incoming_requests'] = 'Demandes entrantes'; $lang['outgoing_requests'] = 'Demandes sortantes'; $lang['incoming_credits_requests'] = 'Demandes de crédits entrantes'; $lang['outgoing_credits_requests'] = 'Demandes de crédits sortantes'; - +$lang['nanocredit_management'] = 'Gestion du nano crédit'; +$lang['change_the_credit_limit'] = 'Modifier la limite du crédit'; +$lang['minimum_credit_limit'] = 'Limite de crédit minimale'; +$lang['maximum_credit_limit'] = 'Limite de crédit maximale'; +$lang['credit_limit_rule'] = 'La limite de crédit maximale doit être supérieure à la limite minimale'; +$lang['update_credit_limit'] = 'Mise à jour des limites de crédits'; +$lang['activate_nano_credit'] = 'Activation du Nano credit'; +$lang['ilink_world_networks'] = 'Réseaux de type iLink World'; +$lang['credit_limit'] = 'Limite de crédit'; +$lang['nano_credit_removal'] = 'Suppression du nano crédit'; +$lang['set_credit_limit'] = 'Définir la limite de crédit'; +$lang['nano_credit_deleted'] = 'Nano crédit supprimé'; ?> diff --git a/application/models/User_model.php b/application/models/User_model.php index 57443f9e..1b961121 100755 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -2664,4 +2664,23 @@ class User_model extends CI_Model return false; } } + + // Nano credit + public function insertCreditLimit($limit_min, $limit_max, $has_nano_credit, $id_network) + { + $sql = "UPDATE `configWallet` SET `has_nano_credit` = ?, `limite_credit_min` = ? , `limite_credit_max` = ? WHERE (`id_network` = ? );"; + return $this->db->query($sql, array($has_nano_credit, $limit_min, $limit_max, $id_network)); + } + + 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.limite_credit_min , configWallet.limite_credit_max , configWallet.has_nano_credit 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; + } + } } diff --git a/application/views/header_gestion.php b/application/views/header_gestion.php index 8a73af02..e14a1787 100755 --- a/application/views/header_gestion.php +++ b/application/views/header_gestion.php @@ -137,22 +137,35 @@ lang->line('Publicité'); ?> -
lang->line('minimum_credit_limit') ?>
+lang->line('maximum_credit_limit') ?>
+N° | +lang->line('Reseau'); ?> | +lang->line('Pays'); ?> | +lang->line('credit_limit'); ?> | +Nano credit | +Action | +||
---|---|---|---|---|---|---|---|
$num | +$row->network | +$row->country | "; + ?> + has_nano_credit) { + ?> ++ [ = Money::of(round($row->limite_credit_min, 2), $row->currency_code, $context)->formatTo('fr_FR') ?> + -- + = Money::of(round($row->limite_credit_max, 2), $row->currency_code, $context)->formatTo('fr_FR') ?> + ] + | ++ + | + ++ lang->line('Inactif'); ?> + | ++ + | + ++ has_nano_credit) echo "disabled" ?> > + lang->line('Voir plus...'); ?> + + | + +