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

foreach ($_POST as $paramName => $paramValue) {
  if ($paramName == "summaryid")
    $id = $paramValue;
  else if ($paramName == "field")
    $field = $paramValue;
}

$dal = new DAL();

if ($field == 'sumControlFields') {

  if ($id > 0) {
    $sql = "SELECT CF.id, SPACE(0) AS 'select', field, CO.control  " .
           "FROM controlfield CF, controlobject CO " .
           "WHERE CF.mainmenu_id = $id AND CF.controlobject_id = CO.id " .
           "ORDER BY CO.control, CF.mainmenu_id ";
    $result = $dal->query($sql);
  }           
}

echo json_encode($result);

?>

