Пример #1
0
    if ($mediarange == 'application/rdf+xml') {
        deliverRdfXml();
        $done = TRUE;
    }
}
if (!$done) {
    Header("Content-Type: text/html; charset=" . $charset);
    $spDisplay = " Agent: " . $agent->getMinimalName();
    pageheader($agent);
    $am = new AgentManager();
    if ($am->isAgentEditor()) {
        echo "<div id='commandDiv'><span class='link' id='editLink'>Edit</span>&nbsp;<span class='link' id='viewLink'>View</span>&nbsp;<span class='link' id='createLink'>New</span></div>";
        echo "\n     <script type='text/javascript'>\n        \$('#editLink').click(function () {\n            \$.ajax({\n               type: 'GET',\n               url: '{$clientRoot}/agents/rpc/handler.php',\n               data: 'mode=edit&table=Agent&agentid=" . $agent->getagentid() . "',\n               dataType : 'html',\n               success: function(data){\n                  \$('#agentDetailDiv" . $agent->getagentid() . "').html(data);\n               },\n               error: function( xhr, status, errorThrown ) {\n                  \$('#statusDiv').html('Error. ' + errorThrown);\n                  console.log( 'Error: ' + errorThrown );\n                  console.log( 'Status: ' + status );\n                  console.dir( xhr );\n               }\n            });\n            return false; \n        });\n        \$('#viewLink').click(function () {\n            \$.ajax({\n               type: 'GET',\n               url: '{$clientRoot}/agents/rpc/handler.php',\n               data: 'mode=show&table=Agent&agentid=" . $agent->getagentid() . "',\n               dataType : 'html',\n               success: function(data){\n                  \$('#agentDetailDiv" . $agent->getagentid() . "').html(data);\n               },\n               error: function( xhr, status, errorThrown ) {\n                  \$('#statusDiv').html('Error. ' + errorThrown);\n                  console.log( 'Error: ' + errorThrown );\n                  console.log( 'Status: ' + status );\n                  console.dir( xhr );\n               }\n            });\n            return false; \n        });\n        \$('#createLink').click(function () {\n            \$.ajax({\n               type: 'GET',\n               url: '{$clientRoot}/agents/rpc/handler.php',\n               data: 'mode=create&table=Agent',\n               dataType : 'html',\n               success: function(data){\n                  \$('#agentDetailDiv" . $agent->getagentid() . "').html(data);\n               },\n               error: function( xhr, status, errorThrown ) {\n                  \$('#statusDiv').html('Error. ' + errorThrown);\n                  console.log( 'Error: ' + errorThrown );\n                  console.log( 'Status: ' + status );\n                  console.dir( xhr );\n               }\n            });\n            return false; \n        });\n     </script>\n     ";
    }
    echo "<div id='agentDetailDiv" . $agent->getagentid() . "'>";
    echo $agentview->getDetailsView();
    echo "</div>";
    if ($findobjects == 1) {
        echo $am->getPrettyListOfCollectionObjectsForCollector($agent->getagentid());
    }
    footer();
}
/**
 * Return the requested agent as RDF in a turtle serialization.
 */
function deliverTurtle()
{
    global $agent, $agentview, $charset;
    Header("Content-Type: text/turtle; charset=" . $charset);
    echo $agentview->getAsTurtle();
}
Пример #2
0
function showAgent($agent)
{
    $result = "";
    if ($agent == null) {
        $result = "Error: No agent found";
    } else {
        $agentview = new AgentView();
        $agentview->setModel($agent);
        $result .= "<div id='agentDetailDiv{$agent->getrecordedById}()'>";
        $result .= $agentview->getDetailsView();
        $result .= "</div>";
    }
    return $result;
}