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


PHP format_numeric函数代码示例

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


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

示例1: ob_clean

     ob_clean();
     $package = (string) get_parameter("package");
     // All files extracted
     $files_total = $package . "/files.txt";
     // Number of files extracted
     $files_num = $package . "/files.info.txt";
     // Files copied
     $files_copied = $package . "/files.copied.txt";
     $files = @file($files_copied);
     if (empty($files)) {
         $files = array();
     }
     $total = (int) @file_get_contents($files_num);
     $progress = 0;
     if (count($files) > 0 && $total > 0) {
         $progress = format_numeric(count($files) / $total * 100, 2);
         if ($progress > 100) {
             $progress = 100;
         }
     }
     $return = array();
     $return['info'] = (string) implode("<br />", $files);
     $return['progress'] = $progress;
     if ($progress >= 100) {
         unlink($files_total);
         unlink($files_num);
         unlink($files_copied);
     }
     echo json_encode($return);
     return;
 }
开发者ID:dsyman2,项目名称:integriaims,代码行数:31,代码来源:offline_update.php

示例2: array

	$table->style = array ();
	$table->rowstyle = array ();

	$table->head = array ();
	$table->head[0] = __('Filename');
	$table->head[1] = __('Description');
	$table->head[2] = __('Size');
	$table->head[3] = __('Date');
	$table->head[4] = __('Ops.');

	foreach ($files as $file) {
		$data = array ();
		
		$data[0] = "<a href='operation/common/download_file.php?id_attachment=".$file["id_attachment"]."&type=lead'>".$file["filename"] . "</a>";
		$data[1] = $file["description"];
		$data[2] = format_numeric($file["size"]);
		$data[3] = $file["timestamp"];

		// Todo. Delete files owner of lead and admins only
		if ( (dame_admin($config["id_user"])) || ($file["id_usuario"] == $config["id_user"]) ){
			$data[4] = "<a href='index.php?sec=customers&sec2=operation/leads/lead_detail&id=$id&op=files&deletef=".$file["id_attachment"]."'><img src='images/cross.png'></a>";
		}

		array_push ($table->data, $data);
		array_push ($table->rowstyle, $style);
	}
	print_table ($table);

} else {
	echo ui_print_error_message (__('There is no files attached for this lead'), '', true, 'h3', true);
}
开发者ID:articaST,项目名称:integriaims,代码行数:31,代码来源:lead_files.php

示例3: pager

function pager($records, $records_pp = 50, $break_on_page = 15)
{
    if ($records == 0) {
        return;
    }
    $cur = (int) get_var('p');
    $uri = '?';
    foreach ($_GET as $var => $val) {
        if ($var != 'p') {
            $uri .= $var . '=' . urlencode($val) . '&amp;';
        }
    }
    if ($records < $records_pp) {
        return;
    }
    echo '<ul class="pager">';
    // adjust start page, if neccessary
    $total_pages = (int) ($records / $records_pp + 0.5);
    $start_page = 0;
    if ($total_pages > $break_on_page) {
        if ($total_pages - $cur < $break_on_page / 2) {
            $start_page = $total_pages - $break_on_page;
        } else {
            $start_page = $cur - (int) ($break_on_page / 2);
            if ($start_page < 0) {
                $start_page = 0;
            }
        }
    }
    $page = $start_page;
    $start_rec = $page * $records_pp + 1;
    $broken = false;
    while ($start_rec < $records + 1) {
        printf('<li%s><a href="%sp=%d">%d</a></li>', $page == $cur ? ' class="selected"' : '', $uri, $page, $page + 1);
        $start_rec += $records_pp;
        $page++;
        if ($page == $break_on_page + $start_page + 1) {
            $broken = true;
            break;
        }
    }
    if ($broken) {
        echo "<li class=\"recordcount\">" . (1 + $total_pages) . ' ' . format_numeric(1 + $total_pages, "page", "pages") . ", {$records} " . format_numeric($records, 'record', 'records') . "</li>";
    } else {
        echo "<li class=\"recordcount\">{$records} " . format_numeric($records, 'record', 'records') . "</li>";
    }
    echo '</ul>';
    echo '<div class="afterpgr">&nbsp;</div>';
}
开发者ID:CristianCCIT,项目名称:shop4office,代码行数:49,代码来源:tinymy.php

示例4: __

        $table->head[1] = __('Owner');
        $table->head[2] = __('Company');
        $table->head[3] = __('Updated at');
        $table->head[4] = __('Country');
        $table->head[5] = __('Progress');
        $table->head[6] = __('Estimated sale');
        $counter = 0;
        foreach ($leads as $lead) {
            $data = array();
            $data[0] = "<a href='index.php?sec=customers&sec2=operation/leads/lead_detail&id=" . $lead["id"] . "'>" . $lead["fullname"] . "</a>";
            $data[1] = $lead["owner"];
            $data[2] = $lead["company"];
            $data[3] = $lead["modification"];
            $data[4] = $lead["country"];
            $data[5] = translate_lead_progress($lead["progress"]);
            $data[6] = format_numeric($lead["estimated_sale"]);
            array_push($table->data, $data);
        }
        print_table($table);
        if ($section_write_permission || $section_manage_permission) {
            echo '<form method="post" action="index.php?sec=customers&sec2=operation/leads/lead_detail&id_company=' . $id . '">';
            echo '<div style="width: ' . $table->width . '; text-align: right;">';
            print_submit_button(__('Create'), 'new_btn', false, 'class="sub next"');
            print_input_hidden('new', 1);
            echo '</div>';
            echo '</form>';
        }
    }
} else {
    if ($op == 'projects') {
        $sql = "SELECT DISTINCT id_project FROM trole_people_task, ttask WHERE ttask.id = trole_people_task.id_task\n\t\t\tAND id_user IN (SELECT id_usuario FROM tusuario WHERE id_company={$id})";
开发者ID:dsyman2,项目名称:integriaims,代码行数:31,代码来源:company_detail.php

示例5: array

    $a_day = 24 * 3600;
    $fields = array($a_day => "1 day", 2 * $a_day => "2 days", 7 * $a_day => "1 week", 14 * $a_day => "2 weeks", 30 * $a_day => "1 month");
    $period = get_parameter("period", $a_day);
    $ttl = 1;
    if ($clean_output) {
        $ttl = 2;
    }
    if ($clean_output) {
        $incident_sla .= "<strong>" . $fields[$period] . "</strong>";
    } else {
        $incident_sla .= print_select($fields, "period", $period, 'reload_sla_slice_graph(\'' . $id . '\');', '', '', true, 0, false, false, false, 'width: 75px');
    }
    $incident_sla .= "</td>";
    $incident_sla .= "<td colspan=2 style='text-align: center; width: 50%;'>";
    $incident_sla .= __('SLA total compliance (%)') . ': ';
    $incident_sla .= format_numeric(get_sla_compliance_single_id($id));
    $incident_sla .= "</td>";
    $incident_sla .= "</tr>";
    $incident_sla .= "<tr>";
    $incident_sla .= "<td id=slaSlicebarField colspan=2 style='text-align: center; padding: 1px 2px 1px 5px;'>";
    $incident_sla .= graph_sla_slicebar($id, $period, 155, 15, $ttl);
    $incident_sla .= "</td>";
    $incident_sla .= "<td colspan=2 style='text-align: center;' >";
    $incident_sla .= "<div class='pie_frame'>";
    $incident_sla .= graph_incident_sla_compliance($id, 155, 80, $ttl);
    $incident_sla .= "</div>";
    $incident_sla .= "</td>";
    $incident_sla .= "<tr>";
    $incident_sla .= "</table>";
}
$right_side .= print_container('incident_sla', __('SLA information'), $incident_sla);
开发者ID:dsyman2,项目名称:integriaims,代码行数:31,代码来源:incident_dashboard_detail.php

示例6: format_for_graph

/** 
 * Render numeric data for a graph. It adds magnitude suffix to the number 
 * (M for millions, K for thousands...) base-10
 *
 * TODO: base-2 multiplication
 * 
 * @param float $number Number to be rendered
 * @param int $decimals Numbers after comma. Default value: 1
 * @param dec_point Decimal separator character. Default value: .
 * @param thousands_sep Thousands separator character. Default value: ,
 * 
 * @return string A string with the number and the multiplier
 */
function format_for_graph($number, $decimals = 1, $dec_point = ".", $thousands_sep = ",", $divisor = 1000)
{
    $shorts = array("", "K", "M", "G", "T", "P");
    $pos = 0;
    while ($number >= $divisor) {
        //as long as the number can be divided by divisor
        $pos++;
        //Position in array starting with 0
        $number = $number / $divisor;
    }
    return format_numeric($number, $decimals) . $shorts[$pos];
    //This will actually do the rounding and the decimals
}
开发者ID:keunes,项目名称:integriaims,代码行数:26,代码来源:functions.php

示例7: projects_get_cost_by_profile

    $total_per_profile_havecost = projects_get_cost_by_profile($id_project, true);
    if (!empty($total_per_profile_havecost)) {
        foreach ($total_per_profile_havecost as $name => $total_profile) {
            if ($total_profile) {
                $budget .= "<tr>";
                $budget .= '<td>&nbsp;&nbsp;&nbsp;&nbsp;' . __($name) . '</td>';
                $budget .= '<td>' . format_numeric($total_profile) . " " . $config["currency"] . '</td>';
                $budget .= "</tr>";
            }
        }
    }
    $budget .= "<tr>";
    $budget .= '<td><b>' . __('Average Cost per Hour') . ' </b>';
    $budget .= "</td><td>";
    if ($total_hr > 0) {
        $budget .= format_numeric($total_project_costs / $total_hr) . " " . $config["currency"];
    } else {
        $budget .= __("N/A");
    }
    $budget .= "</td></tr>";
    $budget .= "</table>";
    // Workload distribution
    $workload_distribution = '<div class="pie_frame">' . graph_workunit_project_user_single(350, 150, $id_project, $graph_ttl) . '</div>';
    // Task detail
    $tasks_report = '';
    $sql = sprintf('SELECT tt.id, tt.name, tt.hours AS estimated_time
					FROM ttask tt
					WHERE tt.id_project = %d', $id_project);
    $tasks = get_db_all_rows_sql($sql);
    if (!empty($tasks)) {
        foreach ($tasks as $task) {
开发者ID:dsyman2,项目名称:integriaims,代码行数:31,代码来源:project_report.php

示例8: __

						$data[1] = __("N/A");
					}
					
					$partial = get_invoice_amount ($invoice["id"]);
					
					if (isset($total[$invoice["currency"]]))
						$total[$invoice["currency"]] = $total[$invoice["currency"]] + $partial;
					else
						$total[$invoice["currency"]] = $partial;

					$data[2] = format_numeric($partial). " " . strtoupper ($invoice["currency"]);

					$tax = get_invoice_tax ($invoice["id"]);
					$tax_amount = get_invoice_amount ($invoice["id"]) * (1 + $tax/100);
					if ($tax != 0 && $tax_amount > 0)
						$data[2] .= print_help_tip (__("With taxes"). ": ".format_numeric($tax_amount)." ".strtoupper($invoice["currency"]), true);

					$data[3] = __($invoice["status"]);
					$data[5] = "<span style='font-size: 10px'>".$invoice["invoice_create_date"] . "</span>";

                    array_push ($table->data, $data);
            }

            print_table ($table);
        }
}

// Leads
if ( check_crm_acl('lead', 'cr') && $show_customers != MENU_HIDDEN ){

        $where_clause = " WHERE fullname LIKE '%".$search_string."%'
开发者ID:articaST,项目名称:integriaims,代码行数:31,代码来源:search.php

示例9: crm_print_company_projects_tree

function crm_print_company_projects_tree($projects)
{
    require_once "include/functions_tasks.php";
    //~ echo '<table width="100%" cellpadding="0" cellspacing="0" border="0px" class="result_table listing" id="incident_search_result_table">';
    $img = print_image("images/input_create.png", true, array("style" => 'vertical-align: middle;', "id" => $img_id));
    $img_project = print_image("images/note.png", true, array("style" => 'vertical-align: middle;'));
    foreach ($projects as $project) {
        $project_name = get_db_value('name', 'tproject', 'id', $project['id_project']);
        //print project name
        //~ echo '<tr><td colspan="10" valign="top">';
        //~ echo "
        //~ <a onfocus='JavaScript: this.blur()' href='javascript: show_detail(\"" . $project['id_project']. "\")'>" .
        //~ $img . "&nbsp;" . $img_project ."&nbsp;" .  safe_output($project_name)."&nbsp;</a>"."&nbsp;&nbsp;";
        //~ echo '</td></tr>';
        $id_project = $project['id_project'];
        $people_inv = get_db_sql("SELECT COUNT(DISTINCT id_user) FROM trole_people_task, ttask WHERE ttask.id_project={$id_project} AND ttask.id = trole_people_task.id_task;");
        $total_hr = get_project_workunit_hours($id_project);
        $total_planned = get_planned_project_workunit_hours($id_project);
        $project_data = get_db_row('tproject', 'id', $id_project);
        $start_date = $project_data["start"];
        $end_date = $project_data["end"];
        // Project detail
        $table_detail = "<table class='advanced_details_table alternate'>";
        $table_detail .= "<tr>";
        $table_detail .= '<td><b>' . __('Start date') . ' </b>';
        $table_detail .= "</td><td>";
        $table_detail .= $start_date;
        $table_detail .= "</td></tr>";
        $table_detail .= "<tr>";
        $table_detail .= '<td><b>' . __('End date') . ' </b>';
        $table_detail .= "</td><td>";
        $table_detail .= $end_date;
        $table_detail .= "</td></tr>";
        $table_detail .= "<tr>";
        $table_detail .= '<td><b>' . __('Total people involved') . ' </b>';
        $table_detail .= "</td><td>";
        $table_detail .= $people_inv;
        $table_detail .= "</td></tr>";
        //People involved (avatars)
        //Get users with tasks
        $sql = sprintf("SELECT DISTINCT id_user FROM trole_people_task, ttask WHERE ttask.id_project= %d AND ttask.id = trole_people_task.id_task", $id_project);
        $users_aux = get_db_all_rows_sql($sql);
        if (empty($users_aux)) {
            $users_aux = array();
        }
        $users_involved = array();
        foreach ($users_aux as $ua) {
            $users_involved[] = $ua['id_user'];
        }
        //Delete duplicated items
        if (empty($users_involved)) {
            $users_involved = array();
        } else {
            $users_involved = array_unique($users_involved);
        }
        $people_involved = "<div style='padding-bottom: 20px;'>";
        foreach ($users_involved as $u) {
            $avatar = get_db_value("avatar", "tusuario", "id_usuario", $u);
            if ($avatar != "") {
                $people_involved .= "<img src='images/avatars/" . $avatar . ".png' width=40 height=40 onclick='openUserInfo(\"{$u}\")' title='" . $u . "'/>";
            } else {
                $people_involved .= "<img src='images/avatars/avatar_notyet.png' width=40 height=40 onclick='openUserInfo(\"{$u}\")' title='" . $u . "'/>";
            }
        }
        $people_involved .= "</div>";
        $table_detail .= "<tr><td colspan='10'>";
        $table_detail .= $people_involved;
        $table_detail .= "</td></tr>";
        $table_detail .= "<tr>";
        $table_detail .= '<td><b>' . __('Total workunit (hr)') . ' </b>';
        $table_detail .= "</td><td>";
        $table_detail .= $total_hr . " (" . format_numeric($total_hr / $config["hours_perday"]) . " " . __("days") . ")";
        $table_detail .= "</td></tr>";
        $table_detail .= "<tr>";
        $table_detail .= '<td><b>' . __('Planned workunit (hr)') . ' </b>';
        $table_detail .= "</td><td>";
        $table_detail .= $total_planned . " (" . format_numeric($total_planned / $config["hours_perday"]) . " " . __("days") . ")";
        $table_detail .= "</td></tr>";
        $table_detail .= "</table>";
        $class = $project['id_project'] . "-project";
        $tr_status = 'class="' . $class . '"';
        //~ echo '<tr '.$tr_status.'><td>';
        print_container_div("project_" . $project['id_project'], $project_name, $table_detail, 'closed', false, true, '', '', 1, '', 'width:32%; float:left;');
        //~ echo '</td></tr>';
    }
    //~ echo '</table>';
}
开发者ID:articaST,项目名称:integriaims,代码行数:87,代码来源:functions_crm.php

示例10: pager

function pager($records, $records_pp = 50, $break_on_page = 15)
{
    if ($records == 0) {
        return;
    }
    $cur = (int) get_var('p');
    $uri = '?';
    foreach ($_GET as $var => $val) {
        if ($var != 'p') {
            $uri .= $var . '=' . rawurlencode($val) . '&';
        }
    }
    if ($records < $records_pp) {
        return;
    }
    echo '<ul class="pager">';
    // adjust start page, if neccessary
    $total_pages = (int) ($records / $records_pp + 0.5);
    $start_page = 0;
    if ($total_pages > $break_on_page) {
        if ($total_pages - $cur < $break_on_page / 2) {
            $start_page = $total_pages - $break_on_page;
        } else {
            $start_page = $cur - (int) ($break_on_page / 2);
            if ($start_page < 0) {
                $start_page = 0;
            }
        }
    }
    $page = $start_page;
    $start_rec = $page * $records_pp + 1;
    $broken = false;
    while ($start_rec < $records + 1) {
        h('<li class="%s"><a href="%sp=%d">%d</a></li>', $page == $cur ? 'selected' : '', $uri, $page, $page + 1);
        $start_rec += $records_pp;
        $page++;
        if ($page == $break_on_page + $start_page + 1) {
            $broken = true;
            break;
        }
    }
    h('<li class="recordcount">%d %s</li>', $broken ? format_numeric(1 + $total_pages, '%d page', '%d pages') : format_numeric(1 + $total_pages, '%d record', '%d records'));
    echo '</ul>';
    echo '<div class="afterpgr">&nbsp;</div>';
}
开发者ID:einars,项目名称:tinymy,代码行数:45,代码来源:tinymy.php

示例11: format_post_float

function format_post_float($fieldnames)
{
    //takes a comma-separated list of POST keys and replaces them with monetary values or NULLs if they're empty
    global $_POST;
    $fields = array_post_fields($fieldnames);
    foreach ($fields as $field) {
        $_POST[$field] = format_numeric($_POST[$field]);
        if ($_POST[$field] === false) {
            $_POST[$field] = "NULL";
        }
    }
}
开发者ID:joshreisner,项目名称:hcfa-cc,代码行数:12,代码来源:format.php

示例12: translate_lead_progress

			} else {
				$overview = '';
			}
 			$data[3] = "<a href='index.php?sec=customers&sec2=operation/leads/lead&tab=search&id=".
				$lead['id']."'>".$lead['fullname'].$overview."</a><br>";
				$data[3] .= "<span style='font-size: 9px'><i>".$lead["company"]."</i></span>";


			$data[4] = "<a href='index.php?sec=customers&sec2=operation/companies/company_detail&id=".$lead['id_company']."'>".get_db_value ('name', 'tcompany', 'id', $lead['id_company'])."</a>";
			if ($lead["owner"] != "")
				$data[4] .= "<br><i>" . $lead["owner"] . "</i>";

			$data[5] = translate_lead_progress ($lead['progress']) . " <i>(".$lead['progress']. "%)</i>";
			
			if ($lead['estimated_sale'] != 0)
				$data[6] = format_numeric($lead['estimated_sale']);
			else
				$data[6] = "--";
		
			$data[7] = "<img src='images/lang/".$lead["id_language"].".png'>"; 
	
			$data[8] =  ucfirst(strtolower($lead['country']));
			$data[9] = "<span style='font-size: 9px' title='". $lead['creation'] . "'>" . human_time_comparation ($lead['creation']) . "</span>";
			$data[9] .= "<br><span style='font-size: 9px'>". human_time_comparation ($lead['modification']). "</span>";

			if ($lead['progress'] < 100 && $lead['owner'] == "")
				$data[10] = "<a href='index.php?sec=customers&sec2=operation/leads/lead&tab=search&id=".
				$lead['id']."&make_owner=1&offset=$offset'><img src='images/award_star_silver_1.png' title='".__("Take ownership of this lead")."'></a>&nbsp;";
			else
				$data[10] = "";
开发者ID:articaST,项目名称:integriaims,代码行数:30,代码来源:lead_detail.php

示例13: show_validation_delete

                $data[7] .= "<a href='#' onClick='javascript: show_validation_delete(\"delete_invoice\"," . $invoice["id"] . ",0," . $offset . ",\"" . $search_params . "\");'><img src='images/cross.png' title='" . __('Delete') . "'></a>";
            } else {
                if ($locked_id_user) {
                    $data[7] .= ' <img src="images/administrator_lock.png" width="18" height="18" 
					title="' . __('Locked by ' . $locked_id_user) . '">';
                }
            }
        }
        array_push($table->data, $data);
    }
    print_table($table);
    if ($total) {
        echo __("Subtotals for each currency: ");
    }
    foreach ($total as $key => $value) {
        echo "- {$key} : " . format_numeric($value, 2);
    }
} else {
    echo "<h3 class='no_result'>" . __("No invoices") . "</h3>";
}
if ($write || $manage and $clean_output == 0) {
    echo '<form method="post" action="index.php?sec=customers&sec2=operation/invoices/invoices">';
    echo '<div class="button" style="width: ' . $table->width . '">';
    print_submit_button(__('Create'), 'new_btn', false, 'class="sub next"');
    print_input_hidden('new_invoice', 1);
    echo '</div>';
    echo '</form>';
}
echo "<div class= 'dialog ui-dialog-content' title='" . __("Delete") . "' id='item_delete_window'></div>";
?>
开发者ID:dsyman2,项目名称:integriaims,代码行数:30,代码来源:invoice_detail.php

示例14: ksort

ksort($inv_data_currency);
arsort($inv_data_company, SORT_NUMERIC);
$table->id = 'company_list';
$table->class = 'listing';
$table->width = '90%';
$table->data = array();
$table->head = array();
$table->style = array();
$table->head[0] = __('Currency');
$table->head[1] = __('Invoiced');
$i = 0;
foreach ($inv_total_currency as $curr => $val) {
    if ($i < 5) {
        $data = array();
        $data[0] = $curr;
        $data[1] = format_numeric($val);
        array_push($table->data, $data);
    }
    $i++;
}
$currency_table = print_table($table, true);
switch ($search_invoice_type) {
    case 'Submitted':
        $container_title = __("Submitted billing history");
        break;
    case 'Received':
        $container_title = __("Received billing history");
        break;
    default:
        $container_title = __(" Submitted billing history");
        break;
开发者ID:dsyman2,项目名称:integriaims,代码行数:31,代码来源:invoice_stats.php

示例15: print_label

$table_advanced->data[0][0] .= print_label (__('Imputable costs'), '', '', true,
	task_workunit_cost ($id_task, 1).' '.$config['currency']);

$incident_cost = get_incident_task_workunit_cost ($id_task);
if ($incident_cost > 0)
	$incident_cost_label = "<span title='".__("Ticket costs")."'> ($incident_cost) </span>";
else
	$incident_cost_label = "";
	
$total_cost = $external_cost + task_workunit_cost ($id_task, 0) + $incident_cost;

$table_advanced->data[0][0] .= print_label (__('Total costs'), '', '', true,
	$total_cost . $incident_cost_label. $config['currency']);

$avg_hr_cost = format_numeric ($total_cost / $worked_time, 2);
$table_advanced->data[0][0] .= print_label (__('Average Cost per hour'), '', '', true,
	$avg_hr_cost .' '.$config['currency']);	

$external_cost = 0;
$external_cost = task_cost_invoices ($id_task);

if (!$external_cost) {
	$external_cost = 0;
}

$table_advanced->data[0][0] .= print_label (__("External costs"), '', '', true);
$table_advanced->data[0][0] .= $external_cost . " " . $config["currency"];	

// Abbreviation for "Estimated"
$labela = __('Est.');
开发者ID:articaST,项目名称:integriaims,代码行数:30,代码来源:task_report.php


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