File: /www/exchange0old/exchange/classes/Controller/CCredentials.php
<?php
class Controller_CCredentials
{
function __construct()
{
if(!isset($_SESSION['user']['userid']) )
header("Location:?do=login");
include_once('classes/Model/MHelpers.php');
$application = Model_MHelpers::redirectToCreateApplication();
$query_1 = new Bin_Query();
$query = "SELECT COUNT(id) as records FROM invoice_api_access WHERE user_id ='". $_SESSION["user"]["userid"]."' AND status = 1 ";
$query_1->executeQuery($query);
$invoiceData =$query_1->records[0]['records'];
if($invoiceData == 0){
header("Location: index.php?do=originatorhome");
exit(0);
}
}
function myCredentials()
{
include('classes/Model/MCredentials.php');
Bin_Template::createTemplate('credentials.html',array(
'credentials'=>Model_MCredentials::getMyCredentials($_SESSION['user']['userid']),
'usr'=>$_SESSION["user"]["username"]
));
}
function showInvoiceData()
{
include("classes/Model/MCredentials.php");
include("classes/Display/DCredentials.php");
include_once("classes/Lib/HandleErrors.php");
Bin_Template::createTemplate('showinvoicedata.html',array(
'errmsg'=>$Err->messages,
'errval'=>$Err->values,
'style'=>$Err->style,
'invoicedata'=>Model_MCredentials::showInvoiceData()
));
unset($_SESSION['success']);
}
function validateInvoice()
{
include("classes/Model/Validation/CheckInputs.php");
include('classes/Model/Validation/FormValidation.php');
include("classes/Model/MCredentials.php");
new Model_Validation_CheckInputs('checkcredentials');
Model_MCredentials::updateInvoice();
header('location:index.php?do=showinvoicedata');
exit;
}
function showInvoicequeue()
{
include("classes/Model/MCredentials.php");
include("classes/Display/DCredentials.php");
Bin_Template::createTemplate('showinvoicequeue.html',array(
'invoicedata'=>Model_MCredentials::showInvoicequeue()
));
unset($_SESSION['success']);
}
function editInvoiceData()
{
include("classes/Model/MCredentials.php");
$data = Model_MCredentials::getFilename($_REQUEST['id']);
if($data[0]['api_data_id']!='' && is_numeric($_REQUEST['id']))
{
include_once("classes/Lib/HandleErrors.php");
Bin_Template::createTemplate('editinvoicedata.html',array(
'errmsg'=>$Err->messages,
'errval'=>$Err->values,
'style'=>$Err->style,
'debtorVal'=>Model_MCredentials::showDebName($Err),
'val'=>Model_MCredentials::editInvoiceData($Err)
));
unset($_SESSION['success']);
}
}
function invoiceCurrency()
{
include("classes/Model/MCredentials.php");
Model_MCredentials::invoiceCurrency();
}
function updateEditInvoicedata()
{
include("classes/Model/Validation/CheckInputs.php");
include('classes/Model/Validation/FormValidation.php');
include("classes/Model/MCredentials.php");
new Model_Validation_CheckInputs('editInvoiceData');
Model_MCredentials::updateEditInvoicedata();
}
}
?>