• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP utf8_str_pad函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中utf8_str_pad函数的典型用法代码示例。如果您正苦于以下问题:PHP utf8_str_pad函数的具体用法?PHP utf8_str_pad怎么用?PHP utf8_str_pad使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: custom_function_default_roadmap_print_issue

function custom_function_default_roadmap_print_issue($p_issue_id, $p_issue_level = 0)
{
    static $t_status;
    $t_bug = bug_get($p_issue_id);
    if (bug_is_resolved($p_issue_id)) {
        $t_strike_start = '<strike>';
        $t_strike_end = '</strike>';
    } else {
        $t_strike_start = $t_strike_end = '';
    }
    if ($t_bug->category_id) {
        $t_category_name = category_get_name($t_bug->category_id);
    } else {
        $t_category_name = '';
    }
    $t_category = is_blank($t_category_name) ? '' : '<b>[' . string_display_line($t_category_name) . ']</b> ';
    echo utf8_str_pad('', $p_issue_level * 6, '&#160;'), '- ', $t_strike_start, string_get_bug_view_link($p_issue_id), ': ', $t_category, string_display_line_links($t_bug->summary);
    if ($t_bug->handler_id != 0) {
        echo ' (', prepare_user_name($t_bug->handler_id), ')';
    }
    if (!isset($t_status[$t_bug->status])) {
        $t_status[$t_bug->status] = get_enum_element('status', $t_bug->status, auth_get_current_user_id(), $t_bug->project_id);
    }
    echo ' - ', $t_status[$t_bug->status], $t_strike_end, '.<br />';
}
开发者ID:nourchene-benslimane,项目名称:mantisV0,代码行数:25,代码来源:custom_function_api.php


示例2: test

 public function test()
 {
     $toPad = '<IñtërnëT>';
     // 10 characters
     $padding = 'ø__';
     // 4 characters
     $this->assertEqual(utf8_str_pad($toPad, 20), $toPad . '          ');
     $this->assertEqual(utf8_str_pad($toPad, 20, ' ', STR_PAD_LEFT), '          ' . $toPad);
     $this->assertEqual(utf8_str_pad($toPad, 20, ' ', STR_PAD_BOTH), '     ' . $toPad . '     ');
     $this->assertEqual(utf8_str_pad($toPad, 10), $toPad);
     $this->assertEqual(str_pad('5char', 4), '5char');
     // str_pos won't truncate input string
     $this->assertEqual(utf8_str_pad($toPad, 8), $toPad);
     $this->assertEqual(utf8_str_pad($toPad, 20, $padding, STR_PAD_RIGHT), $toPad . 'ø__ø__ø__ø');
     $this->assertEqual(utf8_str_pad($toPad, 20, $padding, STR_PAD_LEFT), 'ø__ø__ø__ø' . $toPad);
     $this->assertEqual(utf8_str_pad($toPad, 20, $padding, STR_PAD_BOTH), 'ø__ø_' . $toPad . 'ø__ø_');
 }
开发者ID:kidwellj,项目名称:scuttle,代码行数:17,代码来源:utf8_str_pad.test.php


示例3: print_version_header

function print_version_header($p_version_row)
{
    $t_project_id = $p_version_row['project_id'];
    $t_version_id = $p_version_row['id'];
    $t_version_name = $p_version_row['version'];
    $t_project_name = project_get_field($t_project_id, 'name');
    $t_release_title = '<a href="roadmap_page.php?project_id=' . $t_project_id . '">' . string_display_line($t_project_name) . '</a> - <a href="roadmap_page.php?version_id=' . $t_version_id . '">' . string_display_line($t_version_name) . '</a>';
    if (config_get('show_roadmap_dates')) {
        $t_version_timestamp = $p_version_row['date_order'];
        $t_scheduled_release_date = ' (' . lang_get('scheduled_release') . ' ' . string_display_line(date(config_get('short_date_format'), $t_version_timestamp)) . ')';
    } else {
        $t_scheduled_release_date = '';
    }
    echo '<tt>';
    echo '<br />', $t_release_title, $t_scheduled_release_date, lang_get('word_separator'), print_bracket_link('view_all_set.php?type=1&temporary=y&' . FILTER_PROPERTY_PROJECT_ID . '=' . $t_project_id . '&' . filter_encode_field_and_value(FILTER_PROPERTY_TARGET_VERSION, $t_version_name), lang_get('view_bugs_link')), '<br />';
    $t_release_title_without_hyperlinks = $t_project_name . ' - ' . $t_version_name . $t_scheduled_release_date;
    echo utf8_str_pad('', utf8_strlen($t_release_title_without_hyperlinks), '='), '<br />';
}
开发者ID:nourchene-benslimane,项目名称:mantisV0,代码行数:18,代码来源:roadmap_page.php


示例4: print_version_header

/**
 * Print header for the specified project version.
 * @param int $p_version_id a valid version id
 * @return null
 */
function print_version_header($p_version_id)
{
    $t_project_id = version_get_field($p_version_id, 'project_id');
    $t_version_name = version_get_field($p_version_id, 'version');
    $t_project_name = project_get_field($t_project_id, 'name');
    $t_release_title = '<a href="changelog_page.php?project_id=' . $t_project_id . '">' . string_display_line($t_project_name) . '</a> - <a href="changelog_page.php?version_id=' . $p_version_id . '">' . string_display_line($t_version_name) . '</a>';
    if (config_get('show_changelog_dates')) {
        $t_version_released = version_get_field($p_version_id, 'released');
        $t_release_timestamp = version_get_field($p_version_id, 'date_order');
        if ((bool) $t_version_released) {
            $t_release_date = ' (' . lang_get('released') . ' ' . string_display_line(date(config_get('short_date_format'), $t_release_timestamp)) . ')';
        } else {
            $t_release_date = ' (' . lang_get('not_released') . ')';
        }
    } else {
        $t_release_date = '';
    }
    echo '<br />', $t_release_title, $t_release_date, lang_get('word_separator'), print_bracket_link('view_all_set.php?type=1&temporary=y&' . FILTER_PROPERTY_PROJECT_ID . '=' . $t_project_id . '&' . filter_encode_field_and_value(FILTER_PROPERTY_FIXED_IN_VERSION, $t_version_name), lang_get('view_bugs_link')), '<br />';
    $t_release_title_without_hyperlinks = $t_project_name . ' - ' . $t_version_name . $t_release_date;
    echo utf8_str_pad('', utf8_strlen($t_release_title_without_hyperlinks), '='), '<br />';
}
开发者ID:WebuddhaInc,项目名称:mantisbt-plugin-wbquickreport,代码行数:26,代码来源:changelog_page.php


示例5: relationship_get_details

/**
 * return formatted string with all the details on the requested relationship
 * @param integer             $p_bug_id       A bug identifier.
 * @param BugRelationshipData $p_relationship A bug relationship object.
 * @param boolean             $p_html         Whether to return html or text output.
 * @param boolean             $p_html_preview Whether to include style/hyperlinks - if preview is false, we prettify the output.
 * @param boolean             $p_show_project Show Project details.
 * @return string
 */
function relationship_get_details($p_bug_id, BugRelationshipData $p_relationship, $p_html = false, $p_html_preview = false, $p_show_project = false)
{
    $t_summary_wrap_at = utf8_strlen(config_get('email_separator2')) - 28;
    $t_icon_path = config_get('icon_path');
    if ($p_bug_id == $p_relationship->src_bug_id) {
        # root bug is in the source side, related bug in the destination side
        $t_related_bug_id = $p_relationship->dest_bug_id;
        $t_related_project_name = project_get_name($p_relationship->dest_project_id);
        $t_relationship_descr = relationship_get_description_src_side($p_relationship->type);
    } else {
        # root bug is in the dest side, related bug in the source side
        $t_related_bug_id = $p_relationship->src_bug_id;
        $t_related_project_name = project_get_name($p_relationship->src_project_id);
        $t_relationship_descr = relationship_get_description_dest_side($p_relationship->type);
    }
    # related bug not existing...
    if (!bug_exists($t_related_bug_id)) {
        return '';
    }
    # user can access to the related bug at least as a viewer
    if (!access_has_bug_level(VIEWER, $t_related_bug_id)) {
        return '';
    }
    if ($p_html_preview == false) {
        $t_td = '<td>';
    } else {
        $t_td = '<td class="print">';
    }
    # get the information from the related bug and prepare the link
    $t_bug = bug_get($t_related_bug_id, false);
    $t_status_string = get_enum_element('status', $t_bug->status, auth_get_current_user_id(), $t_bug->project_id);
    $t_resolution_string = get_enum_element('resolution', $t_bug->resolution, auth_get_current_user_id(), $t_bug->project_id);
    $t_relationship_info_html = $t_td . string_no_break($t_relationship_descr) . '&#160;</td>';
    if ($p_html_preview == false) {
        $t_relationship_info_html .= '<td><a href="' . string_get_bug_view_url($t_related_bug_id) . '">' . string_display_line(bug_format_id($t_related_bug_id)) . '</a></td>';
        $t_relationship_info_html .= '<td><span class="issue-status" title="' . string_attribute($t_resolution_string) . '">' . string_display_line($t_status_string) . '</span></td>';
    } else {
        $t_relationship_info_html .= $t_td . string_display_line(bug_format_id($t_related_bug_id)) . '</td>';
        $t_relationship_info_html .= $t_td . string_display_line($t_status_string) . '&#160;</td>';
    }
    $t_relationship_info_text = utf8_str_pad($t_relationship_descr, 20);
    $t_relationship_info_text .= utf8_str_pad(bug_format_id($t_related_bug_id), 8);
    # get the handler name of the related bug
    $t_relationship_info_html .= $t_td;
    if ($t_bug->handler_id > 0) {
        $t_relationship_info_html .= string_no_break(prepare_user_name($t_bug->handler_id));
    }
    $t_relationship_info_html .= '&#160;</td>';
    # add project name
    if ($p_show_project) {
        $t_relationship_info_html .= $t_td . string_display_line($t_related_project_name) . '&#160;</td>';
    }
    # add summary
    if ($p_html == true) {
        $t_relationship_info_html .= $t_td . string_display_line_links($t_bug->summary);
        if (VS_PRIVATE == $t_bug->view_state) {
            $t_relationship_info_html .= sprintf(' <img src="%s" alt="(%s)" title="%s" />', $t_icon_path . 'protected.gif', lang_get('private'), lang_get('private'));
        }
    } else {
        if (utf8_strlen($t_bug->summary) <= $t_summary_wrap_at) {
            $t_relationship_info_text .= string_email_links($t_bug->summary);
        } else {
            $t_relationship_info_text .= utf8_substr(string_email_links($t_bug->summary), 0, $t_summary_wrap_at - 3) . '...';
        }
    }
    # add delete link if bug not read only and user has access level
    if (!bug_is_readonly($p_bug_id) && !current_user_is_anonymous() && $p_html_preview == false) {
        if (access_has_bug_level(config_get('update_bug_threshold'), $p_bug_id)) {
            $t_relationship_info_html .= ' [<a class="small" href="bug_relationship_delete.php?bug_id=' . $p_bug_id . '&amp;rel_id=' . $p_relationship->id . htmlspecialchars(form_security_param('bug_relationship_delete')) . '">' . lang_get('delete_link') . '</a>]';
        }
    }
    $t_relationship_info_html .= '&#160;</td>';
    $t_relationship_info_text .= "\n";
    if ($p_html_preview == false) {
        # choose color based on status
        $t_status_label = html_get_status_css_class($t_bug->status, auth_get_current_user_id(), $t_bug->project_id);
        $t_relationship_info_html = '<tr class="' . $t_status_label . '">' . $t_relationship_info_html . '</tr>' . "\n";
    } else {
        $t_relationship_info_html = '<tr>' . $t_relationship_info_html . '</tr>';
    }
    if ($p_html == true) {
        return $t_relationship_info_html;
    } else {
        return $t_relationship_info_text;
    }
}
开发者ID:derrickweaver,项目名称:mantisbt,代码行数:95,代码来源:relationship_api.php


示例6: project_format_id

function project_format_id($p_project_id)
{
    $t_padding = config_get('display_project_padding');
    return utf8_str_pad($p_project_id, $t_padding, '0', STR_PAD_LEFT);
}
开发者ID:Kirill,项目名称:mantisbt,代码行数:5,代码来源:project_api.php


示例7: bugnote_format_id

/**
 * Pad the bugnote id with the appropriate number of zeros for printing
 * @param int $p_bugnote_id bugnote id
 * @return string
 * @access public
 */
function bugnote_format_id($p_bugnote_id)
{
    $t_padding = config_get('display_bugnote_padding');
    return utf8_str_pad($p_bugnote_id, $t_padding, '0', STR_PAD_LEFT);
}
开发者ID:fur81,项目名称:zofaxiopeu,代码行数:11,代码来源:bugnote_api.php


示例8: displayProgressBar

/**
 * Display a simple progress bar
 *
 * @param $width Width of the progress bar
 * @param $percent Percent of the progress bar
 * @param $options array options :
 *            - title : string title to display (default Progesssion)
 *            - simple : display a simple progress bar (no title / only percent)
 *            - forcepadding : boolean force str_pad to force refresh (default true)
 *
 * @return nothing
 **/
function displayProgressBar($width, $percent, $options = array())
{
    global $CFG_GLPI, $LANG;
    $param['title'] = $LANG['common'][47];
    $param['simple'] = false;
    $param['forcepadding'] = true;
    if (is_array($options) && count($options)) {
        foreach ($options as $key => $val) {
            $param[$key] = $val;
        }
    }
    $percentwidth = floor($percent * $width / 100);
    $output = "<div class='center'><table class='tab_cadre' width='" . ($width + 20) . "px'>";
    if (!$param['simple']) {
        $output .= "<tr><th class='center'>" . $param['title'] . "&nbsp;" . $percent . "%</th></tr>";
    }
    $output .= "<tr><td>\n               <table><tr><td class='center' style='background:url(" . $CFG_GLPI["root_doc"] . "/pics/loader.png) repeat-x; padding: 0px;font-size: 10px;' width='" . $percentwidth . "px' height='12'>";
    if ($param['simple']) {
        $output .= $percent . "%";
    } else {
        $output .= '&nbsp;';
    }
    $output .= "</td></tr></table></td>";
    $output .= "</tr></table>";
    $output .= "</div>";
    if (!$param['forcepadding']) {
        echo $output;
    } else {
        echo utf8_str_pad($output, 4096);
        glpi_flush();
    }
}
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:44,代码来源:display.function.php


示例9: bug_format_id

/**
 * Pads the bug id with the appropriate number of zeros.
 * @param int p_bug_id
 * @return string
 * @access public
 * @uses config_api.php
 */
function bug_format_id($p_bug_id)
{
    $t_padding = config_get('display_bug_padding');
    $t_string = utf8_str_pad($p_bug_id, $t_padding, '0', STR_PAD_LEFT);
    return event_signal('EVENT_DISPLAY_BUG_ID', $t_string, array($p_bug_id));
}
开发者ID:rahmanjis,项目名称:dipstart-development,代码行数:13,代码来源:bug_api.php


示例10: GetRelationshipContent

function GetRelationshipContent($p_bug_id, $p_html = false, $p_html_preview = false, $p_summary = false, $p_icons = false)
{
    $t_summary = '';
    $t_icons = '';
    $t_show_project = false;
    $t_summary_wrap_at = utf8_strlen(config_get('email_separator2')) - 10;
    $t_relationship_all = relationship_get_all($p_bug_id, $t_show_project);
    $t_relationship_all_count = count($t_relationship_all);
    if ($p_summary) {
        for ($i = 0; $i < $t_relationship_all_count; $i++) {
            $p_relationship = $t_relationship_all[$i];
            if ($p_bug_id == $p_relationship->src_bug_id) {
                # root bug is in the src side, related bug in the dest side
                $t_related_bug_id = $p_relationship->dest_bug_id;
                $t_relationship_descr = relationship_get_description_src_side($p_relationship->type);
            } else {
                # root bug is in the dest side, related bug in the src side
                $t_related_bug_id = $p_relationship->src_bug_id;
                $t_relationship_descr = relationship_get_description_dest_side($p_relationship->type);
            }
            # get the information from the related bug and prepare the link
            $t_bug = bug_get($t_related_bug_id, false);
            $t_text = trim(utf8_str_pad($t_relationship_descr, 20)) . ' ';
            if ($p_html_preview == true) {
                $t_text .= '<a href="' . string_get_bug_view_url($t_related_bug_id) . '"';
                $t_text .= ' class="rcv_tooltip"';
                //$t_text .= ' title="' . utf8_str_pad (bug_format_id ($t_related_bug_id), 8) . "\n" . string_attribute ($t_bug->summary) . '"';
                $t_text .= '>';
            }
            $t_text .= string_display_line(bug_format_id($t_related_bug_id));
            if ($p_html_preview == true) {
                $t_text .= '<span class="rcv_tooltip_box">';
                $t_text .= '<span class="rcv_tooltip_title">' . bug_format_id($t_related_bug_id) . '</span>';
                $t_text .= '<span class="rcv_tooltip_content">' . utf8_substr(string_email_links($t_bug->summary), 0, MAX_TOOLTIP_CONTENT_LENGTH);
                $t_text .= MAX_TOOLTIP_CONTENT_LENGTH < strlen($t_bug->summary) ? '...' : '';
                $t_text .= '</span>';
                $t_text .= '</span>';
                $t_text .= '</a>';
            }
            if (plugin_config_get('ShowRelationshipsControl') && !bug_is_readonly($p_bug_id) && !current_user_is_anonymous() && true == $p_html_preview) {
                // bug not read only
                if (access_has_bug_level(config_get('update_bug_threshold'), $p_bug_id)) {
                    // user has access level
                    // add a delete link
                    $t_text .= ' [';
                    $t_text .= '<a class="small" href="bug_relationship_delete.php?bug_id=' . $p_bug_id;
                    $t_text .= '&amp;rel_id=' . $p_relationship->id;
                    $t_text .= '&amp;redirect_url=view_all_bug_page.php';
                    $t_text .= htmlspecialchars(form_security_param('bug_relationship_delete'));
                    $t_text .= '">' . lang_get('delete_link') . '</a>';
                    $t_text .= ']';
                }
            }
            // $t_text = relationship_get_details ($p_bug_id, $t_relationship_all[$i], true, false, $t_show_project);
            if (false == $p_html) {
                // p_html == No
                if ($i != 0) {
                    if ($p_html_preview == true) {
                        $t_summary .= ",<br/>";
                    } else {
                        $t_summary .= ", ";
                    }
                }
                $t_summary .= $t_text;
            } else {
                // p_html == Yes
                if ($p_html_preview == true) {
                    $t_summary .= '<tr bgcolor="' . get_status_color($t_bug->status, auth_get_current_user_id(), $t_bug->project_id) . '">';
                    $t_summary .= '<td>' . $t_text . '</td>';
                    $t_summary .= '</tr>' . "\n";
                } else {
                    if ($i != 0) {
                        $t_summary .= ", ";
                    }
                    $t_summary .= $t_text;
                }
            }
        }
    }
    if (plugin_config_get('ShowRelationshipIcons') && !current_user_is_anonymous() && true == $p_html_preview) {
        $t_text = RelationshipsUtils::GetBugSmybols($p_bug_id, !is_blank($t_summary));
        if (!is_blank($t_text)) {
            if (false == $p_html) {
                // p_html == No
                $t_icons .= $t_text;
            } else {
                // p_html == Yes
                if ($p_html_preview == true) {
                    $t_icons .= '<tr><td>' . $t_text . '</td></tr>' . "\n";
                } else {
                    $t_icons .= $t_text;
                }
            }
        }
    }
    if ($p_html_preview == true) {
        $t_icons_table = '';
        $t_summary_table = '';
        if (!is_blank($t_icons)) {
            $t_icons_table = '<table border="0" width="100%" cellpadding="0" cellspacing="1">' . $t_icons . '</table>';
//.........这里部分代码省略.........
开发者ID:QuestorX,项目名称:MantisBT-Plugin.RelationshipColumnView,代码行数:101,代码来源:RelationshipColumn.php


示例11: mailRow

/**
 *  Format mail row
 *
 * @param $string string: label string
 * @param $value string: value string
 *
 * @return string
**/
function mailRow($string, $value)
{
    $row = utf8_str_pad($string . ': ', 25, ' ', STR_PAD_RIGHT) . $value . "\n";
    return $row;
}
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:13,代码来源:common.function.php


示例12: str_pad

 /**
  * UTF-8 aware alternative to str_pad()
  *
  * Pad a string to a certain length with another string.
  * $padStr may contain multi-byte characters.
  *
  * @param   string   $input   The input string.
  * @param   integer  $length  If the value is negative, less than, or equal to the length of the input string, no padding takes place.
  * @param   string   $padStr  The string may be truncated if the number of padding characters can't be evenly divided by the string's length.
  * @param   integer  $type    The type of padding to apply
  *
  * @return  string
  *
  * @see     http://www.php.net/str_pad
  * @since   1.4.0
  */
 public static function str_pad($input, $length, $padStr = ' ', $type = STR_PAD_RIGHT)
 {
     return utf8_str_pad($input, $length, $padStr, $type);
 }
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:20,代码来源:StringHelper.php


示例13: autoName

/**
 * Create a new name using a autoname field defined in a template
 *
 * @param $objectName autoname template
 * @param $field field to autoname
 * @param $isTemplate true if create an object from a template
 * @param $itemtype item type
 * @param $entities_id limit generation to an entity
 *
 * @return new auto string
**/
function autoName($objectName, $field, $isTemplate, $itemtype, $entities_id = -1)
{
    global $DB, $CFG_GLPI;
    $len = utf8_strlen($objectName);
    if ($isTemplate && $len > 8 && utf8_substr($objectName, 0, 4) === '&lt;' && utf8_substr($objectName, $len - 4, 4) === '&gt;') {
        $autoNum = utf8_substr($objectName, 4, $len - 8);
        $mask = '';
        if (preg_match("/\\#{1,10}/", $autoNum, $mask)) {
            $global = strpos($autoNum, '\\g') !== false && $itemtype != 'Infocom' ? 1 : 0;
            $autoNum = str_replace(array('\\y', '\\Y', '\\m', '\\d', '_', '%', '\\g'), array(date('y'), date('Y'), date('m'), date('d'), '\\_', '\\%', ''), $autoNum);
            $mask = $mask[0];
            $pos = strpos($autoNum, $mask) + 1;
            $len = utf8_strlen($mask);
            $like = str_replace('#', '_', $autoNum);
            if ($global == 1) {
                $query = "";
                $first = 1;
                $types = array('Computer', 'Monitor', 'NetworkEquipment', 'Peripheral', 'Phone', 'Printer');
                foreach ($types as $t) {
                    $table = getTableForItemType($t);
                    $query .= ($first ? "SELECT " : " UNION SELECT  ") . " {$field} AS code\n                         FROM `{$table}`\n                         WHERE `{$field}` LIKE '{$like}'\n                               AND `is_deleted` = '0'\n                               AND `is_template` = '0'";
                    if ($CFG_GLPI["use_autoname_by_entity"] && $entities_id >= 0) {
                        $query .= " AND `entities_id` = '{$entities_id}' ";
                    }
                    $first = 0;
                }
                $query = "SELECT CAST(SUBSTRING(code, {$pos}, {$len}) AS unsigned) AS no\n                      FROM ({$query}) AS codes";
            } else {
                $table = getTableForItemType($itemtype);
                $query = "SELECT CAST(SUBSTRING({$field}, {$pos}, {$len}) AS unsigned) AS no\n                      FROM `{$table}`\n                      WHERE `{$field}` LIKE '{$like}' ";
                if ($itemtype != INFOCOM_TYPE) {
                    $query .= " AND `is_deleted` = '0'\n                           AND `is_template` = '0'";
                    if ($CFG_GLPI["use_autoname_by_entity"] && $entities_id >= 0) {
                        $query .= " AND `entities_id` = '{$entities_id}' ";
                    }
                }
            }
            $query = "SELECT MAX(Num.no) AS lastNo\n                   FROM (" . $query . ") AS Num";
            $resultNo = $DB->query($query);
            if ($DB->numrows($resultNo) > 0) {
                $data = $DB->fetch_array($resultNo);
                $newNo = $data['lastNo'] + 1;
            } else {
                $newNo = 0;
            }
            $objectName = str_replace(array($mask, '\\_', '\\%'), array(utf8_str_pad($newNo, $len, '0', STR_PAD_LEFT), '_', '%'), $autoNum);
        }
    }
    return $objectName;
}
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:61,代码来源:db.function.php


示例14: gantt_chart

function gantt_chart($p_metrics, $p_title, $p_subtitle, $p_graph_width = 300, $p_graph_height = 380)
{
    $t_graph_font = graph_get_font();
    $t_metrics = $p_metrics['metrics'];
    $t_range = $p_metrics['range'];
    // Diff in weeks of the range:
    $t_60s = 60;
    // 1 minute
    $t_60min = 60;
    // 1 hour
    $t_24h = 24;
    // 1 day
    $t_7d = 7;
    // 1 week
    $t_minute = $t_60s;
    $t_hour = $t_60min * $t_minute;
    $t_day = $t_24h * $t_hour;
    $t_week = $t_7d * $t_day;
    $t_gantt_chart_max_rows = plugin_config_get('rows_max');
    error_check(is_array($t_metrics) ? count($t_metrics) : 0, $p_title . " (" . $p_subtitle . ")");
    if (plugin_config_get('eczlibrary') == ON) {
        // DO NOTHING SINCE eczlibrary DOES NOT SUPPORT GANTT CHART
    } else {
        // A new graph with automatic size
        $graph = new GanttGraph(0, 0, "auto");
        $graph->SetShadow();
        // Add title and subtitle
        $graph->title->Set($p_title);
        $graph->title->SetFont($t_graph_font, FS_BOLD, 12);
        $graph->subtitle->Set($p_subtitle);
        // Show day, week and month scale
        $graph->ShowHeaders(GANTT_HDAY | GANTT_HWEEK | GANTT_HMONTH);
        // Instead of week number show the date for the first day in the week
        // on the week scale
        $graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
        // Make the week scale font smaller than the default
        $graph->scale->week->SetFont($t_graph_font, FS_NORMAL, 8);
        // Use the short name of the month together with a 2 digit year
        // on the month scale
        $graph->scale->month->SetStyle(MONTHSTYLE_SHORTNAMEYEAR4);
        $graph->scale->month->SetFontColor("white");
        $graph->scale->month->SetBackgroundColor("blue");
        // Setup a horizontal grid
        $graph->hgrid->Show();
        $graph->hgrid->SetRowFillColor('[email protected]');
        // Setup a vertical grid
        //   $graph->vgrid->Show();
        //Setup the divider display
        $graph->scale->divider->SetWeight(3);
        $graph->scale->divider->SetColor("darkblue");
        $graph->scale->dividerh->SetWeight(3);
        $graph->scale->dividerh->SetColor("darkblue");
        $graph->scale->dividerh->Show();
        $graph->scale->actinfo->vgrid->SetStyle('solid');
        $graph->scale->actinfo->vgrid->SetColor('darkblue');
        $graph->scale->actinfo->vgrid->Show();
        //   // Set the column headers and font
        //   $graph->scale->actinfo->SetColTitles( array('Task','Start','End'),array(100));
        //   $graph->scale->actinfo->SetFont( $t_graph_font, FS_BOLD, 10 );
        //Adding columns:
        //The following is an example: 1st element, an array of the columns,
        //  2nd element an optional array of min width of the columns (here the min width of the 2 first columns)
        //$graph->scale->actinfo->SetColTitles(
        //  array('Note','Task','Duration','Start','Finish'),array(30,100));
        //Adding a table title
        $graph->scale->tableTitle->Set("{$p_subtitle}");
        $graph->scale->tableTitle->SetFont($t_graph_font, FS_NORMAL, 8);
        $graph->scale->SetTableTitleBackground('[email protected]');
        $graph->scale->tableTitle->Show();
        //           if ( null != $t_constrain ){
        //           $t_activity->SetConstrain( $t_constrain, CONSTRAIN_ENDSTART );
        //         }
        //     if ( null != $t_constrain ){
        //       $t_activity->SetConstrain( $t_constrain['row'], $t_constrain['type'] );
        //     }
        // We first need to get the list of rows, in order to know whether to
        // display the constraint or not (in case of missing referenced row)
        $t_row_list = array();
        foreach ($t_metrics as $t_metric_row) {
            $t_row_list[] = $t_metric_row[0];
        }
        foreach ($t_metrics as $t_metric_row) {
            $t_row = $t_metric_row[0] % $t_gantt_chart_max_rows;
            $t_activity_type = $t_metric_row[1];
            $t_bug_id = $t_metric_row[2];
            $t_start_date = $t_metric_row[3];
            $t_end_date = $t_metric_row[4];
            $t_extra = " {$t_bug_id}" . $t_metric_row[5];
            $t_level = $t_metric_row[6];
            $t_constraints = $t_metric_row[7];
            if (isset($t_level)) {
                $t_row_label = utf8_str_pad('', $t_level * 2, ' ') . htmlspecialchars_decode(bug_format_summary($t_bug_id, SUMMARY_FIELD));
            } else {
                $t_row_label = htmlspecialchars_decode(bug_format_summary($t_bug_id, SUMMARY_FIELD));
            }
            // Limit the label to max defined
            $t_row_label = strlen($t_row_label) > plugin_config_get('label_max') ? substr($t_row_label, 0, plugin_config_get('label_max') - 3) . '...' : $t_row_label;
            $t_activity_arr = array('left' => null, 'main' => array('row' => $t_row, 'label' => $t_row_label, 'start' => $t_start_date, 'end' => $t_end_date, 'info' => $t_extra), 'right' => null);
            if ($t_end_date < $t_range['min']) {
                // complete left bar
//.........这里部分代码省略.........
开发者ID:martijnveen,项目名称:GanttChart,代码行数:101,代码来源:gantt_api.php


示例15: GetBugSmybols

 /**
  * checks relationships for a bug and assign relevant symbols
  *
  * @author Rainer Dierck
  * @param $bugId
  */
 public static function GetBugSmybols($bugId, $p_newline = false)
 {
     $t_text = '';
     $bugStatus = bug_get_field($bugId, 'status');
     $allRelationships = relationship_get_all($bugId, $t_show_project);
     $allRelationshipsCount = count($allRelationships);
     $stopFlag = false;
     $forbiddenFlag = false;
     $warningFlag = false;
     $bugEta = bug_get_field($bugId, 'eta');
     $useEta = $bugEta != ETA_NONE && config_get('enable_eta');
     $stopAltText = "";
     $forbiddenAltText = "";
     $warningAltText = "";
     $href = string_get_bug_view_url($bugId) . '#relationships_open';
     for ($index = 0; $index < $allRelationshipsCount; $index++) {
         $relationShip = $allRelationships[$index];
         if ($bugId == $relationShip->src_bug_id) {
             # root bug is in the src side, related bug in the dest side
             $destinationBugId = $relationShip->dest_bug_id;
             $relationshipDescription = relationship_get_description_src_side($relationShip->type);
         } else {
             # root bug is in the dest side, related bug in the src side
             $destinationBugId = $relationShip->src_bug_id;
             $relationshipDescription = relationship_get_description_dest_side($relationShip->type);
         }
         # get the information from the related bug and prepare the link
         $destinationBugStatus = bug_get_field($destinationBugId, 'status');
         if ($bugStatus < CLOSED && $destinationBugStatus < CLOSED && $relationShip->type != BUG_REL_NONE) {
             if ($relationShip->type == BUG_DEPENDANT) {
                 if ($bugId == $relationShip->src_bug_id) {
                     // Stop or Forbidden
                     if ($bugStatus == $destinationBugStatus) {
                         // Stop
                         if ($stopAltText != "") {
                             $stopAltText .= ", ";
                         }
                         if (!$stopFlag) {
                             $stopAltText .= trim(utf8_str_pad($relationshipDescription, 20)) . ' ';
                         }
                         $stopAltText .= string_display_line(bug_format_id($destinationBugId));
                         $stopFlag = true;
                     }
                     if ($bugStatus > $destinationBugStatus) {
                         // Forbidden
                         if ($forbiddenAltText != "") {
                             $forbiddenAltText .= ", ";
                         }
                         if (!$forbiddenFlag) {
                             $forbiddenAltText .= trim(utf8_str_pad($relationshipDescription, 20)) . ' ';
                         }
                         $forbiddenAltText .= string_display_line(bug_format_id($destinationBugId));
                         $forbiddenFlag = true;
                     }
                 } else {
                     // Warning
                     if ($bugStatus < $destinationBugStatus) {
                         // Warning
                         if ($warningAltText != "") {
                             $warningAltText .= ", ";
                         }
                         if (!$warningFlag) {
                             $warningAltText .= trim(utf8_str_pad($relationshipDescription, 20)) . ' ';
                         }
                         $warningAltText .= string_display_line(bug_format_id($destinationBugId));
                         $warningFlag = true;
                     }
                 }
             }
         }
     }
     //if ( $useEta )
     //{  // RELATIONSHIPS_UTILS_PLUGIN_URL
     //   $t_text .= '<img border="0" width="16" height="16" src="' . RELATIONSHIPS_UTILS_PLUGIN_URL . 'clock.png' . '" alt="clock" />';
     //}
     if ($forbiddenFlag) {
         if ($p_newline && !is_blank($t_text)) {
             $t_text .= '<br/>' . "\n";
         }
         $t_text .= '<a href="' . $href . '"><img border="0" width="16" height="16" src="' . RELATIONSHIPS_UTILS_PLUGIN_URL . 'sign_forbidden.png" alt="' . $forbiddenAltText . '" title="' . $forbiddenAltText . '" /></a>';
     }
     if ($stopFlag) {
         if ($p_newline && !is_blank($t_text)) {
             $t_text .= '<br/>' . "\n";
         }
         $t_text .= '<a href="' . $href . '"><img border="0" width="16" height="16" src="' . RELATIONSHIPS_UTILS_PLUGIN_URL . 'sign_stop.png" alt="' . $stopAltText . '" title="' . $stopAltText . '" /></a>';
     }
     if ($warningFlag) {
         if ($p_newline && !is_blank($t_text)) {
             $t_text .= '<br/>' . "\n";
         }
         $t_text .= '<a href="' . $href . '"><img border="0" width="16" height="16" src="' . RELATIONSHIPS_UTILS_PLUGIN_URL . 'sign_warning.png" alt="' . $warningAltText . '" title="' . $warningAltText . '" /></a>';
     }
     return $t_text;
//.........这里部分代码省略.........
开发者ID:QuestorX,项目名称:MantisBT-Plugin.RelationshipColumnView,代码行数:101,代码来源:RelationshipsUtils.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP utf8_str_replace函数代码示例发布时间:2022-05-23
下一篇:
PHP utf8_rtrim函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap