Example #1
0
 protected function renderFormTextfield($asName, &$aForm)
 {
     $sName = FlexiParser::parseHTMLInputName($asName);
     $mValue = isset($aForm["#value"]) ? $aForm["#value"] : "";
     $mValue = FlexiParser::parseHTMLInputValue($mValue);
     //$sTheme = isset($a
     return (isset($aForm["#prefix"]) ? $aForm["#prefix"] : "") . "<input type=\"text\" name=\"" . $sName . "\"" . (empty($mValue) ? "" : "value=\"" . $mValue . "\"") . ">" . (isset($aForm["#suffix"]) ? $aForm["#suffix"] : "");
 }
Example #2
0
 /**
  * Filtering hook to cleanup a single form field setting and value
  *  before being displayed
  * @param array $aValue
  * @param String $asName field name
  */
 protected function renderFilterForm(&$aValue, $asName)
 {
     $this->renderFilterMarkup($aValue);
     $mValue = null;
     if ($aValue["#type"] != "form") {
         $bIsTextArea = $aValue["#type"] == "textarea" || $aValue["#type"] == "html" || $aValue["#type"] == "textarea.raw" || $aValue["#type"] == "html.raw" ? true : false;
         if (isset($aValue["#value"]) && !$bIsTextArea) {
             //echo $asName . ": using value";
             $mValue = $aValue["#value"];
             $aValue["#value"] = FlexiParser::parseHTMLInputValue($mValue);
         }
         if (isset($aValue["#default_value"]) && !$bIsTextArea) {
             //echo $asName . ": using default";
             $mValue = $aValue["#default_value"];
             $aValue["#default_value"] = FlexiParser::parseHTMLInputValue($mValue);
         }
     }
     if ($aValue["#type"] == "checkbox" || $aValue["#type"] == "checkbox.raw") {
         if (!isset($aValue["#return_value"])) {
             $aValue["#return_value"] = 1;
         }
     }
     if ($aValue["#type"] == "form") {
         $aValue["#method"] = isset($aValue["#method"]) ? $aValue["#method"] : "get";
         if ($aValue["#upload"]) {
             $aValue["#method"] = "post";
             $aValue["#enctype"] = "multipart/form-data";
         }
     }
     //throw checking
     if (($aValue["#type"] == "select" || $aValue["#type"] == "select.raw") && !is_null($mValue)) {
         $bMultiple = isset($aValue["#multiple"]) ? $aValue["#multiple"] : false;
         if ($bMultiple && !is_array($mValue)) {
             throw new FlexiException("Form:" . $asName . " value must be of type array for multiple select:" . serialize($mValue), ERROR_DATATYPE);
         }
     }
     if (($aValue["#type"] == "checkboxes" || $aValue["#type"] == "checkboxes.raw") && !is_null($mValue) && !is_array($mValue)) {
         throw new FlexiException("Form:" . $asName . " value must be of type array for checkboxes:" . serialize($mValue), ERROR_DATATYPE);
     }
 }
Example #3
0
 public static function attributesToString($aAttributes, $asDelimiter = "\"")
 {
     if (is_null($aAttributes)) {
         return "";
     }
     $aResult = array();
     foreach ($aAttributes as $sKey => $sValue) {
         $mValue = FlexiParser::parseHTMLInputValue($sValue, $asDelimiter);
         $aResult[] = $sKey . "=" . $asDelimiter . $mValue . $asDelimiter;
     }
     return implode(" ", $aResult);
 }
Example #4
0
			$bSelected = false;
			if($bMultiple && is_array($mValue)) {
				if (in_array($sKeyValue, $mValue))
				{ $bSelected = true; } 
			} else { 
				if ($sKeyValue == $mValue) { $bSelected = true; }
			}
			?>
		<option value="<?php 
echo $sKeyValue;
?>
" <?php 
echo $bSelected ? " selected" : "";
?>
><?php 
echo FlexiParser::parseNoHTML($sOption);
?>
</option>
	<? 
		}
	} else {
    
    if (!$bMultiple) {
      if (!empty($mValue)) {
      ?>
      <option value="<?php 
echo $mValue;
?>
"><?php 
echo $mValue;
?>