Jump to content

Hooch

Members
  • Content Count

    452
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Hooch

  • Rank
    Member
  • Birthday 01/01/1967

Contact Methods

  • Website URL
    http://zentyx.com
  • ICQ
    0

Profile Information

  • Location
    Ontario, Canada
  1. After trying Hadien's code for a while I'm finding it as difficult to get what I want. If someone can have a look at the original code and question for help that would be terriffic. Thank you.
  2. Hi Hadien, thanks for taking the time to help me out. It's definitely got some errors, but I will try to figure it out.
  3. Hello all. I am trying to change this old script up a bit and need some help to get it 100% correct. I'm trying to create a weekly list of 3 people and their job lineup for each of those 3 weeks.Example:Week1:Job1:LesJob2:MikeJob3:DanWeek2:Job1:DanJob2:LesJob3:MikeWeek3:Job1:MikeJob2:DanJob3:LesThen repeat the job cycle from week 1 for eternity.If you check out my results so far at LINKY you can see it is simply repeating week#3 instead of starting over as week 1.Here is my code so far: <?PHP $var1 = 'Les'; $var2 = 'Dan'; $var3 = 'Mike'; $dayName = array(1 => "Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"); $monthName = array(1 => "January","February","March","April","May","June","July","August","September","October","November","December"); $monthDays = array(1 => 31,28,31,30,31,30,31,31,30,31,30,31); $row1 = array($var1,$var1,$var1,$var1,$var1,$var1,$var1,$var2,$var2,$var2,$var2,$var2,$var2,$var2,$var3,$var3,$var3,$var3,$var3,$var3,$var3); $row2 = array($var2,$var2,$var2,$var2,$var2,$var2,$var2,$var3,$var3,$var3,$var3,$var3,$var3,$var3,$var1,$var1,$var1,$var1,$var1,$var1,$var1); $row3 = array($var3,$var3,$var3,$var3,$var3,$var3,$var3,$var1,$var1,$var1,$var1,$var1,$var1,$var1,$var2,$var2,$var2,$var2,$var2,$var2,$var2); $now = time(); $nowd = date('j', $now); $nowm = date('F', $now); $nowy = date('Y', $now); $startdate = date(mktime(0,0,1,10,6,2013)); //Jan 1 2001 00:00:01 $getMonth = $_POST['month']; if($getMonth == '') $getMonth = date('n', $now); $getYear = $_POST['year']; if($getYear == '') $getYear = date('Y', $now); //$getMonth = $_POST['month']; if($getMonth == 0) { $getMonth = 12; $getYear = ($getYear - 1); } elseif($getMonth == 13) { $getMonth = 1; $getYear = ($getYear + 1); } else { $getYear = $getYear; } // if this year is divisable by 4 or 100, and is divisible by 400... then change last day of feb to 29. // if($getMonth == 2) { if (($getYear%4==0)||($getYear%100==0)) {$monthDays[1]=29;} if ($getYear%400==0) {$monthDays[1]=29;} } $firstDay = date(mktime(0,0,0,$getMonth,1,$getYear)); //Jan 1 2001 00:00:01 $firstDay = date('w', $firstDay);//0 through 6 (Sun - Sat) if($getMonth == 1) $buttonMonth = 'January'; if($getMonth == 2) $buttonMonth = 'February'; if($getMonth == 3) $buttonMonth = 'March'; if($getMonth == 4) $buttonMonth = 'April'; if($getMonth == 5) $buttonMonth = 'May'; if($getMonth == 6) $buttonMonth = 'June'; if($getMonth == 7) $buttonMonth = 'July'; if($getMonth == 8) $buttonMonth = 'August'; if($getMonth == 9) $buttonMonth = 'September'; if($getMonth == 10) $buttonMonth = 'October'; if($getMonth == 11) $buttonMonth = 'November'; if($getMonth == 12) $buttonMonth = 'December'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Shift Schedule</title> <link href="styleCalendar.css" rel="stylesheet" type="text/css" /> </head> <body> <?php include_once("analyticstracking.php") ?> <table width="400px" align="center" border="0" cellpadding="1" cellspacing="0"> <tr> <td align="right"> <form method="POST"> <input type="hidden" value="<?PHP echo ($getMonth);?>" name="month"> <input type="hidden" value="<?PHP echo ($getYear-1);?>" name="year"> <input type="submit" value="<<Year" name="submit" class="button-alt" /> </form> </td> <td align="left"> <form method="POST"> <input type="hidden" value="<?PHP echo ($getMonth-1);?>" name="month"> <input type="hidden" value="<?PHP echo ($getYear);?>" name="year"> <input type="submit" value="<<Month" name="submit" class="button-alt" /> </form> </td> <td align="center"><form method="POST" action="puller.php"><input type="submit" value=" Reset " name="submit" class="button-alt" /></form></td> <td align="right"> <form method="POST"> <input type="hidden" value="<?PHP echo ($getMonth+1);?>" name="month"> <input type="hidden" value="<?PHP echo ($getYear);?>" name="year"> <input type="submit" value="Month>>" name="submit" class="button-alt" /> </form> </td> <td align="left"> <form method="POST"> <input type="hidden" value="<?PHP echo ($getMonth);?>" name="month"> <input type="hidden" value="<?PHP echo ($getYear+1);?>" name="year"> <input type="submit" value="Year>>" name="submit" class="button-alt" /> </form> </td> </tr> <tr> <td colspan="5" align="center"><H1><?PHP echo $buttonMonth;?> <?PHP echo $getYear;?></H1></td> </tr> </table> <?PHP echo '<table align="center" border="0" cellpadding="0" cellspacing="0" class="tableOutterBorder">'; echo '<tr>'; for($i = 1; $i < 8; $i++) echo '<td width="120" align="center" class="weekDayHeaderCells">' . substr($dayName[$i], 0, 3) . '</td>'; echo '</tr>'; echo '<tr>'; $dayCount = 1; for ($ii = 0; $ii < $firstDay; $ii++) $dayCount = $dayCount + 1; if($ii >=1) echo '<td colspan="'.$ii.'" width="'.($ii*120).'" height="90" align="left" class="emptyCells"></td>';//Empty if($monthDays[1] == 29) $daysInMonth = 29; else $daysInMonth = $monthDays[$getMonth]; for ($i = 1; $i <= $daysInMonth; $i++) { $fDate = mktime(0,0,0,$getMonth,$i,$getYear);//Hr Mn Sec Mn Dy Yr $diffdate = round(($fDate - $startdate)/86400); $remainder = $diffdate%28; $showRow1 = $row1[$remainder]; $showRow2 = $row2[$remainder]; $showRow3 = $row3[$remainder]; //Highlight today if this month is selected if($getYear == $nowy && $i == $nowd && $buttonMonth == $nowm)$live = "Live"; if($showRow1 == $var1){ $class = "dayCellsE1" . $live; $weekSet = 1; $showJobs = '<br />Puller:'.$var1.'<br>Ground:'.$var2.'<br>Loco:'.$var3; }elseif($showRow1 == $var2){ $class = "dayCellsE2" . $live; $weekSet = 2; $showJobs = '<br />Puller:'.$var2.'<br>Ground:'.$var3.'<br>Loco:'.$var1; }else{ $class = "dayCellsE3" . $live; $weekSet = 3; $showJobs = '<br />Puller:'.$var3.'<br>Ground:'.$var1.'<br>Loco:'.$var2; } echo '<td width="120" height="90" valign="top" align="center" class="'.$class.'">'; echo '<span class="text_16_white">'.$i.'</span>'.$showJobs; echo '</td>'; $live = ''; if (($i+$firstDay)%7==0&&($dayCount<$daysInMonth+1)) echo '</tr><tr>'; } $totCells = $firstDay + $daysInMonth; for ($i = 0; $i < ($totCells > 28 ? ($totCells > 35 ? 42 : 35) : 28) - $totCells; $i++) echo ''; if($i >=1) echo '<td colspan="'.$i.'" width="'.($i*120).'" height="90" align="left" class="emptyCells"></td>';//Empty echo '</tr>'; echo '</table>'; ?> <br /> <center><a href="../" class="button-alt">ZENTYX</a></center> </body> </html> Any help is greatly appreciated.
  4. Ooops..I got to this post via my panel and forgot it started in javascript. Sorry for posting this PHP problem here. I removed the above post and added a new one to PHP
  5. These are scripts I have picked up from the net.One is from code I have purchased. The "packer" is from code I downloaded from http://www.webmotionuk.co.uk/php-jquery-image-upload-and-crop/ I am completely lost with JS and do not understand what you want me to do when it comes to namespacing.
  6. Howdy all. I have 2 scripts that are not happy with each other. From what I have googled there are functions that are named the same. So my limited knowledge of JS have brought me to the conclusion the 2 scripts have function( c ) and function(e) in common.There are 4 function's in this code at the beginning. But do I need to sift through all that code after these functions and replace all the c's and e's?I'm not even sure what I need to change amongst the 1st 4 functions since there are many c's and e's there too. Here is the first bit of code on the file (I can't post the whole code since IPBoard thinks I'm posting a bunch of emoticons)jquery-pack.js eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(' There you can see the functions I am dealing with...after this code it's a bunch of gobbledee gook to me. Thank you for your time
  7. Hooch

    Question On Code

    This code is within a function...and there are many things happening within. Some when a new entry comes along or some when an update comes along.So the function might be true, but not specifically true for a new entry.
  8. Hooch

    Question On Code

    Geesh....After I posted the question I had a brain storm. $checkEvent = ($this->userid) ? ($cE = 1) : ($cE = 2); This works... if $cE = 2 it means there was a new entry. All is good now. Thanks for looking though
  9. Hooch

    Question On Code

    Hey all.I stumbled upon some code that I have a question about. ($this->userid) ? $db->update($this->uTable, $data, "id='" . (int)$this->userid . "'") : $db->insert($this->uTable, $data); On the next line of code I want a check put in place to see if $db->insert was performed. Then if it was do something else. I have tried if($db->insert()) but it's a no go.Still trying other things...but I would love your input here. Thank you.
  10. Thanks for the info guys.Using javascript is not something I do often so I decided to convert it all to PHP. I appreciate you taking the time to help me. If anyone wants the code I will post it. Oh..if you want to see what I was going for look here...This is a 12hr shift schedule my workplace has. Now we cansee what we are working months/years in advance. Againthank you. Hooch
  11. Thanks Guy.But this gives me more errors. To show you how I implemented your code look below <script LANGUAGE="JavaScript"><!-- var dayName=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"); var monthName=newArray("January","February","March","April","May","June","July","August","September","October","November","December"); var monthDays=new Array(31,28,31,30,31,30,31,31,30,31,30,31); var ondays=newArray("D","D","A","A","B","B","B","C","C","D","D","A","A","A","B","B","C","C","D","D","D","A","A","B","B","C","C","C"); var onnights=newArray("B","B","C","C","D","D","D","A","A","B","B","C","C","C","D","D","A","A","B","B","B","C","C","D","D","A","A","A"); var now=new Date(); var nowd=now.getDate(); var nowm=now.getMonth(); var nowy=now.getYear(); var startdate=new Date("Jan 1 2001 00:00:01"); function showCalendar(day,month,year) { // if this year is divisable by 4 or 100, and is divisible by 400... then change last day of feb to 29. // if ((year%4==0)||(year%100==0)) {monthDays[1]=29;} if (year%400==0) {monthDays[1]=29;} var firstDay=new Date(year,month,1).getDay() var calStr="<br><span id=instruction>Instruction<br></span id=instruction>" calStr+="<div class=headerRow>" calStr+="<span class=headerLeft><InPut type = button value = 'Last Month' onClick='nowm--; if (nowm<0) { nowy--;nowm=11; } showCalendar(nowd,nowm,nowy)'></span>" calStr+="<span class=headerRight><InPut type = button value = 'Next Month'onClick='nowm++; if (nowm>11) { nowy++;nowm=0; } showCalendar(nowd,nowm,nowy)'></span>" calStr+="<span class=headerCenter><font size=2>12 Hour Shift Schedule</font><br>"+monthName[month].toUpperCase()+","+year+"</span>" calStr+="</div class=headerRow><div class=headerDayRow>" for (var i=0;i<dayName.length;i++) calStr+="<span class=headerDays>"+dayName[i].substring(0,3)+"</span>" var dayCount=1 calStr+="</div class=headerDayRow><div class=dayRow>" for (var i=0;i<firstDay;i++) calStr+="<span class=emptyDaysTop> </span>" for (var i=0;i<monthDays[month];i++) {if (ondays == 'A' || ondays == 'C'){ calStr+="<span class=ACDays><span class=daynumber>"+dayCount++} else if (ondays == 'B' || ondays == 'D'){ calStr+="<span class=BDDays><span class=daynumber>"+dayCount++} var fDate = new Date(monthName[month]+" "+dayCount+" "+nowy+" 00:00:01") var diffdate = (fDate - startdate)/86400000 -1 var diffdate = Math.round(diffdate) var remainder=diffdate%28 var days=ondays[remainder] var nights=onnights[remainder] calStr+="</span><br><b>Days= " calStr+=days calStr+="<br>Nights= " calStr+=nights+"</b></span>" if ((i+firstDay+1)%7==0&&(dayCount<monthDays[month]+1)) calStr+="</div><div class=dayRow>" } var totCells=firstDay+monthDays[month] for (var i=0;i<(totCells>28?(totCells>35?42:35):28)-totCells;i++) calStr+="<span class=emptyDaysBottom> </span>" calStr+="</div>" //define what html to put in the span tag // calendar.innerHTML=calStr } //--></SCRIPT></head><body background="" bgcolor="#CCCCCC" text="#000000" link="#996600" vlink="#666666" alink="#336600"><center><SPAN ID=calendar><script> showCalendar(nowd,nowm,nowy)</SCRIPT></SPAN></center></body></html> This my show you what I am trying to do.Just an FYI this code (well the 1st code posted) only works in IE not FF Hooch
  12. Hi all.I came across a script that is exactly what I need, unfortunately it's mostly JS.I could work things out if it were PHP but I need some help here. Here is the code.. <html> <head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>Shift Schedule</title> </head><body background="" bgcolor="#CCCCCC" text="#000000" link="#996600" vlink="#666666" alink="#336600"><script LANGUAGE="JavaScript"><!-- var dayName=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"); var monthName=new Array("January","February","March","April","May","June","July","August","September","October","November","December"); var monthDays=new Array(31,28,31,30,31,30,31,31,30,31,30,31); var ondays=new Array("D","D","A","A","B","B","B","C","C","D","D","A","A","A","B","B","C","C","D","D","D","A","A","B","B","C","C","C"); var onnights=new Array("B","B","C","C","D","D","D","A","A","B","B","C","C","C","D","D","A","A","B","B","B","C","C","D","D","A","A","A"); var now=new Date(); var nowd=now.getDate(); var nowm=now.getMonth(); var nowy=now.getYear(); var startdate=new Date("Jan 1 2001 00:00:01"); function showCalendar(day,month,year) { // if this year is divisable by 4 or 100, and is divisible by 400... then change last day of feb to 29. // if ((year%4==0)||(year%100==0)) {monthDays[1]=29;} if (year%400==0) {monthDays[1]=29;} var firstDay=new Date(year,month,1).getDay() var calStr="<br><span id=instruction>Instruction<br></span id=instruction>" calStr+="<div class=headerRow>" calStr+="<span class=headerLeft><InPut type = button value = 'Last Month' onClick='nowm--; if (nowm<0) { nowy--; nowm=11; } showCalendar(nowd,nowm,nowy)'></span>" calStr+="<span class=headerRight><InPut type = button value = 'Next Month'onClick='nowm++; if (nowm>11) { nowy++; nowm=0; } showCalendar(nowd,nowm,nowy)'></span>" calStr+="<span class=headerCenter><font size=2>12 Hour Shift Schedule</font><br>"+monthName[month].toUpperCase()+", "+year+"</span>" calStr+="</div class=headerRow><div class=headerDayRow>" for (var i=0;i<dayName.length;i++) calStr+="<span class=headerDays>"+dayName[i].substring(0,3)+"</span>" var dayCount=1 calStr+="</div class=headerDayRow><div class=dayRow>" for (var i=0;i<firstDay;i++) calStr+="<span class=emptyDaysTop> </span>" for (var i=0;i<monthDays[month];i++) { calStr+="<span class=ACDays><span class=daynumber>"+dayCount++ var fDate = new Date(monthName[month]+" "+dayCount+" "+nowy+" 00:00:01") var diffdate = (fDate - startdate)/86400000 -1 var diffdate = Math.round(diffdate) var remainder=diffdate%28 var days=ondays[remainder] var nights=onnights[remainder] calStr+="</span><br><b>Days= " calStr+=days calStr+="<br>Nights= " calStr+=nights+"</b></span>" if ((i+firstDay+1)%7==0&&(dayCount<monthDays[month]+1)) calStr+="</div><div class=dayRow>" } var totCells=firstDay+monthDays[month] for (var i=0;i<(totCells>28?(totCells>35?42:35):28)-totCells;i++) calStr+="<span class=emptyDaysBottom> </span>" calStr+="</div>" //define what html to put in the span tag // calendar.innerHTML=calStr } //--></SCRIPT><center><SPAN ID=calendar><script> showCalendar(nowd,nowm,nowy)</SCRIPT></SPAN></center></body></html> Basically I need the following line calStr+="<span class=ACDays><span class=daynumber>"+dayCount++ to switch from it to this calStr+="<span class=BDDays><span class=daynumber>"+dayCount++ whenever the variable ondays is either A or C show the switch 1. When variable ondays is either B or D show switch 2. I tried many different ways with my knowledge of PHP but nothing works. Thank you for your time
  13. Here's a question.Is there another way to mouse over an image to show text elsewhere?Maybe an easier option?
  14. This seems to be closer. When I mouse over the images the text will appear whereit should but the text is outputted as " instead of the actual quote ( " ).
×
×
  • Create New...