public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/classes/coursemap.php
/**
		 * Prepare the internal lists of details based on what course we've got
		 * to create an ordered list of modules and units.
		 */
Prepare the internal lists of details based on what course we've got
to create an ordered list of modules and units.
Prepare the internal lists of details based on what course we ' ve got to create an ordered list of modules and units .
public function loadUnitsForCourse() {
			if ( ! $this->courseDetails ) {
				return false;
			}
			global $wpcwdb, $wpdb;
			$wpdb->show_errors();
			$this->moduleList   = array();
			$this->unitList     = array();
			$this->completeList = array();
			$moduleList = $wpdb->get_results( $wpdb->prepare( "
			SELECT *
			FROM $wpcwdb->modules
			WHERE parent_course_id = %d
			ORDER BY module_order, module_title ASC
			", $this->courseDetails->course_id ) );
			if ( ! empty( $moduleList ) ) {
				$previousModule = false;
				foreach ( $moduleList as $moduleDetails ) {
					$this->moduleList[ $moduleDetails->module_id ] = $moduleDetails;
					$unitList = $wpdb->get_results( $wpdb->prepare( "
					SELECT *
					FROM $wpcwdb->units_meta
					WHERE parent_course_id = %d
					  AND parent_module_id = %d
					ORDER BY unit_order ASC
				", $this->courseDetails->course_id, $moduleDetails->module_id ) );
					$unitSublist = array();
					if ( ! empty( $unitList ) ) {
						foreach ( $unitList as $unitObj ) {
							$this->unitList[ $unitObj->unit_id ] = $unitObj;
							$unitSublist[ $unitObj->unit_id ] = $unitObj;
						}
					}
					$this->completeList[ $moduleDetails->module_id ] = array(
						'units'    => $unitSublist,
						'details'  => $moduleDetails,
						'previous' => $previousModule,
					);
					$previousModule = $moduleDetails->module_id;
				} 
			} 
		}
public function loadUnitsForCourse ( ) { if ( ! $ this -> courseDetails ) { return false ; } global $ wpcwdb , $ wpdb ; $ wpdb -> show_errors ( ) ; $ this -> moduleList = array ( ) ; $ this -> unitList = array ( ) ; $ this -> completeList = array ( ) ; $ moduleList = $ wpdb -> get_results ( $ wpdb -> prepare ( " 
			SELECT *
			FROM  $ wpcwdb -> modules 
			WHERE parent_course_id = %d
			ORDER BY module_order, module_title ASC
			 " , $ this -> courseDetails -> course_id ) ) ; if ( ! empty ( $ moduleList ) ) { $ previousModule = false ; foreach ( $ moduleList as $ moduleDetails ) { $ this -> moduleList [ $ moduleDetails -> module_id ] = $ moduleDetails ; $ unitList = $ wpdb -> get_results ( $ wpdb -> prepare ( " 
					SELECT *
					FROM  $ wpcwdb -> units_meta 
					WHERE parent_course_id = %d
					  AND parent_module_id = %d
					ORDER BY unit_order ASC
				 " , $ this -> courseDetails -> course_id , $ moduleDetails -> module_id ) ) ; $ unitSublist = array ( ) ; if ( ! empty ( $ unitList ) ) { foreach ( $ unitList as $ unitObj ) { $ this -> unitList [ $ unitObj -> unit_id ] = $ unitObj ; $ unitSublist [ $ unitObj -> unit_id ] = $ unitObj ; } } $ this -> completeList [ $ moduleDetails -> module_id ] = array ( 'units' => $ unitSublist , 'details' => $ moduleDetails , 'previous' => $ previousModule , ) ; $ previousModule = $ moduleDetails -> module_id ; } } }
Prepare the internal lists of details based on what course we've got
 to create an ordered list of modules and units.
Prepare the internal lists of details based on what course we ' ve got to create an ordered list of modules and units .
// Can't do anything. There are no course details. // Get a list of all modules, in order. // Module added with ID => Details // Now get the units for this module. // Unit added with ID => Details // Unit added with ID => Details // Creating a list of modules and their units in the detailed list // Store previous module for nav. // end of module loop // end of module list check