Exemplo n.º 1
0
<?php

$intPersonIdByIndvId = array();
foreach (AttributeValue::LoadArrayByAttributeId(2) as $objAttributeValue) {
    $intPersonIdByIndvId[$objAttributeValue->TextValue] = $objAttributeValue->PersonId;
}
$objMySqli = new mysqli('localhost', 'root', '', 'alcf_acs');
$objResult = $objMySqli->query('SELECT * FROM awperelt');
$intCount = $objResult->num_rows;
while (QDataGen::DisplayWhileTask('Importing Family Relationships', $intCount) && ($objRow = $objResult->fetch_array())) {
    if ($objRow['indvid'] != $objRow['reltindvid']) {
        $intRelationshipTypeId = null;
        switch (strtolower($objRow['relationship'])) {
            case 'mother':
            case 'father':
                $intRelationshipTypeId = RelationshipType::Parental;
                break;
            case 'son':
            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':
Exemplo n.º 2
0
    /**
     * Deletes all associated AttributeValues
     * @return void
     */
    public function DeleteAllAttributeValues()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateAttributeValue on this unsaved Attribute.');
        }
        // Get the Database Object for this Class
        $objDatabase = Attribute::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (AttributeValue::LoadArrayByAttributeId($this->intId) as $objAttributeValue) {
                $objAttributeValue->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`attribute_value`
				WHERE
					`attribute_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }