本文整理匯總了PHP中Relation::acceptRequest方法的典型用法代碼示例。如果您正苦於以下問題:PHP Relation::acceptRequest方法的具體用法?PHP Relation::acceptRequest怎麽用?PHP Relation::acceptRequest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Relation
的用法示例。
在下文中一共展示了Relation::acceptRequest方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
$info = $Profile->fetchProfile($user_1);
$data = array('user_id' => $user_2, 'other_id' => $user_1, 'person_name' => $info['name'], 'person_lastname' => $info['surname'], 'type' => 1);
echo $Relation->requestFriend($user_1, $user_2);
echo $Relation->createNotification($data);
break;
case 'remove_request':
$user_1 = $_POST['user_1'];
$user_2 = $_POST['user_2'];
echo $Relation->removeRequest($user_1, $user_2);
break;
case 'accept_request':
$user_1 = $_POST['user_1'];
$user_2 = $_POST['user_2'];
$info_1 = $Profile->fetchProfile($user_1);
$info_2 = $Profile->fetchProfile($user_2);
echo $Relation->acceptRequest($user_1, $user_2, $info_2['name'], $info_2['surname']);
echo $Relation->acceptRequest($user_2, $user_1, $info_1['name'], $info_1['surname']);
break;
case 'unfriend_person':
$id = $_POST['user_1'];
$other_id = $_POST['user_2'];
echo $Relation->unfriendPerson($id, $other_id);
echo $Relation->unfriendPerson($other_id, $id);
break;
case 'search_by_user':
$term = $_POST['term'];
$results = $Profile->fetchProfileByName($term);
echo json_encode($results);
break;
case 'search_by_gym':
$term = $_POST['term'];
示例2: Profile
<?php
$Profile = new Profile($conn);
$Relation = new Relation($conn);
if (isset($_GET['accept'])) {
$id = $_SESSION['ifitness_id'];
$other_id = $_GET['accept'];
$not_id = $_GET['id'];
$your_profile = $Profile->fetchProfile($id);
$his_profile = $Profile->fetchProfile($other_id);
$Relation->acceptRequest($id, $other_id, $his_profile['name'], $his_profile['surname']);
$Relation->acceptRequest($other_id, $id, $your_profile['name'], $your_profile['surname']);
$remove = $Relation->removeNotification($not_id);
if ($remove) {
$feedback = array("type" => 'valid', "message" => 'Request Accepted');
}
} else {
if (isset($_GET['refuse'])) {
$id = $_GET['refuse'];
$Relation->removeNotification($id);
}
}
$friends = $Relation->fetchFriendList($_SESSION['ifitness_id']);