.
*/
class CandLocalBoardPosition extends Cand {
/* Constructor
* Make sure you set the name, and, when needed, if the field is
* compulsory
*/
public function __construct($candidate_id) {
$this->candidate_id = $candidate_id;
$this->name = "LocalBoardPosition";
$this->compulsory = true;
}
/* get_print_name()
* Return the name of the field (caption) to be shown in the application
* form
*/
public function get_print_name() {
return "Local board position";
}
/* get_print_name_short()
* Return the name of the field (caption) to be shown in a table
*/
public function get_print_name_short() {
return "Local board";
}
/* get_print_value($readonly)
* Return the value to be printed in the form (with text boxes etc)
* @param: readonly: if the field can be changed (false) or not (true)
*/
public function get_print_value($readonly=false) {
$r = "name."\" value=\"".$this->value."\" size=\"40\" maxlength=\"50\"";
if( $readonly ) $r .= " readonly=\"readonly\"";
$r .= ">";
$r .= " Have you been in your Local Board? What position?";
return $r;
}
/* set($value)
* Check the supplied value and assign it if ok (return true), otherwise
* set an error and return false
* @param: value: the value to be assigned and checked
* @return: true on ok, false on error
*/
public function set($value) {
if( strlen($value)<1 OR strlen($value)>50 ) {
// Error
$this->error = true;
$this->error_txt = "The local board position is too long or missing (fill in 'none' or '-' if you don't have any; maximum 50 characters)";
return false;
}else {
$this->value = $value;
return true;
}
}
}
?>