• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List

E:/E/GEAMP/www/openbiz/openbiz/others/Zend/View/Helper/FormButton.php

00001 <?php
00027 require_once 'Zend/View/Helper/FormElement.php';
00028 
00029 
00039 class Zend_View_Helper_FormButton extends Zend_View_Helper_FormElement
00040 {
00056     public function formButton($name, $value = null, $attribs = null)
00057     {
00058         $info    = $this->_getInfo($name, $value, $attribs);
00059         extract($info); // name, id, value, attribs, options, listsep, disable
00060 
00061         // Get content
00062         $content = '';
00063         if (isset($attribs['content'])) {
00064             $content = $attribs['content'];
00065             unset($attribs['content']);
00066         } else {
00067             $content = $value;
00068         }
00069 
00070         // Ensure type is sane
00071         $type = 'button';
00072         if (isset($attribs['type'])) {
00073             $attribs['type'] = strtolower($attribs['type']);
00074             if (in_array($attribs['type'], array('submit', 'reset', 'button'))) {
00075                 $type = $attribs['type'];
00076             }
00077             unset($attribs['type']);
00078         }
00079 
00080         // build the element
00081         if ($disable) {
00082             $attribs['disabled'] = 'disabled';
00083         }
00084 
00085         $content = ($escape) ? $this->view->escape($content) : $content;
00086 
00087         $xhtml = '<button'
00088                 . ' name="' . $this->view->escape($name) . '"'
00089                 . ' id="' . $this->view->escape($id) . '"'
00090                 . ' type="' . $type . '"';
00091 
00092         // add a value if one is given
00093         if (!empty($value)) {
00094             $xhtml .= ' value="' . $this->view->escape($value) . '"';
00095         }
00096 
00097         // add attributes and close start tag
00098         $xhtml .= $this->_htmlAttribs($attribs) . '>';
00099 
00100         // add content and end tag
00101         $xhtml .= $content . '</button>';
00102 
00103         return $xhtml;
00104     }
00105 }

Generated on Thu Apr 19 2012 17:01:18 for openbiz by  doxygen 1.7.2