本文整理汇总了PHP中UserHelper::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP UserHelper::instance方法的具体用法?PHP UserHelper::instance怎么用?PHP UserHelper::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserHelper
的用法示例。
在下文中一共展示了UserHelper::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getTable
function getTable($params)
{
$this->defaultUrl = $params['default_url'];
$content = '';
$content .= html_build_list_table_top(array($GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_title'), $GLOBALS['Language']->getText('plugin_docman', 'view_documenttable_location'), $GLOBALS['Language']->getText('plugin_docman', 'admin_lock_infos_who'), $GLOBALS['Language']->getText('plugin_docman', 'admin_lock_infos_when')));
// Get list of all locked documents in the project.
$dPM = Docman_PermissionsManager::instance($params['group_id']);
$lockInfos = $dPM->getLockFactory()->getProjectLockInfos($params['group_id']);
$uH = UserHelper::instance();
$hp = Codendi_HTMLPurifier::instance();
require_once dirname(__FILE__) . '/../Docman_ItemFactory.class.php';
$dIF = new Docman_ItemFactory($params['group_id']);
$altRowClass = 0;
foreach ($lockInfos as $row) {
$trclass = html_get_alt_row_color($altRowClass++);
$item = $dIF->getItemFromDb($row['item_id']);
$parent = $dIF->getItemFromDb($item->getParentId());
$content .= '<tr class="' . $trclass . '">';
$content .= '<td>' . '<a href="/plugins/docman/?group_id=' . $params['group_id'] . '&action=details&id=' . $item->getId() . '">' . $item->getTitle() . '</a></td>';
$content .= '<td>';
if ($dIF->isRoot($parent)) {
$content .= '</td>';
} else {
$content .= '<a href="' . $this->defaultUrl . '&action=show&id=' . $parent->getId() . '">' . $parent->getTitle() . '</a></td>';
}
$content .= '<td>' . $hp->purify($uH->getDisplayNameFromUserId($row['user_id'])) . '</td>';
$content .= '<td>' . format_date($GLOBALS['Language']->getText('system', 'datefmt'), $row['lock_date']) . '</td>';
$content .= '</tr>';
}
$content .= '</table>';
return $content;
}
示例2: getContent
public function getContent()
{
$request =& HTTPRequest::instance();
$group_id = $request->get('group_id');
$pm = ProjectManager::instance();
$project = $pm->getProject($group_id);
$res_admin = db_query("SELECT user.user_id AS user_id,user.user_name AS user_name, user.realname as realname " . "FROM user,user_group " . "WHERE user_group.user_id=user.user_id AND user_group.group_id=" . db_ei($group_id) . " AND " . "user_group.admin_flags = 'A'");
if (db_numrows($res_admin) > 0) {
$user_helper = UserHelper::instance();
$hp = Codendi_HTMLPurifier::instance();
$em = EventManager::instance();
echo '<span class="develtitle">' . $GLOBALS['Language']->getText('include_project_home', 'proj_admins') . ':</span><br />';
while ($row_admin = db_fetch_array($res_admin)) {
$display_name = '';
$em->processEvent('get_user_display_name', array('user_id' => $row_admin['user_id'], 'user_name' => $row_admin['user_name'], 'realname' => $row_admin['realname'], 'user_display_name' => &$display_name));
if (!$display_name) {
$display_name = $hp->purify($user_helper->getDisplayNameFromUserId($row_admin['user_id']));
}
echo '<a href="/users/' . $row_admin['user_name'] . '/">' . $display_name . '</a><br />';
}
}
echo '<span class="develtitle">' . $GLOBALS['Language']->getText('include_project_home', 'proj_members') . ':</span><br />';
// count of developers on this project
$res_count = db_query("SELECT user_id FROM user_group WHERE group_id=" . db_ei($group_id));
echo db_numrows($res_count);
echo ' <a href="/project/memberlist.php?group_id=' . $group_id . '">[' . $GLOBALS['Language']->getText('include_project_home', 'view_members') . ']</a>';
}
示例3: getContent
function getContent()
{
$html = '';
$i = 1;
$UH = UserHelper::instance();
$hp = Codendi_HTMLPurifier::instance();
while ($data = db_fetch_array($this->getLatestRevisions())) {
$html .= '<div class="' . util_get_alt_row_color($i++) . '" style="border-bottom:1px solid #ddd">';
$html .= '<div style="font-size:0.98em;">';
$html .= '<a href="' . $this->_getLinkToCommit($data) . '">#' . $data['revision'] . '</a>';
$html .= ' by ';
if (isset($data['whoid'])) {
$name = $UH->getDisplayNameFromUserId($data['whoid']);
} else {
$name = $UH->getDisplayNameFromUserName($data['who']);
}
$html .= $hp->purify($name, CODENDI_PURIFIER_CONVERT_HTML) . ' on ';
//In the db, svn dates are stored as int whereas cvs dates are stored as timestamp
$html .= format_date($GLOBALS['Language']->getText('system', 'datefmt'), is_numeric($data['date']) ? $data['date'] : strtotime($data['date']));
$html .= '</div>';
$html .= '<div style="padding-left:20px; padding-bottom:4px; color:#555">';
$html .= util_make_links(substr($data['description'], 0, 255), $this->group_id);
if (strlen($data['description']) > 255) {
$html .= ' [...]';
}
$html .= '</div>';
$html .= '</div>';
}
$html .= '<div style="text-align:center" class="' . util_get_alt_row_color($i++) . '">';
$html .= '<a href="' . $this->_getLinkToMore() . '">[ More ]</a>';
$html .= '</div>';
return $html;
}
示例4: getContent
public function getContent()
{
$html = '';
$uh = UserHelper::instance();
$request = HTTPRequest::instance();
$hp = Codendi_HTMLPurifier::instance();
$user = UserManager::instance()->getCurrentUser();
$pm = ProjectManager::instance();
$project_ids = $user->getProjects();
foreach ($project_ids as $project_id) {
$project = $pm->getProject($project_id);
if ($project->usesSVN()) {
list($hide_now, $count_diff, $hide_url) = my_hide_url('my_svn_group', $project_id, $request->get('hide_item_id'), count($project_ids), $request->get('hide_my_svn_group'));
$html .= $hide_url;
$html .= '<strong>' . $project->getPublicName() . '</strong>';
if (!$hide_now) {
list($latest_revisions, $nb_revisions) = svn_get_revisions($project, 0, $this->_nb_svn_commits, '', $user->getUserName(), '', '', 0, false);
if (db_numrows($latest_revisions) > 0) {
$i = 0;
while ($data = db_fetch_array($latest_revisions)) {
$html .= '<div class="' . util_get_alt_row_color($i++) . '" style="border-bottom:1px solid #ddd">';
$html .= '<div style="font-size:0.98em;">';
$html .= '<a href="' . $this->_getLinkToCommit($project->getGroupId(), $data['revision']) . '">rev #' . $data['revision'] . '</a>';
$html .= ' ' . $GLOBALS['Language']->getText('my_index', 'my_latest_svn_commit_on') . ' ';
//In the db, svn dates are stored as int whereas cvs dates are stored as timestamp
$html .= format_date($GLOBALS['Language']->getText('system', 'datefmt'), is_numeric($data['date']) ? $data['date'] : strtotime($data['date']));
$html .= ' ' . $GLOBALS['Language']->getText('my_index', 'my_latest_svn_commit_by') . ' ';
if (isset($data['whoid'])) {
$name = $uh->getDisplayNameFromUserId($data['whoid']);
} else {
$name = $uh->getDisplayNameFromUserName($data['who']);
}
$html .= $hp->purify($name, CODENDI_PURIFIER_CONVERT_HTML);
$html .= '</div>';
$html .= '<div style="padding-left:20px; padding-bottom:4px; color:#555">';
$html .= util_make_links(substr($data['description'], 0, 255), $project->getGroupId());
if (strlen($data['description']) > 255) {
$html .= ' [...]';
}
$html .= '</div>';
$html .= '</div>';
}
$html .= '<div style="text-align:center" class="' . util_get_alt_row_color($i++) . '">';
$html .= '<a href="' . $this->_getLinkToMore($project->getGroupId(), $user->getUserName()) . '">[ More ]</a>';
$html .= '</div>';
} else {
$html .= '<div></div>';
}
} else {
$html .= '<div></div>';
}
}
}
return $html;
}
示例5: getContent
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;
}
示例6: getContent
function getContent()
{
$html = '';
$dwItemFactory = $this->getDocmanWatermarkItemFactory();
$watermarkingIsDisabled = $dwItemFactory->isWatermarkingDisabled($this->item->getId());
// Status
if ($watermarkingIsDisabled) {
$status = '<strong>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_watermarking_disabled') . '</strong>';
} else {
$status = $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_watermarking_enabled');
}
$html .= '<p>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_watermarking_status', array($status)) . '</p>';
// About section
$html .= '<h2>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_about_title') . '</h2>';
$html .= '<p>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_disclamer_pdf') . '</p>';
// Disable/enable section
$user = $this->getUserManager()->getCurrentUser();
$dPm = $this->getDocman_PermissionsManager($this->item->getGroupId());
if ($dPm->userCanManage($user, $this->item->getId())) {
$html .= '<h2>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_toggle_title') . '</h2>';
$html .= '<p>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_watermarking_desc') . '</p>';
$html .= '<p>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_watermarking_clicktoproceed') . '</p>';
$html .= '<form method="post" action="' . $this->url . '&item_id=' . $this->item->getId() . '&action=docmanwatermark_toggle_item">';
if ($watermarkingIsDisabled) {
$html .= '<input type="submit" name="enable_watermarking" value="' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_watermarking_enableit') . '" />';
} else {
$html .= '<input type="submit" name="disable_watermarking" value="' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_watermarking_disableit') . '" />';
}
$html .= '</form>';
}
// History
$html .= '<h2>' . $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_history_title') . '</h2>';
$dwLog = $this->getDocmanWatermark_Log();
$dar = $dwLog->getLog($this->item);
if ($dar && $dar->rowCount() > 0) {
$uh = UserHelper::instance();
$hp = Codendi_HTMLPurifier::instance();
$titles = array($GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_history_when'), $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_history_who'), $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_history_what'));
$html .= html_build_list_table_top($titles, false, false, false);
$altColor = 0;
foreach ($dar as $logEntry) {
$html .= '<tr class="' . html_get_alt_row_color($altColor++) . '">';
$html .= '<td>' . util_timestamp_to_userdateformat($logEntry['time']) . '</td>';
$html .= '<td>' . $hp->purify($uh->getDisplayNameFromUserId($logEntry['who'])) . '</td>';
$html .= '<td>' . ($logEntry['watermarked'] == 0 ? $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_history_desactivate') : $GLOBALS['Language']->getText('plugin_docmanwatermark', 'details_history_activate')) . '</td>';
$html .= '</tr>';
}
$html .= '</table>';
}
return $html;
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:51,代码来源:DocmanWatermark_View_ItemDetailsSectionWatermarking.class.php
示例7: snippet_show_package_snippets
function snippet_show_package_snippets($version)
{
global $Language;
//show the latest version
$sql = "SELECT snippet.snippet_id, snippet_package_item.snippet_version_id, snippet_version.version,snippet.name,user.user_name, snippet_version.filesize " . "FROM snippet,snippet_version,snippet_package_item,user " . "WHERE snippet.snippet_id=snippet_version.snippet_id " . "AND user.user_id=snippet_version.submitted_by " . "AND snippet_version.snippet_version_id=snippet_package_item.snippet_version_id " . "AND snippet_package_item.snippet_package_version_id='{$version}'";
$result = db_query($sql);
$rows = db_numrows($result);
echo '
<P>
<H3>' . $Language->getText('snippet_add_snippet_to_package', 's_in_p') . '</H3>
<P>';
$title_arr = array();
$title_arr[] = $Language->getText('snippet_utils', 'version_id');
$title_arr[] = $Language->getText('snippet_details', 's_version');
$title_arr[] = $Language->getText('snippet_browse', 'title');
$title_arr[] = $Language->getText('snippet_details', 'author');
echo html_build_list_table_top($title_arr, $links_arr);
if (!$result || $rows < 1) {
echo db_error();
echo '
<TR><TD COLSPAN="4"><H3>' . $Language->getText('snippet_add_snippet_to_package', 'no_s_in_p') . '</H3></TD></TR>';
} else {
//get the newest version, so we can display it's code
$newest_version = db_result($result, 0, 'snippet_version_id');
for ($i = 0; $i < $rows; $i++) {
echo '
<TR class="' . util_get_alt_row_color($i) . '">
<TD><A HREF="/snippet/detail.php?type=snippet&id=' . db_result($result, $i, 'snippet_id') . '"><b><center>' . db_result($result, $i, 'snippet_version_id') . '</center></b></A></TD>
<TD>';
echo '<A HREF="/snippet/download.php?type=snippet&id=' . db_result($result, $i, 'snippet_version_id') . '"><b><center>' . db_result($result, $i, 'version') . '</b></A>';
// For uploaded files, the user can choose between view or display the code snippet
if (db_result($result, $i, 'filesize') != 0) {
// View link : the file is forced to be displayed as a text
echo ' <a href="/snippet/download.php?mode=view&type=snippet&id=' . db_result($result, $i, 'snippet_version_id') . '">';
echo '<img src="' . util_get_image_theme("ic/view.png") . '" border="0" alt="' . $Language->getText('snippet_details', 'view') . '" title="' . $Language->getText('snippet_details', 'view') . '"></a>';
// Download link : the file is forced to be downloaded
echo ' <a href="/snippet/download.php?mode=download&type=snippet&id=' . db_result($result, $i, 'snippet_version_id') . '">';
echo '<img src="' . util_get_image_theme("ic/download.png") . '" border="0" alt="' . $Language->getText('snippet_details', 'download') . '" title="' . $Language->getText('snippet_details', 'download') . '"></a>';
}
$user = UserManager::instance()->getUserByUserName(db_result($result, $i, 'user_name'));
echo '</center></TD>
<TD>' . db_result($result, $i, 'name') . '</TD><TD>' . UserHelper::instance()->getLinkOnUser($user) . '</TD></TR>';
}
}
echo '</TABLE>';
}
示例8: forum_show_a_nested_message
function forum_show_a_nested_message($result, $row = 0)
{
/*
accepts a database result handle to display a single message
in the format appropriate for the nested messages
second param is which row in that result set to use
*/
global $Language;
$g_id = db_result($result, $row, 'group_id');
if ($g_id == $GLOBALS['sys_news_group']) {
$f_id = db_result($result, $row, 'group_forum_id');
$gr = db_query("SELECT group_id FROM news_bytes WHERE forum_id=" . db_ei($f_id));
$g_id = db_result($gr, 0, 'group_id');
}
$poster = UserManager::instance()->getUserByUserName(db_result($result, $i, 'user_name'));
$ret_val = '
<TABLE BORDER="0" WIDTH="100%">
<TR>
<TD class="thread" NOWRAP>' . $Language->getText('forum_forum', 'by') . ': ' . UserHelper::instance()->getLinkOnUser($poster) . '<BR><A HREF="/forum/message.php?msg_id=' . db_result($result, $row, 'msg_id') . '">' . '<IMG SRC="' . util_get_image_theme("msg.png") . '" BORDER=0 HEIGHT=12 WIDTH=10> ' . db_result($result, $row, 'subject') . ' [ ' . $Language->getText('forum_forum', 'reply') . ' ]</A> ' . '<BR>' . format_date($GLOBALS['Language']->getText('system', 'datefmt'), db_result($result, $row, 'date')) . '
</TD>
</TR>
<TR>
<TD>
' . util_make_links(nl2br(db_result($result, $row, 'body')), $g_id) . '
</TD>
</TR>';
$crossref_fact = new CrossReferenceFactory(db_result($result, $row, 'msg_id'), ReferenceManager::REFERENCE_NATURE_FORUMMESSAGE, $g_id);
$crossref_fact->fetchDatas();
if ($crossref_fact->getNbReferences() > 0) {
$ret_val .= '<tr>';
$ret_val .= ' <td class="forum_reference_separator">';
$ret_val .= ' <b> ' . $Language->getText('cross_ref_fact_include', 'references') . '</b>';
$ret_val .= $crossref_fact->getHTMLDisplayCrossRefs();
$ret_val .= ' </td>';
$ret_val .= '</tr>';
}
$ret_val .= '
<tr>
<td>
</td>
</tr>
</TABLE>';
return $ret_val;
}
示例9: display_user_result_table
function display_user_result_table($res)
{
$user_helper = UserHelper::instance();
$hp = Codendi_HTMLPurifier::instance();
$nb_cols = 3;
if (db_numrows($res)) {
echo '<table><tr>';
$i = 0;
while ($data = db_fetch_array($res)) {
if ($i++ % $nb_cols == 0) {
echo '</tr><tr>';
}
$action = 'add';
$background = 'eee';
if ($data['is_on']) {
$action = 'remove';
$background = 'dcf7c4';
}
echo '<td width="' . round(100 / $nb_cols) . '%">';
echo '<div style="border:1px solid #CCC; background: #' . $background . '; padding:10px 5px; position:relative">';
echo '<table width="100%"><tr><td><a href="/users/' . $hp->purify($data['user_name']) . '/">' . $hp->purify($user_helper->getDisplayName($data['user_name'], $data['realname'])) . '</a></td>';
echo '<td style="text-align:right;">';
project_admin_display_bullet_user($data['user_id'], $action);
echo '</td></tr></table>';
echo '<div style="color:#666; ">' . $data['email'] . '</div>';
echo '</div>';
echo '</td>';
}
while ($i++ % $nb_cols != 0) {
echo '<td width="' . round(100 / $nb_cols) . '%"></td>';
}
echo '</tr></table>';
} else {
echo 'No user match';
echo db_error();
}
}
示例10: getQueryOrderby
/**
* Get the "order by" statement to retrieve field values
*/
public function getQueryOrderby()
{
$uh = UserHelper::instance();
$R1 = 'R1_' . $this->field->id;
$R2 = 'R2_' . $this->field->id;
return "{$R2}.ugroup_id";
}
示例11: fetchFollowUp
/**
* Returns the HTML code of this comment
*
* @return string the HTML code of this comment
*/
public function fetchFollowUp()
{
if ($this->hasEmptyBody()) {
return null;
}
$uh = UserHelper::instance();
$html = '<div class="tracker_artifact_followup_comment_edited_by">';
if ($this->parent_id) {
$html .= $GLOBALS['Language']->getText('plugin_tracker_include_artifact', 'last_edited');
$html .= ' ' . $uh->getLinkOnUserFromUserId($this->submitted_by) . ' ';
$html .= DateHelper::timeAgoInWords($this->submitted_on, false, true);
}
$html .= '</div>';
if (!empty($this->body)) {
$html .= '<input type="hidden"
id="tracker_artifact_followup_comment_body_format_' . $this->changeset->getId() . '"
name="tracker_artifact_followup_comment_body_format_' . $this->changeset->getId() . '"
value="' . $this->bodyFormat . '" />';
$html .= '<div class="tracker_artifact_followup_comment_body">';
if ($this->parent_id && !trim($this->body)) {
$html .= '<em>' . $GLOBALS['Language']->getText('plugin_tracker_include_artifact', 'comment_cleared') . '</em>';
} else {
$html .= $this->getPurifiedBodyForHTML();
}
$html .= '</div>';
}
return $html;
}
示例12: getTableHistory
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;
}
示例13: fetchMailFollowUp
/**
* Returns the artifact followup for mail rendering
*
* @param array $recipient
* @param string $format, the mail format text or html
* @param bool $ignore_perms, indicates if we ignore various permissions
*
* @return String
*/
public function fetchMailFollowUp($recipient, $format, $ignore_perms = false)
{
$uh = UserHelper::instance();
$um = UserManager::instance();
$cs = $this->getChangesets();
$hp = Codendi_HTMLPurifier::instance();
$output = '';
foreach ($cs as $changeset) {
$comment = $changeset->getComment();
$changes = $changeset->diffToPrevious($format, $recipient, $ignore_perms);
if (empty($comment)) {
//do not display empty comment
continue;
}
switch ($format) {
case 'html':
$followup = $comment->fetchFollowUp($format, true);
if (!empty($followup)) {
if (!isset($output)) {
$output = '<h2>' . $GLOBALS['Language']->getText('plugin_tracker_include_artifact', 'follow_ups') . '</h2>';
}
$output .= '<div class="tracker_artifact_followup_header">';
$output .= $followup;
$output .= '</div>';
}
break;
case 'text':
$user = $um->getUserById($comment->submitted_by);
$output .= PHP_EOL;
$output .= '----------------------------- ';
$output .= PHP_EOL;
$output .= $GLOBALS['Language']->getText('plugin_tracker_artifact', 'mail_followup_date') . util_timestamp_to_userdateformat($comment->submitted_on);
$output .= "\t" . $GLOBALS['Language']->getText('plugin_tracker_artifact', 'mail_followup_by') . $uh->getDisplayNameFromUser($user);
$output .= PHP_EOL;
$output .= $comment->getPurifiedBodyForText();
$output .= PHP_EOL;
$output .= PHP_EOL;
break;
default:
$output .= '<!-- TODO -->';
break;
}
}
return $output;
}
示例14: _showProjectAdmins
protected function _showProjectAdmins()
{
$html = '';
$hp = Codendi_HTMLPurifier::instance();
$request = HTTPRequest::instance();
$vFunc = new Valid_WhiteList('plugin_admindelegation_func', array('show_admins'));
$vFunc->required();
if ($request->valid($vFunc)) {
$func = $request->get('plugin_admindelegation_func');
} else {
$func = '';
}
$vGroup = new Valid_String('plugin_admindelegation_group');
$vGroup->required();
if ($request->valid($vGroup)) {
$pm = ProjectManager::instance();
$project = $pm->getProjectFromAutocompleter($request->get('plugin_admindelegation_group'));
if ($project && $project->isActive()) {
$groupValue = $project->getPublicName() . ' (' . $project->getUnixName() . ')';
} else {
$groupValue = '';
}
} else {
$project = false;
$groupValue = '';
}
$html .= '<form method="post" action="?">';
$html .= '<label>' . $GLOBALS['Language']->getText('plugin_admindelegation', 'widget_admins_label') . '</label>';
$html .= '<input type="hidden" name="plugin_admindelegation_func" value="show_admins" />';
$html .= '<input type="text" name="plugin_admindelegation_group" value="' . $groupValue . '" size ="40" id="plugin_admindelegation_group" />';
$html .= ' ';
$html .= '<input type="submit" value="' . $GLOBALS['Language']->getText('plugin_admindelegation', 'widget_btn_search') . '"/>';
$html .= '</form>';
$js = "new ProjectAutoCompleter('plugin_admindelegation_group', '" . util_get_dir_image_theme() . "', false);";
$GLOBALS['HTML']->includeFooterJavascriptSnippet($js);
if ($func == 'show_admins' && $project && $project->isActive()) {
$allAdmins = array();
$users = $this->getProjectAdmins($project->getId());
if (count($users) > 0) {
$uh = UserHelper::instance();
$html .= '<table width="100%">';
$html .= '<theader>';
$html .= '<tr>';
$html .= '<th>' . $GLOBALS['Language']->getText('plugin_admindelegation', 'widget_admins_name') . '</th>';
$html .= '<th>' . $GLOBALS['Language']->getText('plugin_admindelegation', 'widget_admins_email') . '</th>';
$html .= '</tr>';
$html .= '</theader>';
$html .= '<tbody>';
$i = 1;
foreach ($users as $u) {
$mailto = $u->getRealname() . ' <' . $u->getEmail() . '>';
$allAdmins[] = $mailto;
$html .= '<tr class="' . util_get_alt_row_color($i++) . '">';
$html .= '<td>' . $hp->purify($uh->getDisplayNameFromUser($u)) . '</td>';
$html .= '<td><a href="mailto:' . $mailto . '">' . $u->getEmail() . '</a></td>';
$html .= '</tr>';
}
$html .= '</tbody>';
$html .= '</table>';
// Mail to all admins
$html .= '<div style="text-align:center" class="' . util_get_alt_row_color($i++) . '">';
$html .= '<a href="mailto:' . implode(',', $allAdmins) . '?Subject=' . $GLOBALS['Language']->getText('plugin_admindelegation', 'widget_admins_mass_mail_subject', array($GLOBALS['sys_name'], $project->getPublicName())) . '">' . $GLOBALS['Language']->getText('plugin_admindelegation', 'widget_admins_mass_mail') . '</a>';
$html .= '</div>';
}
}
return $html;
}
示例15: _getReviewerTable
function _getReviewerTable()
{
$html = '';
$uh = UserHelper::instance();
$html .= '<h3>' . $GLOBALS['Language']->getText('plugin_docman', 'details_approval_table_title') . '</h3>';
$html .= '<div id="docman_approval_table_create_table">';
if (!$this->table->isClosed()) {
$html .= '<div class="docman_help">' . $GLOBALS['Language']->getText('plugin_docman', 'details_approval_table_help') . '</div>';
}
$rIter = $this->table->getReviewerIterator();
if ($rIter !== null) {
$docmanIcons =& $this->_getDocmanIcons();
$html .= html_build_list_table_top(array($GLOBALS['Language']->getText('plugin_docman', 'details_approval_select'), $GLOBALS['Language']->getText('plugin_docman', 'details_approval_reviewer'), $GLOBALS['Language']->getText('plugin_docman', 'details_approval_review'), $GLOBALS['Language']->getText('plugin_docman', 'details_approval_rank')), false, false, false);
$isFirst = true;
$isLast = false;
$nbReviewers = $rIter->count();
$i = 0;
$rIter->rewind();
while ($rIter->valid()) {
$isLast = $i == $nbReviewers - 1;
$reviewer = $rIter->current();
// i+1 to start with 'white'
$html .= '<tr class="' . html_get_alt_row_color($i + 1) . '">';
// Select
if (!$this->table->isClosed()) {
$checkbox = '<input type="checkbox" name="sel_user[]" value="' . $reviewer->getId() . '" />';
} else {
$checkbox = ' ';
}
$html .= '<td align="center">' . $checkbox . '</td>';
// Username
$html .= '<td>' . $this->hp->purify($uh->getDisplayNameFromUserId($reviewer->getId())) . '</td>';
// Review
$html .= '<td>' . $this->atf->getReviewStateName($reviewer->getState()) . '</td>';
// Rank
if (!$this->table->isClosed()) {
$rank = $reviewer->getRank();
$baseUrl = '?group_id=' . $this->item->getGroupId() . '&action=approval_upd_user&id=' . $this->item->getId() . '&user_id=' . $reviewer->getId() . '&rank=';
$begLink = '';
$upLink = '';
if (!$isFirst) {
$begIcon = '<img src="' . $docmanIcons->getIcon('move-beginning') . '" alt="Beginning" />';
$begLink = '<a href="' . $baseUrl . 'beginning">' . $begIcon . '</a>';
$upIcon = '<img src="' . $docmanIcons->getIcon('move-up') . '" alt="Up" />';
$upLink = '<a href="' . $baseUrl . 'up">' . $upIcon . '</a>';
}
$endLink = '';
$downLink = '';
if (!$isLast) {
$endIcon = '<img src="' . $docmanIcons->getIcon('move-end') . '" alt="End" />';
$endLink = '<a href="' . $baseUrl . 'end">' . $endIcon . '</a>';
$downIcon = '<img src="' . $docmanIcons->getIcon('move-down') . '" alt="Down" />';
$downLink = '<a href="' . $baseUrl . 'down">' . $downIcon . '</a>';
}
$rankHtml = $upLink . ' ' . $downLink . ' ' . $begLink . ' ' . $endLink;
} else {
$rankHtml = ' ';
}
$html .= '<td align="center">' . $rankHtml . '</td>';
$html .= '</tr>';
$isFirst = false;
$i++;
$rIter->next();
}
$html .= '</table>';
// Action with selected reviewers
if (!$this->table->isClosed()) {
$html .= '<p>';
$html .= $GLOBALS['Language']->getText('plugin_docman', 'details_approval_create_table_act');
$vals = array('del', 'mail');
$txts = array($GLOBALS['Language']->getText('plugin_docman', 'details_approval_create_table_act_rm'), $GLOBALS['Language']->getText('plugin_docman', 'details_approval_create_table_act_mail'));
$html .= html_build_select_box_from_arrays($vals, $txts, 'sel_user_act', 100, true);
$html .= '</p>';
}
}
$html .= '</div>';
return $html;
}