<?php
session_start();
require_once($_SERVER['DOCUMENT_ROOT'] . '/sys/db.php');

foreach ($_POST as $paramName => $paramValue) {
  if ($paramName == "selectid")
    $ci_id = $paramValue;
}

if ($ci_id > 0) {
  $dal = new DAL();
  $sql = "SELECT CI.id, " .
         "CI.mainmenu_id AS panelfolder_id, '' AS panelfolder_id_text, " .
         "CI.controlobject_id,    CO.control AS controlobject_id_text, " . 
         "CI.instance,            CI.instance AS instance_text, " .
         "0 AS complete_ind,      '' AS complete_ind_text " .
         "FROM controlinstance CI, controlobject CO " .
         "WHERE CI.id = $ci_id AND CO.id = CI.controlobject_id LIMIT 1 " ;
  $result = $dal->query($sql);
}

$_SESSION['controlinstance'] = $ci_id;

echo json_encode($result);

?>

