File: /home/mostafedeg/public_html/erp/controllers/transfermoneyAjaxController.php
<?php
//the global file operation
session_start();
ob_start();
//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
// GOES HERE ....................
include("../public/include_dao.php");
//Transfermoney
require_once('../models/dao/TransfermoneyDAO.class.php');
require_once('../models/dto/Transfermoney.class.php');
require_once('../models/mysql/TransfermoneyMySqlDAO.class.php');
require_once('../models/mysql/ext/TransfermoneyMySqlExtDAO.class.php');
//Save
require_once('../models/dao/SaveDAO.class.php');
require_once('../models/dto/Save.class.php');
require_once('../models/mysql/SaveMySqlDAO.class.php');
require_once('../models/mysql/ext/SaveMySqlExtDAO.class.php');
//get the do the action
$do = $_GET['do'];
/* ======================
Controller Name :- transfermoneyAjaxCTRL
OPERTATION in Controller
1-get save cuurent value by saveid using ajax
2-load save data tbl expect saveid
======================== */
//here goes the instances and general variables
//Transfermoney
$myTransfermoney = new Transfermoney();
$myTransfermoneyRecord = new TransfermoneyMySqlDAO();
$myTransfermoneyEx = new TransfermoneyMySqlExtDAO();
//save
$mySave = new Save();
$mySaveRecord = new SaveMySqlDAO();
$mySaveEx = new SaveMySqlExtDAO();
//savedaily
$mySavedaily = new Savedaily();
$mySavedailyRecord = new SavedailyMySqlDAO();
//Programsetting
$ProgramsettingDAO = new ProgramsettingsMySqlDAO();
//check and use the condition that suite this action
$Programsettingdata = $ProgramsettingDAO->load(1);
$smarty->assign("Programsettingdata", $Programsettingdata);
//check and use the condetion that suite this action
if ($do == "loadsaveExpectId") {
$saveIdFrom = $_GET['saveidfrom'];
// here the function that do the action
$saveToData = loadsaveExpectId($saveIdFrom);
$smarty->assign("saveToData", $saveToData);
//here the smarty templates
$smarty->display("transfermoneyview/saveto.html");
} elseif ($do == "getSaveValue") {
$saveIdFrom = $_GET['saveidfrom'];
// here the function that do the action
$savecurrentValue = getSaveValue($saveIdFrom);
echo $savecurrentValue;
}
/* ===============================
function in this CONTROLLER
================================ */
//select all save data
function loadsaveExpectId($saveIdFrom) {
//to use the variable out side the funcion
global $mySaveEx;
//load all save data
$saveData = $mySaveEx->queryWithConditionExpectId($saveIdFrom);
return $saveData;
}
// get savecurrentvalue from save tbl
function getSaveValue($saveId) {
//to use the variable out side the funcion
global $mySave;
global $mySaveRecord;
$saveData = $mySaveRecord->load($saveId);
$savecurrentvalue = $saveData->savecurrentvalue;
return $savecurrentvalue;
}
?>