예제 #1
0
 /**
  * View this PHAT_Multiselect
  *
  * @return string The HTML content to view the PHAT_Multiselect
  * @access public
  */
 function view()
 {
     $label = $this->getLabel();
     if (isset($_REQUEST['PHAT_' . $label]) && is_array($_REQUEST['PHAT_' . $label])) {
         $this->setValue($_REQUEST['PHAT_' . $label]);
     }
     if ($this->isRequired()) {
         $viewTags['REQUIRED_FLAG'] = '*';
     }
     $viewTags['BLURB'] = PHPWS_Text::parseOutput($this->_blurb, ENCODE_PARSED_TEXT, false, true);
     $optionText = $this->getOptionText();
     $optionValues = $this->getOptionValues();
     for ($i = 0; $i < sizeof($optionText); $i++) {
         $options[$optionValues[$i]] = $optionText[$i];
     }
     $multiselect = new Form_Multiple('PHAT_' . $label, $options);
     $multiselect->setMatch($this->getValue());
     $multiselect->setId($multiselect->name);
     $viewTags['ID'] = $multiselect->getId();
     $viewTags['MULTISELECT'] = $multiselect->get();
     return PHPWS_Template::processTemplate($viewTags, 'phatform', 'multiselect/view.tpl');
 }
예제 #2
0
 public static function formMultipleSelect($name, $opt_array, $match = null, $ignore_index = false, $match_to_value = false, $onchange = null, $label = null)
 {
     $element = new Form_Multiple($name, $opt_array);
     $element->setMatch($match);
     if ($onchange) {
         $element->setExtra(sprintf('onchange="%s"', $onchange));
     }
     return $element->get();
 }