Example #1
0
	function showFieldForm($field,$content,$default)
	{
		$return = "";
		
		$strtitle = TText::_($field->title);
		$strtitle = htmlspecialchars($strtitle);

		$name = $field->name;
		$fieldname = $field->name;
		$value = @$content->$fieldname;
		if (is_string($value)) {
		$value = TText::_($value);
		}
		
		if (($value == "")&&(isset($default)))
		{
			$default = (object) $default;
			$value = @$default->$fieldname;
			$value = TText::_($value);
		}
		$disabled="";
		$read_only="";
		
		$options = $field->options;
		
        //We initialize the placeholder if they exist, if not we let it empty
        if(isset($options->placeholder_form) && $options->placeholder_form != ""){
            $placeholder = htmlspecialchars($options->placeholder_form);
        } else {
            $placeholder = "";
        }
		$values = array();
		if ((!isset($options))||
			(!isset($options->select_values_storage_type))||
			($options->select_values_storage_type == "internal")) {
			if (@$this->field_values[$field->fieldid]) {
				$values = $this->field_values[$field->fieldid];
			}
		} else if ($options->select_values_storage_type == "db") {
			$dbname = $options->select_db_storage_db_name;
			$_name = $options->select_db_storage_column_name;
			$_value = $options->select_db_storage_column_value;
			//$parent = $options->select_db_storage_column_parent_value;
			$sql = "SELECT `$_name` as fieldtitle,`$_value` as fieldvalue FROM $dbname";
			$this->_db->setQuery($sql);
			$values = $this->_db->loadObjectList();
		}

		foreach($values as $key => $val) {
				$values[$key]->fieldtitle = htmlspecialchars(TText::_($val->fieldtitle));
		}
		
        $return .= "<div class=\"controls\">";
		switch($field->type)
		{
			case 'checkbox':
				if ($field->required == 1)
					$mosReq = "required";
				else
					$mosReq = "";
				if ($value == 1)
					$return .= "<input class='inputbox' type='checkbox' $mosReq  checked='checked' id='$name' name='$name' value='1' />\n";
				else
					$return .= "<input class='inputbox' type='checkbox' $mosReq  name='$name' id='$name' value='1' />\n";
                break;
			case 'multicheckbox':
			case 'multicheckboximage':
				$k = 0;
				$return .= "<table>";
				for ($i=0 ; $i < $field->rows;$i++)
				{
					$return .= "<tr>";
					for ($j=0 ; $j < $field->cols;$j++)
					{
						$return .= "<td>";
						$fieldvalue = @$values[$k]->fieldvalue;
						$fieldtitle = @$values[$k]->fieldtitle;
						if ($field->type == 'multicheckbox') {
							if (isset($fieldtitle))
								$fieldtitle=TText::_($fieldtitle);
						}
						else
						{	
							$fieldtitle = "<img src=\"{$this->baseurl}images/com_adsmanager/fields/$fieldtitle\" alt=\"$fieldtitle\" />";
						} 
						if (isset($values[$k]->fieldtitle))
						{
							if (($field->required == 1)&&($k==0))
								$mosReq = "required";
							else
								$mosReq = "";
							if (is_array($value)) {
								$value = ",".implode(',',$value).",";
							}
							
                            $return .= "<label class=\"checkbox\">";
							if ((strpos($value, ",".$fieldvalue.",") === false) &&
								(strpos($value, $fieldtitle."|*|") === false) &&
								(strpos($value, "|*|".$fieldtitle) === false) &&
								($value !=  $fieldtitle))
								$return .= "<input class='inputbox' type='checkbox' $mosReq  id='".$name."[]' name='".$name."[]' value=\"".htmlspecialchars($fieldvalue)."\" />&nbsp;$fieldtitle&nbsp;\n";
							else
								$return .= "<input class='inputbox' type='checkbox' $mosReq  id='".$name."[]' checked='checked' name='".$name."[]' value=\"".htmlspecialchars($fieldvalue)."\" />&nbsp;$fieldtitle&nbsp;\n";
							$return .= "</label>";
						}
						$return .= "</td>";
						$k++;
					}
					$return .= "</tr>";
				}
				$return .= "</table>";
				break;


			case 'date':
				$options = array();
				$options['size'] = 25;
				$options['maxlength'] = 19;
				if ($field->required == 1) {
					$options['class'] = 'adsmanager_required';
					$options['mosReq'] = '1';
					$options['mosLabel'] = "$strtitle";
				}
				else 
				{
					$options['class'] = 'adsmanager';
				}
				$return .= JHTML::_('behavior.calendar');
                
				/*if ($value != "") {
					if (function_exists("strptime")) {
						$a = strptime($value, TText::_('ADSMANAGER_DATE_FORMAT_LC'));
						$timestamp = mktime(0, 0, 0, $a['tm_mon']+1, $a['tm_mday'], $a['tm_year']+1900);
					} else {
						$timestamp = strtotime($value);
					}
					if ($timestamp != null)
						$value = date("Y-m-d",$timestamp);
					else
						$value = "";
				}*/
				$return .=  JHTML::_('calendar', "", "$field->name", "$field->name", TText::_('ADSMANAGER_DATE_FORMAT_LC'), $options);
				$return .= "<script type='text/javascript'>jQ(document).ready(function() {jQ('#".$field->name."').val(".json_encode($value).");});</script>";
				//$return = "<input $class type='text' name='$field->name' id='$field->name' size='25' maxlength='19' value='$value' readonly=true/>";
				//$return .= "<input name='reset' type='reset' class='button' onclick=\"return showCalendar('$field->name', '%y-%m-%d');\" value='...' />";
				//$return .= $return;
                break;
			
			case 'editor':
                $editor = JFactory::getEditor();
				$return .= $editor->display($field->name, $value, '', '', $field->cols, $field->rows);
                break;
		
			case 'select':
				if ($field->editable == 0)
					$disabled = "disabled=true";
				else
					$disabled = "";
				
				if ($field->required == 1)
					$return .= "<select id='$name' name='$name' required  class='adsmanager_required form-control' $disabled>\n";
				else
					$return .= "<select id='$name' name='$name'  class='adsmanager form-control' $disabled>\n";
					
				if (($field->required == 0)||($value=="")) {
					$return .= "<option value=''>".$placeholder."</option>\n";	
				}
				foreach($values as $v)
				{
					$ftitle = $v->fieldtitle;
					if (($value == $v->fieldvalue)||($value == $ftitle))
						$return .= "<option value=\"".htmlspecialchars($v->fieldvalue)."\" selected='selected' >".$ftitle."</option>\n";
					else
						$return .= "<option value=\"".htmlspecialchars($v->fieldvalue)."\" >".$ftitle."</option>\n";
				}
				
				$return .= "</select>";
				break;
				
			case 'multiselect':
				if ($field->editable == 0)
					$disabled = "disabled=true";
				else
					$disabled = "";
                
				if ($field->required == 1)
					$return .= "<select id=\"".$name."[]\" name=\"".$name."[]\" required  multiple='multiple' size='$field->size' class='adsmanager_required form-control' $disabled>";
				else
					$return .= "<select id='".$name."[]' name=\"".$name."[]\"  multiple='multiple' size='$field->size' class='adsmanager form-control' $disabled>";
					
				if (($field->required == 0)||($value=="")) {
					$return .= "<option value=''>".$placeholder."</option>\n";
				}
				foreach($values as $v)
				{
					$ftitle = $v->fieldtitle;
					if ($field->required == 1)
						$mosReq = "required";
						
					if ((strpos($value, ",".$v->fieldvalue.",") === false) &&
						(strpos($value, $ftitle."|*|") === false) &&
						(strpos($value, "|*|".$ftitle) === false) &&
						($value !=  $ftitle))
						$return .= "<option value=\"".htmlspecialchars($v->fieldvalue)."\" >$ftitle</option>\n";
					else
						$return .= "<option value=\"".htmlspecialchars($v->fieldvalue)."\" selected='selected' >$ftitle</option>\n";
				}
				
				$return .= "</select>";
				break;
				
			case 'textarea':
				if ($field->editable == 0)
					$read_only = "readonly=true";
				else
					$read_only = "";

				if ($field->required == 1)
					$return .= "<textarea class='adsmanager_required form-control' required  id='$name' name='$name' cols='".$field->cols."' rows='".$field->rows."' wrap='VIRTUAL' placeholder=\"$placeholder\" onkeypress='CaracMax(this, $field->maxlength) ;' $read_only>".htmlspecialchars($value)."</textarea>\n"; 
				else
					$return .= "<textarea class='adsmanager form-control' id='$name'  name='$name' cols='".$field->cols."' rows='".$field->rows."' wrap='VIRTUAL' placeholder=\"$placeholder\" onkeypress='CaracMax(this, $field->maxlength) ;' $read_only>".htmlspecialchars($value)."</textarea>\n"; 	
                break;
			
			case 'url':
				if ($field->editable == 0)
					$recontent_only = "readonly=true";
				else
					$recontent_only = "";
				
                if(!isset($options->display_prefix) || $options->display_prefix == 1){
                    $return .= "<div class=\"input-prepend\">";
                    $return .= "<span class=\"add-on\">http://</span>";
                }
				if ($field->required == 1)
					$return .= "<input class='adsmanager_required form-control' required id='$field->name' type='text'  name='$field->name' size='$field->size' maxlength='$field->maxlength' $recontent_only value=\"".htmlspecialchars($value)."\" placeholder=\"$placeholder\" />\n"; 
				else
					$return .= "<input class='adsmanager form-control' id='$field->name' type='text' name='$field->name'  size='$field->size' maxlength='$field->maxlength' $recontent_only value=\"".htmlspecialchars($value)."\" placeholder=\"$placeholder\" />\n";
				if(!isset($options->display_prefix) || $options->display_prefix == 1){
                    $return .= "</div>";
                }
                break;
		
			case 'number':
                if ($field->editable == 0)
					$read_only = "readonly=true";
				else
					$read_only = "";
				
				if ($field->required == 1)
					$return .= "<input class='adsmanager_required form-control' required id='$name' type='number' test='number'  name='$name' size='$field->size' maxlength='$field->maxlength' $read_only value=\"$value\" placeholder=\"$placeholder\" />\n"; 
				else
					$return .= "<input class='adsmanager form-control' id='$name' type='number' name='$name' test='number'  size='$field->size' maxlength='$field->maxlength' $read_only value=\"$value\" placeholder=\"$placeholder\" />\n";
                break;
			case 'price':
				if ($field->editable == 0)
					$read_only = "readonly=true";
				else
					$read_only = "";
                
                if ($field->required == 1) {
					$input = "<input class='adsmanager_required form-control' required id='$name' type='number' test='number'  name='$name' size='$field->size' maxlength='$field->maxlength' $read_only value=\"$value\" placeholder=\"$placeholder\" />\n"; 
                } else {
					$input = "<input class='adsmanager form-control' id='$name' type='number' name='$name' test='number'  size='$field->size' maxlength='$field->maxlength' $read_only value=\"$value\" placeholder=\"$placeholder\" />\n";
                }
                
				if(isset($options->currency_symbol) && $options->currency_symbol != '') {
                    if($options->currency_position == 'before') {
                        if(!isset($options->currency_display_in_form) || $options->currency_display_in_form == 1){
                            $return .= "<div class=\"input-append\">";
                            $return .= "<span class=\"add-on\">".$this->formatPrice(false, $options)."</span>";
                            $return .= $input;
                            $return .= "</div>";
                        } else {
                            $return .= $this->formatPrice(false, $options);
                            $return .= $input;
                        }
                    } else {
                        if(!isset($options->currency_display_in_form) || $options->currency_display_in_form == 1){
                            $return .= "<div class=\"input-prepend\">";
                            $return .= $input;
                            $return .= "<span class=\"add-on\">".$this->formatPrice(false, $options)."</span>";
                            $return .= "</div>";
                        } else {
                            $return .= $input;
                            $return .= $this->formatPrice(false, $options);
                        }
                    }
                } else {
                    $return .= $input;
                }
                break;
			case 'emailaddress':
				if ($field->editable == 0)
					$read_only = "readonly=true";
				else
					$read_only = "";
				
                $return .= "<div class=\"input-prepend\">";
                $return .= "<span class=\"add-on\">@</span>";
				if ($field->required == 1)
					$return .= "<input class='adsmanager_required form-control' required id='$name' type='email' test='emailaddress'  name=\"$name\" size='$field->size' maxlength='$field->maxlength' $read_only value=\"".htmlspecialchars($value)."\" placeholder=\"$placeholder\" />\n"; 
				else
					$return .= "<input class='adsmanager form-control' id='$name' type='email' test='emailaddress' name=\"$name\"  size='$field->size' maxlength='$field->maxlength' $read_only value=\"".htmlspecialchars($value)."\" $placeholder />\n";
				$return .= "</div>";
                break;
				
			case 'text':
				if ($field->editable == 0)
					$read_only = "readonly=true";
				else
					$read_only = "";
				
				if ($field->required == 1)
					$return .= "<input class='adsmanager_required form-control' required id='$name' type='text'  name='$name' size='$field->size' maxlength='$field->maxlength' $read_only value=\"".htmlspecialchars($value)."\" placeholder=\"$placeholder\" />\n"; 
				else
					$return .= "<input class='adsmanager form-control' id='$name' type='text' name='$name'  size='$field->size' maxlength='$field->maxlength' $read_only value=\"".htmlspecialchars($value)."\" placeholder=\"$placeholder\" />\n";
                break;
				
			case 'radio':
			case 'radioimage':
				$k = 0;
				$return .= "<table>";
				for ($i=0 ; $i < $field->rows;$i++)
				{
					$return .= "<tr>";
					for ($j=0 ; $j < $field->cols;$j++)
					{
						$return .= "<td>";
						$fieldvalue = @$values[$k]->fieldvalue;
						$fieldtitle = @$values[$k]->fieldtitle;
						if ($field->type == 'radio') {
							if (isset($fieldtitle))
								$fieldtitle=$fieldtitle;
						}
						else
						{
							$fieldtitle="<img src=\"{$this->baseurl}images/com_adsmanager/fields/$fieldtitle\" alt=\"$fieldtitle\" />";
						} 
						if (isset($values[$k]->fieldtitle))
						{
							if (($field->required == 1)&&($k==0))
								$mosReq = "required";
							else
								$mosReq = "";
                            $return .= "<label class=\"radio\">";
							if (($value == $fieldvalue)||($value == $fieldtitle))
								$return .= "<input type='radio' $mosReq name='$name'  value=\"".htmlspecialchars($fieldvalue)."\" checked='checked' />&nbsp;$fieldtitle&nbsp;\n";
							else
								$return .= "<input type='radio' $mosReq name='$name'  value=\"".htmlspecialchars($fieldvalue)."\" />&nbsp;$fieldtitle&nbsp;\n";
                            $return .= "</label>";
                            
                        }
						$k++;
						$return .= "</td>";
					}
					$return .= "</tr>";
				}
				$return .= "</table>";
				break;
			case 'file':
				$return .= "<input id='$name' type='file' name='$name'  placeholder=\"$placeholder\" />";
				if (isset($value)&&($value != ""))
				{
					$return .= "<br/><a href='{$this->baseurl}images/com_adsmanager/files/$value' target='_blank'>".TText::_('ADSMANAGER_DOWNLOAD_FILE')."</a>";
					$return .= "<br/><input type='hidden' name='delete_$name' value='0'>";
					$return .= "<input style='vertical-align:middle' type='checkbox' name='delete_$name' value='1'>&nbsp;".TText::_('ADSMANAGER_DELETE_FILE');
				}
				break;
				
			default:
				
				if(isset($this->plugins[$field->type]))
				{
					if ($content == null) {
						$content = new stdClass();
					}
					if (!isset($content->id))
						$content->id = 0;
					$result = $this->plugins[$field->type]->getFormDisplay($content,$field,$default );
					if ($result != "")
						$return .= $result;
					else
						return "";
				}
		}
		if (function_exists("checkPaidField"))
		{
			$return .= checkPaidField($field);
		}
        $return .= '</div>';
		return $return;
	}
Example #2
0
 function showFieldForm($field, $content, $default)
 {
     $return = "";
     $strtitle = TText::_($field->title);
     $strtitle = htmlspecialchars($strtitle);
     $name = $field->name;
     $fieldname = $field->name;
     $value = @$content->{$fieldname};
     $value = TText::_($value);
     if ($value == "" && isset($default)) {
         $default = (object) $default;
         $value = @$default->{$fieldname};
         $value = TText::_($value);
     }
     $disabled = "";
     $read_only = "";
     $options = $field->options;
     $values = array();
     if (!isset($options) || !isset($options->select_values_storage_type) || $options->select_values_storage_type == "internal") {
         if (@$this->field_values[$field->fieldid]) {
             $values = $this->field_values[$field->fieldid];
         }
     } else {
         if ($options->select_values_storage_type == "db") {
             $dbname = $options->select_db_storage_db_name;
             $_name = $options->select_db_storage_column_name;
             $_value = $options->select_db_storage_column_value;
             //$parent = $options->select_db_storage_column_parent_value;
             $sql = "SELECT `{$_name}` as fieldtitle,`{$_value}` as fieldvalue FROM {$dbname}";
             $this->_db->setQuery($sql);
             $values = $this->_db->loadObjectList();
         }
     }
     foreach ($values as $key => $val) {
         $values[$key]->fieldtitle = htmlspecialchars(TText::_($val->fieldtitle));
     }
     switch ($field->type) {
         case 'checkbox':
             if ($field->required == 1) {
                 $mosReq = "mosReq='1'";
             } else {
                 $mosReq = "";
             }
             if ($value == 1) {
                 $return .= "<input class='inputbox' type='checkbox' {$mosReq} mosLabel=\"{$strtitle}\" checked='checked' id='{$name}' name='{$name}' value='1' />\n";
             } else {
                 $return .= "<input class='inputbox' type='checkbox' {$mosReq} mosLabel=\"{$strtitle}\" name='{$name}' id='{$name}' value='1' />\n";
             }
             break;
         case 'multicheckbox':
         case 'multicheckboximage':
             $k = 0;
             $return .= "<table>";
             for ($i = 0; $i < $field->rows; $i++) {
                 $return .= "<tr>";
                 for ($j = 0; $j < $field->cols; $j++) {
                     $return .= "<td>";
                     $fieldvalue = @$values[$k]->fieldvalue;
                     $fieldtitle = @$values[$k]->fieldtitle;
                     if ($field->type == 'multicheckbox') {
                         if (isset($fieldtitle)) {
                             $fieldtitle = TText::_($fieldtitle);
                         }
                     } else {
                         $fieldtitle = "<img src=\"{$this->baseurl}images/com_adsmanager/fields/{$fieldtitle}\" alt=\"{$fieldtitle}\" />";
                     }
                     if (isset($values[$k]->fieldtitle)) {
                         if ($field->required == 1 && $k == 0) {
                             $mosReq = "mosReq='1'";
                         } else {
                             $mosReq = "";
                         }
                         if (strpos($value, "," . $fieldvalue . ",") === false && strpos($value, $fieldtitle . "|*|") === false && strpos($value, "|*|" . $fieldtitle) === false && $value != $fieldtitle) {
                             $return .= "<input class='inputbox' type='checkbox' {$mosReq}  mosLabel=\"{$strtitle}\" id='" . $name . "[]' name='" . $name . "[]' value=\"" . htmlspecialchars($fieldvalue) . "\" />&nbsp;{$fieldtitle}&nbsp;\n";
                         } else {
                             $return .= "<input class='inputbox' type='checkbox' {$mosReq}  mosLabel=\"{$strtitle}\" id='" . $name . "[]' checked='checked' name='" . $name . "[]' value=\"" . htmlspecialchars($fieldvalue) . "\" />&nbsp;{$fieldtitle}&nbsp;\n";
                         }
                     }
                     $return .= "</td>";
                     $k++;
                 }
                 $return .= "</tr>";
             }
             $return .= "</table>";
             break;
         case 'date':
             $options = array();
             $options['size'] = 25;
             $options['maxlength'] = 19;
             if ($field->required == 1) {
                 $options['class'] = 'adsmanager_required';
                 $options['mosReq'] = '1';
                 $options['mosLabel'] = "{$strtitle}";
             } else {
                 $options['class'] = 'adsmanager';
             }
             $return .= JHTML::_('behavior.calendar');
             /*if ($value != "") {
             			if (function_exists("strptime")) {
             				$a = strptime($value, TText::_('ADSMANAGER_DATE_FORMAT_LC'));
             				$timestamp = mktime(0, 0, 0, $a['tm_mon']+1, $a['tm_mday'], $a['tm_year']+1900);
             			} else {
             				$timestamp = strtotime($value);
             			}
             			if ($timestamp != null)
             				$value = date("Y-m-d",$timestamp);
             			else
             				$value = "";
             		}*/
             $return .= JHTML::_('calendar', "", "{$field->name}", "{$field->name}", TText::_('ADSMANAGER_DATE_FORMAT_LC'), $options);
             $return .= "<script type='text/javascript'>jQ(document).ready(function() {jQ('#" . $field->name . "').val(" . json_encode($value) . ");});</script>";
             //$return = "<input $class type='text' name='$field->name' id='$field->name' size='25' maxlength='19' value='$value' readonly=true/>";
             //$return .= "<input name='reset' type='reset' class='button' onclick=\"return showCalendar('$field->name', '%y-%m-%d');\" value='...' />";
             //$return .= $return;
             break;
         case 'editor':
             $editor = JFactory::getEditor();
             $return .= $editor->display($field->name, $value, '', '', $field->cols, $field->rows);
             break;
         case 'select':
             if ($field->editable == 0) {
                 $disabled = "disabled=true";
             } else {
                 $disabled = "";
             }
             if ($field->required == 1) {
                 $return .= "<select id='{$name}' name='{$name}' mosReq='1' mosLabel=\"{$strtitle}\" class='adsmanager_required' {$disabled}>\n";
             } else {
                 $return .= "<select id='{$name}' name='{$name}' mosLabel=\"{$strtitle}\" class='adsmanager' {$disabled}>\n";
             }
             if ($field->required == 0 || $value == "") {
                 $return .= "<option value=''>&nbsp;</option>\n";
             }
             foreach ($values as $v) {
                 $ftitle = $v->fieldtitle;
                 if ($value == $v->fieldvalue || $value == $ftitle) {
                     $return .= "<option value=\"" . htmlspecialchars($v->fieldvalue) . "\" selected='selected' >" . $ftitle . "</option>\n";
                 } else {
                     $return .= "<option value=\"" . htmlspecialchars($v->fieldvalue) . "\" >" . $ftitle . "</option>\n";
                 }
             }
             $return .= "</select>\n";
             break;
         case 'multiselect':
             if ($field->editable == 0) {
                 $disabled = "disabled=true";
             } else {
                 $disabled = "";
             }
             if ($field->required == 1) {
                 $return .= "<select id=\"" . $name . "[]\" name=\"" . $name . "[]\" mosReq='1' mosLabel=\"{$strtitle}\" multiple='multiple' size='{$field->size}' class='adsmanager_required' {$disabled}>\n";
             } else {
                 $return .= "<select id='" . $name . "[]' name=\"" . $name . "[]\" mosLabel=\"{$strtitle}\" multiple='multiple' size='{$field->size}' class='adsmanager' {$disabled}>\n";
             }
             if ($field->required == 0 || $value == "") {
                 $return .= "<option value=''>&nbsp;</option>\n";
             }
             foreach ($values as $v) {
                 $ftitle = $v->fieldtitle;
                 if ($field->required == 1) {
                     $mosReq = "mosReq='1'";
                 }
                 if (strpos($value, "," . $v->fieldvalue . ",") === false && strpos($value, $ftitle . "|*|") === false && strpos($value, "|*|" . $ftitle) === false && $value != $ftitle) {
                     $return .= "<option value=\"" . htmlspecialchars($v->fieldvalue) . "\" >{$ftitle}</option>\n";
                 } else {
                     $return .= "<option value=\"" . htmlspecialchars($v->fieldvalue) . "\" selected='selected' >{$ftitle}</option>\n";
                 }
             }
             $return .= "</select>\n";
             break;
         case 'textarea':
             if ($field->editable == 0) {
                 $read_only = "readonly=true";
             } else {
                 $read_only = "";
             }
             if ($field->required == 1) {
                 $return .= "<textarea class='adsmanager_required' mosReq='1' mosLabel=\"{$strtitle}\" id='{$name}' name='{$name}' cols='" . $field->cols . "' rows='" . $field->rows . "' wrap='VIRTUAL' onkeypress='CaracMax(this, {$field->maxlength}) ;' {$read_only}>" . htmlspecialchars($value) . "</textarea>\n";
             } else {
                 $return .= "<textarea class='adsmanager' id='{$name}' mosLabel=\"{$strtitle}\" name='{$name}' cols='" . $field->cols . "' rows='" . $field->rows . "' wrap='VIRTUAL' onkeypress='CaracMax(this, {$field->maxlength}) ;' {$read_only}>" . htmlspecialchars($value) . "</textarea>\n";
             }
             break;
         case 'url':
             if ($field->editable == 0) {
                 $recontent_only = "readonly=true";
             } else {
                 $recontent_only = "";
             }
             $return .= "http://";
             if ($field->required == 1) {
                 $return .= "<input class='adsmanager_required' mosReq='1' id='{$field->name}' type='text' mosLabel=\"{$strtitle}\" name='{$field->name}' size='{$field->size}' maxlength='{$field->maxlength}' {$recontent_only} value='" . htmlspecialchars($value, ENT_QUOTES) . "' />\n";
             } else {
                 $return .= "<input class='adsmanager' id='{$field->name}' type='text' name='{$field->name}' mosLabel=\"{$strtitle}\" size='{$field->size}' maxlength='{$field->maxlength}' {$recontent_only} value='" . htmlspecialchars($value, ENT_QUOTES) . "' />\n";
             }
             break;
         case 'number':
             if ($field->editable == 0) {
                 $read_only = "readonly=true";
             } else {
                 $read_only = "";
             }
             if ($field->required == 1) {
                 $return .= "<input class='adsmanager_required' mosReq='1' id='{$name}' type='text' test='number' mosLabel=\"{$strtitle}\" name='{$name}' size='{$field->size}' maxlength='{$field->maxlength}' {$read_only} value='{$value}' />\n";
             } else {
                 $return .= "<input class='adsmanager' id='{$name}' type='text' name='{$name}' test='number' mosLabel=\"{$strtitle}\" size='{$field->size}' maxlength='{$field->maxlength}' {$read_only} value='{$value}' />\n";
             }
             break;
         case 'price':
             if ($field->editable == 0) {
                 $read_only = "readonly=true";
             } else {
                 $read_only = "";
             }
             if ($options == null) {
                 $priceFormat = '';
             } else {
                 $priceFormat = $this->formatPrice(0, $options);
             }
             if ($field->required == 1) {
                 $return .= "<input class='adsmanager_required' mosReq='1' id='{$name}' type='text' test='number' mosLabel=\"{$strtitle}\" name='{$name}' size='{$field->size}' maxlength='{$field->maxlength}' {$read_only} value='{$value}' /> " . $priceFormat . "\n";
             } else {
                 $return .= "<input class='adsmanager' id='{$name}' type='text' name='{$name}' test='number' mosLabel=\"{$strtitle}\" size='{$field->size}' maxlength='{$field->maxlength}' {$read_only} value='{$value}' /> " . $priceFormat . "\n";
             }
             break;
         case 'emailaddress':
             if ($field->editable == 0) {
                 $read_only = "readonly=true";
             } else {
                 $read_only = "";
             }
             if ($field->required == 1) {
                 $return .= "<input class='adsmanager_required' mosReq='1' id='{$name}' type='text' test='emailaddress' mosLabel=\"{$strtitle}\" name='{$name}' size='{$field->size}' maxlength='{$field->maxlength}' {$read_only} value=\"" . htmlspecialchars($value) . "\" />\n";
             } else {
                 $return .= "<input class='adsmanager' id='{$name}' type='text' test='emailaddress' name='{$name}' mosLabel=\"{$strtitle}\" size='{$field->size}' maxlength='{$field->maxlength}' {$read_only} value=\"" . htmlspecialchars($value) . "\" />\n";
             }
             break;
         case 'text':
             if ($field->editable == 0) {
                 $read_only = "readonly=true";
             } else {
                 $read_only = "";
             }
             if ($field->required == 1) {
                 $return .= "<input class='adsmanager_required' mosReq='1' id='{$name}' type='text' mosLabel=\"{$strtitle}\" name='{$name}' size='{$field->size}' maxlength='{$field->maxlength}' {$read_only} value=\"" . htmlspecialchars($value) . "\" />\n";
             } else {
                 $return .= "<input class='adsmanager' id='{$name}' type='text' name='{$name}' mosLabel=\"{$strtitle}\" size='{$field->size}' maxlength='{$field->maxlength}' {$read_only} value=\"" . htmlspecialchars($value) . "\" />\n";
             }
             break;
         case 'radio':
         case 'radioimage':
             $k = 0;
             $return .= "<table>";
             for ($i = 0; $i < $field->rows; $i++) {
                 $return .= "<tr>";
                 for ($j = 0; $j < $field->cols; $j++) {
                     $return .= "<td>";
                     $fieldvalue = @$values[$k]->fieldvalue;
                     $fieldtitle = @$values[$k]->fieldtitle;
                     if ($field->type == 'radio') {
                         if (isset($fieldtitle)) {
                             $fieldtitle = $fieldtitle;
                         }
                     } else {
                         $fieldtitle = "<img src=\"{$this->baseurl}images/com_adsmanager/fields/{$fieldtitle}\" alt=\"{$fieldtitle}\" />";
                     }
                     if (isset($values[$k]->fieldtitle)) {
                         if ($field->required == 1 && $k == 0) {
                             $mosReq = "mosReq='1'";
                         } else {
                             $mosReq = "";
                         }
                         if ($value == $fieldvalue || $value == $fieldtitle) {
                             $return .= "<input type='radio' {$mosReq} name='{$name}' mosLabel=\"{$strtitle}\" value=\"" . htmlspecialchars($fieldvalue) . "\" checked='checked' />&nbsp;{$fieldtitle}&nbsp;\n";
                         } else {
                             $return .= "<input type='radio' {$mosReq} name='{$name}' mosLabel=\"{$strtitle}\" value=\"" . htmlspecialchars($fieldvalue) . "\" />&nbsp;{$fieldtitle}&nbsp;\n";
                         }
                     }
                     $k++;
                     $return .= "</td>";
                 }
                 $return .= "</tr>";
             }
             $return .= "</table>";
             break;
         case 'file':
             $return .= "<input id='{$name}' type='file' name='{$name}' mosLabel=\"{$strtitle}\"/>";
             if (isset($value) && $value != "") {
                 $return .= "<br/><a href='{$this->baseurl}images/com_adsmanager/files/{$value}' target='_blank'>" . TText::_('ADSMANAGER_DOWNLOAD_FILE') . "</a>";
                 $return .= "<br/><input type='hidden' name='delete_{$name}' value='0'>";
                 $return .= "<input style='vertical-align:middle' type='checkbox' name='delete_{$name}' value='1'>&nbsp;" . TText::_('ADSMANAGER_DELETE_FILE');
             }
             break;
         default:
             if (isset($this->plugins[$field->type])) {
                 if ($content == null) {
                     $content = new stdClass();
                 }
                 if (!isset($content->id)) {
                     $content->id = 0;
                 }
                 $result = $this->plugins[$field->type]->getFormDisplay($content, $field, $default);
                 if ($result != "") {
                     $return .= $result;
                 } else {
                     return "";
                 }
             }
     }
     if (@$field->description && $field->description != "") {
         if (ADSMANAGER_SPECIAL != "abrivac") {
             JHTML::_('behavior.tooltip');
         }
         $return .= JHTML::tooltip(TText::_($field->description), TText::_($field->title));
     }
     if (function_exists("checkPaidField")) {
         $return .= checkPaidField($field);
     }
     return $return;
 }