<?php

include_once '../session/admin-session.php';
include_once '../classes/class_admin.php';
include_once '../classes/validation.php';
include_once '../classes/common.php';

$log = new common();
$objadm = new class_admin();
$val = new validation();

switch ($_REQUEST["action"]) {
    case "system-flag-update":

        $col_name = $val->ValidateString($_REQUEST['col_name']);
        $activity_str = "";
        if ($_REQUEST['activity'] == "OPEN") {
            $activity_str = "Y";
        } else if ($_REQUEST['activity'] == "CLOSE") {
            $activity_str = "N";
        }

        $ref_id = $val->ValidateString($_REQUEST['ref_id']);
        if (!empty($activity_str)) {
            $objadm->ref_pk_id = $ref_id;
            $objadm->col_name = $col_name;
            $objadm->activity_str = $activity_str;
            
            $objadm->admin_roll = $_SESSION['user_sesroll'];
            
            $objadm->UpdateSystemFlags();
        }
        
        echo "DONE";

        break;
        
     case "project-flag-update":
         
         $col_name = $val->ValidateString($_REQUEST['col_name']);
        $activity_str = "";
        if ($_REQUEST['activity'] == "OPEN") {
            $activity_str = "Y";
        } else if ($_REQUEST['activity'] == "CLOSE") {
            $activity_str = "N";
        }

        $ref_id = $val->ValidateString($_REQUEST['ref_id']);
        if (!empty($activity_str)) {
            $objadm->ref_pk_id = $ref_id;
            $objadm->col_name = $col_name;
            $objadm->activity_str = $activity_str;
            
            $objadm->admin_roll = $_SESSION['user_sesroll'];
            
            $objadm->UpdateProjectFlags();
        }
        
        echo "DONE";
         
         break;
}
?>