File: /home/mostafedeg/public_html/erp/controllers/youtubeAjaxController.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
include("../public/include_dao.php");
//user
require_once('../models/dao/YoutubeLinkDAO.class.php');
require_once('../models/dto/YoutubeLink.class.php');
require_once('../models/mysql/YoutubeLinkMySqlDAO.class.php');
require_once('../models/mysql/ext/YoutubeLinkMySqlExtDAO.class.php');
//get the do the action
$do = $_GET['do'];
/* ======================
Controller Name :- productionExecutionAjaxController
OPERTATION in Controller
======================== */
//here goes the instances and general variables
//user
$youtubeLink = new YoutubeLink();
$youtubeLinkDAO = new YoutubeLinkMySqlDAO();
$youtubeLinkEX = new YoutubeLinkMySqlExtDAO();
$today = date("Y-m-d");
$smarty->assign("today", $today);
if ($do == "addLink") {
$youtube = filter_input(INPUT_POST, 'val');
$youtubeLink->url = $youtube ;
$youtubeLink->status = 1;
$youtubeLinkDAO->insert($youtubeLink);
echo 1;
}
if ($do == "updateLink") {
$id = filter_input(INPUT_POST, 'id');
$youtube = filter_input(INPUT_POST, 'val');
$youtubeLink = $youtubeLinkDAO->load($id);
$youtubeLink->url = $youtube ;
$youtubeLink->status = 1;
$youtubeLinkDAO->update($youtubeLink);
echo 1;
}
?>