echo '<td class="HdgDk Right">' . $Lcols2[1] . '</td>' . "\n"; echo '<td class="HdgLt">' . $Lcols2[0] . '</td>' . "\n"; echo '<td class="HdgDk Left Right">' . $Lcols2[3] . '</td>' . "\n"; echo '</tr>' . "\n"; echo '</tbody>' . "\n"; $needheading = false; echo '<tbody>' . "\n"; } echo '<tr class = "taC">' . "\n"; for ($col = 0; $col < $columns; $col++) { $data = $csvarray[$row][$col]; if ($col == 0) { $pmo = substr($data, 5, 2); $pda = substr($data, strrpos($data, "-") + 1, 2); $pyr = substr($data, 0, 4); $tdate = AddDate($pmo, $pda, $pyr, 0); // just to get the name of the day if ($row !== count($csvarray) - 1) { // ie not the last row if (substr($data, 0, 7) !== substr($csvarray[$row + 1][0], 0, 7)) { $needheading = true; } } $data = '<td class = "date">' . substr($tdate[weekday], 0, 3) . '</td><td class = "date"><a href="' . $PHP_SELF . '&ID=' . $WUID . '&month=' . $pmo . '&day=' . $pda . '&year=' . $pyr . '&mode=1&units=' . $units . $phpselftop . '">' . $pda . '</a></td>'; //Date/Time } if ($col == 1) { $convarray = convertTemps($data); $data = merge_data($convarray); // Figures out which measurement is desired & returns it $data = '<td class="BodyDk Left">' . $data . '</td>';
function WeekCalc($Wdate) { //Find Week Start and Week End. //Note LMC weeks begin with Monday (phpday #1) //PHP Weeks begin with Sunday (phpday #0) //need to declare the AddDate function in any page that requires this function //include ('/var/www/LMCIntranet/Util/AddDate.php'); //echo $Wdate . ' Wdate value <br>'; $dtW = date(w, strtotime($Wdate)); //Day Of The Week //echo $dtW.' Original DtW<br>'; if (strcmp($dtW, 0) != 0) { $dtW = $dtW - 1; } else { $dtW = 6; } //echo $dtW.' Adjusted DtW<br>'; $week['Start'] = AddDate($Wdate, 0, -$dtW, 0); $week['End'] = AddDate($week['Start'], 0, +6, 0); return $week; }
public function boxTimeTable($wherestr) { global $startlecturer_time, $endlecturer_time; $startlecturer_time = (int) $startlecturer_time; $endlecturer_time = (int) $endlecturer_time; if ($this->week_no == "") { $this->week_no = 1; } $weekarray = $this->getWeekSelectCtrl($this->week_no, "week_no", $this->year_id, $this->session_id, "onchange='getWeekNo(this.value)'"); $weekctrl = $weekarray['html']; $startweek_date = $weekarray['startweek_date']; $endweek_date = $weekarray['endweek_date']; // looping by day (MONDAY to FRIDAY) $weekday = array(0 => "", 1 => "MONDAY", 2 => "TUESDAY", 3 => "WEDNESDAY", 4 => "THURSDAY", 5 => "FRIDAY"); $wherestr .= " and tt.subjectclass_id = sc.subjectclass_id\r\n and tt.employee_id = em.employee_id\r\n and sc.subject_id = sb.subject_id\r\n and tt.lecturerroom_id = lr.lecturerroom_id\r\n and tt.year_id = cs.year_id\r\n and tt.session_id = cs.session_id\r\n and sc.subjectclass_id = cl.subjectclass_id \r\n and cs.isactive = 0 "; if ($this->subjectclass_id > 0) { $wherestr .= " and tt.subjectclass_id = {$this->subjectclass_id}"; } if ($this->lecturerroom_id > 0) { $wherestr .= " and tt.lecturerroom_id = {$this->lecturerroom_id}"; } //echo $this->subjectclass_id." ".$this->course_id; //&& $this->subjectclass_id > 0 if ($this->course_id > 0) { $wherestr .= " and ( cl.course_id = {$this->course_id})"; } //$wherestr .= " and tt.generateinvoice_date between '$startweek_date' and '$endweek_date' "; echo <<<EOF <form name="frmGenerateinvoiceBox" method="POST"> <input type="hidden" name="search_category" value="{$this->search_category}"> <input type="hidden" name="search_type" value="{$this->search_type}"> <input type="hidden" name="year_id" value="{$this->year_id}"> <input type="hidden" name="session_id" value="{$this->session_id}"> <input type="hidden" name="course_id" value="{$this->course_id}"> <input type="hidden" name="showtt" value="{$this->showtt}"> <input type="hidden" name="issearch" value="{$this->issearch}"> <input type="hidden" name="subjectclass_id" value="{$this->subjectclass_id}"> <input type="hidden" name="lecturerroom_id" value="{$this->lecturerroom_id}"> <input type="hidden" name="action" value="search"> <table> <tr> <td acolspan="12" align="left">{$weekctrl}</td> </tr> </table> <table> EOF; $i = 0; foreach ($weekday as $day_name) { //looping monday to friday //$date_name = getNameDay($trans_date); echo <<<EOF <tr> <td class="even"><b>{$day_name}</b><br>{$trans_date}</td> EOF; $trans_time = $startlecturer_time; $j = 0; while ($trans_time < $endlecturer_time) { //looping start_time to end_time $j++; $whereloop = ""; $rowtype = "odd"; $transstart_time = $trans_time; $transend_time = $trans_time + 100; $time_description = ""; if ($i == 0) { //header only $time_description = "{$transstart_time} - {$transend_time}"; $rowtype = "head"; } else { //start SQL $whereloop .= $wherestr . " and tt.generateinvoice_starttime <= {$transstart_time} and tt.generateinvoice_endtime >= {$transend_time} "; $whereloop .= " and tt.generateinvoice_date = '{$trans_date}' "; $sql = "select tt.generateinvoice_id,tt.generateinvoice_date,tt.generateinvoice_starttime,tt.generateinvoice_endtime,\r\n tt.employee_id,tt.lecturerroom_id,tt.year_id,tt.session_id,tt.subjectclass_id,\r\n em.employee_name,sb.subject_name,sb.subject_no,lr.lecturerroom_name,\r\n lr.lecturerroom_no,sc.course_id,sc.group_no\r\n from\r\n {$this->tablegenerateinvoice} tt, {$this->tablesubjectclass} sc, {$this->tableemployee} em,\r\n {$this->tablesubject} sb, {$this->tablelecturerroom} lr, {$this->tableclosesession} cs,\r\n {$this->tablesubjectclassline} cl \r\n {$whereloop}\r\n group by sc.subjectclass_id\r\n order by tt.generateinvoice_date"; //echo "<br>"; //end SQL $rs = $this->xoopsDB->query($sql); $check = 0; $time_description = ""; while ($row = $this->xoopsDB->fetchArray($rs)) { $check++; //echo "sa $check <br>"; $course_id = $row['course_id']; $generateinvoice_id = $row['generateinvoice_id']; $subjectclass_id = $row['subjectclass_id']; $subject_name = $row['subject_name']; $subject_no = $row['subject_no']; $lecturerroom_no = $row['lecturerroom_no']; $employee_name = $row['employee_name']; $group_no = $row['group_no']; $time_description .= "<a title='Edit This Record' target='blank' href='generateinvoice.php?action=edit&generateinvoice_id={$generateinvoice_id}'>{$subject_name}({$subject_no})<br>Room : ({$lecturerroom_no}) <br>Group : {$group_no}<br>Lecturer : {$employee_name}</a><br><br>"; //$time_description .= $time_description; } $time_description .= "<br><a title='Add New Class' target='blank' href='generateinvoice.php?action=addnew&generateinvoice_date={$trans_date}&generateinvoice_starttime={$transstart_time}&generateinvoice_endtime={$transend_time}&year_id={$this->year_id}&session_id={$this->session_id}'><font color=red>Add New >></font></a>"; //if($check >0) //$time_description = "$subject_name($subject_no)<br>Room : ($lecturerroom_no)<br>Lecturer : $employee_name"; } echo <<<EOF <td class="{$rowtype}" align="left" nowrap>{$time_description}</td> EOF; $trans_time = $trans_time + 100; // add 1 hour } echo <<<EOF </tr> EOF; $trans_date = AddDate($startweek_date, $i); $i++; } echo <<<EOF </table> </form> EOF; }