add /records/caption/ route to API

This commit is contained in:
Nicolas Le Goff
2012-03-08 12:17:03 +01:00
parent d18489c30e
commit fe01a6574f
2 changed files with 32 additions and 0 deletions

View File

@@ -204,6 +204,25 @@ class API_V1_adapter extends API_V1_Abstract
return $result;
}
public function caption_records(Request $request, $databox_id, $record_id)
{
$result = new API_V1_result($request, $this);
$record = $this->appbox->get_databox($databox_id)->get_record($record_id);
$fields = $record->get_caption()->get_fields();
$ret = array();
foreach ($fields as $field)
{
$ret[$field->get_meta_struct_id()] = array(
'meta_structure_id' => $field->get_meta_struct_id()
, 'name' => $field->get_name()
, 'value' => $field->get_serialized_values(";")
);
}
$result->set_datas($ret);
return $result;
}
/**
* Get an API_V1_result containing the results of a records search
*