$this->setDashboardTitle('KPI');
        $this->addComponent($kpi);
    }
}
class SampleDashboard extends TabbedDashboard
{
    public function buildDashboard()
    {
        $drill = new Drill();
        $column = new Column();
        $this->addDashboardTab($drill);
        $this->addDashboardTab($column);
    }
}
global $razorflow_assets;
$db = new SampleDashboard();
?>
<!doctype html>
<html>
  <head>
        <?php 
// Replace this block with your own CSS/JS Includes
echo $razorflow_assets;
?>
    </head>
  <body>
  <h1>Here's an embedded tabbed dashboard</h1>
  <?php 
$db->renderEmbedded();
?>
  </body>
Пример #2
0
<?php

class SampleDashboard extends StandaloneDashboard
{
    public function buildDashboard()
    {
        $table = new TableComponent('table1');
        $table->setCaption("Table 1");
        $table->setDimensions(6, 6);
        $table->setRowsPerPage(8);
        $table->addColumn('colA', "Column A");
        $table->addColumn('colB', "Column B");
        for ($i = 0; $i < 10; $i++) {
            // Single Row
            $table->addRow(array('colA' => $i * 2, 'colB' => $i * 2 + 1));
        }
        $table->cellConditionalFormat("colA", "value>300", array("cellBackgroundColor" => "#000", "cellTextColor" => "#fff"));
        $this->addComponent($table);
    }
}
$db = new SampleDashboard();
$db->renderStandalone();
Пример #3
0
        if ($pos) {
            $yearData = $this->pdo->query('Select c.Id as id, SUM(UnitsInStock)as Quantity, CategoryName from Product as p, Category as c where c.Id = p.CategoryId group by CategoryName order by Quantity DESC LIMIT 3;');
        } else {
            $yearData = $this->pdo->query('Select c.Id as id, SUM(UnitsInStock)as Quantity, CategoryName from Product as p, Category as c where c.Id = p.CategoryId group by CategoryName order by Quantity LIMIT 3;');
        }
        return $yearData->fetchAll(PDO::FETCH_ASSOC);
    }
    public function get_stock()
    {
        $yearData = $this->pdo->query('Select Product.Id, ProductName, CategoryName, UnitPrice, UnitsInStock from Product, Category where Product.Categoryid = Category.Id and Product.UnitsInStock > 0;');
        return $yearData->fetchAll(PDO::FETCH_ASSOC);
    }
    public function get_category()
    {
        $yearData = $this->pdo->query('Select CategoryName from Category group by CategoryName;');
        return $yearData->fetchAll(PDO::FETCH_ASSOC);
    }
}
class SampleDashboard extends TabbedDashboard
{
    public function buildDashboard()
    {
        $sales = new SalesDashboard();
        $stock = new StockDashboard();
        $this->addDashboardTab($sales);
        $this->addDashboardTab($stock);
    }
}
$tabbed = new SampleDashboard();
$tabbed->setStaticRoot("razorflow_php/static/rf/");
$tabbed->renderStandalone();
Пример #4
0
<?php

require 'sample_dashboards.php';
class SampleDashboard extends TabbedDashboard
{
    public function buildDashboard()
    {
        $a = new A();
        $b = new B();
        $c = new C();
        $b->setActive();
        $this->addDashboardTab($a);
        $this->addDashboardTab($b);
        $this->addDashboardTab($c);
    }
}
$tabbed = new SampleDashboard();
$tabbed->renderStandalone();
Пример #5
0
        $kpi2->setCaption("Sales in last 24h");
        $kpi2->setDimensions(3, 2);
        $kpi2->setValue(rand(10, 50), array('numberPrefix' => '$'));
        $this->addComponent($kpi2);
        $kpi3 = new KPIComponent("kpi3");
        $kpi3->setCaption("Number of checkouts this week");
        $kpi3->setDimensions(3, 2);
        $kpi3->setValue(rand(600, 1000));
        $this->addComponent($kpi3);
        $kpi4 = new KPIComponent("kpi4");
        $kpi4->setCaption("Total sales this week");
        $kpi4->setDimensions(3, 2);
        $kpi4->setValue(rand(100, 300), array('numberPrefix' => '$'));
        $this->addComponent($kpi4);
        $chart3 = new ChartComponent("chart3");
        $chart3->setCaption("Gender distribution of shoppers");
        $chart3->setDimensions(6, 6);
        $chart3->setLabels(['Female', 'Male']);
        $chart3->addSeries('gender', 'Gender', array(rand(0, 100), rand(0, 100)), array('seriesDisplayType' => 'pie'));
        $this->addComponent($chart3);
        $chart4 = new ChartComponent("chart4");
        $chart4->setCaption("Age group of shoppers");
        $chart4->setDimensions(6, 6);
        $chart4->setLabels(['Under 15', '15-30', '30-45', '45-60', '60+']);
        $chart4->addSeries('age', 'Age', array(rand(1, 10), rand(20, 30), rand(30, 40), rand(20, 30), rand(1, 10)), array('seriesDisplayType' => 'column'));
        $this->addComponent($chart4);
    }
}
$db = new SampleDashboard();
$db->setDashboardRefreshDelay(5000);
$db->renderStandalone();
Пример #6
0
 public function dashboardAction()
 {
     $db = new SampleDashboard();
     return new CakeResponse(array('body' => $db->getJSONForAction()));
     // return new CakeResponse (array('body' => $db->getJSONForAction ()));
 }
Пример #7
0
 public function dashboardAction()
 {
     $db = new SampleDashboard();
     echo $db->getJSONForAction();
 }