示例#1
0
 /**
  * View this PHAT_Dropobox
  *
  * The view function provides the HTML for a user to view the PHAT_Dropbox.
  *
  * @param  mixed  $value whatever needed to match in the dropbox
  * @return string The HTML to be shown
  */
 function view($value = NULL)
 {
     $label = $this->getLabel();
     if (isset($_REQUEST['PHAT_' . $label])) {
         $this->setValue($_REQUEST['PHAT_' . $label]);
     }
     if ($this->isRequired()) {
         $viewTags['REQUIRED_FLAG'] = '*';
     }
     $optionText = $this->getOptionText();
     $optionValues = $this->getOptionValues();
     for ($i = 0; $i < sizeof($optionText); $i++) {
         $options[$optionValues[$i]] = $optionText[$i];
     }
     $viewTags['BLURB'] = PHPWS_Text::parseOutput($this->getBlurb(), ENCODE_PARSED_TEXT, false, true);
     $element = new Form_Select('PHAT_' . $label, $options);
     $element->setMatch($this->getValue());
     $element->setId($element->name);
     $viewTags['ID'] = $element->getId();
     $viewTags['DROPBOX'] = $element->get();
     return PHPWS_Template::process($viewTags, 'phatform', 'dropbox/view.tpl');
 }
示例#2
0
 public static function formSelect($name, $opt_array, $match = null, $ignore_index = false, $match_to_value = false, $onchange = null, $label = null)
 {
     $element = new Form_Select($name, $opt_array);
     $element->setMatch($match);
     if ($onchange) {
         $element->setExtra(sprintf('onchange="%s"', $onchange));
     }
     return $element->get();
 }