function __construct()
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     parent::__construct();
     $this->sqlWhereExtra = '';
 }
function patientVisit()
{
    //---------------------------------------------------------------------
    //
    //---------------------------------------------------------------------
    $bFormPassed = true;
    $CI =& get_instance();
    $cSchema = new muser_schema();
    $cSchema->loadUFSchemaViaAttachTypeUserTabName(CENUM_CONTEXT_VOLUNTEER, 'Patient Visit', $lTableID, true);
    $cSchema->loadDDLValues($lTableID);
    $bPassed = pvVerifyPersonServed($CI, $cSchema, $lTableID);
    $bFormPassed = $bFormPassed && $bPassed;
    $bPassed = pvVerifyLocation($CI, $cSchema, $lTableID);
    $bFormPassed = $bFormPassed && $bPassed;
    $bPassed = pvVerifyActivity($CI, $cSchema, $lTableID);
    $bFormPassed = $bFormPassed && $bPassed;
    $bPassed = pvVerifyInterventions($CI, $cSchema, $lTableID);
    $bFormPassed = $bFormPassed && $bPassed;
    return $bFormPassed;
}
Пример #3
0
 function cloneAttendance($cloneOpts)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     global $glUserID;
     $cschema = new muser_schema();
     $cschema->loadUFSchemaSingleTable($cloneOpts->lATableID);
     $atable =& $cschema->schema[$cloneOpts->lATableID];
     // build the personalized field list
     $strUFields = '';
     $lNumMulti = 0;
     $multi = array();
     if ($atable->lNumFields > 0) {
         foreach ($atable->fields as $afield) {
             if ($afield->enumFieldType != CS_FT_HEADING) {
                 $strUFields .= ', ' . $afield->strFieldNameInternal . "\n";
             }
             if ($afield->enumFieldType == CS_FT_DDLMULTI) {
                 $multi[$lNumMulti] = new stdClass();
                 $mddl =& $multi[$lNumMulti];
                 $mddl->lFieldID = $afield->lFieldID;
                 ++$lNumMulti;
             }
         }
     }
     $strFP = $atable->strFieldPrefix;
     $sqlBase = "INSERT INTO {$atable->strDataTableName}\n         (\n            {$strFP}" . "_bRetired,\n            {$strFP}" . "_lOriginID,\n            {$strFP}" . "_dteOrigin,\n            {$strFP}" . "_lLastUpdateID,\n            {$strFP}" . "_dteLastUpdate,\n            {$strFP}" . "_dteAttendance,\n            {$strFP}" . "_dDuration,\n            {$strFP}" . "_strCaseNotes\n            {$strUFields},\n            {$strFP}" . "_lEnrollID,\n            {$strFP}" . "_lForeignKey\n         )\n\n         SELECT\n            '0'       AS bRetired,\n            {$glUserID} AS lOriginID,\n            NOW()     AS dteOrigin,\n            {$glUserID} AS lLastUpdateID,\n            NOW()     AS dteLastUpdate,\n            '{$cloneOpts->mdteAttendance}' AS dteAttendance,\n            {$strFP}" . "_dDuration,\n            {$strFP}" . "_strCaseNotes\n            {$strUFields}, ";
     $arecIDs = array();
     foreach ($cloneOpts->clients as $IDs) {
         if (!$cloneOpts->bSkipDups || !$this->bClientAsAttendanceOnDate($IDs->lClientID, $cloneOpts->mdteAttendance, $atable->strFieldPrefix, $atable->strDataTableName, $atable->strDataTableFID)) {
             $sqlStr = $sqlBase . "{$IDs->lEnrollID} AS lEnrollID,\n                {$IDs->lClientID} AS lForeignKey\n                FROM {$atable->strDataTableName}\n                WHERE {$atable->strDataTableKeyID}={$cloneOpts->lARecID};";
             $query = $this->db->query($sqlStr);
             $arecIDs[] = $this->db->insert_id();
         }
     }
     // clone multi-entry ddls
     if ($lNumMulti > 0 && count($arecIDs) > 0) {
         // load the multi values
         foreach ($multi as $mddl) {
             $mddl->selectValues = $this->loadMultiViaARec($mddl->lFieldID, $cloneOpts->lATableID, $cloneOpts->lARecID);
             if (count($mddl->selectValues) > 0) {
                 foreach ($arecIDs as $aID) {
                     $this->cloneARecMDDL($mddl->selectValues, $aID, $mddl->lFieldID, $cloneOpts->lATableID);
                 }
             }
         }
     }
 }
 function strPrePostReport($sRpt)
 {
     //---------------------------------------------------------------------
     //
     //---------------------------------------------------------------------
     $ufSchema = new muser_schema();
     $ufSchema->loadUFSchema();
     if (CB_AAYHF) {
         $ufSchema->tableInfoViaUserTableName('Demographics', $demoTableInfo);
         $lDTableID = $demoTableInfo->lTableID;
         $ufSchema->fieldInfoViaUserFieldName($lDTableID, 'Race', $demoTableInfo->fiRace);
         $ufSchema->fieldInfoViaUserFieldName($lDTableID, 'Ethnicity', $demoTableInfo->fiEthnicity);
         $ufSchema->fieldInfoViaUserFieldName($lDTableID, 'Age Range', $demoTableInfo->fiAgeRange);
         $ufSchema->fieldInfoViaUserFieldName($lDTableID, 'Current Grade Level', $demoTableInfo->fiGradeLevel);
     } else {
         $demoTableInfo = null;
     }
     $cClientSearch = new mclient_search();
     $strOut = '';
     $lPPTestID = $sRpt->lPPTestID;
     $strBetween = $sRpt->strBetween;
     // load test and questions
     $this->loadPPTestsViaPPTID($lPPTestID);
     $pptest =& $this->pptests[0];
     $this->loadQuestionsViaPPTID($lPPTestID);
     $strOut .= $this->strPrePostRptHeader($sRpt, $demoTableInfo);
     // individual questions
     $strTmpTableName = 'tmp_scores';
     $strTmpClientPopTableName = 'tmp_client_pop';
     $this->buildScoringTempTable($strTmpTableName);
     $this->populateScoringTempTable($strTmpTableName, $lPPTestID, $strBetween);
     // all clients for this test and testing window
     $cClientSearch->createClientPopulationTempTable($strTmpClientPopTableName);
     $strInner = "INNER JOIN {$strTmpTableName} ON cr_lKeyID = tmp_lClientID ";
     $strWhere = '';
     $cClientSearch->populateClientPopulationTable($strTmpClientPopTableName, $strWhere, $strInner);
     $this->generatePerQuestionScores($strTmpTableName, $strTmpClientPopTableName);
     $strOut .= $this->strQResultsDetail('Test Results, By Question');
     return $strOut;
 }