CMS  Version 3.9
DocumentLibraryView Class Reference

Public Member Functions

 __construct ($mgr)
 
 buildDocumentTable ()
 
 formatDocumentTitle ($document)
 
 writeScript ()
 
 drawView ()
 
 drawButtons ()
 
 createUploadedByFacet ()
 

Public Attributes

 $mgr
 
 $library
 
 $table
 
 $facetManager
 

Detailed Description

Definition at line 10 of file document_view.inc.

Constructor & Destructor Documentation

◆ __construct()

DocumentLibraryView::__construct (   $mgr)

Definition at line 17 of file document_view.inc.

18  {
19  $this->mgr = $mgr;
20  $this->library = $mgr->library;
21  $this->table = $this->buildDocumentTable();
22 
23  $this->facetManager = new FacetManager('facet_manager', $this->table);
24  TaxonomyManager::addFacets($this->facetManager, Document, true, "160px", "200px", "200px");
25 
26  if (Settings::getValue("document", "show_upload_details"))
27  {
28  $this->facetManager->addFacet("Uploaded By", $this->createUploadedByFacet());
29  }
30  }
This class maps the publication table.
Definition: document.inc:43
static getValue($component, $name)
Retrieve the value of the specified Setting.
Definition: settings.inc:104
static addFacets($manager, $classes, $dropdown=true, $max_width="200px", $width="200px", $height="120px")

Member Function Documentation

◆ buildDocumentTable()

DocumentLibraryView::buildDocumentTable ( )

Definition at line 32 of file document_view.inc.

33  {
34  $showUploadDetails = Settings::getValue("document", "show_upload_details");
35 
36  $docWidth = $showUploadDetails ? "40%" : "80%";
37 
38  $table = new DataListView($this->mgr->documents, "document_library");
39  $table->column("Document", array($this, formatDocumentTitle), true, "width: {$docWidth}", String, null, "{title:lower}")
40  ->column("Author", "{author}", true, "width: 20%");
41 
42  if ($showUploadDetails)
43  {
44  $table->column("Uploaded By", "{Owner.first_name} {Owner.last_name}", false, "width: 20%; text-align: center")
45  ->column("Last Modified", "{last_modified:short}", false, "width: 30%; text-align: center");
46  }
47 
48  $table->pageSize = 10;
49  $table->emptyMessage = "There are no matching documents";
50  $table->sortable = true;
51  $table->filter = Settings::getValue("document", "show_table_filter") ? true : false;
52 
53  $table->writeIdTag = true;
54 
55  return $table;
56  }
formatDocumentTitle($document)
$table column("Redirect From", "<a href='redirect_form?redirect_id={redirect_id}'>{redirect_from}</a>", true, "width: 30%") -> column("Redirect To", "<a href='{redirect_to}' target='_blank'>{redirect_to}</a>", true, "width: 30%") ->column("Last Modified", "{last_modified}", true, "width: 20%; text-align: center") ->column("Override", "{ override true
Definition: redirects.inc:9

◆ createUploadedByFacet()

DocumentLibraryView::createUploadedByFacet ( )

Definition at line 155 of file document_view.inc.

156  {
157  $facet = new MultiSelectFacetFilter("owner_id", array(Document => "{Owner.first_name} {Owner.last_name}"));
158 
159  $facet->dropdownMaxWidth = "160px";
160  $facet->width = "200px";
161  $facet->height = "240px";
162 
163  return $facet;
164  }

◆ drawButtons()

DocumentLibraryView::drawButtons ( )

Definition at line 134 of file document_view.inc.

135  {
136  if(!checkRole("admin") && !checkRole($this->library->upload_files))
137  {
138  return;
139  }
140 
141  echo "<div id='document_library_button_row'>\n";
142  if (checkRole($this->library->upload_files))
143  {
144  echo "<button id='upload' class='button' onclick='documentMgr.uploadFile()'>Upload a File...</button>\n";
145  }
146 
147  if (checkRole("admin"))
148  {
149  echo "<button id='rescan' class='button' onclick='documentMgr.rescanLibrary()'>Rescan</button>\n";
150  }
151 
152  echo "</div>\n";
153  }

◆ drawView()

DocumentLibraryView::drawView ( )

Definition at line 126 of file document_view.inc.

127  {
128  $this->facetManager->drawForm();
129  $this->table->drawView();
130 
131  $this->drawButtons();
132  }

◆ formatDocumentTitle()

DocumentLibraryView::formatDocumentTitle (   $document)

Definition at line 58 of file document_view.inc.

59  {
60  $file = $document->file;
61 
62  $type = getDocType($file);
63  $icon = getDocIcon($file);
64 
65  $size = $this->library->getFileSize($document);
66 
67  if(checkRole($this->library->upload_files))
68  {
69  $details_icon = "icon_edit.png";
70  $fn = "editDocumentDetailsDialog";
71  }
72  else
73  {
74  $details_icon = "icon_view.png";
75  $fn = "showDocumentDetailsDialog";
76  }
77 
78  $titleText = Settings::getValue("document", "link_to_details") ? "<a class='document_title' href='document_details?document_id={document_id}'>{title}</a>" :
79  "<span class='document_title'>{title}</span>";
80 
81  $details_link = "<a href=\"edit_document?document_id={document_id}\" onclick=\"documentMgr.{$fn}({document_id}); return false;\"><img src=\"/fakoli/images/{$details_icon}\" style=\"border: none;display: inline-block;vertical-align: middle;padding-right: 4px\"></a>\n";
82 
83  if(checkRole($this->library->delete_files))
84  {
85  $delete_link .= "<a href=\"delete_document?document_id={document_id}\" onclick=\"documentMgr.deleteFile({document_id}); return false;\"><img alt=\"delete\" src=\"/fakoli/images/icon_delete_trash.png\"></a>\n";
86  }
87 
88  return $document->format("$titleText<br/><img style='display:inline-block;vertical-align: middle' src='$icon' alt='$type'/> <a href='/action/document/download?document_id={document_id}'>Download</a>&nbsp;$size&nbsp;<span style='display: inline-block'>&nbsp;{$details_link}&nbsp;{$delete_link}</span>");
89  }
$file
Definition: delete.inc:47
$size
Definition: download.inc:47
$icon
Definition: upload.inc:92
if(! $document_id) $document
Definition: delete.inc:43

◆ writeScript()

DocumentLibraryView::writeScript ( )

Definition at line 91 of file document_view.inc.

92  {
93  $script .= $this->facetManager->writeScript();
94  $script .= $this->table->writeScript();
95 
96  ob_start();
97  ?>
98  <script type="text/javascript" src="/components/document/js/document_manager.js"></script>
99  <script type="text/javascript">
100  var documentMgr;
101 
102  window.addEvent('domready', function()
103  {
104  documentMgr = new DocumentManager(<?php echo $this->library->document_library_id ?>);
105  });
106 
107  // For compatibility with tree view - this function called from edit.inc
108  function editResult(result)
109  {
110  documentMgr.editResult(result);
111  }
112 
113  // For compatibility with tree view - this function called from upload.inc
114  function uploadResult(responseText)
115  {
116  documentMgr.uploadResult(responseText);
117  }
118  </script>
119  <?
120  $script .= ob_get_contents();
121  ob_end_clean();
122 
123  return $script;
124  }
The DocumentManager class provides the core API and management functions for uploading documents and ...

Member Data Documentation

◆ $facetManager

DocumentLibraryView::$facetManager

Definition at line 15 of file document_view.inc.

◆ $library

DocumentLibraryView::$library

Definition at line 13 of file document_view.inc.

◆ $mgr

DocumentLibraryView::$mgr

Definition at line 12 of file document_view.inc.

◆ $table

DocumentLibraryView::$table

Definition at line 14 of file document_view.inc.


The documentation for this class was generated from the following file: