Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Groups $this-listPublicGroups( 0 ); } } else { if( isset( $urlBits[1] ) ) { $this-listPublicGroups( intval( $urlBits[1] ) ); } else { $this-listPublicGroups( 0 ); } } } /** * Create a new group * @return void */ private function createGroup() { if( isset( $_POST ) && is_array( $_POST ) && count( $_POST ) 0 ) { require_once( FRAMEWORK_PATH . 'models/group.php'); $group = new Group( $this-registry, 0 ); $group-setCreator( $this-registry-getObject('authenticate')getUser()-getUserID() ); $group-setName( $this-registry-getObject('db')sanitizeData( $_POST['name'] ) ); $group-setDescription( $this-registry-getObject('db')sanitizeData( $_POST['description'] ) ); $group-setType( $_POST['type'] ); $group-save(); $this-registry-errorPage('Group created', 'Thank you, your new group has been created'); } else { $this-registry-getObject('template')-buildFromTemplates(. | Groups this- listPublicGroups 0 else if isset urlBits 1 this- listPublicGroups intval urlBits 1 else this- listPublicGroups 0 Create a new group return void private function createGroup if isset _POST is_array _POST count _POST 0 require_once FRAMEWORK_PATH . models group.php group new Group this- registry 0 group- setCreator this- registry- getObject authenticate - getUser - getUserID group- setName this- registry- getObject db - sanitizeData _POST name group- setDescription this- registry- getObject db - sanitizeData _POST description group- setType _POST type group- save this- registry- errorPage Group created Thank you your new group has been created else this- registry- getObject template - buildFromTemplates header.tpl.php groups create.tpl.php footer.tpl.php 322 Download from www.eBookTM.com Chapter 10 View The template for creating a group views default templates groups create. tpl.php is simply a form with a text box for name and description and a drop-down list of types. div id main div id rightside div div id content h1 Create a new group h1 form action groups create method post label for name Name label br input type text id name name name value br label for description Description label br textarea id description name description textarea br label for type Type label br select id type name type option value public Public Group option option value private Private Group option option value private-member-invite Private Invite Only Group option option value private-self-invite Private Self-Invite Group option select br input type submit id create name create value Create group form div div 323 Download from www.eBookTM.com Groups Creating a group in action If we navigate to groups create we see the create group form and are able to successfully create a new group. Viewing a group For us to view a group and also participate in a group we will need A controller for the group A way of maintaining membership lists for groups including A database table A model