<?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();
Beispiel #2
0
            $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();