public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/classes/courseprogress.php
/**
		 * Shows the configuration form for the widget.
		 */
Shows the configuration form for the widget.
Shows the configuration form for the widget .
public function form( $instance ) {
			if ( $instance ) {
				$title = esc_attr( $instance['title'] );
			} else {
				$title = __( 'Current User Progress', 'wp-courseware' );
			}
			$option_course             = esc_attr( WPCW_arrays_getValue( $instance, 'option_course' ) );
			$option_module             = esc_attr( WPCW_arrays_getValue( $instance, 'option_module' ) );
			$option_show_course_title  = ( WPCW_arrays_getValue( $instance, 'option_show_course_title' ) == 'on' ? 'checked="checked"' : '' );
			$option_show_course_desc   = ( WPCW_arrays_getValue( $instance, 'option_show_course_desc' ) == 'on' ? 'checked="checked"' : '' );
			$option_show_module_desc   = ( WPCW_arrays_getValue( $instance, 'option_show_module_desc' ) == 'on' ? 'checked="checked"' : '' );
			$option_show_only_on_units = ( WPCW_arrays_getValue( $instance, 'option_show_only_on_units' ) == 'on' ? 'checked="checked"' : '' );
			$option_toggle_modules        = esc_attr( WPCW_arrays_getValue( $instance, 'option_toggle_modules' ) );
			$option_show_modules_previous = esc_attr( WPCW_arrays_getValue( $instance, 'option_show_modules_previous' ) );
			$option_show_modules_next     = esc_attr( WPCW_arrays_getValue( $instance, 'option_show_modules_next' ) );
			$optionsList_previous = array(
				'all'  => __( 'All previous modules', 'wp-courseware' ),
				'none' => __( 'None', 'wp-courseware' ),
			);
			for ( $i = 1; $i <= 20; $i ++ ) {
				$optionsList_previous[ $i ] = sprintf( _n( 'Show just 1 previous module', 'Show %d previous modules', $i, 'wp-courseware' ), $i );
			}
			$optionsList_next = array(
				'all'  => __( 'All subsequent modules', 'wp-courseware' ),
				'none' => __( 'None', 'wp-courseware' ),
			);
			for ( $i = 1; $i <= 20; $i ++ ) {
				$optionsList_next[ $i ] = sprintf( _n( 'Show just 1 subsequent module', 'Show %d subsequent modules', $i, 'wp-courseware' ), $i );
			}
			?>
            <p>
                <b><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'wp-courseware' ); ?></label></b>
                <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>"/>
                <small><?php _e( '(Optional) Leave blank for no title.', 'wp-courseware' ); ?></small>
            </p>
            <p>
                <b style="display: block; padding-bottom: 3px;"><label for="<?php echo $this->get_field_id( 'option_course' ); ?>"><?php _e( 'Course To Show:', 'wp-courseware' ); ?></label></b>
				<?php
				$courseList = array(
					''        => __( '-- Select a Training Course --', 'wp-courseware' ),
					'current' => __( "Show User's Current Course", 'wp-courseware' ),
				);
				$mainCourseList = WPCW_courses_getCourseList();
				if ( $mainCourseList ) {
					$courseList = $courseList + $mainCourseList;
				}
				echo WPCW_CourseProgress::createDropdown( $this->get_field_name( 'option_course' ), $courseList, $option_course, $this->get_field_id( 'option_course' ) );
				?>
                <br/>
                <small><?php _e( '(Required) Choose whether to display a specific course to the user or to display the course associated with the unit that the user is currently viewing.', 'wp-courseware' ); ?></small>
            </p>
            <p>
                <b style="display: block; padding-bottom: 3px;"><label><?php _e( 'Show/Hide Modules:', 'wp-courseware' ); ?></label></b>
                <small><?php _e( 'Here you can control how many modules to show before and after the current module to save space.', 'wp-courseware' ); ?></small>
            </p>
            <table>
                <tr>
                    <td><label for="<?php echo $this->get_field_id( 'option_show_modules_previous' ); ?>"><?php _e( 'Previous modules to display:', 'wp-courseware' ); ?></label></td>
                    <td><label for="<?php echo $this->get_field_id( 'option_show_modules_next' ); ?>"><?php _e( 'Subsequent modules to display:', 'wp-courseware' ); ?></label></td>
                </tr>
                <tr>
                    <td>
						<?php
						echo WPCW_CourseProgress::createDropdown( $this->get_field_name( 'option_show_modules_previous' ), $optionsList_previous, $option_show_modules_previous, $this->get_field_id( 'option_show_modules_previous' ) );
						?>
                    </td>
                    <td>
						<?php
						echo WPCW_CourseProgress::createDropdown( $this->get_field_name( 'option_show_modules_next' ), $optionsList_next, $option_show_modules_next, $this->get_field_id( 'option_show_modules_next' ) );
						?>
                    </td>
                </tr>
            </table><br/>
            <p>
                <b style="display: block; padding-bottom: 3px;"><label
                            for="<?php echo $this->get_field_id( 'option_toggle_modules' ); ?>"><?php _e( 'Expand/Contract Modules:', 'wp-courseware' ); ?></label></b>
				<?php
				echo WPCW_CourseProgress::createDropdown( $this->get_field_name( 'option_toggle_modules' ),
					array(
						'expand_all'               => __( 'Expand all modules', 'wp-courseware' ),
						'contract_all_but_current' => __( 'Contract all except current module', 'wp-courseware' ),
						'contract_all'             => __( 'Contract all modules', 'wp-courseware' ),
					),
					$option_toggle_modules, $this->get_field_id( 'option_toggle_modules' ) );
				?>
                <br/>
                <small><?php _e( 'You can save sidebar space by contracting  modules in the widget to just show the module title.', 'wp-courseware' ); ?></small>
            </p>
            <p>
                <b style="display: block; padding-bottom: 3px;"><label
                            for="<?php echo $this->get_field_id( 'option_show_module_desc' ); ?>"><?php _e( 'More Options:', 'wp-courseware' ); ?></label></b>
                <input id="<?php echo $this->get_field_id( 'option_show_course_title' ); ?>" name="<?php echo $this->get_field_name( 'option_show_course_title' ); ?>"
                       type="checkbox" <?php echo $option_show_course_title; ?> /> <?php _e( 'Show Course Title', 'wp-courseware' ); ?><br/>
                <input id="<?php echo $this->get_field_id( 'option_show_course_desc' ); ?>" name="<?php echo $this->get_field_name( 'option_show_course_desc' ); ?>"
                       type="checkbox" <?php echo $option_show_course_desc; ?> /> <?php _e( 'Show Course Description', 'wp-courseware' ); ?><br/>
                <input id="<?php echo $this->get_field_id( 'option_show_module_desc' ); ?>" name="<?php echo $this->get_field_name( 'option_show_module_desc' ); ?>"
                       type="checkbox" <?php echo $option_show_module_desc; ?> /> <?php _e( 'Show Module Descriptions', 'wp-courseware' ); ?><br/>
                <input id="<?php echo $this->get_field_id( 'option_show_only_on_units' ); ?>" name="<?php echo $this->get_field_name( 'option_show_only_on_units' ); ?>"
                       type="checkbox" <?php echo $option_show_only_on_units; ?> /> <?php _e( 'Only display this widget when showing a course unit', 'wp-courseware' ); ?>
            </p>
			<?php
		}
public function form ( $ instance ) { if ( $ instance ) { $ title = esc_attr ( $ instance [ 'title' ] ) ; } else { $ title = __ ( 'Current User Progress' , 'wp-courseware' ) ; } $ option_course = esc_attr ( WPCW_arrays_getValue ( $ instance , 'option_course' ) ) ; $ option_module = esc_attr ( WPCW_arrays_getValue ( $ instance , 'option_module' ) ) ; $ option_show_course_title = ( WPCW_arrays_getValue ( $ instance , 'option_show_course_title' ) == 'on' ? 'checked="checked"' : '' ) ; $ option_show_course_desc = ( WPCW_arrays_getValue ( $ instance , 'option_show_course_desc' ) == 'on' ? 'checked="checked"' : '' ) ; $ option_show_module_desc = ( WPCW_arrays_getValue ( $ instance , 'option_show_module_desc' ) == 'on' ? 'checked="checked"' : '' ) ; $ option_show_only_on_units = ( WPCW_arrays_getValue ( $ instance , 'option_show_only_on_units' ) == 'on' ? 'checked="checked"' : '' ) ; $ option_toggle_modules = esc_attr ( WPCW_arrays_getValue ( $ instance , 'option_toggle_modules' ) ) ; $ option_show_modules_previous = esc_attr ( WPCW_arrays_getValue ( $ instance , 'option_show_modules_previous' ) ) ; $ option_show_modules_next = esc_attr ( WPCW_arrays_getValue ( $ instance , 'option_show_modules_next' ) ) ; $ optionsList_previous = array ( 'all' => __ ( 'All previous modules' , 'wp-courseware' ) , 'none' => __ ( 'None' , 'wp-courseware' ) , ) ; for ( $ i = 1 ; $ i <= 20 ; $ i ++ ) { $ optionsList_previous [ $ i ] = sprintf ( _n ( 'Show just 1 previous module' , 'Show %d previous modules' , $ i , 'wp-courseware' ) , $ i ) ; } $ optionsList_next = array ( 'all' => __ ( 'All subsequent modules' , 'wp-courseware' ) , 'none' => __ ( 'None' , 'wp-courseware' ) , ) ; for ( $ i = 1 ; $ i <= 20 ; $ i ++ ) { $ optionsList_next [ $ i ] = sprintf ( _n ( 'Show just 1 subsequent module' , 'Show %d subsequent modules' , $ i , 'wp-courseware' ) , $ i ) ; } ?> <p>
                <b><label for=" <?php echo $ this -> get_field_id ( 'title' ) ; ?> "> <?php _e ( 'Title:' , 'wp-courseware' ) ; ?> </label></b>
                <input class="widefat" id=" <?php echo $ this -> get_field_id ( 'title' ) ; ?> " name=" <?php echo $ this -> get_field_name ( 'title' ) ; ?> " type="text" value=" <?php echo $ title ; ?> "/>
                <small> <?php _e ( '(Optional) Leave blank for no title.' , 'wp-courseware' ) ; ?> </small>
            </p>

            <p>
                <b style="display: block; padding-bottom: 3px;"><label for=" <?php echo $ this -> get_field_id ( 'option_course' ) ; ?> "> <?php _e ( 'Course To Show:' , 'wp-courseware' ) ; ?> </label></b>
				 <?php $ courseList = array ( '' => __ ( '-- Select a Training Course --' , 'wp-courseware' ) , 'current' => __ ( " Show User's Current Course " , 'wp-courseware' ) , ) ; $ mainCourseList = WPCW_courses_getCourseList ( ) ; if ( $ mainCourseList ) { $ courseList = $ courseList + $ mainCourseList ; } echo WPCW_CourseProgress :: createDropdown ( $ this -> get_field_name ( 'option_course' ) , $ courseList , $ option_course , $ this -> get_field_id ( 'option_course' ) ) ; ?> <br/>
                <small> <?php _e ( '(Required) Choose whether to display a specific course to the user or to display the course associated with the unit that the user is currently viewing.' , 'wp-courseware' ) ; ?> </small>
            </p>

            <p>
                <b style="display: block; padding-bottom: 3px;"><label> <?php _e ( 'Show/Hide Modules:' , 'wp-courseware' ) ; ?> </label></b>
                <small> <?php _e ( 'Here you can control how many modules to show before and after the current module to save space.' , 'wp-courseware' ) ; ?> </small>
            </p>

            <table>
                <tr>
                    <td><label for=" <?php echo $ this -> get_field_id ( 'option_show_modules_previous' ) ; ?> "> <?php _e ( 'Previous modules to display:' , 'wp-courseware' ) ; ?> </label></td>
                    <td><label for=" <?php echo $ this -> get_field_id ( 'option_show_modules_next' ) ; ?> "> <?php _e ( 'Subsequent modules to display:' , 'wp-courseware' ) ; ?> </label></td>
                </tr>

                <tr>
                    <td>
						 <?php echo WPCW_CourseProgress :: createDropdown ( $ this -> get_field_name ( 'option_show_modules_previous' ) , $ optionsList_previous , $ option_show_modules_previous , $ this -> get_field_id ( 'option_show_modules_previous' ) ) ; ?> </td>

                    <td>
						 <?php echo WPCW_CourseProgress :: createDropdown ( $ this -> get_field_name ( 'option_show_modules_next' ) , $ optionsList_next , $ option_show_modules_next , $ this -> get_field_id ( 'option_show_modules_next' ) ) ; ?> </td>
                </tr>
            </table><br/>

            <p>
                <b style="display: block; padding-bottom: 3px;"><label
                            for=" <?php echo $ this -> get_field_id ( 'option_toggle_modules' ) ; ?> "> <?php _e ( 'Expand/Contract Modules:' , 'wp-courseware' ) ; ?> </label></b>
				 <?php echo WPCW_CourseProgress :: createDropdown ( $ this -> get_field_name ( 'option_toggle_modules' ) , array ( 'expand_all' => __ ( 'Expand all modules' , 'wp-courseware' ) , 'contract_all_but_current' => __ ( 'Contract all except current module' , 'wp-courseware' ) , 'contract_all' => __ ( 'Contract all modules' , 'wp-courseware' ) , ) , $ option_toggle_modules , $ this -> get_field_id ( 'option_toggle_modules' ) ) ; ?> <br/>
                <small> <?php _e ( 'You can save sidebar space by contracting  modules in the widget to just show the module title.' , 'wp-courseware' ) ; ?> </small>
            </p>

            <p>
                <b style="display: block; padding-bottom: 3px;"><label
                            for=" <?php echo $ this -> get_field_id ( 'option_show_module_desc' ) ; ?> "> <?php _e ( 'More Options:' , 'wp-courseware' ) ; ?> </label></b>
                <input id=" <?php echo $ this -> get_field_id ( 'option_show_course_title' ) ; ?> " name=" <?php echo $ this -> get_field_name ( 'option_show_course_title' ) ; ?> "
                       type="checkbox"  <?php echo $ option_show_course_title ; ?> />  <?php _e ( 'Show Course Title' , 'wp-courseware' ) ; ?> <br/>
                <input id=" <?php echo $ this -> get_field_id ( 'option_show_course_desc' ) ; ?> " name=" <?php echo $ this -> get_field_name ( 'option_show_course_desc' ) ; ?> "
                       type="checkbox"  <?php echo $ option_show_course_desc ; ?> />  <?php _e ( 'Show Course Description' , 'wp-courseware' ) ; ?> <br/>
                <input id=" <?php echo $ this -> get_field_id ( 'option_show_module_desc' ) ; ?> " name=" <?php echo $ this -> get_field_name ( 'option_show_module_desc' ) ; ?> "
                       type="checkbox"  <?php echo $ option_show_module_desc ; ?> />  <?php _e ( 'Show Module Descriptions' , 'wp-courseware' ) ; ?> <br/>

                <input id=" <?php echo $ this -> get_field_id ( 'option_show_only_on_units' ) ; ?> " name=" <?php echo $ this -> get_field_name ( 'option_show_only_on_units' ) ; ?> "
                       type="checkbox"  <?php echo $ option_show_only_on_units ; ?> />  <?php _e ( 'Only display this widget when showing a course unit' , 'wp-courseware' ) ; ?> </p>
			 <?php }
Shows the configuration form for the widget.
Shows the configuration form for the widget .
// Create a default title if there is one. // Module visibility Toggling // Generate dropdowns for the previous/next options // Blend lists together