本文整理汇总了PHP中Zend_Form::getAction方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form::getAction方法的具体用法?PHP Zend_Form::getAction怎么用?PHP Zend_Form::getAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form
的用法示例。
在下文中一共展示了Zend_Form::getAction方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkMarkup
public function checkMarkup($html)
{
$this->assertFalse(empty($html));
$this->assertContains('<form', $html);
$this->assertRegexp('/<form[^>]+action="' . $this->form->getAction() . '"/', $html);
$this->assertRegexp('/<form[^>]+method="' . $this->form->getMethod() . '"/i', $html);
$this->assertRegexp('#<form[^>]+enctype="application/x-www-form-urlencoded"#', $html);
$this->assertContains('</form>', $html);
}
示例2: testCanSetObjectStateByPassingConfigObjectToConstructor
public function testCanSetObjectStateByPassingConfigObjectToConstructor()
{
$config = new Zend_Config($this->getOptions());
$form = new Zend_Form($config);
$this->assertEquals('foo', $form->getName());
$this->assertEquals('someform', $form->getAttrib('class'));
$this->assertEquals('/foo/bar', $form->getAction());
$this->assertEquals('put', $form->getMethod());
}
示例3: getFormAsArray
/**
* Return an array of form elements.
*
* @param Zend_Form $form
* @return array
*/
public function getFormAsArray(Zend_Form $form)
{
$array = array();
$array['action'] = $form->getAction();
$array['method'] = $form->getMethod();
foreach ($form->getElements() as $element) {
$element->removeDecorator('HtmlTag');
$element->removeDecorator('Label');
$element->removeDecorator('DtDdWrapper');
$array[$element->getName()] = $element;
}
return $array;
}
示例4: getForm
/**
* @param unknown_type $formName
* @param unknown_type $options
* @throws Exception
* @return Zend_Form
*/
public function getForm($formName, $options = null, $useTemplate = false)
{
if (is_null(self::$_forms)) {
if (is_file(APPLICATION_PATH . '/configs/forms.ini')) {
$config = new Zend_Config_Ini(APPLICATION_PATH . '/configs/forms.ini');
} else {
$config = new Zend_Config(include_once APPLICATION_PATH . '/configs/forms.php');
}
$config = $config->toArray();
self::$_forms = $config;
}
if (!array_key_exists($formName, $config)) {
throw new Exception("Form not exist");
}
if ($useTemplate) {
//$form = new Zend_Form_Template($config[$formName]);
//$form->setTemplate($formName, $options);
$form = new Zend_Form($config[$formName]);
$elements = $form->getElements();
foreach ($elements as &$element) {
$element->removeDecorator('Label');
$element->removeDecorator('HtmlTag');
$element->removeDecorator('DtDdWrapper');
$element->removeDecorator('Description');
$element->removeDecorator('Errors');
$element->addDecorator(array('data' => 'Errors'), array('tag' => 'p', 'class' => 'description'));
}
$filter = new Zend_Filter_Word_CamelCaseToDash();
$formName = $filter->filter($formName);
$options['viewScript'] = 'forms/' . $formName . '.phtml';
$form->setDecorators(array(array('viewScript', $options)));
} else {
$form = new Zend_Form($config[$formName]);
/* $form->addElementPrefixPath('Zend_Decorator',
'Zend/Decorator/',
'decorator');
$form->setDecorators(array('Default'));*/
//Zend_Debug::dump($form->getDecorator('Errors'));
/*$elements = $form->getElements();
foreach ($elements as &$element) {
$element->setDecorators(
array(
'ViewHelper',
'Errors',
array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element')),
'Label',
array(array('row' => 'HtmlTag'), array('tag' => 'li'))
)
);
//Zend_Debug::dump($element->getDecorator('Errors'));
};*/
/*
$form->setElementDecorators(array(
'ViewHelper',
array('Errors', array('class' => 'help-inline control-error')),
array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'controls')),
array(array('label' => 'Label'), array('class' => 'control-label')),
array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'control-group')),
));
*/
// $form->addElement("text", "naem", $opt);
/* $form->setDecorators(array(
'FormElements',
array('Form', array('class' => 'form-horizontal'))
));*/
//Zend_Debug::dump($form);
// вынести декораторы
}
$formAction = $form->getAction();
$routes = $this->getRouterNames();
$actionParams = array();
if (is_array($options) && array_key_exists('actionParams', $options)) {
$actionParams = $options['actionParams'];
}
if (in_array($formAction, $routes)) {
if (array_key_exists("actionParams", $config[$formName]) && is_array($config[$formName]['actionParams'])) {
$actionParams = $config[$formName]['actionParams'];
}
$form->setAction($this->_url($actionParams, $formAction));
}
//Zend_Debug::dump($form);
return $form;
}