. */ class CandFax extends Cand { /* Constructor * Make sure you set the name, and, when needed, if the field is * compulsory */ public function __construct($candidate_id) { $this->candidate_id = $candidate_id; $this->name = "Fax"; $this->compulsory = false; } /* get_print_name() * Return the name of the field (caption) to be shown in the application * form */ public function get_print_name() { return "Fax number"; } /* get_print_name_short() * Return the name of the field (caption) to be shown in a table */ public function get_print_name_short() { return "Fax"; } /* get_print_value($readonly) * Return the value to be printed in the form (with text boxes etc) * @param: readonly: if the field can be changed (false) or not (true) */ public function get_print_value($readonly=false) { $r = "+ name."\" value=\"".$this->value."\" size=\"38\" maxlength=\"50\""; if( $readonly ) $r .= " readonly=\"readonly\""; $r .= ">"; return $r; } /* set($value) * Check the supplied value and assign it if ok (return true), otherwise * set an error and return false * @param: value: the value to be assigned and checked * @return: true on ok, false on error */ public function set($value) { if( !preg_match("/(^[\d| |-]{6,50}$)/", $value) AND strlen($value)>0 ) { // Error $this->error = true; $this->error_txt = "The fax number is invalid (only numbers, spaces and dashes are allowed)"; return false; }else { $this->value = $value; return true; } } public function get_accesspublic() { if( isset($_SESSION['access_user']) && $_SESSION['access_user'] ) return true; else return false; } } ?>