View Single Post
  #9 (permalink)  
Old 04-21-09, 04:17 AM
Nikas Nikas is offline
Coding Addict
 
Join Date: Jun 2005
Location: Singapore
Posts: 377
Thanks: 0
Thanked 1 Time in 1 Post
I like need to get the opposite dates. Currently, those date are unavailable dates. I need to get the available dates.

This is what I wrote, it works but there's a part I don't know how to get the value of the user.

PHP Code:

// Function to give a list of personnel who are able to serve the duty for the particular month
// Some might not be able to make it due to medical reason, off, leave, roving and/or other reason.
function availableList(&$DB$unavailableDate$month) {
    
// Determine the number of days in the particular month and year
    
$year getdate();
    
$num cal_days_in_month(CAL_GREGORIAN$month$year['year']);

    
$temp_availableDate = array();
    for (
$i=1$i<=$num$i++) {
        if (!
in_array($year['year'].'-'.$month.'-'.$i$unavailableDate)) {
            
$temp_availableDate[] = $year['year'].'-'.$month.'-'.$i;
        }
    }
    return 
$temp_availableDate;
}

// This I type it out myself. If I wanted to use the name from the previous array? // How do I call it? It's $personnelDates[$arr[$i]['personnel_name']] but that's 
// the date.
availableList($DB$personnelDates['Tan Ah Lian'], '04'); 
PS: After some thought, would it be better not to do this function? When I'm doing the script, I will just add in the codes for it.

Last edited by Nikas; 04-21-09 at 04:34 AM.
Reply With Quote