Changeset 647401
- Timestamp:
- 01/03/2013 11:28:26 AM (13 years ago)
- File:
-
- 1 edited
-
dippler/trunk/classes/dippler-toolbar.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dippler/trunk/classes/dippler-toolbar.php
r633434 r647401 22 22 $course_valid = false; 23 23 //Iterate through course ID's and load data 24 $total_courses = 0; 25 $active_course = null; 24 26 foreach ( $this->getList( 'COURSE_ENROLLED', 'id' ) as $course_id ) { 25 27 $course_manager = new DipplerCourseManager ( 'LOAD', $course_id ); … … 32 34 } 33 35 $option_list .= '<option value="'.$course->id.'" '.$selected.'>'.$course->title.'</option>'; 36 $total_courses++; 37 $active_course = $course; 34 38 } 35 39 } 40 41 //If only one course, set it default to be selected all the time 42 if ( $total_courses == 1 && is_user_logged_in() && !is_null( $active_course ) ) { 43 $course_valid = true; 44 $option_list = '<option value="'.$active_course->id.'" selected="selected">'.$active_course->title.'</option>'; 45 global $wp_query; 46 $wp_query->set( 'dippler-course', $active_course->id ); //Use WP_Query, because main.php getGET method will work then. 47 } 48 36 49 if ( !empty( $option_list ) ) { 37 50 $option_list = '<option value="-1">'.__( 'Select a course', $this->getTextdomain() ).'</option>'.$option_list; 38 51 $html .= $option_list; 39 52 } 53 40 54 $html .= '</select>'; 41 55 $html .= '</form>';
Note: See TracChangeset
for help on using the changeset viewer.