本文整理汇总了PHP中Messages::getUserMessages方法的典型用法代码示例。如果您正苦于以下问题:PHP Messages::getUserMessages方法的具体用法?PHP Messages::getUserMessages怎么用?PHP Messages::getUserMessages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Messages
的用法示例。
在下文中一共展示了Messages::getUserMessages方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: json_encode
<?php
require_once '../phpInclude/db_connection.php';
error_reporting(E_ALL);
require_once '../classes/AllClasses.php';
$user_id = $_REQUEST['user_id'];
$user_matches = array();
$user = new Users();
$message = new Messages();
if (!empty($user_id)) {
$messages = $message->getUserMessages($user_id);
$success = '1';
$msg = 'success';
} else {
$success = '0';
$msg = 'Incomplete Parameters';
}
echo json_encode(array('success' => $success, 'msg' => $msg, 'messages' => $messages));
示例2: MasterData
require_once INCLUDE_DIR . 'class.masterData.php';
$objMaster = new MasterData();
$schoolId = $_SESSION['schoolId'];
$teachers = $objMaster->getAllTeachersOfSchool($schoolId);
if ($_POST['act'] == "reply") {
$messageId = $_POST['messageId'];
$message = $objMsg->messagesDetail($messageId);
$message['message'] = strip_tags($message['message']);
}
$objTpl->assign('login_error', $login_error);
$objTpl->assign('message', $message);
$objTpl->assign('teachers', $teachers);
$objTpl->display('messages_compose.tpl');
exit;
}
if ($_POST['act'] == "send") {
$toId = $_POST['toId'];
$fromId = $_SESSION['userId'];
$title = $_POST['title'];
$message = $_POST['message'];
$rs = $objMsg->sendMessage($toId, $fromId, $title, $message);
if ($rs) {
$login_error = "Message send successfully.";
}
}
$messages = $objMsg->getUserMessages($user);
//$unread = $objUser->getUnreadMsgs();
$objTpl->assign('login_error', $login_error);
$objTpl->assign('unread', $unread);
$objTpl->assign('messages', $messages);
$objTpl->display('messages.tpl');
示例3: array
// +-----------------------------------+
// + STEP 2: get data +
// +-----------------------------------+
$token = $_REQUEST['access_token'];
$user2 = $_REQUEST['user2'];
if (!($token && $user2)) {
$success = "0";
$msg = "Incomplete Parameters";
$data = array();
} else {
// +-----------------------------------+
// + STEP 3: perform operations +
// +-----------------------------------+
$user_id = GeneralFunctions::getUserId($token);
if ($user_id) {
$data = Messages::getUserMessages($user_id, $user2);
if ($data) {
$success = "1";
$msg = "Records Found";
} else {
$success = '0';
$msg = "No Record Found";
}
} else {
$success = "0";
$msg = "Incorrect Parameters";
}
}
// +-----------------------------------+
// + STEP 4: send json data +
// +-----------------------------------+
示例4: array
$success = "0";
$msg = "Incomplete Parameters";
$data = array();
} else {
// +-----------------------------------+
// + STEP 3: perform operations +
// +-----------------------------------+
$user_id = GeneralFunctions::getUserId($token);
if ($user_id) {
//set messages received before the specified message_id as read
$updated = Messages::updateReadStatus($user_id, $other_id);
$geo_result = Users::getLatLong($user_id);
$lat = $geo_result[0]['lat'];
$lang = $geo_result[0]['lang'];
$profile = Users::getOtherProfile($user_id, $other_id, $lat, $lang) ? Users::getOtherProfile($user_id, $other_id, $lat, $lang) : [];
$data = Messages::getUserMessages($user_id, $other_id) ? Messages::getUserMessages($user_id, $other_id) : [];
$success = "1";
$msg = "Success";
} else {
$success = "0";
$msg = "Token Expired";
}
}
// +-----------------------------------+
// + STEP 4: send json data +
// +-----------------------------------+
if ($success == 1) {
echo json_encode(array("success" => $success, "msg" => $msg, "data" => $data, "profile" => $profile));
} else {
echo json_encode(array("success" => $success, "msg" => $msg));
}