本文整理汇总了PHP中Form::setAction方法的典型用法代码示例。如果您正苦于以下问题:PHP Form::setAction方法的具体用法?PHP Form::setAction怎么用?PHP Form::setAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Form
的用法示例。
在下文中一共展示了Form::setAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetAction
/**
* @covers Xoops\Form\Form::getAction
*/
public function testGetAction()
{
$name = 'form_name';
$this->object->setAction($name);
$value = $this->object->getAction();
$this->assertSame($name, $value);
}
示例2: testFormAttributes
public function testFormAttributes()
{
$this->assertEquals(Form::METHOD_POST, $this->object->getMethod());
$this->object->setMethod(Form::METHOD_GET);
$this->assertEquals(Form::METHOD_GET, $this->object->getMethod());
$this->assertEquals(null, $this->object->getAction());
$this->object->setAction('/some/url');
$this->assertEquals('/some/url', $this->object->getAction());
$this->assertFalse($this->object->isMultipart());
$this->object->setMultipart(true);
$this->assertTrue($this->object->isMultipart());
$this->assertInstanceOf('\\ArrayIterator', $this->object->getIterator());
}
示例3: __construct
public function __construct($userId)
{
parent::__construct();
$data = OW::getEventManager()->call("photo.entity_albums_find", array("entityType" => "user", "entityId" => $userId));
$albums = empty($data["albums"]) ? array() : $data["albums"];
$source = BOL_PreferenceService::getInstance()->getPreferenceValue("pcgallery_source", $userId);
$this->assign("source", $source == "album" ? "album" : "all");
$selectedAlbum = BOL_PreferenceService::getInstance()->getPreferenceValue("pcgallery_album", $userId);
$form = new Form("pcGallerySettings");
$form->setEmptyElementsErrorMessage(null);
$form->setAction(OW::getRouter()->urlFor("PCGALLERY_CTRL_Gallery", "saveSettings"));
$element = new HiddenField("userId");
$element->setValue($userId);
$form->addElement($element);
$element = new Selectbox("album");
$element->setHasInvitation(true);
$element->setInvitation(OW::getLanguage()->text("pcgallery", "settings_album_invitation"));
$validator = new PCGALLERY_AlbumValidator();
$element->addValidator($validator);
$albumsPhotoCount = array();
foreach ($albums as $album) {
$element->addOption($album["id"], $album["name"] . " ({$album["photoCount"]})");
$albumsPhotoCount[$album["id"]] = $album["photoCount"];
if ($album["id"] == $selectedAlbum) {
$element->setValue($album["id"]);
}
}
OW::getDocument()->addOnloadScript(UTIL_JsGenerator::composeJsString('window.pcgallery_settingsAlbumCounts = {$albumsCount};', array("albumsCount" => $albumsPhotoCount)));
$element->setLabel(OW::getLanguage()->text("pcgallery", "source_album_label"));
$form->addElement($element);
$submit = new Submit("save");
$submit->setValue(OW::getLanguage()->text("pcgallery", "save_settings_btn_label"));
$form->addElement($submit);
$this->addForm($form);
}
示例4: __construct
/**
* Constructor.
*/
public function __construct($ajax = false)
{
parent::__construct();
$form = new Form('sign-in');
$form->setAction("");
$username = new TextField('identity');
$username->setRequired(true);
$username->setHasInvitation(true);
$username->setInvitation(OW::getLanguage()->text('base', 'component_sign_in_login_invitation'));
$form->addElement($username);
$password = new PasswordField('password');
$password->setHasInvitation(true);
$password->setInvitation('password');
$password->setRequired(true);
$form->addElement($password);
$remeberMe = new CheckboxField('remember');
$remeberMe->setValue(true);
$remeberMe->setLabel(OW::getLanguage()->text('base', 'sign_in_remember_me_label'));
$form->addElement($remeberMe);
$submit = new Submit('submit');
$submit->setValue(OW::getLanguage()->text('base', 'sign_in_submit_label'));
$form->addElement($submit);
$this->addForm($form);
if ($ajax) {
$form->setAjaxResetOnSuccess(false);
$form->setAjax();
$form->setAction(OW::getRouter()->urlFor('BASE_CTRL_User', 'ajaxSignIn'));
$form->bindJsFunction(Form::BIND_SUCCESS, 'function(data){if( data.result ){if(data.message){OW.info(data.message);}setTimeout(function(){window.location.reload();}, 1000);}else{OW.error(data.message);}}');
$this->assign('forgot_url', OW::getRouter()->urlForRoute('base_forgot_password'));
}
$this->assign('joinUrl', OW::getRouter()->urlForRoute('base_join'));
}
示例5: __construct
public function __construct()
{
parent::__construct();
$language = OW::getLanguage();
$serviceLang = BOL_LanguageService::getInstance();
$addSectionForm = new Form('qst_add_section_form');
$addSectionForm->setAjax();
$addSectionForm->setAjaxResetOnSuccess(true);
$addSectionForm->setAction(OW::getRouter()->urlFor("ADMIN_CTRL_Questions", "ajaxResponder"));
$input = new HiddenField('command');
$input->setValue('addSection');
$addSectionForm->addElement($input);
$qstSectionName = new TextField('section_name');
$qstSectionName->addAttribute('class', 'ow_text');
$qstSectionName->addAttribute('style', 'width: auto;');
$qstSectionName->setRequired();
$qstSectionName->setLabel($language->text('admin', 'questions_new_section_label'));
$addSectionForm->addElement($qstSectionName);
$this->addForm($addSectionForm);
$addSectionForm->bindJsFunction('success', ' function (result) {
if ( result.result )
{
OW.info(result.message);
}
else
{
OW.error(result.message);
}
window.location.reload();
} ');
}
示例6: action
/**
* The action that displays the entry insert form .
*
* @param PDO $pdo The PDO object.
* @return Opt_View
*/
function action($pdo, $config)
{
$view = new Opt_View('add.tpl');
$view->title = 'Add new entry';
$form = new Form($view);
$form->setAction('index.php?action=add');
$form->addField('author', 'required,min_len=3,max_len=30', 'The length must be between 3 and 30 characters.');
$form->addField('email', 'required,email,min_len=3,max_len=100', 'The value must be a valid mail with maximum 100 characters long.');
$form->addField('website', 'url,min_len=3,max_len=100', 'The value must be a valid URL with maximum 100 characters long.');
$form->addField('body', 'required,min_len=3', 'The body must be at least 3 characters long.');
if ($form->validate()) {
$values = $form->getValues();
$stmt = $pdo->prepare('INSERT INTO `entries` (`author`, `email`, `date`, `website`, `body`)
VALUES(:author, :email, :date, :website, :body)');
$stmt->bindValue(':author', $values['author'], PDO::PARAM_STR);
$stmt->bindValue(':email', $values['email'], PDO::PARAM_STR);
$stmt->bindValue(':date', time(), PDO::PARAM_INT);
$stmt->bindValue(':website', $values['website'], PDO::PARAM_STR);
$stmt->bindValue(':body', $values['body'], PDO::PARAM_STR);
$stmt->execute();
$view->setTemplate('message.tpl');
$view->message = 'The entry has been successfully added!';
$view->redirect = 'index.php?action=list';
} else {
// The form is an object, so we need to inform OPT about it.
$view->form = $form;
$view->setFormat('form', 'Objective');
}
return $view;
}
示例7: __construct
public function __construct(BASE_CommentsParams $params, $id, $formName)
{
parent::__construct();
$language = OW::getLanguage();
$form = new Form($formName);
$textArea = new Textarea('commentText');
$textArea->setHasInvitation(true);
$textArea->setInvitation($language->text('base', 'comment_form_element_invitation_text'));
$form->addElement($textArea);
$hiddenEls = array('entityType' => $params->getEntityType(), 'entityId' => $params->getEntityId(), 'displayType' => $params->getDisplayType(), 'pluginKey' => $params->getPluginKey(), 'ownerId' => $params->getOwnerId(), 'cid' => $id, 'commentCountOnPage' => $params->getCommentCountOnPage(), 'isMobile' => 1);
foreach ($hiddenEls as $name => $value) {
$el = new HiddenField($name);
$el->setValue($value);
$form->addElement($el);
}
$submit = new Submit('comment-submit');
$submit->setValue($language->text('base', 'comment_add_submit_label'));
$form->addElement($submit);
$form->setAjax(true);
$form->setAction(OW::getRouter()->urlFor('BASE_CTRL_Comments', 'addComment'));
// $form->bindJsFunction(Form::BIND_SUBMIT, "function(){ $('#comments-" . $id . " .comments-preloader').show();}");
// $form->bindJsFunction(Form::BIND_SUCCESS, "function(){ $('#comments-" . $id . " .comments-preloader').hide();}");
$this->addForm($form);
OW::getDocument()->addOnloadScript("window.owCommentCmps['{$id}'].initForm('" . $textArea->getId() . "', '" . $submit->getId() . "');");
$this->assign('form', true);
$this->assign('id', $id);
}
示例8: loginForm
private function loginForm()
{
$form = new Form();
$form->setAction(Lib_Link::build('login/login'));
$form->addText('userLogin', 'Jmeno:', 10)->addRule(Form::FILLED, 'Vloz svoje uzivatelske jmeno.');
$form->addPassword('userPassword', 'Heslo:', 10)->addRule(Form::FILLED, 'Vloz tvoje heslo.')->addRule(Form::MIN_LENGTH, 'Heslo musi byt dlouhe minimalne %d znaku.', 3);
$form->addSubmit('login', 'Prihlasit');
return $form . '';
}
示例9: __construct
public function __construct($entityType, $entityId, $displayType, $pluginKey, $ownerId, $commentCountOnPage, $id, $cmpContextId, $formName)
{
parent::__construct();
$language = OW::getLanguage();
//comment form init
$form = new Form($formName);
$textArea = new Textarea('commentText');
$form->addElement($textArea);
$entityTypeField = new HiddenField('entityType');
$form->addElement($entityTypeField);
$entityIdField = new HiddenField('entityId');
$form->addElement($entityIdField);
$displayTypeField = new HiddenField('displayType');
$form->addElement($displayTypeField);
$pluginKeyField = new HiddenField('pluginKey');
$form->addElement($pluginKeyField);
$ownerIdField = new HiddenField('ownerId');
$form->addElement($ownerIdField);
$attch = new HiddenField('attch');
$form->addElement($attch);
$cid = new HiddenField('cid');
$form->addElement($cid);
$commentsOnPageField = new HiddenField('commentCountOnPage');
$form->addElement($commentsOnPageField);
$submit = new Submit('comment-submit');
$submit->setValue($language->text('base', 'comment_add_submit_label'));
$form->addElement($submit);
$form->getElement('entityType')->setValue($entityType);
$form->getElement('entityId')->setValue($entityId);
$form->getElement('displayType')->setValue($displayType);
$form->getElement('pluginKey')->setValue($pluginKey);
$form->getElement('ownerId')->setValue($ownerId);
$form->getElement('cid')->setValue($id);
$form->getElement('commentCountOnPage')->setValue($commentCountOnPage);
$form->setAjax(true);
$form->setAction(OW::getRouter()->urlFor('BASE_CTRL_Comments', 'addComment'));
$form->bindJsFunction(Form::BIND_SUBMIT, "function(){ \$('#comments-" . $id . " .comments-preloader').show();}");
$form->bindJsFunction(Form::BIND_SUCCESS, "function(){ \$('#comments-" . $id . " .comments-preloader').hide();}");
$this->addForm($form);
if (BOL_TextFormatService::getInstance()->isCommentsRichMediaAllowed()) {
$attachmentCmp = new BASE_CLASS_Attachment($id);
$this->addComponent('attachment', $attachmentCmp);
}
OW::getDocument()->addOnloadScript("owCommentCmps['{$id}'].initForm('" . $form->getElement('commentText')->getId() . "', '" . $form->getElement('attch')->getId() . "');");
$this->assign('form', true);
$this->assign('id', $id);
if (OW::getUser()->isAuthenticated()) {
$currentUserInfo = BOL_AvatarService::getInstance()->getDataForUserAvatars(array(OW::getUser()->getId()));
$this->assign('currentUserInfo', $currentUserInfo[OW::getUser()->getId()]);
}
}
示例10: index
public function index(array $params = array())
{
$config = OW::getConfig();
$configs = $config->getValues('antibruteforce');
$form = new Form('settings');
$form->setAjax();
$form->setAjaxResetOnSuccess(false);
$form->setAction(OW::getRouter()->urlForRoute('antibruteforce.admin'));
$form->bindJsFunction(Form::BIND_SUCCESS, 'function(data){if(data.result){OW.info("Settings successfuly saved");}else{OW.error("Parser error");}}');
$auth = new CheckboxField('auth');
$auth->setValue($configs['authentication']);
$form->addElement($auth);
$reg = new CheckboxField('reg');
$reg->setValue($configs['registration']);
$form->addElement($reg);
$tryCount = new TextField('tryCount');
$tryCount->setRequired();
$tryCount->addValidator(new IntValidator(1));
$tryCount->setValue($configs['try_count']);
$form->addElement($tryCount);
$expTime = new TextField('expTime');
$expTime->setRequired();
$expTime->setValue($configs['expire_time']);
$expTime->addValidator(new IntValidator(1));
$form->addElement($expTime);
$title = new TextField('title');
$title->setRequired();
$title->setValue($configs['lock_title']);
$form->addElement($title);
$desc = new Textarea('desc');
$desc->setValue($configs['lock_desc']);
$form->addElement($desc);
$submit = new Submit('save');
$form->addElement($submit);
$this->addForm($form);
if (OW::getRequest()->isAjax()) {
if ($form->isValid($_POST)) {
$config->saveConfig('antibruteforce', 'authentication', $form->getElement('auth')->getValue());
$config->saveConfig('antibruteforce', 'registration', $form->getElement('reg')->getValue());
$config->saveConfig('antibruteforce', 'try_count', $form->getElement('tryCount')->getValue());
$config->saveConfig('antibruteforce', 'expire_time', $form->getElement('expTime')->getValue());
$config->saveConfig('antibruteforce', 'lock_title', strip_tags($form->getElement('title')->getValue()));
$config->saveConfig('antibruteforce', 'lock_desc', strip_tags($form->getElement('desc')->getValue()));
exit(json_encode(array('result' => true)));
}
}
}
示例11: __construct
/**
* Constructor.
*
* @param array $itemsList
*/
public function __construct($langId)
{
parent::__construct();
$this->service = BOL_LanguageService::getInstance();
if (empty($langId)) {
$this->setVisible(false);
return;
}
$languageDto = $this->service->findById($langId);
if ($languageDto === null) {
$this->setVisible(false);
return;
}
$language = OW::getLanguage();
$form = new Form('lang_edit');
$form->setAjax();
$form->setAction(OW::getRouter()->urlFor('ADMIN_CTRL_Languages', 'langEditFormResponder'));
$form->setAjaxResetOnSuccess(false);
$labelTextField = new TextField('label');
$labelTextField->setLabel($language->text('admin', 'clone_form_lbl_label'));
$labelTextField->setDescription($language->text('admin', 'clone_form_descr_label'));
$labelTextField->setRequired();
$labelTextField->setValue($languageDto->getLabel());
$form->addElement($labelTextField);
$tagTextField = new TextField('tag');
$tagTextField->setLabel($language->text('admin', 'clone_form_lbl_tag'));
$tagTextField->setDescription($language->text('admin', 'clone_form_descr_tag'));
$tagTextField->setRequired();
$tagTextField->setValue($languageDto->getTag());
if ($languageDto->getTag() == 'en') {
$tagTextField->addAttribute('disabled', 'disabled');
}
$form->addElement($tagTextField);
$rtl = new CheckboxField('rtl');
$rtl->setLabel($language->text('admin', 'lang_edit_form_rtl_label'));
$rtl->setDescription($language->text('admin', 'lang_edit_form_rtl_desc'));
$rtl->setValue((bool) $languageDto->getRtl());
$form->addElement($rtl);
$hiddenField = new HiddenField('langId');
$hiddenField->setValue($languageDto->getId());
$form->addElement($hiddenField);
$submit = new Submit('submit');
$submit->setValue($language->text('admin', 'btn_label_edit'));
$form->addElement($submit);
$form->bindJsFunction(Form::BIND_SUCCESS, "function(data){if(data.result){OW.info(data.message);setTimeout(function(){window.location.reload();}, 1000);}else{OW.error(data.message);}}");
$this->addForm($form);
}
示例12: __construct
public function __construct($userId)
{
parent::__construct();
$form = new Form("send_message_form");
$form->setAjax(true);
$form->setAjaxResetOnSuccess(true);
$form->setAction(OW::getRouter()->urlFor('BASE_CTRL_AjaxSendMessageToEmail', 'sendMessage'));
$user = new HiddenField("userId");
$user->setValue($userId);
$form->addElement($user);
$subject = new TextField('subject');
$subject->setInvitation(OW::getLanguage()->text('base', 'subject'));
$subject->setRequired(true);
$form->addElement($subject);
$textarea = new WysiwygTextarea("message");
$textarea->setInvitation(OW::getLanguage()->text('base', 'message_invitation'));
$requiredValidator = new WyswygRequiredValidator();
$requiredValidator->setErrorMessage(OW::getLanguage()->text('base', 'message_empty'));
$textarea->addValidator($requiredValidator);
$form->addElement($textarea);
$submit = new Submit('send');
$submit->setLabel(OW::getLanguage()->text('base', 'send'));
$form->addElement($submit);
$form->bindJsFunction(Form::BIND_SUCCESS, ' function ( data ) {
if ( data.result )
{
OW.info(data.message);
}
else
{
OW.error(data.message);
}
if ( OW.getActiveFloatBox() )
{
OW.getActiveFloatBox().close();
}
} ');
$this->addForm($form);
}
示例13: __construct
/**
* @param integer $userId
*/
public function __construct($userId)
{
parent::__construct();
$user = BOL_UserService::getInstance()->findUserById((int) $userId);
if (!OW::getUser()->isAuthorized('base') || $user === null) {
$this->setVisible(false);
return;
}
$aService = BOL_AuthorizationService::getInstance();
$roleList = $aService->findNonGuestRoleList();
$form = new Form('give-role');
$form->setAjax(true);
$form->setAction(OW::getRouter()->urlFor('BASE_CTRL_User', 'updateUserRoles'));
$hidden = new HiddenField('userId');
$form->addElement($hidden->setValue($userId));
$userRoles = $aService->findUserRoleList($user->getId());
$userRolesIdList = array();
foreach ($userRoles as $role) {
$userRolesIdList[] = $role->getId();
}
$tplRoleList = array();
/* @var $role BOL_AuthorizationRole */
foreach ($roleList as $role) {
$field = new CheckboxField('roles[' . $role->getId() . ']');
$field->setLabel(OW::getLanguage()->text('base', 'authorization_role_' . $role->getName()));
$field->setValue(in_array($role->getId(), $userRolesIdList));
if (in_array($role->getId(), $userRolesIdList) && $role->getSortOrder() == 1) {
$field->addAttribute('disabled', 'disabled');
}
$form->addElement($field);
$tplRoleList[$role->sortOrder] = $role;
}
ksort($tplRoleList);
$form->addElement(new Submit('submit'));
OW::getDocument()->addOnloadScript("owForms['{$form->getName()}'].bind('success', function(data){\n if( data.result ){\n if( data.result == 'success' ){\n window.baseChangeUserRoleFB.close();\n window.location.reload();\n //OW.info(data.message);\n }\n else if( data.result == 'error'){\n OW.error(data.message);\n }\n }\n\t\t})");
$this->addForm($form);
$this->assign('list', $tplRoleList);
}
示例14: onBeforeRender
public function onBeforeRender()
{
parent::onBeforeRender();
$language = OW::getLanguage();
$form = new Form('inite-friends');
$emailList = new TagsInputField('emailList');
$emailList->setRequired();
$emailList->setDelimiterChars(array(',', ' '));
$emailList->setInvitation($language->text('contactimporter', 'email_field_inv_message'));
$emailList->setJsRegexp('/^(([^<>()[\\]\\.,;:\\s@\\"]+(\\.[^<>()[\\]\\.,;:\\s@\\"]+)*)|(\\".+\\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/');
$form->addElement($emailList);
$text = new Textarea('text');
$text->setValue($language->text('contactimporter', 'email_invite_field_default_text'));
$text->setHasInvitation(true);
$form->addElement($text);
$submit = new Submit('submit');
$form->addElement($submit);
$form->setAction(OW::getRouter()->urlFor('CONTACTIMPORTER_CTRL_Email', 'send'));
$form->setAjax();
$form->setAjaxResetOnSuccess(false);
$form->bindJsFunction(Form::BIND_SUCCESS, "\n function(data){ \n if( data.success ){\n OW.info(data.message);\n owForms['inite-friends'].resetForm();\n window.ciMailFloatBox.close();\n }\n else{\n OW.error(data.message);\n }\n }");
$this->addForm($form);
}
示例15: array
$tab_array[] = array(gettext("Certificate Revocation"), false, "system_crlmanager.php");
display_top_tabs($tab_array);
// Load valid country codes
$dn_cc = array();
if (file_exists("/etc/ca_countries")) {
$dn_cc_file = file("/etc/ca_countries");
foreach ($dn_cc_file as $line) {
if (preg_match('/^(\\S*)\\s(.*)$/', $line, $matches)) {
$dn_cc[$matches[1]] = $matches[1];
}
}
}
if ($act == "new" || $_POST['save'] == gettext("Save") && $input_errors) {
$form = new Form();
if ($act == "csr" || $_POST['save'] == gettext("Update") && $input_errors) {
$form->setAction('system_certmanager.php?act=csr');
$section = new Form_Section('Complete Signing Request');
if (isset($id) && $a_cert[$id]) {
$form->addGlobal(new Form_Input('id', null, 'hidden', $id));
}
$section->addInput(new Form_Input('descr', 'Descriptive name', 'text', $pconfig['descr']));
$section->addInput(new Form_Textarea('csr', 'Signing request data', $pconfig['csr']))->setReadonly()->setHelp('Copy the certificate signing data from here and ' . 'forward it to your certificate authority for signing.');
$section->addInput(new Form_Textarea('cert', 'Final certificate data', $pconfig["cert"]))->setHelp('Paste the certificate received from your certificate authority here.');
$form->add($section);
print $form;
include "foot.inc";
exit;
}
$form->setAction('system_certmanager.php?act=edit');
if (isset($userid) && $a_user) {
$form->addGlobal(new Form_Input('userid', null, 'hidden', $userid));