[SASHA-Code] SF.net SVN: sasha:[80] trunk/SASHA/inc/lib
Brought to you by:
gphemsley
|
From: <gph...@us...> - 2010-01-19 21:47:17
|
Revision: 80
http://sasha.svn.sourceforge.net/sasha/?rev=80&view=rev
Author: gphemsley
Date: 2010-01-19 21:47:11 +0000 (Tue, 19 Jan 2010)
Log Message:
-----------
Add link to institution-specific views to get back to full semester view.
Don't force cut off of course subjects or numbers based on maximum length values.
Fix bug that caused unspecified days to turn into Sunday.
Fix bug that made default times after edit revert to AM, even if PM was specified.
Add an extra check to Base::format_days() to ensure proper array handling.
Change column widths for some columns in schedules list.
Modified Paths:
--------------
trunk/SASHA/inc/lib/lib.base.php
trunk/SASHA/inc/lib/lib.schedule.php
Modified: trunk/SASHA/inc/lib/lib.base.php
===================================================================
--- trunk/SASHA/inc/lib/lib.base.php 2010-01-19 00:44:45 UTC (rev 79)
+++ trunk/SASHA/inc/lib/lib.base.php 2010-01-19 21:47:11 UTC (rev 80)
@@ -634,7 +634,7 @@
{
$days_array = array();
- if( $input === TRUE )
+ if( ( $input === TRUE ) || is_array( $days ) )
{
$input = 'array';
}
@@ -958,10 +958,13 @@
$course_format = $Database->fetch_assoc( $result );
$course_max_length = $course_format['course_max_length'];
- $course = ( strlen( $course ) < $course_max_length ) ? str_pad( $course, $course_max_length, '0', STR_PAD_LEFT ) : $course;
- $subject = substr( $subject, 0, $course_format['subject_max_length'] );
- $course = substr( $course, -$course_max_length, $course_max_length );
+ // Don't force the lengths; use them only as a guide
+ $course = ltrim( $course, '0' );
+ $course = ( strlen( $course ) > $course_max_length ) ? $course : str_pad( $course, $course_max_length, '0', STR_PAD_LEFT );
+
+// $subject = substr( $subject, 0, $course_format['subject_max_length'] );
+// $course = substr( $course, -$course_max_length, $course_max_length );
}
$Database->free_result( $result );
@@ -1046,10 +1049,10 @@
if( $institution )
{
- print $this->format_institution( $institution, TRUE ) . ' – ';
+ print $this->format_institution( $institution, TRUE ) . ' – <a href="' . $file . '?semester=' . $semester . '">';
}
- print $this->format_semester( $semester ) . '</div>' . "\n";
+ print $this->format_semester( $semester ) . ( ( $institution ) ? '</a>' : '' ) . '</div>' . "\n";
print "\t\t" . '<div class="right-column"><a href="' .$file . '?' . $only_institution . 'semester=' . $next . '">' . $this->format_semester( $next ) . ' →</a></div>' . "\n";
print "\t" . '</div>' . "\n";
Modified: trunk/SASHA/inc/lib/lib.schedule.php
===================================================================
--- trunk/SASHA/inc/lib/lib.schedule.php 2010-01-19 00:44:45 UTC (rev 79)
+++ trunk/SASHA/inc/lib/lib.schedule.php 2010-01-19 21:47:11 UTC (rev 80)
@@ -60,6 +60,9 @@
$institution = ( $this->institution ) ? $this->institution : $this->default_institution;
$semester = ( $this->semester ) ? $this->semester : $this->default_semester;
+ $start_time = $this->convert_hour( TRUE, $this->start_time['hour'], $this->start_time );
+ $end_time = $this->convert_hour( TRUE, $this->end_time['hour'], $this->end_time );
+
$this_step = ( exists( $_POST['step'] ) ) ? (int) $_POST['step'] : FALSE;
$prev_step = ( $this_step ) ? (int) ( $this_step - 1 ) : FALSE;
$next_step = ( $this_step ) ? (int) ( $this_step + 1 ) : FALSE;
@@ -338,13 +341,13 @@
'type' => 'time',
'name' => 'start_time',
'label' => 'Start Time',
- 'data' => array( mktime( $this->start_time['hour'], $this->start_time['minute'], 0 ) )
+ 'data' => array( mktime( $start_time['hour'], $start_time['minute'], 0 ) )
),
array(
'type' => 'time',
'name' => 'end_time',
'label' => 'End Time',
- 'data' => array( mktime( $this->end_time['hour'], $this->end_time['minute'], 0 ) )
+ 'data' => array( mktime( $end_time['hour'], $end_time['minute'], 0 ) )
),
array(
'type' => 'hidden',
@@ -404,7 +407,7 @@
{
case 3:
$sql = "UPDATE schedules
- SET institution = '$institution', semester = '$semester', subject = '" . $Database->escape( $this->subject ) . "', course = {$this->course}, section = '" . $Database->escape( $this->section ) . "', section_title = '" . $Database->escape( $this->section_title ) . "', schedule_type = {$this->schedule_type}, days = b'" . $this->format_days( $this->schedule_days, 'decimal', 'binary' ) . "', start_time = {$this->start_time}, end_time = {$this->end_time}, instructors = '" . $this->prepare_instructors( $this->instructors ) . "', parent_schedule_id = {$this->parent_schedule_id}
+ SET institution = '$institution', semester = '$semester', subject = '" . $Database->escape( $this->subject ) . "', course = {$this->course}, section = '" . $Database->escape( $this->section ) . "', section_title = '" . $Database->escape( $this->section_title ) . "', schedule_type = {$this->schedule_type}, days = b'" . $this->format_days( $this->schedule_days, NULL, 'binary' ) . "', start_time = {$this->start_time}, end_time = {$this->end_time}, instructors = '" . $this->prepare_instructors( $this->instructors ) . "', parent_schedule_id = {$this->parent_schedule_id}
WHERE schedule_id = $schedule_id";
$sql = str_replace( array( "= '',", "= '' ", '= ,', '= ', "= \n" ), array( '= NULL,', '= NULL ', '= NULL,', '= NULL ', "= NULL\n" ), $sql );
@@ -412,7 +415,7 @@
if( $result )
{
- print_message( 'good', 'Schedule for ' . $this->format_course( $this->subject, $this->course, $institution, ' ' ) . ' ' . $this->section . ' at ' . $this->format_institution( $institution ) . ' (' . $this->format_instructors( $this->instructors, '; ' ) . ' — ' . $this->format_schedule_type( $this->schedule_type ) . ': ' . $this->format_days( $this->schedule_days, 'decimal', 'html' ) . ') updated successfully.', 'Update successful.' );
+ print_message( 'good', 'Schedule for ' . $this->format_course( $this->subject, $this->course, $institution, ' ' ) . ' ' . $this->section . ' at ' . $this->format_institution( $institution ) . ' (' . $this->format_instructors( $this->instructors, '; ' ) . ' — ' . $this->format_schedule_type( $this->schedule_type ) . ': ' . $this->format_days( $this->schedule_days, NULL, 'html' ) . ') updated successfully.', 'Update successful.' );
$this->list_schedule();
@@ -681,7 +684,7 @@
if( !$institution_where )
{
$columns[1] = array(
- 'style' => 'width: 10%;'
+ 'style' => 'width: 7.5%;'
);
$headers[1] = array(
'content' => 'Institution'
@@ -729,14 +732,14 @@
);
$columns[8] = array(
- 'style' => 'width: 10%;'
+ 'style' => 'width: 7.5%;'
);
$headers[8] = array(
'content' => 'Start Time'
);
$columns[9] = array(
- 'style' => 'width: 10%;'
+ 'style' => 'width: 7.5%;'
);
$headers[9] = array(
'content' => 'End Time'
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|