本文整理汇总了PHP中Relationship::loadFields方法的典型用法代码示例。如果您正苦于以下问题:PHP Relationship::loadFields方法的具体用法?PHP Relationship::loadFields怎么用?PHP Relationship::loadFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Relationship
的用法示例。
在下文中一共展示了Relationship::loadFields方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMarriages
function getMarriages(&$search, $limit = 0)
{
global $tblprefix, $err_marriage, $currentRequest;
$res = array();
$query = "SELECT DISTINCT CONCAT_WS('-', YEAR(NOW()), LPAD(MONTH(e.date1), 2, '0'), LPAD(DAYOFMONTH(e.date1), 2, '0')) AS fake_marriage, " . "DATE_FORMAT(e.date1, " . $currentRequest->datefmt . ") AS DOM, e.date1, " . PersonDetail::getFields("groom", "ng", "bg", "dg") . "," . PersonDetail::getFields("bride", "nb", "bb", "db") . ", sp.dissolve_date, sp.dissolve_reason," . " DATE_FORMAT(sp.dissolve_date, " . $currentRequest->datefmt . ") AS DOD, e.event_id " . " FROM " . $tblprefix . "event e" . " JOIN " . $tblprefix . "spouses sp ON sp.event_id = e.event_id" . " LEFT JOIN " . $tblprefix . "people bride ON sp.bride_id = bride.person_id " . " LEFT JOIN " . $tblprefix . "people groom ON sp.groom_id = groom.person_id " . PersonDetail::getJoins("LEFT", "groom", "ng", "bg", "dg") . PersonDetail::getJoins("LEFT", "bride", "nb", "bb", "db");
// if the user is not logged in, only show people pre $restrictdate
$query .= $this->addPersonRestriction(" WHERE ", "bb", "db");
$query .= $this->addPersonRestriction(" AND ", "bg", "dg");
$query .= " AND (e.etype = " . BANNS_EVENT . " OR e.etype = " . MARRIAGE_EVENT . ") ";
if ($limit > 0) {
$query .= " HAVING fake_marriage >= now() AND fake_marriage <= DATE_ADD(NOW(), INTERVAL {$limit} DAY) ORDER BY fake_marriage";
}
$this->addLimit($search, $query);
$result = $this->runQuery($query, $err_marriage);
$search->numResults = 0;
while ($row = $this->getNextRow($result)) {
$rel = new Relationship();
$rel->person->loadFields($row, L_HEADER, "groom_");
$rel->person->name->loadFields($row, "ng_");
$rel->relation->loadFields($row, L_HEADER, "bride_");
$rel->relation->name->loadFields($row, "nb_");
$rel->loadFields($row);
$rel->marriage_date = $row["date1"];
$rel->dom = $row["DOM"];
$search->numResults++;
$res[] = $rel;
}
$this->freeResultSet($result);
$search->results = $res;
}
示例2: getMarriagePlaces
function getMarriagePlaces(&$locations, $person = null)
{
global $tblprefix, $strEvent, $currentRequest;
$pquery = "select relation.event_id," . PersonDetail::getFields("groom", "ng", "bg", "dg") . "," . PersonDetail::getFields("bride", "nb", "bb", "db") . "," . Event::getFields("e") . ", relation.dissolve_date, relation.dissolve_reason," . " DATE_FORMAT(relation.dissolve_date, " . $currentRequest->datefmt . ") AS DOD " . "," . Location::getFields("l") . " FROM " . $tblprefix . "event e" . " JOIN " . $tblprefix . "spouses relation ON relation.event_id=e.event_id" . " JOIN " . $tblprefix . "locations l ON e.location_id=l.location_id " . " LEFT JOIN " . $tblprefix . "people bride ON relation.bride_id = bride.person_id " . " LEFT JOIN " . $tblprefix . "people groom ON relation.groom_id = groom.person_id " . PersonDetail::getJoins("LEFT", "groom", "ng", "bg", "dg") . PersonDetail::getJoins("LEFT", "bride", "nb", "bb", "db") . " WHERE (e.etype = " . BANNS_EVENT . " OR e.etype=" . MARRIAGE_EVENT . ") AND e.location_id is not null";
$pquery .= $this->addPersonRestriction(" AND ", "bg", "dg");
$pquery .= $this->addPersonRestriction(" AND ", "bb", "db");
if ($locations->location_id > 0) {
$pquery .= " AND l.location_id = " . $locations->location_id;
}
$presult = $this->runQuery($pquery, "");
while ($row = $this->getNextRow($presult)) {
$rel = new Relationship();
$rel->person->loadFields($row, L_HEADER, "groom_");
$rel->person->name->loadFields($row, "ng_");
$rel->person->setPermissions();
$rel->relation->loadFields($row, L_HEADER, "bride_");
$rel->relation->name->loadFields($row, "nb_");
$rel->relation->setPermissions();
$rel->loadFields($row);
$rel->event = new Event();
$rel->event->loadFields($row, "e_");
$rel->event->location->loadFields($row, "l_");
$rel->event->location->setPermissions();
$text = $rel->person->getLink() . ' ' . $strEvent[$row["e_etype"]] . ' ' . $rel->relation->getLink() . ' ' . $rel->event->getDate1();
if ($rel->isViewable()) {
$p = $this->createPlace($locations, $rel->event->location, $text);
if ($p != null) {
$p->marriage = true;
}
}
}
$this->freeResultSet($presult);
}