tailieunhanh - Tạo mạng xã hội với PHP - part 24

Public and Private Messages /** * The registry object */ private $registry; /** * ID of the message */ private $id=0; /** * ID of the sender */ private $sender; /** * Name of the sender */ private $senderName; /** * ID of the recipient */ private $recipient; /** * Name of the recipient */ private $recipientName; /** * Subject of the message */ private $subject; /** * When the message was sent (TIMESTAMP) */ private $sent; /** * User readable, friendly format of the time the message was sent */ [ 212 ] Download from Chapter 7 private $sentFriendlyTime; /**. | Public and Private Messages The registry object private registry ID of the message private id 0 ID of the sender private sender Name of the sender private senderName ID of the recipient private recipient Name of the recipient private recipientName Subject of the message private subject When the message was sent TIMESTAMP private sent User readable friendly format of the time the message was sent ------------------------------ 212 ----------------------------------- Download from Chapter 7 private sentFriendlyTime Has the message been read private read 0 The message content itself private message The constructor takes the registry and ID of the message as parameters if the ID has been defined then it queries the database and sets the class variables. The database query here also formats a copy of the date into a friendlier format and looks up the names of the sender and recipient of the message Message constructor @param Registry registry the registry object @param int id the ID of the message return void public function __construct Registry registry id 0 this- registry registry this- id id if this- id 0 sql SELECT m. DATE_FORMAT D M Y as sent_friendly as sender_name as recipient_name FROM messages m profile psender profile precipient WHERE AND AND . this- id this- registry- getObject db - executeQuery sql if this- registry- getObject db - numRows 0 data this- registry- getObject db - getRows this- sender data sender this- recipient data recipient this- sent data sent this- read data read this- subject data subject this- message data message ----------------------------------- 213 ----------------------------------- Download from Public and Private Messages this- sentFriendlyTime data sent_friendly this- senderName data sender_name this- recipientName data recipient_name else this- id 0 Next we have setter methods for most of the class .

TỪ KHÓA LIÊN QUAN
crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.