.
*/
class ApplEmail extends Appl {
public function __construct($appl_id) {
$this->appl_id = $appl_id;
$this->name = "Email";
$this->compulsory = true;
}
public function get_print_name() {
return "E-mail";
}
public function get_print_name_short() {
return "E-mail";
}
public function get_print_value($readonly=false) {
$r = "name."\" value=\"".$this->value."\" size=\"40\" maxlength=\"70\"";
if( $readonly ) $r .= " disabled=\"disabled\"";
$r .= " /> Please enter only one e-mail address without additional remarks!";
return $r;
}
public function set($value) {
if( !check_email($value) ) {
// Error
$this->error = true;
$this->error_txt = "The e-mail address is invalid";
return false;
}elseif( strpos($value, "@aegee.org")>0 ) {
// Error
$this->error = true;
$this->error_txt = "The e-mail address cannot be in the domain @aegee.org. Please specify a real mailbox, not a forward";
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_personaledit", $_SESSION['sess_functions']) ) return self::ACCESS_RW;
elseif( isset($_SESSION['sess_functions']) && in_array("applicationfield_personalview", $_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();
//}
public function display($value, $PersonID=0, &$allvalues="") {
return "".$value."";
}
public function displaytext($value, $PersonID=0, &$allvalues="") {
return $value;
}
}
?>