. */ class PersonsWorkshopIDSlot1 extends Persons { private $workshops; /* Constructor * Make sure you set the name, and, when needed, if the field is * compulsory */ public function __construct($dummy=0) { $this->name = "WorkshopIDSlot1"; } /* get_print_name() * Return the name of the field (caption) to be shown in the application * form */ public function get_print_name() { return "Workshop 1st timeslot"; } /* get_print_name_short() * Return the name of the field (caption) to be shown in a table */ public function get_print_name_short() { return "Workshop 1st timeslot"; } public function get_access($dummy=0) { global $setup; if( $setup['SetupWSNumber']==0 ) return self::ACCESS_NO; elseif( isset($_SESSION['sess_functions']) && in_array("applicationfield_workshopview", $_SESSION['sess_functions']) ) return self::ACCESS_R; else return self::ACCESS_NO; } public function display($value, $applicationID=0, &$allvalues="") { if( !is_array($this->workshops) ) { $this->workshops = array(); $this->workshops[0] = ""; $query = "SELECT `id`, `title` FROM `workshops`"; if( @mysql_num_rows( $res=doquery($query) )>0 ) { while( $row=mysql_fetch_array($res) ) { $this->workshops[ $row['id'] ] = $row['title']; } }else { debug("Failed loading workshops"); return $value; } } if( $matches = preg_split("/;/", $value) ) { if( array_key_exists($matches[0], $this->workshops) ) $r = $this->workshops[ $matches[0] ]; else $r = $matches[0]; if( $matches[1]=="yes" ) $r .= " [chairing]"; return $r; }else { return "error"; } } public function sql_columnname() { return "CONCAT(`applications`.`WorkshopIDSlot1`, ';', `applications`.`chairWS1`) AS `WorkshopIDSlot1`"; } } ?>