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


PHP Reports::size方法代码示例

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


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

示例1: viewReports

function viewReports($userID, $domainID)
{
    $viewReports = "";
    $chart = '';
    $statistics = "";
    $chartSeriesData = '';
    $chartGraphData = '';
    $chartData = '';
    $showChart = false;
    $gid = 0;
    $valueRotation = 0;
    $graphSettings = '';
    $labelFreq = '1';
    $gridCount = '4';
    $settingsString = '';
    $aryColors = array(1 => '#1B6097', 2 => '#7C1787', 3 => '#874417', 4 => '#228717', 5 => '#207DBC', 6 => '#BC5E20', 7 => '#17877C', 8 => '#871722', 9 => '#172287', 10 => '#87175A', 11 => '#877C17', 12 => '#178744', 13 => '#441787', 14 => '#5A8717', 15 => '#3B9DDE', 16 => '#DE7C3B');
    $aryColorPairs = array(1 => '#1B6097', 2 => '#2994DB', 3 => '#7C1787', 4 => '#C929DB', 5 => '#874417', 6 => '#DB7029', 7 => '#228717', 8 => '#3BDB29', 9 => '#207DBC', 10 => '#5EAEE4', 11 => '#BC5E20', 12 => '#E4935E', 13 => '#17877C', 14 => '#29DBC9', 15 => '#871722', 16 => '#DB293B', 17 => '#172287', 18 => '#293BDB', 19 => '#87175A', 20 => '#DB2994', 21 => '#877C17', 22 => '#DBC929', 23 => '#178744', 24 => '#29DB70', 25 => '#441787', 26 => '#7029DB', 27 => '#5A8717', 28 => '#94DB29', 29 => '#3B9DDE', 30 => '#92C8ED', 31 => '#DE7C3B', 32 => '#EDB692');
    $aryUnits = array('KWh' => 'KW', 'kVarh' => 'kVar');
    $reports = new Reports();
    $userObject = clone $_SESSION['UserObject'];
    if (!isset($_POST['repPoints'])) {
        $viewReports = '<div class="error" style="width: 700px;">You must select one or more points to display a report.</div>' . "\n";
    } elseif (!(isset($_POST['repBaseDateFrom']) || isset($_POST['repBaseDateTo']))) {
        $viewReports = '<div class="error" style="width: 700px;">You must select a from date and a to date to display a report.</div>' . "\n";
    } elseif (!isset($_POST['repBaseDateFrom'])) {
        $viewReports = '<div class="error" style="width: 700px;">You must select a from date to display a report.</div>' . "\n";
    } elseif (!isset($_POST['repBaseDateTo'])) {
        $viewReports = '<div class="error" style="width: 700px;">You must select a to date to display a report.</div>' . "\n";
    } elseif (!isset($_POST['report'])) {
        $viewReports = '<div class="error" style="width: 700px;">You must select a Report Type to display.</div>' . "\n";
    } elseif ($_POST['report'] == 'aveHourlyProfile') {
        $viewReports = BuildReportHeader("Average Hourly Profile", $_POST['repBaseDateFrom'], $_POST['repBaseDateTo']);
        foreach ($_POST['repPoints'] as $pointChannel => $state) {
            $ids = explode(":", $pointChannel);
            $chartSeriesData = '';
            $chartData = '';
            $chartGraphData = '';
            if ($reports->GetAverageHourlyProfile($ids[0], $ids[1], $_POST['repBaseDateFrom'], $_POST['repBaseDateTo'])) {
                $gid++;
                $graphName = $userObject->pointChannels()->pointChannel($ids[0], $ids[1])->channelDescription();
                $valueUnits = $userObject->pointChannels()->pointChannel($ids[0], $ids[1])->units()->unitOfMeasureName();
                $graphSettings .= compileGraphSettings($gid, $aryColors[$gid], $graphName);
                $chartGraphData .= '<graph gid=\\"' . $gid . '\\">';
                for ($inx = 0; $inx < $reports->size(); $inx++) {
                    $chartGraphData .= '<value xid=\\"' . $inx . '\\">' . $reports->values($inx) . '</value>';
                }
                $chartGraphData .= '</graph>';
                for ($inx = 0; $inx < $reports->size(); $inx++) {
                    $chartSeriesData .= '<value xid=\\"' . $inx . '\\">' . $reports->labels($inx) . '</value>';
                }
                $chartData = '<chart><series>' . $chartSeriesData . '</series><graphs>' . $chartGraphData . '</graphs></chart>';
                $chart .= assembleCharts($ids[0] . '_' . $ids[1], 'bar', $chartData, $valueRotation, $aryUnits[$valueUnits], $reports->labelUnits(), $labelFreq, $gridCount, $graphSettings);
                $chart .= '<div align="center">' . '<table border="1" cellspacing="0" cellpadding="3">' . '<tr><td align="right">Average Hourly Demand:</td><td align="right">' . $reports->statistic("AverageHourlyDemand") . '</td></tr>' . '<tr><td align="right">Maximum Hourly Demand:</td><td align="right">' . $reports->statistic("MaximumHourlyDemand") . '</td></tr>' . '<tr><td align="right">Total Usage:</td><td align="right">' . $reports->statistic("TotalUsage") . '</td></tr>' . '</table>' . '</div>';
            } else {
                $viewReports .= '<div class="error" style="width: 700px;">Could not retreive Average Hourly Profile Report for ' . $userObject->pointChannels()->pointChannel($ids[0], $ids[1])->channelDescription() . ' for the selected dates.</div>' . "\n";
            }
        }
    } elseif ($_POST['report'] == 'aveHourVsPeakHour') {
        $viewReports = BuildReportHeader("Average Hour Vs. Peak Hour", $_POST['repBaseDateFrom'], $_POST['repBaseDateTo']);
        //$viewReports = '<table>';
        foreach ($_POST['repPoints'] as $pointChannel => $state) {
            $ids = explode(":", $pointChannel);
            $chartSeriesData = '';
            $chartData = '';
            $chartGraphData01 = '';
            $chartGraphData02 = '';
            if ($reports->GetAverageHourlyProfile($ids[0], $ids[1], $_POST['repBaseDateFrom'], $_POST['repBaseDateTo'])) {
                for ($inx = 0; $inx < $reports->size(); $inx++) {
                    $averageHour[$inx] = $reports->values($inx);
                }
                if ($reports->GetPeakHourlyProfile($ids[0], $ids[1], $_POST['repBaseDateFrom'], $_POST['repBaseDateTo'])) {
                    $graphName = $userObject->pointChannels()->pointChannel($ids[0], $ids[1])->channelDescription();
                    $valueUnits = $userObject->pointChannels()->pointChannel($ids[0], $ids[1])->units()->unitOfMeasureName();
                    $gid++;
                    $chartGraphData01 .= '<graph gid=\\"' . $gid . '\\">';
                    $graphSettings .= compileLineGraphSettings($gid, $aryColorPairs[$gid], $graphName . ': Average ' . $aryUnits[$valueUnits]);
                    $gid++;
                    $chartGraphData02 .= '<graph gid=\\"' . $gid . '\\">';
                    $graphSettings .= compileLineGraphSettings($gid, $aryColorPairs[$gid], $graphName . ': Peak ' . $aryUnits[$valueUnits]);
                    //$viewReports .= '<tr><td>' . $reports->labelUnits() . '</td><td> Average ' . $reports->valueUnits() . '</td><td> Peak ' . $reports->valueUnits() . '</td></tr>' . "\n";
                    for ($inx = 0; $inx < $reports->size(); $inx++) {
                        //$viewReports .= '<tr><td>' . $reports->labels($inx) . '</td><td>' . $averageHour[$inx] . '</td><td>' . $reports->values($inx) . '</td></tr>' . "\n";
                        $chartGraphData01 .= '<value xid=\\"' . $inx . '\\">' . $averageHour[$inx] . '</value>';
                        $chartGraphData02 .= '<value xid=\\"' . $inx . '\\">' . $reports->values($inx) . '</value>';
                    }
                    $chartGraphData01 .= '</graph>';
                    $chartGraphData02 .= '</graph>';
                    for ($inx = 0; $inx < $reports->size(); $inx++) {
                        $chartSeriesData .= '<value xid=\\"' . $inx . '\\">' . $reports->labels($inx) . '</value>';
                    }
                    $valueRotation = 0;
                    $chartData = '<chart><series>' . $chartSeriesData . '</series><graphs>' . $chartGraphData01 . $chartGraphData02 . '</graphs></chart>';
                    $chart .= assembleCharts($ids[0] . '_' . $ids[1], 'line', $chartData, $valueRotation, $aryUnits[$valueUnits], $reports->labelUnits(), 1, 24, $graphSettings);
                    $chart .= '<div align="center">' . '<table border="1" cellspacing="0" cellpadding="3">' . '<tr><td>Maximum Demand:</td><td>' . $reports->statistic("IntervalValue") . '</td><td> on ' . $reports->statistic("IntervalDate") . '</td></tr>' . '</table>' . '</div>';
                } else {
                    $viewReports .= '<div class="error" style="width: 700px;">Could not retreive Average Hour Vs. Peak Hour Report for ' . $userObject->pointChannels()->pointChannel($ids[0], $ids[1])->channelDescription() . ' for the selected dates.</div>' . "\n";
                }
            } else {
                $viewReports .= '<div class="error" style="width: 700px;">Could not retreive Average Hour Vs. Peak Hour Report for ' . $userObject->pointChannels()->pointChannel($ids[0], $ids[1])->channelDescription() . ' for the selected dates.</div>' . "\n";
            }
//.........这里部分代码省略.........
开发者ID:kelen303,项目名称:iEMS,代码行数:101,代码来源:displayReports.inc.php


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