function indexAction() { if ($this->_request->getPost('submit')) { $feild1 = $this->_request->getPost('feild1'); $feild2 = $this->_request->getPost('feild2'); $feild3 = $this->_request->getPost('feild3'); $feild4 = $this->_request->getPost('feild4'); $feild5 = $this->_request->getPost('feild5'); $feild6 = $this->_request->getPost('feild6'); $feild7 = $this->_request->getPost('feild7'); $feild8 = $this->_request->getPost('feild8'); $feild9 = $this->_request->getPost('feild9'); $customization = new settings_Model_Customization(); $tableName = $customization->getSubmodule($feild8); foreach ($tableName as $tableName1) { $tNmae = "ourbank_" . $tableName1->submodule_description . "_extended"; } $form_id = $customization->insert(array('module_id' => $feild7, 'submodule_id' => $feild8, 'feild_name' => $feild1, 'display_name' => $feild2, 'legend_id' => 1, 'feild_type' => $feild3, 'table_name' => $feild9, 'data_type' => $feild4, 'mandatory' => $feild5, 'display' => $feild5), "ourbank_customizingform"); $feildDetails = $customization->gettableDetails($form_id); foreach ($feildDetails as $feildDetails) { $feild_name = $feildDetails->feild_name; $data_type = $feildDetails->data_type; } foreach ($tableName as $tableName1) { $customization->createTable($tNmae, $feild_name, $data_type, $tableName1->submodule_description . "_extended"); } $this->_redirect('settings/customization'); } }
public function __construct($options = null) { Zend_Dojo::enableForm($this); parent::__construct(); $cust = new settings_Model_Customization(); $sample = $cust->fetchcustomized(); foreach ($sample as $cust1) { switch ($cust1['feild_type']) { case "text": $Instance = new Zend_Form_Element_Text($cust1['feild_name']); $Instance->setLabel($cust1['display_name']); $Instance->setAttrib('size', '8'); if ($cust1['feild_name']) { $Instance->setRequired(true)->setDecorators(array('ViewHelper', array('Description', array('tag' => '', 'escape' => false)), 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td', 'requiredSuffix' => ' *')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); } break; case "radio": $Instance = new Zend_Form_Element_Radio($cust1['feild_name']); $Instance->setLabel($cust1['display_name']); $appliesTo = $cust->getTableInfo($cust1['table_name']); foreach ($appliesTo as $appliesTo1) { foreach ($appliesTo as $key => $value) { $i = 1; foreach ($value as $key1 => $value1) { if ($i % 2 == 0) { //faltu start $f2 = $appliesTo1[$key1]; } else { $f1 = $appliesTo1[$key1]; } $Instance->addMultiOption($f1, $f2); $i++; } //faltu end } } if ($cust1['feild_name']) { $Instance->setRequired(true)->addValidators(array(array('NotEmpty')))->setDecorators(array('ViewHelper', array('Description', array('tag' => '', 'escape' => false)), 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td', 'requiredSuffix' => ' *')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); } break; case "select": $Instance = new Zend_Form_Element_Select($cust1['feild_name']); $Instance->setLabel($cust1['display_name']); $appliesTo = $cust->getTableInfo($cust1['table_name']); foreach ($appliesTo as $appliesTo1) { foreach ($appliesTo as $key => $value) { $i = 1; foreach ($value as $key1 => $value1) { if ($i % 2 == 0) { //faltu start $f2 = $appliesTo1[$key1]; } else { $f1 = $appliesTo1[$key1]; } $Instance->addMultiOption($f1, $f2); $i++; } //faltu end } } if ($cust1['feild_name']) { $Instance->setRequired(true)->addValidators(array(array('NotEmpty')))->setDecorators(array('ViewHelper', array('Description', array('tag' => '', 'escape' => false)), 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td', 'requiredSuffix' => ' *')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); } break; case "description": $Instance = new Zend_Form_Element_Textarea($cust1['feild_name'], array('rows' => 3, 'cols' => 20)); $Instance->setLabel($cust1['display_name']); if ($cust1['feild_name']) { $Instance->setRequired(true)->addValidators(array(array('NotEmpty')))->setDecorators(array('ViewHelper', array('Description', array('tag' => '', 'escape' => false)), 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td', 'requiredSuffix' => ' *')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); } break; case "checkbox": $Instance = new Zend_Form_Element_MultiCheckbox($cust1['feild_name']); $Instance->setLabel($cust1['display_name']); $appliesTo = $cust->getTableInfo($cust1['table_name']); foreach ($appliesTo as $appliesTo1) { foreach ($appliesTo as $key => $value) { $i = 1; foreach ($value as $key1 => $value1) { if ($i % 2 == 0) { //faltu starta $f2 = $appliesTo1[$key1]; } else { $f1 = $appliesTo1[$key1]; } $Instance->addMultiOption($f1, $f2); $i++; } //faltu end } } if ($cust1['feild_name']) { $Instance->setRequired(true)->addValidators(array(array('NotEmpty')))->setDecorators(array('ViewHelper', array('Description', array('tag' => '', 'escape' => false)), 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td', 'requiredSuffix' => ' *')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); } break; } $this->addElements(array($Instance)); } }