示例#1
0
            case 'daughter':
                $intRelationshipTypeId = RelationshipType::Child;
                break;
            case 'brother':
            case 'sister':
                $intRelationshipTypeId = RelationshipType::Sibling;
                break;
            case 'grandmother':
            case 'grandfather':
                $intRelationshipTypeId = RelationshipType::Grandparent;
                break;
            case 'grandchild':
            case 'grandson':
            case 'granddaughter':
                $intRelationshipTypeId = RelationshipType::Grandchild;
                break;
        }
        if ($intRelationshipTypeId) {
            $objPerson = Person::Load($intPersonIdByIndvId[$objRow['indvid']]);
            $objRelatedPerson = Person::Load($intPersonIdByIndvId[$objRow['reltindvid']]);
            if (!Relationship::LoadByPersonIdRelatedToPersonId($objPerson->Id, $objRelatedPerson->Id)) {
                $objPerson->AddRelationship($objRelatedPerson, $intRelationshipTypeId);
            }
        }
    }
}
$objParticipationCursor = HouseholdParticipation::QueryCursor(QQ::All());
$intCount = HouseholdParticipation::CountAll();
while (QDataGen::DisplayWhileTask('Recalculating HouseholdParticipation Roles', $intCount) && ($objHouseholdParticipation = HouseholdParticipation::InstantiateCursor($objParticipationCursor))) {
    $objHouseholdParticipation->RefreshRole();
}
示例#2
0
$objWikiPage->CompileHtml();
$objWikiItem->CreateNewVersion('Downloads from Old Qcodo.com Website', $objWikiPage, 'Save', array(), Person::Load(1), null);
print "Done.\r\n";
QDataGen::DisplayForEachTaskStart($strTitle = 'Refreshing Topic Stats', Topic::CountAll());
foreach (Topic::LoadAll() as $objTopic) {
    QDataGen::DisplayForEachTaskNext($strTitle);
    $objTopic->RefreshStats();
}
QDataGen::DisplayForEachTaskEnd($strTitle);
QDataGen::DisplayForEachTaskStart($strTitle = 'Refreshing TopicLink Stats', TopicLink::CountAll());
foreach (TopicLink::LoadAll() as $objTopicLink) {
    QDataGen::DisplayForEachTaskNext($strTitle);
    $objTopicLink->RefreshStats();
}
QDataGen::DisplayForEachTaskEnd($strTitle);
$objResult = $objDb->query('SELECT * FROM email_topic_person_assn');
while (QDataGen::DisplayWhileTask('Migrating email_topic_person_assn', $objResult->num_rows)) {
    $objRow = $objResult->fetch_array();
    try {
        Topic::GetDatabase()->NonQuery('INSERT INTO email_topic_person_assn(topic_id, person_id) VALUES (' . $objRow['topic_id'] . ',' . $objRow['person_id'] . ');');
    } catch (QMySqliDatabaseException $objExc) {
    }
}
$objResult = $objDb->query('SELECT * FROM read_topic_person_assn');
while (QDataGen::DisplayWhileTask('Migrating read_topic_person_assn', $objResult->num_rows)) {
    $objRow = $objResult->fetch_array();
    try {
        Topic::GetDatabase()->NonQuery('INSERT INTO read_topic_person_assn(topic_id, person_id) VALUES (' . $objRow['topic_id'] . ',' . $objRow['person_id'] . ');');
    } catch (QMySqliDatabaseException $objExc) {
    }
}
示例#3
0
文件: datagen.cli.php 项目: alcf/chms
 public static function GenerateHouseholds()
 {
     while (QDataGen::DisplayWhileTask('Generating Households', self::HouseholdCount, false)) {
         $objHousehold = null;
         $objPerson = null;
         switch (rand(0, 9)) {
             case 0:
             case 1:
             case 2:
                 // Single-Family Household
                 $objHousehold = self::GenerateHouseholdSingleFamily();
                 break;
             case 3:
             case 4:
             case 5:
                 // Single-Person Household
                 $objPerson = self::GenerateIndividual(rand(0, 1), rand(0, 8));
                 $objHousehold = Household::CreateHousehold($objPerson);
                 break;
             case 6:
             case 7:
                 // Multi-Family Households
                 // TODO
                 break;
             case 8:
             case 9:
                 // Non-Household
                 $objPerson = self::GenerateIndividual(rand(0, 1), rand(0, 8));
                 break;
         }
         // Address and Phone for Household
         if ($objHousehold) {
             self::GenerateAddressesForHousehold($objHousehold);
             foreach ($objHousehold->GetHouseholdParticipationArray() as $objParticipation) {
                 $objParticipation->Person->RefreshPrimaryContactInfo();
             }
         } else {
             if ($objPerson) {
                 $objPerson->RefreshPrimaryContactInfo();
             }
         }
     }
     self::$HouseholdArray = Household::LoadAll();
 }
示例#4
0
    // Randomly Select a Number of Messages for this Forum Topic
    $intMessageCount = rand(1, GENERATE_MESSAGES_PER_TOPIC_UBOUND);
    if (rand(0, 1)) {
        $intMessageCount = round($intMessageCount / 2);
    }
    if (rand(0, 1)) {
        $intMessageCount = round($intMessageCount / 2);
    }
    if (rand(0, 1)) {
        $intMessageCount = round($intMessageCount / 2);
    }
    if (rand(0, 1)) {
        $intMessageCount = round($intMessageCount / 2);
    }
    if (rand(0, 1)) {
        $intMessageCount = round($intMessageCount / 2);
    }
    if (rand(0, 1)) {
        $intMessageCount = round($intMessageCount / 2);
    }
    $blnFirstMessage = true;
    while (QDataGen::DisplayWhileTask(' - Generating Messages for Topic #' . $objTopic->Id, $intMessageCount, true)) {
        $strMessageText = QDataGen::GenerateContent(rand(1, 5));
        $objPerson = Person::Load(rand(1, $intMaxPersonId));
        $dttDateTime = QDataGen::GenerateDateTime($dttStartDate, QDateTime::Now());
        $objTopic->PostMessage($strMessageText, $objPerson, $dttDateTime);
    }
    // Finally, Refresh this topic's ReplyNumber ordering
    $objTopic->RefreshReplyNumbering();
}
QDataGen::DisplayForEachTaskEnd($strTopics);