예제 #1
0
    $objParentGroup = Group::CreateGroupForMinistry($objMinistry, GroupType::GroupCategory, trim($strTokens[0]), 'Growth Groups in ' . $objGrowthGroupLocation->Location);
    $objGroupCategory = new GroupCategory();
    $objGroupCategory->Group = $objParentGroup;
    $objGroupCategory->Save();
    $objGgResult = $objMySqli->Query('SELECT * FROM growth_group WHERE growth_group_location_id=' . $objRow['id'] . ' ORDER BY id');
    while ($objGgRow = $objGgResult->fetch_array()) {
        $objGroup = Group::CreateGroupForMinistry($objMinistry, GroupType::GrowthGroup, $objGgRow['name'], 'Growth Group for ' . $objGgRow['name'], $objParentGroup);
        $objGrowthGroup = new GrowthGroup();
        $objGrowthGroup->Group = $objGroup;
        $objGrowthGroup->GrowthGroupLocationId = $objGgRow['growth_group_location_id'];
        $objGrowthGroup->GrowthGroupDayTypeId = $objGgRow['growth_group_day_type_id'];
        $objGrowthGroup->MeetingBitmap = $objGgRow['meeting_bitmap'];
        $objGrowthGroup->StartTime = $objGgRow['start_time'];
        $objGrowthGroup->EndTime = $objGgRow['end_time'];
        $objGrowthGroup->Address1 = $objGgRow['address_1'];
        $objGrowthGroup->Address2 = $objGgRow['address_2'];
        $objGrowthGroup->CrossStreet1 = $objGgRow['cross_street_1'];
        $objGrowthGroup->CrossStreet2 = $objGgRow['cross_street_2'];
        $objGrowthGroup->ZipCode = $objGgRow['zip_code'];
        $objGrowthGroup->Longitude = $objGgRow['longitude'];
        $objGrowthGroup->Latitude = $objGgRow['latitude'];
        $objGrowthGroup->Accuracy = $objGgRow['accuracy'];
        $objGrowthGroup->Save();
        $objStructureResult = $objMySqli->Query('SELECT * FROM growthgroupstructure_growthgroup_assn where growth_group_id=' . $objGgRow['id']);
        while ($objStructureRow = $objStructureResult->fetch_array()) {
            $objGrowthGroup->AssociateGrowthGroupStructure(GrowthGroupStructure::Load($objStructureRow['growth_group_structure_id']));
        }
    }
}
$objMySqli->Close();
Group::RefreshHierarchyDataForMinistry($objMinistry->Id);