first_reg = $xml_data->getAttribute('firstreg'); $this->uid = $xml_data->getAttribute('uid'); $this->name = $xml_data->getAttribute('name'); $this->surname = $xml_data->getAttribute('surname'); $this->pnr = $xml_data->getAttribute('pnr'); $this->state = $xml_data->getAttribute('state'); if ( $xml_data->hasAttribute('programcodefirstreg') ) { $this->programcode = $xml_data->getAttribute('programcodefirstreg'); } else { $this->programcode = "missing"; } // ---------- // Check whether the student has old attributes, if so fetch them. // ---------- if ( $xml_data->hasAttribute('olduid') ) { $this->old_uid = $xml_data->getAttribute('olduid'); } if ( $xml_data->hasAttribute('oldpnr') ) { $this->old_pnr = $xml_data->getAttribute('oldpnr'); } if ( $xml_data->hasAttribute('oldname') ) { $this->old_name = $xml_data->getAttribute('oldname'); } if ( $xml_data->hasAttribute('oldsurname') ) { $this->old_surname = $xml_data->getAttribute('oldsurname'); } } // ---------------------------------------- // get_programcode // // Returns program code for this student. // ---------------------------------------- public function get_programcode() { return $this->programcode; } // ---------------------------------------- // get_first_reg // // Returns first registration for this student. // ---------------------------------------- public function get_first_reg() { return $this->first_reg; } // ---------------------------------------- // get_uid // // Returns the uid for this student. // ---------------------------------------- public function get_uid() { return $this->uid; } // ---------------------------------------- // get_name // // Returns the name of this student. // ---------------------------------------- public function get_name() { return $this->name; } // ---------------------------------------- // get_surname // // Returns the surname of this student. // ---------------------------------------- public function get_surname() { return $this->surname; } // ---------------------------------------- // get_pnr // // Returns the personal identification number of this student. // ---------------------------------------- public function get_pnr() { return $this->pnr; } // ---------------------------------------- // get_state // // Returns the course state of this student. // ---------------------------------------- public function get_state() { return $this->state; } // ---------------------------------------- // get_old_uid // // Returns the old uid of this student, if there is such. // ---------------------------------------- public function get_old_uid() { return $this->old_uid; } // ---------------------------------------- // get_old_pnr // // Returns the old pnr of this student, if there is such. // ---------------------------------------- public function get_old_pnr() { return $this->old_pnr; } // ---------------------------------------- // change_uid // // Change the uid of this student. // ---------------------------------------- public function change_uid($new_uid) { $this->old_uid = $this->uid; $this->uid = $new_uid; } // ---------------------------------------- // change_pnr // // Change the pnr of this student. // ---------------------------------------- public function change_pnr($new_pnr) { $this->old_pnr = $this->pnr; $this->pnr = $new_pnr; } // ---------------------------------------- // change_first_name // // Change the name of this student. // ---------------------------------------- public function change_first_name($new_name) { $this->old_name = $this->name; $this->name = $new_name; } // ---------------------------------------- // change_surname // // Change the surname of this student. // ---------------------------------------- public function change_surname($new_surname) { $this->old_surname = $this->surname; $this->surname = $new_surname; } // ---------------------------------------- // print_dump // // Print function for debugging / testing. // ---------------------------------------- public function print_dump() { // ---------- // Print the student data // ---------- print "\t\tUID: " . $this->uid . ", Name: " . $this->name . ", Surname: " . $this->surname . ", PNR: " . $this->pnr . ", State: " . $this->state; // ---------- // Check whether the student has old attributes, if so print them. // ---------- if ( isset($this->old_uid) ) { print ", Old UID: " . $this->old_uid; } if ( isset($this->old_pnr) ) { print ", Old PNR: " . $this->old_pnr; } if ( isset($this->old_name) ) { print ", Old PNR: " . $this->old_name; } if ( isset($this->old_surname) ) { print ", Old PNR: " . $this->old_surname; } print "\n"; } // ---------------------------------------- // End of Student class definition // ---------------------------------------- } // ---------------------------------------------------------------------------- ?>