function display($params) { $itemFactory = new Docman_ItemFactory($params['group_id']); $nbItemsFound = 0; $itemIterator = $itemFactory->getItemList($params['item']->getId(), $nbItemsFound, array('user' => $params['user'], 'ignore_collapse' => true, 'ignore_obsolete' => true, 'filter' => $params['filter'], 'getall' => true)); $result = array(); foreach ($itemIterator as $item) { $result[] = $item->toRow(); } return $result; }
function getTable($params) { $html = ''; // Get root $itemFactory = new Docman_ItemFactory($params['group_id']); $rootItem = $itemFactory->getRoot($params['group_id']); $nbItemsFound = 0; $itemIterator =& $itemFactory->getItemList($rootItem->getId(), $nbItemsFound, array('user' => $params['user'], 'ignore_collapse' => true, 'obsolete_only' => true)); $table = html_build_list_table_top(array('Title', 'Obsolete date')); $altRowClass = 0; $itemIterator->rewind(); while ($itemIterator->valid()) { $item =& $itemIterator->current(); $type = $itemFactory->getItemTypeForItem($item); if ($type != PLUGIN_DOCMAN_ITEM_TYPE_FOLDER) { $trclass = html_get_alt_row_color($altRowClass++); $table .= "<tr class=\"" . $trclass . "\">\n"; // Name $docmanIcons =& $this->_getDocmanIcons($params); $icon_src = $docmanIcons->getIconForItem($item, $params); $icon = '<img src="' . $icon_src . '" class="docman_item_icon" />'; $table .= "<td>"; $table .= '<span style="white-space: nowrap;">'; $table .= $icon; $url = $this->buildActionUrl($params, array('action' => 'details', 'id' => $item->getId()), false, true); $table .= '<a href="' . $url . '">'; $table .= htmlentities($item->getTitle(), ENT_QUOTES, 'UTF-8'); $table .= '</a>'; $table .= '</span>'; $table .= "</td>\n"; // Obsolete date $table .= "<td>"; $table .= format_date("Y-m-j", $item->getObsolescenceDate()); $table .= "</td>\n"; $table .= "</tr>\n"; } $itemIterator->next(); } $table .= "</table>\n"; $html = $table; return $html; }
/** * @access: protected */ function _content($params) { $itemFactory = new Docman_ItemFactory($params['group_id']); // Limit browsing $offset = 25; $_low_limit = 0; if (isset($params['start'])) { $_low_limit = (int) $params['start']; } $_high_limit = $_low_limit + $offset; $nbItemsFound = 0; $itemIterator =& $itemFactory->getItemList($params['item']->getId(), $nbItemsFound, array('user' => $params['user'], 'ignore_collapse' => true, 'ignore_obsolete' => true, 'filter' => $params['filter'], 'start' => $_low_limit, 'offset' => $offset)); // Default URL $this->_getDefaultUrlParams($params); $baseUrl = $this->buildActionUrl($params, array_merge($this->dfltParams, $this->dfltSearchParams)); // Generate table header $ci = $params['filter']->getColumnIterator(); $ci->rewind(); while ($ci->valid()) { $column = $ci->current(); $columnsTitles[] = $column->getTitle($this, $params); $ci->next(); } $table = html_build_list_table_top($columnsTitles); // Generate table $altRowClass = 0; $itemIterator->rewind(); while ($itemIterator->valid()) { $item =& $itemIterator->current(); $trclass = html_get_alt_row_color($altRowClass++); $table .= "<tr class=\"" . $trclass . "\">\n"; $ci->rewind(); while ($ci->valid()) { $column = $ci->current(); $table .= "<td>"; $table .= $column->getTableBox($item, $this, $params); $this->javascript .= $column->getJavascript($item, $this); $table .= "</td>\n"; $ci->next(); } $table .= "</tr>\n"; $itemIterator->next(); } $table .= "</table>\n"; // Prepare Navigation Bar if ($_low_limit > 0) { $firstUrl = $this->_buildSearchUrl($params, array('start' => '0')); $first = '<a href="' . $firstUrl . '"><< ' . $GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_begin') . '</a>'; } else { $first = '<< ' . $GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_begin'); } $previousOffset = $_low_limit - $offset; if ($_low_limit > 0) { if ($previousOffset < 0) { $previousOffset = 0; } $previousUrl = $this->_buildSearchUrl($params, array('start' => $previousOffset)); $previous = '<a href="' . $previousUrl . '">< ' . $GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_previous', $offset) . '></a>'; } else { $previous = '< ' . $GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_previous', $offset); } if ($_high_limit < $nbItemsFound) { $nextUrl = $this->_buildSearchUrl($params, array('start' => $_high_limit)); $next = '<a href="' . $nextUrl . '">' . $GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_next', $offset) . ' ></a>'; } else { $next = $GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_next', $offset) . ' >'; } if ($_high_limit < $nbItemsFound) { $lastOffset = $nbItemsFound - $offset; $lastUrl = $this->_buildSearchUrl($params, array('start' => $lastOffset)); $last = '<a href="' . $lastUrl . '">' . $GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_end') . ' >></a>'; } else { $last = $GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_end') . ' >>'; } $navbar = '<table border="0" width="100%"><tr><td align="left">' . $first . ' ' . $previous . '</td><td align="center">' . $nbItemsFound . ' ' . $GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_docfound') . '</td><td align="right">' . $next . ' ' . $last . '</td></tr></table>'; if (isset($params['filter']) && $params['filter'] !== null) { $htmlReport = new Docman_ReportHtml($params['filter'], $this, $params['default_url']); print $htmlReport->getReportCustomization($params); } print $navbar; print $table; }