コード例 #1
0
ファイル: index.php プロジェクト: zofe/dataform
<?php

require_once __DIR__ . '/vendor/autoload.php';
use Zofe\Deficient\Deficient;
use Zofe\DataForm\DataForm;
Deficient::boot("./");
## burp,  move it somewhere
route_any('store', array('as' => 'save', function () {
    Zofe\Burp\BurpEvent::queue('dataform.save');
}));
route_any('^/{save?}$', array('as' => 'home', function () {
    $form = DataForm::create(User::find(1));
    $form->text('name', 'Name')->rule('required');
    $form->textarea('lastname', 'Lastname');
    $form->checkbox('enabled', 'Enabled');
    $form->submit('Save');
    $form->saved(function () use($form) {
        $form->message("ok record saved");
        $form->linkRoute("home", "Back to the Form");
    });
    echo blade('dataform.tests.form', compact('form'));
}));
route_missing(function () {
    echo blade('dataform.tests.error', array(), 404);
    die;
});
route_dispatch();
コード例 #2
0
ファイル: index.php プロジェクト: faizan31/datagrid
<?php

require_once __DIR__ . '/vendor/autoload.php';
use Zofe\Deficient\Deficient;
use Zofe\DataGrid\DataSet;
use Zofe\DataGrid\DataGrid;
Deficient::boot("./");
## burp,  move it somewhere
route_get('page/(\\d+)', array('as' => 'page', function ($page) {
    Zofe\Burp\BurpEvent::queue('dataset.page', array($page));
}));
//define some general purpose events on query-string
route_query('ord=(-?)(\\w+)', array('as' => 'orderby', function ($direction, $field) {
    $direction = $direction == '-' ? "DESC" : "ASC";
    Zofe\Burp\BurpEvent::queue('dataset.sort', array($direction, $field));
}))->remove('page');
## test routes
route_get('^/{page?}$', array('as' => 'datagrid', function () {
    $grid = DataGrid::source(new User());
    $grid->add('id', 'ID', true)->style('width:100px');
    $grid->add('name', 'Name', true);
    $grid->paginate(5);
    echo blade('datagrid.tests.datagrid', compact('grid'));
    die;
}));
route_get('^/dataset/{page?}$', array('as' => 'dataset', function () {
    $ds = DataSet::source(new User());
    $ds->paginate(5);
    $ds->build();
    echo blade('datagrid.tests.dataset', compact('ds'));
    die;
コード例 #3
0
ファイル: helpers.php プロジェクト: drickferreira/rastreador
 function event_flush_all()
 {
     Zofe\Burp\BurpEvent::flushAll();
 }