本文整理汇总了PHP中Forge::script方法的典型用法代码示例。如果您正苦于以下问题:PHP Forge::script方法的具体用法?PHP Forge::script怎么用?PHP Forge::script使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Forge
的用法示例。
在下文中一共展示了Forge::script方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Forge
function form_script_test()
{
$form = new Forge("test/controller", "", "post", array("id" => "g-test-group-form"));
$group = $form->group("test_group")->label(t("Test Group"));
$group->input("title")->label(t("Title"));
$group->textarea("description")->label(t("Text Area"));
$form->script("")->url(url::file("test.js"))->text("alert('Test Javascript');");
$group->submit("")->value(t("Submit"));
$csrf = access::csrf_token();
$expected = "<form action=\"http://./index.php/test/controller\" method=\"post\" " . "id=\"g-test-group-form\">\n" . "<input type=\"hidden\" name=\"csrf\" value=\"{$csrf}\" />" . " <fieldset>\n" . " <legend>Test Group</legend>\n" . " <ul>\n" . " <li>\n" . " <label for=\"title\" >Title</label>\n" . " <input type=\"text\" name=\"title\" value=\"\" " . "class=\"textbox\" />\n" . " </li>\n" . " <li>\n" . " <label for=\"description\" >Text Area</label>\n" . " <textarea name=\"description\" rows=\"\" cols=\"\" " . "class=\"textarea\" ></textarea>\n" . " </li>\n" . " <li>\n" . " <input type=\"submit\" value=\"Submit\" class=\"submit\" />\n" . " </li>\n" . " </ul>\n" . " </fieldset>\n" . "<script type=\"text/javascript\" src=\"http://./test.js\"></script>\n\n" . "<script type=\"text/javascript\">\n" . "alert('Test Javascript');\n" . "</script>\n" . "</form>";
$this->assert_same($expected, (string) $form);
}
示例2: Forge
static function get_add_form($parent)
{
$form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gAddAlbumForm"));
$group = $form->group("add_album")->label(t("Add an album to %album_title", array("album_title" => $parent->title)));
$group->input("title")->label(t("Title"));
$group->textarea("description")->label(t("Description"));
$group->input("name")->label(t("Directory Name"))->callback("item::validate_no_slashes")->error_messages("no_slashes", t("The directory name can't contain the \"/\" character"));
$group->hidden("type")->value("album");
$group->submit("")->value(t("Create"));
$form->add_rules_from(ORM::factory("item"));
$form->script("")->url(url::abs_file("modules/gallery/js/albums_form_add.js"));
return $form;
}
示例3: Forge
static function get_add_form($parent)
{
$form = new Forge("albums/create/{$parent->id}", "", "post", array("id" => "g-add-album-form"));
$group = $form->group("add_album")->label(t("Add an album to %album_title", array("album_title" => $parent->title)));
$group->input("title")->label(t("Title"))->error_messages("required", t("You must provide a title"))->error_messages("length", t("Your title is too long"));
$group->textarea("description")->label(t("Description"));
$group->input("name")->label(t("Directory name"))->error_messages("no_slashes", t("The directory name can't contain the \"/\" character"))->error_messages("required", t("You must provide a directory name"))->error_messages("length", t("Your directory name is too long"));
$group->input("slug")->label(t("Internet Address"))->error_messages("not_url_safe", t("The internet address should contain only letters, numbers, hyphens and underscores"))->error_messages("required", t("You must provide an internet address"))->error_messages("length", t("Your internet address is too long"));
$group->hidden("type")->value("album");
$group->submit("")->value(t("Create"));
$form->script("")->url(url::abs_file("modules/gallery/js/albums_form_add.js"));
return $form;
}
示例4: Forge
/**
* Display delete confirmation message and form
* @param object $item
* @return string form
*/
static function get_delete_form($item)
{
$page_type = Input::instance()->get("page_type");
$from_id = Input::instance()->get("from_id");
$form = new Forge("quick/delete/{$item->id}?page_type={$page_type}&from_id={$from_id}", "", "post", array("id" => "g-confirm-delete"));
$group = $form->group("confirm_delete")->label(t("Confirm Deletion"));
$group->submit("")->value(t("Delete"));
$form->script("")->url(url::abs_file("modules/gallery/js/item_form_delete.js"));
return $form;
}