本文整理汇总了PHP中get_relationship函数的典型用法代码示例。如果您正苦于以下问题:PHP get_relationship函数的具体用法?PHP get_relationship怎么用?PHP get_relationship使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_relationship函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: unserialize
/**
* Unserializes the event object stored in the database
*
* @param string $serialized Serialized string
* @return string
*/
public function unserialize($serialized)
{
$data = unserialize($serialized);
if (isset($data->action)) {
$this->action = $data->action;
}
if (isset($data->object_id) && isset($data->object_type)) {
switch ($data->object_type) {
case 'object':
case 'user':
case 'group':
case 'site':
$this->object = get_entity($data->object_id);
break;
case 'annotation':
$this->object = elgg_get_annotation_from_id($data->object_id);
break;
case 'metadata':
$this->object = elgg_get_metadata_from_id($data->object_id);
break;
case 'relationship':
$this->object = get_relationship($data->object_id);
}
}
if (isset($data->actor_guid)) {
$this->actor = get_entity($data->actor_guid);
}
}
开发者ID:elgg,项目名称:elgg,代码行数:34,代码来源:EventSerialization.php
示例2: add_entity_relationship
/**
* Define an arbitrary relationship between two entities.
* This relationship could be a friendship, a group membership or a site membership.
*
* This function lets you make the statement "$guid_one is a $relationship of $guid_two".
*
* @param int $guid_one First GUID
* @param string $relationship Relationship name
* @param int $guid_two Second GUID
*
* @return bool
* @throws InvalidArgumentException
*/
function add_entity_relationship($guid_one, $relationship, $guid_two)
{
global $CONFIG;
if (strlen($relationship) > ElggRelationship::RELATIONSHIP_LIMIT) {
$msg = "relationship name cannot be longer than " . ElggRelationship::RELATIONSHIP_LIMIT;
throw InvalidArgumentException($msg);
}
$guid_one = (int) $guid_one;
$relationship = sanitise_string($relationship);
$guid_two = (int) $guid_two;
$time = time();
// Check for duplicates
if (check_entity_relationship($guid_one, $relationship, $guid_two)) {
return false;
}
$id = insert_data("INSERT INTO {$CONFIG->dbprefix}entity_relationships\n\t\t(guid_one, relationship, guid_two, time_created)\n\t\tVALUES ({$guid_one}, '{$relationship}', {$guid_two}, {$time})");
if ($id !== false) {
$obj = get_relationship($id);
// this event has been deprecated in 1.9. Use 'create', 'relationship'
$result_old = elgg_trigger_event('create', $relationship, $obj);
$result = elgg_trigger_event('create', 'relationship', $obj);
if ($result && $result_old) {
return true;
} else {
delete_relationship($result);
}
}
return false;
}
开发者ID:tjcaverly,项目名称:Elgg,代码行数:42,代码来源:relationships.php
示例3: get
/**
* {@inheritdoc}
*/
public function get($uid = '')
{
switch ($uid) {
case 'me':
$uid = "ue" . elgg_get_logged_in_user_guid();
break;
case 'site':
$uid = "se" . elgg_get_site_entity()->guid;
break;
}
$abbr = substr($uid, 0, 2);
switch ($abbr) {
case 'an':
$id = (int) substr($uid, 2);
$object = elgg_get_annotation_from_id($id);
break;
case 'md':
$id = (int) substr($uid, 2);
$object = elgg_get_metadata_from_id($id);
break;
case 'rl':
$id = (int) substr($uid, 2);
$object = get_relationship($id);
break;
case 'rv':
$id = (int) substr($uid, 2);
$river = elgg_get_river(array('ids' => sanitize_int($id)));
$object = $river ? $river[0] : false;
break;
case 'ue':
case 'se':
case 'oe':
case 'ge':
$id = (int) substr($uid, 2);
$object = get_entity($id);
break;
default:
$object = get_user_by_username($uid);
if (!$object && is_numeric($uid)) {
$object = get_entity($uid);
}
}
if (!$this->isExportable($object)) {
return false;
}
return $object;
}
开发者ID:hypejunction,项目名称:hypeapps,代码行数:50,代码来源:Graph.php
示例4: getObject
/**
* Get the object of the event
*
* @return \ElggData
*/
public function getObject()
{
switch ($this->object_type) {
case 'object':
case 'user':
case 'site':
case 'group':
return get_entity($this->object_id);
break;
case 'relationship':
return get_relationship($this->object_id);
break;
case 'annotation':
return elgg_get_annotation_from_id($this->object_id);
break;
}
return null;
}
开发者ID:sephiroth88,项目名称:Elgg,代码行数:23,代码来源:Event.php
示例5: testCanUpdate
public function testCanUpdate()
{
add_entity_relationship($this->user->guid, 'test_self1', $this->user->guid);
$rel = check_entity_relationship($this->user->guid, 'test_self1', $this->user->guid);
$res = update_data("\n\t\t\tUPDATE {$this->prefix}entity_relationships\n\t\t\tSET relationship = 'test_self2'\n\t\t\tWHERE id = {$rel->id}\n\t\t");
$rel = get_relationship($rel->id);
$this->assertIdentical($res, true);
$this->assertEqual($rel->relationship, 'test_self2');
$num_rows = update_data("\n\t\t\tUPDATE {$this->prefix}entity_relationships\n\t\t\tSET relationship = 'test_self3'\n\t\t\tWHERE id = {$rel->id}\n\t\t", [], true);
$rel = get_relationship($rel->id);
$this->assertIdentical($num_rows, 1);
$this->assertEqual($rel->relationship, 'test_self3');
$num_rows = update_data("\n\t\t\tUPDATE {$this->prefix}entity_relationships\n\t\t\tSET relationship = :rel\n\t\t\tWHERE id = :id\n\t\t", [':rel' => 'test_self4', ':id' => $rel->id], true);
$rel = get_relationship($rel->id);
$this->assertIdentical($num_rows, 1);
$this->assertEqual($rel->relationship, 'test_self4');
$rel->delete();
}
开发者ID:elgg,项目名称:elgg,代码行数:18,代码来源:ElggDataFunctionsTest.php
示例6: elgg_get_metadata_from_id
$m->name = $id_or_name;
$m->entity_guid = $guid;
$m->time_created = $entity->time_created;
$m->time_updated = $entity->time_updated;
$m->owner_guid = $entity->owner_guid;
$m->id = $id_or_name;
$m->type = "attr";
break;
case 'metadata':
$m = elgg_get_metadata_from_id($id_or_name);
break;
case 'annotation':
$m = elgg_get_annotation_from_id($id_or_name);
break;
case 'relationship':
$r = get_relationship($id_or_name);
break;
case 'volatile':
$m = elgg_trigger_plugin_hook('volatile', 'metadata', array('guid' => $guid, 'varname' => $id_or_name));
break;
default:
$msg = "Sorry, I don't know how to export '" . $type . "'";
throw new \InvalidParameterException($msg);
}
// Render metadata or relationship
if (!$m && !$r) {
throw new \InvalidParameterException("Could not find any data.");
}
// Exporting metadata?
if ($m) {
if ($m->entity_guid != $entity->guid) {
开发者ID:ibou77,项目名称:elgg,代码行数:31,代码来源:export_handler.php
示例7: get_relationship_url
/**
* Get the url for a given relationship.
*
* @param int $id Relationship ID
*
* @return string
*/
function get_relationship_url($id)
{
global $CONFIG;
$id = (int) $id;
if ($relationship = get_relationship($id)) {
$view = elgg_get_viewtype();
$guid = $relationship->guid_one;
$type = $relationship->relationship;
$url = "";
$function = "";
if (isset($CONFIG->relationship_url_handler[$type])) {
$function = $CONFIG->relationship_url_handler[$type];
}
if (isset($CONFIG->relationship_url_handler['all'])) {
$function = $CONFIG->relationship_url_handler['all'];
}
if (is_callable($function)) {
$url = call_user_func($function, $relationship);
}
if ($url == "") {
$nameid = $relationship->id;
$url = elgg_get_site_url() . "export/{$view}/{$guid}/relationship/{$nameid}/";
}
return $url;
}
return false;
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:34,代码来源:relationships.php
示例8: get_relationship_url
/**
* Get the url for a given relationship.
*
* @param int $id Relationship ID
*
* @return string
* @deprecated 1.9 Use \ElggRelationship::getURL()
*/
function get_relationship_url($id)
{
elgg_deprecated_notice(__FUNCTION__ . ' is deprecated. Use \\ElggRelationship::getURL()', 1.9);
global $CONFIG;
$id = (int) $id;
if ($relationship = get_relationship($id)) {
$view = elgg_get_viewtype();
$guid = $relationship->guid_one;
$type = $relationship->relationship;
$url = "";
$function = "";
if (isset($CONFIG->relationship_url_handler[$type])) {
$function = $CONFIG->relationship_url_handler[$type];
}
if (isset($CONFIG->relationship_url_handler['all'])) {
$function = $CONFIG->relationship_url_handler['all'];
}
if (is_callable($function)) {
$url = call_user_func($function, $relationship);
}
if ($url == "") {
$nameid = $relationship->id;
$url = elgg_get_site_url() . "export/{$view}/{$guid}/relationship/{$nameid}/";
}
return $url;
}
return false;
}
开发者ID:gzachos,项目名称:elgg_ellak,代码行数:36,代码来源:deprecated-1.9.php
示例9: getObjectFromID
/**
* For a given ID, return the object associated with it.
* This is used by the river functionality primarily.
* This is useful for checking access permissions etc on objects.
*
* @param int $id ID
*
* @return ElggRelationship
*/
public function getObjectFromID($id)
{
return get_relationship($id);
}
开发者ID:redvabel,项目名称:Vabelgg,代码行数:13,代码来源:ElggRelationship.php
示例10: get_input
$guid = (int) get_input('guid');
$type = get_input('type');
$key = get_input('key');
$show_hidden = access_show_hidden_entities(true);
$entity = get_entity($guid);
if (empty($entity) || empty($type) || $key === null) {
access_show_hidden_entities($show_hidden);
return elgg_error_response(elgg_echo('error:missing_data'));
}
if (!$entity->canEdit()) {
access_show_hidden_entities($show_hidden);
return elgg_error_response(elgg_echo('action:unauthorized'));
}
switch ($type) {
case 'entity':
if (!$entity instanceof ElggSite) {
$entity->delete();
}
break;
case 'metadata':
unset($entity->{$key});
break;
case 'relationship':
get_relationship($key)->delete();
break;
case 'private_setting':
$entity->removePrivateSetting($key);
break;
}
access_show_hidden_entities($show_hidden);
forward(REFERER);
开发者ID:elgg,项目名称:elgg,代码行数:31,代码来源:entity_explorer_delete.php
示例11: get_associate_relationship_name
function get_associate_relationship_name(WT_Individual $person1, WT_Individual $person2)
{
if ($person1 === $person2) {
$label = WT_I18N::translate('self');
} else {
$label = get_relationship_name(get_relationship($person1, $person2, true, 4));
}
return $label;
}
开发者ID:brambravo,项目名称:webtrees,代码行数:9,代码来源:functions.php
示例12: cr_facts_localisation_pl
function cr_facts_localisation_pl(&$factrec, &$fact, &$explode_fact, &$pid)
{
global $factarray;
$ct = preg_match_all("/\\d ASSO @(.*)@/", $factrec, $match, PREG_SET_ORDER);
if ($ct > 0) {
$pid2 = $match[0][1];
}
if (isset($pid2)) {
$sex1 = Person::getInstance($pid)->getSex();
$sex2 = Person::getInstance($pid2)->getSex();
if ($explode_fact[1] == "BIRT") {
switch ($explode_fact[2]) {
case "SIBL":
if ($sex2 == "M") {
$factarray[$fact] = "Narodziny brata";
} else {
if ($sex2 == "F") {
$factarray[$fact] = "Narodziny siostry";
}
}
break;
case "GCHI":
if ($sex2 == "M") {
$factarray[$fact] = "Narodziny wnuka";
} else {
if ($sex2 == "F") {
$factarray[$fact] = "Narodziny wnuczki";
}
}
break;
case "GGCH":
if ($sex2 == "M") {
$factarray[$fact] = "Narodziny prawnuka";
} else {
if ($sex2 == "F") {
$factarray[$fact] = "Narodziny prawnuczki";
}
}
break;
case "COUS":
if ($sex2 == "M") {
$factarray[$fact] = "Narodziny kuzyna";
} else {
if ($sex2 == "F") {
$factarray[$fact] = "Narodziny kuzynki";
}
}
break;
case "FSIB":
if ($sex2 == "M") {
$factarray[$fact] = "Narodziny brata ojca";
} else {
if ($sex2 == "F") {
$factarray[$fact] = "Narodziny siostry ojca";
}
}
break;
case "MSIB":
if ($sex2 == "M") {
$factarray[$fact] = "Narodziny brata matki";
} else {
if ($sex2 == "F") {
$factarray[$fact] = "Narodziny siostry matki";
}
}
break;
case "NEPH":
$node = get_relationship($pid, $pid2);
if (isset($node["path"][1])) {
$sex3 = Person::getInstance($node["path"][1])->getSex();
if ($sex2 == "M") {
if ($sex3 == "M") {
$factarray[$fact] = "Narodziny bratanka";
} else {
if ($sex3 == "F") {
$factarray[$fact] = "Narodziny siostrzeńca";
}
}
} else {
if ($sex2 == "F") {
if ($sex3 == "M") {
$factarray[$fact] = "Narodziny bratanicy";
} else {
if ($sex3 == "F") {
$factarray[$fact] = "Narodziny siostrzenicy";
}
}
}
}
}
break;
}
} else {
if ($explode_fact[1] != "") {
switch ($explode_fact[2]) {
case "SIBL":
if ($sex2 == "M") {
$factarray[$fact] = $factarray[$explode_fact[1]] . " brata";
} else {
if ($sex2 == "F") {
//.........这里部分代码省略.........
开发者ID:bitweaver,项目名称:phpgedview,代码行数:101,代码来源:functions.pl.php
示例13: add
/**
* Create a relationship between two entities. E.g. friendship, group membership, site membership.
*
* This function lets you make the statement "$guid_one is a $relationship of $guid_two". In the statement,
* $guid_one is the subject of the relationship, $guid_two is the target, and $relationship is the type.
*
* @param int $guid_one GUID of the subject entity of the relationship
* @param string $relationship Type of the relationship
* @param int $guid_two GUID of the target entity of the relationship
*
* @return bool
* @throws InvalidArgumentException
*/
function add($guid_one, $relationship, $guid_two)
{
if (strlen($relationship) > \ElggRelationship::RELATIONSHIP_LIMIT) {
$msg = "relationship name cannot be longer than " . \ElggRelationship::RELATIONSHIP_LIMIT;
throw InvalidArgumentException($msg);
}
$guid_one = (int) $guid_one;
$relationship = sanitise_string($relationship);
$guid_two = (int) $guid_two;
$time = time();
// Check for duplicates
if (check_entity_relationship($guid_one, $relationship, $guid_two)) {
return false;
}
$id = _elgg_services()->db->insertData("INSERT INTO {$this->CONFIG->dbprefix}entity_relationships\n\t\t\t(guid_one, relationship, guid_two, time_created)\n\t\t\tVALUES ({$guid_one}, '{$relationship}', {$guid_two}, {$time})");
if ($id !== false) {
$obj = get_relationship($id);
$result = _elgg_services()->events->trigger('create', 'relationship', $obj);
if ($result) {
return true;
} else {
delete_relationship($result);
}
}
return false;
}
开发者ID:bhargavgarlapati,项目名称:Elgg,代码行数:39,代码来源:RelationshipsTable.php
示例14: get
/**
* Returns a node from it's uid
*
* @param string $uid UID of the resource
* @return mixed
*/
public function get($uid = '')
{
switch ($uid) {
case 'me':
$uid = "ue" . elgg_get_logged_in_user_guid();
break;
case 'site':
$uid = "se" . elgg_get_site_entity()->guid;
break;
}
if (substr($uid, 0, 2) == 'an') {
$id = (int) substr($uid, 2);
$node = elgg_get_annotation_from_id($id);
} else {
if (substr($uid, 0, 2) == 'md') {
$id = (int) substr($uid, 2);
$node = elgg_get_metadata_from_id($id);
} else {
if (substr($uid, 0, 2) == 'rl') {
$id = (int) substr($uid, 2);
$node = get_relationship($id);
} else {
if (substr($uid, 0, 2) == 'rv') {
$id = (int) substr($uid, 2);
$river = elgg_get_river(array('ids' => sanitize_int($id)));
$node = $river ? $river[0] : false;
} else {
if (in_array(substr($uid, 0, 2), array('ue', 'se', 'oe', 'ge'))) {
$id = (int) substr($uid, 2);
$node = get_entity($id);
} else {
if (is_numeric($uid)) {
$node = get_entity($uid);
} else {
$node = get_user_by_username($uid);
}
}
}
}
}
}
if (!$this->isExportable($node)) {
return false;
}
return $node;
}
开发者ID:hypejunction,项目名称:hypegraph,代码行数:52,代码来源:Graph.php
示例15: get_relationship
}
$Dbheight = $bheight;
$Dbxspacing = 0;
$Dbyspacing = 0;
$Dbasexoffset = 0;
$Dbaseyoffset = 0;
$person1 = WT_Individual::getInstance($pid1);
$person2 = WT_Individual::getInstance($pid2);
$controller->addExternalJavascript(WT_STATIC_URL . 'js/autocomplete.js')->addInlineJavascript('autocomplete();');
if ($person1 && $person1->canShowName() && $person2 && $person2->canShowName()) {
$controller->setPageTitle(WT_I18N::translate('Relationships between %1$s and %2$s', $person1->getFullName(), $person2->getFullName()))->PageHeader();
$node = get_relationship($person1, $person2, $followspouse, 0, $path_to_find);
// If no blood relationship exists, look for relationship via marriage
if ($path_to_find == 0 && $node == false && $followspouse == false) {
$followspouse = true;
$node = get_relationship($person1, $person2, $followspouse, 0, $path_to_find);
}
$disp = true;
} else {
$controller->setPageTitle(WT_I18N::translate('Relationships'))->PageHeader();
$node = false;
$disp = false;
}
?>
<div id="relationship-page">
<h2><?php
echo $controller->getPageTitle();
?>
</h2>
<form name="people" method="get" action="?">
<input type="hidden" name="ged" value="<?php
开发者ID:brambravo,项目名称:webtrees,代码行数:31,代码来源:relationship.php
注:本文中的get_relationship函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论