src.dualinventive.com/mtinfo/dist/webroot/main/app/include/check_project_transfer.php

71 lines
2.8 KiB
PHP

<?php
/** \file check_project_transfer.php
* \brief DI check_project_transfer page
* \author Bram Lentjes, Core|Vision
* \version 1.0
* \date 09-04-2014
*
* This file contains the check_project_transfer file.
*/
// Check id $_POST values are set
if((isset($_POST['project_name'])) && (isset($_POST['project_id']))){
// Get project id and user id
$projectid = $_POST['project_name'];
$userid = $_POST['project_id'];
// Get all entries of project_overdracht for this user in combination with the current project
$accept = db_fetch_project_transfer($projectid, $userid);
// Check for entries
if(is_array($accept)){
// Loop through all project_overdrachr entries for the user in combination with the current project
foreach ($accept as $entry){
// CHeck if status is 'goedgekeurd';
if($entry['status'] == 'goedgekeurd'){
echo "<script type=\"text/javascript\">
// Store in array
accept_project_transfer[getProjectId()] = true;
</script>";
}else{
echo "<script type=\"text/javascript\">
";
if($entry['status'] == 'gewijzigd'){
echo "
// Store imagepath
setImagePath('" . IMAGES_PATH . "');
setTimeout(function(){
setToastAlert('" . app_('Documents for these project are changed') . "','" . app_('Ok') ."','','','','');
},1000);
";
}
echo "
// Change image of sign button
//$(footer_button_three_project).css('background-image','url(" . IMAGES_PATH . "di_app_projects/sign_button_normal.png)');
</script>";
}
}
}else{
// If there are no tranfer accepted entries default the sign button to normal
echo "<script type=\"text/javascript\">
// Change color of sign button
// $(footer_button_three_project).css('background-image','url(" . IMAGES_PATH . "di_app_projects/sign_button_normal.png)');
</script>";
}
}
echo "<script type=\"text/javascript\">
// Set flag in array (only once check document transfer)
firsttime_accept_project_transfer[getProjectId()] = true;
// Recall a_get_documents page
ajax_post(getProjectName('return'),getProjectId(),'?id=" . $_PAGE_INFO['id'] . "&href=app/di_app_projects/a_get_documents.php','loaded_page');
</script>";