protected function getNextPersonID()
 {
     // get the MAX(person_id)... need to determine what insertion person ID will be (used to create new registration record)
     $person = new RowManager_PersonManager();
     $persons = new MultiTableManager();
     $persons->addRowManager($person);
     $persons->setFunctionCall('MAX', 'person_id');
     $persons->ignoreFields();
     // only leave MAX(person_id) in values to be returned
     $personsList = $persons->getListIterator();
     $personsArray = $personsList->getDataList();
     $maxID = -1;
     reset($personsArray);
     foreach (array_keys($personsArray) as $k) {
         $personRecord = current($personsArray);
         $maxID = $personRecord['MAX(person_id)'];
         if ($maxID > -1) {
             break;
             // get out of the loop once MAX is found
         }
         next($personsArray);
     }
     return $maxID + 1;
 }
 protected function getNextStatusID()
 {
     // get the MAX(status_id)... need to determine what insertion status_id will be (used to create new status record)
     $status = new RowManager_StatusManager();
     $statuses = new MultiTableManager();
     $statuses->addRowManager($status);
     $statuses->setFunctionCall('MAX', 'status_id');
     $statuses->ignoreFields();
     // only leave MAX(status_id) in values to be returned
     $statusesList = $statuses->getListIterator();
     $statusesArray = $statusesList->getDataList();
     $maxID = -1;
     reset($statusesArray);
     foreach (array_keys($statusesArray) as $k) {
         $statusRecord = current($statusesArray);
         $maxID = $statusRecord['MAX(status_id)'];
         if ($maxID > -1) {
             // this condition occurs if no records found
             if ($maxID == '') {
                 $maxID = -1;
             }
             break;
             // get out of the loop once MAX is found
         }
         next($statusesArray);
     }
     return $maxID + 1;
     // NOTE: equals 0 if nothing found
 }
 protected function createRegistrationRecord($eventID, $personID, &$regs)
 {
     if ($personID != -1 && $eventID != -1) {
         // 	        $regs = new RowManager_RegistrationManager();
         // get status id for INITIAL_REG_STATUS
         $regStatus = new RowManager_StatusManager();
         $regStatus->setStatusDesc(FormProcessor_Register::INITIAL_REG_STATUS);
         $regStatusList = $regStatus->getListIterator();
         $regStatusArray = $regStatusList->getDataList();
         $statusID = 0;
         reset($regStatusArray);
         foreach (array_keys($regStatusArray) as $k) {
             $status = current($regStatusArray);
             $statusID = $status['status_id'];
             // NOTE: should only be one reg. per person per event (ENFORCE??)
             next($regStatusArray);
         }
         // get the MAX(registration_id)... need to determine what insertion registration ID will be (used in confirmNum)
         $allRegs = new MultiTableManager();
         $allRegs->addRowManager($regs);
         $allRegs->setFunctionCall('MAX', 'registration_id');
         $allRegs->ignoreFields();
         // only leave MAX(registration_id) in values to be returned
         $allRegsList = $allRegs->getListIterator();
         $allRegsArray = $allRegsList->getDataList();
         $maxID = -1;
         reset($allRegsArray);
         foreach (array_keys($allRegsArray) as $k) {
             $regRecord = current($allRegsArray);
             $maxID = $regRecord['MAX(registration_id)'];
             if ($maxID > -1) {
                 break;
                 // get out of the loop once MAX is found
             }
             next($allRegsArray);
         }
         // compile values needed for new registration record
         $regValues = array();
         $nextRegID = $maxID + 1;
         $regValues['event_id'] = $eventID;
         // check if a new person record needs to be created
         // 				if ($this->person_id == -1)
         // 				{
         // 					$this->person_id = $this->getNextPersonID();	// assumes processData() will properly use this value for insertion
         // 				}
         $regValues['person_id'] = $personID;
         $timestamp = strtotime("now");
         $date = date('Y-m-d H:i:s', $timestamp);
         // == NOW() : to bad I could pass that as non-string...
         $regValues['registration_date'] = $date;
         // set date-time to current date-time
         $regValues['registration_confirmNum'] = 'E' . $eventID . 'R' . $nextRegID . 'AIA';
         $regValues['registration_status'] = $statusID;
         $this->confirmNum = $regValues['registration_confirmNum'];
         // TODO: change means of assigning to global
         // store values in table manager object.
         $regs->loadFromArray($regValues);
         // set primary key to use for update (if maxID found)
         if ($maxID > -1) {
             $regValues['registration_id'] = $nextRegID;
             $regs->setRegID($regValues['registration_id']);
         }
         // now update the DB with the values
         if (!$regs->isLoaded()) {
             $regs->createNewEntry(true);
             // allow primary key to be set (in case auto_increment is off)
             return $nextRegID;
         } else {
             return -1;
         }
         // TODO: figure out how to show error if no registration made, or updated (IF it is even possible now...)
     }
 }