本文整理匯總了PHP中Conversation::user_admin方法的典型用法代碼示例。如果您正苦於以下問題:PHP Conversation::user_admin方法的具體用法?PHP Conversation::user_admin怎麽用?PHP Conversation::user_admin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Conversation
的用法示例。
在下文中一共展示了Conversation::user_admin方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: die
$date_id = $data->date_id;
// $date_id = 13;
$user = User::get_current_user();
try {
if (is_numeric($date_id)) {
$mysqli = Database::connection();
$sql = "SELECT conversation_id, conversation_name, closed, date_started, date_recent_activity, header, date_id, joinable FROM `conversations` WHERE date_id ='$date_id'";
$result = $mysqli->query($sql)
or die ($mysqli->error);
if ($result->num_rows == 1) {
$conversation_id = mysqli_fetch_row($result)[0];
$conversation = new Conversation(array(
'conversation_id' => $conversation_id)
);
$conversation->get_messages();
$is_admin = $conversation->user_admin($user);
$conversation->current_user_admin = $is_admin;
http_response_code(200);
echo json_encode($conversation, JSON_PRETTY_PRINT);
}
else {
throw new OutOfRangeException('OutOfRangeException occured on request, conversation does not exist');
}
}
else {
throw new UnexpectedValueException('UnexpectedValueException occured on request');
}
}
catch (Exception $e) {
http_response_code(400);
Database::print_exception($e);