#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2011
    Posts
    47
    Rep Power
    4

    Calendar read ( < prev year) Nov 2012 ( next year >) Wont Move


    My calendar will not go back or forward. Code below, what Ďam I missing?

    <tr>
    <td><font size=2 color="#FFFFFF"><b><?php echo "$month_full $year" ; ?></b></font>
    </td>
    <td align="right">
    <? echo "<a href='index.php?Sec=home&req_month=$prev_month&year=$prev_year'><img src=../images/pmonth.gif border=0></a>&nbsp;&nbsp;"; ?>
    <? echo "<a href='index.php?Sec=home&req_month=$next_month&year=$next_year'><img src=../images/nmonth.gif border=0></a>&nbsp;&nbsp;"; ?>
    </td>
    </tr>
    </table>


    Thanks in advance,
    Scotty
  2. #2
  3. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6351
    what Ďam I missing?
    Ummm....the other 900 lines of code?
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2011
    Posts
    47
    Rep Power
    4
    <?php
    include "header.inc.php";

    if(!$year) $year = date('Y');
    if(!$req_month || $req_month=="none") {
    $req_month = date('n',time() + $config['timeZoneOffset']);
    }

    $dt_and_tm = mktime(0,0,0,$req_month,1,$year);

    // what are the months and year immediately ahead and behind the current one?
    $prev_result = getPrevMonth($req_month, $year);
    $prev_month = substr($prev_result, 0, 2);
    $prev_year = substr($prev_result, 2);

    $next_result = getNextMonth($req_month, $year);
    $next_month = substr($next_result, 0, 2);
    $next_year = substr($next_result, 2);


    # ***********************************************************************************
    # *** Find out the month number from the time stamp we just created *************
    # *** Find out the day of the week from the same(0 to 6 for Sunday to *************
    # *** Saturday) add "1" so that it becomes 1 to 7 *************
    # *************************************************************************************

    $month=date("n",$dt_and_tm);
    $week_day=date("w",$dt_and_tm)+1;


    # ************************************************************************************
    # *** Set number days in requested month *************
    # ************************************************************************************
    if($month==1 || $month==3 || $month==5 || $month==7 || $month==8 || $month==10 || $month==12) {
    $no_of_days=31;
    }elseif($month==4 || $month==6 || $month==9 || $month==11) {
    $no_of_days=30;
    }elseif($month==2) {
    # **************************************************************************************
    # *** If the month requested is Feb. Check whether it is Leap Year **************
    # **************************************************************************************

    if(date("L",$dt_and_tm))
    { $no_of_days=29 ;}
    else
    {$no_of_days=28;}
    }
    $month_full=date("F",$dt_and_tm);

    // Is there a match in the calendar for today?

    $today_year = date('Y');
    $today_month = date('n',time() + $config['timeZoneOffset']);
    if ($today_year==$year && $today_month==$month) {
    $today_day = date("j",time() + $config['timeZoneOffset']);
    $today_match = "true";

    }else{
    $today_match = "false";
    }

    plannerMenu();
    echo '<div style="font-size: 22px; font-weight: normal; font-family: Arial;">Vacation Calendar</div><br />';

    //tableOpen();
    ?>

    <table width="730" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td style="border: 1px solid #ccc;">
    <table width="100%" border="0" cellpadding="2" cellspacing="0">
    <tr>
    <td>
    <table width="100%" align="center">
    <tr bgcolor="#003366"><td colspan=7>
    <table border=0 width="100%">
    <tr>
    <td><font size=3 color="#ffffff"><b><?php echo "$month_full $year" ; ?></b></font>
    </td>
    <td align="right">
    <? echo "<a href='schedule.php?Sec=schedule&req_month=$prev_month&year=$prev_year'><img src=../images/pmonth.gif border=0></a>&nbsp;&nbsp;"; ?>
    <? echo "<a href='schedule.php?Sec=schedule&req_month=$next_month&year=$next_year'><img src=../images/nmonth.gif border=0></a>&nbsp;&nbsp;"; ?>
    </td>
    </tr>
    </table>
    </td></tr>
    <tr bgcolor="#6699FF">
    <td width="75" class="CalTitle" style="border-color='black'"><div align="center">Sunday</div></td>
    <td width="75" class="CalTitle" style="border-color='black'"><div align="center">Monday</div></td>
    <td width="75" class="CalTitle" style="border-color='black'"><div align="center">Tuesday</div></td>
    <td width="75" class="CalTitle" style="border-color='black'"><div align="center">Wednesday</div></td>
    <td width="75" class="CalTitle" style="border-color='black'"><div align="center">Thursday</div></td>
    <td width="75" class="CalTitle" style="border-color='black'"><div align="center">Friday</div></td>
    <td width="75" class="CalTitle" style="border-color='black'"><div align="center">Saturday</div></td>
    </tr>
    <tr>
    <?php
    # **************************************************************************************
    # *** We need to start form week day and print total number of days *****************
    # *** in this month.For that we need to find out the last cell. *****************
    # *** While looping end current row and start new row for each 7 cells *****************
    # **************************************************************************************
    $last_cell=$week_day+$no_of_days;
    for($i=1;$i<=42;$i++)
    {

    if($day == "") {
    $day = "1";
    }

    $Date = $year . "-" . $month . "-" . $day;

    $QueryTasks = do_query("SELECT * FROM ".$config['tableTasks']." WHERE due_date='".$Date."' && completed=0",__LINE__,__FILE__);
    $Tasks_count = mysql_num_rows($QueryTasks);

    $QueryApp = do_query("SELECT * FROM ".$config['tableVacation']." WHERE date='".$Date."'",__LINE__,__FILE__);
    $QueryNotes = do_query("SELECT * FROM ".$config['tableScheduledNotes']." WHERE date='".$Date."'",__LINE__,__FILE__);

    if ($Tasks_count != 0) {
    while ($TasksArray = mysql_fetch_object($QueryTasks)) {
    $Pop_title = "<strong>Tasks: </strong>" . addslashes($TasksArray->title) . "<br>" . addslashes($TasksArray->tasks);
    $Pop_title = ereg_replace("\r\n","",$Pop_title);
    $TasksOne = substr($TasksArray->title, 0, 9);
    $Tasks .= "<a href=\"tasks.php?Sec=tasks&View=$TasksArray->T_ID\" onmouseover=\"return overlib('$Pop_title');\" onmouseout=\"return nd();\" style='font-size: 9px;'>" . $TasksOne . " ...</a><br>";
    }
    }

    while ($AppArray = mysql_fetch_object($QueryApp)) {
    $Pop_app = "<strong>Vacation: </strong>" . addslashes($AppArray->notes);
    $Pop_app = ereg_replace("\r\n","",$Pop_app);
    $AppOne = substr($AppArray->type, 0, 9);
    $App .= "<a href='edit_vacation.php?Sec=schedule&id=".$AppArray->A_ID."' onmouseover=\"return overlib('$Pop_app');\" onmouseout=\"return nd();\" style=\"color: #FF0000; font-size: 9px;\">" . $AppOne . "</a><br>";
    }

    while ($NotesArray = mysql_fetch_object($QueryNotes)) {
    $Pop_note = "<strong>Note: </strong>" . addslashes($NotesArray->note);
    $Pop_note = ereg_replace("\r\n","",$Pop_note);
    $NoteOne = substr($NotesArray->note, 0, 9);
    $Note .= "<a href='edit_scheduled_note.php?Sec=schedule&id=".$NotesArray->SN_ID."' onmouseover=\"return overlib('$Pop_note');\" onmouseout=\"return nd();\" style=\"color: #339933; font-size: 9px;\">" . $NoteOne . " ...</a><br>";
    }

    if($i==$week_day) $day=1;
    if($i<$week_day || $i>=$last_cell) {

    echo "<td height=\"75\" >&nbsp;</td>";
    if($i%7==0){echo "</tr><tr>\n";}
    }else{

    if(($today_match)&& ($today_day==$day)) {
    $Var = mktime(0,0,0,$month,$day,$year);
    echo "<td width=\"75\" class=\"calBig\" style=\"border-color: #FF0000\" onMouseOver=\"bgColor='#FFFFCC'; this.style.color='#000000'\" onMouseOut=\"bgColor=''; this.style.color='#000000'\" height=\"75\"><strong><a href=\"dialy.php?Sec=schedule&today=$Var\" style=\"color='#000000'\"><strong>$day</strong></a></strong><br><div align=\"left\"><font size=1>$Tasks $App $Note</font></div></td>";
    }else{
    $Var = mktime(0,0,0,$month,$day,$year);
    echo "<td width=\"75\" class=\"calBig\" onMouseOver=\"bgColor='#FFFFCC'; this.style.color='#000000'\" onMouseOut=\"bgColor=''; this.style.color='#000000'\" height=\"75\"><a href=\"dialy.php?Sec=schedule&today=$Var\" style=\"color='#000000'\"><strong>$day</strong></a></strong><br><div align=\"left\"><font size=1>$Tasks $App $Note</font></div></td>";
    }

    $day++;
    if($i%7==0) { echo "</tr><tr>\n"
    ; }

    }
    $Note = "";
    $App = "";
    $Tasks = "";
    }
    echo ("</table></td></tr></table></td></tr></table>");
    //tableClose();

    include "footer.inc.php";
    ?>
    Last edited by Scotty13; November 9th, 2012 at 02:19 PM.
  6. #4
  7. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6351
    Please read the new user guide to learn how to properly format your code so it's readable.

    There's also steps in the new user guide to help you debug this on your own, narrow down the problem, and ask good questions.

    Edit: OP's post has disappeared, he ended up actually posting all 900 lines in one big unreadable mess.
    Last edited by ManiacDan; November 12th, 2012 at 11:25 AM.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.

IMN logo majestic logo threadwatch logo seochat tools logo