PageRenderTime 50ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/application/views/files/file_details.php

https://github.com/cj/Project-Pier
PHP | 107 lines | 97 code | 10 blank | 0 comment | 26 complexity | fffba9b9071d4cace6380f9703e9b3d0 MD5 | raw file
  1. <?php
  2. set_page_title($file->getFilename());
  3. project_tabbed_navigation(PROJECT_TAB_FILES);
  4. $files_crumbs = array(
  5. 0 => array(lang('files'), get_url('files'))
  6. ); // array
  7. if ($folder instanceof ProjectFolder) {
  8. $files_crumbs[] = array($folder->getName(), $folder->getBrowseUrl());
  9. } // if
  10. $files_crumbs[] = lang('file details');
  11. project_crumbs($files_crumbs);
  12. if (ProjectFile::canAdd(logged_user(), active_project())) {
  13. if ($folder instanceof ProjectFolder) {
  14. add_page_action(lang('add file'), $folder->getAddFileUrl());
  15. } else {
  16. add_page_action(lang('add file'), get_url('files', 'add_file'));
  17. } // if
  18. } // if
  19. if (ProjectFolder::canAdd(logged_user(), active_project())) {
  20. add_page_action(lang('add folder'), get_url('files', 'add_folder'));
  21. } // if
  22. add_stylesheet_to_page('project/files.css');
  23. ?>
  24. <div id="fileDetails" class="block">
  25. <?php if ($file->isPrivate()) { ?>
  26. <div class="private" title="<?php echo lang('private file') ?>"><span><?php echo lang('private file') ?></span></div>
  27. <?php } // if ?>
  28. <div class="header"><?php echo clean($file->getFilename()) ?></div>
  29. <div class="content">
  30. <div id="fileIcon"><img src="<?php echo $file->getTypeIconUrl() ?>" alt="<?php echo $file->getFilename() ?>" /></div>
  31. <div id="fileInfo">
  32. <?php if (($file->getDescription())) { ?>
  33. <div id="fileDescription"><?php echo do_textile($file->getDescription()) ?></div>
  34. <?php } // if ?>
  35. <?php if ($folder instanceof ProjectFolder) { ?>
  36. <div id="fileFolder"><span class="propertyName"><?php echo lang('folder') ?>:</span> <a href="<?php echo $folder->getBrowseUrl() ?>"><?php echo clean($folder->getName()) ?></a></div>
  37. <?php } // if ?>
  38. <?php if ($last_revision instanceof ProjectFileRevision) { ?>
  39. <div id="fileLastRevision"><span class="propertyName"><?php echo lang('last revision') ?>:</span>
  40. <?php if ($last_revision->getCreatedBy() instanceof User) { ?>
  41. <?php echo lang('file revision info long', $last_revision->getRevisionNumber(), $last_revision->getCreatedBy()->getCardUrl(), clean($last_revision->getCreatedBy()->getDisplayName()), format_descriptive_date($last_revision->getCreatedOn())) ?>
  42. <?php } else { ?>
  43. <?php echo lang('file revision info short', $last_revision->getRevisionNumber(), format_descriptive_date($last_revision->getCreatedOn())) ?>
  44. <?php } // if ?>
  45. </div>
  46. <?php } // if ?>
  47. <div id="fileTags"><span class="propertyName"><?php echo lang('tags') ?>:</span> <?php echo project_object_tags($file, $file->getProject()) ?></div>
  48. <?php
  49. $options = array();
  50. if ($file->canDownload(logged_user())) $options[] = '<a href="' . $file->getDownloadUrl() . '" class="downloadLink">' . lang('download') . ' <span>(' . format_filesize($file->getFilesize()) . ')</span></a>';
  51. if ($file->canEdit(logged_user())) $options[] = '<a href="' . $file->getEditUrl() . '">' . lang('edit') . '</a>';
  52. if ($file->canDelete(logged_user())) $options[] = '<a href="' . $file->getDeleteUrl() . '">' . lang('delete') . '</a>'
  53. ?>
  54. <?php if (count($options)) { ?>
  55. <div id="fileOptions"><?php echo implode(' | ', $options) ?></div>
  56. <?php } // if ?>
  57. </div>
  58. </div>
  59. <div class="clear"></div>
  60. </div>
  61. <?php if (isset($revisions) && is_array($revisions) && count($revisions)) { ?>
  62. <div id="revisions">
  63. <h2><?php echo lang('revisions') ?></h2>
  64. <?php $counter = 0; ?>
  65. <?php foreach ($revisions as $revision) { ?>
  66. <?php $counter++; ?>
  67. <div class="revision <?php echo $counter % 2 ? 'even' : 'odd' ?> <?php echo $counter == 1 ? 'lastRevision' : '' ?>" id="revision<?php echo $revision->getId() ?>">
  68. <div class="revisionName">
  69. <?php if ($revision->getCreatedBy() instanceof User) { ?>
  70. <?php echo lang('file revision title long', $revision->getDownloadUrl(), $revision->getRevisionNumber(), $revision->getCreatedBy()->getCardUrl(), $revision->getCreatedBy()->getDisplayName(), format_datetime($revision->getCreatedOn())) ?>
  71. <?php } else { ?>
  72. <?php echo lang('file revision title short', $revision->getDownloadUrl(), $revision->getRevisionNumber(), format_datetime($revision->getCreatedOn())) ?>
  73. <?php } // if ?>
  74. </div>
  75. <?php if (trim($revision->getComment())) { ?>
  76. <div class="revisionComment"><?php echo do_textile($revision->getComment()) ?></div>
  77. <?php } // if ?>
  78. <?php
  79. $options = array();
  80. if ($revision->canDownload(logged_user())) {
  81. $options[] = '<a href="' . $revision->getDownloadUrl() . '" class="downloadLink">' . lang('download') . ' <span>(' . format_filesize($revision->getFileSize()) . ')</span></a>';
  82. }
  83. if ($revision->canEdit(logged_user())) {
  84. $options[] = '<a href="' . $revision->getEditUrl() . '">' . lang('edit') . '</a>';
  85. }
  86. if ($revision->canDelete(logged_user())) {
  87. $options[] = '<a href="' . $revision->getDeleteUrl() . '">' . lang('delete') . '</a>';
  88. }
  89. ?>
  90. <?php if (count($revisions)) { ?>
  91. <div class="revisionOptions"><?php echo implode(' | ', $options) ?></div>
  92. <?php } // if ?>
  93. </div>
  94. <?php } // foreach ?>
  95. </div>
  96. <?php } // if ?>
  97. <?php echo render_object_comments($file, $file->getDetailsUrl()) ?>