当前位置: 首页>>代码示例>>PHP>>正文


PHP UserHelper::getDisplayNameFromUserName方法代码示例

本文整理汇总了PHP中UserHelper::getDisplayNameFromUserName方法的典型用法代码示例。如果您正苦于以下问题:PHP UserHelper::getDisplayNameFromUserName方法的具体用法?PHP UserHelper::getDisplayNameFromUserName怎么用?PHP UserHelper::getDisplayNameFromUserName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserHelper的用法示例。


在下文中一共展示了UserHelper::getDisplayNameFromUserName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: svn_utils_format_svn_history

function svn_utils_format_svn_history($group_id)
{
    global $Language;
    $output = '';
    $res_svnfullhist = svn_data_get_svn_history($group_id);
    if (!$res_svnfullhist || db_numrows($res_svnfullhist) < 1) {
        print '<P>' . $Language->getText('svn_utils', 'no_hist');
    } else {
        $svnhist = array();
        while ($row_svnfullhist = db_fetch_array($res_svnfullhist)) {
            $svnhist[$row_svnfullhist['user_name']]['full'] = $row_svnfullhist['commits'];
            $svnhist[$row_svnfullhist['user_name']]['last'] = 0;
        }
        // Now over the last 7 days
        $res_svnlasthist = svn_data_get_svn_history($group_id, 7 * 24 * 3600);
        while ($row_svnlasthist = db_fetch_array($res_svnlasthist)) {
            $svnhist[$row_svnlasthist['user_name']]['last'] = $row_svnlasthist['commits'];
        }
        // Format output
        $output = '<P><b>' . $Language->getText('svn_utils', 'ci_week') . '</b><BR>&nbsp;';
        reset($svnhist);
        $uh = new UserHelper();
        $hp = Codendi_HTMLPurifier::instance();
        while (list($user, ) = each($svnhist)) {
            $output .= '<BR>' . $hp->purify($uh->getDisplayNameFromUserName($user), CODENDI_PURIFIER_CONVERT_HTML) . ' (' . $svnhist[$user]['last'] . '/' . $svnhist[$user]['full'] . ')';
        }
    }
    return $output;
}
开发者ID:pombredanne,项目名称:tuleap,代码行数:29,代码来源:svn_utils.php

示例2: _display_muc_logs

 private function _display_muc_logs($group_id, $start_date, $end_date)
 {
     $pm = ProjectManager::instance();
     $project = $pm->getProject($group_id);
     $any = $GLOBALS['Language']->getText('global', 'any');
     echo '<h2>' . $GLOBALS['Language']->getText('plugin_im', 'muc_logs_title') . '</h2>';
     echo '<form name="muclog_search" id="muclog_search" action="">';
     echo ' <fieldset>';
     echo '  <legend>' . $GLOBALS['Language']->getText('plugin_im', 'muc_logs_search') . ' <img src="' . $this->iconsPath . 'help.png" alt="' . $GLOBALS['Language']->getText('plugin_im', 'muc_logs_helpsearch') . '" title="' . $GLOBALS['Language']->getText('plugin_im', 'muc_logs_helpsearch') . '" /> </legend>';
     echo '  <p>';
     echo '   <label for="log_start_date">' . $GLOBALS['Language']->getText('plugin_im', 'muc_logs_start_date') . '</label>';
     echo $GLOBALS['HTML']->getDatePicker('log_start_date', 'log_start_date', $start_date);
     echo '  </p>';
     echo '  <p>';
     echo '   <label for="log_end_date">' . $GLOBALS['Language']->getText('plugin_im', 'muc_logs_end_date') . '</label>';
     echo $GLOBALS['HTML']->getDatePicker('log_end_date', 'log_end_date', $end_date);
     echo '  </p>';
     echo '  <p>';
     echo '   <label for="search_button">&nbsp;</label>';
     echo '  <input id="search_button" type="submit" value="' . $GLOBALS['Language']->getText('plugin_im', 'search') . '">';
     echo '  </p>';
     echo ' </fieldset>';
     echo ' <input type="hidden" name="action" value="muc_logs" />';
     echo ' <input type="hidden" name="group_id" value="' . $group_id . '" />';
     echo '</form>';
     $mclm = IMMucLogManager::getMucLogManagerInstance();
     $conversations = null;
     try {
         if ($start_date == $any && $end_date == $any) {
             $conversations = $mclm->getLogsByGroupName($project->getUnixName(true));
         } elseif ($start_date == $any && $end_date != $any) {
             $conversations = $mclm->getLogsByGroupNameBeforeDate($project->getUnixName(true), $end_date);
         } elseif ($start_date != $any && $end_date == $any) {
             $conversations = $mclm->getLogsByGroupNameAfterDate($project->getUnixName(true), $start_date);
         } else {
             $conversations = $mclm->getLogsByGroupNameBetweenDates($project->getUnixName(true), $start_date, $end_date);
         }
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     if (!$conversations || sizeof($conversations) == 0) {
         echo $GLOBALS['Language']->getText('plugin_im', 'no_muc_logs');
     } else {
         $purifier = Codendi_HTMLPurifier::instance();
         $uh = new UserHelper();
         $nick_color_arr = array();
         // association array nickname => color
         $available_colors = $GLOBALS['HTML']->getTextColors();
         echo '<table class="logs">';
         echo ' <tr>';
         echo '  <th>' . $GLOBALS['Language']->getText('plugin_im', 'muc_logs_time') . '</th>';
         echo '  <th>' . $GLOBALS['Language']->getText('plugin_im', 'muc_logs_user') . '</th>';
         echo '  <th>' . $GLOBALS['Language']->getText('plugin_im', 'muc_logs_message') . '</th>';
         echo ' </tr>';
         $current_day = null;
         $current_time_minute = null;
         $last_conversation_activity = null;
         foreach ($conversations as $conv) {
             if ($conv->getDay() != $current_day) {
                 $current_day = $conv->getDay();
                 echo ' <tr class="boxtitle">';
                 echo '  <td colspan="3">' . $conv->getDay() . '</td>';
                 echo ' </tr>';
             } else {
                 if ($conv->getTimestamp() - $last_conversation_activity > IMMucLog::DELAY_BETWEEN_CONVERSATIONS * 60) {
                     echo ' <tr class="conversation_separation">';
                     echo '  <td colspan="3"><hr class="conversation_separation"></td>';
                     echo ' </tr>';
                 }
             }
             // if nickname hasn't its color yet, we give it a new one
             if (!array_key_exists($conv->getNickname(), $nick_color_arr)) {
                 // if all the colors have been used, we start again with the same colors
                 if (sizeof($available_colors) == 0) {
                     $available_colors = $GLOBALS['HTML']->getChartColors();
                 }
                 $current_color = array_pop($available_colors);
                 // remove a color from the array, and set it to current color
                 $nick_color_arr[$conv->getNickname()] = $GLOBALS['HTML']->getColorCodeFromColorName($current_color);
             }
             echo ' <tr class="' . get_class($conv) . '">';
             if ($conv->getTime() != $current_time_minute) {
                 $current_time_minute = $conv->getTime();
                 echo '  <td class="log_time">' . $current_time_minute . '</td>';
             } else {
                 echo '  <td class="log_time">&nbsp;</td>';
             }
             if ($conv->getNickname() != null) {
                 echo '  <td class="log_nickname"><span title="' . $purifier->purify($uh->getDisplayNameFromUserName($conv->getUsername())) . '" style="color: ' . $nick_color_arr[$conv->getNickname()] . ';">&lt;' . $purifier->purify($conv->getNickname(), CODENDI_PURIFIER_CONVERT_HTML) . '&gt;</span></td>';
             } else {
                 echo '  <td class="log_nickname">&nbsp;</td>';
             }
             echo '  <td class="' . get_class($conv) . '">' . $purifier->purify($conv->getMessage(), CODENDI_PURIFIER_BASIC, $group_id) . '</td>';
             echo ' </tr>';
             // update last activity time
             $last_conversation_activity = $conv->getTimestamp();
         }
         echo '</table>';
         echo '<form action="" method="post" name="muc_logs_export_form" id="muc_logs_export_form">';
         echo ' <input name="type" value="export" type="hidden">';
//.........这里部分代码省略.........
开发者ID:pdaniel-frk,项目名称:tuleap,代码行数:101,代码来源:IMViews.class.php


注:本文中的UserHelper::getDisplayNameFromUserName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。