本文整理汇总了PHP中box::addWidget方法的典型用法代码示例。如果您正苦于以下问题:PHP box::addWidget方法的具体用法?PHP box::addWidget怎么用?PHP box::addWidget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类box
的用法示例。
在下文中一共展示了box::addWidget方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: drawWidget
function drawWidget()
{
$s = new session();
if (session::check() != false) {
$w = new box($this->logged_in_realm_caption);
$w->css_box = "login";
$w->addWidget(html::write($this->logged_in_caption . $s->user->username));
$w->addWidget(new button($this->logout_caption, $this->logouttarget . "?logout=1"));
return $w->draw();
}
$h = new html();
$h->html .= "\n\t\t\t\t\t\n\t\t\t\t\t<form method=\"post\" action=\"" . $this->target . "\">\n\t\t\t\t\t<table>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td colspan=\"2\">\n\t\t\t\t\t\t\t" . $this->realm_caption . "\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td>" . $this->username_caption . "</td><td><input type=\"text\" name=\"username\"></td></tr>\t\t\t\n\t\t\t\t\t\t<tr><td>" . $this->password_caption . "</td><td><input type=\"password\" name=\"password\"></td></tr>\n\t\t\t\t\t\t<tr><td><input type=\"submit\" value=\"" . $this->submit_caption . "\"></td></tr></table></form>";
$b = new box($this->realm_caption, $h);
$b->css_box = "login";
return $b->draw();
}
示例2: predrawWidget
function predrawWidget()
{
$r = new request();
if ($r->id) {
$this->__scaffoldobject->open($r->id);
}
$this->__gridobject->drop($this->__scaffoldobject);
$this->__dataform->drop($this->__scaffoldobject);
switch ($r->action) {
default:
$button_add = new button($this->button_add, $this->controller . "?action=add");
$b = new box($this->name ? $this->name : "List", $this->__gridobject);
$b->addWidget($button_add);
return $b;
break;
case "add":
$this->__dataform->action = $this->__dataform->action . "?action=insert";
$this->__dataform->submit = $this->button_add;
$this->__dataform->__target = $this->__dataform->action;
return new box($this->name ? $this->name : "Add", $this->__dataform);
break;
case "insert":
$this->__scaffoldobject->fromObject($r);
if ($this->__scaffoldobject->insert()) {
$b = new box($this->name ? $this->name : "Message", html::write($this->message_insert_ok));
$b->addWidget(new button($this->button_list, $this->controller));
return $b;
} else {
$b = new box($this->name ? $this->name : "Message", html::write($this->message_insert_failed));
$b->addWidget(new button($this->button_list, $this->controller));
return $b;
}
break;
case "update":
$this->__scaffoldobject->open($r->id);
$this->__scaffoldobject->fromObject($r);
if ($this->__scaffoldobject->update()) {
$b = new box($this->name ? $this->name : "Message", html::write($this->message_update_ok));
$b->addWidget(new button($this->button_list, $this->controller));
return $b;
} else {
$b = new box($this->name ? $this->name : "Message", html::write($this->message_update_failed));
$b->addWidget(new button($this->button_list, $this->controller));
return $b;
}
break;
case "view":
$this->__dataform->action = $this->__dataform->action . "?action=update&id=" . $r->id;
$this->__dataform->__target = $this->__dataform->action;
$this->__dataform->submit = $this->button_update;
$b = new box($this->name ? $this->name : "View", $this->__dataform);
$b->addWidget(new button($this->button_list, $this->controller));
$b->addWidget(new button($this->button_delete, $this->controller . "?action=delete&id=" . $r->id));
return $b;
break;
case "delete":
$this->__scaffoldobject->open($r->id);
if ($this->__scaffoldobject->delete()) {
$b = new box($this->name ? $this->name : "Message", html::write($this->message_delete_ok));
$b->addWidget(new button($this->button_list, $this->controller));
return $b;
} else {
$b = new box($this->name ? $this->name : "Message", html::write($this->message_delete_failed));
$b->addWidget(new button($this->button_list, $this->controller));
return $b;
}
break;
}
}
示例3: predrawWidget
function predrawWidget()
{
$identificator = $this->name;
$action = $this->name . "_action";
$_identificator = $this->name . "_id";
$r = new request();
if ($r->filter_text) {
if (strpos($this->controller, "?") === false) {
$this->controller .= "?prepend=1";
}
$this->controller .= "&filter_text=" . $r->filter_text . "&filter_field=" . $r->filter_field;
if ($r->filter_match) {
$this->controller .= "&filter_match=1";
}
}
if ($r->{$_identificator}) {
$this->__scaffoldobject->open($r->{$_identificator});
}
$this->__gridobject->drop($this->__scaffoldobject);
if ($r->{$action} == "insert") {
$this->__scaffoldobject->fromObject($r);
}
$this->__formobject->drop($this->__scaffoldobject);
switch ($r->{$action}) {
default:
$button_add = new button($this->button_add, $this->controller . (strpos($this->controller, "?") === false ? "?" : "&") . $action . "=add", "add");
$b = new box($this->name ? $this->name : "List", $this->__gridobject);
if (!$this->__disable_add) {
$b->addWidget($button_add);
}
return $b;
break;
case "add":
$this->__formobject->action = $this->__formobject->action . (strpos($this->__formobject->action, "?") === false ? "?" : "&") . $action . "=insert";
$this->__formobject->submit = $this->button_add;
$this->__formobject->__target = $this->__formobject->action;
return new box($this->name ? $this->name : "Add", $this->__formobject);
break;
case "insert":
$this->__scaffoldobject->fromObject($r);
if (is_array($this->__composites)) {
foreach ($this->__composites as $k => $v) {
$entity = $this->__composites[$k]["entity"];
$efield = $this->__composites[$k]["efield"];
$this->__scaffoldobject->composeField($k, $entity, $efield);
}
}
if ($this->__scaffoldobject->insert()) {
$b = new box($this->name ? $this->name : "Message", html::write($this->message_insert_ok));
$t = new toolbar();
$b->addWidget(html::write("<script>setTimeout(\"document.location='" . $this->controller . "'\",1000);</script>"));
$b->addWidget($t);
return $b;
} else {
$w = new oowidget();
$b = new box($this->name ? $this->name : "Message", html::write($this->message_insert_failed));
$b->addWidget(errorobject::errorList());
$this->__formobject->action = $this->__formobject->action . (strpos($this->__formobject->action, "?") === false ? "?" : "&") . $action . "=insert";
$this->__formobject->submit = $this->button_add;
$this->__formobject->__target = $this->__formobject->action;
$b2 = new box($this->name ? $this->name : "Add", $this->__formobject);
$w->addWidget($b);
$w->addWidget($b2);
$b->addWidget(new button($this->button_list, $this->controller));
return $w;
}
break;
case "update":
$tmpsf = $this->__scaffoldobject;
$this->__scaffoldobject = new scaffold($this->name);
$this->__scaffoldobject->__validators = $tmpsf->__validators;
$this->__scaffoldobject->fromObject($r);
if (is_array($this->__composites)) {
foreach ($this->__composites as $k => $v) {
$entity = $this->__composites[$k]["entity"];
$efield = $this->__composites[$k]["efield"];
$this->__scaffoldobject->composeField($k, $entity, $efield);
}
}
if ($this->__scaffoldobject->update()) {
$b = new box($this->name ? $this->name : "Message", html::write($this->message_update_ok));
$t = new toolbar();
//$b->addWidget(new button($this->button_list, $this->controller));
$b->addWidget(html::write("<script>setTimeout(\"document.location='" . $this->controller . "'\",1000);</script>"));
return $b;
} else {
$w = new oowidget();
$this->__formobject->action = $this->__formobject->action . (strpos($this->__formobject->action, "?") === false ? "?" : "&") . $action . "=update&" . $this->name . "_id=" . $r->{$_identificator};
$this->__formobject->__target = $this->__formobject->action;
$this->__formobject->submit = $this->button_update;
$b2 = new box($this->name ? $this->name : "View", $this->__formobject);
$b = new box($this->name ? $this->name : "Message", html::write($this->message_update_failed));
$b->addWidget(errorobject::errorList());
$b->addWidget(new button($this->button_list, $this->controller));
$w->addWidget($b);
$w->addWidget($b2);
$b->addWidget(new button($this->button_list, $this->controller));
return $w;
return $b;
}
//.........这里部分代码省略.........