<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="sr-RS">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<?php

/*
 * Demo: demo_info.php
 * 
 * Primer poziva API funkcije 'info' koja vraca osnovne podatke o API okruzenju. 
 *  
 */
 

include_once 'infoapi/infoapi.php';

$miapiHandler = new iapiHandler;
$miapiHandler->APIServerURL = SERVER_URL; // definisano u apitest/config.php

$miapiHandler->DebugLevel = DEBUG_LEVEL;
$miapiHandler->DebugSections = DEBUG_SECTIONS;

//$miapiHandler->RequestAPIVersion = API_VERSION;


// naziv API funkcije koja se poziva
$mAPIFunctionName = 'INFO';

$mQueryEnvelope = new iapiQueryEnvelope ($mAPIFunctionName);
$mQueryEnvelope->username = USERNAME; // definisano u apitest/config.php
$mQueryEnvelope->password = PASSWORD; // definisano u apitest/config.php


$mQuery = $mQueryEnvelope;
$mResponse  = $miapiHandler->Execute($mQuery);

echo "<pre>";
print_r ($mResponse);
echo "</pre>";

?>
<?php

$m_error = false;

if ($mResponse->error_state !='ok') {
  $m_error = true;
?>
Greska: <?php echo $mResponse->error_state; ?> - <?php echo $mResponse->error_message; ?>
<?php
} else {

  if ($mResponse->data->error_state !='ok') {
    $m_error = true;
?>
Greska: <?php echo $mResponse->data->error_state; ?> - <?php echo $mResponse->data->error_message; ?>
<?php
  }

}
?>
<hr />

<?php
if (!$m_error) {
  
?>
Getting API info:

<p>
Developer: <?php echo $mResponse->data->developer; ?><br />
Username: <?php echo $mResponse->data->username; ?><br />
Entry name: <?php echo $mResponse->data->entry_name; ?><br />
WEntry name: <?php echo $mResponse->data->wentry_name; ?><br />
Logged in: <?php echo $mResponse->GetDataValue('logedin'); ?><br />
<br />
Poslovna godina: <?php echo $mResponse->GetDataValue('poslovna_godina'); ?><br />
JOB: <?php echo $mResponse->GetDataValue('job'); ?><br />
Pozicija: <?php echo $mResponse->GetDataValue('pozicija'); ?><br />
<br />
Sifra firme: <?php echo $mResponse->data->sif_firme; ?><br />
Radna jedinica: <?php echo $mResponse->GetDataValue('kd_rj'); ?><br />
Sifra objekta: <?php echo $mResponse->GetDataValue('sif_obj'); ?><br />
Tip korisnika: <?php echo $mResponse->GetDataValue('tip_kor'); ?><br />
<br />
Referent: <?php echo $mResponse->GetDataValue('referent'); ?><br />
</p>
<hr />

<?php
}  //  if (!$m_error) 
?>

<?php include_once 'inc_sysinfo.php'; ?>

</body>
</html>