Files
oc-server3/htdocs/okapi/services/logs/entry.php
2014-10-08 10:06:07 +02:00

37 lines
1.0 KiB
PHP

<?php
namespace okapi\services\logs\entry;
use okapi\OkapiInternalRequest;
use okapi\OkapiServiceRunner;
use okapi\Okapi;
use okapi\OkapiRequest;
use okapi\ParamMissing;
use okapi\InvalidParam;
class WebService
{
public static function options()
{
return array(
'min_auth_level' => 1
);
}
public static function call(OkapiRequest $request)
{
$log_uuid = $request->get_parameter('log_uuid');
if (!$log_uuid) throw new ParamMissing('log_uuid');
$fields = $request->get_parameter('fields');
if (!$fields) $fields = "date|user|type|comment";
$results = OkapiServiceRunner::call('services/logs/entries', new OkapiInternalRequest(
$request->consumer, $request->token, array('log_uuids' => $log_uuid,
'fields' => $fields)));
$result = $results[$log_uuid];
if ($result == null)
throw new InvalidParam('log_uuid', "This log entry does not exist.");
return Okapi::formatted_response($request, $result);
}
}