Ejemplo n.º 1
0
 /**
  * Returns the HTML for the parameter input.
  * 
  * @since 0.4.6
  * 
  * @return string
  */
 public function getHtml()
 {
     $valueList = array();
     if (is_array($this->param->getAllowedValues())) {
         $valueList[] = $this->param->getAllowedValues();
     }
     // Compat code, will got in 0.7
     foreach ($this->param->getCriteria() as $criterion) {
         if ($criterion instanceof CriterionInArray) {
             $valueList[] = $criterion->getAllowedValues();
         }
     }
     if (count($valueList) > 0) {
         // Compat code, will got in 0.7
         $valueList = count($valueList) > 1 ? call_user_func_array('array_intersect', $valueList) : $valueList[0];
         $html = $this->param->isList() ? $this->getCheckboxListInput($valueList) : $this->getSelectInput($valueList);
     } else {
         switch ($this->param->getType()) {
             case Parameter::TYPE_CHAR:
             case Parameter::TYPE_FLOAT:
             case Parameter::TYPE_INTEGER:
             case Parameter::TYPE_NUMBER:
                 $html = $this->getNumberInput();
                 break;
             case Parameter::TYPE_BOOLEAN:
                 $html = $this->getBooleanInput();
                 break;
             case Parameter::TYPE_STRING:
             default:
                 $html = $this->getStrInput();
                 break;
         }
     }
     return $html;
 }