function add_test($name) { $test = new Test(); $test->name = $name; $test->design_file = 'stupid_design.php'; $test->handler_file = 'random_order.php'; $test->finisher_file = 'sms_points_printer.php'; $test->sms_enabled = 1; $test->put(); $test->all_questions = array(); return $test; }
<?php include '../lib/common.inc.php'; $test = new Test(); $test->name = trim($_REQUEST['name']); // validate $test->put(); jsdie('testCreated', $test->id);
{ public function put($p) { $ret['s'] = 'OK'; $t = new CassandraCF('mall', 'UserItem', true); // if(is_array($p)){ $id = $p['u']; $ret['id'] = $t->put_super($p['d'], $id); return $ret; } public function get($p) { $ret['s'] = 'OK'; $t = new CassandraCF('mall', 'UserItem', true); $id = $p['u']; $ret['d'] = $t->get($id); return $ret; } } //return; $p = array('u' => '2', 'd' => array('id' => 'testid', 'first' => 'Zeng', 'last' => 'tingkun', 'addr' => array('city' => 'beijing', 'zip' => '123456'))); print_r($p); $t = new Test(); record_time($start); print_r($t->put($p)); record_time($start, '$t->put($p)'); $p['d']['id'] = ''; $p['d']['info'] = 'with no id'; print_r($t->put($p)); print_r($t->get($p)); record_time($start, '$t->get($p)');