本文整理汇总了PHP中Place::getById方法的典型用法代码示例。如果您正苦于以下问题:PHP Place::getById方法的具体用法?PHP Place::getById怎么用?PHP Place::getById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Place
的用法示例。
在下文中一共展示了Place::getById方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleIndividualAPI
function handleIndividualAPI($args, $that)
{
$session = mySession::getInstance();
if ($that->method === 'GET') {
if ($that->verb === '') {
$id = intval(array_shift($args));
if ($id && is_numeric($id)) {
$session = mySession::getInstance();
if ($id > -1) {
$person = Person::getById($id);
if ($person) {
$person->appendNames();
$person->birth = Birth::getById($id);
if ($person->birth) {
$person->birth->birthPlace = Place::getById($person->birth->place);
}
$person->death = Death::getById($id);
if ($person->death) {
$person->death->deathPlace = Place::getById($person->death->place);
}
$person->burial = Burial::getById($id);
if ($person->burial) {
$person->burial->burialPlace = Place::getById($person->burial->place);
}
$person->parents = Parents::getParentsOf($id);
$person->children = Parents::getChildrenOf($id);
$person->spouse = Spouse::getById($id);
$person->profilePicture = File::getById($person->profile_pic);
return $person;
} else {
return false;
}
} else {
return false;
}
}
} else {
if ($that->verb === 'submissions') {
$user = User::current_user();
$submissions = Person::getSubmissions($user);
return $submissions;
} else {
if ($that->verb === 'allSubmissions' && $session->isAdmin()) {
$submissions = Person::getSubmissions();
return $submissions;
} else {
if ($that->verb === 'children') {
if (count($args) > 2 || count($args) < 2) {
return array();
} else {
$id = intval(array_shift($args));
$spouseid = intval(array_shift($args));
if ($id && is_numeric($id) && $spouseid && is_numeric($spouseid)) {
$children = Person::getChildrenByParents($id, $spouseid);
$result = array();
if ($children && is_array($children) && count($children)) {
foreach ($children as $child) {
$person = Person::getById($child->child);
$person->appendNames();
$person->profilePicture = File::getById($person->profile_pic);
$result[] = $person;
}
}
return $result;
} else {
return array();
}
}
} else {
if ($that->verb === 'families') {
if (!empty($args)) {
$letter = array_shift($args);
} else {
$letter = 'a';
}
$all = array_shift($args);
$all = $all === "true" ? true : false;
$names = array();
$families = Person::getLastNames($letter, $all);
if ($families) {
foreach ($families as $key) {
$names[] = $key['lastName'];
}
}
return $names;
} else {
if ($that->verb === 'family') {
$id = intval(array_shift($args));
if ($id && is_numeric($id)) {
$person = Person::getById($id);
$person->appendNames();
$family = new stdClass();
$family->self = $person;
$family->parents = array();
// $family->siblings = array();
$children = $person->getChildren();
$family->children = array();
foreach ($children as $child) {
$temp = Person::getById($child->child);
$temp->appendNames();
//.........这里部分代码省略.........
示例2: getByFileId
public static function getByFileId($id = NULL)
{
if ($id) {
$database = cbSQLConnect::connect('object');
if (isset($database)) {
$query = "SELECT * FROM `tag` WHERE `fileid`=" . $id;
$result = $database->QuerySingle($query);
$tags = array();
$tags['person'] = array();
$tags['place'] = array();
$tags['other'] = array();
foreach ($result as $tag) {
if ($tag->enum === 'person') {
$tempPerson = Person::getById($tag->foreignid);
if ($tempPerson) {
$tempPerson->text = $tempPerson->selectName() . " (" . $tempPerson->yearBorn . ")";
$tags['person'][] = $tempPerson;
}
} else {
if ($tag->enum === 'place') {
$place = Place::getById($tag->foreignid);
if ($place) {
$place = recast('Place', $place);
$place->text = $place->getTypeaheadName();
$tags['place'][] = $place;
}
} else {
$tags['other'][] = $tag;
}
}
}
return $tags;
}
} else {
return NULL;
}
}
示例3: place
protected function place($args)
{
$session = mySession::getInstance();
if ($this->method === 'GET') {
if ($this->verb == "") {
$placeId = intval(array_shift($args));
if ($placeId && is_numeric($placeId)) {
$place = Place::getById($placeId);
return $place;
}
}
}
return false;
}
示例4: array
$temp[0] = 'parent';
$temp_person = Person::getById($pops->parentId);
$temp[1] = "" . $temp_person->lastName . ", " . $temp_person->firstName . " " . $temp_person->middleName . " || Born: " . $temp_person->yearBorn . ", Death: " . $temp_person->yearDead . " || " . $temp_person->id;
$parents[] = $temp;
}
$result[] = $parents;
$spouses = array();
$spouse = Spouse::getAllSpousesById($id);
foreach ($spouse as $spo) {
$temp = array();
$temp[0] = 'spouse';
$temp_spouse = Person::getById($spo->spouse);
$temp[1] = "" . $temp_spouse->lastName . ", " . $temp_spouse->firstName . " " . $temp_spouse->middleName . " || Born: " . $temp_spouse->yearBorn . ", Death: " . $temp_spouse->yearDead . " || " . $temp_spouse->id;
$temp[2] = $spo->day . "/" . $spo->month . "/" . $spo->year;
$temp[3] = $spo->yearM;
$temp[4] = array_values(get_object_vars(Place::getById($spo->place)));
$spouses[] = $temp;
}
$result[] = $spouses;
echo json_encode($result);
}
exit;
}
//this will get us the individual's data
if ($action == 'getFileData') {
$id = getRequest('id');
if ($id) {
$result['file'] = $file = File::getById($id);
$result['tags'] = $tags = File::getTagsById($id);
echo json_encode($result);
}
示例5: doInd
function doInd($that, $args)
{
$that = recast('MyAPI', $that);
$session = mySession::getInstance();
if ($that->method === 'GET') {
if ($that->verb === '') {
$id = intval(array_shift($args));
if ($id && is_numeric($id)) {
$session = mySession::getInstance();
if ($id > -1) {
$person = Person::getById($id);
if ($person) {
$person->appendNames();
$person->birth = Birth::getById($id);
if ($person->birth) {
$person->birth->birthPlace = Place::getById($person->birth->place);
}
$person->death = Death::getById($id);
if ($person->death) {
$person->death->deathPlace = Place::getById($person->death->place);
}
$person->burial = Burial::getById($id);
if ($person->burial) {
$person->burial->burialPlace = Place::getById($person->burial->place);
}
$person->parents = Parents::getParentsOf($id);
$person->children = Parents::getChildrenOf($id);
$person->spouse = Spouse::getById($id);
return $person;
} else {
return false;
}
} else {
return false;
}
}
} else {
if ($that->verb === 'families') {
if (!empty($args)) {
$letter = array_shift($args);
} else {
$letter = 'a';
}
$names = array();
$families = Person::getLastNames($letter);
if ($families) {
foreach ($families as $key) {
$names[] = $key['lastName'];
}
}
return $names;
} else {
if ($that->verb === 'familyNames') {
if (!empty($args)) {
$lastName = array_shift($args);
} else {
$lastName = 'Law';
}
$names = array();
$familyNames = Person::getFirstNames($lastName);
if ($familyNames) {
foreach ($familyNames as $key) {
$key = recast('Person', arrayToObject($key));
$key->appendNames();
$names[] = $key;
}
}
return $names;
}
}
}
} else {
if ($that->method === 'DELETE' && $session->isLoggedIn() && $session->isAdmin()) {
$id = intval($args[0]);
if (is_numeric($id)) {
$person = Person::getById($id);
if ($person) {
$birth = Birth::getById($id);
if ($birth) {
$birth = recast('Birth', $birth);
$birth->delete();
//delete
}
$death = Death::getById($id);
if ($death) {
$death = recast('Death', $death);
$death->delete();
//delete
}
$burial = Burial::getById($id);
if ($burial) {
$burial = recast('Burial', $burial);
$burial->delete();
//delete
}
$parents = Parents::getParentsOf($id);
if ($parents) {
foreach ($parents as $parent) {
$parent = recast('Parents', $parent);
$parent->delete();
//.........这里部分代码省略.........
示例6: updateSpouse
public static function updateSpouse($spouse, $spouseId, $individualId)
{
$newSpouse = Spouse::getByPair($spouseId, $individualId);
if ($newSpouse) {
$newSpouse = recast('Spouse', $newSpouse);
$newSpouse->day = $spouse->marriageDate->day;
$newSpouse->month = $spouse->marriageDate->month;
$newSpouse->year = $spouse->marriageDate->year;
$newSpouse->yearM = $spouse->marriageDate->yearM;
$newSpouse->save();
$marriagePlace = Place::getById($newSpouse->place);
if ($marriagePlace) {
$marriagePlace = recast('Place', $marriagePlace);
if ($spouse->marriagePlace && isset($spouse->marriagePlace->town)) {
$marriagePlace->town = $spouse->marriagePlace->town;
}
if ($spouse->marriagePlace && isset($spouse->marriagePlace->county)) {
$marriagePlace->county = $spouse->marriagePlace->county;
}
if ($spouse->marriagePlace && isset($spouse->marriagePlace->state)) {
$marriagePlace->state = $spouse->marriagePlace->state;
}
if ($spouse->marriagePlace && isset($spouse->marriagePlace->country)) {
$marriagePlace->country = $spouse->marriagePlace->country;
}
if ($spouse->marriagePlace && isset($spouse->marriagePlace->cemetary)) {
$marriagePlace->cemetary = $spouse->marriagePlace->cemetary;
}
$marriagePlace->ft_name = 'spouse';
$marriagePlace->fkey = $spouseId;
$marriagePlace->save();
}
return $newSpouse->id;
}
return false;
}