Example #1
0
<div class="demo-section">
<?php 
$transport = new \Kendo\Data\DataSourceTransport();
$read = new \Kendo\Data\DataSourceTransportRead();
$read->url('selection.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(12);
$listview = new \Kendo\UI\ListView('listView');
$listview->dataSource($dataSource)->templateId('template')->selectable('multiple')->pageable(true)->dataBound("onDataBound")->change("onChange");
echo $listview->render();
?>
</div>

<div class="demo-section">
	<h2>Console Log</h2>
	<div class="console"></div>
</div>

Example #2
0
$endTimezoneField = new \Kendo\Data\DataSourceSchemaModelField('endTimezone');
$endTimezoneField->from('EndTimezone');
$isAllDayField = new \Kendo\Data\DataSourceSchemaModelField('isAllDay');
$isAllDayField->type('boolean')->from('IsAllDay');
$descriptionField = new \Kendo\Data\DataSourceSchemaModelField('description');
$descriptionField->type('string')->from('Description');
$recurrenceIdField = new \Kendo\Data\DataSourceSchemaModelField('recurrenceId');
$recurrenceIdField->from('RecurrenceID');
$recurrenceRuleField = new \Kendo\Data\DataSourceSchemaModelField('recurrenceRule');
$recurrenceRuleField->from('RecurrenceRule');
$recurrenceExceptionField = new \Kendo\Data\DataSourceSchemaModelField('recurrenceException');
$recurrenceExceptionField->from('RecurrenceException');
$ownerIdField = new \Kendo\Data\DataSourceSchemaModelField('ownerId');
$ownerIdField->from('OwnerID')->defaultValue(1);
$model->id('taskID')->addField($taskIDField)->addField($titleField)->addField($startField)->addField($endField)->addField($startTimezoneField)->addField($endTimezoneField)->addField($descriptionField)->addField($recurrenceIdField)->addField($recurrenceRuleField)->addField($recurrenceExceptionField)->addField($ownerIdField)->addField($isAllDayField);
$schema = new \Kendo\Data\DataSourceSchema();
$schema->data('data')->errors('errors')->model($model);
$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport)->schema($schema)->batch(true);
$scheduler = new \Kendo\UI\Scheduler('scheduler');
$scheduler->timezone("Etc/UTC")->date(new DateTime('2013/6/13'))->startTime(new DateTime('2013/6/13 6:00'))->height(600)->addView('day', array('type' => 'week', 'selected' => true))->dataSource($dataSource);
?>
<div class="configuration-horizontal">
    <div class="config-section">
        <label><input type="checkbox" checked />Snap events to slot boundaries</label>
    </div>
</div>

<?php 
echo $scheduler->render();
?>
Example #3
0
require_once '../lib/Kendo/Autoload.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    header('Content-Type: application/json');
    $request = json_decode(file_get_contents('php://input'));
    $result = new DataSourceResult('sqlite:..//sample.db');
    echo json_encode($result->read('Products', array('ProductID', 'ProductName'), $request));
    exit;
}
require_once '../include/header.php';
$transport = new \Kendo\Data\DataSourceTransport();
$read = new \Kendo\Data\DataSourceTransportRead();
$read->url('remotedatasource.php')->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');
$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport)->schema($schema);
$dropDownList = new \Kendo\UI\DropDownList('products');
$dropDownList->dataSource($dataSource)->dataTextField('ProductName')->dataValueField('ProductID')->attr('style', 'width: 250px');
?>
<div class="demo-section">
    <h2>Products</h2>
<?php 
echo $dropDownList->render();
?>
</div>
<style scoped>
    .demo-section {
        width: 250px;
Example #4
0
require_once '../include/header.php';
$transport = new \Kendo\Data\DataSourceTransport();
$read = new \Kendo\Data\DataSourceTransportRead();
$read->url('events.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)->pageSize(5)->schema($schema)->serverSorting(true)->serverPaging(true);
$grid = new \Kendo\UI\Grid('grid');
$productName = new \Kendo\UI\GridColumn();
$productName->field('ProductName')->title('Product Name');
$unitPrice = new \Kendo\UI\GridColumn();
$unitPrice->field('UnitPrice')->format('{0:c}')->width(150)->title('Unit Price');
$unitsInStock = new \Kendo\UI\GridColumn();
$unitsInStock->field('UnitsInStock')->width(150)->title('Units In Stock');
$grid->addColumn($productName, $unitPrice, $unitsInStock)->selectable('cell multiple')->pageable(true)->sortable(true)->dataSource($dataSource)->change('onChange')->dataBound('onDataBound')->dataBinding('onDataBinding');
echo $grid->render();
?>

<script>
function create_makerfaire_scheduler($faire_id)
{
    $transport = new \Kendo\Data\DataSourceTransport();
    $create = new \Kendo\Data\DataSourceTransportCreate();
    $create->url('makerfaire-scheduling-tasks.php?type=create')->contentType('application/json')->type('POST')->dataType('json');
    $read = new \Kendo\Data\DataSourceTransportRead();
    $read->url('makerfaire-scheduling-tasks.php?type=read')->contentType('application/json')->type('GET')->dataType('json');
    $update = new \Kendo\Data\DataSourceTransportUpdate();
    $update->url('makerfaire-scheduling-tasks.php?type=update')->contentType('application/json')->type('POST')->dataType('json');
    $destroy = new \Kendo\Data\DataSourceTransportDestroy();
    $destroy->url('makerfaire-scheduling-tasks.php?type=destroy')->contentType('application/json')->type('POST')->dataType('json');
    $transport->create($create)->read($read)->update($update)->destroy($destroy)->parameterMap('function(data) {
              return kendo.stringify(data);
          }');
    $model = new \Kendo\Data\DataSourceSchemaModel();
    $locationIdField = new \Kendo\Data\DataSourceSchemaModelField('locationID');
    $locationIdField->type('number')->from('locationID')->nullable(true);
    $titleField = new \Kendo\Data\DataSourceSchemaModelField('title');
    $titleField->from('Title')->defaultValue('No title')->validation(array('required' => false));
    $startField = new \Kendo\Data\DataSourceSchemaModelField('start');
    $startField->type('date')->from('Start');
    $endField = new \Kendo\Data\DataSourceSchemaModelField('end');
    $endField->type('date')->from('End');
    $isAllDayField = new \Kendo\Data\DataSourceSchemaModelField('isAllDay');
    $isAllDayField->type('boolean')->from('IsAllDay');
    $subareaIdField = new \Kendo\Data\DataSourceSchemaModelField('subareaId');
    $subareaIdField->from('SubareaID')->nullable(true);
    $entriesField = new \Kendo\Data\DataSourceSchemaModelField('entries');
    $entriesField->from('Entries')->nullable(true);
    $model->id('locationID')->addField($locationIdField)->addField($titleField)->addField($startField)->addField($endField)->addField($isAllDayField)->addField($subareaIdField)->addField($entriesField);
    $schema = new \Kendo\Data\DataSourceSchema();
    $schema->model($model);
    $dataSource = new \Kendo\Data\DataSource();
    $dataSource->transport($transport)->schema($schema)->batch(false);
    $subareasResource = new \Kendo\UI\SchedulerResource();
    $locations_array = get_entry_locations($faire_id);
    $subareasResource->field('subareaId')->title('Stage')->name('Stages')->dataSource($locations_array);
    $entries = get_entries($faire_id);
    $entriesResource = new \Kendo\UI\SchedulerResource();
    $entriesResource->field('entries')->title('Presenter')->multiple(true)->name('Presenters')->dataSource($entries);
    $pdf = new \Kendo\UI\SchedulerPdf();
    $pdf->fileName('Kendo UI Scheduler Export.pdf')->proxyURL('makerfaire-scheduling.php?type=save');
    $scheduler = new \Kendo\UI\Scheduler('scheduler');
    $scheduler->eventTemplateId('presentation-template')->timezone('UTC')->currentTimeMarker(false)->date(new DateTime('2015/9/26 00:00', new DateTimeZone('UTC')))->height(900)->pdf($pdf)->addToolbarItem(new \Kendo\UI\SchedulerToolbarItem('pdf'))->addResource($subareasResource, $entriesResource)->group(array('resources' => array('Stages')))->addView(array('type' => 'day', 'majorTick' => 30, 'showWorkHours' => true, 'workWeekEnd' => 7, 'workDayStart' => new DateTime('2015/1/1 15:00', new DateTimeZone('UTC')), 'workDayEnd' => new DateTime('2015/1/1 24:00', new DateTimeZone('UTC'))), array('type' => 'workWeek', 'majorTick' => 30, 'selected' => true, 'workWeekStart' => 5, 'workWeekEnd' => 7, 'showWorkHours' => true, 'workDayStart' => new DateTime('2015/1/1 15:00', new DateTimeZone('UTC')), 'workDayEnd' => new DateTime('2015/1/1 24:00', new DateTimeZone('UTC'))), 'agenda')->dataSource($dataSource);
    return $scheduler;
}
Example #6
0
$endTimezoneField = new \Kendo\Data\DataSourceSchemaModelField('endTimezone');
$endTimezoneField->from('EndTimezone');
$isAllDayField = new \Kendo\Data\DataSourceSchemaModelField('isAllDay');
$isAllDayField->type('boolean')->from('IsAllDay');
$descriptionField = new \Kendo\Data\DataSourceSchemaModelField('description');
$descriptionField->type('string')->from('Description');
$recurrenceIdField = new \Kendo\Data\DataSourceSchemaModelField('recurrenceId');
$recurrenceIdField->from('RecurrenceID');
$recurrenceRuleField = new \Kendo\Data\DataSourceSchemaModelField('recurrenceRule');
$recurrenceRuleField->from('RecurrenceRule');
$recurrenceExceptionField = new \Kendo\Data\DataSourceSchemaModelField('recurrenceException');
$recurrenceExceptionField->from('RecurrenceException');
$ownerIdField = new \Kendo\Data\DataSourceSchemaModelField('ownerId');
$ownerIdField->from('OwnerID')->defaultValue(1);
$model->id('taskID')->addField($taskIDField)->addField($titleField)->addField($startField)->addField($endField)->addField($startTimezoneField)->addField($endTimezoneField)->addField($descriptionField)->addField($recurrenceIdField)->addField($recurrenceRuleField)->addField($recurrenceExceptionField)->addField($ownerIdField)->addField($isAllDayField);
$schema = new \Kendo\Data\DataSourceSchema();
$schema->data('data')->errors('errors')->model($model);
$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport)->schema($schema)->batch(true)->addFilterItem(array('logic' => 'or', 'filters' => array(array('field' => 'ownerId', 'operator' => 'eq', 'value' => 1), array('field' => 'ownerId', 'operator' => 'eq', 'value' => 2))));
$resource = new \Kendo\UI\SchedulerResource();
$resource->field('ownerId')->title('Owner')->dataSource(array(array('text' => 'Alex', 'value' => 1, 'color' => '#f8a398'), array('text' => 'Bob', 'value' => 2, 'color' => '#51a0ed'), array('text' => 'Charlie', 'value' => 3, 'color' => '#56ca85')));
$scheduler = new \Kendo\UI\Scheduler('scheduler');
$scheduler->timezone("Etc/UTC")->date(new DateTime('2013/6/13'))->height(600)->addResource($resource)->addView(array('type' => 'day', 'startTime' => new DateTime('2013/6/13 7:00')), array('type' => 'workWeek', 'selected' => true, 'startTime' => new DateTime('2013/6/13 7:00')), array('type' => 'week', 'startTime' => new DateTime('2013/6/13 7:00')), 'month', 'agenda')->dataSource($dataSource);
?>
<div id="people">
    <input checked type="checkbox" id="alex" value="1">
    <input checked type="checkbox" id="bob" value="2">
    <input type="checkbox" id="charlie" value="3">
</div>

<?php 
Example #7
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 #8
0
require_once '../lib/Kendo/Autoload.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    header('Content-Type: application/json');
    $request = json_decode(file_get_contents('php://input'));
    $result = new DataSourceResult('sqlite:..//sample.db');
    echo json_encode($result->read('Employees', array('FirstName', 'LastName', 'City', 'Address', 'HomePhone'), $request));
    exit;
}
require_once '../include/header.php';
$transport = new \Kendo\Data\DataSourceTransport();
$read = new \Kendo\Data\DataSourceTransportRead();
$read->url('navigation.php')->contentType('application/json')->type('POST');
$transport->read($read)->parameterMap('function(data) {
              return kendo.stringify(data);
          }');
$schema = new \Kendo\Data\DataSourceSchema();
$schema->data('data')->groups('groups')->total('total');
$dataSource = new \Kendo\Data\DataSource();
$group = new \Kendo\Data\DataSourceGroupItem();
$group->field('City');
$dataSource->transport($transport)->pageSize(5)->addGroupItem($group)->schema($schema)->serverSorting(true)->serverFiltering(true)->serverGrouping(true)->serverPaging(true);
$grid = new \Kendo\UI\Grid('grid');
$firstName = new \Kendo\UI\GridColumn();
$firstName->field("FirstName")->title('First Name');
$lastName = new \Kendo\UI\GridColumn();
$lastName->field("LastName")->title('Last Name');
$city = new \Kendo\UI\GridColumn();
$city->field('City');
$address = new \Kendo\UI\GridColumn();
$address->field('Address');
$phone = new \Kendo\UI\GridColumn();
Example #9
0
$city->field('City')->width(110);
$title = new \Kendo\UI\GridColumn();
$title->field('Title');
$grid->addColumn($firstName, $lastName, $country, $city, $title)->dataSource($dataSource)->height(430)->sortable(true)->pageable(true)->dataBound('dataBound')->detailTemplateId('details');
echo $grid->render();
?>

<script id="details" type="text/x-kendo-template">
   <?php 
$transport = new \Kendo\Data\DataSourceTransport();
$read = new \Kendo\Data\DataSourceTransportRead();
$read->url('hierarchy.php?details=details')->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');
$dataSource = new \Kendo\Data\DataSource();
$filter = new \Kendo\Data\DataSourceFilterItem();
$filter->field('EmployeeID')->operator('eq')->value('#=EmployeeID#');
$dataSource->transport($transport)->pageSize(5)->schema($schema)->addFilterItem($filter)->serverSorting(true)->serverFiltering(true)->serverPaging(true);
$detailGrid = new \Kendo\UI\Grid('detailGrid#=EmployeeID#');
$orderID = new \Kendo\UI\GridColumn();
$orderID->field('OrderID')->width(70)->title('Order ID');
$shipCountry = new \Kendo\UI\GridColumn();
$shipCountry->field('ShipCountry')->width(110)->title('Ship Country');
$shipAddress = new \Kendo\UI\GridColumn();
$shipAddress->field('ShipAddress')->title('Ship Address');
$shipName = new \Kendo\UI\GridColumn();
$shipName->field('ShipName')->title('Ship Name')->width(200);
$detailGrid->dataSource($dataSource)->addColumn($orderID, $shipCountry, $shipAddress, $shipName)->pageable(true)->sortable(true)->scrollable(false);
Example #10
0
require_once '../lib/DataSourceResult.php';
require_once '../lib/Kendo/Autoload.php';
require_once '../include/header.php';
$result = new DataSourceResult('sqlite:..//sample.db');
$data = $result->read('Products', array('ProductName', 'UnitPrice', 'UnitsInStock', 'Discontinued'));
$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');
$discontinuedField = new \Kendo\Data\DataSourceSchemaModelField('Discontinued');
$discontinuedField->type('boolean');
$model->addField($productNameField)->addField($unitPriceField)->addField($unitsInStockField)->addField($discontinuedField);
$schema = new \Kendo\Data\DataSourceSchema();
$schema->data('data')->model($model)->total('total');
$dataSource = new \Kendo\Data\DataSource();
$dataSource->data($data)->pageSize(16)->schema($schema);
$grid = new \Kendo\UI\Grid('grid');
$productName = new \Kendo\UI\GridColumn();
$productName->field('ProductName')->title('Product Name');
$unitPrice = new \Kendo\UI\GridColumn();
$unitPrice->field('UnitPrice')->width('130px')->format('{0:c}')->title('Unit Price');
$unitsInStock = new \Kendo\UI\GridColumn();
$unitsInStock->field('UnitsInStock')->width('130px')->title('Units In Stock');
$discontinued = new \Kendo\UI\GridColumn();
$discontinued->field('Discontinued')->width('130px');
$grid->addColumn($productName)->addColumn($unitPrice)->addColumn($unitsInStock)->addColumn($discontinued)->scrollable(false)->dataSource($dataSource);
echo $grid->render();
$sortable = new \Kendo\UI\Sortable('#grid table');
Example #11
0
$read = new \Kendo\Data\DataSourceTransportRead();
$read->url('rtl.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');
$discontinuedField = new \Kendo\Data\DataSourceSchemaModelField('Discontinued');
$discontinuedField->type('boolean');
$model->addField($productNameField)->addField($unitPriceField)->addField($discontinuedField)->addField($unitsInStockField);
$schema = new \Kendo\Data\DataSourceSchema();
$schema->data('data')->errors('errors')->model($model)->total('total');
$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport)->pageSize(15)->serverPaging(true)->serverSorting(true)->serverGrouping(true)->schema($schema);
$grid = new \Kendo\UI\Grid('grid');
$productName = new \Kendo\UI\GridColumn();
$productName->field('ProductName')->title('Product Name');
$unitPrice = new \Kendo\UI\GridColumn();
$unitPrice->field('UnitPrice')->format('{0:c}')->width(130)->title('Unit Price');
$unitsInStock = new \Kendo\UI\GridColumn();
$unitsInStock->field('UnitsInStock')->width(130)->title('Units In Stock');
$discontinued = new \Kendo\UI\GridColumn();
$discontinued->field('Discontinued')->width(130);
$grid->addColumn($productName, $unitPrice, $unitsInStock, $discontinued)->dataSource($dataSource)->height(430)->sortable(true)->resizable(true)->pageable(true);
?>
Example #12
0
require_once '../lib/Kendo/Autoload.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    header('Content-Type: application/json');
    $request = json_decode(file_get_contents('php://input'));
    $result = new DataSourceResult('sqlite:..//sample.db');
    echo json_encode($result->read('Products', array('ProductID', 'ProductName'), $request));
    exit;
}
require_once '../include/header.php';
$transport = new \Kendo\Data\DataSourceTransport();
$read = new \Kendo\Data\DataSourceTransportRead();
$read->url('serverfiltering.php')->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');
$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport)->schema($schema)->serverFiltering(true);
$autoComplete = new \Kendo\UI\AutoComplete('products');
$autoComplete->dataSource($dataSource)->dataTextField('ProductName')->ignoreCase(false)->attr('style', 'width:250px');
?>
<div class="demo-section">
    <h2>Products</h2>
<?php 
echo $autoComplete->render();
?>
</div>
<style scoped>
    .demo-section {
        width: 250px;
Example #13
0
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    header('Content-Type: application/json');
    $request = json_decode(file_get_contents('php://input'));
    $result = new DataSourceResult('sqlite:..//sample.db');
    echo json_encode($result->read('Employees', array('EmployeeID', 'FirstName', 'LastName', 'City', 'Title', 'Address'), $request));
    exit;
}
require_once '../include/header.php';
$transport = new \Kendo\Data\DataSourceTransport();
$read = new \Kendo\Data\DataSourceTransportRead();
$read->url('custom-command.php')->contentType('application/json')->type('POST');
$transport->read($read)->parameterMap('function(data) {
              return kendo.stringify(data);
          }');
$model = new \Kendo\Data\DataSourceSchemaModel();
$schema = new \Kendo\Data\DataSourceSchema();
$schema->data('data')->total('total');
$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport)->pageSize(10)->schema($schema)->serverPaging(true);
$grid = new \Kendo\UI\Grid('grid');
$firstName = new \Kendo\UI\GridColumn();
$firstName->field('FirstName')->title('First Name');
$lastName = new \Kendo\UI\GridColumn();
$lastName->field('LastName')->title('Last Name');
$title = new \Kendo\UI\GridColumn();
$title->field('Title');
$command = new \Kendo\UI\GridColumnCommandItem();
$command->click('commandClick')->text('View Details');
$commandColumn = new \Kendo\UI\GridColumn();
$commandColumn->addCommandItem($command)->title('&nbsp;')->width(140);
$grid->addColumn($firstName, $lastName, $title, $commandColumn)->dataSource($dataSource)->height(260)->pageable(true);
Example #14
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';
Example #15
0
            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>
<p>
    <label for="products">Products:</label>
<?php 
Example #16
0
require_once '../lib/Kendo/Autoload.php';
require_once '../include/header.php';
$data = array(array('meetingID' => 1, 'title' => 'Call Charlie about the project', 'start' => new DateTime('2013/6/13 10:30'), 'end' => new DateTime('2013/6/13 11:30'), 'roomId' => 1, 'attendee' => 1), array('meetingID' => 2, 'title' => 'Performance review', 'start' => new DateTime('2013/6/13 9:00'), 'end' => new DateTime('2013/6/13 12:30'), 'roomId' => 2, 'attendee' => 2), array('meetingID' => 3, 'title' => 'HR Lecture', 'start' => new DateTime('2013/6/13 13:00'), 'end' => new DateTime('2013/6/13 14:30'), 'roomId' => 1, 'attendee' => 2));
$model = new \Kendo\Data\DataSourceSchemaModel();
$startField = new \Kendo\Data\DataSourceSchemaModelField('start');
$startField->type('date');
$endField = new \Kendo\Data\DataSourceSchemaModelField('end');
$endField->type('date');
$titleField = new \Kendo\Data\DataSourceSchemaModelField('title');
$titleField->defaultValue('No title')->validation(array('required' => true));
$roomIdField = new \Kendo\Data\DataSourceSchemaModelField('roomId');
$roomIdField->nullable(true);
$attendeeField = new \Kendo\Data\DataSourceSchemaModelField('attendee');
$attendeeField->defaultValue(1);
$model->id('meetingID')->addField($roomIdField)->addField($startField)->addField($endField)->addField($attendeeField)->addField($titleField);
$schema = new \Kendo\Data\DataSourceSchema();
$schema->model($model);
$dataSource = new \Kendo\Data\DataSource();
$dataSource->data($data)->schema($schema);
$roomResource = new \Kendo\UI\SchedulerResource();
$roomResource->field('roomId')->title('Room')->name('Rooms')->dataSource(array(array('text' => 'Meeting Room 101', 'value' => 1, 'color' => '#6eb3fa'), array('text' => 'Meeting Room 201', 'value' => 2, 'color' => '#f58a8a')));
$attendeesResource = new \Kendo\UI\SchedulerResource();
$attendeesResource->field('attendee')->title('Attendee')->name('Attendee')->dataSource(array(array('text' => 'Alex', 'value' => 1, 'color' => '#f8a398'), array('text' => 'Bob', 'value' => 2, 'color' => '#51a0ed')));
$scheduler = new \Kendo\UI\Scheduler('scheduler');
$scheduler->date(new DateTime('2013/6/13'))->height(600)->addResource($attendeesResource, $roomResource)->group(array('resources' => array('Rooms')))->addView(array('type' => 'day', 'startTime' => new DateTime('2013/6/13 7:00')))->resize('scheduler_resize')->resizeEnd('scheduler_resizeEnd')->move('scheduler_move')->moveEnd('scheduler_moveEnd')->addEvent('scheduler_add')->save('scheduler_save')->dataSource($dataSource);
echo $scheduler->render();
?>

<script>
    function scheduler_resize(e) {
        if (roomIsOccupied(e.start, e.end, e.event, e.resources) || attendeeIsOccupied(e.start, e.end, e.event, e.resources)) {
Example #17
0
$transport->create($create)->read($read)->update($update)->destroy($destroy)->parameterMap('function(data) {
                  return kendo.stringify(data);
              }');
$model = new \Kendo\Data\DataSourceSchemaModel();
$productIDField = new \Kendo\Data\DataSourceSchemaModelField('ProductID');
$productIDField->type('number')->editable(false)->nullable(true);
$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');
$discontinuedField = new \Kendo\Data\DataSourceSchemaModelField('Discontinued');
$discontinuedField->type('boolean');
$model->id('ProductID')->addField($productIDField)->addField($productNameField)->addField($unitPriceField)->addField($discontinuedField)->addField($unitsInStockField);
$schema = new \Kendo\Data\DataSourceSchema();
$schema->data('data')->errors('errors')->model($model)->total('total');
$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport)->batch(true)->schema($schema)->pageSize(4);
$listview = new \Kendo\UI\ListView('listView');
$listview->dataSource($dataSource)->templateId('template')->editTemplateId('editTemplate')->selectable(true)->navigatable(true)->pageable(true);
echo $listview->render();
?>
</div>

<script>
    $(function() {
        $(".k-add-button").click(function(e) {
            var listView = $("#listView").data("kendoListView");

            listView.add();
Example #18
0
require_once '../lib/Kendo/Autoload.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    header('Content-Type: application/json');
    $request = json_decode(file_get_contents('php://input'));
    $result = new DataSourceResult('sqlite:..//sample.db');
    echo json_encode($result->read('Products', array('ProductName', 'UnitPrice', 'UnitsInStock', 'UnitsOnOrder'), $request));
    exit;
}
require_once '../include/header.php';
$transport = new \Kendo\Data\DataSourceTransport();
$read = new \Kendo\Data\DataSourceTransportRead();
$read->url('aggregates.php')->contentType('application/json')->type('POST');
$transport->read($read)->parameterMap('function(data) {
              return kendo.stringify(data);
          }');
$schema = new \Kendo\Data\DataSourceSchema();
$schema->data('data')->errors('errors')->groups('groups')->aggregates('aggregates')->total('total');
$productNameCount = new \Kendo\Data\DataSourceAggregateItem();
$productNameCount->field("ProductName")->aggregate("count");
$unitsOnOrderAvg = new \Kendo\Data\DataSourceAggregateItem();
$unitsOnOrderAvg->field("UnitsOnOrder")->aggregate("average");
$unitsInStockMin = new \Kendo\Data\DataSourceAggregateItem();
$unitsInStockMin->field("UnitsInStock")->aggregate("min");
$unitsInStockMax = new \Kendo\Data\DataSourceAggregateItem();
$unitsInStockMax->field("UnitsInStock")->aggregate("max");
$unitsInStockCount = new \Kendo\Data\DataSourceAggregateItem();
$unitsInStockCount->field("UnitsInStock")->aggregate("count");
$group = new \Kendo\Data\DataSourceGroupItem();
$group->field('UnitsInStock')->addAggregate($productNameCount, $unitsOnOrderAvg, $unitsInStockMin, $unitsInStockMax, $unitsInStockCount);
$dataSource = new \Kendo\Data\DataSource();
$dataSource->transport($transport)->pageSize(7)->serverPaging(true)->serverSorting(true)->serverGrouping(true)->serverFiltering(true)->serverAggregates(true)->addGroupItem($group)->addAggregateItem($productNameCount, $unitsOnOrderAvg, $unitsInStockMin, $unitsInStockMax)->schema($schema);