Пример #1
0
<?php

require './__init__.php';
Rhaco::import('generic.Flow');
Rhaco::import('database.DbUtil');
Rhaco::import('model.Category');
Rhaco::import('model.Todo');
$db = new DbUtil(Category::connection());
$flow = new Flow();
$flow->setVariable('categories', $db->select(new Category()));
$flow->setVariable('object_list', $db->select(new Todo(), new C(Q::fact())));
$flow->write('list.html');
Пример #2
0
<?php

require_once '__init__.php';
Rhaco::import('generic.Urls');
Rhaco::import('model.Todo');
Rhaco::import('model.Category');
$db = new DbUtil(Category::connection());
$patterns = array('^$' => array('class' => 'generic.Views', 'method' => 'read', 'args' => array(new Todo(), new C(Q::eq(Todo::columnClose(), false), Q::fact())), 'template' => 'list.html'), '^detail/(\\d+)$' => array('method' => 'detail', 'args' => array(new Todo(), new C(Q::fact()))), '^create$' => array('method' => 'create', 'args' => array(new Todo(), Rhaco::url())), '^update/(\\d+)$' => array('method' => 'update', 'args' => array(new Todo(), null, Rhaco::url())), '^delete/(\\d+)$' => array('method' => 'delete', 'args' => array(new Todo(), null, Rhaco::url())), '^cat/(\\d+)$' => array('method' => 'detail', 'args' => array(new Category(), new C(Q::depend()))));
$parser = Urls::parser($patterns, $db);
$parser->setVariable('categories', $db->select(new Category()));
$parser->write();
Пример #3
0
<?php

require './__init__.php';
Rhaco::import('generic.Views');
Rhaco::import('model.Category');
Rhaco::import('model.Todo');
$views = new Views();
$views->read(new Todo(), new C(Q::fact()));
$views->setVariable('categories', $views->dbUtil->select(new Category()));
$views->write('list.html');