本文整理汇总了PHP中Zend_Form::getSubForm方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form::getSubForm方法的具体用法?PHP Zend_Form::getSubForm怎么用?PHP Zend_Form::getSubForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form
的用法示例。
在下文中一共展示了Zend_Form::getSubForm方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getForm
/**
* Returns form or subform instance
*
* @param mixed $subForm Subform name to return, Numeric value
*
* @return Bvb_Grid_Form
*/
public function getForm($subForm = null)
{
if (!is_null($subForm)) {
return $this->_form->getSubForm($subForm);
}
return $this->_form;
}
示例2: getSubForm
/**
* Get a subform by name.
*
* @param string $formName
* @return Zend_Form
*/
public function getSubForm($formName)
{
$subForm = $this->_form->getSubForm($formName);
if (empty($subForm)) {
/**
* @see Zym_Controller_Action_Helper_MultiPageForm_Exception_FormNotFound
*/
require_once 'Zym/Controller/Action/Helper/MultiPageForm/Exception/FormNotFound.php';
$message = sprintf('No form by the name of "%s" was registered.', $formName);
throw new Zym_Controller_Action_Helper_MultiPageForm_Exception_FormNotFound($message);
}
$subForm->populate($this->getValues($formName));
return $subForm;
}
示例3: setupElements
public function setupElements()
{
$hourForm = $this->form->getSubForm('hour_existing');
$hourForm->clearDecorators();
$hourForm->addDecorator('FormElements');
$newForm = $this->form->getSubForm('hour_new');
$newForm->clearDecorators();
$newForm->addDecorator('FormElements');
foreach ($hourForm->getElements() as $elmKey => $elm) {
$elm->clearDecorators();
$elm->addDecorator(new My_Decorator_Hour());
$elm->addDecorator('HtmlTag', array('tag' => 'li'));
}
foreach ($newForm->getElements() as $elmKey => $elm) {
$elm->clearDecorators();
$elm->addDecorator(new My_Decorator_Hour());
$class = '';
if (strpos($elm->getFullyQualifiedName(), '__unique__') !== false) {
$class = 'template';
}
$elm->addDecorator('HtmlTag', array('tag' => 'li', 'class' => $class));
}
$this->form->addElement('submit', 'submit');
}
示例4: getSubForm
/**
* Get a subform by name.
*
* @param string $formName
* @return Zend_Form
*/
public function getSubForm($formName)
{
// Get the subform by name
$subForm = $this->_form->getSubForm($formName);
if (empty($subForm)) {
/**
* @see Zend_Controller_Action_Exception
*/
require_once 'Zend/Controller/Action/Exception.php';
throw new Zend_Controller_Action_Exception('No form by the name of "' . $formName . '" was registered.');
}
// Populate the subform with session data
$subForm->populate($this->getSessionValues($formName));
// Return the subform
return $subForm;
}
示例5: testCanRemoveSingleSubForm
public function testCanRemoveSingleSubForm()
{
$this->testCanAddAndRetrieveMultipleSubForms();
$this->assertTrue($this->form->removeSubForm('page2'));
$this->assertNull($this->form->getSubForm('page2'));
}
示例6: _formStepCommonPopulate
//.........这里部分代码省略.........
$formData['above_x'] = 'yes';
}
// Bicycle section
//TODO: This should be talking to the quote manager NOT directly to the datasource
$bicycle = new Datasource_Insurance_Policy_Cycles($this->_customerReferenceNumber, $this->_policyNumber);
if ($bicycle->countBikes() > 0) {
$formData['bicycle'] = 'yes';
}
break;
case 3:
// Insured Address section
// Fetch previously stored address
$quoteManager = new Manager_Insurance_TenantsContentsPlus_Quote(null, null, $this->_policyNumber);
$addressArray = $quoteManager->getPropertyAddress();
if ($addressArray['postcode'] != '') {
if (strpos($addressArray['address1'], ',') !== false) {
$formData['ins_house_number_name'] = preg_replace('/,.*$/', '', $addressArray['address1']);
} else {
$formData['ins_house_number_name'] = preg_replace('/ .*$/', '', $addressArray['address1']);
}
$formData['ins_postcode'] = $addressArray['postcode'];
// Look up address again to populate dropdown
$postcodeLookup = new Manager_Core_Postcode();
$addresses = $postcodeLookup->getPropertiesByPostcode(preg_replace('/[^\\w\\ ]/', '', $formData['ins_postcode']));
$addressList = array('' => '--- please select ---');
$filterString = is_numeric($formData['ins_house_number_name']) ? $formData['ins_house_number_name'] . ", " : $formData['ins_house_number_name'];
foreach ($addresses as $address) {
$addressList[$address['id']] = $address['singleLineWithoutPostcode'];
if (stripos($address['singleLineWithoutPostcode'], $filterString) === 0) {
$addressID = $address['id'];
}
}
// Add some validation
$ins_address = $pageForm->getSubForm('subform_insuredaddress')->getElement('ins_address');
$ins_address->setMultiOptions($addressList);
$validator = new Zend_Validate_InArray(array('haystack' => array_keys($addressList)));
$validator->setMessages(array(Zend_Validate_InArray::NOT_IN_ARRAY => 'Insured address does not match with postcode'));
$ins_address->addValidator($validator, true);
// Set the address to selected
$ins_address->setValue($addressID);
$addressID = null;
// Make sure we don't use this again for the correspondance address!
// Upsell Message section
$pageSession = new Zend_Session_Namespace('tenants_insurance_quote');
$session = new Zend_Session_Namespace('homelet_global');
$agentSchemeNumber = $session->agentSchemeNumber;
}
// Correspondance Address section
$customerManager = new Manager_Core_Customer();
$customer = $customerManager->getCustomer(Model_Core_Customer::LEGACY_IDENTIFIER, $this->_customerReferenceNumber);
$addressLine1 = $customer->getAddressLine(Model_Core_Customer::ADDRESSLINE1);
$addressPostcode = $customer->getPostCode();
if ($addressPostcode != '') {
if (strpos($addressLine1, ',') !== false) {
$formData['cor_house_number_name'] = preg_replace('/,.*$/', '', $addressLine1);
} else {
$formData['cor_house_number_name'] = preg_replace('/ .*$/', '', $addressLine1);
}
$formData['cor_postcode'] = $addressPostcode;
// TODO: Surely if this postcode and house number matches the previous one
// we can just tick the YES box and hide the correspondance address form??
$postcodeLookup = new Manager_Core_Postcode();
$addresses = $postcodeLookup->getPropertiesByPostcode(preg_replace('/[^\\w\\ ]/', '', $formData['cor_postcode']));
$addressList = array('' => '--- please select ---');
$filterString = is_numeric($formData['cor_house_number_name']) ? $formData['cor_house_number_name'] . ", " : $formData['cor_house_number_name'];
foreach ($addresses as $address) {
示例7: getSubForm
/**
* Ermittelt ein spezifisches Subform (Subpage)
* @param string $name
* @return Myself_Form_Page_Interface
*/
public function getSubForm($name)
{
$form = parent::getSubForm($name);
if (null !== $form) {
if ($form->isAvailable()) {
return $form;
} else {
// Remove form data from namespace
unset($this->getNamespace()->{$form->getName()});
}
}
return null;
}
示例8: _formStepCommonPopulate
//.........这里部分代码省略.........
// There's a manually entered rebuild value - need to work out if it is because they
// chose £500k+ - or if it's because we don't have a dsi
$premiums = $quoteManager->calculatePremiums();
if ($premiums['calculatedDSIValue'] > 0) {
$formData['override_dsi'] = 1;
}
$formData['building_value'] = $productMeta['rebuild_value'];
}
}
if ($quoteManager->hasProduct(Manager_Insurance_LandlordsPlus_Quote::CONTENTS_COVER) || $quoteManager->hasProduct(Manager_Insurance_LandlordsPlus_Quote::UNFURNISHED_CONTENTS_COVER)) {
$formData['need_contents_insurance'] = 'yes';
if ($quoteManager->hasProduct(Manager_Insurance_LandlordsPlus_Quote::CONTENTS_COVER)) {
$formData['property_furnished'] = 'yes';
$productMeta = $quoteManager->getProductMeta(Manager_Insurance_LandlordsPlus_Quote::CONTENTS_COVER);
$formData['contents_amount'] = $productMeta['cover_amount'];
$formData['contents_excess'] = $productMeta['excess'];
$formData['contents_accidental_damage'] = $productMeta['accidental_damage'];
} else {
$formData['property_furnished'] = 'no';
}
}
break;
case 3:
if (isset($pageSession->completed[$stepNum]) && $pageSession->completed[$stepNum] == true) {
$formData['need_emergency_assistance'] = 'no';
$formData['need_prestige_rent_guarantee'] = 'no';
$formData['need_legal_expenses'] = 'no';
$formData['need_boiler_heating'] = 'no';
}
// If we have contents/buildings cover then EAS is already included for free so we can hide the form
if ($quoteManager->hasProduct(Manager_Insurance_LandlordsPlus_Quote::BUILDING_COVER) || $quoteManager->hasProduct(Manager_Insurance_LandlordsPlus_Quote::CONTENTS_COVER)) {
// Change the subforms view script to one that just says it's already included for free
// yeah yeah.. this aint pretty :(
$emergencyAssistanceForm = $pageForm->getSubForm('subform_emergencyassistance');
$emergencyAssistanceForm->setDecorators(array(array('ViewScript', array('viewScript' => 'subforms/emergency-assistance-free.phtml'))));
if ($quoteManager->hasProduct(Manager_Insurance_LandlordsPlus_Quote::BOILER_HEATING)) {
$formData['need_boiler_heating'] = 'yes';
}
} else {
// We can allow stand-alone EAS - so we hide the boiler and heating section
// yes... this is waaay too complex... I know :(
$pageForm->removeSubForm('subform_boilerheating');
if ($quoteManager->hasProduct(Manager_Insurance_LandlordsPlus_Quote::EMERGENCY_ASSISTANCE)) {
$formData['need_emergency_assistance'] = 'yes';
}
}
if ($quoteManager->hasProduct(Manager_Insurance_LandlordsPlus_Quote::RENT_GUARANTEE)) {
$formData['need_prestige_rent_guarantee'] = 'yes';
$productMeta = $quoteManager->getProductMeta(Manager_Insurance_LandlordsPlus_Quote::RENT_GUARANTEE);
$formData['rent_amount'] = $productMeta['monthly_rent'];
} elseif ($quoteManager->hasProduct(Manager_Insurance_LandlordsPlus_Quote::LEGAL_EXPENSES)) {
$formData['need_legal_expenses'] = 'yes';
}
break;
case 4:
if (isset($pageSession->completed[$stepNum]) && $pageSession->completed[$stepNum] == true) {
// Load underwriting answers from the database as they've already been answered
$answersManager = new Manager_Insurance_Answers();
$quote = $quoteManager->getModel();
$policyNumber = $quote->legacyID;
$customerReferenceNumber = $quote->legacyCustomerID;
$answers = $answersManager->getUnderwritingAnswers($policyNumber);
foreach ($answers as $answer) {
switch ($answer->getQuestionNumber()) {
case '53':
$formData['declaration1'] = $answer->getAnswer();
示例9: subFormRender
/**
* Create an html code from form elements to render a plain text fom.<br />
* This function filter subForms and create the read only view.<br />
* Utilize the elementRender function to do the same with elements.<br />
*
* @param Zend_Form $form The form to transform into readOnlu view.
*
* @return string $this->_html The html code for the elements rendering.
*/
public function subFormRender(Zend_Form $form, $subFormName = "")
{
$subForms = null;
if (!$this->_listOpened) {
$this->_html = $this->_openListTag;
$this->_listOpened = true;
}
if (!empty($subFormName)) {
$subForm = $form->getSubForm($subFormName);
$this->_html .= $this->elementRender($subForm);
} else {
$subForms = $form->getSubForms();
$nbSubForms = count($subForms);
$position = 1;
foreach ($subForms as $subForm) {
$this->_html .= '<fieldset id = "' . $subForm->getId() . '" class="' . $subForm->getAttrib('class') . '">';
$this->_html .= '<legend class="readOnly">';
$this->_html .= $subForm->getLegend();
$this->_html .= '</legend>';
// Do not close the list after rendering elemnts of the sub forms.
$this->_closeList = false;
// Render sub form elements
$this->_html .= $this->elementRender($subForm);
$this->_html .= '</fieldset>';
if ($this->_addSeparator && in_array($position, $this->_separatorPosition)) {
$this->_html .= '<div class="' . $this->_separatorClass . '"></div>';
}
$position++;
}
$this->_html .= $this->_closeListTag;
}
return $this->_html;
}