public function create() { $req = new \ebi\Request(); $this->value($req->in_vars('value')); $this->save(); return ['id' => $this->id]; }
public function index() { $req = new \ebi\Request(); $req->vars('get_file', $req->in_files('file')); $req->vars('set_cookie', $req->in_vars('set_cookie') + 1); $req->write_cookie('set_cookie'); return $req->ar_vars(); }
foreach (test\db\Paginator::find($paginator, \ebi\Q::order('id')) as $o) { $i++; } eq(20, $i); $i = 0; $paginator = new \ebi\Paginator(20, 4); foreach (test\db\Paginator::find($paginator, \ebi\Q::order('id')) as $o) { $i++; } eq(20, $i); $i = 0; $paginator = new \ebi\Paginator(20, 5); foreach (test\db\Paginator::find($paginator, \ebi\Q::order('id')) as $o) { $i++; } eq(18, $i); $i = 0; $paginator = new \ebi\Paginator(20, 6); foreach (test\db\Paginator::find($paginator, \ebi\Q::order('id')) as $o) { $i++; } eq(0, $i); $i = 0; $req = new \ebi\Request(); $req->vars('paginate_by', 30); // 30を指定してもmax25なので25まで $paginator = \ebi\Paginator::request($req, 20, 25); foreach (test\db\Paginator::find($paginator, \ebi\Q::order('id')) as $o) { $i++; } eq(25, $i);
<?php $req = new \ebi\Request(); $req->rm_vars(); $req->vars('abc', 1); $req->vars('def', 2); $req->vars('ghi', 3); $i = 0; $keys = array('abc', 'def', 'ghi'); $values = array(1, 2, 3); foreach ($req as $k => $v) { eq($keys[$i], $k); eq($values[$i], $v); $i++; }
/** * ログインしていない場合にログイン処理を実行する */ private function login_required() { $selected_pattern = $this->get_selected_pattern(); if (!$this->is_user_logged_in() && array_key_exists('action', $selected_pattern) && strpos($selected_pattern['action'], '::do_login') === false) { if ($this->has_object_plugin('before_login_required')) { /** * ログイン処理の前処理 * @param \ebi\flow\Request $arg1 */ $this->call_object_plugin_funcs('before_login_required', $this); } if (strpos($selected_pattern['action'], '::do_logout') === false) { $this->sessions('logged_in_redirect_to', \ebi\Request::current_url() . \ebi\Request::request_string(true)); } $req = new \ebi\Request(); $this->sess->vars(__CLASS__ . '_login_vars', [time(), $req->ar_vars()]); if (array_key_exists('@', $selected_pattern)) { $this->set_before_redirect('do_login'); } else { $this->set_before_redirect('login'); } } }
public function form_obj() { $req = new \ebi\Request(); return array_merge($req->ar_vars(), ['object' => new \test\model\Form(10, 'ABC', 999)]); }
<?php $obj = new \test\xml\Xml(); $self = new \ebi\Xml('abc', $obj); eq('<abc><aaa>hoge</aaa><ccc>123</ccc></abc>', $self->get()); $n = explode('\\', get_class($obj)); $n = array_pop($n); $obj1 = clone $obj; $obj2 = clone $obj; $obj3 = clone $obj; $obj2->ccc(456); $obj3->ccc(789); $arr = array($obj1, $obj2, $obj3); $self = new \ebi\Xml('abc', $arr); eq(sprintf('<abc>' . '<%s><aaa>hoge</aaa><ccc>123</ccc></%s>' . '<%s><aaa>hoge</aaa><ccc>456</ccc></%s>' . '<%s><aaa>hoge</aaa><ccc>789</ccc></%s>' . '</abc>', $n, $n, $n, $n, $n, $n), $self->get()); $obj = new \ebi\Request(); $obj->rm_vars(); $obj->vars('aaa', 'hoge'); $obj->vars('ccc', 123); $self = new \ebi\Xml('abc', $obj); eq('<abc><aaa>hoge</aaa><ccc>123</ccc></abc>', $self->get()); $src = "<tag><abc><def var='123'><ghi selected>hoge</ghi></def></abc></tag>"; $tag = \ebi\Xml::extract($src, 'tag'); eq("hoge", $tag->find_get("abc/def/ghi")->value()); eq("123", $tag->find_get("abc/def")->in_attr('var')); eq("selected", $tag->find_get("abc/def/ghi")->in_attr('selected')); eq("<def var='123'><ghi selected>hoge</ghi></def>", $tag->find_get("abc/def")->plain()); try { $tag->find_get("abc/def/xyz"); fail(); } catch (\ebi\exception\NotFoundException $e) {
/** * @automap */ public function mail_view() { $req = new \ebi\Request(); $obj = \ebi\SmtpBlackholeDao::find_get(Q::eq('tcode', $req->in_vars('tcode')), Q::eq('id', $req->in_vars('id'))); $mail_info = new \ebi\Dt\DocInfo(); foreach (\ebi\Dt\Man::mail_template_list() as $info) { if ($info->opt('x_t_code') == $obj->tcode()) { $mail_info = $info; break; } } return ['mail_info' => $mail_info, 'object' => $obj]; }