Example #1
0
            break;
        case 'products':
            $result = $result->read('Products', array('ProductID', 'ProductName', 'CategoryID'), $request);
            break;
        case 'orders':
            $result = $result->read('[Order Details]', array('OrderID', 'ProductID', 'Quantity'), $request);
            break;
    }
    echo json_encode($result);
    exit;
}
require_once '../include/header.php';
$transport = new \Kendo\Data\DataSourceTransport();
$read = new \Kendo\Data\DataSourceTransportRead();
$read->url('cascadingdropdownlist.php?type=categories')->contentType('application/json')->type('POST');
$transport->read($read)->parameterMap('function(data) {
              return kendo.stringify(data);
           }');
$schema = new \Kendo\Data\DataSourceSchema();
$schema->data('data')->total('total');
?>
<div class="demo-section">
<h2>View Order Details</h2>
<p>
    <label for="categories">Categories:</label>
<?php 
$categories = new \Kendo\UI\DropDownList('categories');
$categories->dataSource(array('transport' => $transport, 'schema' => $schema, 'serverFiltering' => true))->dataTextField('CategoryName')->dataValueField('CategoryID')->attr('style', 'width: 300px')->optionLabel('Select category ...');
echo $categories->render();
?>
</p>
Example #2
0
    <table id="weather" class="weather">
        <thead>
            <tr>
                <th class="month">MONTH</th>
                <th>MAX TEMP &deg;C</th>
                <th>WIND SPEED KM/H</th>
                <th>RAINFALL MM</th>
            </tr>
        </thead>
        <tbody>
<?php 
$months = array("January", "February", "March", "April", "May", "June");
for ($i = 0; $i < count($months); $i++) {
    $monthNumber = $i + 1;
    $transport = new \Kendo\Data\DataSourceTransport();
    $transport->read(array('url' => "_weather.php?station=SOFIA&year=2012&month={$monthNumber}", 'type' => 'POST', 'dataType' => 'json'));
    $dataSource = new \Kendo\Data\DataSource();
    $dataSource->transport($transport);
    ?>
        <tr>
            <td class="month"><?php 
    echo $months[$i];
    ?>
</td>
            <td>
<?php 
    $tmaxSeries = new \Kendo\Dataviz\UI\SparklineSeriesItem();
    $tmaxSeries->type('column')->field('TMax')->color('#ff0000')->negativeColor('#0099ff');
    $tmax = new \Kendo\Dataviz\UI\Sparkline("sparkline-tmax-{$i}");
    $tmax->dataSource($dataSource)->addSeriesItem($tmaxSeries);
    echo $tmax->render();
Example #3
0
<?php

require_once '../lib/Kendo/Autoload.php';
require_once '../include/chart_data.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    header('Content-Type: application/json');
    $result = chart_antenna_gain();
    echo json_encode($result);
    exit;
}
require_once '../include/header.php';
$gain = new \Kendo\Dataviz\UI\ChartSeriesItem();
$gain->type('polarLine')->xField('azimuth')->yField('gain');
$xAxis = new \Kendo\Dataviz\UI\ChartXAxisItem();
$xAxis->majorUnit(30);
$transport = new \Kendo\Data\DataSourceTransport();
$transport->read(array('url' => 'remote-data-binding.php', 'type' => 'POST', 'dataType' => 'json'));
$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport);
$chart = new \Kendo\Dataviz\UI\Chart('chart');
$chart->title(array('text' => 'Antenna Gain (dB)'))->dataSource($dataSource)->addSeriesItem($gain)->addXAxisItem($xAxis);
echo $chart->render();
require_once '../include/footer.php';
Example #4
0
<?php

require_once '../lib/Kendo/Autoload.php';
require_once '../lib/DataSourceResult.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    header('Content-Type: application/json');
    $result = new DataSourceResult('sqlite:..//sample.db');
    echo json_encode($result->read('Customers', array('ContactName', 'CustomerID', 'CompanyName')));
    exit;
}
require_once '../include/header.php';
$read = new \Kendo\Data\DataSourceTransportRead();
$read->url('template.php')->type('POST');
$transport = new \Kendo\Data\DataSourceTransport();
$transport->read($read);
$schema = new \Kendo\Data\DataSourceSchema();
$schema->data('data')->total('total');
$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport)->schema($schema);
$autoComplete = new \Kendo\UI\AutoComplete('customers');
$autoComplete->minLength(1)->dataTextField('ContactName')->dataSource($dataSource)->height(370)->attr('style', 'width:400px')->headerTemplate(<<<TEMPLATE
<div class="dropdown-header"><span class="k-widget k-header">Photo</span><span class="k-widget k-header">Contact info</span></div>
TEMPLATE
)->template(<<<TEMPLATE
<span class="k-state-default"><img src="../content/web/Customers/#= CustomerID #.jpg" alt="#= CustomerID #" /></span><span class="k-state-default"><h3>#: data.ContactName #</h3><p>#: data.CompanyName #</p></span>
TEMPLATE
);
?>

<div class="demo-section">
<h2>Customers</h2>
Example #5
0
<?php

require_once '../lib/Kendo/Autoload.php';
require_once '../include/chart_data.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    header('Content-Type: application/json');
    $result = chart_stock_prices();
    echo json_encode($result);
    exit;
}
require_once '../include/header.php';
$series = new \Kendo\Dataviz\UI\ChartSeriesItem();
$series->type('line')->field('close')->name('#= group.value # (close)');
$valueAxis = new \Kendo\Dataviz\UI\ChartValueAxisItem();
$valueAxis->labels(array('format' => '${0}', 'skip' => 2, 'step' => 2));
$categoryAxis = new \Kendo\Dataviz\UI\ChartCategoryAxisItem();
$categoryAxis->field('date')->labels(array('format' => 'MMM'));
$tooltip = new \Kendo\Dataviz\UI\ChartTooltip();
$tooltip->visible(true)->format('{0}%')->template('#= series.name # - #= value #%');
$model = new \Kendo\Data\DataSourceSchemaModel();
$model->addField(array('field' => 'date', 'type' => 'date'));
$schema = new \Kendo\Data\DataSourceSchema();
$schema->model($model);
$transport = new \Kendo\Data\DataSourceTransport();
$transport->read(array('url' => 'grouped-data.php', 'type' => 'POST', 'dataType' => 'json'));
$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport)->schema($schema)->addGroupItem(array('field' => 'symbol'))->addSortItem(array('field' => 'date', 'dir' => 'asc'));
$chart = new \Kendo\Dataviz\UI\Chart('chart');
$chart->title(array('text' => 'Stock Prices'))->dataSource($dataSource)->legend(array('position' => 'bottom'))->addSeriesItem($series)->addValueAxisItem($valueAxis)->addCategoryAxisItem($categoryAxis)->seriesDefaults(array('type' => 'area'))->tooltip($tooltip);
echo $chart->render();
require_once '../include/footer.php';
Example #6
0
?>

<script type="text/x-kendo-tmpl" id="template">
    <div class="product">
        <img src="../content/web/foods/#:ProductID#.jpg" alt="#:ProductName# image" />
        <h3>#:ProductName#</h3>
        <p>#:kendo.toString(UnitPrice, "c")#</p>
    </div>
</script>

<div class="demo-section">
<?php 
$transport = new \Kendo\Data\DataSourceTransport();
$read = new \Kendo\Data\DataSourceTransportRead();
$read->url('integration-listview.php')->contentType('application/json')->type('POST');
$transport->read($read)->parameterMap('function(data) { return kendo.stringify(data); }');
$model = new \Kendo\Data\DataSourceSchemaModel();
$productNameField = new \Kendo\Data\DataSourceSchemaModelField('ProductName');
$productNameField->type('string');
$unitPriceField = new \Kendo\Data\DataSourceSchemaModelField('UnitPrice');
$unitPriceField->type('number');
$unitsInStockField = new \Kendo\Data\DataSourceSchemaModelField('UnitsInStock');
$unitsInStockField->type('number');
$model->addField($productNameField)->addField($unitPriceField)->addField($unitsInStockField);
$schema = new \Kendo\Data\DataSourceSchema();
$schema->data('data')->model($model)->total('total');
$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport)->schema($schema)->pageSize(15);
$listview = new \Kendo\UI\ListView('listView');
$listview->dataSource($dataSource)->templateId('template')->pageable(true);
echo $listview->render();
Example #7
0
<?php

require_once '../lib/Kendo/Autoload.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    header('Content-Type: application/json');
    $result = json_decode(file_get_contents('../content/dataviz/js/boeing-stock.json'));
    echo json_encode($result);
    exit;
}
require_once '../include/header.php';
$stock = new \Kendo\Dataviz\UI\StockChartSeriesItem();
$stock->type('candlestick')->openField('Open')->highField('High')->lowField('Low')->closeField('Close');
$volume = new \Kendo\Dataviz\UI\StockChartSeriesItem();
$volume->type('column')->field('Volume')->axis('volumeAxis')->tooltip(array('format' => '{0:C0}'));
$navigator = new \Kendo\Dataviz\UI\StockChartNavigator();
$navigator->addSeriesItem(array('type' => 'area', 'field' => 'Close'))->select(array('from' => '2009/02/05', 'to' => '2011/10/07'));
$transport = new \Kendo\Data\DataSourceTransport();
$transport->read(array('url' => 'panes.php', 'type' => 'POST', 'dataType' => 'json'));
$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport);
$chart = new \Kendo\Dataviz\UI\StockChart('stock-chart');
$chart->dataSource($dataSource)->title(array('text' => 'The Boeing Company (NYSE:BA)'))->dateField('Date')->addPane(array('title' => 'Value'), array('name' => 'volumePane', 'title' => 'Volume', 'height' => 150))->addCategoryAxisItem(array('pane' => 'volumePane'))->addValueAxisItem(array('line' => array('visible' => false)), array('name' => 'volumeAxis', 'pane' => 'volumePane', 'visible' => false))->addSeriesItem($stock, $volume)->navigator($navigator);
echo $chart->render();
?>
<style scoped>
.k-chart {
    height: 500px;
}
</style>
<?php 
require_once '../include/footer.php';
Example #8
0
<?php

require_once '../lib/Kendo/Autoload.php';
require_once '../include/map_data.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    header('Content-Type: application/json');
    $result = store_locations();
    echo json_encode($result);
    exit;
}
require_once '../include/header.php';
$tile_layer = new \Kendo\Dataviz\UI\MapLayer();
$tile_layer->type("tile")->urlTemplate("http://#= subdomain #.tile2.opencyclemap.org/transport/#= zoom #/#= x #/#= y #.png")->subdomains(array('a', 'b', 'c'))->attribution("&copy; <a href='http://osm.org/copyright'>OpenStreetMap contributors</a>." + "Tiles courtesy of <a href='http://www.opencyclemap.org/'>Andy Allan</a>");
$transport = new \Kendo\Data\DataSourceTransport();
$transport->read(array('url' => 'remote-markers.php', 'type' => 'POST', 'dataType' => 'json'));
$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport);
$marker_layer = new \Kendo\Dataviz\UI\MapLayer();
$marker_layer->type('marker')->dataSource($dataSource)->locationField('latLng')->titleField('name');
$map = new \Kendo\Dataviz\UI\Map('map');
$map->center(array(30.2681, -97.7448))->zoom(15)->addLayer($tile_layer)->addLayer($marker_layer);
echo $map->render();
require_once '../include/footer.php';
Example #9
0
<?php

require_once '../lib/Kendo/Autoload.php';
require_once '../include/header.php';
$series = new \Kendo\Dataviz\UI\StockChartSeriesItem();
$series->type('candlestick')->openField('Open')->highField('High')->lowField('Low')->closeField('Close');
$transport = new \Kendo\Data\DataSourceTransport();
$transport->read(array('url' => '_intraday.php', 'type' => 'POST', 'dataType' => 'json'))->parameterMap('function(data) {
              return kendo.stringify(data);
          }');
$model = new \Kendo\Data\DataSourceSchemaModel();
$model->addField(array('field' => 'Date', 'type' => 'date'));
$schema = new \Kendo\Data\DataSourceSchema();
$schema->model($model);
$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport)->schema($schema)->serverFiltering(true);
$navigator = new \Kendo\Dataviz\UI\StockChartNavigator();
$navigator->addSeriesItem(array('type' => 'area', 'field' => 'Close'))->dataSource($dataSource)->select(array('from' => '2009/02/05', 'to' => '2011/10/07'));
$chart = new \Kendo\Dataviz\UI\StockChart('stock-chart');
$chart->dataSource($dataSource)->title(array('text' => 'The ACME Company'))->dateField('Date')->addSeriesItem($series)->navigator($navigator);
echo $chart->render();
require_once '../include/footer.php';