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

Groups If the group is active, the next stage is to check that the currently logged in user is either the creator of the group, or is a member of the group. require_once( FRAMEWORK_PATH . 'models/'); $gm = new Groupmembership( $this-registry ); $user = $this-registry-getObject('authenticate')getUser()-getUserID(); $gm-getByUserAndGroup( $user, $this-groupID ); if( $this-group-getCreator() == $user || $gmgetApproved() ) { If the currently logged in user is a member of the group, or its creator, then the controller looks up the full details of the user's request, and passes control to the appropriate method. if( isset( $urlBits[2] ) ) { switch( $urlBits[2] ) { case 'create-topic': $this-createTopic();. | Groups If the group is active the next stage is to check that the currently logged in user is either the creator of the group or is a member of the group. require_once FRAMEWORK_PATH . models gm new Groupmembership this- registry user this- registry- getObject authenticate - getUser - getUserID gm- getByUserAndGroup user this- groupID if this- group- getCreator user gm- getApproved If the currently logged in user is a member of the group or its creator then the controller looks up the full details of the user s request and passes control to the appropriate method. if isset urlBits 2 switch urlBits 2 case create-topic this- createTopic break case view-topic this- viewTopic intval urlBits 3 break case reply-to-topic this- replyToTopic intval urlBits 3 break case membership this- manageMembership intval urlBits 3 break default this- viewGroup break else this- viewGroup else ------------------------------------ 332 -------------------------------- Download from Chapter 10 If the user isn t a member of the group control is passed to a secondary controller we will create it shortly which if appropriate will provide a mechanism for the user to join the group. require_once FRAMEWORK_PATH . controllers group membership new Membershipcontroller this- registry this- groupID membership- join else this- registry- errorPage Group not found Sorry the group you requested was not found else this- registry- errorPage Group not found Sorry the group you requested was not found else this- registry- errorPage Please login Sorry you must be logged in to view groups If the user s request was to view a group then the group model data is sent to the template engine the template is built and the cache of topics from the group is generated and also sent to the template engine. private function viewGroup this- group- toTags group_ this- registry- getObject template - buildFromTemplates groups cache .

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
10    72    2    19-05-2024
41    116    18    19-05-2024
Đã 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.