本文整理汇总了PHP中Zend_Form_SubForm::addElementPrefixPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_SubForm::addElementPrefixPath方法的具体用法?PHP Zend_Form_SubForm::addElementPrefixPath怎么用?PHP Zend_Form_SubForm::addElementPrefixPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_SubForm
的用法示例。
在下文中一共展示了Zend_Form_SubForm::addElementPrefixPath方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getParameters
/**
* get all the custom parameter fields
*/
public static function getParameters($panelId, $form)
{
$parametersForm = new Zend_Form_SubForm();
// Get the list field
$fields = Doctrine::getTable('Panels')->find($panelId, Doctrine_Core::HYDRATE_ARRAY);
$parameters = !empty($fields['params']) ? json_decode($fields['params'], true) : array();
// Set the decorator
$parametersForm->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
foreach ($parameters as $field => $value) {
// Create the custom field
$parametersForm->addElement('text', $field, array('filters' => array('StringTrim'), 'label' => $field, 'decorators' => array('Composite'), 'class' => 'form-control', 'value' => $value));
}
// Add the subform
$form->addSubForm($parametersForm, 'parameters');
return $form;
}
示例2: createRegistrarForm
/**
* Create the custom registrars parameters
*
* @param integer $attribute_group_id
*/
public static function createRegistrarForm($form, $registrar_name)
{
$config = null;
$attributeForm = new Zend_Form_SubForm();
$attributeForm->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
$configfile = PROJECT_PATH . "/library/Shineisp/Plugins/Registrars/" . $registrar_name . "/config.xml";
if (file_exists($configfile)) {
$config = simplexml_load_file($configfile);
foreach ($config->settings->children() as $node) {
$arr = $node->attributes();
$var = strtolower($config['var']) . "_" . (string) $arr['var'];
$label = (string) $arr['label'];
$type = (string) $arr['type'];
$description = (string) $arr['description'];
$default = (string) $arr['default'];
$required = (string) $arr['required'];
if (!empty($var) && !empty($label) && !empty($type)) {
// Create the element
$attributeForm->addElement($type, $var, array('label' => $label, 'class' => 'form-control', 'decorators' => array('Bootstrap'), 'description' => $description));
if ($required) {
$attributeForm->getElement($var)->setRequired(true);
}
// Handle the default option items for the dropdown selector
if ($type == "select") {
$items = trim((string) $node);
$data = !empty($items) ? json_decode($items, true) : array();
$attributeForm->getElement($var)->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions($data);
}
if (!empty($default)) {
$attributeForm->getElement($var)->setValue($default);
}
$form->addSubForm($attributeForm, 'settings');
}
}
}
return array($form, $config);
}
示例3: init
public function init()
{
// Set the custom decorator
$this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
$translate = Shineisp_Registry::get('Zend_Translate');
$this->addElement('textarea', 'note', array('filters' => array('StringTrim'), 'required' => false, 'decorators' => array('Bootstrap'), 'rows' => 5, 'description' => $translate->_('Write here a message for the administrator about this domain.'), 'class' => 'form-control'));
$this->addElement('text', 'tags', array('filters' => array('StringTrim'), 'required' => false, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Tags'), 'class' => 'form-control large-input tags'));
$this->addElement('text', 'authinfocode', array('filters' => array('StringTrim'), 'required' => false, 'decorators' => array('Bootstrap'), 'label' => $translate->_('Authinfo'), 'class' => 'form-control medium-input'));
$this->addElement('select', 'autorenew', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Autorenew'), 'description' => $translate->_('By default, every domain is set with auto-renew option enabled. Choose if the domain must be auto-renew or not at the expiring date.'), 'class' => 'form-control large-input'));
$this->getElement('autorenew')->setAllowEmpty(false)->setMultiOptions(array('1' => $translate->_('Yes, I would like to renew the domain at the expiration date.'), '0' => $translate->_('No, I am not interested in the renew.')));
$status = $this->addElement('select', 'status_id', array('label' => $translate->_('Status'), 'decorators' => array('Bootstrap'), 'class' => 'form-control large-input'));
$status = $this->getElement('status_id')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Statuses::getList('domains'));
$this->addElement('submit', 'submit', array('label' => $translate->_('Save'), 'decorators' => array('Bootstrap'), 'class' => 'btn btn-primary btn-lg'));
// Adding a subform
$dnsform = new Zend_Form_SubForm();
// Set the decorator
$dnsform->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
$dnsform->addElement('text', 'subdomain', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Subdomain'), 'class' => 'form-control medium-input'));
$dnsform->addElement('select', 'zones', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('DNS Type Zone'), 'class' => 'form-control large-input'));
$dnsform->getElement('zones')->setAllowEmpty(false)->setMultiOptions(Dns_Zones_Types::getZones());
$dnsform->addElement('text', 'target', array('filters' => array('StringTrim'), 'decorators' => array('Bootstrap'), 'label' => $translate->_('Target Address'), 'class' => 'form-control large-input'));
$this->addSubForm($dnsform, 'dnsform');
$id = $this->addElement('hidden', 'domain_id');
}
示例4: createAttributesElements
/**
* Create the attribute elements
*
*
* @param integer $attribute_group_id
*/
private function createAttributesElements($form, $group_id)
{
$attributeForm = new Zend_Form_SubForm();
$attributeForm->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
if (is_numeric($group_id)) {
// Get all the elements
$elements = ProductsAttributesGroups::getAttributesProfiles($group_id, $this->session->langid);
if (!empty($elements[0])) {
foreach ($elements as $element) {
if (!empty($element['ProductsAttributes'])) {
// Check the label
$label = !empty($element['ProductsAttributes']['ProductsAttributesData'][0]['label']) ? $element['ProductsAttributes']['ProductsAttributesData'][0]['label'] : $element['ProductsAttributes']['code'];
$description = !empty($element['ProductsAttributes']['ProductsAttributesData'][0]['description']) ? $element['ProductsAttributes']['ProductsAttributesData'][0]['description'] : "";
// Create the element
$attributeForm->addElement($element['ProductsAttributes']['type'], $element['ProductsAttributes']['code'], array('label' => $label, 'class' => 'form-control', 'decorators' => array('Composite'), 'description' => $description));
if ($element['ProductsAttributes']['is_required']) {
$attributeForm->getElement($element['ProductsAttributes']['code'])->setRequired(true);
}
// Handle the default option items for the dropdown selector
if ($element['ProductsAttributes']['type'] == "select") {
$data = !empty($element['ProductsAttributes']['defaultvalue']) ? json_decode($element['ProductsAttributes']['defaultvalue'], true) : array();
$attributeForm->getElement($element['ProductsAttributes']['code'])->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions($data);
} else {
$attributeForm->getElement($element['ProductsAttributes']['code'])->setValue($element['ProductsAttributes']['defaultvalue']);
}
}
}
$form->addSubForm($attributeForm, 'attributes');
}
}
return $form;
}
示例5: getElements
/**
* get all the custom external fields
*/
public static function getElements(Zend_Form $form, $section = "customers", $panel_id = null)
{
$attributeForm = new Zend_Form_SubForm();
// Get the list field
$fields = Doctrine_Query::create()->from('CustomAttributes ca')->andWhere("ca.section = ?", $section)->andWhere('ca.panel_id = ? OR ca.panel_id IS ?', array(intval($panel_id), null))->execute(array(), Doctrine_Core::HYDRATE_ARRAY);
// Set the decorator
$attributeForm->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
foreach ($fields as $field) {
// Create the custom field
$attributeForm->addElement($field['type'], $field['var'], array('filters' => array('StringTrim'), 'label' => $field['label'], 'decorators' => array('Composite'), 'class' => 'form-control'));
}
// Add the subform
$form->addSubForm($attributeForm, 'attributes');
return $form;
}