本文整理汇总了PHP中Zend_Form::getView方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form::getView方法的具体用法?PHP Zend_Form::getView怎么用?PHP Zend_Form::getView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form
的用法示例。
在下文中一共展示了Zend_Form::getView方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getForm
/**
* Генерирует форму для заполнения доп данных
* @return Zend_Form $form Форма для завершения регистрации
*/
public function getForm($params)
{
$form = new Zend_Form();
// Устанавливаем декораторы
$form->setAction($form->getView()->url($params, 'auth_openid_complete'))->setAttrib('id', 'zend_form');
//Email
$email = new Zend_Form_Element_Text('email');
$email->setRequired(true)->addValidator('EmailAddress', false, array('domain' => false))->addValidator(new ZendExtra_Validate_Email())->setOptions(array('domain' => false))->setLabel('Email:')->setDescription($form->getView()->translate('Enter email for recieving password'))->setAttrib('onBlur', 'validate(this);');
$form->addElement($email);
// Кнопка "Отправить"
$submit = new Zend_Form_Element_Text('submit');
$html = '<dt></dt><dd><a class="btn-base btn-normal" href="javascript:;" onClick=\'$("#zend_form").submit();\'><span></span>' . $form->getView()->translate('submit') . '</a></dd>';
$submit->setDecorators(array('decorator' => array('br' => new ZendExtra_Form_Decorator_HtmlCode(array('tag' => $html, 'placement' => Zend_Form_Decorator_Abstract::PREPEND)))))->setOrder(100);
$form->addElement($submit);
return $form;
}
示例2: _recursivelyPrepareForm
protected function _recursivelyPrepareForm(Zend_Form $form)
{
$belongsTo = $form instanceof Zend_Form ? $form->getElementsBelongTo() : null;
$elementContent = '';
$separator = $this->getSeparator();
$translator = $form->getTranslator();
$view = $form->getView();
foreach ($form as $item) {
$item->setView($view)->setTranslator($translator);
if ($item instanceof Zend_Form_Element) {
$item->setBelongsTo($belongsTo);
} elseif (!empty($belongsTo) && $item instanceof Zend_Form) {
if ($item->isArray()) {
$name = $this->mergeBelongsTo($belongsTo, $item->getElementsBelongTo());
$item->setElementsBelongTo($name, true);
} else {
$item->setElementsBelongTo($belongsTo, true);
}
$this->_recursivelyPrepareForm($item);
} elseif (!empty($belongsTo) && $item instanceof Zend_Form_DisplayGroup) {
foreach ($item as $element) {
$element->setBelongsTo($belongsTo);
}
}
}
}
示例3: testCanSetView
public function testCanSetView()
{
$view = new Zend_View();
$this->assertNull($this->form->getView());
$this->form->setView($view);
$received = $this->form->getView();
$this->assertSame($view, $received);
}
示例4: testCanSetView
public function testCanSetView()
{
$view = new View\PhpRenderer();
$test = $this->form->getView();
$this->assertNotSame($view, $test);
$this->form->setView($view);
$received = $this->form->getView();
$this->assertSame($view, $received);
}
示例5: testFormShouldEnableView
public function testFormShouldEnableView()
{
$form = new Zend_Form();
$view = new Zend_View();
$form->setView($view);
$this->assertFalse(false !== $form->getView()->getPluginLoader('helper')->getPaths('ZendX_JQuery_View_Helper'));
ZendX_JQuery::enableForm($form);
$this->assertTrue(false !== $form->getView()->getPluginLoader('helper')->getPaths('ZendX_JQuery_View_Helper'));
}
示例6: enableForm
/**
* Dojo-enable a form instance
*
* @param Zend_Form $form
* @return void
*/
public static function enableForm(Zend_Form $form)
{
$form->addPrefixPath('Zend_Dojo_Form_Decorator', 'Zend/Dojo/Form/Decorator', 'decorator')->addPrefixPath('Zend_Dojo_Form_Element', 'Zend/Dojo/Form/Element', 'element')->addElementPrefixPath('Zend_Dojo_Form_Decorator', 'Zend/Dojo/Form/Decorator', 'decorator')->addDisplayGroupPrefixPath('Zend_Dojo_Form_Decorator', 'Zend/Dojo/Form/Decorator')->setDefaultDisplayGroupClass('Zend_Dojo_Form_DisplayGroup');
foreach ($form->getSubForms() as $subForm) {
self::enableForm($subForm);
}
if (null !== ($view = $form->getView())) {
self::enableView($view);
}
}
示例7: enableForm
/**
* jQuery-enable a form instance
*
* @param \Zend_Form $form
* @return void
*/
public static function enableForm(\Zend_Form $form)
{
$form->addPrefixPath('ZendX_JQuery_Form_Decorator', 'ZendX/JQuery/Form/Decorator', 'decorator')->addPrefixPath('ZendX_JQuery_Form_Element', 'ZendX/JQuery/Form/Element', 'element')->addElementPrefixPath('ZendX_JQuery_Form_Decorator', 'ZendX/JQuery/Form/Decorator', 'decorator')->addDisplayGroupPrefixPath('ZendX_JQuery_Form_Decorator', 'ZendX/JQuery/Form/Decorator');
foreach ($form->getSubForms() as $subForm) {
self::enableForm($subForm);
}
if (null !== ($view = $form->getView())) {
self::enableView($view);
}
}
示例8: testIfViewIsSetInTime
/**
* @group ZF-10149
*/
public function testIfViewIsSetInTime()
{
try {
$form = new Zend_Form(array('view' => new MyTestView()));
$this->assertTrue($form->getView() instanceof MyTestView);
$form = new Zend_Form(array('view' => new StdClass()));
$this->assertNull($form->getView());
$result = $form->render();
} catch (Zend_Form_Exception $e) {
$this->fail('Setting a view object using the options array should not throw an exception');
}
$this->assertNotEquals($result, '');
}
示例9: getView
/** @inheritdoc */
public function getView()
{
if (null === $this->_view) {
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
if (!$viewRenderer->view) {
$view = new Zend_View();
$view->doctype('XHTML1_STRICT');
$viewRenderer->setView($view);
}
}
return parent::getView();
}