File: /home/mostafedeg/public_html/erp/controllers/assetAjaxController.php
<?php
//the global file operation
session_start();
ob_start();
//global varable
global $showoutside;
//to check if the page from .htacess
//$showoutside = $_GET['sn']; yf
// 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");
//Assets
require_once('../models/dao/AssetsDAO.class.php');
require_once('../models/dto/Asset.class.php');
require_once('../models/mysql/AssetsMySqlDAO.class.php');
require_once('../models/mysql/ext/AssetsMySqlExtDAO.class.php');
//get the do the action
$do = $_GET['do'];
/* ======================
Controller Name :- assetsCTRL
OPERTATION in Controller
1-display add form
2- add in Assets tble
3-display sucess or error
4-display show form
5-delete from Assets tbl
6-edit in Assets data
======================== */
//here goes the instances and general variables
$myAssets = new Asset();
$myAssetsRecord = new AssetsMySqlDAO();
$myAssetsEx = new AssetsMySqlExtDAO();
//Checkcontroller
//check and use the condetion that suite this action
if (empty($do)) {
} elseif ($do == "checkName") {
$assetname = $_POST['assetname'];
$txtUser = $_POST['txtuser'];
echo $txtUser;
$assetData = $myAssetsRecord->queryByAssetsName($assetname);
if (empty($assetname)) {
echo -1;
} elseif (!empty($assetData)) {
echo -2;
} elseif (empty($txtUser)) {
echo 0;
}
}
?>