Đang chuẩn bị liên kết để tải về tài liệu:
Thiết kế mạng xã hội với PHP - 16

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Tham khảo tài liệu 'thiết kế mạng xã hội với php - 16', công nghệ thông tin, đồ họa - thiết kế - flash phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Friends and Relationships type_plural_name uap.name as usera_name ubp.name as userb_name FROM relationships r relationship_types t profile uap profile ubp WHERE t.ID r.type AND uap.user_id r.usera AND ubp.user_id r.userb AND r.accepted approved if usera 0 Ssql . AND r.usera usera if userb 0 Ssql . AND r.userb userb cache Sthis- registry- getObject db - cacheQuery Ssql return cache New controller method The controller needs to check if the user is logged in include our relationships model get the pending requests and display them to the user in the view. private function pendingRelationships if Sthis- registry- getObject authenticate - isLoggedIn require_once FRAMEWORK_PATH . models relationships.php Srelationships new Relationships this- registry Spending relationships- getRelationships 0 this- registry- getObject authenticate - getUser - getUserID 0 Sthis- registry- getObject template - buildFromTemplates header.tpl.php friends pending.tpl.php footer.tpl.php Sthis- registry- getObject template - getPage - addTag pending array SQL Spending else Sthis- registry- errorPage Please login Please login to manage pending connections 132 Download from Wow eBook www.wowebook.com Chapter 4 The result Now if we navigate to http oursite relationships pending we see a list of pending requests Pending connections Michael Peacock wants to be Jogging buddies with you. Approve or Reject this re q u est. Accepting a pending request We simply check that we are logged in that we are permitted to accept the request then we call the accept method and save the relationship. This is within the relationship model. private function approveRelationship r if this- registry- getObject authenticate - isLoggedIn require_once FRAMEWORK_PATH . models relationship.php relationship new Relationship this- registry r 0 0 0 0 if relationship- getUserB this- registry- getObject authenticate - getUser - getUserID we can approve this relationship- approveRelationship relationship- save this- registry- .