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

PHP ct函数代码示例

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

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



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

示例1: getTickerColumns

 /**
  * @return an array of columns e.g. (type, title, args)
  */
 function getTickerColumns()
 {
     $columns = array();
     $columns[] = array('type' => 'number', 'title' => ct("Free delay"));
     $columns[] = array('type' => 'number', 'title' => ct("Premium delay"));
     return $columns;
 }
开发者ID:phpsource,项目名称:openclerk,代码行数:10,代码来源:StatisticsQueue.php


示例2: ct

function ct($n, $m)
{
    $ct = c::get($n, $m);
    if (!is_null($ct)) {
        return $ct;
    }
    if ($n === $m) {
        $ct = 0.0;
    } elseif ($n === 1 && $m === 0) {
        $ct = 2.0;
    } elseif ($m === 0) {
        $ct = (1 + ct($n - 1, 0)) * 2;
    } else {
        for ($i = $m + 1; $i != $n; ++$i) {
            $ct0 = c::get($n, $i);
            if (!is_null($ct0)) {
                break;
            }
        }
        for ($i -= 1; $i != $m; --$i) {
            $ct1 = 1 + $ct0 / 2 + ct($n, 0) / 2;
            c::set($n, $i, $ct1);
            $ct0 = $ct1;
        }
        $ct = 1 + ct($n, $m + 1) / 2 + ct($n, 0) / 2;
    }
    c::set($n, $m, $ct);
    return $ct;
}
开发者ID:BastinRobin,项目名称:CodeSprints,代码行数:29,代码来源:ct.php


示例3: getTickerColumns

 /**
  * @return an array of columns e.g. (type, title, args)
  */
 function getTickerColumns()
 {
     $columns = array();
     $columns[] = array('type' => 'number', 'title' => ct("1 min"), 'min' => 0, 'max' => 5);
     $columns[] = array('type' => 'number', 'title' => ct("5 min"), 'min' => 0, 'max' => 5);
     $columns[] = array('type' => 'number', 'title' => ct("15 min"), 'min' => 0, 'max' => 5);
     return $columns;
 }
开发者ID:phpsource,项目名称:openclerk,代码行数:11,代码来源:StatisticsSystemLoad.php


示例4: getData

 public function getData($days)
 {
     $columns = array();
     $key_column = array('type' => 'date', 'title' => ct("Date"));
     $report_type = $this->report_type;
     $report_table = $this->report_table;
     $report_ref_table = $this->report_ref_table;
     $report_reference = $this->report_reference;
     $key_prefix = $this->key_prefix;
     $key = $this->key;
     $actual_value_key = $this->actual_value_key;
     $q = db()->prepare("SELECT * FROM performance_reports WHERE report_type=? ORDER BY id DESC LIMIT 30");
     $q->execute(array($report_type));
     $reports = $q->fetchAll();
     if (!$reports) {
         return render_text($graph, "No report {$report_type} found.");
     }
     // construct an array of (date => )
     $data = array();
     $keys = array();
     $last_updated = false;
     foreach ($reports as $report) {
         // get all queries
         $q = db()->prepare("SELECT * FROM {$report_table} AS r " . ($report_ref_table ? "JOIN {$report_ref_table} AS q ON r.{$report_reference}=q.id " : "") . "WHERE report_id=?");
         $q->execute(array($report['id']));
         $date = date('Y-m-d H:i:s', strtotime($report['created_at']));
         $row = array();
         while ($query = $q->fetch()) {
             if (!isset($keys[$query[$key]])) {
                 $keys[$query[$key]] = count($keys);
                 $columns[] = array('type' => 'number', 'title' => $query[$key]);
             }
             if ($actual_value_key === null) {
                 if ($query[$key_prefix . '_count'] == 0) {
                     // prevent division by 0
                     $row[$keys[$query[$key]]] = graph_number_format(0);
                 } else {
                     $row[$keys[$query[$key]]] = graph_number_format($query[$key_prefix . '_time'] / $query[$key_prefix . '_count']);
                 }
             } else {
                 $row[$keys[$query[$key]]] = graph_number_format($query[$actual_value_key]);
             }
         }
         $data[$date] = $row;
         $last_updated = max($last_updated, strtotime($report['created_at']));
     }
     // fill in any missing rows, e.g. queries that may not have featured in certain reports
     foreach ($data as $date => $row) {
         foreach ($keys as $id) {
             if (!isset($row[$id])) {
                 $data[$date][$id] = 0;
             }
         }
     }
     return array('key' => $key_column, 'columns' => $columns, 'data' => $data, 'last_updated' => $last_updated);
 }
开发者ID:phpsource,项目名称:openclerk,代码行数:56,代码来源:AdminMetrics.php


示例5: getTickerColumns

 /**
  * @return an array of columns e.g. (type, title, args)
  */
 function getTickerColumns()
 {
     $args = array(':pair' => get_currency_abbr($this->currency1) . "/" . get_currency_abbr($this->currency2));
     $columns = array();
     if ($this->onlyhasLastTrade()) {
         // hack fix because TheMoneyConverter and Coinbase only have last_trade
         $columns[] = array('type' => 'number', 'title' => ct(":pair"), 'args' => $args);
     } else {
         $columns[] = array('type' => 'number', 'title' => ct(":pair Bid"), 'args' => $args);
         $columns[] = array('type' => 'number', 'title' => ct(":pair Ask"), 'args' => $args);
     }
     return $columns;
 }
开发者ID:phpsource,项目名称:openclerk,代码行数:16,代码来源:Ticker.php


示例6: getData

 public function getData($days)
 {
     $columns = array();
     $key_column = array('type' => 'string', 'title' => ct("Key"));
     $columns[] = array('type' => 'string', 'title' => ct("Title"), 'heading' => true);
     $columns[] = array('type' => 'string align-right', 'title' => ct("Total"));
     $columns[] = array('type' => 'string align-right', 'title' => ct("Last week"));
     $columns[] = array('type' => 'string align-right', 'title' => ct("Last day"));
     $columns[] = array('type' => 'string align-right', 'title' => ct("Last hour"));
     $last_updated = time();
     $summary = array('user_properties' => array('title' => ct('Users'), 'extra' => array('is_disabled=1' => ct('Disabled'))), 'addresses' => array('title' => ct('Addresses')), 'jobs' => array('title' => ct('Jobs'), 'extra' => array('is_executed=0' => ct('Pending'))), 'outstanding_premiums' => array('title' => ct('Premiums'), 'extra' => array('is_paid=1' => ct('Paid'))), 'uncaught_exceptions' => array('title' => ct('Uncaught exceptions')), 'ticker' => array('title' => ct('Ticker instances')));
     $result = array();
     foreach ($summary as $key => $data) {
         $row = array();
         $row[0] = $data['title'];
         if (isset($data['extra'])) {
             foreach ($data['extra'] as $extra_key => $extra_title) {
                 $row[0] .= " ({$extra_title})";
             }
         }
         $parts = array('1', 'created_at >= date_sub(now(), interval 7 day)', 'created_at >= date_sub(now(), interval 1 day)', 'created_at >= date_sub(now(), interval 1 hour)');
         foreach ($parts as $query) {
             $q = db()->prepare("SELECT COUNT(*) AS c FROM {$key} WHERE {$query}");
             $q->execute();
             $c = $q->fetch();
             $row[] = number_format($c['c']);
             if (isset($data['extra'])) {
                 foreach ($data['extra'] as $extra_key => $extra_title) {
                     $q = db()->prepare("SELECT COUNT(*) AS c FROM {$key} WHERE {$query} AND {$extra_key}");
                     $q->execute();
                     $c = $q->fetch();
                     $row[count($row) - 1] .= " (" . number_format($c['c']) . ")";
                 }
             }
         }
         $result[$key] = $row;
     }
     $row = array(ct("Unused premium addresses"));
     $q = db()->prepare("SELECT currency, COUNT(*) AS c FROM premium_addresses WHERE is_used=0 GROUP BY currency");
     $q->execute();
     while ($c = $q->fetch()) {
         $row[] = number_format($c['c']) . " (" . get_currency_abbr($c['currency']) . ")";
     }
     $result['unused_premium_addresses'] = $row;
     return array('key' => $key_column, 'columns' => $columns, 'data' => $result, 'last_updated' => $last_updated);
 }
开发者ID:phpsource,项目名称:openclerk,代码行数:46,代码来源:AdminStatistics.php


示例7: getData

 public function getData($days)
 {
     $key_column = array('type' => 'string', 'title' => get_exchange_name($this->exchange));
     $columns = array();
     $columns[] = array('type' => 'string', 'title' => ct("Price"), 'heading' => true);
     $columns[] = array('type' => 'string', 'title' => ct("Value"));
     $data = array();
     $q = db()->prepare("SELECT * FROM ticker_recent WHERE exchange=:exchange AND currency1=:currency1 AND currency2=:currency2");
     $q->execute(array('exchange' => $this->exchange, 'currency1' => $this->currency1, 'currency2' => $this->currency2));
     if ($ticker = $q->fetch()) {
         $last_updated = $ticker['created_at'];
         $data[] = array('Bid', currency_format($this->currency1, $ticker['bid'], 4));
         $data[] = array('Ask', currency_format($this->currency1, $ticker['ask'], 4));
     } else {
         throw new GraphException(t("No recent rates found for :exchange :pair", $this->getTitleArgs()));
     }
     return array('key' => $key_column, 'columns' => $columns, 'data' => $data, 'last_updated' => $last_updated, 'no_header' => true);
 }
开发者ID:phpsource,项目名称:openclerk,代码行数:18,代码来源:ExchangePair.php


示例8: getData

 /**
  * We need to transpose the returned data, both data and columns.
  */
 public function getData($days)
 {
     $original = parent::getData($days);
     $columns = array();
     $columns[] = array('type' => 'string', 'title' => ct("Total :currency"), 'args' => array(':currency' => get_currency_abbr($this->currency)), 'heading' => true);
     $data = array();
     $total = 0;
     foreach ($original['data'] as $key => $row) {
         foreach ($row as $i => $value) {
             $data[] = array($original['columns'][$i]['title'], currency_format($this->currency, $value, 4));
             $total += $value;
         }
     }
     // 'Total BTC' column
     $columns[] = array('type' => 'string', 'title' => currency_format($this->currency, $total, 4));
     // save for later
     $this->total = $total;
     return array('key' => $original['key'], 'columns' => $columns, 'data' => $data, 'last_updated' => $original['last_updated']);
 }
开发者ID:phpsource,项目名称:openclerk,代码行数:22,代码来源:CompositionTable.php


示例9: print_report

function print_report()
{
    $OUTPUT = clean_html(financialStatements::incomestmnt($_POST));
    switch ($_POST["key"]) {
        case ct("Print"):
            require "../tmpl-print.php";
            break;
        case ct("Save"):
            db_conn("core");
            $sql = "INSERT INTO save_income_stmnt (output, gendate, div) VALUES ('" . base64_encode($OUTPUT) . "', current_date, '" . USER_DIV . "')";
            $svincRslt = db_exec($sql) or errDie("Unable to save the balance sheet to Cubit.");
            return "<li class='err'>Income statement has been successfully saved to Cubit.</li>\n\t\t\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=25%>\n\t\t\t\t<tr><th>Quick Links</th></tr>\n\t\t\t\t<tr class=datacell><td align=center><a target=_blank href='../core/acc-new2.php'>Add account (New Window)</a></td></tr>\n\t\t\t\t<tr class=datacell><td align=center><a href='index-reports.php'>Financials</a></td></tr>\n\t\t\t\t<tr class=datacell><td align=center><a href='index-reports-stmnt.php'>Current Year Financial Statements</a></td></tr>\n\t\t\t\t<tr class=datacell><td align=center><a href='../main.php'>Main Menu</td></tr>\n\t\t\t</table>";
            break;
        case ct("Export to Spreadsheet"):
            require_lib("xls");
            StreamXLS("income_statement", $OUTPUT);
            break;
    }
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:19,代码来源:income-stmnt.php


示例10: getData

 public function getData($days)
 {
     $key_column = array('type' => 'string', 'title' => ct("Currency"));
     $columns = array();
     // get data
     // TODO could probably cache this
     $q = db()->prepare("SELECT SUM(balance) AS balance, exchange, MAX(created_at) AS created_at FROM balances WHERE user_id=? AND is_recent=1 AND currency=? GROUP BY exchange");
     $q->execute(array($this->getUser(), $this->currency));
     $balances = $q->fetchAll();
     // need to also get address balances
     $summary_balances = get_all_summary_instances($this->getUser());
     // get additional balances
     $data = array();
     if (isset($summary_balances['blockchain' . $this->currency]) && $summary_balances['blockchain' . $this->currency]['balance'] != 0) {
         $balances[] = array("balance" => $summary_balances['blockchain' . $this->currency]['balance'], "exchange" => "blockchain", "created_at" => $summary_balances['blockchain' . $this->currency]['created_at']);
     }
     if (isset($summary_balances['offsets' . $this->currency]) && $summary_balances['offsets' . $this->currency]['balance'] != 0) {
         $balances[] = array("balance" => $summary_balances['offsets' . $this->currency]['balance'], "exchange" => "offsets", "created_at" => $summary_balances['offsets' . $this->currency]['created_at']);
     }
     // sort by balance
     usort($balances, array($this, 'sort_by_balance_desc'));
     $last_updated = find_latest_created_at($balances);
     // apply demo_scale and calculate total summary
     $data = array();
     $total = 0;
     foreach ($balances as $b) {
         if ($b['balance'] != 0) {
             $columns[] = array('type' => 'number', 'title' => get_exchange_name($b['exchange']));
             $data[] = demo_scale($b['balance']);
             $total += demo_scale($b['balance']);
         }
     }
     // return a more helpful message if there is no data
     if (!$data) {
         throw new NoDataGraphException_AddAccountsAddresses();
     }
     // sort data by balance
     $data = array(get_currency_abbr($this->currency) => $data);
     return array('key' => $key_column, 'columns' => $columns, 'data' => $data, 'last_updated' => $last_updated);
 }
开发者ID:phpsource,项目名称:openclerk,代码行数:40,代码来源:CompositionPie.php


示例11: getData

 public function getData($days)
 {
     $key_column = array('type' => 'string', 'title' => ct("Currency"));
     $columns = array();
     // get all balances
     $balances = get_all_summary_instances($this->getUser());
     $last_updated = find_latest_created_at($balances, "total");
     // and convert them using the most recent rates
     $rates = get_all_recent_rates();
     // create data
     // TODO refactor this into generic any-currency balances
     $data = array();
     if (isset($balances['totalbtc']) && $balances['totalbtc']['balance'] != 0) {
         $columns[] = array('type' => 'number', 'title' => get_currency_abbr('btc'));
         $data[] = graph_number_format(demo_scale($balances['totalbtc']['balance']));
     }
     foreach (get_all_currencies() as $cur) {
         // if the key is a currency, use the same currency colour across all graphs (#293)
         $color = array_search($cur, get_all_currencies());
         if ($cur == 'btc') {
             continue;
         }
         if (!is_fiat_currency($cur) && isset($balances['total' . $cur]) && $balances['total' . $cur]['balance'] != 0 && isset($rates['btc' . $cur])) {
             $columns[] = array('type' => 'number', 'title' => get_currency_abbr($cur), 'color' => $color);
             $data[] = graph_number_format(demo_scale($balances['total' . $cur]['balance'] * $rates['btc' . $cur]['bid']));
         }
         if (is_fiat_currency($cur) && isset($balances['total' . $cur]) && $balances['total' . $cur]['balance'] != 0 && isset($rates[$cur . 'btc']) && $rates[$cur . 'btc']['ask']) {
             $columns[] = array('type' => 'number', 'title' => get_currency_abbr($cur), 'color' => $color);
             $data[] = graph_number_format(demo_scale($balances['total' . $cur]['balance'] / $rates[$cur . 'btc']['ask']));
         }
     }
     // display a helpful message if there's no data
     if (!$data) {
         throw new NoDataGraphException_AddAccountsAddresses();
     }
     // sort data by balance
     arsort($data);
     $data = array(get_currency_abbr('btc') => $data);
     return array('key' => $key_column, 'columns' => $columns, 'data' => $data, 'last_updated' => $last_updated);
 }
开发者ID:phpsource,项目名称:openclerk,代码行数:40,代码来源:EquivalentPieBTC.php


示例12: getData

 public function getData($days)
 {
     $key_column = array('type' => 'string', 'title' => ct("Currency"));
     $columns = array();
     $columns[] = array('type' => 'string', 'title' => ct("Currency"), 'heading' => true);
     $columns[] = array('type' => 'string', 'title' => ct("Total"));
     // a table of each currency
     // get all balances
     $balances = get_all_summary_instances($this->getUser());
     $summaries = get_all_summary_currencies($this->getUser());
     $currencies = get_all_currencies();
     $last_updated = find_latest_created_at($balances, "total");
     // create data
     $data = array();
     foreach ($currencies as $c) {
         if (isset($summaries[$c])) {
             $balance = isset($balances['total' . $c]) ? $balances['total' . $c]['balance'] : 0;
             $data[] = array("<span title=\"" . htmlspecialchars(get_currency_name($c)) . "\">" . get_currency_abbr($c) . "</span>", currency_format($c, demo_scale($balance), 4));
         }
     }
     return array('key' => $key_column, 'columns' => $columns, 'data' => $data, 'last_updated' => $last_updated, 'add_more_currencies' => true, 'no_header' => true);
 }
开发者ID:phpsource,项目名称:openclerk,代码行数:22,代码来源:BalancesTable.php


示例13: getData

 public function getData($days)
 {
     $key_column = array('type' => 'string', 'title' => ct("Currency"));
     $columns = array();
     $columns[] = array('type' => 'string', 'title' => ct("Exchange"), 'heading' => true);
     $columns[] = array('type' => 'string', 'title' => ct("Converted fiat"));
     // a table of each crypto2xxx value
     // get all balances
     $currencies = get_crypto_conversion_summary_types($this->getUser());
     $last_updated = false;
     // create data
     $data = array();
     foreach ($currencies as $key => $c) {
         $q = db()->prepare("SELECT * FROM summary_instances WHERE user_id=? AND summary_type=? AND is_recent=1");
         $q->execute(array($this->getUser(), "crypto2" . $key));
         if ($balance = $q->fetch()) {
             $data[] = array($c['short_title'], currency_format($c['currency'], demo_scale($balance['balance']), 4));
             $last_updated = max($last_updated, strtotime($balance['created_at']));
         }
     }
     return array('key' => $key_column, 'columns' => $columns, 'data' => $data, 'last_updated' => $last_updated, 'add_more_currencies' => true, 'no_header' => true);
 }
开发者ID:phpsource,项目名称:openclerk,代码行数:22,代码来源:CryptoConvertedTable.php


示例14: getData

 public function getData($days)
 {
     $columns = array();
     $key_column = array('type' => 'string', 'title' => ct("Key"));
     $columns[] = array('type' => 'string', 'title' => ct("Exchange"), 'heading' => true);
     $columns[] = array('type' => 'string', 'title' => ct("Price"));
     $columns[] = array('type' => 'string', 'title' => ct("Volume"));
     $q = db()->prepare("SELECT * FROM ticker_recent WHERE currency1=? AND currency2=? ORDER BY volume DESC");
     $q->execute(array($this->currency1, $this->currency2));
     $tickers = $q->fetchAll();
     $q = db()->prepare("SELECT * FROM average_market_count WHERE currency1=? AND currency2=?");
     $q->execute(array($this->currency1, $this->currency2));
     $market_count = $q->fetch();
     $average = false;
     foreach ($tickers as $ticker) {
         if ($ticker['exchange'] == 'average') {
             $average = $ticker;
         }
     }
     if (!$average) {
         throw new RenderGraphException(t("Could not find any average data"));
     }
     $volume_currency = $average['currency2'];
     // generate the table of data
     $data = array();
     foreach ($tickers as $ticker) {
         if ($ticker['exchange'] == "average") {
             continue;
         }
         if ($ticker['volume'] == 0) {
             continue;
         }
         $id = $ticker['exchange'] . "_" . $ticker['currency1'] . $ticker['currency2'] . "_daily";
         $data[$ticker['exchange']] = array("<a href=\"" . htmlspecialchars(url_for('historical', array('id' => $id, 'days' => 180))) . "\">" . get_exchange_name($ticker['exchange']) . "</a>", $this->average_currency_format_html($ticker['last_trade'], $ticker['last_trade']), currency_format($volume_currency, $ticker['volume'], 0) . " (" . ($average['volume'] == 0 ? "-" : number_format($ticker['volume'] * 100 / $average['volume']) . "%") . ")");
     }
     $last_updated = $average['created_at'];
     return array('key' => $key_column, 'columns' => $columns, 'data' => $data, 'last_updated' => $last_updated, 'h1' => get_currency_abbr($average['currency1']) . "/" . get_currency_abbr($average['currency2']) . ": " . currency_format($average['currency1'], $average['last_trade']), 'h2' => "(" . number_format($average['volume']) . " " . get_currency_abbr($volume_currency) . " total volume)");
 }
开发者ID:phpsource,项目名称:openclerk,代码行数:38,代码来源:AverageMarketData.php


示例15: getData

 public function getData($days)
 {
     $columns = array();
     $key_column = array('type' => 'date', 'title' => ct("Date"));
     $columns = $this->getTickerColumns();
     // TODO extra_days_necessary
     $extra_days = 10;
     $sources = $this->getTickerSources($days, $extra_days);
     $args = $this->getTickerArgs();
     $data = array();
     $last_updated = false;
     foreach ($sources as $source) {
         $q = db()->prepare($source['query']);
         $q->execute($args);
         while ($ticker = $q->fetch()) {
             $data_key = date($this->isDaily() ? 'Y-m-d' : 'Y-m-d H:i:s', strtotime($ticker[$source['key']]));
             $data[$data_key] = $this->getTickerData($ticker);
             $last_updated = max($last_updated, strtotime($ticker['created_at']));
         }
     }
     // sort by key, but we only want values
     uksort($data, 'cmp_time_reverse');
     return array('key' => $key_column, 'columns' => $columns, 'data' => $data, 'last_updated' => $last_updated);
 }
开发者ID:phpsource,项目名称:openclerk,代码行数:24,代码来源:AbstractTicker.php


示例16: getData

 public function getData($days)
 {
     $columns = array();
     $key_column = array('type' => 'date', 'title' => ct("Date"));
     // $columns = $this->getTickerColumns();
     // TODO extra_days_necessary
     $extra_days = 10;
     $sources = $this->getCompositionSources($days, $extra_days);
     $args = $this->getCompositionArgs();
     $data = array();
     $last_updated = false;
     $exchanges_found = array();
     $maximum_balances = array();
     // only used to check for non-zero accounts
     $data_temp = array();
     $hide_missing_data = !require_get("debug_show_missing_data", false);
     $latest = array();
     foreach ($sources as $source) {
         $q = db()->prepare($source['query']);
         $q->execute($args);
         while ($ticker = $q->fetch()) {
             $key = date('Y-m-d', strtotime($ticker[$source['key']]));
             if (!isset($data_temp[$key])) {
                 $data_temp[$key] = array();
             }
             if (!isset($data_temp[$key][$ticker['exchange']])) {
                 $data_temp[$key][$ticker['exchange']] = 0;
             }
             $data_temp[$key][$ticker['exchange']] += $ticker[$source['balance_key']];
             $last_updated = max($last_updated, strtotime($ticker['created_at']));
             $exchanges_found[$ticker['exchange']] = $ticker['exchange'];
             if (!isset($maximum_balances[$ticker['exchange']])) {
                 $maximum_balances[$ticker['exchange']] = 0;
             }
             $maximum_balances[$ticker['exchange']] = max($ticker[$source['balance_key']], $maximum_balances[$ticker['exchange']]);
             if (!isset($latest[$ticker['exchange']])) {
                 $latest[$ticker['exchange']] = 0;
             }
             $latest[$ticker['exchange']] = max($latest[$ticker['exchange']], strtotime($ticker[$source['key']]));
         }
     }
     // get rid of any exchange summaries that had zero data
     foreach ($maximum_balances as $key => $balance) {
         if ($balance == 0) {
             foreach ($data_temp as $dt_key => $values) {
                 unset($data_temp[$dt_key][$key]);
             }
             unset($exchanges_found[$key]);
         }
     }
     // sort by date so we can get previous dates if necessary for missing data
     ksort($data_temp);
     $data = array();
     // add headings after we know how many exchanges we've found
     $first_heading = array('title' => t("Date"));
     $headings = array($first_heading);
     $i = 0;
     // sort them so they're always in the same order
     ksort($exchanges_found);
     foreach ($exchanges_found as $key => $ignored) {
         $headings[$key] = array('title' => $this->getHeadingTitle($key, $args));
     }
     // $data[0] = $headings;
     // add '0' for exchanges that we've found at one point, but don't have a data point
     // but reset to '0' for exchanges that are no longer present (i.e. from graph_data_balances archives)
     // this fixes a bug where old securities data is still displayed as present in long historical graphs
     $previous_row = array();
     foreach ($data_temp as $date => $values) {
         $row = array();
         foreach ($exchanges_found as $key => $ignored) {
             if (!$hide_missing_data || strtotime($date) <= $latest[$key]) {
                 if (!isset($values[$key])) {
                     $row[$key] = graph_number_format(isset($previous_row[$key]) ? $previous_row[$key] : 0);
                 } else {
                     $row[$key] = graph_number_format(demo_scale($values[$key]));
                 }
             } else {
                 $row[$key] = graph_number_format(0);
             }
         }
         if (count($row) > 0) {
             // don't add empty rows
             $data[$date] = $row;
             $previous_row = $row;
         }
     }
     // sort each row by the biggest value in the most recent data
     // so e.g. BTC comes first, LTC comes second, regardless of order of summary_instances, balances etc
     $keys = array_keys($data);
     // we can only sort if we actually have data
     if (count($keys) == 0) {
         // bail early
         throw new NoDataGraphException_AddCurrencies();
     }
     $last_row = $data[$keys[count($keys) - 1]];
     arsort($last_row);
     $data_temp = array();
     foreach ($data as $row => $columns) {
         $temp = array();
         foreach ($last_row as $key => $ignored) {
//.........这里部分代码省略.........
开发者ID:phpsource,项目名称:openclerk,代码行数:101,代码来源:AbstractCompositionGraph.php


示例17: print_report

function print_report()
{
    $OUTPUT = clean_html(financialStatements::trialbal($_POST));
    switch ($_POST["key"]) {
        case ct("Print"):
            require "../tmpl-print.php";
            break;
        case ct("Save"):
            db_conn("core");
            $sql = "INSERT INTO save_trial_bal (output, gendate, div) VALUES ('" . base64_encode($OUTPUT) . "', current_date, '" . USER_DIV . "')";
            $svincRslt = db_exec($sql) or errDie("Unable to save the trial balance to Cubit.");
            return "\n\t\t\t\t<li>Trial Balance has been successfully saved to Cubit.</li>\n\t\t\t\t<table " . TMPL_tblDflts . " width='25%'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='datacell'>\n\t\t\t\t\t\t<td align='center'><a target=_blank href='../core/acc-new2.php'>Add account (New Window)</a></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='datacell'>\n\t\t\t\t\t\t<td align='center'><a href='index-reports.php'>Financials</a></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='datacell'>\n\t\t\t\t\t\t<td align='center'><a href='index-reports-stmnt.php'>Current Year Financial Statements</a></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr class='datacell'>\n\t\t\t\t\t\t<td align='center'><a href='../main.php'>Main Menu</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>";
            break;
        case ct("Export to Spreadsheet"):
            require_lib("xls");
            StreamXLS("trial_balance", $OUTPUT);
            break;
    }
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:19,代码来源:trial_bal.php


示例18: ct

<?php

echo ct("Hello");
echo urlencode("World");
echo t("Cat");
echo u("Ignored");
echo ht("Ignored");
echo plural("book", 5);
开发者ID:soundasleep,项目名称:translation-discovery,代码行数:8,代码来源:input.php


示例19: getTitle

 public function getTitle()
 {
     return ct("Equivalent :currency");
 }
开发者ID:phpsource,项目名称:openclerk,代码行数:4,代码来源:BtcEquivalentGraph.php


示例20: api_v1_graphs

function api_v1_graphs($graph)
{
    $start_time = microtime(true);
    $result = array();
    /**
     * Graph rendering goes like this:
     * 0. check graph rendering permissions
     * 1. get raw graph data (from a {@link GraphRenderer} through {@link construct_graph_renderer()})
     * 2. apply deltas as necessary
     * 3. add technicals as necessary
     * 4. strip dates outside of the requested ?days parameter (e.g. from extra_days)
     * 5. construct heading and links
     * 6. construct subheading and revise last_updated
     * 7. return data
     * that is, deltas and technicals are done on the server-side; not the client-side.
     */
    $renderer = construct_graph_renderer($graph['graph_type'], $graph['arg0'], $graph['arg0_resolved']);
    // 0. check graph rendering permissions
    if ($renderer->requiresUser()) {
        if (!isset($graph['user_id']) || !$graph['user_id']) {
            throw new GraphException("No user specified for authenticated graph");
        }
        if (!isset($graph['user_hash']) || !$graph['user_hash']) {
            throw new GraphException("No user hash specified for authenticated graph");
        }
        $user = get_user($graph['user_id']);
        if (!$user) {
            throw new GraphException("No such user found");
        }
        if (!has_expected_user_graph_hash($graph['user_hash'], $user)) {
            throw new GraphException("Mismatched user hash for user " . $graph['user_id'] . " with graph type " . $graph['graph_type']);
        }
        if ($renderer->requiresAdmin()) {
            if (!$user['is_admin']) {
                throw new GraphException("Graph requires administrator privileges");
            }
        }
        $renderer->setUser($user['id']);
    }
    if ($renderer->usesDays()) {
        // 0.5 limit 'days' parameter as necessary
        $get_permitted_days = get_permitted_days();
        $has_valid_days = false;
        foreach ($get_permitted_days as $key => $days) {
            if ($days['days'] == $graph['days']) {
                $has_valid_days = true;
            }
        }
        if (!$has_valid_days) {
            throw new GraphException("Invalid days '" . $graph['days'] . "' for graph that requires days");
        }
    }
    // 1. get raw graph data
    try {
        $data = $renderer->getData($graph['days']);
        $original_count = count($data['data']);
        $result['type'] = $renderer->getChartType();
        // 2. apply deltas as necessary
        $data['data'] = calculate_graph_deltas($graph, $data['data'], false);
        // if there is no data, bail out early
        if (count($data['data']) == 0) {
            $result['type'] = 'nodata';
        } else {
            if ($renderer->canHaveTechnicals()) {
                // 3. add technicals as necessary
                // (only if there is at least one point of data, otherwise calculate_technicals() will throw an error)
                $technicals = calculate_technicals($graph, $data['data'], $data['columns'], false);
                $data['columns'] = $technicals['headings'];
                $data['data'] = $technicals['data'];
            }
        }
        // 4. discard early data
        if ($renderer->usesDays()) {
            $data['data'] = discard_early_data($data['data'], $graph['days']);
            $after_discard_count = count($data['data']);
        }
        $result['columns'] = $data['columns'];
        $result['key'] = $data['key'];
        $result['data'] = $data['data'];
        // clean up columns
        foreach ($result['columns'] as $key => $value) {
            $result['columns'][$key]['technical'] = isset($result['columns'][$key]['technical']) && $result['columns'][$key]['technical'] ? true : false;
            if ($result['columns'][$key]['technical']) {
                if (!isset($result['columns'][$key]['type'])) {
                    $result['columns'][$key]['type'] = 'number';
                }
            }
        }
    } catch (NoDataGraphException_AddAccountsAddresses $e) {
        $result['type'] = 'nodata';
        $result['text'] = ct("Either you have not specified any accounts or addresses, or these addresses and accounts have not yet been updated by :site_name.");
        $result['args'] = array(':site_name' => get_site_config('site_name'));
        $result['data'] = array();
        $data['last_updated'] = false;
        $data['add_accounts_addresses'] = true;
    } catch (NoDataGraphException_AddCurrencies $e) {
        $result['type'] = 'nodata';
        $result['text'] = ct("Either you have not enabled this currency, or your summaries for this currency have not yet been updated by :site_name.");
        $result['args'] = array(':site_name' => get_site_config('site_name'));
        $result['data'] = array();
//.........这里部分代码省略.........
开发者ID:phpsource,项目名称:openclerk,代码行数:101,代码来源:Graph.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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