public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/quiz/random.php
/**
		 * Fetch all questions for the selected tags, with no limitatons. Ordered by question ID.
		 *
		 * @param Array $tagDetails The list of tag details that we want to use.
		 *
		 * @return Array The list of questions.
		 */
Fetch all questions for the selected tags, with no limitatons. Ordered by question ID.
@param Array $tagDetails The list of tag details that we want to use.

@return Array The list of questions.
Fetch all questions for the selected tags with no limitatons . Ordered by question ID . @param Array $tagDetails The list of tag details that we want to use . @return Array The list of questions .
public static function questionSelection_getAllQuestionsFromTags( $tagDetails ) {
			$questionsToUse = array();
			if ( ! empty( $tagDetails ) ) {
				global $wpcwdb, $wpdb;
				$wpdb->show_errors();
				foreach ( $tagDetails as $singleTag => $singleTagDetails ) {
					$questionList = false;
					if ( 'whole_pool' == $singleTag ) {
						$questionList = $wpdb->get_results( "
						SELECT qq.question_id, qq.question_type, qq.question_question
						FROM $wpcwdb->quiz_qs qq
						WHERE question_type != 'random_selection'
						ORDER BY qq.question_id
					" );
					} 
					else {
						$questionList = $wpdb->get_results( $wpdb->prepare( "
						SELECT qq.question_id, qq.question_type, qq.question_question
						FROM $wpcwdb->quiz_qs qq
							LEFT JOIN $wpcwdb->question_tag_mapping qtm ON qtm.question_id = qq.question_id
						WHERE tag_id = %d
						 AND question_type != 'random_selection'
						ORDER BY qq.question_id
					", $singleTagDetails['tag_id'] ) );
					}
					if ( ! empty( $questionList ) ) {
						foreach ( $questionList as $questionDetails ) {
							$questionsToUse[ $questionDetails->question_id ] = $questionDetails;
						}
					}
				} 
			} 
			return $questionsToUse;
		}
public static function questionSelection_getAllQuestionsFromTags ( $ tagDetails ) { $ questionsToUse = array ( ) ; if ( ! empty ( $ tagDetails ) ) { global $ wpcwdb , $ wpdb ; $ wpdb -> show_errors ( ) ; foreach ( $ tagDetails as $ singleTag => $ singleTagDetails ) { $ questionList = false ; if ( 'whole_pool' == $ singleTag ) { $ questionList = $ wpdb -> get_results ( " 
						SELECT qq.question_id, qq.question_type, qq.question_question
						FROM  $ wpcwdb -> quiz_qs  qq
						WHERE question_type != 'random_selection'
						ORDER BY qq.question_id
					 " ) ; } else { $ questionList = $ wpdb -> get_results ( $ wpdb -> prepare ( " 
						SELECT qq.question_id, qq.question_type, qq.question_question
						FROM  $ wpcwdb -> quiz_qs  qq
							LEFT JOIN  $ wpcwdb -> question_tag_mapping  qtm ON qtm.question_id = qq.question_id
						WHERE tag_id = %d
						 AND question_type != 'random_selection'
						ORDER BY qq.question_id
					 " , $ singleTagDetails [ 'tag_id' ] ) ) ; } if ( ! empty ( $ questionList ) ) { foreach ( $ questionList as $ questionDetails ) { $ questionsToUse [ $ questionDetails -> question_id ] = $ questionDetails ; } } } } return $ questionsToUse ; }
Fetch all questions for the selected tags, with no limitatons.
Fetch all questions for the selected tags with no limitatons .
// Got a whole pool tag // Just get all questions in the pool. // Got a single tag // Get the questions that have the specified tag. // Got some questions in this selection, so add to the main list. // Using question ID, so that any duplicate questions get unified // by using the same question key. // end foreach // end if we have tag details.