maxLength = $maxLength;
$this->restrictedField = $restrictedField;
$this->restrictedTable = $restrictedTable;
$this->restrictedMessage = $restrictedMessage;
parent::__construct($name, $title, $value);
}
function Field() {
Requirements::javascript(SAPPHIRE_DIR . "/javascript/i18n.js");
Requirements::javascript(SAPPHIRE_DIR . "/javascript/UniqueFields.js");
/*
$restrictedValues = array();
$restrictedInputs = array();
// if the restrictedFields and tables have been specified,
// then get the restricted values
if( !empty( $this->restrictedField ) && !empty( $this->restrictedTable ) ) {
$result = DB::query("SELECT `{$this->restrictedField}` FROM `{$this->restrictedTable}`");
$count = 1;
while( $restrictedValue = $result->nextRecord() )
$restrictedValues[$restrictedValue[$this->restrictedField]] = 1;
$result = DB::query("SELECT `{$this->restrictedField}` FROM `{$this->restrictedTable}_Live`");
while( $restrictedValue = $result->nextRecord() )
$restrictedValues[$restrictedValue[$this->restrictedField]] = 1;
// remove the initial value of this field
$restrictedValues = array_diff_assoc( $restrictedValues, array( $this->attrValue() => 1 ) );
foreach( $restrictedValues as $restrictedValue => $discard )
$restrictedInputs[] = "id()."-restricted-".($count++)."\" value=\"$restrictedValue\" name=\"restricted-values[".$this->id()."]\" />";
}
*/
$fieldSize = $this->maxLength ? min( $this->maxLength, 30 ) : 30;
if($this->maxLength){
return /*implode("", $restrictedInputs).*/"class."\" type=\"text\" id=\"" . $this->id() . "\" name=\"{$this->name}\" value=\"" . $this->attrValue() . "\" maxlength=\"$this->maxLength\" size=\"$fieldSize\" />id()."]\" id=\"".$this->id()."-restricted-message\" value=\"{$this->restrictedMessage}\" />";
}else{
return /*implode("", $restrictedInputs).*/"class."\" type=\"text\" id=\"" . $this->id() . "\" name=\"{$this->name}\" value=\"" . $this->attrValue() . "\" size=\"30\" />id()."]\" id=\"".$this->id()."-restricted-message\" value=\"{$this->restrictedMessage}\" />";
}
}
}
?>