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

PHP formatNumber函数代码示例

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

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



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

示例1: __construct

 public function __construct($new, $unit)
 {
     $absolute = formatNumber($new / $unit);
     $relative = formatNumber($absolute - 1);
     $hundred = formatNumber($absolute * 100);
     if ($absolute > 1) {
         $nominal = 'positive';
     } else {
         if ($absolute = 1) {
             $nominal = 'status-quo';
         } else {
             $nominal = 'negative';
         }
     }
 }
开发者ID:rubends,项目名称:web-backend-oplossingen,代码行数:15,代码来源:classes-begin.php


示例2: formatBytes

function formatBytes($bytes, $precision = 2, $system = 'IEC')
{
    if ($system === 'IEC') {
        $base = 1024;
        $units = array('B', 'KiB', 'MiB', 'GiB', 'TiB');
    } elseif ($system === 'SI') {
        $base = 1000;
        $units = array('B', 'KB', 'MB', 'GB', 'TB');
    }
    $bytes = max(intval($bytes), 0);
    $pow = $bytes === 0 ? 0 : floor(log($bytes) / log($base));
    $pow = min($pow, count($units) - 1);
    $bytes /= pow($base, $pow);
    return formatNumber($bytes, $precision) . ' ' . $units[$pow];
}
开发者ID:woshilapin,项目名称:FreshRSS,代码行数:15,代码来源:lib_rss.php


示例3: formatNumber

function formatNumber($v, $noOfDec = 2, $pad = null)
{
    $num = sprintf("%.{$noOfDec}f", (double) $v);
    return $num;
    // this to be fixed latter
    if ($num >= 100000) {
        $num = $num / 100000;
        $num = formatNumber($num);
        $num = $num . "Lakh";
    } else {
        if ($num >= 1000) {
            $num = $num / 1000;
            $num = formatNumber($num);
            $num = $num . "<b> K </b>";
        }
    }
}
开发者ID:aranyak-banerjee,项目名称:eetpl-connect,代码行数:17,代码来源:commonFunctions_helper.php


示例4: parseContacts

function parseContacts($filename)
{
    $contacts = array();
    $handle = fopen($filename, 'r');
    $contents = fread($handle, filesize($filename));
    $contactsString = trim($contents);
    $contactsArray = explode("\n", $contactsString);
    $newArray = [];
    fclose($handle);
    foreach ($contactsArray as $value) {
        $personInfoArray = explode("|", $value);
        $personInfoArray[1] = formatNumber($personInfoArray[1]);
        //next line is saying you are pushing info(associative array) into newArray.
        $newArray[] = ['name' => $personInfoArray[0], 'number' => $personInfoArray[1]];
    }
    // array literal notation is this [].
    // todo - read file and parse contacts
    return $newArray;
}
开发者ID:ryanski,项目名称:Codeup-Web-Exercises,代码行数:19,代码来源:contact-parser.php


示例5: sort_my_array

function sort_my_array($arr)
{
    foreach ($arr as $key => $row) {
        $nome[$key] = $row[0];
        $cnpj[$key] = $row[1];
        $usuario[$key] = $row[2];
        $auxVlr = formatNumber($row[3]);
        $valor[$key] = (double) $auxVlr;
        $email[$key] = $row[4];
    }
    if (isset($_GET['ordena'])) {
        switch ($_GET['ordena']) {
            case 'nomeA-emailD-valorD':
                array_multisort($nome, SORT_ASC, $email, SORT_DESC, $valor, SORT_DESC, $arr);
                break;
            case 'nomeD-emailD-valorD':
                array_multisort($nome, SORT_DESC, $email, SORT_DESC, $valor, SORT_DESC, $arr);
                break;
            case 'usuarioA-nomeA-valorD':
                array_multisort($usuario, SORT_ASC, $nome, SORT_ASC, $valor, SORT_DESC, $arr);
                break;
            case 'usuarioD-nomeA-valorD':
                array_multisort($usuario, SORT_DESC, $nome, SORT_ASC, $valor, SORT_DESC, $arr);
                break;
            case 'emailD-nomeD-valorA':
                array_multisort($email, SORT_DESC, $nome, SORT_DESC, $valor, SORT_ASC, $arr);
                break;
            case 'emailA-nomeD-valorA':
                array_multisort($email, SORT_ASC, $nome, SORT_DESC, $valor, SORT_ASC, $arr);
                break;
            case 'valorD-nomeA-emailA':
                array_multisort($valor, SORT_DESC, $nome, SORT_ASC, $email, SORT_ASC, $arr);
                break;
            case 'valorA-nomeA-emailA':
                array_multisort($valor, SORT_ASC, $nome, SORT_ASC, $email, SORT_ASC, $arr);
                break;
            default:
                # code...
                break;
        }
    }
    return $arr;
}
开发者ID:andersonbporto,项目名称:programacao_internet_2015_1,代码行数:43,代码来源:Report.php


示例6: contactInfo

function contactInfo($db, $call)
{
    $contacts = '';
    $q3 = "SELECT ares_contact_type, contact, validity, A.type " . "FROM ares_contact_info A, ares_contact_type B " . "WHERE A.type = B.type AND A.call='" . $call . "'";
    //echo "<p>" . $q3 . ",/p>\n";
    $r3 = getResult($q3, $db);
    while ($row3 = getRow($r3, $db)) {
        $xx = $row3[1];
        if ($row3[3] < 4) {
            $xx = formatNumber($row3[1]);
        }
        if ($row3[2] == 1) {
            $contacts = $contacts . $row3[0] . ": <b>" . $xx . "</b><br>";
        } else {
            $contacts = $contacts . $row3[0] . ": " . $xx . "<br>";
        }
    }
    echo $contacts;
}
开发者ID:jjmcd,项目名称:mi-arpsc,代码行数:19,代码来源:ECcontact.php


示例7: parseContacts

function parseContacts($filename)
{
    $filename = 'contacts.txt';
    $handle = fopen($filename, 'r');
    $contents = fread($handle, filesize($filename));
    //$keys = array('name','number');
    $trimContent = trim($contents);
    $contacts = array();
    $formatArray = [];
    $contactsArray = explode("\n", $trimContent);
    //$contacts=explode('|',$contents);
    fclose($handle);
    foreach ($contactsArray as $value) {
        $personInfoArray = explode('|', $value);
        $personInfoArray[1] = formatNumber($personInfoArray[1]);
        $formatArray[] = ['name' => $personInfoArray[0], 'number' => $personInfoArray[1]];
    }
    // todo - read file and parse contacts
    return $formatArray;
}
开发者ID:pswantner,项目名称:Codeup-Web-Excercises,代码行数:20,代码来源:contact-parser.php


示例8: foreach

    //get current values
    $sth = $dbh->prepare('SELECT *
			FROM ' . $TYPES[$_POST['type']]['pluralName'] . '
			WHERE ' . $TYPES[$_POST['type']]['idName'] . ' = :id');
    $sth->execute([':id' => $_POST['id']]);
    $item = $sth->fetch();
    $return['html'] = '<h1>Edit ' . $_POST['type'] . '</h1>';
    foreach ($TYPES[$_POST['type']]['formData'] as $key => $section) {
        $return['html'] .= '<section><h2>' . $key . '</h2><div class="sectionData">';
        foreach ($section as $column) {
            $return['html'] .= '<ul>';
            foreach ($column as $field) {
                $formalName = $TYPES[$_POST['type']]['fields'][$field]['formalName'];
                $attributes = $TYPES[$_POST['type']]['fields'][$field]['verifyData'];
                if ($attributes[1] == 'int' || $attributes[1] == 'dec') {
                    $item[$field] = formatNumber($item[$field]);
                }
                if ($attributes[1] == 'int' || $attributes[1] == 'str' || $attributes[1] == 'dec' || $attributes[1] == 'email') {
                    $return['html'] .= '<li><label for="' . $field . '">' . $formalName . '</label>';
                    $return['html'] .= '<input type="text" name="' . $field . '" autocomplete="off" value="' . $item[$field] . '"></li>';
                } elseif ($attributes[1] == 'id' || $attributes[1] == 'opt') {
                    $empty = $attributes[0] == 0 || $field == 'managerID' && $item[$field] == 0 ? true : false;
                    //allow empty field if it's not required, or if the item is the top employee
                    $return['html'] .= '<li><label for="' . $field . '">' . $formalName . '</label><select name="' . $field . '">';
                    $return['html'] .= $attributes[1] == 'id' ? generateTypeOptions($attributes[2], $empty, $item[$field]) : generateFieldOptions($_POST['type'], $field, $empty, $item[$field]);
                    $return['html'] .= '</select></li>';
                } elseif ($attributes[1] == 'disp') {
                    $return['html'] .= '<li>&nbsp;</li>';
                } elseif ($attributes[1] == 'date') {
                    $return['html'] .= '<li><label for="' . $field . '">' . $formalName . '</label>';
                    $return['html'] .= '<input type="text" class="dateInput" name="' . $field . '" autocomplete="off" value="' . formatDate($item[$field]) . '"></li>';
开发者ID:jewelhuq,项目名称:erp,代码行数:31,代码来源:ajax.php


示例9: getBudgetItemsByBudgetId


//.........这里部分代码省略.........
        $directFee += $smallCount[3];
        $smallCount = array(0, 0, 0, 0, 0, 0);
    }
    //增加一行空行
    $res[$count++] = array('budgetItemId' => 'NULL' . $count, 'budgetId' => $budgetId, 'isEditable' => false);
    //计算其他项
    $totalFee = $directFee;
    //N 工程直接费
    $itemUnit = '元';
    $itemName = '工程直接费';
    $itemCode = 'N';
    $item = $NOPQRSItems[$itemCode];
    $budgetItemId = $item['budgetItemId'];
    $fee = $directFee;
    $res[$count++] = array('budgetItemId' => $budgetItemId, 'itemName' => $isGBK ? str2GBK($itemName) : $itemName, 'budgetId' => $budgetId, 'itemCode' => $itemCode, 'itemUnit' => $isGBK ? str2GBK($itemUnit) : $itemUnit, 'mainMaterialTotalPrice' => $fee, 'isEditable' => false);
    if ($fee != $item['mainMaterialPrice']) {
        $item['mainMaterialPrice'] = $fee;
        $arr = editItem($item);
        // update
    }
    // O 设计费
    $itemUnit = '元';
    $itemName = '设计费3%';
    $itemCode = 'O';
    $item = $NOPQRSItems[$itemCode];
    $itemAmount = $item['itemAmount'];
    $budgetItemId = $item['budgetItemId'];
    $fee = $directFee * $itemAmount;
    $totalFee += $fee;
    $res[$count++] = array('budgetItemId' => $budgetItemId, 'itemName' => $isGBK ? str2GBK($itemName) : $itemName, 'budgetId' => $budgetId, 'itemCode' => $itemCode, 'itemUnit' => $isGBK ? str2GBK($itemUnit) : $itemUnit, 'itemAmount' => $itemAmount, 'mainMaterialTotalPrice' => $fee, 'isEditable' => false);
    if ($fee != $item['mainMaterialPrice']) {
        $item['mainMaterialPrice'] = $fee;
        $arr = editItem($item);
        // update
    }
    // P 效果图
    $itemUnit = '张';
    $itemName = '效果图';
    $itemCode = 'P';
    $item = $NOPQRSItems[$itemCode];
    $itemAmount = $item['itemAmount'];
    $budgetItemId = $item['budgetItemId'];
    $fee = 500 * $itemAmount;
    $totalFee += $fee;
    $res[$count++] = array('budgetItemId' => $budgetItemId, 'itemName' => $isGBK ? str2GBK($itemName) : $itemName, 'budgetId' => $budgetId, 'itemCode' => $itemCode, 'itemUnit' => $isGBK ? str2GBK($itemUnit) : $itemUnit, 'itemAmount' => $itemAmount, 'mainMaterialTotalPrice' => $fee, 'isEditable' => false);
    // Q 5%管理费
    $itemUnit = '元';
    $itemName = '5%管理费';
    $itemCode = 'Q';
    $item = $NOPQRSItems[$itemCode];
    $itemAmount = $item['itemAmount'];
    $budgetItemId = $item['budgetItemId'];
    $fee = $directFee * $itemAmount;
    $totalFee += $fee;
    $res[$count++] = array('budgetItemId' => $budgetItemId, 'itemName' => $isGBK ? str2GBK($itemName) : $itemName, 'budgetId' => $budgetId, 'itemCode' => $itemCode, 'itemUnit' => $isGBK ? str2GBK($itemUnit) : $itemUnit, 'itemAmount' => $itemAmount, 'mainMaterialTotalPrice' => $fee, 'isEditable' => false);
    if ($fee != $item['mainMaterialPrice']) {
        $item['mainMaterialPrice'] = $fee;
        $arr = editItem($item);
        // update
    }
    // R 税金
    $itemUnit = '元';
    $itemName = '税金';
    $itemCode = 'R';
    $item = $NOPQRSItems[$itemCode];
    $itemAmount = $item['itemAmount'];
    $budgetItemId = $item['budgetItemId'];
    $fee = $directFee * $itemAmount;
    $totalFee += $fee;
    $res[$count++] = array('budgetItemId' => $budgetItemId, 'itemName' => $isGBK ? str2GBK($itemName) : $itemName, 'budgetId' => $budgetId, 'itemCode' => $itemCode, 'itemUnit' => $isGBK ? str2GBK($itemUnit) : $itemUnit, 'itemAmount' => $itemAmount, 'mainMaterialTotalPrice' => $fee, 'isEditable' => false);
    if ($fee != $item['mainMaterialPrice']) {
        $item['mainMaterialPrice'] = $fee;
        $arr = editItem($item);
        // update
    }
    // S 工程总造价
    $itemUnit = '元';
    $itemName = '工程总造价';
    $itemCode = 'S';
    $item = $NOPQRSItems[$itemCode];
    $budgetItemId = $item['budgetItemId'];
    $itemAmount = '';
    $fee = $totalFee;
    $res[$count++] = array('budgetItemId' => $budgetItemId, 'itemName' => $isGBK ? str2GBK($itemName) : $itemName, 'budgetId' => $budgetId, 'itemCode' => $itemCode, 'itemUnit' => $isGBK ? str2GBK($itemUnit) : $itemUnit, 'itemAmount' => $itemAmount, 'mainMaterialTotalPrice' => $fee, 'isEditable' => false);
    if ($fee != $item['mainMaterialPrice']) {
        $item['mainMaterialPrice'] = $fee;
        $arr = editItem($item);
        // update
    }
    foreach ($res as $count => $bItem) {
        //保留小数点后两位,不足补0
        foreach ($bItem as $key => $val) {
            if (!in_array($key, array('itemAmount', 'mainMaterialTotalPrice', 'auxiliaryMaterialTotalPrice', 'manpowerTotalPrice', 'mainMaterialTotalCost', 'lossPercent', 'manpowerTotalCost', 'machineryTotalPrice', 'mainMaterialPrice', 'auxiliaryMaterialPrice', 'machineryPrice', 'manpowerPrice'))) {
                continue;
            }
            $res[$count][$key] = formatNumber($val);
        }
    }
    return $res;
}
开发者ID:hxghxg527,项目名称:FamilyDecoration,代码行数:101,代码来源:budgetDB.php


示例10: formatNumber_money

function formatNumber_money($value)
{
    return formatNumber($value, 'intmoney');
}
开发者ID:vikingkarwur,项目名称:smjgpib,代码行数:4,代码来源:donByMonth.php


示例11: reset

            <th>Count</th>
        </tr>
    </thead>
    <tbody>
        <?php 
reset($count);
$whole_size = $statistics->getSize();
for ($i = 0; $i < sizeof($count) - 1; $i++) {
    $key = key($count);
    ?>
            <tr>
                <td><?php 
    echo $key;
    ?>
</td>
                <td><?php 
    echo formatSizeNumber($whole_size[$key]);
    ?>
</td>
                <td><?php 
    echo formatNumber($count[$key]);
    ?>
</td>
            </tr>
            <?php 
    next($count);
}
?>
    </tbody>
</table>
开发者ID:rootfs,项目名称:robinhood,代码行数:30,代码来源:count.php


示例12: array

echo "<h1>User " . $user . "</h1>";
echo "<hr/>";
global $sz_range_fields;
global $sz_range_name;
// summary table
$tab = array(array());
$i = 0;
foreach ($user_info as $g => $vals) {
    if ($vals[COUNT] > 0) {
        $avg = round($vals[SIZE] / $vals[COUNT], 0);
    } else {
        $avg = 0;
    }
    $tab[$i][] = "{$user}/{$g}";
    $tab[$i][] = formatSizeNumber($vals[SIZE]);
    $tab[$i][] = formatNumber($vals[COUNT]);
    $tab[$i][] = formatSizeNumber($avg);
    $i++;
}
$header = "<thead> <tr>";
$header = $header . "<th>User/Group</th>";
$header = $header . "<th>Volume</th>";
$header = $header . "<th>File count</th>";
$header = $header . "<th>Avg Size</th>";
$header = $header . "</tr> </thead>";
generateMergedTable($tab, $header);
// profile table
$sz_ranges = array();
$tab = array(array());
$header = "<thead> <tr>";
foreach ($sz_range_name as $range) {
开发者ID:rootfs,项目名称:robinhood,代码行数:31,代码来源:popup.php


示例13: anchor

        echo anchor('invoices/view/' . $row->id, $row->invoice_number);
        ?>
</td>
		<td><?php 
        echo anchor('invoices/view/' . $row->id, $display_date);
        ?>
</td>
		<td class="cName"><?php 
        echo anchor('invoices/view/' . $row->id, $row->name);
        ?>
 <span class="short_description"><?php 
        echo $short_description[$row->id];
        ?>
</span></td>
		<td><?php 
        echo anchor('invoices/view/' . $row->id, formatNumber($row->subtotal, TRUE));
        ?>
</td>
		<td>
		<?php 
        if ($row->amount_paid == $row->subtotal) {
            // paid invoices
            echo anchor('invoices/view/' . $row->id, $this->lang->line('invoice_closed'), array('title' => 'invoice status'));
        } elseif ($row->amount_paid > $row->subtotal) {
            // invoices with credit.
            echo anchor('invoices/view/' . $row->id, $this->lang->line('invoice_with_credit'), array('title' => 'invoice status'));
        } elseif (mysql_to_unix($row->dateIssued) >= strtotime('-' . $this->settings_model->get_setting('days_payment_due') . ' days')) {
            // owing less then the overdue days amount
            echo anchor('invoices/view/' . $row->id, $this->lang->line('invoice_open'), array('title' => 'invoice status'));
        } else {
            // owing more then the overdue days amount
开发者ID:skarcha,项目名称:BambooInvoice,代码行数:31,代码来源:invoice_table.php


示例14: key

$count = $statistics->getCount();
for ($i = 0; $i < sizeof($top_size) - 1; $i++) {
    $group = key($top_size);
    ?>
            <tr>
                <td>
                    <?php 
    echo "<a href='" . str_replace(" ", "%20", $group) . "_group_popup.php'rel='#volume'>" . $group . "</a>";
    ?>
                </td>
                <td><?php 
    echo formatSizeNumber($top_size[$group]);
    ?>
</td>
                <td><?php 
    echo formatNumber($count[$group]);
    ?>
</td>
            </tr>
            <?php 
    next($top_size);
}
?>
    </tbody>
</table>

<!-- POPUP -->
<div class="apple_overlay" id="volume">
    <div class="contentWrap"></div>
</div>
开发者ID:rootfs,项目名称:robinhood,代码行数:30,代码来源:volume.php


示例15: trackingTotalCost

 /**
  * Computer total cost of a ticket
  *
  * @param $actiontime float : ticket actiontime
  * @param $cost_time float : ticket time cost
  * @param $cost_fixed float : ticket fixed cost
  * @param $cost_material float : ticket material cost
  * @param $edit boolean : used for edit of computation ?
  *
  * @return total cost formatted string
  **/
 static function trackingTotalCost($actiontime, $cost_time, $cost_fixed, $cost_material, $edit = true)
 {
     return formatNumber($actiontime * $cost_time / HOUR_TIMESTAMP + $cost_fixed + $cost_material, $edit);
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:15,代码来源:ticket.class.php


示例16: Redirect

    Redirect("Menu.php");
    exit;
}
$sDate = FilterInput($_GET['date'], 'char', 10);
// JPGraph seems to be fixed.. no longer needed
// setlocale(LC_ALL, 'C');
// Include JPGraph library and the pie chart drawing modules
LoadLib_JPGraph(pie, pie3d);
$sSQL = "SELECT fun_Name as Fund, SUM(dna_Amount) as Total\n\tFROM donations_don\n\tLEFT JOIN donationamounts_dna ON donations_don.don_ID = donationamounts_dna.dna_don_ID\n\tLEFT JOIN donationfund_fun ON donationamounts_dna.dna_fun_ID = donationfund_fun.fun_ID\n\tWHERE don_Date = '{$sDate}'\n\tGROUP BY fun_ID ORDER BY fun_Name ASC";
$result = RunQuery($sSQL);
$i = 0;
while ($row = mysql_fetch_array($result)) {
    extract($row);
    $funds[$i] = $Fund;
    $totals[$i] = $Total;
    $funds[$i] = $funds[$i] . " (" . formatNumber($Total, 'money') . ")";
    $i++;
}
// Start Graphing ---------------------------->
// Create the graph.
$graph = new PieGraph(550, 200);
$graph->SetShadow();
// Set A title for the plot
$graph->title->Set(gettext("Total by Fund for") . " {$sDate}");
$graph->title->SetFont(FF_FONT1, FS_BOLD, 16);
$graph->title->SetColor("darkblue");
$graph->legend->Pos(0.02, 0.15);
// Create the bar plot
$p1 = new PiePlot3d($totals);
$p1->SetTheme("sand");
$p1->SetCenter(0.285);
开发者ID:vikingkarwur,项目名称:smjgpib,代码行数:31,代码来源:funds1day.php


示例17: toNumber

function toNumber($n, $d)
{
    $toNumber = formatNumber($n, $d, -1);
    return @$toNumber;
}
开发者ID:313801120,项目名称:AspPhpCms,代码行数:5,代码来源:StringNumber.php


示例18: graphBy


//.........这里部分代码省略.........
         $hauteur_moyenne = round($moyenne * $rapport);
         $hauteur = round($value * $rapport);
         echo "<td class='bottom' width=" . $largeur . ">";
         if ($hauteur >= 0) {
             if ($hauteur_moyenne > $hauteur) {
                 $difference = $hauteur_moyenne - $hauteur - 1;
                 echo "<img alt=\"{$key}: {$value}\" title=\"{$key}: {$value}\" src='" . $CFG_GLPI["root_doc"] . "/pics/moyenne.png' width=" . $largeur . " height='1' >";
                 echo "<img alt=\"{$key}: {$value}\" title=\"{$key}: {$value}\" src='" . $CFG_GLPI["root_doc"] . "/pics/rien.gif' width=" . $largeur . " height=" . $difference . " >";
                 echo "<img alt=\"{$key}: {$value}\" title=\"{$key}: {$value}\" src='" . $CFG_GLPI["root_doc"] . "/pics/noir.png' width=" . $largeur . " height='1' >";
                 if (strstr($key, "-01")) {
                     // janvier en couleur foncee
                     echo "<img alt=\"{$key}: {$value}\" title=\"{$key}: {$value}\" src='" . $CFG_GLPI["root_doc"] . "/pics/fondgraph1.png' width=" . $largeur . " height=" . $hauteur . " >";
                 } else {
                     echo "<img alt=\"{$key}: {$value}\" title=\"{$key}: {$value}\" src='" . $CFG_GLPI["root_doc"] . "/pics/fondgraph2.png' width=" . $largeur . " height=" . $hauteur . " >";
                 }
             } else {
                 if ($hauteur_moyenne < $hauteur) {
                     $difference = $hauteur - $hauteur_moyenne - 1;
                     echo "<img alt=\"{$key}: {$value}\" title=\"{$key}: {$value}\" src='" . $CFG_GLPI["root_doc"] . "/pics/noir.png' width=" . $largeur . " height='1'>";
                     if (strstr($key, "-01")) {
                         // janvier en couleur foncee
                         $couleur = "1";
                         $couleur2 = "2";
                     } else {
                         $couleur = "2";
                         $couleur2 = "1";
                     }
                     echo "<img alt=\"{$key}: {$value}\" title=\"{$key}: {$value}\" src='" . $CFG_GLPI["root_doc"] . "/pics/fondgraph{$couleur}.png' width=" . $largeur . " height=" . $difference . ">";
                     echo "<img alt=\"{$key}: {$value}\" title=\"{$key}: {$value}\" src='" . $CFG_GLPI["root_doc"] . "/pics/moyenne.png' width=" . $largeur . " height='1'>";
                     echo "<img alt=\"{$key}: {$value}\" title=\"{$key}: {$value}\" src='" . $CFG_GLPI["root_doc"] . "/pics/fondgraph{$couleur}.png' width=" . $largeur . " height=" . $hauteur_moyenne . ">";
                 } else {
                     echo "<img alt=\"{$key}: {$value}\" title=\"{$key}: {$value}\" src='" . $CFG_GLPI["root_doc"] . "/pics/noir.png' width=" . $largeur . " height='1'>";
                     if (strstr($key, "-01")) {
                         // janvier en couleur foncee
                         echo "<img alt=\"{$key}: {$val_tab}\" title=\"{$key}: {$value}\" src='" . $CFG_GLPI["root_doc"] . "/pics/fondgraph1.png' width=" . $largeur . " height=" . $hauteur . ">";
                     } else {
                         echo "<img alt=\"{$key}: {$value}\" title=\"{$key}: {$value}\" src='" . $CFG_GLPI["root_doc"] . "/pics/fondgraph2.png' width=" . $largeur . " height=" . $hauteur . ">";
                     }
                 }
             }
         }
         echo "<img alt=\"{$value}\" title=\"{$value}\" src='" . $CFG_GLPI["root_doc"] . "/pics/rien.gif' width=" . $largeur . " height='1'>";
         echo "</td>\n";
     }
     echo "<td bgcolor='black'>";
     echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/noir.png' width='1' height='1' alt=''></td></tr>";
     if ($largeur > 10) {
         echo "<tr><td></td>";
         foreach ($entrees as $key => $val) {
             if ($type == "month") {
                 $splitter = explode("-", $key);
                 echo "<td class='center'>" . utf8_substr($LANG['calendarM'][$splitter[1] - 1], 0, 3) . "</td>";
             } else {
                 if ($type == "year") {
                     echo "<td class='center'>" . substr($key, 2, 2) . "</td>";
                 }
             }
         }
         echo "</tr>";
     }
     if ($maxgraph <= 10) {
         $r = 2;
     } else {
         if ($maxgraph <= 100) {
             $r = 1;
         } else {
             $r = 0;
         }
     }
     echo "</table>";
     echo "</td>";
     echo "<td style='background-image:url(" . $CFG_GLPI["root_doc"] . "/pics/fond-stats.gif)' class='bottom'>";
     echo "<img src='" . $CFG_GLPI["root_doc"] . "/pics/rien.gif' style='background-color:black;' " . "width='3' height='1' alt=''></td>";
     echo "<td><img src='" . $CFG_GLPI["root_doc"] . "/pics/rien.gif' width='5' height='1' alt=''></td>";
     echo "<td class='top'>";
     echo "<table>";
     echo "<tr><td height='15' class='top'>";
     echo "<font face='arial,helvetica,sans-serif' size='1' class ='b'>" . formatNumber($maxgraph, false, $r) . "</font></td></tr>";
     echo "<tr><td height='25' class='middle'>";
     echo "<font face='arial,helvetica,sans-serif' size='1' color='#999999'>" . formatNumber(7 * ($maxgraph / 8), false, $r) . "</font></td></tr>";
     echo "<tr><td height='25' class='middle'>";
     echo "<font face='arial,helvetica,sans-serif' size='1'>" . formatNumber(3 * ($maxgraph / 4), false, $r);
     echo "</font></td></tr>";
     echo "<tr><td height='25' class='middle'>";
     echo "<font face='arial,helvetica,sans-serif' size='1' color='#999999'>" . formatNumber(5 * ($maxgraph / 8), false, $r) . "</font></td></tr>";
     echo "<tr><td height='25' class='middle'>";
     echo "<font face='arial,helvetica,sans-serif' size='1' class ='b'>" . formatNumber($maxgraph / 2, false, $r) . "</font></td></tr>";
     echo "<tr><td height='25' class='middle'>";
     echo "<font face='arial,helvetica,sans-serif' size='1' color='#999999'>" . formatNumber(3 * ($maxgraph / 8), false, $r) . "</font></td></tr>";
     echo "<tr><td height='25' class='middle'>";
     echo "<font face='arial,helvetica,sans-serif' size='1'>" . formatNumber($maxgraph / 4, false, $r);
     echo "</font></td></tr>";
     echo "<tr><td height='25' class='middle'>";
     echo "<font face='arial,helvetica,sans-serif' size='1' color='#999999'>" . formatNumber(1 * ($maxgraph / 8), false, $r) . "</font></td></tr>";
     echo "<tr><td height='10' class='bottom'>";
     echo "<font face='arial,helvetica,sans-serif' size='1' class='b'>0</font></td></tr>";
     echo "</table>";
     echo "</td></tr></table>";
     echo "</div>";
 }
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:101,代码来源:stat.class.php


示例19: restoreMySqlDump

/**  Restore a mysql dump
 *
 * @param $DB DB object
 * @param $dumpFile dump file
 * @param $duree max delay before refresh
**/
function restoreMySqlDump($DB, $dumpFile, $duree)
{
    global $DB, $TPSCOUR, $offset, $cpt, $LANG;
    // $dumpFile, fichier source
    // $duree=timeout pour changement de page (-1 = aucun)
    // Desactivation pour empecher les addslashes au niveau de la creation des tables
    // En plus, au niveau du dump on considere qu'on est bon
    // set_magic_quotes_runtime(0);
    if (!file_exists($dumpFile)) {
        echo $LANG['document'][38] . "&nbsp;: {$dumpFile}<br>";
        return false;
    }
    $fileHandle = fopen($dumpFile, "rb");
    if (!$fileHandle) {
        echo $LANG['document'][45] . "&nbsp;: {$dumpFile}<br>";
        return false;
    }
    if ($offset != 0) {
        if (fseek($fileHandle, $offset, SEEK_SET) != 0) {
            //erreur
            echo $LANG['backup'][22] . " " . formatNumber($offset, false, 0) . "<br>";
            return false;
        }
        glpi_flush();
    }
    $formattedQuery = "";
    while (!feof($fileHandle)) {
        current_time();
        if ($duree > 0 && $TPSCOUR >= $duree) {
            //on atteint la fin du temps imparti
            return true;
        }
        // specify read length to be able to read long lines
        $buffer = fgets($fileHandle, 102400);
        // do not strip comments due to problems when # in begin of a data line
        $formattedQuery .= $buffer;
        if (get_magic_quotes_runtime()) {
            $formattedQuery = stripslashes($formattedQuery);
        }
        if (substr(rtrim($formattedQuery), -1) == ";") {
            // Do not use the $DB->query
            if ($DB->query($formattedQuery)) {
                //if no success continue to concatenate
                $offset = ftell($fileHandle);
                $formattedQuery = "";
                $cpt++;
            }
        }
    }
    if ($DB->error) {
        echo "<hr>" . $LANG['backup'][23] . " [{$formattedQuery}]<br>" . $DB->error() . "<hr>";
    }
    fclose($fileHandle);
    $offset = -1;
    return true;
}
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:62,代码来源:backup.php


示例20: getHoursAvailable

function getHoursAvailable($userid, $type = 1, $start = '2015-01-01', $end = '2015-12-31')
{
    $accrued = getHoursAccrued($userid, $type, $start, $end);
    //debugMessage($accrued);
    $taken = getHoursTaken($userid, $type, $start, $end);
    //debugMessage($taken);
    $available = $accrued - $taken;
    // debugMessage($available);
    return $available < 0 ? 0 : formatNumber($available);
}
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:10,代码来源:dropdownlists.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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