public/wordpress/wp-content/plugins/wp-courseware/includes/legacy/functions.php
/**
 * Get the associated quiz for a unit.
 *
 * @since 1.0.0
 *
 * @param integer $unitID The ID of the unit to get the associated quiz for.
 * @param boolean $resolveRandomQuestions If true, convert any randomised questions to live questions.
 * @param integer $userID The ID of the user to resolve the questions to.
 *
 * @return object The Object of the associated quiz, or false if no quiz found.
 */
Get the associated quiz for a unit.

@param integer $unitID The ID of the unit to get the associated quiz for.
@param boolean $resolveRandomQuestions If true, convert any randomised questions to live questions.
@param integer $userID The ID of the user to resolve the questions to.

@return object The Object of the associated quiz, or false if no quiz found.
Get the associated quiz for a unit . @param integer $unitID The ID of the unit to get the associated quiz for . @param boolean $resolveRandomQuestions If true convert any randomised questions to live questions . @param integer $userID The ID of the user to resolve the questions to . @return object The Object of the associated quiz or false if no quiz found .
function WPCW_quizzes_getAssociatedQuizForUnit( $unitID, $resolveRandomQuestions = false, $userID ) {
	if ( ! $unitID ) {
		return false;
	}
	global $wpcwdb, $wpdb;
	$wpdb->show_errors();
	$SQL = $wpdb->prepare( "
			SELECT quiz_id
			FROM $wpcwdb->quiz
			WHERE parent_unit_id = %d
			", $unitID );
	$quizObj = $wpdb->get_row( $SQL );
	if ( ! $quizObj ) {
		return false;
	}
	return WPCW_quizzes_getQuizDetails( $quizObj->quiz_id, true, $resolveRandomQuestions, $userID );
}
function WPCW_quizzes_getAssociatedQuizForUnit ( $ unitID , $ resolveRandomQuestions = false , $ userID ) { if ( ! $ unitID ) { return false ; } global $ wpcwdb , $ wpdb ; $ wpdb -> show_errors ( ) ; $ SQL = $ wpdb -> prepare ( " 
			SELECT quiz_id
			FROM  $ wpcwdb -> quiz 
			WHERE parent_unit_id = %d
			 " , $ unitID ) ; $ quizObj = $ wpdb -> get_row ( $ SQL ) ; if ( ! $ quizObj ) { return false ; } return WPCW_quizzes_getQuizDetails ( $ quizObj -> quiz_id , true , $ resolveRandomQuestions , $ userID ) ; }
Get the associated quiz for a unit.
Get the associated quiz for a unit .
// Return full details for this quiz