. */ class ApplPassportNo extends Appl { public function __construct($appl_id) { global $setup; $this->appl_id = $appl_id; $this->name = "PassportNo"; $this->compulsory = $setup['ApplShowIDRequired']; } public function get_print_name() { global $setup; if( $setup['ApplShowIDRequired'] ) { return "Passport or ID Card number"; }else { return "Passport number"; } } public function get_print_name_short() { return "Passport#"; } public function get_print_value($readonly=false) { global $setup; $r = "name."\" value=\"".$this->value."\" size=\"40\" maxlength=\"50\""; if( $readonly ) $r .= " disabled=\"disabled\""; $r .= " />"; if( $setup['ApplShowIDRequired'] ) $r .= "
For identification the number of the type of ID you select below can be filled in. Please note that if you require visa, you'll have to use your passport as identification."; return $r; } public function set($value) { global $setup; if( (isset($_POST['Visa']) && $_POST['Visa']=="yes") OR $setup['ApplShowIDRequired'] ) $this->compulsory = true; if( $this->compulsory AND strlen($value)<2 ) { // Error $this->error = true; $this->error_txt = "You did not provide a passport number (maximal 50 characters, required when needing visa)"; return false; }else { $this->value = $value; return true; } } /* The default access for a field is that 'admin', 'chair', 'localorg' and 'edit' people can edit the field, as well as a logged in user. * Users with only 'view' can only view the field, and all others are denied access * Override this function if you want different access */ public function get_access($new=true) { if( $this->access>=0 ) return $this->access; elseif( isset($_SESSION['sess_functions']) && in_array("applicationfield_passportedit", $_SESSION['sess_functions']) ) return self::ACCESS_RW; elseif( isset($_SESSION['sess_functions']) && in_array("applicationfield_passportview", $_SESSION['sess_functions']) ) return self::ACCESS_R; elseif( isset($_SESSION['access_user']) && $_SESSION['access_user'] ) return self::ACCESS_RW; elseif( $new ) return self::ACCESS_RW; else return self::ACCESS_NO; } /* Normally a field is saved to MySQL. If you don't want to save it, or want to do something else before data is saved, override this function. * Make sure you return an array (can be empty) */ //public function get_sql() { // return array(); //} } ?>