108 lines
3.8 KiB
PHP
108 lines
3.8 KiB
PHP
<?php
|
|
/** \file scripts\action\_a_project.php
|
|
* \brief DI webinterface project action script.
|
|
* \author Rob Schalken, Core|Vision
|
|
* \version 1.0
|
|
* \date 17-10-2008
|
|
*
|
|
* This file contains the project action script.
|
|
*/
|
|
|
|
// Extra login check
|
|
if (db_ver_right_user($_SESSION[$_PAGE_INFO['id']]['login']['user']['id'], "login")) {
|
|
// Store project info
|
|
unset($_SESSION[$_PAGE_INFO['id']]['login']['project']);
|
|
if (($_GET['project'] == "skip") && ($_GET['project_id'] == -1)) {
|
|
$_SESSION[$_PAGE_INFO['id']]['login']['project']['skip'] = 1;
|
|
}
|
|
else {
|
|
$_SESSION[$_PAGE_INFO['id']]['login']['project']['name'] = $_GET['project'];
|
|
$_SESSION[$_PAGE_INFO['id']]['login']['project']['id'] = $_GET['project_id'];
|
|
}
|
|
|
|
// Update global variables
|
|
UpdateGlobals();
|
|
|
|
// Redirect to main menu or to linked page
|
|
if ((isset($_GET['link'])) || (is_dev("RS3000"))) {
|
|
$released = 1;
|
|
|
|
if (!$_SESSION[$_PAGE_INFO['id']]['login']['project']['skip']) {
|
|
// Check if project has been released => Redirect back
|
|
$project_info = db_fetch_project($_SESSION[$_PAGE_INFO['id']]['login']['project']['id'], "", 1);
|
|
|
|
if (($project_info['sstatus'] != "vrijgegeven") && ($project_info['type'] != "normaal")) {
|
|
// Display message
|
|
$_SESSION[$_PAGE_INFO['id']]['errormsg']['text'] = _("Project has not been released!");
|
|
|
|
// Get users with release rights
|
|
$users = db_fetch_project_users($_SESSION[$_PAGE_INFO['id']]['login']['project']['id'], "", "projecten:g");
|
|
|
|
if (is_array($users)) {
|
|
$_SESSION[$_PAGE_INFO['id']]['errormsg']['text'] .= "<br><br>" . _("Responsible") . ":";
|
|
|
|
foreach($users as $user) {
|
|
// Display user info
|
|
$_SESSION[$_PAGE_INFO['id']]['errormsg']['text'] .= "<br>- " . getUser($user['id']);
|
|
|
|
// Mobile number available?
|
|
$_SESSION[$_PAGE_INFO['id']]['errormsg']['text'] .= (strlen($user['alarmnr'])) ? " (" . $user['alarmnr'] . ")" : "";
|
|
}
|
|
}
|
|
|
|
$_SESSION[$_PAGE_INFO['id']]['errormsg']['type'] = "alert";
|
|
$_SESSION[$_PAGE_INFO['id']]['errormsg']['title'] = "Announcement";
|
|
|
|
// Clear project info & flag
|
|
$released = 0;
|
|
unset($_SESSION[$_PAGE_INFO['id']]['login']['project']['name']);
|
|
unset($_SESSION[$_PAGE_INFO['id']]['login']['project']['id']);
|
|
|
|
// Update global variables
|
|
UpdateGlobals();
|
|
}
|
|
}
|
|
|
|
if ($released) {
|
|
if (!is_dev("RS3000")) {
|
|
$link = (isset($_GET['action'])) ? "?id=" . $_PAGE_INFO['id'] . "&href=" . $_GET['link'] . "&action=" . $_GET['action'] : "?id=" . $_PAGE_INFO['id'] . "&href=" . $_GET['link'];
|
|
$link .= (isset($_GET['page_project'])) ? "&page_project=" . $_GET['page_project'] : "";
|
|
|
|
// Check if new window/tab
|
|
if (isset($_GET['renew'])) {
|
|
$link .= "&renew=1";
|
|
}
|
|
header("Location: " . $link . "");
|
|
}
|
|
else {
|
|
// RS3000 ok message
|
|
SendMessageRS3000(array("status='0'"));
|
|
}
|
|
}
|
|
else {
|
|
if (!is_dev("RS3000")) {
|
|
// Redirect back => Display message
|
|
include("scripts/page/project.php");
|
|
}
|
|
else {
|
|
// RS3000 error message
|
|
SendMessageRS3000(array("status='1'","errormsg='" . $_SESSION[$_PAGE_INFO['id']]['errormsg']['text'] . "'"));
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
header("Location: ?id=" . $_PAGE_INFO['id'] . "&href=" . PAGE_MENU . "");
|
|
}
|
|
}
|
|
else {
|
|
// Display logout message
|
|
$_SESSION[$_PAGE_INFO['id']]['login_info']['errormsg'] = _("No valid rights");
|
|
|
|
// Redirect page back to login page
|
|
echo "<script type=\"text/javascript\">\n";
|
|
echo "location.href='/?id=" . $_PAGE_INFO['id'] . "&href=" . PAGE_LOGIN. "'\n";
|
|
echo "</script>\n";
|
|
}
|
|
|
|
?>
|