CS2623: Server-Side Programming (SSP) 03

Objectives:

Point Value:

Specifics:

  1. Chapters:
    1. 8: starting page 234
    2. 13:starting page 382
  2. Downloads:None
  3. References:
    1. SSP03 Date Sample (http://apollo.occc.edu/chyde/cs2623/assignments/ssp03_date_example.txt): Note, change the ".txt" file extension to ".php" if you want to run and test.
  4. Collaboration Assignment: On the forumn, explain which you like more. The switch or the if else/if statement. Do the same for the loops (i.e. which of the three loops do you like the most). For the loops which are testing their conditions pre and post. At the very least: which do you like, why, and what do you not like about the others. other.
  5. SSP03:
    1. Notes:
      1. Use the following code to get the current day:
        "$current_day = date('N');"
      2. For the purpose of this assignment, the numbers associated with the day of the week will be.
        Days of Week
        Num String
        1 Monday
        2 Tuesday
        3 Wednesday
        4 Thursday
        5 Friday
        6 Saturday
        7 Sunday
      3. The school apollo1 server, and likely yourr local server, have the timezone set to UCT which is +6 hours (USA Central Time zone). I do not want you losing time resetting this so just be aware of this setting when doing your assignment.
    2. Functions
      1. Folder: create a folder entitled functions in your root PHP directory.
      2. File: create a file called functions_ssp03.php in that folder.
      3. fn_tableOpen(): Create a function entitled fn_tableOpen(). This function will have one paramater for the tables caption. It will contain static code to open a table, apply your CSS formatting class(es), and create the header columns. Your header columns will be the same as what you did in SSP02 which were Day, Details, and Time. Note, when populating the day column with the functions below you will use the string (e.g. "Monday") instead of the number (e.g. "1").
      4. fn_tableClose(): Create a function entitled fn_tableClose(). THis function will not have any paramaters. It will contain static code for a table closing tag followed by two line breaks (e.g. <br>).
      5. fn_tableRowCurrent(): Create a function entitled fn_tableRowCurrent(). This function will have three paramaters for the three different columns. You will have the approrpriate code to display these paramaters in a new row.
        Also, it will have css coding to highlight the row. By that I mean change this rows background color to yellow (e.g. #FFFF66). Sorry in advance if that does not align with your pages color schema. I need something standard for grading purposes.
      6. fn_tableRow(): Create a function entitled fn_tableRow(). This will be the same as fn_tableRowCurrent() except you will NOT have the special highlighting.
      7. fn_dayOfWeek(): Create a function entitled fn_dayOfWeek(). This will have one parameter for the numerical day of the week. You will return the actual string day of the week. For example, if you get a 1 it will be "Monday", 2 it will be "Tuesday", etc. Reference the table above!
        I expect you to use an if staement with a else if for this.
      8. fn_dayDetails(): Create a function entitled fn_dayDetails(). Use a switch statement, create details about your CS2623 study goals for eadh day of the week. The function will take one parameter which is the numerical day of the week. For this assignment, you must dedicate at least four days to the course with a certain amount of study time for each day.
      9. fn_dayTime(): Create a function entitled fn_dayTime(). Using an if else/if statement, write code to give the amount of time you will study on CS2623 for days of the week. For two of your four days, the study time will be the same. The other two must be unique. For the ones with the same day, you must use an "OR" the logical operator.
    3. Loops:
      1. Folder: Create folder in your root directy entitled SSP03.
      2. File: Create a copy of your SSP02.php file and name it SSP03. Save it in the SSP03 folder.
      3. Navigation: Update your navigation to include the SSP03 page on your SSP03.php.
      4. Content: Remove the include dymanic content from your body. Where it was in your SSP03.php file you will be entering PHP information for the following loops.
      5. For Loop: Create a table with a for loop for each day of the week. Your table should start on Monday and go to Sunday. Your caption should be "CS2623: <YourName> Weekly Planner" where <YourName> will be your actual name. The tables content and syntax should be done with the functions (minus the loop syntax). If the rows day is the current day than use fn_tableRowCurrent() for the day rows. Otherwise, you would use fn_tableRow().
      6. While Loop: Create a table with a while loop for the weekdays only. A weekday is Monday to Friday. Your caption should be "CS2623: <YourName> Weekday Planner" where <YourName> will be your actual name. The tables content and syntax should be done with the functions (minus the loop syntax). If the rows day is the current day than use fn_tableRowCurrent() for the day rows. Otherwise, you would use fn_tableRow().
      7. Do-While Loop: Create a table with a do-while loop that starts from today and ends on Sunday. Your caption should be "CS2623: <YourName> To-Do Planner" where <YourName> will be your actual name.
        Note, this table will end up being dynamic in that the number of rows will differ from day to day. If it's Sunday you should still see a row for Sunday.
    4. Upload Code: Upload your files/folders to Apollo1 and test your code. Submit a link to your SSP03.php page via moodle. Make sure to look at your source code. The HTML code generated by your functions should have appropriate line breaks, indention, etc. Finally, your functions and code should have appropriate comments

Helpful Illustrations

Sample function

Sample function for SSP03 in php source code

Sample table Output: Browser View

Sample table for SSP03 in browser window

Sample table Output: Browser Source View

Sample code for SSP03: Browser source view for html table

Sample table Output: PHP File

Sample code for SSP03: PHP file source code

Common Requirements for All Web Pages:

  1. Your code must adhere to HTML5 standards. W3C HTML5 Example: https://www.w3schools.com/html/html5_intro.asp
  2. All your pages must pass W3C validators
  3. The web pages must display correctly in all of the following: FireFox, Chrome, Internet Explorer.
  4. The links between the existing pages with the Pacific Trails Resort website cannot be broken.
  5. All HTML and CSS code must be well documented, properly indented, and easy to read.
    http://css-tricks.com/examples/CleanCode/Beautiful-HTML.png
    http://coding.smashingmagazine.com/2008/05/02/improving-code-readability-with-css-styleguides/