[Logicampus-cvs] logicampus/src/logicreate/lib lc_table_calendar.php, 1.13, 1.14
Brought to you by:
trilexcom
From: Mark K <har...@us...> - 2007-10-09 23:52:48
|
Update of /cvsroot/logicampus/logicampus/src/logicreate/lib In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv14007 Modified Files: lc_table_calendar.php Log Message: Adding in calendar support for activities based off of lesson start/stop times. Index: lc_table_calendar.php =================================================================== RCS file: /cvsroot/logicampus/logicampus/src/logicreate/lib/lc_table_calendar.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** lc_table_calendar.php 28 Sep 2007 20:37:43 -0000 1.13 --- lc_table_calendar.php 9 Oct 2007 23:52:45 -0000 1.14 *************** *** 294,299 **** if ( $eventWindow == 'day' ) { ! $this->windowStartTS = mktime(0,0,0,$this->m,$this->d,$this->y); ! $this->windowEndTS = mktime(23,59,59,$this->m,$this->d,$this->y); } --- 294,299 ---- if ( $eventWindow == 'day' ) { ! $this->windowStartTS = mktime(0,0,0,$this->m,$this->d,$this->y)- 1000000; ! $this->windowEndTS = mktime(23,59,59,$this->m,$this->d,$this->y) + 1000; } *************** *** 303,306 **** --- 303,307 ---- $this->loadClassEvents($this->windowStartTS, $this->windowEndTS); + $this->loadLessonEvents($this->windowStartTS, $this->windowEndTS); } *************** *** 418,422 **** function getEventsAtHour($dateStamp) { $ret = array(); ! // echo "Hour is : ".date('G:i:s',$dateStamp); // echo "<br/><br/>"; foreach($this->events as $blank=>$evt) { --- 419,423 ---- function getEventsAtHour($dateStamp) { $ret = array(); ! // echo "Hour is : ".date('G:i:s',$evtStart); // echo "<br/><br/>"; foreach($this->events as $blank=>$evt) { *************** *** 461,465 **** $db->query($sql); while( $db->nextRecord() ) { ! $this->events[$db->record['pkey']] = $db->record; } } --- 462,509 ---- $db->query($sql); while( $db->nextRecord() ) { ! $this->events[] = $db->record; ! } ! } ! ! ! /** ! * Load up events relative to the student's enrollment in the class. ! * ! * Use enrollment dates or semester start/stop dates to calculate offets ! */ ! function loadLessonEvents($start,$end) { ! $classIds = implode($this->classIds, ' or id_classes='); ! ! $sql =' ! SELECT C.activeOn + start_offset as startdate ! , C.inactiveOn + due_offset as enddate ! , A.lob_title as title ! , A.start_offset ! , A.due_offset ! , A.lob_type as calendarType ! FROM class_lesson_sequence AS A ! LEFT JOIN classes AS B on A.class_id = B.id_classes ! ! LEFT JOIN class_lessons AS C on A.lesson_id = C.id_class_lessons ! ! ! WHERE ! (class_id = '.$classIds.') ! AND (lob_type = "activity" OR lob_type = "test") ! ! HAVING ! ( (startdate )>='.$start.' AND (startdate) <= '.$end.') ! OR ! ( ! ( (enddate) >= '.$start.' AND (enddate) <= '.$end.') ! AND (due_offset > 0 OR due_offset IS NULL) ! ) ! '; ! ! //debug($sql,1); ! $db = DB::getHandle(); ! $db->query($sql); ! while( $db->nextRecord() ) { ! $this->events[] = $db->record; } } *************** *** 805,808 **** --- 849,853 ---- */ function paintHeaders() { + $this->html .= '<thead>'; $this->html .= '<tr class="center_justify">'; *************** *** 877,884 **** $renderer->row = $x; $renderer->col = $y; if ($y==0 ) { $renderer->value = $x; } else { ! $renderer->value = $this->table->tableModel->getEventsAtHour( mktime($x+1, 0, 0, $this->table->tableModel->m, $this->table->tableModel->d, $this->table->tableModel->y ) ); } --- 922,930 ---- $renderer->row = $x; $renderer->col = $y; + if ($y==0 ) { $renderer->value = $x; } else { ! $renderer->value = $this->table->tableModel->getEventsAtHour( mktime($x, 0, 0, $this->table->tableModel->m, $this->table->tableModel->d, $this->table->tableModel->y ) ); } *************** *** 973,992 **** $evtType = strtolower($evt['calendarType']); switch( $evtType ) { ! case 'classroomassignments': ! $type = 'Assignment:'; if ($evtStart == $this->targetDate->timeStamp) { ! $type = 'Assignment (Assigned):'; } else if ($evtEnd == $this->targetDate->timeStamp) { ! $type = 'Assignment (Due):'; } break; ! case 'assessmentscheduling': ! $type = 'Assessment:'; if ($evtStart == $this->targetDate->timeStamp) { ! $type = 'Assessment (Assigned):'; } else if ($evtEnd == $this->targetDate->timeStamp) { ! $type = 'Assessment (Due):'; } break; default: $type = ''; --- 1019,1040 ---- $evtType = strtolower($evt['calendarType']); switch( $evtType ) { ! case 'activity': ! $type = 'Activity:'; if ($evtStart == $this->targetDate->timeStamp) { ! $type = 'Activity (Assigned):'; } else if ($evtEnd == $this->targetDate->timeStamp) { ! $type = 'Activity (Due):'; } break; ! case 'test': ! $type = 'Test:'; if ($evtStart == $this->targetDate->timeStamp) { ! $type = 'Test (Assigned):'; } else if ($evtEnd == $this->targetDate->timeStamp) { ! $type = 'Test (Due):'; } break; + + default: $type = ''; |