Example #1
0
 public function render(array $attributes)
 {
     if (empty($attributes['value'])) {
         $attributes['value'] = 'submit';
     }
     return parent::render(new Zodiac_Form_Element_Attribute($attributes), Zodiac_Form_Element_List::SUBMIT);
 }
Example #2
0
 public function render(array $attributes)
 {
     if (!empty($attributes['value'])) {
         $attributes['value'] = '';
     }
     return parent::render(new Zodiac_Form_Element_Attribute($attributes), Zodiac_Form_Element_List::PASSWORD);
 }
Example #3
0
 public function render(array $attributes)
 {
     if (!empty($attributes['value'])) {
         $attributes['checked'] = 'checked';
     }
     return parent::render(new Zodiac_Form_Element_Attribute($attributes), Zodiac_Form_Element_List::RADIO);
 }
Example #4
0
 public function render(array $attributes)
 {
     if (isset($attributes['selectValue']) && $attributes['selectValue'] == $attributes['value']) {
         $attributes['selected'] = 'selected';
     }
     // Only needed this to contain the parent element value
     unset($attributes['selectValue']);
     return parent::render(new Zodiac_Form_Element_Attribute($attributes), Zodiac_Form_Element_List::OPTION);
 }
Example #5
0
 public function render(array $attributes)
 {
     if (isset($attributes['options']) && count($attributes['options'])) {
         $selectValue = isset($attributes['value']) ? $attributes['value'] : '';
         $optionList = array();
         foreach ($attributes['options'] as $name => $value) {
             $option = new Zodiac_Form_Render_Option();
             $options = array('name' => $name, 'value' => $value, 'selectValue' => $selectValue);
             $optionList[] = $option->render($options);
         }
         $attributes['options'] = PHP_EOL . implode(PHP_EOL, $optionList) . PHP_EOL;
     }
     return parent::render(new Zodiac_Form_Element_Attribute($attributes, array('options')), Zodiac_Form_Element_List::SELECT);
 }
Example #6
0
 public function render(array $attributes)
 {
     if (empty($attributes['method'])) {
         $attributes['method'] = 'POST';
     }
     if (empty($attributes['action'])) {
         $ports = array('https' => 443, 'http' => 80);
         $prefix = empty($_SERVER['HTTPS']) || $_SERVER['HTTPS'] == "off" ? 'http' : 'https';
         $action = $prefix . '://' . $_SERVER['HTTP_HOST'];
         $action .= $_SERVER['SERVER_PORT'] != $ports[$prefix] ? ':' . $_SERVER['SERVER_PORT'] : '' . $_SERVER['SCRIPT_NAME'];
         $action .= isset($_SERVER['QUERY_STRING']) && $_SERVER['QUERY_STRING'] != "" ? "?" . $_SERVER['QUERY_STRING'] : "";
         $attributes['action'] = $action;
     }
     return parent::render(new Zodiac_Form_Element_Attribute($attributes), Zodiac_Form_Element_List::FORM);
 }
Example #7
0
 public function render(array $attributes)
 {
     return parent::render(new Zodiac_Form_Element_Attribute($attributes), Zodiac_Form_Element_List::TEXTAREA);
 }