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; } }
/** * function getHTML * <pre> * This method returns the HTML data generated by this object. * </pre> * @return [STRING] HTML Display data. */ function getHTML() { // Uncomment the following line if you want to create a template // tailored for this page: //$path = $this->pathModuleRoot.'templates/'; // Otherwise use the standard Templates for the site: $path = SITE_PATH_TEMPLATES; /* * store the link values */ // example: // $this->linkValues[ 'view' ] = 'add/new/href/data/here'; // store the link labels $this->linkLabels['edit'] = $this->labels->getLabel('[Edit]'); $this->linkLabels['del'] = $this->labels->getLabel('[Delete]'); $this->linkLabels['cont'] = $this->labels->getLabel('[Continue]'); // $this->linkLabels[ 'view' ] = 'new link label here'; /* * store any additional link Columns */ // example: //$title = $this->labels->getLabel( '[title_groups]'); //$columnLabel = $this->labels->getLabel( '[groups]'); //$link = $this->linkValues[ 'groups' ]; //$fieldName = 'accessgroup_id'; //$this->addLinkColumn( $title, $columnLabel, $link, $fieldName); /* * Update any label tags ... */ // example: // $name = $user->getName(); // $this->labels->setLabelTag( '[Title]', '[userName]', $name); // NOTE: this parent method prepares the $this->template with the // common AdminBox data. $this->prepareTemplate($path); // store the statevar id to edit $this->template->set('editEntryID', $this->pricerules_id); // store all the fields to the template $this->setFormFieldsToTemplate(); /* * Form related Template variables: */ /* * Insert the date start/end values for the following date fields: */ // example: //$this->template->set( 'startYear_[fieldName]', 2000); //$this->template->set( 'endYear_[fieldName]', 2010); /* * List related Template variables : */ // Store the XML Node name for the Data Access Field List $xmlNodeName = RowManager_PriceRuleManager::XML_NODE_NAME; $this->template->set('rowManagerXMLNodeName', $xmlNodeName); // store the primary key field name for the data being displayed $this->template->set('primaryKeyFieldName', 'pricerules_id'); // store data list to the template // NOTE: we initialize it here to make sure we capture any new data // from a recent processData() call. $dataAccessManager = new RowManager_PriceRuleManager(); $dataAccessManager->setEventID($this->event_id); $dataAccessManager->setSortOrder($this->sortBy); // $this->dataList = new PriceRuleList( $this->sortBy ); $this->dataList = $dataAccessManager->getListIterator(); $this->template->setXML('dataList', $this->dataList->getXML()); /* * Add any additional data required by the template here */ $field = new RowManager_FieldManager(); $field->setEventID($this->event_id); $field->setSortOrder('fields_id'); $fieldList = new ListIterator($field); $fieldArray = $fieldList->getDropListArray(); $this->template->set('list_fields_id', $fieldArray); $priceRuleType = new RowManager_PriceRuleTypeManager(); $priceRuleType->setSortOrder('priceruletypes_id'); $priceRuleTypeList = new ListIterator($priceRuleType); $priceRuleTypeArray = $priceRuleTypeList->getDropListArray(); $this->template->set('list_priceruletypes_id', $priceRuleTypeArray); $notice = "<b>NOTE:</b> For checkbox 'Form Attribute' rules use '1' for checked box and '0' for unchecked box."; $this->template->set('note_pricerules_value', $notice); $templateName = 'siteFormDataList.php'; // if you are creating a custom template for this page then // replace $templateName with the following: //$templateName = 'page_EditPriceRules.php'; return $this->template->fetch($templateName); }
/** * function getHTML * <pre> * This method returns the HTML data generated by this object. * </pre> * @return [STRING] HTML Display data. */ function getHTML() { // Uncomment the following line if you want to create a template // tailored for this page: //$path = $this->pathModuleRoot.'templates/'; // Otherwise use the standard Templates for the site: $path = SITE_PATH_TEMPLATES; /* * store the link values */ // example: // $this->linkValues[ 'view' ] = 'add/new/href/data/here'; // store the link labels $this->linkLabels['edit'] = $this->labels->getLabel('[Edit]'); $this->linkLabels['del'] = $this->labels->getLabel('[Delete]'); $this->linkLabels['cont'] = $this->labels->getLabel('[Continue]'); // $this->linkLabels[ 'view' ] = 'new link label here'; /* * store any additional link Columns */ // example: //$title = $this->labels->getLabel( '[title_groups]'); //$columnLabel = $this->labels->getLabel( '[groups]'); //$link = $this->linkValues[ 'groups' ]; //$fieldName = 'accessgroup_id'; //$this->addLinkColumn( $title, $columnLabel, $link, $fieldName); /* * Update any label tags ... */ // example: // $name = $user->getName(); // $this->labels->setLabelTag( '[Title]', '[userName]', $name); // NOTE: this parent method prepares the $this->template with the // common AdminBox data. $this->prepareTemplate($path); // store the statevar id to edit $this->template->set('editEntryID', $this->fields_id); // store all the fields to the template $this->setFormFieldsToTemplate(); /* * Form related Template variables: */ /* * Insert the date start/end values for the following date fields: */ // example: //$this->template->set( 'startYear_[fieldName]', 2000); //$this->template->set( 'endYear_[fieldName]', 2010); /* * List related Template variables : */ // Store the XML Node name for the Data Access Field List $xmlNodeName = RowManager_FieldManager::XML_NODE_NAME; $this->template->set('rowManagerXMLNodeName', $xmlNodeName); // store the primary key field name for the data being displayed $this->template->set('primaryKeyFieldName', 'fields_id'); // store data list to the template // NOTE: we initialize it here to make sure we capture any new data // from a recent processData() call. $dataAccessManager = new RowManager_FieldManager(); $dataAccessManager->setEventID($this->event_id); $dataAccessManager->setSortOrder($this->sortBy); // $this->dataList = new FieldList( $this->sortBy ); $this->dataList = $dataAccessManager->getListIterator(); $this->template->setXML('dataList', $this->dataList->getXML()); /* * Add any additional data required by the template here */ // get a list of all field type IDs $fieldtype = new RowManager_FieldTypeManager(); $fieldtype->setSortOrder('fieldtype_id'); $fieldtypeList = new ListIterator($fieldtype); $fieldtypeArray = $fieldtypeList->getDropListArray(); $this->template->set('list_fieldtype_id', $fieldtypeArray); // get a list of all data types; DB table = reg_cim_datatypes $type = new RowManager_DataTypeManager(); $type->setSortOrder('datatypes_id'); $typeList = new ListIterator($type); $typeArray = $typeList->getDropListArray(); $this->template->set('list_datatypes_id', $typeArray); //TODO: replace this with a reference to a multi_lingual label constant array... $boolArray = array(); $boolArray['0'] = 'false'; $boolArray['1'] = 'true'; $this->template->set('list_fields_hidden', $boolArray); $this->template->set('list_fields_reqd', $boolArray); // get a list of all field priorities (for some possible future use; for ease, requires priority DB table) /* $priority = new RowManager_FieldManager(); $priority->setSortOrder( 'fields_priority' ); $priorityList = new ListIterator($priority); $priorityArray = $priorityList->getDropListArray(); $this->template->set( 'list_fields_priority', $priorityArray ); */ $templateName = 'siteFormDataList.php'; // if you are creating a custom template for this page then // replace $templateName with the following: //$templateName = 'page_EditFormFields.php'; return $this->template->fetch($templateName); }
protected function getFieldArray($regID = '', $personID = '', $eventID = '') { $FALSE = 0; $fields = new RowManager_FieldManager(); // $fvalues = new RowManager_FieldValueManager(); $ftypes = new RowManager_FieldTypeManager(); // echo "personID = ".$personID; // echo "eventID = ".$eventID; if ($eventID != '') { $fields->setEventID($eventID); //$fvalues->setRegID($regID); } else { if ($regID != '') { $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); $eventID = $regValue['event_id']; //NOTE: assumes only 1 event per registration //OLD: 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'); // echo $fieldInfo->createSQL(); $valuesIterator = $fieldInfo->getListIterator(); $valuesArray = $valuesIterator->getDataList(); // echo "label values:<br><pre>".print_r($valuesArray,true)."</pre>"; // map the fields_id of each field values row to the label of that particular form field $idx = 0; reset($valuesArray); foreach (array_keys($valuesArray) as $k) { $record = current($valuesArray); // store mapping associating form field label with fields_id $this->formFieldToFieldIDmapper['form_field' . $idx] = $record['fields_id']; next($valuesArray); $idx++; } // echo "field id values:<br><pre>".print_r($this->formFieldToFieldIDmapper,true)."</pre>"; return $valuesArray; }