. */ class ApplTShirtSize extends Appl { public function __construct($appl_id) { $this->appl_id = $appl_id; $this->name = "TShirtSize"; $this->compulsory = true; } public function get_print_name() { return "Size for your official T-shirt"; } public function get_print_name_short() { return "T-shirt size"; } public function get_print_value($readonly=false) { if( $readonly ) $d="disabled=\"disabled\""; else $d=""; $r = "name."_s\" name=\"".$this->name."\" value=\"S\" $d"; if( $this->value=="S" ) $r .= " checked=\"checked\""; $r .= " />   name."_m\" name=\"".$this->name."\" value=\"M\" $d"; if( $this->value=="M" ) $r .= " checked=\"checked\""; $r .= " />   name."_l\" name=\"".$this->name."\" value=\"L\" $d"; if( $this->value=="L" ) $r .= " checked=\"checked\""; $r .= " />   name."_xl\" name=\"".$this->name."\" value=\"XL\" $d"; if( $this->value=="XL" ) $r .= " checked=\"checked\""; $r .= " />"; return $r; } public function set($value) { if( $value!="S" AND $value!="M" AND $value!="L" AND $value!="XL" ) { // Error $this->error = true; $this->error_txt = "The T-shirt size is invalid"; 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) { global $setup; if( $setup['ApplShowTShirtSize']==false ) return self::ACCESS_NO; elseif( $this->access>=0 ) return $this->access; elseif( isset($_SESSION['sess_functions']) && in_array("applicationfield_optionedit", $_SESSION['sess_functions']) ) return self::ACCESS_RW; elseif( isset($_SESSION['sess_functions']) && in_array("applicationfield_optionview", $_SESSION['sess_functions']) ) return self::ACCESS_R; elseif( is_anon() AND $new ) return self::ACCESS_RW; elseif( isset($_SESSION['access_user']) && $_SESSION['access_user'] ) 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($new=true) { // // Return when making new application or when there is write access // if( $this->get_access($new)==Appl::ACCESS_RW OR $new ) return array($this->name => $this->value); // else return array(); //} } ?>