private function getFileVersions()
 {
     $uh = UserHelper::instance();
     $content = '<h3>' . $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions') . '</h3>';
     $version_factory = new Docman_VersionFactory();
     $approvalFactory = Docman_ApprovalTableFactoriesFactory::getFromItem($this->item);
     $versions = $version_factory->getAllVersionForItem($this->item);
     if ($versions) {
         if (count($versions)) {
             $titles = array();
             $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_version');
             $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_date');
             $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_author');
             $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_label');
             $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_changelog');
             $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_approval');
             $titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_delete_version');
             $content .= html_build_list_table_top($titles, false, false, false);
             $odd_even = array('boxitem', 'boxitemalt');
             $i = 0;
             foreach ($versions as $key => $nop) {
                 $download = Docman_View_View::buildUrl($this->url, array('action' => 'show', 'id' => $this->item->getId(), 'version_number' => $versions[$key]->getNumber()));
                 $delete = Docman_View_View::buildUrl($this->url, array('action' => 'confirmDelete', 'id' => $this->item->getId(), 'version' => $versions[$key]->getNumber()));
                 $user = $versions[$key]->getAuthorId() ? $uh->getDisplayNameFromUserId($versions[$key]->getAuthorId()) : $GLOBALS['Language']->getText('plugin_docman', 'details_history_anonymous');
                 $content .= '<tr class="' . $odd_even[$i++ % count($odd_even)] . '">';
                 $content .= '<td align="center"><a href="' . $download . '">' . $versions[$key]->getNumber() . '</a></td>';
                 $content .= '<td>' . html_time_ago($versions[$key]->getDate()) . '</td>';
                 $content .= '<td>' . $this->hp->purify($user) . '</td>';
                 $content .= '<td>' . $this->hp->purify($versions[$key]->getLabel()) . '</td>';
                 $content .= '<td>' . $this->hp->purify($versions[$key]->getChangelog(), CODENDI_PURIFIER_LIGHT) . '</td>';
                 $table = $approvalFactory->getTableFromVersion($versions[$key]);
                 if ($table != null) {
                     $appTable = Docman_View_View::buildUrl($this->url, array('action' => 'details', 'section' => 'approval', 'id' => $this->item->getId(), 'version' => $versions[$key]->getNumber()));
                     $content .= '<td align="center"><a href="' . $appTable . '">' . ($titles[] = $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_approval_show') . '</a></td>');
                 } else {
                     $content .= '<td></td>';
                 }
                 $content .= '<td align="center"><a href="' . $delete . '"><img src="' . util_get_image_theme("ic/trash.png") . '" height="16" width="16" border="0"></a></td>';
                 $content .= '</tr>';
             }
             $content .= '</table>';
         } else {
             $content .= '<div>' . $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_no') . '</div>';
         }
     } else {
         $content .= '<div>' . $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_error') . '</div>';
     }
     return $content;
 }
 public function visitFile(Docman_File $item)
 {
     $this->statistics['nb_file']++;
     $n = $this->visitDocument($item);
     // Dump all versions
     $versionFactory = new Docman_VersionFactory();
     $versions = array_reverse($versionFactory->getAllVersionForItem($item));
     if (count($versions) > 0) {
         $vNode = $this->doc->createElement('versions');
         foreach ($versions as $version) {
             $this->statistics['nb_version']++;
             $vNode->appendChild($this->createVersion($version));
         }
         $n->appendChild($vNode);
     }
     return $n;
 }