public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/classes/import.php
/**
		 * Try to add this specific question to the database (to the pool).
		 *
		 * @param Array $singleQuestionData Specific question data to add.
		 *
		 * @return Integer The ID of the newly inserted question ID, or false if it wasn't added.
		 */
Try to add this specific question to the database (to the pool).
@param Array $singleQuestionData Specific question data to add.

@return Integer The ID of the newly inserted question ID, or false if it wasn't added.
Try to add this specific question to the database ( to the pool ) . @param Array $singleQuestionData Specific question data to add . @return Integer The ID of the newly inserted question ID or false if it wasn ' t added .
private function loadQuestionData_addQuestionToDatabase( $singleQuestionData ) {
			if ( ! $singleQuestionData || empty( $singleQuestionData ) ) {
				return false;
			}
			global $wpdb, $wpcwdb;
			$wpdb->show_errors();
			$questionDetailsToAdd = $singleQuestionData;
			$question_order = WPCW_arrays_getValue( $singleQuestionData, 'question_order' );
			unset( $questionDetailsToAdd['question_order'] );
			$questionDetailsToAdd['question_data_answers'] = false;
			if ( ! empty( $singleQuestionData['question_data_answers'] ) ) {
				$questionDetailsToAdd['question_data_answers'] = serialize( $singleQuestionData['question_data_answers'] );
			}
			$tagList = array();
			if ( isset( $questionDetailsToAdd['tags'] ) ) {
				$tagList = $questionDetailsToAdd['tags'];
			}
			unset( $questionDetailsToAdd['tags'] );
			$queryResult = $wpdb->query( arrayToSQLInsert( $wpcwdb->quiz_qs, $questionDetailsToAdd ) );
			$currentQuestionID = $wpdb->insert_id;
			if ( $queryResult === false ) {
				$this->errorList[] = __( 'There was a problem adding the question into the database.', 'wp-courseware' );
				return false;
			}
			WPCW_questions_tags_addTags( $currentQuestionID, $tagList );
			return $currentQuestionID;
		}
private function loadQuestionData_addQuestionToDatabase ( $ singleQuestionData ) { if ( ! $ singleQuestionData || empty ( $ singleQuestionData ) ) { return false ; } global $ wpdb , $ wpcwdb ; $ wpdb -> show_errors ( ) ; $ questionDetailsToAdd = $ singleQuestionData ; $ question_order = WPCW_arrays_getValue ( $ singleQuestionData , 'question_order' ) ; unset ( $ questionDetailsToAdd [ 'question_order' ] ) ; $ questionDetailsToAdd [ 'question_data_answers' ] = false ; if ( ! empty ( $ singleQuestionData [ 'question_data_answers' ] ) ) { $ questionDetailsToAdd [ 'question_data_answers' ] = serialize ( $ singleQuestionData [ 'question_data_answers' ] ) ; } $ tagList = array ( ) ; if ( isset ( $ questionDetailsToAdd [ 'tags' ] ) ) { $ tagList = $ questionDetailsToAdd [ 'tags' ] ; } unset ( $ questionDetailsToAdd [ 'tags' ] ) ; $ queryResult = $ wpdb -> query ( arrayToSQLInsert ( $ wpcwdb -> quiz_qs , $ questionDetailsToAdd ) ) ; $ currentQuestionID = $ wpdb -> insert_id ; if ( $ queryResult === false ) { $ this -> errorList [ ] = __ ( 'There was a problem adding the question into the database.' , 'wp-courseware' ) ; return false ; } WPCW_questions_tags_addTags ( $ currentQuestionID , $ tagList ) ; return $ currentQuestionID ; }
Try to add this specific question to the database (to the pool).
Try to add this specific question to the database ( to the pool ) .
// ### 1 - Initialise data to be added for question. // ### 2 - Need to strip out question order, as there is no question_order field // in the database, so we need to use it in the mappings data. // ### 3 - Handle the insert of the special arrays that need serialising. We know these exist // as we have specifically validated them. // ### 4 - Extract tags from the question data so that we can insert the question into //		   the database without any errors. // ### 5 - Insert details of this particular question into the database. // ### 6 - Store the ID of the newly inserted ID, we'll need it for associating tags. // ### 7 - Check query succeeded. // ### 8 - Now we create the tag associations.