tailieunhanh - Thiết kế mạng xã hội với PHP - 16
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 as usera_name as userb_name FROM relationships r relationship_types t profile uap profile ubp WHERE AND AND AND approved if usera 0 Ssql . AND usera if userb 0 Ssql . AND 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 Srelationships new Relationships this- registry Spending relationships- getRelationships 0 this- registry- getObject authenticate - getUser - getUserID 0 Sthis- registry- getObject template - buildFromTemplates friends 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 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 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- .
đang nạp các trang xem trước