Beispiel #1
0
    $objStructure->Save();
}
$objResult = $objMySqli->Query('SELECT * FROM growth_group_location order by id;');
$objParentGroupArray = array();
while ($objRow = $objResult->fetch_array()) {
    $objGrowthGroupLocation = new GrowthGroupLocation();
    $objGrowthGroupLocation->Location = $objRow['location'];
    $objGrowthGroupLocation->Longitude = $objRow['longitude'];
    $objGrowthGroupLocation->Latitude = $objRow['latitude'];
    $objGrowthGroupLocation->Zoom = $objRow['zoom'];
    $objGrowthGroupLocation->Save();
    $strTokens = explode('(', $objGrowthGroupLocation->Location);
    $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'];
Beispiel #2
0
 public static function GenerateGroup(Ministry $objMinistry, Group $objParentGroup = null)
 {
     $strName = QDataGen::GenerateTitle(1, 4);
     $strToken = strtolower(str_replace(' ', '_', $strName));
     while (Group::LoadByToken($strToken)) {
         $strName = QDataGen::GenerateTitle(1, 4);
         $strToken = strtolower(str_replace(' ', '_', $strName));
     }
     $strDescription = QDataGen::GenerateContent(rand(0, 1), 5, 20);
     $intGroupTypeId = QDataGen::GenerateFromArray(array_keys(GroupType::$NameArray));
     $objGroup = Group::CreateGroupForMinistry($objMinistry, $intGroupTypeId, $strName, $strDescription, $objParentGroup);
     // Set folder options
     $objGroup->ConfidentialFlag = !rand(0, 8);
     // Email
     if (!rand(0, 3)) {
         $objGroup->EmailBroadcastTypeId = QDataGen::GenerateFromArray(array_keys(EmailBroadcastType::$NameArray));
         $objGroup->Token = $strToken;
     }
     $objGroup->Save();
     switch ($objGroup->GroupTypeId) {
         case GroupType::GrowthGroup:
             $objGrowthGroup = new GrowthGroup();
             $objGrowthGroup->Group = $objGroup;
             $objGrowthGroup->GrowthGroupLocationId = rand(1, GrowthGroupLocation::CountAll());
             $objGrowthGroup->Save();
             break;
         case GroupType::SmartGroup:
             $objSmartGroup = new SmartGroup();
             $objSmartGroup->Group = $objGroup;
             $objSmartGroup->Save();
             break;
         case GroupType::GroupCategory:
             $objGroupCategory = new GroupCategory();
             $objGroupCategory->Group = $objGroup;
             $objGroupCategory->Save();
             // Create Subgroups
             $intSubFolderCount = rand(0, 5);
             for ($intCount = 0; $intCount < $intSubFolderCount; $intCount++) {
                 self::GenerateGroup($objMinistry, $objGroup);
             }
             break;
     }
     // Create Participants
     $objGroupRoleArray = GroupRole::LoadArrayByMinistryId($objMinistry->Id);
     switch ($objGroup->GroupTypeId) {
         case GroupType::GrowthGroup:
         case GroupType::RegularGroup:
             $intParticipantCount = rand(1, 8);
             for ($intIndex = 0; $intIndex < $intParticipantCount; $intIndex++) {
                 $dttStartDate = QDataGen::GenerateDateTime(self::$SystemStartDate, QDateTime::Now());
                 $dttEndDate = rand(0, 4) ? null : QDataGen::GenerateDateTime($dttStartDate, QDateTime::Now());
                 $objGroup->AddPerson(Person::Load(rand(1, self::$MaxPersonId)), QDataGen::GenerateFromArray($objGroupRoleArray)->Id, $dttStartDate, $dttEndDate);
             }
             break;
     }
 }
Beispiel #3
0
//		or an array of awgrresf.reserveid's to use just the specified subset within that group
//		(thus ignoring the ACS Group for the groupid)
$objGroupArray = array(21 => array(63 => array('Alter Prayer Ministry', false), 26 => array('Prayer Ministry', array(104, 105, 106, 272, 314, 364, 374, 375, 383, 401)), 36 => array('PrayerWorks', false), 35 => array('Worship Warriors', false)), 23 => array(53 => array('Information Center', false), 28 => array('Worship Services', array(123, 115, 116, 278, 121, 254, 124)), 19 => array('Hospitality', false)));
foreach ($objGroupArray as $intMinistryId => $objAcsGroupArray) {
    $objMinistry = Ministry::Load($intMinistryId);
    $objRoleArray = $objMinistry->GetGroupRoleArray();
    $objRole = $objRoleArray[0];
    foreach ($objAcsGroupArray as $intAcsGroupId => $objDescriptionArray) {
        if (!$objDescriptionArray[1]) {
            $objGroup = Group::CreateGroupForMinistry($objMinistry, GroupType::RegularGroup, $objDescriptionArray[0], null);
            CreateGroupParticipations($objAcsDatabase, $objGroup, $objRole, $intAcsGroupId, null);
        } else {
            $objGroupCategory = Group::CreateGroupForMinistry($objMinistry, GroupType::GroupCategory, $objDescriptionArray[0], null);
            $objGroupCategoryDetail = new GroupCategory();
            $objGroupCategoryDetail->GroupId = $objGroupCategory->Id;
            $objGroupCategoryDetail->Save();
            foreach ($objDescriptionArray[1] as $intAcsReserveId) {
                $objResult = $objAcsDatabase->query(sprintf('select * from awgrresf where groupid=%s AND reserveid=%s;', $intAcsGroupId, $intAcsReserveId));
                while ($objRow = $objResult->fetch_array()) {
                    $objGroup = Group::CreateGroupForMinistry($objMinistry, GroupType::RegularGroup, $objRow['value'], null, $objGroupCategory);
                    CreateGroupParticipations($objAcsDatabase, $objGroup, $objRole, $intAcsGroupId, $intAcsReserveId);
                }
            }
        }
    }
    Group::RefreshHierarchyDataForMinistry($intMinistryId);
}
function CreateGroupParticipations(mysqli $objAcsDatabase, Group $objGroup, GroupRole $objRole, $intAcsGroupId, $intAcsReserveId)
{
    print "Adding for Group: " . $objGroup->Name . "\r\n      ";
    if ($intAcsReserveId) {