예제 #1
0
function CreateGroupParticipations(mysqli $objAcsDatabase, Group $objGroup, GroupRole $objRole, $intAcsGroupId, $intAcsReserveId)
{
    print "Adding for Group: " . $objGroup->Name . "\r\n      ";
    if ($intAcsReserveId) {
        $objResult = $objAcsDatabase->query(sprintf('select * from awgrrost where groupid=%s AND reserveid1=%s', $intAcsGroupId, $intAcsReserveId));
    } else {
        $objResult = $objAcsDatabase->query(sprintf('select * from awgrrost where groupid=%s', $intAcsGroupId));
    }
    while ($objRow = $objResult->fetch_array()) {
        $objAttributeValueArray = AttributeValue::QueryArray(QQ::AndCondition(QQ::Equal(QQN::AttributeValue()->AttributeId, 2), QQ::Equal(QQN::AttributeValue()->TextValue, $objRow['indvid'])));
        if (count($objAttributeValueArray) != 1) {
            printf("Issue with awgrrost.pkid of %s - IndvId %s for Group %s - AVCount of %s\r\n", $objRow['pkid'], $objRow['indvid'], $objGroup->Name, count($objAttributeValueArray));
        } else {
            $objPerson = $objAttributeValueArray[0]->Person;
            $dttStartDate = new QDateTime($objRow['dateadded']);
            if ($objRow['dateremoved']) {
                $dttEndDate = new QDateTime($objRow['dateremoved']);
            } else {
                $dttEndDate = null;
            }
            $objGroup->AddPerson($objPerson, $objRole->Id, $dttStartDate, $dttEndDate);
            print "*";
        }
    }
    print "\r\n      Done.\r\n\r\n";
}
예제 #2
0
 protected function SetupPanel()
 {
     $this->dtgAttributes = new QDataGrid($this);
     $this->dtgAttributes->AddColumn(new QDataGridColumn('Attribute', '<a href="#attributes/edit/<?= $_ITEM->AttributeId; ?>"><?= QApplication::HtmlEntities($_ITEM->Attribute->Name); ?></a>', 'HtmlEntities=false', 'Width=180px;'));
     $this->dtgAttributes->AddColumn(new QDataGridColumn('Value', '<?= $_CONTROL->ParentControl->RenderValue($_ITEM); ?>', 'HtmlEntities=false', 'Width=570px'));
     $this->dtgAttributes->DataSource = $this->objPerson->GetAttributeValueArray(QQ::OrderBy(QQN::AttributeValue()->Attribute->Name));
 }
예제 #3
0
파일: Attendees.php 프로젝트: alcf/chms
 public function RenderSalvationDate($objPerson)
 {
     $attributeArray = $objPerson->GetAttributeValueArray(QQ::OrderBy(QQN::AttributeValue()->Attribute->Name));
     foreach ($attributeArray as $objAttribute) {
         if ($objAttribute->Attribute->Name == 'Date Accepted Christ') {
             return $objAttribute->DateValue->ToString('MMMM D, YYYY');
         }
     }
 }
예제 #4
0
 /**
  * Used internally by the Meta-based Add Column tools.
  *
  * Given a QQNode or a Text String, this will return a AttributeValue-based QQNode.
  * It will also verify that it is a proper AttributeValue-based QQNode, and will throw an exception otherwise.
  *
  * @param mixed $mixContent
  * @return QQNode
  */
 protected function ResolveContentItem($mixContent)
 {
     if ($mixContent instanceof QQNode) {
         if (!$mixContent->_ParentNode) {
             throw new QCallerException('Content QQNode cannot be a Top Level Node');
         }
         if ($mixContent->_RootTableName == 'attribute_value') {
             if ($mixContent instanceof QQReverseReferenceNode && !$mixContent->_PropertyName) {
                 throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
             }
             $objCurrentNode = $mixContent;
             while ($objCurrentNode = $objCurrentNode->_ParentNode) {
                 if (!$objCurrentNode instanceof QQNode) {
                     throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
                 }
                 if ($objCurrentNode instanceof QQReverseReferenceNode && !$objCurrentNode->_PropertyName) {
                     throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
                 }
             }
             return $mixContent;
         } else {
             throw new QCallerException('Content QQNode has a root table of "' . $mixContent->_RootTableName . '". Must be a root of "attribute_value".');
         }
     } else {
         if (is_string($mixContent)) {
             switch ($mixContent) {
                 case 'Id':
                     return QQN::AttributeValue()->Id;
                 case 'AttributeId':
                     return QQN::AttributeValue()->AttributeId;
                 case 'Attribute':
                     return QQN::AttributeValue()->Attribute;
                 case 'PersonId':
                     return QQN::AttributeValue()->PersonId;
                 case 'Person':
                     return QQN::AttributeValue()->Person;
                 case 'DateValue':
                     return QQN::AttributeValue()->DateValue;
                 case 'DatetimeValue':
                     return QQN::AttributeValue()->DatetimeValue;
                 case 'TextValue':
                     return QQN::AttributeValue()->TextValue;
                 case 'BooleanValue':
                     return QQN::AttributeValue()->BooleanValue;
                 case 'SingleAttributeOptionId':
                     return QQN::AttributeValue()->SingleAttributeOptionId;
                 case 'SingleAttributeOption':
                     return QQN::AttributeValue()->SingleAttributeOption;
                 default:
                     throw new QCallerException('Simple Property not found in AttributeValueDataGrid content: ' . $mixContent);
             }
         } else {
             if ($mixContent instanceof QQAssociationNode) {
                 throw new QCallerException('Content QQNode cannot go through any "To Many" association nodes.');
             } else {
                 throw new QCallerException('Invalid Content type');
             }
         }
     }
 }
예제 #5
0
function CalculateAttributeStatistics($objMembershipArray, $iTotalCount)
{
    $iEthnicity = array();
    $iFromPreviousChurch = 0;
    $iSalvationDate = array('Not Specified' => 0, 'Ten Years' => 0, 'Twenty Years' => 0, 'Thirty Years' => 0, 'Forty Years' => 0, 'Fifty Years Or More' => 0);
    $iMaritalStatus = array('Not Specified' => 0, 'Single' => 0, 'Married' => 0, 'Separated' => 0);
    $iAgeStatus = array('Not Specified' => 0, '0-10 Years Old' => 0, '10-20  Years Old' => 0, '20-30 Years Old' => 0, '30-40 Years Old' => 0, '40-50 Years Old' => 0, '50-60 Years Old' => 0, '60+ Years Old' => 0);
    foreach ($objMembershipArray as $objMembership) {
        $objPerson = $objMembership->Person;
        switch ($objPerson->MaritalStatusTypeId) {
            case MaritalStatusType::NotSpecified:
                $iMaritalStatus['Not Specified']++;
                break;
            case MaritalStatusType::Single:
                $iMaritalStatus['Single']++;
                break;
            case MaritalStatusType::Married:
                $iMaritalStatus['Married']++;
                break;
            case MaritalStatusType::Separated:
                $iMaritalStatus['Separated']++;
                break;
            default:
                $iMaritalStatus['Not Specified']++;
        }
        $iAge = $objPerson->Age;
        if ($iAge != null) {
            if ($iAge < 10) {
                $iAgeStatus['0-10 Years Old']++;
            } elseif ($iAge < 20) {
                $iAgeStatus['10-20  Years Old']++;
            } elseif ($iAge < 30) {
                $iAgeStatus['20-30 Years Old']++;
            } elseif ($iAge < 40) {
                $iAgeStatus['30-40 Years Old']++;
            } elseif ($iAge < 50) {
                $iAgeStatus['40-50 Years Old']++;
            } elseif ($iAge < 60) {
                $iAgeStatus['50-60 Years Old']++;
            } else {
                $iAgeStatus['60+ Years Old']++;
            }
        } else {
            $iAgeStatus['Not Specified']++;
        }
        $attributeArray = $objPerson->GetAttributeValueArray(QQ::OrderBy(QQN::AttributeValue()->Attribute->Name));
        foreach ($attributeArray as $objAttribute) {
            if ($objAttribute->Attribute->Name == 'Ethnicity') {
                if (array_key_exists($objAttribute->SingleAttributeOption->Name, $iEthnicity)) {
                    $iEthnicity[$objAttribute->SingleAttributeOption->Name]++;
                } else {
                    $iEthnicity[$objAttribute->SingleAttributeOption->Name] = 1;
                }
            }
            if ($objAttribute->Attribute->Name == 'Previous Church') {
                $iFromPreviousChurch++;
            }
            if ($objAttribute->Attribute->Name == 'Date Accepted Christ') {
                $dtsValue = $objAttribute->DateValue->Difference(QDateTime::Now());
                if ($dtsValue->IsNegative()) {
                    $intYear = abs($dtsValue->Years);
                    if ($intYear < 10) {
                        $iSalvationDate['Ten Years']++;
                    } elseif ($intYear < 20) {
                        $iSalvationDate['Twenty Years']++;
                    } elseif ($intYear < 30) {
                        $iSalvationDate['Thirty Years']++;
                    } elseif ($intYear < 40) {
                        $iSalvationDate['Forty Years']++;
                    } else {
                        $iSalvationDate['Fifty Years Or More']++;
                    }
                }
            }
        }
    }
    ksort($iEthnicity);
    $iSalvationDate['Not Specified'] = $iTotalCount - array_sum($iSalvationDate);
    // Now print it all out
    print "Total New Members From Other Churches:" . $iFromPreviousChurch . "\r\n";
    print "Salvation Date Statistics - New Member has been a Christian for:\r\n";
    foreach ($iSalvationDate as $key => $value) {
        print $key . ': ,' . $value . "\r\n";
    }
    print "Marital Statistics:\r\n";
    foreach ($iMaritalStatus as $key => $value) {
        print $key . ': ,' . $value . "\r\n";
    }
    print "Age Statistics:\r\n";
    foreach ($iAgeStatus as $key => $value) {
        print $key . ': ,' . $value . "\r\n";
    }
    print "Ethnicity BreakDown:\r\n";
    foreach ($iEthnicity as $key => $value) {
        print $key . ': ,' . $value . "\r\n";
    }
}
예제 #6
0
 /**
  * Checks to see if an association exists with a specific AttributeOptionAsMultiple
  * @param AttributeOption $objAttributeOption
  * @return bool
  */
 public function IsAttributeOptionAsMultipleAssociated(AttributeOption $objAttributeOption)
 {
     if (is_null($this->intId)) {
         throw new QUndefinedPrimaryKeyException('Unable to call IsAttributeOptionAsMultipleAssociated on this unsaved AttributeValue.');
     }
     if (is_null($objAttributeOption->Id)) {
         throw new QUndefinedPrimaryKeyException('Unable to call IsAttributeOptionAsMultipleAssociated on this AttributeValue with an unsaved AttributeOption.');
     }
     $intRowCount = AttributeValue::QueryCount(QQ::AndCondition(QQ::Equal(QQN::AttributeValue()->Id, $this->intId), QQ::Equal(QQN::AttributeValue()->AttributeOptionAsMultiple->AttributeOptionId, $objAttributeOption->Id)));
     return $intRowCount > 0;
 }
예제 #7
0
 protected function InitializeArray()
 {
     $iAfricanAmerican = $iAfricanAmericanNative = $iAfricanAmericanItalian = $iAfricanAmericanCaucasian = 0;
     $iAsian = $iBrazilian = $iBritish = $iCaucasian = $iChinese = 0;
     $iChineseAmerican = $iEthiopian = $iFilipino = $iFilipinoPuertoRican = $iGreek = 0;
     $iHawaiian = $iHispanic = $iHispanicBrazilian = $iHispanicLatino = $iIndian = 0;
     $iJapanese = $iJapaneseCaucasian = $iKoreanAmerican = $iLatino = 0;
     $iMiddleEastern = $iPolynesian = $iSamoan = $iSpanish = $iSriLankan = $iSwiss = 0;
     $iTongan = $iVietnamese = $iOther = $iNigerian = 0;
     $iTotalEthnicCount = 0;
     $objPersonArray = Person::LoadArrayBy2016Attribute();
     $this->iTotalPersonCount = count($objPersonArray);
     foreach ($objPersonArray as $objPerson) {
         $attributeArray = $objPerson->GetAttributeValueArray(QQ::OrderBy(QQN::AttributeValue()->Attribute->Name));
         foreach ($attributeArray as $objAttribute) {
             if ($objAttribute->Attribute->Name == 'Ethnicity') {
                 $iTotalEthnicCount++;
                 switch ($objAttribute->SingleAttributeOption->Name) {
                     case "African American":
                         $iAfricanAmerican++;
                         break;
                     case "African American/Native American":
                         $iAfricanAmericanNative++;
                         break;
                     case "African America/Italian":
                         $iAfricanAmericanItalian++;
                         break;
                     case "African America/Caucasian":
                         $iAfricanAmericanCaucasian++;
                         break;
                     case "Asian":
                         $iAsian++;
                         break;
                     case "Brazilian":
                         $iBrazilian++;
                         break;
                     case "British":
                         $iBritish++;
                         break;
                     case "Caucasian":
                         $iCaucasian++;
                         break;
                     case "Chinese":
                         $iChinese++;
                         break;
                     case "Chinese American":
                         $iChineseAmerican++;
                         break;
                     case "Ethiopian":
                         $iEthiopian++;
                         break;
                     case "Filipino":
                         $iFilipino++;
                         break;
                     case "Filipino/Puerto Rican":
                         $iFilipinoPuertoRican++;
                         break;
                     case "Greek":
                         $iGreek++;
                         break;
                     case "Hawaiian":
                         $iHawaiian++;
                         break;
                     case "Hispanic":
                         $iHispanic++;
                         break;
                     case "Hispanic/Brazilian":
                         $iHispanicBrazilian++;
                         break;
                     case "Hispanic/Latino":
                         $iHispanicLatino++;
                         break;
                     case "Indian":
                         $iIndian++;
                         break;
                     case "Japanese":
                         $iJapanese++;
                         break;
                     case "Japanese/Caucasian":
                         $iJapaneseCaucasian++;
                         break;
                     case "Korean-American":
                         $iKoreanAmerican++;
                         break;
                     case "Latino":
                         $iLatino++;
                         break;
                     case "Middle Eastern":
                         $iMiddleEastern++;
                         break;
                     case "Polynesian":
                         $iPolynesian++;
                         break;
                     case "Samoan":
                         $iSamoan++;
                         break;
                     case "Spanish":
                         $iSpanish++;
                         break;
                     case "Sri Lankan":
                         $iSriLankan++;
                         break;
                     case "Swiss":
                         $iSwiss++;
                         break;
                     case "Tongan":
                         $iTongan++;
                         break;
                     case "Vietnamese":
                         $iVietnamese++;
                         break;
                     case "Nigerian":
                         $iNigerian++;
                         break;
                     default:
                         $iOther++;
                         break;
                 }
             }
         }
     }
     // Construct Associative Array of counts.
     $returnArray = array("totalEthnicCount" => $iTotalEthnicCount, "africanAmerican" => $iAfricanAmerican, "africanAmericanNative" => $iAfricanAmericanNative, "africanAmericanItalian" => $iAfricanAmericanItalian, "africanAmericanCaucasian" => $iAfricanAmericanCaucasian, "asian" => $iAsian, "brazilian" => $iBrazilian, "british" => $iBritish, "caucasian" => $iCaucasian, "chinese" => $iChinese, "chineseAmerican" => $iChineseAmerican, "ethiopian" => $iEthiopian, "filipino" => $iFilipino, "filipinoPuertoRican" => $iFilipinoPuertoRican, "greek" => $iGreek, "hawaiian" => $iHawaiian, "hispanic" => $iHispanic, "hispanicBrazilian" => $iHispanicBrazilian, "hispanicLatino" => $iHispanicLatino, "indian" => $iIndian, "japanese" => $iJapanese, "japaneseCaucasian" => $iJapaneseCaucasian, "koreanAmerican" => $iKoreanAmerican, "latino" => $iLatino, "middleEastern" => $iMiddleEastern, "polynesian" => $iPolynesian, "samoan" => $iSamoan, "spanish" => $iSpanish, "sriLankan" => $iSriLankan, "swiss" => $iSwiss, "tongan" => $iTongan, "vietnamese" => $iVietnamese, "other" => $iOther, "nigerian" => $iNigerian);
     return $returnArray;
 }