Login   Register  
PHP Classes
elePHPant
Icontem

Creating an Appointment Calendar - Part 05 - Appointment Calendar package blog

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  All package blogs All package blogs   Appointment Calendar Appointment Calendar   Blog Appointment Calendar package blog   RSS 1.0 feed RSS 2.0 feed   Blog Creating an Appointme...  
  Post a comment Post a comment   See comments See comments (1)   Trackbacks (0)  
<< Previous: Creating an Appointme...>> Next: Creating an Appointme...

Author: Michael J. Fuhrman

Posted on:

Package: Appointment Calendar

This post will focus on building the pages that will be served to the user. Those pages being: List, View, New, Edit, Move and Delete




11. Implementing the Appointment Interface, cont...:
===============================

Welcome back to the fifth part of "Creating an Appointment Calendar". The previous post focused on designing components used to build the appointment presentation. This post will focus on building the pages that will be served to the user. Those pages being: List, View, New, Edit, Move and Delete

Note: at this point in the series, the code described in this blog has been removed. It can be retrieved from PHPClasses as the Appointment Calendar Class.

----------

b) The User Presentation: List, View, New, Edit, Move and Delete

The presentation pages follow a common format.
1) include PHP classes and libraries.
2) retrieve page parameters
3) validate the page parameters
4) retrieve class ID’s
5) retrieve the main folder of interest
6) create instances of panels needed to draw the page
7) initialize the panels
8) include JavaScript and CSS libraries
9) draw the page

Note that Ladder the _app.inc file specifically calls php_Main to insure that database connections and sessions are specifically opened and closed.

[ --- List.php --- ]

Line 8 .. abstracts the directory path so that the page can be moved anywhere in the directory tree, and minimal adjustments are needed.

Line 10 – 18 .. loads shared files and classes
Line 20 – 107 .. draws the page
Line 22 – 24 .. retrieves the ID of the Folder that contains the Appointments.
Line 26 – 28 .. retrieves the date the list should viewed.
Line 33 .. validates that a folder ID was passed in.
Line 38 .. retrieves the Appointment Class, used on line 77.

Line 43 .. retrieves the folder of interest from Ladder. For now no validation is done to confirm that a folder has been retrieved, that the ID is in fact correct, or that Ladder did not generate other errors.

Line 48 .. creates an instance of the Appointments Folder which extends Ladder’s folder structure.
Line 49 .. initializes the Appointments instance with the folder instance.

Line 54 .. creates an instance of a List Panel
Line 55 .. creates an instance of an Appointment Panel

Line 57 .. creates an instance of Start Time Panel
Line 58 .. creates an instance of an Appointment Length Panel

Line 60 .. creates an instance of the Calendar Panel

Line 65 .. sets the name of the Calendar Panel
Line 66 .. requests the panel to get its session data. This basically initializes the date of the panel to the last date the panel was given, if the session data was saved previously.

Line 67 .. determines if a date was passed in. If so, it sets the Calendar Panel’s date to that passed in.

Line 68 .. saves the Calendars date to a session for later retrieval.

Line 70 .. sets the Appointments Folder to search for appointments using the specified date.

Line 72 .. sets the name of the List Panel
Line 73 .. tells the List Panel that only 10 items per page should be listed
Line 74 .. tells the List Panel that it’s on Page 1
Line 75 .. tells the List Panel which Panel will be used to draw the rows it’s creates.
Line 76 .. tells the List Panel to use the Appointments Folder Instance
Line 77 .. tells the List Panel which classes to use when filtering the results.

Line 79 .. tells the Appointment Panel which Start Time Panel to use.
Line 80 .. tells the Appointment Panel which Length Panel to use.

Lines 82 - 87 .. import CSS style scripts, JavaScript libraries, and initialize variables in JavaScript.

Line 88 .. requests that the Calendar Panel draw itself

Lines 89 – 97 .. draw the page navigation. This could have been abstracted, into a separate library.

Line 98 - 100 .. creates a form to encapsulate the List Panel.
Line 99 .. requests that the List panel draw itself

Lines 102 – 105 .. insures that the widths of various Panels are the same by using JQuery Lite to traverse the DOM (Document Object Model). Note that the names of the panels were set earlier on Lines 65, 72, 90, and 98.

[ --- View.php --- ]

Line 8 .. abstracts the directory path so that the page can be moved anywhere in the directory tree, and minimal adjustments are needed.

Line 10 – 17 .. loads shared files and classes

Line 19 – 107 .. draws the page
Line 21 – 23 .. retrieves the ID of the Folder that contains the Appointments.
Line 25 – 27 .. retrieves the date the list should viewed.

Line 32 .. validates that a folder ID was passed in.
Line 33 .. validates that a position was passed in.

Line 38 .. retrieves the Appointment Class.

Line 43 .. retrieves the folder of interest from Ladder. For now no validation is done to confirm that a folder has been retrieved, that the ID is in fact correct, or that Ladder did not generate other errors.

Line 48 .. creates an instance of the Appointments Folder which extends Ladder’s folder structure.
Line 49 .. initializes the Appointments instance with the folder instance.

Line 54 .. creates an instance of an Appointment Panel
Line 56 .. creates an instance of Start Time Panel
Line 57 .. creates an instance of an Appointment Length Panel
Line 59 .. creates an instance of the Calendar Panel

Line 64 .. sets the name of the Calendar Panel
Line 65 .. requests the panel to get its session data. This basically initializes the date of the panel to the last date the panel was given, if the session data was saved previously.

Line 66 .. sets the Appointment Folder’s Date to the Calendar Panel’s date.

Line 68 .. retrieves the Appointment from the Appointments Folder based on the Position of the item in the folder.

Line 73 .. sets the name of the Appointment Panel
Line 74 .. tells the Appointment Panel which Start Time Panel to use.
Line 75 .. tells the Appointment Panel which Length Panel to use.
Line 76 .. sets the Appointment Panel to the Appointment Item retrieved on Line 68

Lines 78 - 86 .. import CSS style scripts, JavaScript libraries, and initialize variables in JavaScript.

Line 87 .. requests that the Calendar Panel draw itself

Lines 89 – 96 .. draw the page navigation. This could have been abstracted, into a separate library.

Line 97 - 100 .. creates a table to encapsulate the Appointment Panel.
Line 99 .. requests that the Appointment panel draw itself

Lines 102 – 105 .. insures that the widths of various Panels are the same by using JQuery Lite to traverse the DOM (Document Object Model). Note that the names of the panels were set earlier on Lines 64, 73, 89, and 97.

[ --- New.php --- ]

Line 8 .. abstracts the directory path so that the page can be moved anywhere in the directory tree, and minimal adjustments are needed.

Line 10 – 17 .. loads shared files and classes

Line 19 – 91 .. draws the page
Line 21 – 23 .. retrieves the ID of the Folder that contains the Appointments.

Line 28 .. validates that a folder ID was passed in.

Line 33 .. retrieves the Appointment Class.

Line 38 .. retrieves the folder of interest from Ladder. For now no validation is done to confirm that a folder has been retrieved, that the ID is in fact correct, or that Ladder did not generate other errors.

Line 43 .. creates an instance of an Appointment Panel
Line 45 .. creates an instance of Start Time Panel
Line 46 .. creates an instance of an Appointment Length Panel
Line 48 .. creates an instance of the Calendar Panel

Line 53 .. sets the name of the Calendar Panel
Line 54 .. requests the panel to get its session data. This basically initializes the date of the panel to the last date the panel was given, if the session data was saved previously.

Line 56 .. sets the name of the Appointment Panel
Line 57 .. tells the Appointment Panel which Start Time Panel to use.
Line 58 .. tells the Appointment Panel which Length Panel to use.

Lines 61 - 67 .. import CSS style scripts, JavaScript libraries, and initialize variables in JavaScript.

Line 68 .. requests that the Calendar Panel draw itself

Lines 70 – 77 .. draw the page navigation. This could have been abstracted, into a separate library.

Line 78 -84 .. creates a FORM to encapsulate the Appointment Panel.
Line 81 .. requests that the Appointment panel draw itself

Lines 86 – 89 .. insures that the widths of various Panels are the same by using JQuery Lite to traverse the DOM (Document Object Model). Note that the names of the panels were set earlier on Lines 53, 56, 70 and 78.

[ --- Add.php --- ]

Line 8 .. abstracts the directory path so that the page can be moved anywhere in the directory tree, and minimal adjustments are needed.

Line 10 – 11 .. loads shared files and classes

Line 13 – 80 .. executes the logic needed to add an appointment to the folder.

Line 15 – 17 .. retrieves the ID of the Folder that contains the Appointments.

Line 22 .. validates that a folder ID was passed in.

Line 27 .. retrieves the Appointment Class.

Line 37 .. creates an appointment Item. It is later initialized with data on Line 60.

Line 42 .. creates an instance of an Appointment Panel
Line 44 .. creates an instance of Start Time Panel
Line 45 .. creates an instance of an Appointment Length Panel
Line 47 .. creates an instance of the Calendar Panel

Line 52 .. sets the name of the Calendar Panel
Line 53 .. requests the panel to get its session data. This basically initializes the date of the panel to the last date the panel was given, if the session data was saved previously.

Line 55 .. sets the name of the Appointment Panel
Line 56 .. tells the Appointment Panel which Start Time Panel to use.
Line 57 .. tells the Appointment Panel which Length Panel to use.
Line 58 .. retrieves the data from POST variables.

Line 60 .. retrieves the data the Appointment Panel and transfers it Appointment Item.
Line 61 .. sets the date of the Appointment Item
Line 62 .. stores the Appointment Item

Line 64 .. redirects the server to display the list.

[ --- Edit.php --- ]

Line 8 .. abstracts the directory path so that the page can be moved anywhere in the directory tree, and minimal adjustments are needed.

Line 10 – 17 .. loads shared files and classes

Line 19 – 110 .. draws the page
Line 21 – 23 .. retrieves the ID of the Folder that contains the Appointments.
Line 25 – 27 .. retrieves the date the list should viewed.

Line 32 .. validates that a folder ID was passed in.
Line 33 .. validates that a position was passed in.

Line 38 .. retrieves the Appointment Class, Later used on 63.

Line 43 .. retrieves the folder of interest from Ladder. For now no validation is done to confirm that a folder has been retrieved, that the ID is in fact correct, or that Ladder did not generate other errors.

Line 48 .. creates an instance of the Appointments Folder which extends Ladder’s folder structure.
Line 49 .. initializes the Appointments instance with the folder instance.

Line 54 .. creates an instance of an Appointment Panel
Line 56 .. creates an instance of Start Time Panel
Line 57 .. creates an instance of an Appointment Length Panel
Line 59 .. creates an instance of the Calendar Panel

Line 64 .. sets the name of the Calendar Panel
Line 65 .. requests the panel to get its session data. This basically initializes the date of the panel to the last date the panel was given, if the session data was saved previously.

Line 66 .. sets the Appointment Folder’s Date to the Calendar Panel’s date.

Line 68 .. retrieves the Appointment from the Appointments Folder based on the Position of the item in the folder.

Line 73 .. sets the name of the Appointment Panel
Line 74 .. tells the Appointment Panel which Start Time Panel to use.
Line 75 .. tells the Appointment Panel which Length Panel to use.
Line 76 .. sets the Appointment Panel to the Appointment Item retrieved on Line 68

Lines 78 - 86 .. import CSS style scripts, JavaScript libraries, and initialize variables in JavaScript.

Line 87 .. requests that the Calendar Panel draw itself

Lines 89 – 95 .. draw the page navigation. This could have been abstracted, into a separate library.

Line 97 - 103 .. creates a FORM to encapsulate the Appointment Panel.
Line 100 .. requests that the Appointment panel draw itself

Lines 105 – 107 .. insures that the widths of various Panels are the same by using JQuery Lite to traverse the DOM (Document Object Model). Note that the names of the panels were set earlier on Lines 64, 73, 89, and 97.

[ --- Update.php --- ]

Line 8 .. abstracts the directory path so that the page can be moved anywhere in the directory tree, and minimal adjustments are needed.

Lines 10 – 17 .. loads shared files and classes

Lines 15 – 17 .. retrieves the ID of the Folder that contains the Appointments.

Lines 19 – 86 .. executes the logic needed to update an appointment to the folder.

Lines 25 – 27 .. retrieves the position of the Appointment Item.

Line 32 .. validates that a folder ID was passed in.
Line 33 .. validates that a Position was passed in.

Line 38 .. retrieves the Appointment Class.

Line 43 .. retrieves the folder of interest from Ladder. For now no validation is done to confirm that a folder has been retrieved, that the ID is in fact correct, or that Ladder did not generate other errors.

Line 48 .. creates an instance of the Appointments Folder which extends Ladder’s folder structure.
Line 49 .. initializes the Appointments instance with the folder instance.

Line 54 .. creates an instance of an Appointment Panel
Line 56 .. creates an instance of Start Time Panel
Line 57 .. creates an instance of an Appointment Length Panel
Line 59 .. creates an instance of the Calendar Panel

Line 64 .. sets the name of the Calendar Panel
Line 65 .. requests the panel to get its session data. This basically initializes the date of the panel to the last date the panel was given, if the session data was saved previously.
Line 66 .. sets the Appointment Folder date filter to the date set in the Calendar Panel.

Line 73 .. sets the name of the Appointment Panel
Line 74 .. tells the Appointment Panel which Start Time Panel to use.
Line 75 .. tells the Appointment Panel which Length Panel to use.
Line 76 .. retrieves the data from POST variables.

Line 78 .. retrieves the data the Appointment Panel and transfers it Appointment Item.

Line 79 .. sets the date of the Appointment Item
Line 80 .. stores the Appointment Item

Line 82 .. redirects the server to display the list.

[ --- Move.php --- ]

Line 8 .. abstracts the directory path so that the page can be moved anywhere in the directory tree, and minimal adjustments are needed.

Lines 10 – 17 .. loads shared files and classes

Lines 15 – 17 .. retrieves the ID of the Folder that contains the Appointments.

Lines 19 – 86 .. executes the logic needed to update an appointment to the folder.

Lines 25 – 27 .. retrieves the position of the Appointment Item.
Lines 29 – 31 .. retrieves the target date of the Appointment Item.

Line 36 .. validates that a folder ID was passed in.
Line 37 .. validates that a Position was passed in.
Line 38 .. validates that a Date was passed in.

Line 43 .. retrieves the Appointment Class.

Line 48 .. retrieves the folder of interest from Ladder. For now no validation is done to confirm that a folder has been retrieved, that the ID is in fact correct, or that Ladder did not generate other errors.

Line 53 .. creates an instance of the Appointments Folder which extends Ladder’s folder structure.
Line 54 .. initializes the Appointments instance with the folder instance.

Line 64 .. creates an instance of the Calendar Panel
Line 65 .. sets the name of the Calendar Panel
Line 66 .. sets the Appointment Folder date filter to the date set in the Calendar Panel.

Line 68 .. retrieves the data the Appointment Panel and transfers it Appointment Item.

Line 73 .. sets the date of the Appointment Item
Line 74 .. stores the Appointment Item

Line 76 .. redirects the server to display the list.

[ --- Delete.php --- ]

Line 8 .. abstracts the directory path so that the page can be moved anywhere in the directory tree, and minimal adjustments are needed.

Lines 10 – 17 .. loads shared files and classes

Lines 15 – 17 .. retrieves the ID of the Folder that contains the Appointments.

Lines 19 – 86 .. executes the logic needed to update an appointment to the folder.

Lines 25 – 27 .. retrieves the position of the Appointment Item.

Line 32 .. validates that a folder ID was passed in.
Line 33 .. validates that a Position was passed in.

Line 38 .. retrieves the Appointment Class.

Line 43 .. retrieves the folder of interest from Ladder. For now no validation is done to confirm that a folder has been retrieved, that the ID is in fact correct, or that Ladder did not generate other errors.

Line 48 .. creates an instance of the Appointments Folder which extends Ladder’s folder structure.
Line 49 .. initializes the Appointments instance with the folder instance.

Line 54 .. creates an instance of the Calendar Panel
Line 59 .. sets the name of the Calendar Panel
Line 60 .. retrieves the current appointment from the session.
Line 61 .. sets the Appointment Folder date filter to the date set in the Calendar Panel.

Line 63 .. retrieves the data the Appointment Panel and transfers it Appointment Item.

Line 75 .. deletes the Appointment Item

Line 76 .. redirects the server to display the list.

======================================
Next Post
======================================

The next post will describe how to extend the ldrFolder and ldrItem classes so that PHP classes for Common_Appointment and Common_Appointments can be created.


/* =======================================
Copyright 1998 - 2010 - E Net Arch
This program is distributed under the terms of the GNU
General Public License (or the Lesser GPL).
======================================= */

You need to be a registered user or login to post a comment

1,282,297 PHP developers registered to the PHP Classes site.
Be One of Us!

Login Immediately with your account on:

Facebook ConnectGmail or other Google Account
Hotmail or Microsoft Windows LiveStackOverflow
GitHubYahoo


Comments:

1. Where is the file "List.php" - David (2010-05-07 17:50)
Where is the file "List.php"... - 0 replies
Read the whole comment and replies


<< Previous: Creating an Appointme...>> Next: Creating an Appointme...


  Post a comment Post a comment   See comments See comments (1)   Trackbacks (0)  
  All package blogs All package blogs   Appointment Calendar Appointment Calendar   Blog Appointment Calendar package blog   RSS 1.0 feed RSS 2.0 feed   Blog Creating an Appointme...