function getContent()
 {
     $content = '';
     $uh = UserHelper::instance();
     if (is_a($this->item, 'Docman_File')) {
         $content .= '<h3>' . $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions') . '</h3>';
         $version_factory =& new Docman_VersionFactory();
         $approvalFactory =& Docman_ApprovalTableFactory::getFromItem($this->item);
         if ($versions = $version_factory->getAllVersionForItem($this->item)) {
             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>';
         }
     }
     if ($this->logger) {
         $content .= $this->logger->fetchLogsForItem($this->item->getId(), $this->display_access_logs);
     }
     return $content;
 }
 private function getSectionForNewVersion()
 {
     $content = '<dt>' . $GLOBALS['Language']->getText('plugin_docman', 'details_actions_newversion') . '</dt><dd>';
     if (!$this->_controller->userCanWrite($this->item->getid())) {
         $content .= $GLOBALS['Language']->getText('plugin_docman', 'details_actions_newversion_cannotcreate');
     } else {
         $content .= $GLOBALS['Language']->getText('plugin_docman', 'details_actions_newversion_cancreate', Docman_View_View::buildUrl($this->url, array('action' => 'action_new_version', 'id' => $this->item->getId())));
     }
     $content .= '</dd>';
     return $content;
 }
 function getTableHistory()
 {
     $html = '';
     $uh = UserHelper::instance();
     if (is_a($this->table, 'Docman_ApprovalTableVersionned')) {
         $html .= '<h3>' . $GLOBALS['Language']->getText('plugin_docman', 'details_approval_history_title') . '</h3>';
         $html .= html_build_list_table_top(array($GLOBALS['Language']->getText('plugin_docman', 'details_approval_history_table_version'), $GLOBALS['Language']->getText('plugin_docman', 'details_approval_history_table_owner'), $GLOBALS['Language']->getText('plugin_docman', 'details_approval_history_table_status'), $GLOBALS['Language']->getText('plugin_docman', 'details_approval_history_table_date')));
         $allTables = $this->atf->getAllApprovalTable();
         $rowColorIdx = 1;
         foreach ($allTables as $table) {
             $html .= '<tr class="' . html_get_alt_row_color($rowColorIdx++) . '">';
             if ($this->table->getVersionNumber() != $table->getVersionNumber()) {
                 $url = Docman_View_View::buildUrl($this->url, array('action' => 'details', 'section' => 'approval', 'id' => $this->item->getId(), 'version' => $table->getVersionNumber()));
                 $href = '<a href="' . $url . '">' . $table->getVersionNumber() . '</a>';
             } else {
                 $href = $table->getVersionNumber();
             }
             $html .= '<td>' . $href . '</td>';
             $html .= '<td>' . $this->hp->purify($uh->getDisplayNameFromUserId($table->getOwner())) . '</td>';
             $html .= '<td>' . $GLOBALS['Language']->getText('plugin_docman', 'approval_review_state_' . $table->getApprovalState()) . '</td>';
             $html .= '<td>' . util_timestamp_to_userdateformat($table->getDate()) . '</td>';
             $html .= '</tr>';
         }
         $html .= '</table>';
     }
     return $html;
 }
 function _displayItem(&$item, $params)
 {
     $li_displayed = false;
     if ($this->stripFirstNode && !$this->firstNodeStripped) {
         $this->firstNodeStripped = true;
         if (isset($this->params['display_description']) && $this->params['display_description']) {
             $this->html .= '<p>' . $item->getDescription() . '</p>';
         }
     } else {
         if ($item !== null && $this->_canDisplayItem($item)) {
             $this->html .= '<li id="item_' . $item->getId() . '" class="' . Docman_View_Browse::getItemClasses($params) . '">';
             $params['expanded'] = true;
             $open = '_open';
             if (!isset($this->params['item_to_move']) && user_get_preference(PLUGIN_DOCMAN_EXPAND_FOLDER_PREF . '_' . $item->getGroupId() . '_' . $item->getId()) === false) {
                 $params['expanded'] = false;
                 $open = '';
             }
             $icon_src = $this->params['docman_icons']->getIconForItem($item, $params);
             $icon = '<img src="' . $icon_src . '" class="docman_item_icon" />';
             $this->html .= '<div>';
             $action = isset($this->params['item_to_move']) ? false : $item->accept($this->get_action_on_icon, array('view' => &$this->view));
             if ($action) {
                 $class = $item->accept($this->get_class_for_link, array('view' => &$this->view));
                 if ($class) {
                     $class .= $open;
                 }
                 $url = Docman_View_View::buildUrl($this->params['default_url'], array('action' => $action, 'id' => $item->getId()));
                 $this->html .= '<a href="' . $url . '" class="' . $class . '">';
             }
             $this->html .= $icon;
             if ($action) {
                 $this->html .= '</a>';
             }
             $this->html .= '<span class="docman_item_title">';
             if ($action) {
                 $url = Docman_View_View::buildActionUrl($this->params, array('action' => 'show', 'id' => $item->getId()), false, isset($params['popup_doc']) ? true : false);
                 $this->html .= '<a href="' . $url . '" id="docman_item_title_link_' . $item->getId() . '">';
             }
             $this->html .= $this->hp->purify($item->getTitle(), CODENDI_PURIFIER_CONVERT_HTML);
             if ($action) {
                 $this->html .= '</a>';
             }
             $this->html .= '</span>';
             $this->html .= $this->view->getItemMenu($item, $this->params);
             $this->js .= $this->view->getActionForItem($item);
             $this->html .= '</div>';
             if (trim($item->getDescription()) != '') {
                 $this->html .= '<div class="docman_item_description">' . $this->hp->purify($item->getDescription(), CODENDI_PURIFIER_BASIC, $item->getGroupId()) . '</div>';
             }
             $li_displayed = true;
         }
     }
     return $li_displayed;
 }
 function buildActionUrl($params, $parameters, $injs = false, $popup = false)
 {
     $output = '';
     $prefix = '';
     if (isset($params['default_url']) && $params['default_url'] != false && $params['default_url'] !== null) {
         $prefix = $params['default_url'];
     }
     if (isset($params['pv']) && $params['pv'] !== false && $popup) {
         $output = Docman_View_View::buildPopupUrl($prefix, $parameters, $injs);
     } else {
         if (isset($params['pv']) && $params['pv'] !== false) {
             $parameters['pv'] = $params['pv'];
         }
         if (isset($params['report']) && $params['report'] !== false) {
             $parameters['report'] = $params['report'];
         }
         $output = Docman_View_View::buildUrl($prefix, $parameters, !$injs);
     }
     return $output;
 }
 private function getLinkVersions()
 {
     $uh = UserHelper::instance();
     $content = '<h3>' . $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions') . '</h3>';
     $version_factory = new Docman_LinkVersionFactory();
     $versions = $version_factory->getAllVersionForItem($this->item);
     if ($versions) {
         $titles = array($GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_version'), $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_date'), $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_author'), $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_label'), $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_changelog'));
         $content .= html_build_list_table_top($titles, false, false, false);
         $odd_even = array('boxitem', 'boxitemalt');
         $i = 0;
         foreach (array_keys($versions) as $key) {
             $download = Docman_View_View::buildUrl($this->url, array('action' => 'show', 'id' => $this->item->getId(), 'version_number' => $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>';
             $content .= '</tr>';
         }
         $content .= '</table>';
     } else {
         $content .= '<div>' . $GLOBALS['Language']->getText('plugin_docman', 'details_history_versions_error') . '</div>';
     }
     return $content;
 }