HEX
Server: Apache
System: Linux server1.royalgt4.com 4.18.0-553.89.1.lve.el8.x86_64 #1 SMP Wed Dec 10 13:58:50 UTC 2025 x86_64
User: mostafedeg (1125)
PHP: 5.6.40
Disabled: mail,passthru,parse_ini_file,show_source,eval,assert,pcntl_exec,dl,putenv,proc_open,popen
Upload Files
File: /home/mostafedeg/public_html/erp/controllers/paymentnetworks.php
<?php

//the global file operation
include("../public/impOpreation.php");
include_once("../library/uploadImages.php");

//global varable
global $showoutside;

//to check if the page from .htacess
//$showoutside = $_GET['sn'];
// get the config file
include_once("../public/config.php");

//here the db files that include in the file
include("../public/include_dao.php");

//get the do the action
$do = $_GET['do'];

$langs = $_SESSION['erp_lang'];
include_once("../views/languages/$langs/success.php");
include_once("../views/languages/$langs/error.php");

///paymentnetworks
$paymentNetworks = new Paymentnetwork();
$paymentNetworksDAO = new PaymentnetworksMySqlDAO();
$paymentNetworksEx = new PaymentnetworksMySqlExtDAO();


//here the global templates
$smarty->display("header.html");



$today = date("Y-m-d");


//check and use the condition that suite this action
if (empty($do)) {
    //here the permssion check
    include_once("../public/authentication.php");

    //here the smarty templates
    $smarty->display("paymentnetworksview/add.html");
}
####
elseif ($do == "add") {
    include_once("../public/authentication.php");

    try {
        add();
        header("location:?do=sucess");
    } catch (Exception $e) {
        header("location:?do=error");
    }
}
####
elseif ($do == "show") {
    //here the permssion check
    include_once("../public/authentication.php");

    $paymentNetworks = $paymentNetworksDAO->queryAll();
    $smarty->assign('paymentNetworks', $paymentNetworks);
    $smarty->display("paymentnetworksview/show.html");
}
####
elseif ($do == "delete") {
    include_once("../public/authentication.php");

    $networkId = filter_input(INPUT_GET, "id");
    $paymentNetworks = $paymentNetworksDAO->load($networkId);
    $paymentNetworks->deleted = 1;
    try {
        $paymentNetworksDAO->update($paymentNetworks);
        header("location:?do=sucess");
    } catch (Exception $e) {
        header("location:?do=error");
    }
}

####
elseif ($do == "edit") {//edit  client
    include_once("../public/authentication.php");
    $networkId = filter_input(INPUT_GET, "id");

    $paymentNetworks = $paymentNetworksDAO->load($networkId);
    $smarty->assign('network', $paymentNetworks);

    $smarty->display("paymentnetworksview/edit.html");
}
####
elseif ($do == "update") { //edit update
    include_once("../public/authentication.php");
    try {
        update();
        header("location:?do=sucess");
    } catch (Exception $e) {
        header("location:?do=error");
    }
}
####
elseif ($do == "sucess") {
    //here the smarty templates
    $smarty->display("succes.html");
}
####
elseif ($do == "error") {
    //here the smarty templates
    $smarty->display("error.html");
}



$smarty->assign("bills", 1);

//here the global templates
$smarty->display("footer.html");

/* ===============================
  function in this CONTROLLER
  ================================ */

// add in client tbl
function add() {
    global $paymentNetworks;
    global $paymentNetworksDAO;

    $networkName = filter_input(INPUT_POST, "networkName");
    $networkNameEn = filter_input(INPUT_POST, "networkNameEn");
    $discountpercent = filter_input(INPUT_POST, "discountpercent");

    $paymentNetworks->name = $networkName;
    $paymentNetworks->nameen = $networkNameEn;
    $paymentNetworks->discountpercent = $discountpercent;
    $paymentNetworks->deleted = 0;

    $paymentNetworksDAO->insert($paymentNetworks);
}

function update() {
    global $paymentNetworks;
    global $paymentNetworksDAO;

    $networkId = filter_input(INPUT_POST, "networkId");
    $networkName = filter_input(INPUT_POST, "networkName");
    $networkNameEn = filter_input(INPUT_POST, "networkNameEn");
    $discountpercent = filter_input(INPUT_POST, "discountpercent");

    $paymentNetworks = $paymentNetworksDAO->load($networkId);


    $paymentNetworks->name = $networkName;
    $paymentNetworks->nameen = $networkNameEn;
    $paymentNetworks->discountpercent = $discountpercent;

    $paymentNetworksDAO->update($paymentNetworks);
}
?>