You are here

function theme_cmis_browser_doc_view in CMIS API 6.2

Generate CMIS document list view. It displays document icon, name, download link, description, size, last modification date, modifier and thumbnail if any.

Parameters

$target_path:

1 theme call to theme_cmis_browser_doc_view()
cmis_browser_block_content in cmis_browser/cmis_browser.module
Display CMIS document list based on the path configurations.

File

cmis_browser/cmis_browser.theme.inc, line 134

Code

function theme_cmis_browser_doc_view($target_path) {
  module_load_include('api.inc', 'cmis');
  $folder_img = theme('image', drupal_get_path('module', 'cmis_browser') . '/images/space.gif');
  $document_img = theme('image', drupal_get_path('module', 'cmis_browser') . '/images/file.png');
  try {
    $repository = cmisapi_getRepositoryInfo();
    $cmis_object = cmisapi_getProperties($repository->repositoryId, drupal_urlencode($target_path));
  } catch (CMISException $e) {
    cmis_error_handler('cmis_browser', $e);
    return t('Errors occured while trying to access CMIS repository. Please check Drupal error logs. (@error)', array(
      '@error' => $e
        ->getMessage(),
    ));
  }
  $updated = date_format($cmis_object->updated, 'n/j/Y g:i A');
  if ($cmis_object->type == 'folder') {
    $icon = $folder_img;
    $link = l($cmis_object->title, 'cmis/browser' . $target_path);
  }
  else {
    $icon = $document_img;
    $link = l($cmis_object->title, 'cmis/browser', array(
      'query' => array(
        'id' => $cmis_object->id,
      ),
    ));
  }
  $contents = '<div>' . $icon . $link . '</div>';
  $contents .= '<div>' . $cmis_object->summary . '</div>';
  $contents .= $cmis_object->type == 'folder' ? '' : '<div> Size:' . number_format($cmis_object->size / 1000, 2, '.', ',') . ' K</div>';
  $contents .= '<div> Modified:' . $updated . '</div>';
  $contents .= '<div> Modifier:' . $cmis_object->author . '</div>';
  return $contents;
}