当前位置: 首页>>代码示例>>PHP>>正文


PHP Family::getHusband方法代码示例

本文整理汇总了PHP中Family::getHusband方法的典型用法代码示例。如果您正苦于以下问题:PHP Family::getHusband方法的具体用法?PHP Family::getHusband怎么用?PHP Family::getHusband使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Family的用法示例。


在下文中一共展示了Family::getHusband方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Family

		<input type="submit" value="<?php 
        echo $pgv_lang["save"];
        ?>
" /><input type="button" value="<?php 
        echo $pgv_lang["cancel"];
        ?>
" onclick="window.close();" />
	</form>
	<?php 
        break;
        //------------------------------------------------------------------------------
    //------------------------------------------------------------------------------
    case 'changefamily_update':
        require_once PGV_ROOT . 'includes/classes/class_family.php';
        $family = new Family($gedrec);
        $father = $family->getHusband();
        $mother = $family->getWife();
        $children = $family->getChildren();
        $updated = false;
        //-- add the new father link
        if (isset($_REQUEST['HUSB'])) {
            $HUSB = $_REQUEST['HUSB'];
        }
        if (!empty($HUSB) && (is_null($father) || $father->getXref() != $HUSB)) {
            if (strstr($gedrec, "1 HUSB") !== false) {
                $gedrec = preg_replace("/1 HUSB @.*@/", "1 HUSB @{$HUSB}@", $gedrec);
            } else {
                $gedrec .= "\n1 HUSB @{$HUSB}@\n";
            }
            if (isset($pgv_changes[$HUSB . "_" . PGV_GEDCOM])) {
                $indirec = find_updated_record($HUSB, PGV_GED_ID);
开发者ID:rathervague,项目名称:phpgedview,代码行数:31,代码来源:edit_interface.php

示例2: CompairForUpdateFamily

 /**
  * Compairs familys and then returns true if the have 50% or more chance of being the same family.
  * Other wise it returns false.
  */
 function CompairForUpdateFamily($family1, $family2)
 {
     // Values used to calculate the Percent of likley hood that the family is the same.
     $ChanceSameFamily = 0.0;
     $CountFamily1 = 0.0;
     $CountFamily2 = 0.0;
     $ChanceSame = 0.0;
     $firstTimeChildren = true;
     $famrec1 = find_family_record($family1);
     $ct = preg_match("/(\\w+):(.+)/", $family2, $match);
     if ($ct > 0) {
         $servid = trim($match[1]);
         $remoteid = trim($match[2]);
         $famrec2 = $this->getRemoteRecord($remoteid);
     } else {
         return false;
     }
     $family1 = Family::getInstance($family1);
     if (is_null($family1)) {
         return false;
     }
     $family2 = new Family($famrec2);
     if (!is_null($family1)) {
         // Creat the fathers if their is some
         $father1 = $family1->getHusband();
         $CountFamily1 += 1.0;
         $mother1 = $family1->getWife();
         $CountFamily1 += 1.0;
     }
     $father2 = $family2->getHusband();
     $CountFamily2 += 1.0;
     if (empty($father1)) {
         unset($father1);
         $CountFamily1 -= 1.0;
     }
     if (empty($father2)) {
         unset($father2);
         $CountFamily2 -= 1.0;
     }
     // Creat the mothers if their is some
     $mother2 = $family2->getWife();
     $CountFamily2 += 1.0;
     if (empty($mother1)) {
         unset($mother1);
         $CountFamily1 -= 1.0;
     }
     if (empty($mother2)) {
         unset($mother2);
         $CountFamily2 -= 1.0;
     }
     // Creat an array of Children
     $children1 = $family1->getChildren();
     $children2 = $family2->getChildren();
     // finds the probablity that they are the same family Bassed of both sites information
     $CountFamily1 += count($children1);
     $CountFamily2 += count($children2);
     foreach ($children1 as $childID1 => $Person1) {
         if (!empty($Person1)) {
             foreach ($children2 as $childID2 => $Person2) {
                 if (!empty($Person2)) {
                     if ($this->ComparePeople($Person1, $Person2)) {
                         $ChanceSameFamily += 1.0;
                         //print "<br />".$Person1->getXref()." equals ".$Person2->getXref();
                         break;
                     }
                 }
             }
         }
     }
     if (empty($father1)) {
     } elseif (empty($father2)) {
     } else {
         if ($this->ComparePeople($father1, $father2)) {
             $ChanceSameFamily += 1.0;
         }
     }
     if (empty($mother1)) {
     } elseif (empty($mother2)) {
     } else {
         if ($this->ComparePeople($mother1, $mother2)) {
             $ChanceSameFamily += 1.0;
         }
     }
     if ($CountFamily1 != 0 && $CountFamily2 != 0) {
         $ChanceSame = ($ChanceSameFamily / $CountFamily1 + $ChanceSameFamily / $CountFamily2) / 2;
         //print "<br />chancesame=".$ChanceSameFamily." count1=".$CountFamily1." count2=".$CountFamily2." ".$family1->getXref()." compared to ".$family2->getXref()." is ".$ChanceSame;
     } else {
         return false;
     }
     if ($ChanceSame < 0.5) {
         // If the probabilty is less then 0.5 or 50% then the current family is stored here to be added later
         return false;
     } else {
         return true;
     }
 }
开发者ID:bitweaver,项目名称:phpgedview,代码行数:100,代码来源:class_serviceclient.php

示例3: getFamilyAnniversaryIcalEvent

/**
 * returns a marriage anniversary iCalendar event for a family marriage.
 * If there is no date for the event, or either of the spouses is not alive,
 * no iCalendar event will be returned
 * @param Family $family the Family Object used as the source of the marriage anniversary info
 * @return the marriage anniversary iCalendar event.
 */
function getFamilyAnniversaryIcalEvent($family)
{
    $anniversaryDate = $family->getMarriageDate();
    if ($anniversaryDate == "") {
        return;
    }
    if ($family->isDivorced()) {
        return;
    }
    $wife = $family->getWife();
    $husband = $family->getHusband();
    if ($wife->isDead() || $husband->isDead()) {
        return;
    }
    $anniversaryDate = new GedcomDate($anniversaryDate);
    $summary = "Anniversary of " . $husband->getFullName() . " and " . $wife->getFullName();
    $place = $family->getMarriagePlace();
    $description = "Married on " . $anniversaryDate->Display(false) . ($place == "" ? "" : "in " . $place) . "\n" . encode_url($family->getAbsoluteLinkUrl());
    $iCalRecord = getIcalRecord($anniversaryDate, $summary, $description, encode_url($family->getAbsoluteLinkUrl()));
    return $iCalRecord;
}
开发者ID:bitweaver,项目名称:phpgedview,代码行数:28,代码来源:ical.php


注:本文中的Family::getHusband方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。