DragonPrime - LoGD Resource Community
Welcome Guest
  • Good afternoon, Guest.
    Please log in, or register.
  • May 21, 2018, 12:01:49 PM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Resource Pages

Pages: [1]   Go Down
Author Topic: HTML Table Help  (Read 670 times)
0 Members and 1 Guest are viewing this topic.
Mod God
Offline Offline

Posts: 732

View Profile WWW
« on: June 01, 2017, 05:24:59 PM »

Evening Everyone, Smiley

I'm working on a module to display a time card. I have several problems in completing this module that are frankly driving me crazy.

1. I wish the date laid out as follows: (example) Tuesday, January 04, 2020, in a Sunday - Saturday format across the columns of the table. Currently I'm using

$date = date('l, F d, Y');

This correctly displays the current date, so each day shows as Thursday, June 01, 2017. I can't get the code to display correctly short of setting the whole thing in a calendar setting which I would very much like to avoid as I wish this particular table to be by week and not by month.

2. I wish to have an if statement per column after the first in each row. Example: Hours worked and Task completed are displayed if a time card has been filled out, otherwise the cell would be filled with a red background and the output of "Timecard Needed". I have the latter part of this set already, but I cannot get the if statement to actually work.

3. I wish to have the "Timecard Needed" cell clickable. I can make a hyperlink of just the words with no problem but the cell itself is proving to be very frustrating. I thought of making it a button, but cannot get that code to work correctly either.

4. Once the week is up, I'd like to store the data in a month and once the year is up in a year page by staffer. I haven't the foggiest idea how to do that short of calling everything by date.

Any help would be greatly appreciated, thanks!


Offline Offline

Posts: 271

View Profile
« Reply #1 on: June 02, 2017, 05:01:13 PM »

1. Calculate the date of the first day in your current week of the year. In your case the sunday and then create the table and use $date = date('l, F d, Y', $firstDayOfTheWeek + x days);. I think you have to provide your x days in seconds.

2. Assuming you have your hours needed and done in variables you can decide wether you wrap the whole table row in the if or just the table cell or even only apply a style to the table cell.
if($hoursWorked >= $hoursRequired)
    rawoutput("<tr><td>$dayStuff</td><td style='background-color: red;'>Timecard needed</td></tr>");

// or
    .doYourDamnWork {
        background: red;
    .doYourDamnWork:after {
        content: 'Timecard Needed';
// and in your table
rawoutput("<tr><td>$dayStuff</td><td class='" . ($hoursWorked < $hoursRequired?"doYourDamnWork":"") . "'></td></tr>");

3. When you have an anchor element in your table cell you could use something like this:
    .doYourDamnWork {
        background: red;
    .doYourDamnWork a {
        display: block;
        width: 100%;
        height: 100%;
    .doYourDamnWork a:after {
        content: 'Timecard Needed';

rawoutput("<tr><td>$dayStuff</td><td class='" . ($hoursWorked < $hoursRequired?"doYourDamnWork":"workDone") . "'><a href='#'></a></td></tr>");

4. A little more description on what you want to achieve would be nice. Do you just want to save some thing like "User X worked Y of Z hours this week/month/year", or do you wish to store every single day with required and worked hours?

I guarantee that the given code examples are 100% un-tested and may contain errors or unwished behavior, due I just scribbled it down here.  Wink

Have fun tinkering.
Pages: [1]   Go Up
Jump to:  

DragonPrime Notices
Play LoGD on Dragonprime

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
26 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search