. */ class CandMemberSince extends Cand { public function __construct($candidate_id) { $this->candidate_id = $candidate_id; $this->name = "MemberSince"; $this->compulsory = true; } public function get_print_name() { return "Member since"; } public function get_print_name_short() { return "Member since"; } public function get_print_value($readonly=false) { return show_date($this->name, $this->value, !$readonly, 1, 31, 1, 12, 1985, date("Y")); } public function get($oldvalue=false) { if( $oldvalue ) return date("d.m.Y", strtotime($this->oldvalue)); else return date("d.m.Y", strtotime($this->value)); } public function set($value) { if( preg_match("/(^(\d){4}-(\d){2}-(\d){2}$)/", $value) AND checkdate(substr($value, 5, 2), substr($value, 8, 2), substr($value, 0, 4)) ) { // OK $this->value = $value; return true; }else { // Error if( $_SERVER['REQUEST_METHOD']=="POST" ) $this->error = true; $this->error_txt = "The member since is invalid"; return false; } } public function check() { $this->error = false; $this->value = $_POST[$this->name."_year"]."-".$_POST[$this->name."_month"]."-".$_POST[$this->name."_day"]; return $this->set( $this->value ); } } ?>