. */ class ApplMeals extends Appl { public function __construct($appl_id) { $this->appl_id = $appl_id; $this->name = "Meals"; $this->compulsory = true; } public function get_print_name() { return "Desired meals"; } public function get_print_name_short() { return "Meals"; } public function get_print_value($readonly=false) { if( $readonly ) $d="disabled=\"disabled\""; else $d=""; $r = "name."_normal\" name=\"".$this->name."\" value=\"normal\" $d"; if( $this->value=="normal" ) $r .= " checked=\"checked\""; $r .= " />   name."_vegetarian\" name=\"".$this->name."\" value=\"vegetarian\" $d"; if( $this->value=="vegetarian" ) $r .= " checked=\"checked\""; $r .= " />   name."_diet\" name=\"".$this->name."\" value=\"diet\" $d"; if( $this->value=="diet" ) $r .= " checked=\"checked\""; $r .= " />"; $r .= "
Although we will try to respect your wishes it might not always be possible."; return $r; } public function set($value) { if( $value!="normal" AND $value!="vegetarian" AND $value!="diet" ) { // Error $this->error = true; $this->error_txt = "The desired meals 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) { if( $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( 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(); //} } ?>