예제 #1
0
 function loadRegUTableData(&$ut, $strVolIDs, &$regExport)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $ufd = new muser_fields_display();
     $ufd->lTableID = $lTableID = $ut->lTableID;
     $ufd->loadTableViaTableID();
     $ufd->loadFieldsGeneric(true, $lTableID, null);
     $ufd->userTables[0]->lNumFields = $ufd->lNumFields;
     $ufd->userTables[0]->ufields =& $ufd->fields;
     // limit the lookup to the qualified volunteer list
     $strFNPrefix = $ut->strFieldPrefix;
     $strFNFID = $strFNPrefix . '_lForeignKey';
     $ufd->mrSQLWhereExtra = " AND {$strFNFID} IN ({$strVolIDs}) ";
     // order by vol, then earliest record; for multiple entries
     // we take only the first (we assume this was the entry from the registration form)
     $ufd->mrSQLOrder = ' ' . $strFNFID . ', ' . $strFNPrefix . '_dteOrigin ';
     //    $ufd->lNumMRRecs  - number of loaded records
     //    $ufd->mrRecs      - array of data records
     $ufd->loadMRRecs(false, false);
     if ($ufd->lNumMRRecs > 0) {
         $lVIDGroup = -999;
         foreach ($ufd->mrRecs as $mrRec) {
             $lVolID = $mrRec->{$strFNFID};
             if ($lVIDGroup != $lVolID) {
                 $lVIDGroup = $lVolID;
                 $rRec =& $regExport[$lVolID];
                 $rRec->pTableData[$lTableID] = clone $mrRec;
             }
         }
     }
 }
 function prefillRec($lTableID, &$mRec, $lPrevRecID, $lNumFields, $fields)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $cPrefillUFD = new muser_fields_display();
     $cPrefillUFD->lTableID = $lTableID;
     $cPrefillUFD->loadTableViaTableID();
     $prevtable =& $cPrefillUFD->userTables[0];
     $prevtable->lNumFields = $lNumFields;
     $prevtable->ufields =& $fields;
     $cPrefillUFD->loadMRRecsViaRID($lPrevRecID);
     $prevRec =& $cPrefillUFD->mrRecs[0];
     $mRec = new stdClass();
     foreach ($fields as $field) {
         if ($field->bPrefilled) {
             $strFN = $field->strFieldNameInternal;
             $mRec->{$strFN} = $prevRec->{$strFN};
             if ($field->enumFieldType == CS_FT_DDLMULTI) {
                 $mRecMDDLFN = $strFN . '_ddlMulti';
                 $mRec->{$mRecMDDLFN} = new stdClass();
                 $mRec->{$mRecMDDLFN}->lNumEntries = $prevRec->{$mRecMDDLFN}->lNumEntries;
                 $mRec->{$mRecMDDLFN}->entries = arrayCopy($prevRec->{$mRecMDDLFN}->entries);
             }
         }
     }
 }