예제 #1
0
 public function phoneElement($name, $value = null, $attribs = null)
 {
     $areanum = $geonum = $localnum = '';
     if ($value) {
         list($areanum, $geonum, $localnum) = split('-', $value);
     }
     $helper = new Zend_View_Helper_FormText();
     $helper->setView($this->view);
     $this->html .= $helper->formText($name . '[areanum]', $areanum, array('size' => 3, 'maxlength' => 3));
     $this->html .= $helper->formText($name . '[geonum]', $geonum, array('size' => 3, 'maxlength' => 3));
     $this->html .= $helper->formText($name . '[localnum]', $localnum, array('size' => 4, 'maxlength' => 4));
     return $this->html;
 }
예제 #2
0
 public function phoneElement($name, $value = null, $attribs = null)
 {
     $a = $b = $c = '';
     $helper = new Zend_View_Helper_FormText();
     $helper->setView($this->view);
     if ($value) {
         list($a, $b, $c) = split('-', $value);
     }
     $this->html .= $helper->formText($name . '[a]', $a, array('size' => 3, 'maxlenght' => 3));
     $this->html .= $helper->formText($name . '[b]', $b, array('size' => 3, 'maxlenght' => 3));
     $this->html .= $helper->formText($name . '[c]', $c, array('size' => 3, 'maxlenght' => 3));
     return $this->html;
 }
예제 #3
0
 public function phoneElement($name, $value = null, $attribs = null)
 {
     $areanum = $geonum = $localnum = '';
     $helper = new Zend_View_Helper_FormText();
     $helper->setView($this->view);
     if (is_array($value)) {
         $areanum = isset($value['areanum']) ? $value['areanum'] : '';
         $geonum = isset($value['geonum']) ? $value['geonum'] : '';
         $localnum = isset($value['localnum']) ? $value['localnum'] : '';
     }
     $this->html .= $helper->formText($name . '[areanum]', $areanum, array());
     $this->html .= $helper->formText($name . '[geonum]', $geonum, array());
     $this->html .= $helper->formText($name . '[localnum]', $localnum, array());
     return $this->html;
 }
예제 #4
0
 /**
  * @param string $name the name of the form element.
  * @param string $value the value of the form element.
  * @param array $arrtibs the attribs for the form element.
  * @return string $_xhtml the rendered xhtml for this form element.
  */
 public function ssnElement($name, $value = null, $attribs = null)
 {
     // take the incoming SSN string break it up into three pieces for the
     // three elements that will make the composite element.
     $areanum = $groupnum = $serialnum = '';
     if ($value) {
         $areanum = substr($value, 0, 3);
         $groupnum = substr($value, 3, 2);
         $serialnum = substr($value, 5, 4);
     }
     // Use Zend_View_Helper_FormText to build the elements that will form
     // the composite element.
     $helper = new Zend_View_Helper_FormText();
     // Must assign a view since we are outside zend's normal MVC structure.
     $helper->setView($this->view);
     // Create the xhtml
     $this->_xhtml .= $helper->formText($name . '[areanum]', $areanum, array('size' => 3, 'maxlength' => 3));
     $this->_xhtml .= $helper->formText($name . '[groupnum]', $groupnum, array('size' => 2, 'maxlength' => 2));
     $this->_xhtml .= $helper->formText($name . '[serialnum]', $serialnum, array('size' => 4, 'maxlength' => 4));
     return $this->_xhtml;
 }
예제 #5
0
 /**
  * Generates a 'text' element.
  *
  * @access public
  *
  * @param string|array $name If a string, the element name.  If an
  * array, all other parameters are ignored, and the array elements
  * are used in place of added parameters.
  *
  * @param mixed $value The element value.
  *
  * @param array $attribs Attributes for the element tag.
  *
  * @return string The element XHTML.
  */
 public function formTextOverwrite($name, $value = null, $attribs = null)
 {
     $info = $this->_getInfo($name, $value, $attribs);
     extract($info);
     // name, value, attribs, options, listsep, disabled
     $viewHelperFormCheckbox = new Zend_View_Helper_FormCheckbox();
     $viewHelperFormCheckbox->setView($this->view);
     $viewHelperFormElement = new Zend_View_Helper_FormText();
     $viewHelperFormElement->setView($this->view);
     $checked = '';
     if ($attribs['overwrite']) {
         $checked = 'checked';
         $disabled = true;
         unset($attribs['overwrite']);
     } else {
         $disabled = false;
         if (isset($attribs['class']) && $attribs['class'] != '') {
             $attribs['class'] = $attribs['class'] . ' disabled';
         } else {
             $attribs['class'] = 'disabled';
         }
     }
     $separator = '';
     if (isset($attribs['separator'])) {
         $separator = $attribs['separator'];
         unset($attribs['separator']);
     }
     $xhtml = '<div class="input-prepend">';
     $xhtml .= '<label class="add-on">';
     $xhtml .= $viewHelperFormCheckbox->formCheckbox($name . '[overwrite]', null, array_merge($attribs, array('checked' => $checked, 'class' => 'checkbox text-overwrite-checkbox')));
     $xhtml .= '</label>';
     $xhtml .= ' ' . $separator;
     if (!$disabled) {
         $xhtml .= $viewHelperFormElement->formText($name . '[value]', $value, array_merge($attribs, array('disabled' => 'disabled')));
     } else {
         $xhtml .= $viewHelperFormElement->formText($name . '[value]', $value, $attribs);
     }
     $xhtml .= '</div>';
     return $xhtml;
 }