You are here

function cmis_content_generate_doc_view in CMIS API 6

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

1 call to cmis_content_generate_doc_view()
cmis_content_contents in cmis_content/cmis_content.module
Display CMIS document list based on the path configurations.

File

cmis_content/cmis_content.module, line 361

Code

function cmis_content_generate_doc_view($target_path) {

  // Try to get the node id
  module_load_include('api.inc', 'cmis');
  $folder_img = theme('image', drupal_get_path('module', 'cmis_browser') . '/images/space.gif');
  $file_img = theme('image', drupal_get_path('module', 'cmis_browser') . '/images/file.png');
  $repository = cmisapi_getRepositoryInfo();
  $cmis_object = cmisapi_getProperties($repository->repositoryId, drupal_urlencode($target_path));
  $updatedStr = date_format($cmis_object->updated, 'n/j/Y g:i A');
  $contents = '';
  if ($cmis_object->type == 'folder') {
    $folderlink = l($cmis_object->title, 'cmis/browser', array(
      'query' => array(
        'id' => $cmis_object->id,
      ),
    ));
    $contents .= '<div>' . $folder_img . $folderlink . '</div>';
    $contents .= '<div>' . $cmis_object->summary . '</div>';
    $contents .= '<div> Modified:' . $updatedStr . '</div>';
    $contents .= '<div> Modifier:' . $cmis_object->author . '</div>';
  }
  else {
    $documentLink = l($cmis_object->title, 'cmis/get', array(
      'query' => array(
        'id' => $cmis_object->id,
      ),
    ));
    $contents .= '<div>' . $file_img . $documentLink . '</div>';
    $contents .= '<div>' . $cmis_object->summary . '</div>';
    $contents .= '<div> Size:' . number_format($cmis_object->size / 1000, 2, '.', ',') . ' K</div>';
    $contents .= '<div> Modified:' . $updatedStr . '</div>';
    $contents .= '<div> Modifier:' . $cmis_object->author . '</div>';
  }
  return $contents;
}