$result = $result->read('Products', $columns, $request); break; case 'update': $result = $result->update('Products', $columns, $request->models, 'ProductID'); break; case 'destroy': $result = $result->destroy('Products', $request->models, 'ProductID'); break; } echo json_encode($result, JSON_NUMERIC_CHECK); exit; } require_once '../include/header.php'; $transport = new \Kendo\Data\DataSourceTransport(); $create = new \Kendo\Data\DataSourceTransportCreate(); $create->url('editing-popup.php?type=create')->contentType('application/json')->type('POST'); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('editing-popup.php?type=read')->contentType('application/json')->type('POST'); $update = new \Kendo\Data\DataSourceTransportUpdate(); $update->url('editing-popup.php?type=update')->contentType('application/json')->type('POST'); $destroy = new \Kendo\Data\DataSourceTransportDestroy(); $destroy->url('editing-popup.php?type=destroy')->contentType('application/json')->type('POST'); $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')->validation(array('required' => true)); $unitPriceValidation = new \Kendo\Data\DataSourceSchemaModelFieldValidation();
</dd> <dt>Discontinued</dt> <dd><input type="checkbox" name="Discontinued" data-bind="checked:Discontinued"></dd> </dl> </div> </script> <div class="demo-section"> <a class="k-button k-button-icontext k-add-button" href="#"><span class="k-icon k-add"></span>Add new record</a> </div> <div class="demo-section"> <?php $transport = new \Kendo\Data\DataSourceTransport(); $create = new \Kendo\Data\DataSourceTransportCreate(); $create->url('navigation.php?type=create')->contentType('application/json')->type('POST'); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('navigation.php?type=read')->contentType('application/json')->type('POST'); $update = new \Kendo\Data\DataSourceTransportUpdate(); $update->url('navigation.php?type=update')->contentType('application/json')->type('POST'); $destroy = new \Kendo\Data\DataSourceTransportDestroy(); $destroy->url('navigation.php?type=destroy')->contentType('application/json')->type('POST'); $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');
$result = $result->updateWithAssociation('Meetings', 'MeetingAttendees', $columns, $request->models, 'MeetingID', array('Attendees' => 'AttendeeID')); break; case 'destroy': $result = $result->destroyWithAssociation('Meetings', 'MeetingAttendees', $request->models, 'MeetingID'); break; default: $result = $result->readWithAssociation('Meetings', 'MeetingAttendees', 'MeetingID', array('AttendeeID' => 'Attendees'), array('MeetingID', 'RoomID'), $request); break; } echo json_encode($result, JSON_NUMERIC_CHECK); exit; } require_once '../include/header.php'; $transport = new \Kendo\Data\DataSourceTransport(); $create = new \Kendo\Data\DataSourceTransportCreate(); $create->url('resources.php?type=create')->contentType('application/json')->type('POST'); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('resources.php?type=read')->contentType('application/json')->type('POST'); $update = new \Kendo\Data\DataSourceTransportUpdate(); $update->url('resources.php?type=update')->contentType('application/json')->type('POST'); $destroy = new \Kendo\Data\DataSourceTransportDestroy(); $destroy->url('resources.php?type=destroy')->contentType('application/json')->type('POST'); $transport->create($create)->read($read)->update($update)->destroy($destroy)->parameterMap('function(data) { return kendo.stringify(data); }'); $model = new \Kendo\Data\DataSourceSchemaModel(); $meetingIdField = new \Kendo\Data\DataSourceSchemaModelField('meetingID'); $meetingIdField->type('number')->from('MeetingID')->nullable(true); $titleField = new \Kendo\Data\DataSourceSchemaModelField('title'); $titleField->from('Title')->defaultValue('No title')->validation(array('required' => true)); $startField = new \Kendo\Data\DataSourceSchemaModelField('start');
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; }
break; case 'update': $result = $result->update('Products', $columns, $request->models, 'ProductID'); break; case 'destroy': $result = $result->destroy('Products', $request->models, 'ProductID'); break; } echo json_encode($result); exit; } require_once '../include/header.php'; $categories = $result->read('Categories', array('CategoryID as value', 'CategoryName as text')); $transport = new \Kendo\Data\DataSourceTransport(); $create = new \Kendo\Data\DataSourceTransportCreate(); $create->url('foreignkeycolumn.php?type=create')->contentType('application/json')->type('POST'); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('foreignkeycolumn.php?type=read')->contentType('application/json')->type('POST'); $update = new \Kendo\Data\DataSourceTransportUpdate(); $update->url('foreignkeycolumn.php?type=update')->contentType('application/json')->type('POST'); $destroy = new \Kendo\Data\DataSourceTransportDestroy(); $destroy->url('foreignkeycolumn.php?type=destroy')->contentType('application/json')->type('POST'); $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')->validation(array('required' => true)); $unitPriceValidation = new \Kendo\Data\DataSourceSchemaModelFieldValidation();
<?php require_once 'lib/Kendo/Autoload.php'; include 'header.php'; // --------- Kendo UI DataSource Transport ------- $create = new \Kendo\Data\DataSourceTransportCreate(); $create->url('/api/products/create.php')->contentType('application/json')->type('POST'); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('/api/products/read.php')->contentType('application/json')->type('POST'); $update = new \Kendo\Data\DataSourceTransportUpdate(); $update->url('/api/products/update.php')->contentType('application/json')->type('PUT'); $destroy = new \Kendo\Data\DataSourceTransportDestroy(); $destroy->url('/api/products/destroy.php')->contentType('application/json')->type('POST'); $transport = new \Kendo\Data\DataSourceTransport(); $transport->create($create)->read($read)->update($update)->destroy($destroy)->parameterMap('function(data) { return kendo.stringify(data); }'); // --------- Kendo UI DataSource Schema ------- $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'); $supplierField = new \Kendo\Data\DataSourceSchemaModelField("Supplier"); $supplierField->defaultValue(new stdClass()); $categoryField = new \Kendo\Data\DataSourceSchemaModelField("Category"); $categoryField->defaultValue(new stdClass()); $model->id("ProductID")->addField($productNameField)->addField($unitPriceField)->addField($unitsInStockField)->addField($supplierField)->addField($categoryField); $schema = new \Kendo\Data\DataSourceSchema(); $schema->data('data')->model($model)->total('total'); // --------- Kendo UI DataSource -------
public function set_insert($url, $with_button = 1) { $dst = new \Kendo\Data\DataSourceTransportCreate(); $dst->url('json/insert/' . $url)->contentType('application/json')->type('POST'); $this->grid->transport->create($dst); if ($with_button) { $this->add_table_button(['text' => 'Nouvelle entrée', 'name' => 'create']); } }
$result = $result->updateWithAssociation('Meetings', 'MeetingAttendees', $columns, $request->models, 'MeetingID', array('Attendees' => 'AttendeeID')); break; case 'destroy': $result = $result->destroyWithAssociation('Meetings', 'MeetingAttendees', $request->models, 'MeetingID'); break; default: $result = $result->readWithAssociation('Meetings', 'MeetingAttendees', 'MeetingID', array('AttendeeID' => 'Attendees'), array('MeetingID', 'RoomID'), $request); break; } echo json_encode($result, JSON_NUMERIC_CHECK); exit; } require_once '../include/header.php'; $transport = new \Kendo\Data\DataSourceTransport(); $create = new \Kendo\Data\DataSourceTransportCreate(); $create->url('resources-grouping-horizontal.php?type=create')->contentType('application/json')->type('POST'); $read = new \Kendo\Data\DataSourceTransportRead(); $read->url('resources-grouping-horizontal.php?type=read')->contentType('application/json')->type('POST'); $update = new \Kendo\Data\DataSourceTransportUpdate(); $update->url('resources-grouping-horizontal.php?type=update')->contentType('application/json')->type('POST'); $destroy = new \Kendo\Data\DataSourceTransportDestroy(); $destroy->url('resources-grouping-horizontal.php?type=destroy')->contentType('application/json')->type('POST'); $transport->create($create)->read($read)->update($update)->destroy($destroy)->parameterMap('function(data) { return kendo.stringify(data); }'); $model = new \Kendo\Data\DataSourceSchemaModel(); $meetingIdField = new \Kendo\Data\DataSourceSchemaModelField('meetingID'); $meetingIdField->type('number')->from('MeetingID')->nullable(true); $titleField = new \Kendo\Data\DataSourceSchemaModelField('title'); $titleField->from('Title')->defaultValue('No title')->type('string')->validation(array('required' => true)); $startField = new \Kendo\Data\DataSourceSchemaModelField('start');
public function set_insert($url, $with_button = 1) { if (isset($this->transport)) { $this->_insert = 1; $dst = new \Kendo\Data\DataSourceTransportCreate(); $dst->url($url)->type('POST'); $this->transport->create($dst); if ($with_button) { $this->grid->addToolbarItem(['name' => 'create', 'text' => i18n\fr::$new_entry]); } } }