当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Form::setAction方法代码示例

本文整理汇总了PHP中Zend_Form::setAction方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form::setAction方法的具体用法?PHP Zend_Form::setAction怎么用?PHP Zend_Form::setAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Form的用法示例。


在下文中一共展示了Zend_Form::setAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: FormAdminGeneric

    /**
     * Returns the HTML for creating a form powered by JavaScript (or straight one).
     * The CSS, JS and other is included.
     *
     * @param Zend_Form $form The form object
     * @param Boolean $jsStayOnPage Should we post as a service and stay on the same page
     * @param String $srvurl The URL to post the data to or NONE will build the URL automatically
     */
    public function FormAdminGeneric(Zend_Form $form, $jsStayOnPage = true, $srvurl = '')
    {
        $formname = $form->getName();
        if ($srvurl == '') {
            $srvurl = '/' . $this->view->moduleName . '/services/edit' . $formname . '/format/json';
        }
        $form->setAction($srvurl);
        $html = '';
        if ($jsStayOnPage) {
            $html .= '
		<script>
		$(function(){
			$(\'#' . $formname . '\').formvalidator({\'url\':\'' . $srvurl . '\'});
		});
		</script>
		';
        }
        $html .= '
		<div class="box">
			<fieldset>
				' . $form . '
			</fieldset>
		</div>
		';
        return $html;
    }
开发者ID:Cryde,项目名称:sydney-core,代码行数:34,代码来源:FormAdminGeneric.php

示例2: createAssetstoreForm

 /** Create assetstore form */
 public function createAssetstoreForm()
 {
     $form = new Zend_Form();
     $action = $this->webroot . '/assetstore/add';
     $form->setAction($action);
     $form->setName('assetstoreForm');
     $form->setMethod('post');
     $form->setAttrib('class', 'assetstoreForm');
     // Name of the assetstore
     $inputDirectory = new Zend_Form_Element_Text('name', array('label' => $this->t('Give a name'), 'id' => 'assetstorename'));
     $inputDirectory->setRequired(true);
     $form->addElement($inputDirectory);
     // Input directory
     $basedirectory = new Zend_Form_Element_Text('basedirectory', array('label' => $this->t('Pick a base directory'), 'id' => 'assetstoreinputdirectory'));
     $basedirectory->setRequired(true);
     $form->addElement($basedirectory);
     // Assetstore type
     $assetstoretypes = array('0' => $this->t('Managed by MIDAS'), '1' => $this->t('Remotely linked'));
     // Amazon support is not yet implemented, don't present it as an option
     //                          '2' => $this->t('Amazon S3'));
     $assetstoretype = new Zend_Form_Element_Select('assetstoretype', array('id' => 'assetstoretype'));
     $assetstoretype->setLabel('Select a type')->setMultiOptions($assetstoretypes);
     // Add a loading image
     $assetstoretype->setDescription('<div class="assetstoreLoading" style="display:none"><img src="' . $this->webroot . '/core/public/images/icons/loading.gif"/></div>')->setDecorators(array('ViewHelper', array('Description', array('escape' => false, 'tag' => false)), array('HtmlTag', array('tag' => 'dd')), array('Label', array('tag' => 'dt')), 'Errors'));
     $form->addElement($assetstoretype);
     // Submit
     $addassetstore = new Zend_Form_Element_Submit('addassetstore', $this->t('Add this assetstore'));
     $form->addElement($addassetstore);
     return $form;
 }
开发者ID:josephsnyder,项目名称:Midas,代码行数:31,代码来源:AssetstoreForm.php

示例3: editAction

 public function editAction()
 {
     $configForm = $this->getInvokeArg('bootstrap')->getResource('configForm');
     $userForm = new Zend_Form($configForm->user);
     $userId = $this->getRequest()->getParam('id', null);
     if ($this->getRequest()->isPost()) {
         if ($userForm->isValid($_POST)) {
             try {
                 $values = $userForm->getValues();
                 unset($values['password_repeat']);
                 $userId = $this->userRepository->saveEntity($values);
                 $this->_helper->systemMessages('notice', 'Nutzer erfolgreich gespeichert');
             } catch (\Exception $e) {
                 $log = $this->getInvokeArg('bootstrap')->log;
                 $log->log($e->getMessage(), \Zend_Log::ERR, array('trace' => $e->getTraceAsString()));
                 $this->_helper->systemMessages('error', 'Nutzer konnte nicht gespeichert werden');
             }
         }
     } else {
         try {
             $entity = $this->userRepository->fetchEntity($userId);
             $userForm->populate($entity->toArray());
         } catch (\Exception $e) {
             throw new \Exception($e->getMessage(), 404);
         }
     }
     $userForm->setAction('/admin/user/edit/' . $userId);
     $this->view->form = $userForm;
 }
开发者ID:kromeyer,项目名称:MMK-Newsroom,代码行数:29,代码来源:UserController.php

示例4: form

 function form()
 {
     if (!isset($this->form)) {
         $form = new Zend_Form();
         $form->setAction($this->url());
         $form->setMethod('post');
         // Create and configure username element:
         $username = $form->createElement('text', 'username');
         $username->setLabel("Username");
         $username->addValidator('alnum');
         $username->addValidator('regex', false, array('/^[a-z]+/'));
         $username->addValidator('stringLength', false, array(6, 20));
         $username->setRequired(true);
         $username->addFilter('StringToLower');
         // Create and configure password element:
         $password = $form->createElement('password', 'password');
         $password->setLabel("Password");
         $password->addValidator('StringLength', false, array(6));
         $password->setRequired(true);
         // Add elements to form:
         $form->addElement($username);
         $form->addElement($password);
         // use addElement() as a factory to create 'Login' button:
         $form->addElement('submit', 'login', array('label' => 'Login'));
         // Since we're using this outside ZF, we need to supply a default view:
         $form->setView(new Zend_View());
         $this->form = $form;
     }
     return $this->form;
 }
开发者ID:RussellDias,项目名称:konstrukt,代码行数:30,代码来源:index.php

示例5: removeAction

 public function removeAction()
 {
     $form = new Zend_Form();
     $form->setView(new Zend_View());
     $form->setMethod('post');
     $form->setAction('');
     $form->setAttrib('class', 'devel');
     $form->setAttrib('title', 'Remove wizard - ' . $this->getRequest()->getParam('name'));
     $handleOptions = explode(',', $this->getRequest()->getParam('handles'));
     $referenceOptions = explode(',', $this->getRequest()->getParam('references'));
     $handleOptionsUsed = explode(',', $this->getRequest()->getParam('handles_used'));
     $handleOptionsHidden = $form->createElement('hidden', 'handles', array('decorators' => array('ViewHelper')));
     $referenceOptionsHidden = $form->createElement('hidden', 'references', array('decorators' => array('ViewHelper')));
     $handleOptionsUsedHidden = $form->createElement('hidden', 'handles_used', array('decorators' => array('ViewHelper')));
     $handle = $form->createElement('radio', 'handle', array('label' => 'Handle', 'required' => true, 'multiOptions' => array_combine($handleOptions, $handleOptions), 'description' => 'NOTE: This are the handles that this block appears in: ' . $this->getRequest()->getParam('handles_used')));
     $reference = $form->createElement('radio', 'reference', array('label' => 'Reference', 'required' => true, 'multiOptions' => array_combine($referenceOptions, $referenceOptions)));
     $name = $form->createElement('text', 'name', array('label' => 'Name', 'required' => true));
     $submit = $form->createElement('submit', 'submit', array('label' => 'Submit'));
     $form->addElements(array($handleOptionsHidden, $referenceOptionsHidden, $handleOptionsUsedHidden, $handle, $reference, $name, $submit));
     if ($form->isValid($this->getRequest()->getParams())) {
         $localXmlWriter = Mage::getModel('devel/writer_localxml');
         $localXmlWriter->addRemove($form->handle->getValue(), $form->reference->getValue(), $form->name->getValue());
         $localXmlWriter->save();
         die('DONE. You need to reload to see changes!');
     } else {
         $this->loadLayout();
         $this->getLayout()->getUpdate()->load('devel_layout_wizard');
         $this->getLayout()->generateXml();
         $this->loadLayout();
         $this->getLayout()->getBlock('devel_wizard_form')->setForm($form);
         $this->renderLayout();
     }
 }
开发者ID:votanlean,项目名称:Magento-Pruebas,代码行数:33,代码来源:LayoutController.php

示例6: loginAction

 public function loginAction()
 {
     $configForm = $this->getInvokeArg('bootstrap')->getResource('configForm');
     $loginForm = new \Zend_Form($configForm->login);
     if ($this->getRequest()->isPost()) {
         if ($loginForm->isValid($_POST)) {
             try {
                 $auth = $this->getInvokeArg('bootstrap')->auth;
                 $auth->setIdentity($loginForm->getValue('login'))->setCredential($loginForm->getValue('password'));
                 $result = \Zend_Auth::getInstance()->authenticate($auth);
                 if ($result->isValid()) {
                     $this->_redirect('/admin');
                 } else {
                     $this->_helper->systemMessages('error', 'Anmeldung verweigert');
                 }
             } catch (\Exception $e) {
                 $log = $this->getInvokeArg('bootstrap')->log;
                 $log->log($e->getMessage(), \Zend_Log::ERR, array('trace' => $e->getTraceAsString()));
                 $this->_helper->systemMessages('error', 'Fehler bei der Anmeldung');
             }
         }
     }
     $loginForm->setAction('/login');
     $this->view->form = $loginForm;
 }
开发者ID:kromeyer,项目名称:MMK-Newsroom,代码行数:25,代码来源:IndexController.php

示例7: detailAction

 public function detailAction()
 {
     $newsUrl = $this->getRequest()->getParam('url', null);
     try {
         $news = $this->newsRepository->fetchEntityByUrl($newsUrl);
     } catch (\Exception $e) {
         throw new \Exception($e->getMessage(), 404);
     }
     $this->view->headTitle($news->headline);
     $this->view->headMeta()->setName('description', $this->_helper->truncate($news->content, 255));
     $configForm = $this->getInvokeArg('bootstrap')->getResource('configForm');
     $commentForm = new \Zend_Form($configForm->comment);
     if ($this->getRequest()->isPost()) {
         if ($commentForm->isValid($_POST)) {
             try {
                 $values = $commentForm->getValues();
                 unset($values['csrf']);
                 unset($values['firstname']);
                 # SpamDetection
                 $values['news'] = $news;
                 $this->commentRepository->saveEntity($values);
                 $commentForm->reset();
                 #$this->_helper->systemMessages('notice', 'Kommentar erfolgreich gespeichert');
             } catch (\Exception $e) {
                 $log = $this->getInvokeArg('bootstrap')->log;
                 $log->log($e->getMessage(), \Zend_Log::ERR, array('trace' => $e->getTraceAsString()));
                 #$this->_helper->systemMessages('error', 'Kommentar konnte nicht gespeichert werden');
             }
         }
     }
     $commentForm->setAction('/news/' . $newsUrl);
     $this->view->form = $commentForm;
     $this->view->news = $news;
 }
开发者ID:kromeyer,项目名称:MMK-Newsroom,代码行数:34,代码来源:NewsController.php

示例8: _collectionsForm

 /**
  * This returns the form for the collections.
  *
  * @return Zend_Form
  * @author Eric Rochester <erochest@virginia.edu>
  **/
 protected function _collectionsForm()
 {
     $ctable = $this->_helper->db->getTable('Collection');
     $private = (int) get_option('solr_search_display_private_items');
     if ($private) {
         $collections = $ctable->findAll();
     } else {
         $collections = $ctable->findBy(array('public' => 1));
     }
     $form = new Zend_Form();
     $form->setAction(url('solr-search/collections'))->setMethod('post');
     $collbox = new Zend_Form_Element_MultiCheckbox('solrexclude');
     $form->addElement($collbox);
     foreach ($collections as $c) {
         $title = metadata($c, array('Dublin Core', 'Title'));
         $collbox->addMultiOption("{$c->id}", $title);
     }
     $etable = $this->_helper->db->getTable('SolrSearchExclude');
     $excludes = array();
     foreach ($etable->findAll() as $exclude) {
         $excludes[] = "{$exclude->collection_id}";
     }
     $collbox->setValue($excludes);
     $form->addElement('submit', 'Exclude');
     return $form;
 }
开发者ID:fitnycdigitalinitiatives,项目名称:SolrSearch,代码行数:32,代码来源:AdminController.php

示例9: testCanSetActionWithGetParams

 /**
  * @issue ZF-7067
  */
 public function testCanSetActionWithGetParams()
 {
     $this->testActionDefaultsToEmptyString();
     $this->form->setAction('/foo.php?bar')->setView(new Zend_View());
     $html = $this->form->render();
     $this->assertContains('action="/foo.php?bar"', $html);
     $this->assertEquals('/foo.php?bar', $this->form->getAction());
 }
开发者ID:vicfryzel,项目名称:zf,代码行数:11,代码来源:FormTest.php

示例10: formAction

 public function formAction()
 {
     $form = new Zend_Form();
     $form->setAction('/resource/process')->setMethod('post');
     $form->setAttrib('id', 'login');
     $form->addElement('text', 'username');
     echo $form;
     exit;
 }
开发者ID:laiello,项目名称:xinhuxi,代码行数:9,代码来源:IndexController.php

示例11: indexAction

 function indexAction()
 {
     $this->setupCache('default');
     $this->level = 500;
     $this->requirePriviledges();
     $this->toTpl('theInclude', 'profile');
     $data = $this->_request->getParams();
     $this->toTpl('module_title', $this->t('Profile of') . " " . $data['profile']);
     //check if the user is trying to view his profile
     $edit = false;
     if ($data['profile'] == 'me' || !$data['profile'] || $data['profile'] == 'index') {
         $profile = $_SESSION['user']['username'];
         $edit = true;
     } else {
         $profile = $data['profile'];
         $edit = false;
     }
     //try to get the user...
     $user = $this->getUserByName($profile);
     //now we need to get the data for this user
     $user['data'] = $this->getUserData($user['id']);
     //now if the user is viewing his profile, we need to create a nice form in order for him to edit the data
     if ($edit) {
         //get the fields
         $fields = $this->getUserProfileFields();
         $form = new Zend_Form();
         $form->setView($this->tpl);
         $form->setAttrib('class', 'form');
         $form->removeDecorator('dl');
         $form->setAction($this->config->host->folder . '/profiles/update')->setMethod('post');
         foreach ($fields as $k => $v) {
             switch ($v['field_type']) {
                 case "selectbox":
                     $values = explode(",", $v['default_value']);
                     break;
                 default:
                     $values = $v['default_value'];
                     break;
             }
             $form->addElement($this->getFormElement(array('name' => $v['name'], 'value' => $v['field_type'], 'title' => $this->t(ucfirst($v['name'])), 'use_pool' => 'valuesAsKeys', 'pool_type' => $values, 'novalue' => true), $user['data'][$v['name']]));
         }
         $form->addElement($this->getFormElement(array('name' => 'uid', 'value' => 'hidden'), $user['id']));
         $submit = new Zend_Form_Element_Submit('save');
         $submit->setLabel($this->t("Update"));
         $submit->setAttrib('class', "btn btn-primary");
         $form->addElement($submit);
         $form = $this->doQoolHook('pre_assign_user_profile_form', $form);
         $this->toTpl('formTitle', $this->t("Update your profile"));
         $this->toTpl('theForm', $form);
         $user = $this->doQoolHook('pre_assign_profiles_own_user_data', $user);
     } else {
         $user = $this->doQoolHook('pre_assign_profiles_user_data', $user);
     }
     $this->doQoolHook('pre_load_profiles_tpl');
     $this->toTpl('user', $user);
 }
开发者ID:basdog22,项目名称:Qool,代码行数:56,代码来源:ProfilesController.php

示例12: _getForm

 protected function _getForm()
 {
     $form = new Zend_Form();
     $form->setAction($this->view->baseUrl('/contact'));
     $form->addElement(new Zend_Form_Element_Text('name', array('label' => 'Name', 'required' => true)));
     $form->addElement(new Zend_Form_Element_Text('email', array('label' => 'E-mail', 'required' => true)));
     $form->addElement(new Zend_Form_Element_Textarea('body', array('label' => 'Question / feedback', 'required' => true)));
     $form->addElement(new Zend_Form_Element_Submit('submit', array('label' => 'Send')));
     return $form;
 }
开发者ID:jtietema,项目名称:Fizzy,代码行数:10,代码来源:ContactController.php

示例13: createCreateAgreementForm

 /**
  * Create create_agreement form.
  *
  * @param  string $community_id
  * @return Zend_Form
  */
 public function createCreateAgreementForm($community_id)
 {
     $form = new Zend_Form();
     $form->setAction($this->webroot . '/communityagreement/community/agreementtab?communityId=' . $community_id)->setMethod('post');
     $agreement = new Zend_Form_Element_Textarea('agreement');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel($this->t('Save'));
     $form->addElements(array($agreement, $submit));
     return $form;
 }
开发者ID:josephsnyder,项目名称:Midas,代码行数:16,代码来源:CommunityForm.php

示例14: testRenderElement

 public function testRenderElement()
 {
     $form = new Zend_Form();
     $form->addElement($this->element);
     $view = new Zend_View();
     $view->addHelperPath('Application/View/Helper', 'Application_View_Helper');
     $form->setAction('/foo.php?bar')->setView($view);
     $html = $form->render();
     $this->assertContains('<input type="date" name="foo" id="foo" value="" disabled="1">', $html);
 }
开发者ID:aporat,项目名称:application_form_element_input,代码行数:10,代码来源:InputTest.php

示例15: createMigrateForm

 /** Main form */
 public function createMigrateForm($assetstores)
 {
     // Setup the form
     $form = new Zend_Form();
     $form->setAction('migratemidas2');
     $form->setName('migrateForm');
     $form->setMethod('post');
     $form->setAttrib('class', 'migrateForm');
     // Input directory
     $midas2_hostname = new Zend_Form_Element_Text('midas2_hostname', array('label' => $this->t('MIDAS2 Hostname'), 'size' => 60, 'value' => 'localhost'));
     $midas2_hostname->setRequired(true);
     $form->addElement($midas2_hostname);
     $midas2_port = new Zend_Form_Element_Text('midas2_port', array('label' => $this->t('MIDAS2 Port'), 'size' => 4, 'value' => '5432'));
     $midas2_port->setRequired(true);
     $midas2_port->setValidators(array(new Zend_Validate_Digits()));
     $form->addElement($midas2_port);
     $midas2_user = new Zend_Form_Element_Text('midas2_user', array('label' => $this->t('MIDAS2 User'), 'size' => 60, 'value' => 'midas'));
     $midas2_user->setRequired(true);
     $form->addElement($midas2_user);
     $midas2_password = new Zend_Form_Element_Password('midas2_password', array('label' => $this->t('MIDAS2 Password'), 'size' => 60, 'value' => 'midas'));
     $midas2_password->setRequired(true);
     $form->addElement($midas2_password);
     $midas2_database = new Zend_Form_Element_Text('midas2_database', array('label' => $this->t('MIDAS2 Database'), ' size' => 60, 'value' => 'midas'));
     $midas2_database->setRequired(true);
     $form->addElement($midas2_database);
     $midas2_assetstore = new Zend_Form_Element_Text('midas2_assetstore', array('label' => $this->t('MIDAS2 Assetstore Path'), 'size' => 60, 'value' => 'C:/xampp/midas/assetstore'));
     $midas2_assetstore->setRequired(true);
     $form->addElement($midas2_assetstore);
     // Button to select the directory on the server
     $midas2_assetstore_button = new Zend_Form_Element_Button('midas2_assetstore_button', $this->t('Choose'));
     $midas2_assetstore_button->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'class' => 'browse-button')), array('Label', array('tag' => 'div', 'style' => 'display:none'))));
     $form->addElement($midas2_assetstore_button);
     // Assetstore
     $assetstoredisplay = array();
     $assetstoredisplay[0] = $this->t('Choose one...');
     // Initialize with the first type (MIDAS)
     foreach ($assetstores as $assetstore) {
         if ($assetstore->getType() == 0) {
             $assetstoredisplay[$assetstore->getAssetstoreId()] = $assetstore->getName();
         }
     }
     $assetstore = new Zend_Form_Element_Select('assetstore');
     $assetstore->setLabel($this->t('MIDAS3 Assetstore'));
     $assetstore->setMultiOptions($assetstoredisplay);
     $assetstore->setDescription(' <a class="load-newassetstore" href="#newassetstore-form" rel="#newassetstore-form" title="' . $this->t('Add a new assetstore') . '"> ' . $this->t('Add a new assetstore') . '</a>')->setDecorators(array('ViewHelper', array('Description', array('escape' => false, 'tag' => false)), array('HtmlTag', array('tag' => 'dd')), array('Label', array('tag' => 'dt')), 'Errors'));
     $assetstore->setRequired(true);
     $assetstore->setValidators(array(new Zend_Validate_GreaterThan(array('min' => 0))));
     $assetstore->setRegisterInArrayValidator(false);
     // This array is dynamic so we disable the validator
     $form->addElement($assetstore);
     // Submit
     $submit = new Zend_Form_Element_Button('migratesubmit', $this->t('Migrate'));
     $form->addElement($submit);
     return $form;
 }
开发者ID:josephsnyder,项目名称:Midas,代码行数:56,代码来源:MigrateForm.php


注:本文中的Zend_Form::setAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。