function cmis_query_view in CMIS API 6.4
Same name and namespace in other branches
- 6.2 cmis_query/cmis_query.pages.inc \cmis_query_view()
- 6.3 cmis_query/cmis_query.module \cmis_query_view()
- 7.2 cmis_query/cmis_query.module \cmis_query_view()
- 7 cmis_query/cmis_query.module \cmis_query_view()
Implementation of hook_view()
Parameters
$query:
$format:
$p:
1 string reference to 'cmis_query_view'
- cmis_query_menu in cmis_query/
cmis_query.module - Implementation of hook_menu() for CMIS search module.
File
- cmis_query/
cmis_query.module, line 41 - Search functions
Code
function cmis_query_view($query = NULL, $format = 'html', $p = 1) {
module_load_include('api.inc', 'cmis');
$query = urldecode($query);
if ($query) {
try {
$repository = cmisapi_getRepositoryInfo();
$query_result = cmisapi_query($repository->repositoryId, $query);
} catch (CMISException $e) {
cmis_error_handler('cmis_query', $e);
$contents = t('Error');
}
}
switch ($format) {
case 'json':
$result = array();
if ($query_result) {
// strip links property
foreach ($query_result->objectList as $cmis_object) {
if (isset($cmis_object->links)) {
unset($cmis_object->links);
}
$result[] = $cmis_object;
}
}
$contents = NULL;
drupal_json($result);
break;
default:
$contents = drupal_get_form('cmis_query_form', NULL);
if ($query_result) {
$contents .= theme('cmis_query_results', $query_result->objectList);
}
}
return $contents;
}