public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/classes/import.php
/**
		 * Loads the data needed to create the questions.
		 */
Loads the data needed to create the questions.
Loads the data needed to create the questions .
private function loadQuestionData() {
			if ( ! isset( $this->xml->questions ) && ! isset( $this->xml->questions->question[0] ) ) {
				return false;
			}
			$questionData = array();
			foreach ( $this->xml->questions->question as $singleQuestion ) {
				$rawData = $this->loadQuestionData_fullData( $singleQuestion );
				if ( ! empty( $rawData ) && $hashID = WPCW_arrays_getValue( $rawData, 'question_hash' ) ) {
					unset( $rawData['question_hash'] );
					$questionID = $this->loadQuestionData_addQuestionToDatabase( $rawData );
					if ( $questionID > 0 ) {
						$questionData[ $hashID ] = $questionID;
					}
				} 
			} 
			return $questionData;
		}
private function loadQuestionData ( ) { if ( ! isset ( $ this -> xml -> questions ) && ! isset ( $ this -> xml -> questions -> question [ 0 ] ) ) { return false ; } $ questionData = array ( ) ; foreach ( $ this -> xml -> questions -> question as $ singleQuestion ) { $ rawData = $ this -> loadQuestionData_fullData ( $ singleQuestion ) ; if ( ! empty ( $ rawData ) && $ hashID = WPCW_arrays_getValue ( $ rawData , 'question_hash' ) ) { unset ( $ rawData [ 'question_hash' ] ) ; $ questionID = $ this -> loadQuestionData_addQuestionToDatabase ( $ rawData ) ; if ( $ questionID > 0 ) { $ questionData [ $ hashID ] = $ questionID ; } } } return $ questionData ; }
Loads the data needed to create the questions.
Loads the data needed to create the questions .
// Need at least 1 module to continue. // Questions will contain a hash ID which we will match up in the quizzes later. // Extract the raw details from the XML to use // Need the raw hash ID to allow us to do mappings. // Don't add raw hash to database // Add the details to the database // Database insert worked, so now add the DB ID to the hash in our list. // end if there's any raw data. // end foreach