protected function setRegistrationStatus()
 {
     $backup_event_id = -1;
     $status_message = 'No registration created!';
     if (isset($this->reg_id) && $this->reg_id != '') {
         // check cim_hrdb_person to determine if a person has been affiliated with registration
         $regs = new RowManager_RegistrationManager();
         $regs->setRegID($this->reg_id);
         $person = new RowManager_PersonManager();
         $regCheck = new MultiTableManager();
         $regCheck->addRowManager($regs);
         $regCheck->addRowManager($person, new JoinPair($regs->getJoinOnPersonID(), $person->getJoinOnPersonID()));
         $regsList = $regCheck->getListIterator();
         $regsArray = $regsList->getDataList();
         // variables to be used for later checks
         $person_id = '';
         $confirm_num = '';
         $person_address = '';
         $person_email = '';
         $person_city = '';
         $person_province = '0';
         $person_pcode = '';
         $person_phone = '';
         reset($regsArray);
         // should be only one registration status (for 1 reg_id)
         foreach (array_keys($regsArray) as $k) {
             $record = current($regsArray);
             $backup_event_id = $record['event_id'];
             $person_id = $record['person_id'];
             $confirm_num = $record['registration_confirmNum'];
             $person_email = $record['person_email'];
             $person_address = $record['person_addr'];
             $person_city = $record['person_city'];
             $person_province = $record['province_id'];
             $person_pcode = $record['person_pc'];
             $person_phone = $record['person_phone'];
             next($regsArray);
         }
         // determine whether any person records were found for registration
         if (!isset($regsArray) || count($regsArray) < 1) {
             $this->storeRegStatus($this->reg_id, RowManager_StatusManager::INCOMPLETE);
             $status_message = 'No person record associated with registration.';
             // ASSUMPTION: set reg_id ==> created registration record
             return RowManager_StatusManager::INCOMPLETE . '|' . $status_message;
         } else {
             if (isset($regsArray) && ($person_email == '' || $person_address == '' || $person_city == '' || $person_province == '' || $person_province == '0' || $person_pcode == '' || $person_phone == '')) {
                 $this->storeRegStatus($this->reg_id, RowManager_StatusManager::INCOMPLETE);
                 $status_message = 'Please ensure that you have entered the following data:' . '<br> name, e-mail address, permanent address, city, province, postal code, and phone number.';
                 return RowManager_StatusManager::INCOMPLETE . '|' . $status_message;
             }
         }
         // check cim_hrdb_assignment to determine that the person has been assigned to a campus
         $assign = new RowManager_AssignmentsManager();
         $assign->setPersonID($person_id);
         $status = new RowManager_CampusAssignmentStatusManager();
         $campusAssign = new MultiTableManager();
         $campusAssign->addRowManager($assign);
         $campusAssign->addRowManager($status, new JoinPair($assign->getJoinOnStatusID(), $status->getJoinOnStatusID()));
         $regsList = $campusAssign->getListIterator();
         $regsArray = $regsList->getDataList();
         // variables to be used for later checks
         $assignArray = array();
         $this->campus_id = '';
         reset($regsArray);
         // should be only one campus assignment status (for now, later maybe not)
         foreach (array_keys($regsArray) as $k) {
             $record = current($regsArray);
             if ($record['assignmentstatus_desc'] != RowManager_AssignmentsManager::UNKNOWN_STATUS) {
                 $this->campus_id = $record['campus_id'];
                 $assignArray[$this->campus_id] = $record['assignmentstatus_desc'];
             }
             next($regsArray);
         }
         // determine whether a campus assignment exists for the found person linked to the registration
         if (!isset($assignArray) || count($assignArray) < 1) {
             $this->storeRegStatus($this->reg_id, RowManager_StatusManager::INCOMPLETE);
             $status_message = "Please ensure that the registrant is assigned to a valid campus and has a valid status.";
             return RowManager_StatusManager::INCOMPLETE . '|' . $status_message;
         }
         // check cim_reg_fieldvalues to determine whether field values have been set for the registration
         $fields = new RowManager_FieldManager();
         $fields->setEventID($this->event_id);
         $TRUE = 1;
         $fields->setIsRequired($TRUE);
         $fieldsList = $fields->getListIterator();
         $fieldsArray = $fieldsList->getDataList();
         // 		     reset($fieldsArray);	// should be only one campus assignment status (for now, later maybe not)
         // 		     foreach (array_keys($fieldsArray) as $k)
         // 		     {
         // 			     $record = current($fieldsArray);
         //
         // 			     next($fieldsArray);
         // 		     }
         $fieldValues = new RowManager_FieldValueManager();
         $fieldValues->setRegID($this->reg_id);
         $valuesList = $fieldValues->getListIterator();
         $valuesArray = $valuesList->getDataList();
         // 		     reset($regsArray);	// should be only one campus assignment status (for now, later maybe not)
         // 		     foreach (array_keys($regsArray) as $k)
         // 		     {
         // 			     $record = current($regsArray);
         //
         // 			     $assignArray[$record['campus_id'] = $record['assignmentstatus_desc']
         // 			     next($regsArray);
         // 		     }
         // ensure that the REQUIRED fields for an event all have a record for the particular registration
         if (count($valuesArray) < count($fieldsArray)) {
             $this->storeRegStatus($this->reg_id, RowManager_StatusManager::INCOMPLETE);
             $status_message = 'Some required event-specific field values were NOT set for the registration.';
             return RowManager_StatusManager::INCOMPLETE . '|' . $status_message;
         }
         if (!isset($this->event_id) || $this->event_id == '') {
             $this->event_id = $backup_event_id;
             // should have been set earlier when retrieving reg. data...
         }
         // retrieve event deposit for later use
         $event = new RowManager_EventManager();
         $event->setEventID($this->event_id);
         $eventsList = $event->getListIterator();
         $eventsArray = $eventsList->getDataList();
         $event_deposit = -1;
         $event_basePrice = -1;
         reset($eventsArray);
         // should be only one event per event_id
         foreach (array_keys($eventsArray) as $k) {
             $record = current($eventsArray);
             $event_deposit = $record['event_deposit'];
             next($eventsArray);
         }
         if ($event_deposit == -1) {
             $this->storeRegStatus($this->reg_id, RowManager_StatusManager::INCOMPLETE);
             $status_message = 'Invalid event associated with registration.';
             return RowManager_StatusManager::INCOMPLETE . '|' . $status_message;
         }
         // check cim_reg_cashtransaction and cim_reg_cctransaction tables to determine if event deposit has been paid
         $ccTransaction = new RowManager_CreditCardTransactionManager();
         $ccTransaction->setRegID($this->reg_id);
         $ccTransList = $ccTransaction->getListIterator();
         $ccTransArray = $ccTransList->getDataList();
         $ccAmount = 0;
         reset($ccTransArray);
         foreach (array_keys($ccTransArray) as $k) {
             $record = current($ccTransArray);
             $ccAmount += $record['cctransaction_amount'];
             next($ccTransArray);
         }
         // check cash
         $cashTransaction = new RowManager_CashTransactionManager();
         $cashTransaction->setRegID($this->reg_id);
         $cashTransList = $cashTransaction->getListIterator();
         $cashTransArray = $cashTransList->getDataList();
         $cashAmount = 0;
         reset($cashTransArray);
         foreach (array_keys($cashTransArray) as $k) {
             $record = current($cashTransArray);
             $cashAmount += $record['cashtransaction_amtPaid'];
             next($cashTransArray);
         }
         // check scholarship
         $scholarship = new RowManager_ScholarshipAssignmentManager();
         $scholarship->setRegID($this->reg_id);
         $scholarshipList = $scholarship->getListIterator();
         $scholarshipArray = $scholarshipList->getDataList();
         $scholarshipAmount = 0;
         reset($scholarshipArray);
         foreach (array_keys($scholarshipArray) as $k) {
             $record = current($scholarshipArray);
             $scholarshipAmount += $record['scholarship_amount'];
             next($scholarshipArray);
         }
         if ($ccAmount + $cashAmount + $scholarshipAmount < $event_deposit) {
             $this->storeRegStatus($this->reg_id, RowManager_StatusManager::INCOMPLETE);
             $status_message = 'The event deposit of $' . $event_deposit . ' has not been paid.';
             return RowManager_StatusManager::INCOMPLETE . '|' . $status_message;
         }
         // check that confirmation # exists and is in proper format (check that format is 'E<event_id>R<reg_id>C<campus_id>')
         $anyNum = '[0-9]+';
         // allow any number for campus ID because person may have been assigned new campuses
         $pattern = '(E' . $this->event_id . 'R' . $this->reg_id . 'C' . $anyNum . ')';
         if (!isset($confirm_num) || preg_match($pattern, $confirm_num) < 1) {
             // if campus-id missing from confirm. # then
             // search for campus-id, since user may have created new campus assignment during process
             $pattern = '(E' . $this->event_id . 'R' . $this->reg_id . 'C)';
             if (preg_match($pattern, $confirm_num) >= 1) {
                 $campusAssigned = new RowManager_AssignmentsManager();
                 $campusAssigned->setPersonID($person_id);
                 $assignmentsList = $campusAssigned->getListIterator();
                 $assignmentsArray = $assignmentsList->getDataList();
                 $assignment = current($assignmentsArray);
                 $campusID = $assignment['campus_id'];
                 // retrieve latest campus_id assigned to registrant
                 // update confirmation # in database for the proper registration
                 $updateArray = array();
                 $updateArray['registration_id'] = $this->reg_id;
                 $updateArray['registration_confirmNum'] = $confirm_num . $campusID;
                 // append the new campus_ID
                 $regsManager = new RowManager_RegistrationManager($this->reg_id);
                 $regsManager->loadFromArray($updateArray);
                 $regsManager->updateDBTable();
             } else {
                 $this->storeRegStatus($this->reg_id, RowManager_StatusManager::INCOMPLETE);
                 $status_message = 'The confirmation number has not been properly set.';
                 return RowManager_StatusManager::INCOMPLETE . '|' . $status_message;
             }
         }
         // 			  $status = new RowManager_StatusManager();
         // 			  $status->setStatusDesc(RowManager_StatusManager::REGISTERED);
         //
         // 		     $statusList = $status->getListIterator();
         // 		     $statusArray = $statusList->getDataList();
         // 		     $status_id = -1;
         // 		     reset($statusArray);		// should be only 1 record for a particular status description
         // 		     foreach (array_keys($statusArray) as $k)
         // 		     {
         // 			     $record = current($statusArray);
         // 			     $status_id = $record['status_id'];
         //
         // 			     next($statusArray);
         // 		     }
         //
         // 		     if ($status_id == -1)
         // 		     {
         // 			     $status_message = 'The registration status could not be properly set to REGISTERED.';
         // 					return  RowManager_StatusManager::INCOMPLETE.'|'.$status_message;
         // 			  }
         //
         // 			  $updateValues = array();
         // 			  $updateValues['registration_id'] = $this->reg_id;
         // 			  $updateValues['registration_status'] = $status_id;	// mark registration as being REGISTERED
         //
         //             // Store values in RegistrationManager object
         //             $regs->loadFromArray( $updateValues );
         // //              echo "<pre>".print_r($this->formValues ,true)."</pre>";
         //
         //             // update information
         //              $regs->updateDBTable();
         $success = $this->storeRegStatus($this->reg_id, RowManager_StatusManager::REGISTERED);
         if ($success == false) {
             $status_message = 'The registration status could not be properly set to REGISTERED.';
             return RowManager_StatusManager::INCOMPLETE . '|' . $status_message;
         } else {
             $status_message = '';
             return RowManager_StatusManager::REGISTERED . '|' . $status_message;
         }
     } else {
         return RowManager_StatusManager::UNASSIGNED . '|' . $status_message;
     }
 }
Example #2
0
  * cctransaction_moddate [DATE]  The timestamp of the last modification to the transaction record.
  */
 $CreditCardTransaction = new RowManager_CreditCardTransactionManager();
 $CreditCardTransaction->dropTable();
 $CreditCardTransaction->createTable();
 /*
  * FieldValue Table
  *
  * Assigns a value to a registration form field for some registrant.
  *
  * fieldvalues_id [INTEGER]  Unique identifier for the field value stored for a particular field-registrant combination.
  * fields_id [INTEGER]  Value identifying the form field being assigned the value.
  * fieldvalues_value [STRING]  The value being assigned to a particular form field for some registration.
  * registration_id [INTEGER]  The value identifying the registration associated with the field value assignment.
  */
 $FieldValue = new RowManager_FieldValueManager();
 $FieldValue->dropTable();
 $FieldValue->createTable();
 /*
  * Registration Table
  *
  * Manages basic registration data for some person-event combination.
  *
  * registration_id [INTEGER]  Unique identifier for this particular registration record
  * event_id [INTEGER]  The event the person is registering for.
  * person_id [INTEGER]  The value identifying the person registering.
  * registration_date [DATE]  The date the registration was made.
  * registration_confirmNum [STRING]  The confirmation number for the registration.
  */
 $Registration = new RowManager_RegistrationManager();
 $Registration->dropTable();
Example #3
0
 private function loadFieldValuesForm(&$form)
 {
     $fields = new RowManager_FieldManager();
     $fieldTypes = new RowManager_FieldTypeManager();
     $fieldValues = new RowManager_FieldValueManager();
     $fieldValues->setRegID($this->REG_ID);
     $formFieldValues = new MultiTableManager();
     $formFieldValues->addRowManager($fields);
     $formFieldValues->addRowManager($fieldTypes, new JoinPair($fields->getJoinOnFieldTypeID(), $fieldTypes->getJoinOnFieldTypeID()));
     $formFieldValues->addRowManager($fieldValues, new JoinPair($fields->getJoinOnFieldID(), $fieldValues->getJoinOnFieldID()));
     $formFieldValues->setSortOrder('fields_priority');
     $formFieldValuesList = $formFieldValues->getListIterator();
     $formFieldValuesArray = $formFieldValuesList->getDataList();
     $formFieldLabels = array();
     $formData = array();
     $fieldInfo = '';
     //		$isFirst = true;
     $fieldValue = '';
     reset($formFieldValuesArray);
     // (below) store registration-specific form values for event-specific fields
     foreach (array_keys($formFieldValuesArray) as $k) {
         $row = current($formFieldValuesArray);
         //			$field_value = $row['fieldvalues_value'];
         $fieldName = 'fields_id' . $row['fields_id'];
         $fieldInfo .= $fieldName . '|' . $row['fieldtypes_desc'] . '|' . $row['datatypes_id'] . '|' . $row['fields_reqd'] . '|' . $row['fields_invalid'] . '';
         $formFieldLabels[$fieldName] = $row['fields_desc'];
         $fieldValue = $row['fieldvalues_value'];
         $formData[$fieldName] = $fieldValue;
         $fieldInfo .= ',';
         next($formFieldValuesArray);
     }
     $fieldInfo = substr($fieldInfo, 0, -1);
     // remove final ','
     // set data in the form to be displayed
     $form->setFields($fieldInfo);
     $form->setFormData($formData);
     $form->setLabels($formFieldLabels);
     $form->setButtonText('Update');
     // setup form action based on AppController standards
     $parameters = array('EVENT_ID' => $this->EVENT_ID, 'FIELDTYPE_ID' => $this->FIELDTYPE_ID, 'PRICERULETYPE_ID' => $this->PRICERULETYPE_ID, 'CCTYPE_ID' => $this->CCTYPE_ID, 'PRIV_ID' => $this->PRIV_ID, 'VIEWER_ID' => $this->VIEWER_ID, 'SUPERADMIN_ID' => $this->SUPERADMIN_ID, 'EVENTADMIN_ID' => $this->EVENTADMIN_ID, 'FIELD_ID' => $this->FIELD_ID, 'DATATYPE_ID' => $this->DATATYPE_ID, 'PRICERULE_ID' => $this->PRICERULE_ID, 'CAMPUSACCESS_ID' => $this->CAMPUSACCESS_ID, 'CASHTRANS_ID' => $this->CASHTRANS_ID, 'CCTRANS_ID' => $this->CCTRANS_ID, 'REG_ID' => $this->REG_ID, 'FIELDVALUE_ID' => $this->FIELDVALUE_ID, 'SCHOLARSHIP_ID' => $this->SCHOLARSHIP_ID, 'STATUS_ID' => $this->STATUS_ID, 'CAMPUS_ID' => $this->CAMPUS_ID);
     //[RAD_CALLBACK_PARAMS]
     $formAction = $this->getCallBack(modulecim_reg::PAGE_EDITREGISTRATIONFIELDVALUESFORM, $this->sortBy, $parameters);
     $form->setFormAction($formAction);
     return;
 }
 /**
  * function getBasePriceForRegistrant
  * <pre>
  * Returns registration cost for a particular registration, not including scholarship discounts
  * </pre>
  * Pre-condition: all variables must be initialized with proper values
  *
  * @param $regID [INTEGER]		registration ID
  * @param $eventID [INTEGER]	event ID
  * @param $campusID [INTEGER]	campus ID (precondition: must be associated directly with registration ID)
  * @param $eventBasePrice [INTEGER]	the cost of the event per registration, before any discounts
  * @param $priceRulesArray [ARRAY]	an array of the price rules applying to event denoted by $eventID
  * @param &$rulesApplied [ARRAY REFERENCE]	reference to an array to be filled with applied rules	
  * @return [INTEGER] $basePriceForThisGuy		the new base price for registration $regID (before scholarships)
  */
 function getBasePriceForRegistrant($regID, $eventID, $campusID, $eventBasePrice, $priceRulesArray, &$rulesApplied = array())
 {
     // Need to manually calculate discounts for these exceptions:
     $BC_SUMMIT_2007 = 19;
     $MB_SUMMIT_2007 = 22;
     $LAKESHORE_SUMMIT_2007 = 25;
     $EASTERN_WC_2007 = 28;
     $AIA_NATIONAL_TRAINING = 33;
     $MARITIMES_SUMMIT_2008 = 34;
     $basePriceForThisGuy = $eventBasePrice;
     // 	     echo "<pre>".print_r($priceRulesArray,true)."</pre>";
     // PUT SPECIAL EVENT EXCEPTIONS HERE AS CONDITIONAL STATEMENTS:
     /*	    if ($eventID == $MARITIMES_SUMMIT_2008)
     	    {
     		    $FROSH_DISCOUNT_FIELD = 119;
     		    
     		    // first check for Frosh Discount
                 $fieldValue = new RowManager_FieldValueManager();
     // 	            $fieldValue->loadByFieldIDandRegID($rule['fields_id'],$regID);
     			$fieldValue->setFieldID($FROSH_DISCOUNT_FIELD);
     			$fieldValue->setRegID($regID);
              
              $valueListManager = $fieldValue->getListIterator(); 
              $fieldValueList = $valueListManager->getDataList();	
     // 		         echo "<pre>".print_r($fieldValueList,true)."</pre>";
     			
              reset($fieldValueList);
              $record = current($fieldValueList);		         	
     
     			// CHECK TO SEE IF SOME FIELD VALUE HAS BEEN SET FOR GIVEN PARAMETERS
     // 					$userValue = '';
     			$userValue = $record['fieldvalues_value'];   // $fieldValue->getFieldValue();
     			if ((isset($userValue))&&($userValue != '')) 
     			{
     			
     				// DETERMINE WHETHER PRICE RULE VALUE IS EQUIVALENT TO CURRENT FIELD VALUE
                 if ( $userValue == '1')
                 {
                     // form criteria is met, apply the discount/penalty
     //                 $basePriceForThisGuy -= 15;		// subtract $15 from $65 event base cost
     					$basePriceForThisGuy = 50;		// frosh cost
     					
     					$rulesApplied[] = $priceRulesArray['45'];
     					
     					return $basePriceForThisGuy;
                 }			
            	}  
            	
            	// if no frosh discount, THEN apply early bird discount (if conditions met)
     // 		        echo "DATE RULE<BR>";
              // get the user's registration date    
              $registration = new RowManager_RegistrationManager();
              $registration->setRegID($regID);
              
              $regListManager = $registration->getListIterator(); 
              $regArray = $regListManager->getDataList();	
     //        echo "<pre>".print_r($registration,true)."</pre>";	
     
     			// set default date-time
     			$regTime = '';	
     			
     			// retrieve registration date
     			reset($regArray);
     			$record = current($regArray);	// should be only 1 record for regID
     			$regTime = $record['registration_date'];
     		
     // 					$regTime = $registration->getRegistrationDate();
     			if ($regTime != '') 
     			{										
     				
                 // if the registrant signed up before a deadline, apply the rule
                 if ( strtotime($regTime) < strtotime( '2008-04-01' )  )		//$rule['pricerules_value']
                 {
                     // date criteria is met, apply the discount/penalty
     //                 $basePriceForThisGuy -= 15;		// apply early bird discount to $65 event base cost to get $50
                     
     					 $basePriceForThisGuy = 50;
                     $rulesApplied[] = $priceRulesArray['47'];
                     
                     return $basePriceForThisGuy;
                 }	
           	}	      		    
     		    
     	    	return $basePriceForThisGuy;			// otherwise return unaltered base event cost ($125)
         	}		*/
     if ($eventID == $AIA_NATIONAL_TRAINING) {
         $FOOD_PASS_REQ_FIELD = 102;
         $HOUSING_REQ_FIELD = 103;
         // first check for Food Pass Fee
         $fieldValue = new RowManager_FieldValueManager();
         // 	            $fieldValue->loadByFieldIDandRegID($rule['fields_id'],$regID);
         $fieldValue->setFieldID($FOOD_PASS_REQ_FIELD);
         $fieldValue->setRegID($regID);
         $valueListManager = $fieldValue->getListIterator();
         $fieldValueList = $valueListManager->getDataList();
         // 		         echo "<pre>".print_r($fieldValueList,true)."</pre>";
         reset($fieldValueList);
         $record = current($fieldValueList);
         // CHECK TO SEE IF SOME FIELD VALUE HAS BEEN SET FOR $FOOD_PASS_REQ_FIELD
         // 					$userValue = '';
         $userValue = $record['fieldvalues_value'];
         // $fieldValue->getFieldValue();
         if (isset($userValue) && $userValue != '') {
             /** Get the user's registration date **/
             $registration = new RowManager_RegistrationManager();
             $registration->setRegID($regID);
             $regListManager = $registration->getListIterator();
             $regArray = $regListManager->getDataList();
             //        echo "<pre>".print_r($registration,true)."</pre>";
             // set default date-time
             $regTime = '';
             // retrieve registration date-time
             reset($regArray);
             $record = current($regArray);
             // should be only 1 record for regID
             $regTime = $record['registration_date'];
             // DETERMINE WHETHER PRICE RULE VALUE IS EQUIVALENT TO CURRENT FIELD VALUE
             if ($userValue == '1') {
                 // form criteria is met, apply the discount/penalty
                 //                 $basePriceForThisGuy += 100;		// add 150 to base 260 event price
                 $basePriceForThisGuy += 150;
                 $rulesApplied[] = $priceRulesArray['39'];
                 // Apply early-bird discount on this if applicable
                 if ($regTime != '') {
                     // if the registrant signed up before a deadline, apply the rule
                     if (strtotime($regTime) < strtotime('2008-04-16')) {
                         $basePriceForThisGuy -= 50;
                         // subtract 50
                         $rulesApplied[] = $priceRulesArray['42'];
                     }
                 }
             }
         }
         // second check for Housing Fee
         $fieldValue = new RowManager_FieldValueManager();
         // 	            $fieldValue->loadByFieldIDandRegID($rule['fields_id'],$regID);
         $fieldValue->setFieldID($HOUSING_REQ_FIELD);
         $fieldValue->setRegID($regID);
         $valueListManager = $fieldValue->getListIterator();
         $fieldValueList = $valueListManager->getDataList();
         // 		         echo "<pre>".print_r($fieldValueList,true)."</pre>";
         reset($fieldValueList);
         $record = current($fieldValueList);
         // CHECK TO SEE IF SOME FIELD VALUE HAS BEEN SET FOR $HOUSING_REQ_FIELD
         // 					$userValue = '';
         $userValue = $record['fieldvalues_value'];
         // $fieldValue->getFieldValue();
         if (isset($userValue) && $userValue != '') {
             /** Get the user's registration date **/
             $registration = new RowManager_RegistrationManager();
             $registration->setRegID($regID);
             $regListManager = $registration->getListIterator();
             $regArray = $regListManager->getDataList();
             //        echo "<pre>".print_r($registration,true)."</pre>";
             // set default date-time
             $regTime = '';
             // retrieve registration date-time
             reset($regArray);
             $record = current($regArray);
             // should be only 1 record for regID
             $regTime = $record['registration_date'];
             // DETERMINE WHETHER PRICE RULE VALUE IS EQUIVALENT TO CURRENT FIELD VALUE
             if ($userValue == '1') {
                 // form criteria is met, apply the discount/penalty
                 //                 $basePriceForThisGuy += 180;		// add 230 to base 260 event price
                 $basePriceForThisGuy += 230;
                 $rulesApplied[] = $priceRulesArray['41'];
                 // Apply early-bird discount on this if applicable
                 if ($regTime != '') {
                     // if the registrant signed up before a deadline, apply the rule
                     if (strtotime($regTime) < strtotime('2008-04-16')) {
                         $basePriceForThisGuy -= 50;
                         // subtract 50
                         $rulesApplied[] = $priceRulesArray['42'];
                     }
                 }
                 return $basePriceForThisGuy;
             }
         }
         return $basePriceForThisGuy;
         // otherwise return unaltered base event cost ($125)
     }
     if ($eventID == $EASTERN_WC_2007) {
         $COMMUTER_DISCOUNT_FIELD = 86;
         // first check for Frosh Discount
         $fieldValue = new RowManager_FieldValueManager();
         // 	            $fieldValue->loadByFieldIDandRegID($rule['fields_id'],$regID);
         $fieldValue->setFieldID($COMMUTER_DISCOUNT_FIELD);
         $fieldValue->setRegID($regID);
         $valueListManager = $fieldValue->getListIterator();
         $fieldValueList = $valueListManager->getDataList();
         // 		         echo "<pre>".print_r($fieldValueList,true)."</pre>";
         reset($fieldValueList);
         $record = current($fieldValueList);
         // CHECK TO SEE IF SOME FIELD VALUE HAS BEEN SET FOR GIVEN PARAMETERS
         // 					$userValue = '';
         $userValue = $record['fieldvalues_value'];
         // $fieldValue->getFieldValue();
         if (isset($userValue) && $userValue != '') {
             // DETERMINE WHETHER PRICE RULE VALUE IS EQUIVALENT TO CURRENT FIELD VALUE
             if ($userValue == '1') {
                 // form criteria is met, apply the discount/penalty
                 //                 $basePriceForThisGuy -= 80;		// subtract $80 from $279 event base cost
                 $basePriceForThisGuy = 199;
                 // commuter cost
                 $rulesApplied[] = $priceRulesArray['38'];
                 return $basePriceForThisGuy;
             }
         }
         // if no commuter discount, THEN apply early bird discount (if conditions met)
         // 		        echo "DATE RULE<BR>";
         // get the user's registration date
         $registration = new RowManager_RegistrationManager();
         $registration->setRegID($regID);
         $regListManager = $registration->getListIterator();
         $regArray = $regListManager->getDataList();
         //        echo "<pre>".print_r($registration,true)."</pre>";
         // set default date-time
         $regTime = '';
         // retrieve registration date
         reset($regArray);
         $record = current($regArray);
         // should be only 1 record for regID
         $regTime = $record['registration_date'];
         // 					$regTime = $registration->getRegistrationDate();
         if ($regTime != '') {
             // if the registrant signed up before a deadline, apply the rule
             if (strtotime($regTime) < strtotime('2007-12-01')) {
                 if (strtotime($regTime) < strtotime('2007-10-09')) {
                     // date criteria is met, apply the discount/penalty
                     //                 $basePriceForThisGuy -= 50;		// apply early bird discounts to $279 event base cost to get $229
                     $basePriceForThisGuy = 229;
                     $rulesApplied[] = $priceRulesArray['37'];
                     $rulesApplied[] = $priceRulesArray['36'];
                     return $basePriceForThisGuy;
                 } else {
                     // date criteria is met, apply the discount/penalty
                     //                 $basePriceForThisGuy -= 50;		// apply regular discount to $279 event base cost to get $259
                     $basePriceForThisGuy = 259;
                     $rulesApplied[] = $priceRulesArray['36'];
                     return $basePriceForThisGuy;
                 }
             }
         }
         return $basePriceForThisGuy;
         // otherwise return unaltered base event cost ($125)
     }
     // PUT SPECIAL EVENT EXCEPTIONS HERE AS CONDITIONAL STATEMENTS:
     if ($eventID == $BC_SUMMIT_2007) {
         $FROSH_DISCOUNT_FIELD = 54;
         // first check for Frosh Discount
         $fieldValue = new RowManager_FieldValueManager();
         // 	            $fieldValue->loadByFieldIDandRegID($rule['fields_id'],$regID);
         $fieldValue->setFieldID($FROSH_DISCOUNT_FIELD);
         $fieldValue->setRegID($regID);
         $valueListManager = $fieldValue->getListIterator();
         $fieldValueList = $valueListManager->getDataList();
         // 		         echo "<pre>".print_r($fieldValueList,true)."</pre>";
         reset($fieldValueList);
         $record = current($fieldValueList);
         // CHECK TO SEE IF SOME FIELD VALUE HAS BEEN SET FOR GIVEN PARAMETERS
         // 					$userValue = '';
         $userValue = $record['fieldvalues_value'];
         // $fieldValue->getFieldValue();
         if (isset($userValue) && $userValue != '') {
             // DETERMINE WHETHER PRICE RULE VALUE IS EQUIVALENT TO CURRENT FIELD VALUE
             if ($userValue == '1') {
                 // form criteria is met, apply the discount/penalty
                 //                 $basePriceForThisGuy -= 46;		// subtract $46 from $125 event base cost
                 $basePriceForThisGuy = 79;
                 // frosh cost
                 $rulesApplied[] = $priceRulesArray['14'];
                 return $basePriceForThisGuy;
             }
         }
         // if no frosh discount, THEN apply early bird discount (if conditions met)
         // 		        echo "DATE RULE<BR>";
         // get the user's registration date
         $registration = new RowManager_RegistrationManager();
         $registration->setRegID($regID);
         $regListManager = $registration->getListIterator();
         $regArray = $regListManager->getDataList();
         //        echo "<pre>".print_r($registration,true)."</pre>";
         // set default date-time
         $regTime = '';
         // retrieve registration date
         reset($regArray);
         $record = current($regArray);
         // should be only 1 record for regID
         $regTime = $record['registration_date'];
         // 					$regTime = $registration->getRegistrationDate();
         if ($regTime != '') {
             // if the registrant signed up before a deadline, apply the rule
             if (strtotime($regTime) < strtotime('2007-09-21')) {
                 // date criteria is met, apply the discount/penalty
                 //                 $basePriceForThisGuy -= 26;		// apply early bird discount to $125 event base cost to get $99
                 $basePriceForThisGuy = 99;
                 $rulesApplied[] = $priceRulesArray['15'];
                 return $basePriceForThisGuy;
             }
         }
         return $basePriceForThisGuy;
         // otherwise return unaltered base event cost ($125)
     }
     if ($eventID == $MB_SUMMIT_2007) {
         $FROSH_DISCOUNT_FIELD = 60;
         $FROSH_VOLUME_THRESHOLD = 20;
         $MB_EARLY_FROSH_TABLE = 'temp_mb_early_frosh';
         // first check for Frosh Discount
         $fieldValue = new RowManager_FieldValueManager();
         // 	            $fieldValue->loadByFieldIDandRegID($rule['fields_id'],$regID);
         $fieldValue->setFieldID($FROSH_DISCOUNT_FIELD);
         $fieldValue->setRegID($regID);
         $valueListManager = $fieldValue->getListIterator();
         $fieldValueList = $valueListManager->getDataList();
         // 		         echo "<pre>".print_r($fieldValueList,true)."</pre>";
         reset($fieldValueList);
         $record = current($fieldValueList);
         // CHECK TO SEE IF SOME FIELD VALUE HAS BEEN SET FOR GIVEN PARAMETERS
         // 					$userValue = '';
         $userValue = $record['fieldvalues_value'];
         // $fieldValue->getFieldValue();
         if (isset($userValue) && $userValue != '') {
             // DETERMINE WHETHER PRICE RULE VALUE IS EQUIVALENT TO CURRENT FIELD VALUE
             if ($userValue == '1') {
                 // check if there are 20 or more frosh already stored
                 $froshValues = new RowManager_FieldValueManager();
                 $froshValues->setFieldID($FROSH_DISCOUNT_FIELD);
                 $froshValues->setFieldValue('1');
                 // 1 = checked checkbox
                 $fieldsManager = new MultiTableManager();
                 $fieldsManager->addRowManager($froshValues);
                 // TODO: sub-query like 'SELECT <ALL FIELD VALUES FOR SPECIFIC FROSH DISCOUNT> WHERE REG_ID IN (SELECT ALL REGISTRATIONS FOR EVENT)'
                 $regs = new RowManager_RegistrationManager();
                 $regs->setEventID($eventID);
                 $regData = new MultiTableManager();
                 $regData->addRowManager($regs);
                 $regData->setFieldList('registration_id');
                 $registered_SQL = $regData->createSQL();
                 // actually creates the sub-query in order to get an accurate count of discount field values stored
                 $negateSubQuery = false;
                 $addSubQuery = true;
                 $fieldsManager->constructSubQuery('registration_id', $registered_SQL, $negateSubQuery, $addSubQuery);
                 // 		         $froshValues->setSortOrder('registration_id');
                 $froshList = $fieldsManager->getListIterator();
                 $froshArray = array();
                 $froshArray = $froshList->getDataList();
                 // 		         echo "COUNT = ".count($froshArray);
                 if (count($froshArray) <= $FROSH_VOLUME_THRESHOLD) {
                     // form criteria is met, apply the discount/penalty
                     //                 $basePriceForThisGuy -= 25;		// subtract $46 from $125 event base cost
                     $basePriceForThisGuy = 40;
                     // frosh cost
                     $rulesApplied[] = $priceRulesArray['25'];
                     $db = new Database_MySQL();
                     $db->connectToDB(SITE_DB_NAME, SITE_DB_PATH, SITE_DB_USER, SITE_DB_PWORD);
                     // precaution that avoids duplicates
                     $sql = "DELETE FROM " . $MB_EARLY_FROSH_TABLE . " WHERE registration_id = " . $regID;
                     $db->runSQL($sql);
                     $sql = "INSERT INTO " . $MB_EARLY_FROSH_TABLE . " (registration_id) VALUES (" . $regID . ")";
                     $db->runSQL($sql);
                 } else {
                     $db = new Database_MySQL();
                     $db->connectToDB(SITE_DB_NAME, SITE_DB_PATH, SITE_DB_USER, SITE_DB_PWORD);
                     $sql = "SELECT * FROM " . $MB_EARLY_FROSH_TABLE . " WHERE registration_id = " . $regID;
                     $db->runSQL($sql);
                     $temp_regID = '';
                     if ($row = $db->retrieveRow()) {
                         $temp_regID = $row['registration_id'];
                     }
                     // apply rule despite there being >20 frosh because this registration existed before cut-off
                     if ($regID == $temp_regID) {
                         //                 $basePriceForThisGuy -= 25;		// subtract $25 from $85 event base cost
                         $basePriceForThisGuy = 40;
                         // frosh cost
                         $rulesApplied[] = $priceRulesArray['25'];
                     } else {
                         $basePriceForThisGuy = 60;
                         // basic frosh cost
                         $rulesApplied[] = $priceRulesArray['28'];
                     }
                 }
                 return $basePriceForThisGuy;
             }
         }
         return $basePriceForThisGuy;
         // otherwise return unaltered base event cost ($85)
     }
     if ($eventID == $LAKESHORE_SUMMIT_2007) {
         $FROSH_DISCOUNT_FIELD = 64;
         // first check for Frosh Discount
         $fieldValue = new RowManager_FieldValueManager();
         // 	            $fieldValue->loadByFieldIDandRegID($rule['fields_id'],$regID);
         $fieldValue->setFieldID($FROSH_DISCOUNT_FIELD);
         $fieldValue->setRegID($regID);
         $valueListManager = $fieldValue->getListIterator();
         $fieldValueList = $valueListManager->getDataList();
         // 		         echo "<pre>".print_r($fieldValueList,true)."</pre>";
         reset($fieldValueList);
         $record = current($fieldValueList);
         // CHECK TO SEE IF SOME FIELD VALUE HAS BEEN SET FOR GIVEN PARAMETERS
         // 					$userValue = '';
         $userValue = $record['fieldvalues_value'];
         // $fieldValue->getFieldValue();
         if (isset($userValue) && $userValue != '') {
             // DETERMINE WHETHER PRICE RULE VALUE IS EQUIVALENT TO CURRENT FIELD VALUE
             if ($userValue == '1') {
                 // form criteria is met, apply the discount/penalty
                 //                 $basePriceForThisGuy -= <varies>;		// subtract <varying amount> from $120/$115/$110/$105 to get $75
                 $basePriceForThisGuy = 75;
                 // frosh cost
                 $rulesApplied[] = $priceRulesArray['19'];
                 return $basePriceForThisGuy;
             }
         }
         // if no frosh discount, THEN apply early bird discount (if conditions met)
         // 		        echo "DATE RULE<BR>";
         // get the user's registration date
         $registration = new RowManager_RegistrationManager();
         $registration->setRegID($regID);
         $regListManager = $registration->getListIterator();
         $regArray = $regListManager->getDataList();
         //        echo "<pre>".print_r($registration,true)."</pre>";
         // set default date-time
         $regTime = '';
         // retrieve registration date
         reset($regArray);
         $record = current($regArray);
         // should be only 1 record for regID
         $regTime = $record['registration_date'];
         // 					$regTime = $registration->getRegistrationDate();
         if ($regTime != '') {
             // if the registrant signed up before a deadline, apply the rule
             if (strtotime($regTime) < strtotime('2007-09-26')) {
                 // date criteria is met, apply the discount/penalty
                 //                 $basePriceForThisGuy -= 15;		// apply early bird discount to $115 event base cost to get $105
                 $basePriceForThisGuy = 105;
                 $rulesApplied[] = $priceRulesArray['20'];
                 return $basePriceForThisGuy;
             }
         }
         return $basePriceForThisGuy;
         // otherwise return unaltered base event cost ($120)
     }
     /**** END OF RULE EXCEPTIONS ****/
     // apply any price rules
     foreach ($priceRulesArray as $key => $rule) {
         $ruleType = $rule['priceruletypes_id'];
         // form attribute rule: apply price rule based on whether some form field value exists (i.e. frosh discount)
         if ($ruleType == RowManager_PriceRuleTypeManager::FORM_ATTRIBUTE_RULE) {
             // 	            echo "FORM RULE<BR>";
             // get the user's input for this form attribute
             $fieldValue = new RowManager_FieldValueManager();
             // 	            $fieldValue->loadByFieldIDandRegID($rule['fields_id'],$regID);
             $fieldValue->setFieldID($rule['fields_id']);
             $fieldValue->setRegID($regID);
             $valueListManager = $fieldValue->getListIterator();
             $fieldValueList = $valueListManager->getDataList();
             // 		         echo "<pre>".print_r($fieldValueList,true)."</pre>";
             reset($fieldValueList);
             $record = current($fieldValueList);
             // CHECK TO SEE IF SOME FIELD VALUE HAS BEEN SET FOR GIVEN PARAMETERS
             // 					$userValue = '';
             $userValue = $record['fieldvalues_value'];
             // $fieldValue->getFieldValue();
             if (isset($userValue) && $userValue != '') {
                 // DETERMINE WHETHER PRICE RULE VALUE IS EQUIVALENT TO CURRENT FIELD VALUE
                 if ($rule['pricerules_value'] == $userValue) {
                     // form criteria is met, apply the discount/penalty
                     $basePriceForThisGuy += $rule['pricerules_discount'];
                     $rulesApplied[] = $rule;
                 }
             }
         } else {
             if ($ruleType == RowManager_PriceRuleTypeManager::DATE_RULE) {
                 // 		        echo "DATE RULE<BR>";
                 // get the user's registration date
                 $registration = new RowManager_RegistrationManager();
                 $registration->setRegID($regID);
                 $regListManager = $registration->getListIterator();
                 $regArray = $regListManager->getDataList();
                 //        echo "<pre>".print_r($registration,true)."</pre>";
                 // set default date-time
                 $regTime = '';
                 // retrieve registration date
                 reset($regArray);
                 $record = current($regArray);
                 // should be only 1 record for regID
                 $regTime = $record['registration_date'];
                 // 					$regTime = $registration->getRegistrationDate();
                 if ($regTime != '') {
                     // if the registrant signed up before a deadline, apply the rule
                     if (strtotime($regTime) < strtotime($rule['pricerules_value'])) {
                         // date criteria is met, apply the discount/penalty
                         $basePriceForThisGuy += $rule['pricerules_discount'];
                         $rulesApplied[] = $rule;
                     }
                 }
             } else {
                 if ($ruleType == RowManager_PriceRuleTypeManager::VOLUME_RULE) {
                     $volumeNeeded = $rule['pricerules_value'];
                     // 		        $correctCampus = false;
                     // 		        $pattern = RowManager_PriceRuleTypeManager::CAMPUS_VOLUME_REGEX;
                     // 		        $numMatches = preg_match($pattern, $rule['pricerules_value']);
                     // 		        if ($numMatches > 0)
                     // 		        {
                     //
                     // 						$pricingValues = explode('|',$rule['pricerules_value']);
                     // 	//					echo '<pre>'.print_r($pricingValues,true).'</pre>';
                     // 	//					echo 'campus = '.$pricingValues[0].'  cut-off = '.$pricingValues[1];
                     // 						if ((int)$pricingValues[0] == $campusID)
                     // 						{
                     // 							$correctCampus = true;
                     // 							$volumeNeeded = $pricingValues[1];
                     //
                     // 	/*						if ($numRegistrantsMyCampus != '')
                     // 							{
                     // 				            // if the # of registrants >= the bulk discount value...
                     // 				            if ( $numRegistrantsMyCampus >= $pricingValues[1] )
                     // 				            {
                     // 				                // bulk discount criteria is met, apply the discount/penalty
                     // 				                $basePriceForThisGuy += $rule['pricerules_discount'];
                     //
                     // 				                $rulesApplied[] = $rule;
                     // 				            }
                     // 			         	}
                     // 			         	else 	// try to calculate the # of registrants on our own
                     // 			         	{
                     // 	*/
                     //
                     // 	/**						}
                     // 	**/
                     // 						}
                     // 					}
                     //
                     // 					// check volume rule if no specific campus associated or current campus is associated with rule
                     // 					if (($numMatches == 0)||($correctCampus == true))
                     // 					{
                     if (isset($campusID) && $campusID != '') {
                         // get total registrations for specific campus and particular event
                         $total = array();
                         $summary = new RegSummaryTools();
                         $total = $summary->getCampusRegistrations($eventID, '', false, $campusID, '', RowManager_RegistrationManager::STATUS_REGISTERED);
                         if (isset($total[$campusID])) {
                             $numRegistrantsMyCampus = $total[$campusID];
                         } else {
                             $numRegistrantsMyCampus = 0;
                         }
                         if (count($total) > 0) {
                             // if the # of registrants >= the bulk discount value...
                             if ($numRegistrantsMyCampus >= $volumeNeeded) {
                                 // bulk discount criteria is met, apply the discount/penalty
                                 $basePriceForThisGuy += $rule['pricerules_discount'];
                                 $rulesApplied[] = $rule;
                             }
                         }
                     } else {
                         // should not occur, this function meant to be used with campusID set
                     }
                 } else {
                     if ($ruleType == RowManager_PriceRuleTypeManager::CAMPUS_RULE) {
                         // 		        echo "CAMPUS RULE<BR>";
                         // check the campus ID against the one stored in the price rules table
                         if ($campusID == $rule['pricerules_value']) {
                             $basePriceForThisGuy += $rule['pricerules_discount'];
                             $rulesApplied[] = $rule;
                         }
                     } else {
                         die('unknown ruletype[' . $ruleType . ']');
                     }
                 }
             }
         }
     }
     // foreach rule
     // special hack for Eastern Ontario/Montreal summit 2006
     /*	    if ( $eventID == 4 )
     	    {
     	        $basePriceForThisGuy = getBasePriceEasternSummit2006( $regID, $numRegistrantsMyCampus, $rulesApplied );
     	    }
     	    else if ( $eventID == 11 )
     	    {
     	        $basePriceForThisGuy = getBasePricePrairieSummit2006( $regID, $campusID, $numRegistrantsMyCampus, $rulesApplied );
     	    }
     */
     return $basePriceForThisGuy;
 }
 private function deleteAssociatedRegRecords($reg_id)
 {
     // delete any CC transactions linked to the registration record
     $ccTrans = new RowManager_CreditCardTransactionManager();
     $ccTrans->setRegID($reg_id);
     $ccTransList = $ccTrans->getListIterator();
     $ccTransArray = $ccTransList->getDataList();
     reset($ccTransArray);
     foreach (array_keys($ccTransArray) as $k) {
         $record = current($ccTransArray);
         $ccTransID = $record['cctransaction_id'];
         // delete any CC transaction receipts linked to the registration record
         $ccReceipt = new RowManager_ReceiptManager($ccTransID);
         $ccReceipt->deleteEntry();
         // delete CC trans record now that we know CC trans. ID
         $deleteCCtrans = new RowManager_CreditCardTransactionManager($ccTransID);
         $deleteCCtrans->deleteEntry();
         next($ccTransArray);
     }
     // delete any cash transactions linked to the registration record
     $cashTrans = new RowManager_CashTransactionManager();
     $cashTrans->setRegID($reg_id);
     $cashTransList = $cashTrans->getListIterator();
     $cashTransArray = $cashTransList->getDataList();
     reset($cashTransArray);
     foreach (array_keys($cashTransArray) as $k) {
         $record = current($cashTransArray);
         $cashTransID = $record['cashtransaction_id'];
         // delete cash trans record now that we know cash trans. ID
         $deleteCashTrans = new RowManager_CashTransactionManager($cashTransID);
         $deleteCashTrans->deleteEntry();
         next($cashTransArray);
     }
     // delete any scholarships linked to the registration record
     $scholarship = new RowManager_ScholarshipAssignmentManager();
     $scholarship->setRegID($reg_id);
     $scholarshipList = $scholarship->getListIterator();
     $scholarshipArray = $scholarshipList->getDataList();
     reset($scholarshipArray);
     foreach (array_keys($scholarshipArray) as $k) {
         $record = current($scholarshipArray);
         $scholarshipID = $record['scholarship_id'];
         // delete cash trans record now that we know scholarship ID
         $deleteScholarship = new RowManager_ScholarshipAssignmentManager($scholarshipID);
         $deleteScholarship->deleteEntry();
         next($scholarshipArray);
     }
     // delete any field values linked to the registration record
     $fieldValues = new RowManager_FieldValueManager();
     $fieldValues->setRegID($reg_id);
     $fieldValuesList = $fieldValues->getListIterator();
     $fieldValuesArray = $fieldValuesList->getDataList();
     reset($fieldValuesArray);
     foreach (array_keys($fieldValuesArray) as $k) {
         $record = current($fieldValuesArray);
         $fieldValueID = $record['fieldvalues_id'];
         // delete cash trans record now that we know field value ID
         $deleteFieldValue = new RowManager_FieldValueManager($fieldValueID);
         $deleteFieldValue->deleteEntry();
         next($fieldValuesArray);
     }
 }
 protected function getFieldValuesArray($regID = '', $personID = '', $eventID = '')
 {
     $FALSE = 0;
     $fields = new RowManager_FieldManager();
     $fvalues = new RowManager_FieldValueManager();
     $ftypes = new RowManager_FieldTypeManager();
     // 		 echo "personID = ".$personID;
     // 		 echo "eventID = ".$eventID;
     if ($regID != '') {
         //$fields->setEventID($eventID);
         $fvalues->setRegID($regID);
     } else {
         if ($eventID != '' && $personID != '') {
             $registrations = new RowManager_RegistrationManager();
             // 		    $registrations->setRegID($regID);
             $person = new RowManager_PersonManager();
             $person->setPersonID($personID);
             $event = new RowManager_EventManager();
             $event->setEventID($eventID);
             $personReg = new MultiTableManager();
             $personReg->addRowManager($registrations);
             $personReg->addRowManager($person, new JoinPair($registrations->getJoinOnPersonID(), $person->getJoinOnPersonID()));
             $personReg->addRowManager($event, new JoinPair($registrations->getJoinOnEventID(), $event->getJoinOnEventID()));
             $valIterator = $personReg->getListIterator();
             $valArray = $valIterator->getDataList();
             // go through results and store field types
             reset($valArray);
             foreach (array_keys($valArray) as $k) {
                 $regValue = current($valArray);
                 $regID = $regValue['registration_id'];
                 //NOTE: assumes only 1 registration per person per event
                 next($valArray);
             }
             // 			$fields->setEventID($eventID);
             $fvalues->setRegID($regID);
         }
     }
     //	    $fvalues->setSortByFieldID();
     $fieldInfo = new MultiTableManager();
     $fieldInfo->addRowManager($fields);
     $fieldInfo->addRowManager($fvalues, new JoinPair($fvalues->getJoinOnFieldID(), $fields->getJoinOnFieldID()));
     $fieldInfo->addRowManager($ftypes, new JoinPair($fields->getJoinOnFieldTypeID(), $ftypes->getJoinOnFieldTypeID()));
     if ($this->show_hidden == false) {
         $fieldInfo->constructSearchCondition('fields_hidden', '=', $FALSE, true);
     }
     $fieldInfo->setSortOrder('fields_priority');
     $valuesIterator = $fieldInfo->getListIterator();
     $valuesArray = $valuesIterator->getDataList();
     //        echo "field values:<br><pre>".print_r($valuesArray,true)."</pre>";
     // store field ids associated with values already in database
     $initializedFieldIds = array_keys($valuesArray);
     // since each field value is located in a DB row the result array has several arrays - one per field value
     // need to extract each field value and store it as a non-array record in a result array
     $fieldValues = array();
     $idx = 0;
     /** Go through all event fields and map each to existing field value, otherwise create new field value record **/
     $fieldsArray = array_values($this->formFieldToFieldIDmapper);
     // store field IDs (ASSUMES formFieldToFieldIDmapper is initialized)
     //         echo 'fieldsArray = <pre>'.print_r($fieldsArray,true).'</pre>';
     reset($fieldsArray);
     reset($valuesArray);
     foreach (array_keys($fieldsArray) as $k) {
         $fieldID = current($fieldsArray);
         $form_value = '';
         // default blank field value if none found
         $form_value_id = -1;
         // to be replaced with existing or newly-created field values ID
         if (in_array($fieldID, $initializedFieldIds) == true) {
             $record = $valuesArray[$fieldID];
             $form_value = $record['fieldvalues_value'];
             $form_value_id = $record['fieldvalues_id'];
         } else {
             $updateValues = array();
             $updateValues['fields_id'] = $fieldID;
             $updateValues['fieldvalues_value'] = $form_value;
             $updateValues['registration_id'] = $regID;
             $fieldvalues_manager = new RowManager_FieldValueManager();
             // store values in table manager object.
             $fieldvalues_manager->loadFromArray($updateValues);
             // now update the DB with the values
             if (!$fieldvalues_manager->isLoaded()) {
                 $fieldvalues_manager->createNewEntry(true);
                 $form_value_id = $fieldvalues_manager->getID();
             }
         }
         $fieldValues['form_field' . $idx] = $form_value;
         // store mapping associating form field label with fieldvalues_id
         $this->formFieldToValueIDmapper['form_field' . $idx] = $form_value_id;
         next($fieldsArray);
         $idx++;
     }
     // 			echo 'labels-values = <pre>'.print_r($this->formFieldToValueIDmapper,true).'</pre>';
     // 			echo 'labels-fields = <pre>'.print_r($this->formFieldToFieldIDmapper,true).'</pre>';
     return $fieldValues;
 }