function &getReviewerFactoryFromItem($item) { $appTableFactory = Docman_ApprovalTableFactory::getFromItem($item); if ($appTableFactory !== null) { $table =& $appTableFactory->getTable(); return $appTableFactory->_getReviewerFactory($table, $item); } }
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; }
function _getApprovalTable() { $html = ''; $atf =& Docman_ApprovalTableFactory::getFromItem($this->item); if ($atf->tableExistsForItem()) { $html .= '<dt>' . $GLOBALS['Language']->getText('plugin_docman', 'details_actions_update_apptable') . '</dt><dd>'; $html .= '<dd>'; $html .= Docman_View_ItemDetailsSectionApprovalCreate::displayImportLastTable(false); $html .= '</dd>'; } return $html; }
function initDisplay() { $request =& HTTPRequest::instance(); // // User may request a specific table id $vVersion = new Valid_UInt('version'); $vVersion->required(); if ($request->valid($vVersion)) { $this->version = $request->get('version'); } $this->atf =& Docman_ApprovalTableFactory::getFromItem($this->item, $this->version); $this->table =& $this->atf->getTable(); }
function displayNotificationEmail() { $html = ''; $html .= '<h3>' . $GLOBALS['Language']->getText('plugin_docman', 'details_approval_email_title') . '</h3>'; $atsm = new Docman_ApprovalTableNotificationCycle(); $atsm->setItem($this->item); $atf =& Docman_ApprovalTableFactory::getFromItem($this->item); $table = $atf->getTable(false); $atsm->setTable($table); $um =& UserManager::instance(); $owner =& $um->getUserById($table->getOwner()); $atsm->setOwner($owner); $email = $atsm->getNotifReviewer($owner); $html .= $GLOBALS['Language']->getText('plugin_docman', 'details_approval_email_subject') . ' ' . $email->getSubject() . "\n"; $html .= '<p class="docman_approval_email">'; $html .= htmlentities($email->getBody(), ENT_COMPAT, 'UTF-8'); $html .= '</p>'; $backurl = $this->url . '&action=approval_create&id=' . $this->item->getId(); $html .= '<a href="' . $backurl . '">' . $GLOBALS['Language']->getText('plugin_docman', 'details_approval_email_back') . '</a>'; return $html; }
function _validateApprovalTable($request, $item) { $atf = Docman_ApprovalTableFactory::getFromItem($item); if ($atf && $atf->tableExistsForItem()) { $vAppTable = new Valid_WhiteList('app_table_import', array('copy', 'reset', 'empty')); $vAppTable->required(); if (!$request->valid($vAppTable)) { $this->feedback->log('error', $GLOBALS['Language']->getText('plugin_docman', 'error_no_option')); return false; } } return true; }
function approval_delete() { // Params $item = $this->_controler->_actionParams['item']; $version = $this->_controler->_actionParams['version']; $atf =& Docman_ApprovalTableFactory::getFromItem($item, $version); $deleted = $atf->deleteTable(); if ($deleted) { $this->_controler->feedback->log('info', $GLOBALS['Language']->getText('plugin_docman', 'approval_tabledel_success')); } else { $this->_controler->feedback->log('error', $GLOBALS['Language']->getText('plugin_docman', 'approval_tabledel_failure')); } }