tailieunhanh - Tạo mạng xã hội với PHP - part 31
Events and Birthdays Next, we have our save method, which depending on whether an ID is set or not, either inserts a new record into the database or updates an existing one. If we are inserting a new record, it also iterates through the invitees, and adds them to the attendees table as an invitee. This would be where we may wish to add an e-mail notification to the user to inform them that they have been invited to the event: /** * Save the event * @return bool */ public function save() { // handle the updating of a profile if(. | Events and Birthdays Next we have our save method which depending on whether an ID is set or not either inserts a new record into the database or updates an existing one. If we are inserting a new record it also iterates through the invitees and adds them to the attendees table as an invitee. This would be where we may wish to add an e-mail notification to the user to inform them that they have been invited to the event Save the event return bool public function save handle the updating of a profile if this- registry- getObject authenticate - isLoggedIn this- registry- getObject authenticate - getUser - getUserID this- creator this- registry- getObject authenticate - getUser - isAdmin true this- ID 0 we are either the user created the event or we are the administrator or the event is being created event array foreach this as field data if is_array data is_object data field ID event field this- field if this- ID 0 this- registry- getObject db - insertRecords events event this- ID this- registry- getObject db - lastInsertID if is_array this- invitees count this- invitees 0 foreach this- invitees as invitee insert array insert event_id this- ID insert user_id invitee ----------------------------------- 282 ----------------------------------- Download from Chapter 9 insert status invited this- registry- getObject db - insertRecords event_attendees insert insert array insert event_id this- ID insert user_id this- creator insert status going this- registry- getObject db - insertRecords event_ attendees insert return true else this- registry- getObject db - updateRecords events event ID . this- ID if this- registry- getObject db - affectedRows 1 return true else return false else return false Next we have the standard toTags method which takes a prefix and converts all of the data that isn t an object or an array to template tags Convert the event data to template tags @param String prefix prefix for the template tags return volD public function toTags .
đang nạp các trang xem trước