/** * function setLinks * <pre> * Sets the value of the linkValues array. * </pre> * @param $links [ARRAY] Array of Link Values * @return [void] */ function setLinks($links, $cashTransLinks, $ccTransLinks, $disabledLink) { $this->cashTrans_form->setLinks($cashTransLinks); $this->ccTrans_form->setLinks($ccTransLinks); $dataAccessManager = new RowManager_EditCampusAssignmentManager(); $dataAccessManager->setPersonID($this->person_id); $dataAccessManager->setCampusID($this->campus_id); $dataAccessManager->setSortOrder($this->sortBy); $dataList = $dataAccessManager->getListIterator(); $displayedValues = $dataList->getDataList(); // calculate total paid already $scholarshipTotal = $this->getScholarshipsTotal(); $cashTotal = $this->getCashPaidTotal(); $ccTotal = $this->getCCtransTotal(); $cashOwed = $this->getCashOwedTotal(); $totalPaid = $scholarshipTotal + $cashTotal + $ccTotal; // echo "<br>scholarships = ".$scholarshipTotal; // echo "<br>cash total = ".$cashTotal; // echo "<br>cc total = ".$ccTotal; // disallow the 'continue' link if total paid (+ recorded as owed) is less than event deposit for this person $deposit = $this->getEventDeposit(); if ($deposit == "NOT YET DETERMINED" || $totalPaid + $cashOwed < $deposit) { $baseLink = $disabledLink; //cashTransLinks['sortBy']; // $baseLink = str_replace( modulecim_reg::CASHTRANS_ID.'=', '', $baseLink); $links['cont'] = $baseLink; $this->linkLabels['cont'] = $this->labels->getLabel('[Disabled]'); } // echo print_r($this->linkValues,true); parent::setLinks($links); }
/** * function setLinks * <pre> * Sets the value of the linkValues array. * </pre> * @param $links [ARRAY] Array of Link Values * @return [void] */ function setLinks($links) { $dataAccessManager = new RowManager_EditCampusAssignmentManager(); $dataAccessManager->setPersonID($this->person_id); $dataAccessManager->setCampusID($this->campus_id); $dataAccessManager->setSortOrder($this->sortBy); $dataList = $dataAccessManager->getListIterator(); $displayedValues = $dataList->getDataList(); // disallow the 'continue' link if there is no campus assignment data recorded for this person if (count($displayedValues) == 0) { $baseLink = $links['edit']; $baseLink = str_replace(modulecim_reg::ASSIGNMENT_ID . '=', '', $baseLink); $links['cont'] = $baseLink; } parent::setLinks($links); }
/** * function processData * <pre> * Processes the data for this form. * </pre> * @return [void] */ function processData() { // if this is a delete operation then if ($this->opType == 'D') { if ($this->shouldDelete) { $this->dataManager->deleteEntry(); } } else { // else // save the value of the Foriegn Key(s) // $this->formValues[ 'person_id' ] = $this->person_id; // $this->formValues[ 'campus_id' ] = $this->campus_id; // $this->formValues[ 'assignmentstatus_id' ] = $this->assignmentstatus_id; // echo "person_id = ".$this->formValues[ 'person_id' ] ; // echo "campus_id = ".$this->formValues[ 'campus_id' ] ; // echo "assignmentstatus_id = ".$this->formValues[ 'assignmentstatus_id' ] ; /*[RAD_ADMINBOX_FOREIGNKEY]*/ // Store values in dataManager object $this->dataManager->loadFromArray($this->formValues); // Save the values into the Table. if (!$this->dataManager->isLoaded()) { $assignmentsChecker = new RowManager_EditCampusAssignmentManager(); // check to ensure that duplicate/conflicting data is not stored // i.e. ensure that each student-campus combo only has 1 status $assignmentsChecker->setPersonID($this->formValues['person_id']); $assignmentsChecker->setCampusID($this->formValues['campus_id']); $resultSet = $assignmentsChecker->find(); $found = false; $resultSet->setFirst(); while ($resultSet->moveNext()) { // load the searchManager from the current row of data // echo "pre-insert results: <pre>".print_r($resultSet->getCurrentRow(),true)."</pre><br>"; $found = true; } // only add new entry if the person-campus combination doesn't exist yet if ($found == false) { $this->dataManager->createNewEntry(); } else { $this->error_message = 'Only *1* status allowed per campus-person combination!<br>' . 'Insert operation aborted.'; } } else { $assignmentsChecker = new RowManager_EditCampusAssignmentManager(); $assignmentsChecker->setAssignmentID($this->assignment_id); $resultSet = $assignmentsChecker->find(); // NOTE: should only find one record, because assignment_id was set $abort = false; // $add = false; $resultSet->setFirst(); while ($resultSet->moveNext()) { // load the searchManager from the current row of data // echo "pre-insert results: <pre>".print_r($resultSet->getCurrentRow(),true)."</pre><br>"; $results = array(); $results = $resultSet->getCurrentRow(); /** STEP 1: ensure that person name/ID is not updated since this can easily create redundancies **/ if ($this->formValues['person_id'] != $results['person_id']) { $abort = true; $this->error_message = 'Please do NOT update person in person-campus assignment,' . 'use "ADD" instead.<br>Update operation aborted.'; } /** STEP 2: ensure that historical data about campus assignments is not over-written **/ if ($this->formValues['campus_id'] != $results['campus_id']) { $abort = true; if (isset($this->error_message)) { $this->error_message .= '<br><br>'; } else { $this->error_message = ''; } $this->error_message .= 'Please do NOT update campus in person-campus assignment,' . 'use "ADD" instead.<br>Update operation aborted.'; } } // only add new entry if the person-campus combination doesn't exist yet if ($abort == false) { // if ($add == false) // { $this->dataManager->updateDBTable(); /* } else // if ADD was triggered, add entry to DB instead of updating { $this->dataManager->setAssignmentID(''); //ensure that primary key is not set $this->dataManager->createNewEntry(); } */ } } } // end if // now Clear out dataManager & FormValues $this->dataManager->clearValues(); $this->formValues = $this->dataManager->getArrayOfValues(); // on a successful update return assignment_id to '' $this->assignment_id = ''; }