All pastes #352783 Raw Edit

Something

public text v1 · immutable
·published 2007-02-13 00:30 UTC
rendered paste body
        /**
         * constructor
         * This takes an optional ID, if no ID is passed level is set to 0
         * as they must not be a staff member
         */
        public function __constructor($id='') {

                if (!$id) {

                }

                else {
                        $this->id = intval($id);
                        $info   = $this->get_info();
                        if (!count($info)) { return false; }

                }


        } // __constructor


        /**
         * _get_info
         * This first checks to see if the ID is negative, if so it's a conference gues
         * Next it checks to see if it's in the staff list, if not its a student at the very
         * end it returns a named array of the user properties
         */
        private function get_info() {

                if (!$this->id < 0) {
                        $info = $this->get_conference_info();
                }
                else {
                        // Check the Staff table because thats fast
                        $sql = "SELECT * FROM `staff` WHERE `id`='$this->id'";
                        $db_results = dba_query($sql,'4oh4.resdesk');

                        $info = dba_fetch_assoc($db_results,'4oh4.resdesk');

                        // If we still didn't find them, we have to run the RMS query *cry*
                        if (!count($info)) {
                                $info = RMS::get_student_from_id($this->id);
                        }
                return $info;

        } // _get_info

        /**
         * _get_conference_info
         * This pulls the information for a conference guest it takes a negative ID
         * as the source of the information
         */
        private function get_conference_info() {