| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /inetpub/wwwroot/icd/msc/ |
Upload File : |
<?php
include_once 'lib/lib.php';
function getCurrentAccYear(){
$daysoff = 0;
$ard = getdate(time() + Config::TIMEOFF + 86400 * $daysoff);
$curYear = $ard["year"];
$curAccYearID = DBUtils::getresult("SELECT `Id` FROM `msc_accyears` WHERE `Description` LIKE '{$curYear}-%'");
if ($curAccYearID === FALSE){
$lastid = NULL;
$nextYear = $curYear+1;
$nextNextYear = $nextYear + 1;
DBUtils::execute_query_auto("INSERT INTO `msc_accyears` (`Description`) VALUES ('{$curYear}-{$nextYear}');", $lastid);
$curAccYearID = $lastid;
DBUtils::execute_query("INSERT INTO `msc_semesterdates` (`AccYearId`, `SemesterId`, `StartDate`, `EndDate`) VALUES ({$curAccYearID}, 1, '{$curYear}-10-15 00:00:00', '{$nextYear}-01-31 00:00:00'), ({$curAccYearID}, 2, '{$nextYear}-02-01 00:00:00', '{$nextYear}-06-30 00:00:00'), ({$curAccYearID}, 3, '{$nextYear}-07-01 00:00:00', '{$nextNextYear}-01-31 00:00:00');");
//var_dump($lastid);
}
//var_dump($curAccYearID);
return $curAccYearID;
}
$mCtrl = new Controller("report_applications", "@[PAGE_TITLE]");
$mCtrl->onlyForLoggedInUsers = true;
//$mCtrl->addToHead("");
$reject = Utils::vRequest("reject", FALSE, "");
$approve = Utils::vRequest("approve", FALSE, "");
if ((strlen($reject) > 0) || (strlen($approve) > 0)){
if ($mCtrl->userHasRole("registry")){
$id = "";
if (strlen($reject) > 0){
$id = $reject;
}elseif (strlen($approve) > 0){
$id = $approve;
}
$sql = "SELECT * FROM `msc_Applications` WHERE `docType` = 0 AND `Id` = {$id}";
$curApp = DBUtils::getObject($sql);
if ($curApp != null){
$appStatus = $curApp->appStatus;
if ($appStatus == 0){
$sql1 = null;
$sql2 = null;
if (strlen($reject) > 0){
$sql1 = "UPDATE `msc_Applications` SET `appStatus` = -1 WHERE `Id` = {$reject}";
}elseif (strlen($approve) > 0){
$regAccYear = getCurrentAccYear();
$sql1 = "UPDATE `msc_Applications` SET `appStatus` = 1 WHERE `Id` = {$approve}";
$registeredon = Utils::dateStr();
$sql2 = "INSERT INTO `msc_Registry` (RegisteredOn, Surname, Forname, Title, Gender, Nationality, DateOfBirth, Address, PostCode, City, Country, Telephone, Mobile, Fax, Email, `RegAccYear`, `CurAccYear`, `CurSemester`) SELECT '{$registeredon}', Surname, Forname, Title, Gender, Nationality, DateOfBirth, Address, PostCode, City, Country, Telephone, Mobile, Fax, Email, {$regAccYear}, {$regAccYear}, 1 FROM `msc_Applications` WHERE `Id` = {$approve}";
}
if ($sql1 != null){
DBUtils::execute_query($sql1);
}
if ($sql2 != null){
DBUtils::execute_query($sql2);
}
}else{
if ($appStatus > 0){
$mCtrl->setFlashWarning("This application has already been approved");
}else{
$mCtrl->setFlashWarning("This application has already been rejected");
}
}
}else{
$mCtrl->setFlashWarning("There is no such application id");
}
}else{
$mCtrl->setFlashWarning("You do not have this permission");
}
}
$mCtrl->printHeaders();
$mCtrl->clearFlashWarning();
//$mCtrl->addSideBarBlock("δοκιμή", "δοκιμή", 300);
?>
<?php
//$mCtrl->includeSource("left_navigation");
$mCtrl->includeSource();
?>
<?php
$mCtrl->Close();
?>