public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/classes/export.php
/**
		 * Exports the course object, breaking down the course, modules and units.
		 *
		 * @param Array $courseDetails The object containing the course details.
		 * @param Array $moduleList The object containing the modules and units for this course.
		 * @param Array $questionList The list of ALL questions for this course.
		 *
		 * @return String The XML that represents this course.
		 */
Exports the course object, breaking down the course, modules and units.
@param Array $courseDetails The object containing the course details.
@param Array $moduleList The object containing the modules and units for this course.
@param Array $questionList The list of ALL questions for this course.

@return String The XML that represents this course.
Exports the course object breaking down the course modules and units . @param Array $courseDetails The object containing the course details . @param Array $moduleList The object containing the modules and units for this course . @param Array $questionList The list of ALL questions for this course . @return String The XML that represents this course .
public function exportCourseDetails( $courseDetails, $moduleList, $questionList ) {
			$xml = "";
			$this->questionList = $questionList;
			global $fieldsToProcess_course, $fieldsToProcess_modules, $fieldsToProcess_units;
			$padding    = $this->export_indent( false );
			$parentNode = 'course';
			$xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
			$xml .= $padding . sprintf( '<%s version="%s">', $parentNode, WPCW_DATABASE_VERSION );
			$xml .= $this->export_objectToXML( 'settings', false, $courseDetails, $fieldsToProcess_course, false );
			if ( ! empty( $this->questionList ) ) {
				$xml .= $this->export_startBlock( false, 'questions' );
				$xml .= $this->export_content_handleQuestionsAndTags();
				$xml .= $this->export_endBlock( false, 'questions' );
			}
			if ( ! empty( $moduleList ) ) {
				$xml .= $this->export_startBlock( false, 'modules' );
				foreach ( $moduleList as $moduleID => $moduleObj ) {
					$parentPath = 'modules';
					$xml .= $this->export_objectToXML( 'module', false, $moduleObj, $fieldsToProcess_modules, $parentPath, false );
					if ( isset( $moduleObj->units ) && ! empty( $moduleObj->units ) ) {
						$unitParentPath = $parentPath . '/module';
						$xml            .= $this->export_startBlock( $unitParentPath, 'units' );
						foreach ( $moduleObj->units as $unitObj ) {
							$unitObj->template = get_post_meta( $unitObj->ID, WPCW_TEMPLATE_META_ID, true ); 
							$unitMeta = WPCW_units_getUnitMetaData( $unitObj->ID );
							if ( ! empty ( $unitMeta ) ) {
								$unitObj->unit_drip_type          = isset( $unitMeta->unit_drip_type ) ? $unitMeta->unit_drip_type : '';
								$unitObj->unit_drip_date          = isset( $unitMeta->unit_drip_date ) ? $unitMeta->unit_drip_date : '';
								$unitObj->unit_drip_interval      = isset( $unitMeta->unit_drip_interval ) ? $unitMeta->unit_drip_interval : '';
								$unitObj->unit_drip_interval_type = isset( $unitMeta->unit_drip_interval_type ) ? $unitMeta->unit_drip_interval_type : '';
								$unitObj->unit_drip_date_ts       = isset( $unitMeta->unit_drip_date_ts ) ? $unitMeta->unit_drip_date_ts : '';
							}
							$xml .= $this->export_objectToXML( 'unit', false, $unitObj, $fieldsToProcess_units, $unitParentPath, false );
							$xml .= $this->export_content_handleQuizzes( $unitObj, $unitParentPath . '/unit' );
							$xml .= $this->export_endBlock( $unitParentPath, 'unit' );
						}
						$xml .= $this->export_endBlock( $unitParentPath, 'units' );
					}
					$xml .= $this->export_endBlock( $parentPath, 'module' );
				}
				$xml .= $this->export_endBlock( false, 'modules' );
			}
			$xml .= "$padding</$parentNode>";
			return $xml;
		}
public function exportCourseDetails ( $ courseDetails , $ moduleList , $ questionList ) { $ xml = " " ; $ this -> questionList = $ questionList ; global $ fieldsToProcess_course , $ fieldsToProcess_modules , $ fieldsToProcess_units ; $ padding = $ this -> export_indent ( false ) ; $ parentNode = 'course' ; $ xml = " <?xml version= \" 1.0 \"  encoding= \" UTF-8 \" ?> " ; $ xml .= $ padding . sprintf ( '<%s version="%s">' , $ parentNode , WPCW_DATABASE_VERSION ) ; $ xml .= $ this -> export_objectToXML ( 'settings' , false , $ courseDetails , $ fieldsToProcess_course , false ) ; if ( ! empty ( $ this -> questionList ) ) { $ xml .= $ this -> export_startBlock ( false , 'questions' ) ; $ xml .= $ this -> export_content_handleQuestionsAndTags ( ) ; $ xml .= $ this -> export_endBlock ( false , 'questions' ) ; } if ( ! empty ( $ moduleList ) ) { $ xml .= $ this -> export_startBlock ( false , 'modules' ) ; foreach ( $ moduleList as $ moduleID => $ moduleObj ) { $ parentPath = 'modules' ; $ xml .= $ this -> export_objectToXML ( 'module' , false , $ moduleObj , $ fieldsToProcess_modules , $ parentPath , false ) ; if ( isset ( $ moduleObj -> units ) && ! empty ( $ moduleObj -> units ) ) { $ unitParentPath = $ parentPath . '/module' ; $ xml .= $ this -> export_startBlock ( $ unitParentPath , 'units' ) ; foreach ( $ moduleObj -> units as $ unitObj ) { $ unitObj -> template = get_post_meta ( $ unitObj -> ID , WPCW_TEMPLATE_META_ID , true ) ; $ unitMeta = WPCW_units_getUnitMetaData ( $ unitObj -> ID ) ; if ( ! empty ( $ unitMeta ) ) { $ unitObj -> unit_drip_type = isset ( $ unitMeta -> unit_drip_type ) ? $ unitMeta -> unit_drip_type : '' ; $ unitObj -> unit_drip_date = isset ( $ unitMeta -> unit_drip_date ) ? $ unitMeta -> unit_drip_date : '' ; $ unitObj -> unit_drip_interval = isset ( $ unitMeta -> unit_drip_interval ) ? $ unitMeta -> unit_drip_interval : '' ; $ unitObj -> unit_drip_interval_type = isset ( $ unitMeta -> unit_drip_interval_type ) ? $ unitMeta -> unit_drip_interval_type : '' ; $ unitObj -> unit_drip_date_ts = isset ( $ unitMeta -> unit_drip_date_ts ) ? $ unitMeta -> unit_drip_date_ts : '' ; } $ xml .= $ this -> export_objectToXML ( 'unit' , false , $ unitObj , $ fieldsToProcess_units , $ unitParentPath , false ) ; $ xml .= $ this -> export_content_handleQuizzes ( $ unitObj , $ unitParentPath . '/unit' ) ; $ xml .= $ this -> export_endBlock ( $ unitParentPath , 'unit' ) ; } $ xml .= $ this -> export_endBlock ( $ unitParentPath , 'units' ) ; } $ xml .= $ this -> export_endBlock ( $ parentPath , 'module' ) ; } $ xml .= $ this -> export_endBlock ( false , 'modules' ) ; } $ xml .= " $ padding </ $ parentNode > " ; return $ xml ; }
Exports the course object, breaking down the course, modules and units.
Exports the course object breaking down the course modules and units .
// Nice whitespace padding to make XML readable. // Debugging only - see if we have any missing fields from export checking the above. // Check error_log for the results of this function - to see which fields are not included // in the export. //$this->debug_courseCheckFieldsWeHave($courseDetails, $fieldsToProcess_course); // Export settings for course itself. // #### Add Questions First // Add Module Details // Render each module as modules > module > details // Export main module data // Export unit data for this module, mostly just content. The IDs, post date, etc can be ignored. // The ordering is assumed to be the order of the data in the file, so again, that can be ignored. // This makes the XML as simple as possible, making it flexible for the future as possible. // ###Units - Start //Include template for unit // Export the quizzes for this unit // ###Units - End // Finally add closing tag for this module // Close parent tag