Chapter 8: Intranet Simple Document Publisher 273 list (Remote web server)

Chapter 8: Intranet Simple Document Publisher 273 list for the new category in the database table. A status message is shown using showStatusMessage() to inform the administrator about the successful creation of the category. Because the new category needs to be added to the navigation file used by home.php application, generateCategoryNavigator() is called to generate a new version of this file that includes the new category. If the new category is not added, showStatusMessage() informs the administrative user about the failure. . updateDoc(): This method updates a document. Here s how it works: If the method is called with empty category ID ($cid) but a new category name ($cat), it creates the new category using a category object and retrieves the new category s ID using the getCategoryIDByName() method of the new category object. It creates a new document object called $docObj. It checks to see if there is a category ID ($cid) and whether or not the required document parts (subject called $heading and contents called $body) are provided. If any of this required information is missing, the method shows an alert message and returns null. It extracts the month, day, and year of the document s publish date ($pub_date), which has been supplied from the Web form. The publishing date is verified to be a future date using the checkDate() function. If it is not a future date, an alert message is shown to inform the user that documents cannot have a past publication date, and the method returns null. The current hour, second, and minutes are stored in the $curHr, $curSec, $curMin variables using the date() function. A parameter list array called $params is constructed using all the database fields needed to create the document, which is passed to the modifyDoc() method to modify the document. If the modifyDoc() method of the document object returns TRUE status, the document is added, and a screen showing the success message is constructed using showStatusMessage(). To announce the document modification, a Message object is created. The addMessage() method of the Message class (from Chapter 7) is used to add the new document announcement message to appropriate viewers using the addViewer() of the Message object. If the document could not be added, a status message shows the failure notice.

Leave a Reply