Skip to content

Commit

Permalink
Merge pull request #2503 from QuizandSurveyMaster/dev-zubair
Browse files Browse the repository at this point in the history
added advanced assessment promotional popup
  • Loading branch information
zubairraeen authored Mar 21, 2024
2 parents fceada7 + 5aa52d1 commit 879434c
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 67 deletions.
6 changes: 6 additions & 0 deletions js/qsm-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3890,6 +3890,9 @@ var import_button;
jQuery(document).on('click', '.qsm-mark-as-default', function () {
jQuery('.qsm-mark-as-default').not(jQuery(this)).prop('checked', false);
})
jQuery(document).on('click', '.qsm-upgrade-popup-advanced-assessment-variable', function () {
MicroModal.show('modal-advanced-assessment');
});
function qsmHandleConditionChange(containerClass, extraCategoryClass, operatorClass, criteriaClass, defaultValueClass) {
jQuery(document).on('change', '.' + containerClass + '-category', function () {
let container = jQuery(this).closest('.' + containerClass);
Expand Down Expand Up @@ -3918,6 +3921,9 @@ var import_button;
container.find('.' + operatorClass + ' option').hide().prop("selected", true);
container.find('.' + operatorClass + ' option.default_operator').show().prop("selected", true);
container.find('option.qsm-score-criteria').show();
} else if ('option-pro' == jQuery(this).val() || 'label-pro' == jQuery(this).val()) {
jQuery(this).val('quiz');
MicroModal.show('modal-advanced-assessment');
}
});
}
Expand Down
7 changes: 5 additions & 2 deletions mlw_quizmaster2.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Plugin Name: Quiz And Survey Master
* Description: Easily and quickly add quizzes and surveys to your website.
* Version: 8.2.3
* Version: 9.0.0
* Author: ExpressTech
* Author URI: https://quizandsurveymaster.com/
* Plugin URI: https://expresstech.io/
Expand Down Expand Up @@ -43,7 +43,7 @@ class MLWQuizMasterNext {
* @var string
* @since 4.0.0
*/
public $version = '8.2.3';
public $version = '9.0.0';

/**
* QSM Alert Manager Object
Expand Down Expand Up @@ -650,6 +650,9 @@ public function setup_admin_menu() {
add_submenu_page( 'qsm_dashboard', __( 'Addon Settings', 'quiz-master-next' ), '<span style="color:#f39c12;">' . __( 'Addons', 'quiz-master-next' ) . '</span>', 'moderate_comments', 'qmn_addons', 'qmn_addons_page' );
add_submenu_page( 'qsm_dashboard', __( 'Get a Free Addon', 'quiz-master-next' ), '<span style="color:#f39c12;">' . esc_html__( 'Get a Free Addon!', 'quiz-master-next' ) . '</span>', 'moderate_comments', 'qsm-free-addon', 'qsm_display_optin_page' );
add_submenu_page( 'qsm_dashboard', __( 'About', 'quiz-master-next' ), __( 'About', 'quiz-master-next' ), 'moderate_comments', 'qsm_quiz_about', 'qsm_generate_about_page' );
if ( ! class_exists( 'QSM_Advanced_Assessment' ) ) {
add_submenu_page( 'qsm_dashboard', __( 'Answer Labels', 'quiz-master-next' ), __( 'Answer Labels', 'quiz-master-next' ), 'manage_options', 'qsm-answer-label', 'qsm_advanced_assessment_quiz_page_content', 3 );
}
// Register screen option for dashboard page
add_action( 'screen_settings', 'qsm_dashboard_screen_options', 10, 2 );
}
Expand Down
47 changes: 33 additions & 14 deletions php/admin/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1421,13 +1421,9 @@ function qsm_extra_template_and_leaderboard( $variable_list ) {
'%CATEGORY_PERCENTAGE_X%' => __('X:Category Name - This variable displays the percentage of any selected category out of the total quiz score.', 'quiz-master-next'),
'%COUNT_UNATTEMPTED%' => __('This variable displays the total number of questions not attempted or not counted by the user.', 'quiz-master-next'),
);
if ( version_compare( $mlwQuizMasterNext->version, '7.3.4', '>' ) ) {
$extra_variables = array(
'Extra Template Variables' => $template_array,
);
} else {
$extra_variables = $template_array;
}
$extra_variables = array(
'Extra Template Variables' => $template_array,
);
$variable_list = array_merge($variable_list, $extra_variables);
}
if ( ! class_exists('Mlw_Qmn_Al_Widget') ) {
Expand All @@ -1437,15 +1433,23 @@ function qsm_extra_template_and_leaderboard( $variable_list ) {
'%LEADERBOARD_POSITION_URL%' => __('Display Leaderboard URL to check position.', 'quiz-master-next' ),
);

if ( version_compare( $mlwQuizMasterNext->version, '7.3.4', '>' ) ) {
$leaderboard = array(
'Advanced Leaderboard' => $template_array,
);
} else {
$extra_variables = $template_array;
}
$leaderboard = array(
'Advanced Leaderboard' => $template_array,
);
$variable_list = array_merge($variable_list, $leaderboard );
}
if ( ! class_exists('QSM_Advanced_Assessment') ) {
$template_array = array(
'%ANSWER_LABEL_POINTS%' => __( 'The amount of points of all labels earned.', 'quiz-master-next' ),
'%ANSWER_LABEL_POINTS_X%' => __( 'X: Answer label slug - The amount of points a specific label earned.', 'quiz-master-next' ),
'%ANSWER_LABEL_COUNTS%' => __( 'The amount of counts of all labels earned.', 'quiz-master-next' ),
'%ANSWER_LABEL_COUNTS_X%' => __( 'X: Answer label slug - The amount of counts a specific label earned.', 'quiz-master-next' ),
);
$advanced_assessment = array(
'Advanced Assessment' => $template_array,
);
$variable_list = array_merge( $variable_list, $advanced_assessment );
}
return $variable_list;
}
/**
Expand Down Expand Up @@ -1540,4 +1544,19 @@ function qsm_get_input_label_selected( $param ) {
esc_attr( $param['name'] ),
wp_kses( $options ,$allowed_tags)
);
}
function qsm_advanced_assessment_quiz_page_content() {
$args = array(
"id" => 'advanced-assessment',
"title" => __( 'Advanced Assessment', 'quiz-master-next' ),
"description" => __( 'Create assessments with ease using Advanced Assessment. With features like label assignment, personalized results, and insightful data visualization, you can engage your audience effectively.', 'quiz-master-next' ),
"chart_image" => plugins_url( '', dirname( __FILE__ ) ) . '/images/advance-assessment-chart.png',
"warning" => __( 'Missing Feature - Advanced Assessment Add-on required', 'quiz-master-next' ),
"information" => __( 'Get all our add-ons at a discounted rate with the QSM Addon Bundle and save up to 95% today! Alternatively, you can also purchase the Advanced Assessment Addon separately.', 'quiz-master-next' ),
"buy_btn_text" => __( 'Buy Quiz Advanced Assessment', 'quiz-master-next' ),
"doc_link" => qsm_get_plugin_link( 'docs/add-ons/advanced-assessment', 'quiz-documentation', 'plugin', 'advanced-assessment', 'qsm_plugin_upsell' ),
"upgrade_link" => qsm_get_plugin_link( 'pricing', 'quiz-documentation', 'plugin', 'advanced-assessment', 'qsm_plugin_upsell' ),
"addon_link" => qsm_get_plugin_link( 'downloads/advanced-assessment', 'quiz-documentation', 'plugin', 'advanced-assessment', 'qsm_plugin_upsell' ),
);
qsm_admin_upgrade_content( $args, 'page' );
}
49 changes: 33 additions & 16 deletions php/admin/options-page-email-tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,27 @@ function qsm_options_emails_tab_content() {
$upgrade_link = "";$variable = "";
$tooltip = '';
if ( ( ! class_exists( 'QSM_Extra_Variables' ) ) && ( 'Extra Template Variables' == $category_name ) ) {
$upgrade_link = qsm_get_plugin_link( 'extra-template-variables' );
$upgrade_link = qsm_get_plugin_link('extra-template-variables');
$classname = "qsm-upgrade-popup-variable";
$qsm_badge = "<a href =".$upgrade_link." target='_blank' class='qsm-upgrade-popup-badge'>".esc_html__( 'PRO', 'quiz-master-next' )."</a>";

}
if ( ( ! class_exists( 'Mlw_Qmn_Al_Widget' ) ) && ( 'Advanced Leaderboard' == $category_name ) ) {
$upgrade_link = qsm_get_plugin_link( 'downloads/advanced-leaderboard/' );
$upgrade_link = qsm_get_plugin_link('downloads/advanced-leaderboard/');
$classname = "qsm-upgrade-popup-variable";
$qsm_badge = "<a href =".$upgrade_link." target='_blank' class='qsm-upgrade-popup-badge'>".esc_html__( 'PRO', 'quiz-master-next' )."</a>";

}
if ( ( ! class_exists( 'QSM_Analysis' ) ) && ( 'Analysis' == $category_name ) ) {
$upgrade_link = qsm_get_plugin_link('downloads/results-analysis/');
$classname = "qsm-upgrade-popup-variable";
$qsm_badge = "<a href =".$upgrade_link." target='_blank' class='qsm-upgrade-popup-badge'>".esc_html__( 'PRO', 'quiz-master-next' )."</a>";

}
if ( ( ! class_exists( 'QSM_Advanced_Assessment' ) ) && ( 'Advanced Assessment' == $category_name ) ) {
$upgrade_link = qsm_get_plugin_link( 'downloads/advanced-assessment/' );
$classname = "qsm-upgrade-popup-variable qsm-upgrade-popup-advanced-assessment-variable";
$qsm_badge = "<a href =".$upgrade_link." target='_blank' class='qsm-upgrade-popup-badge'>".esc_html__( 'PRO', 'quiz-master-next' )."</a>";
}
?>
<div><h2 class="qsm-upgrade-popup-category-name"><?php echo esc_attr( $category_name ); ?></h2><?php echo wp_kses_post( $qsm_badge ) ; ?></div>
Expand All @@ -115,19 +128,19 @@ function qsm_options_emails_tab_content() {
?>
<div class="popup-template-span-wrap">
<span class="qsm-text-template-span <?php echo esc_attr( $classname );?>">
<?php if ( ( ( ! class_exists( 'QSM_Extra_Variables' ) ) && ( 'Extra Template Variables' == $category_name ) ) || (( ! class_exists( 'Mlw_Qmn_Al_Widget' ) ) && ( 'Advanced Leaderboard' == $category_name )) ) {?>
<?php if ( str_contains( $classname, 'qsm-upgrade-popup-variable') ) {?>
<span class="button button-default template-variable qsm-tooltips-icon"><?php echo esc_attr( $variable_key ); ?>
<span class="qsm-tooltips qsm-upgrade-tooltip"><?php echo esc_html__( 'Available in pro', 'quiz-master-next' );?></span>
</span>
<?php } else { ?>
<span class="button button-default template-variable"><?php echo esc_attr( $variable_key ); ?></span>
<span class='button click-to-copy'>Click to Copy</span>
<span class="temp-var-seperator">
<span class="dashicons dashicons-editor-help qsm-tooltips-icon">
<span class="qsm-tooltips"><?php echo esc_attr( $variable ); ?></span>
</span>
</span>
<?php } ?>
<span class="qsm-tooltips qsm-upgrade-tooltip"><?php echo esc_html__( 'Available in pro', 'quiz-master-next' );?></span>
</span>
<?php } else { ?>
<span class="button button-default template-variable"><?php echo esc_attr( $variable_key ); ?></span>
<span class='button click-to-copy'>Click to Copy</span>
<span class="temp-var-seperator">
<span class="dashicons dashicons-editor-help qsm-tooltips-icon">
<span class="qsm-tooltips"><?php echo esc_attr( $variable ); ?></span>
</span>
</span>
<?php } ?>
</span>
</div>
<?php
Expand Down Expand Up @@ -252,8 +265,12 @@ function qsm_options_emails_tab_template() {
<option value="category" <# if (data.category == 'category' || jQuery.inArray(data.category, categories_array) !== -1 ) { #>selected<# } #>><?php esc_html_e( 'Category', 'quiz-master-next' ); ?></option>
<?php } else { ?>
<option disabled value=""><?php esc_html_e( 'No Categories Available', 'quiz-master-next' ); ?></option>
<?php } ?>
<?php do_action( 'qsm_email_page_condition_category' ); ?>
<?php }
if ( ! class_exists( 'QSM_Advanced_Assessment' ) ) { ?>
<option value="option-pro"><?php esc_html_e( 'Option (pro)', 'quiz-master-next' ); ?></option>
<option value="label-pro"><?php esc_html_e( 'Label (pro)', 'quiz-master-next' ); ?></option>
<?php }
do_action( 'qsm_email_page_condition_category' ); ?>
</select>
</div>
<div class="email-extra-condition-category-container qsm-email-condition-container-inner">
Expand Down
83 changes: 49 additions & 34 deletions php/admin/options-page-results-page-tab.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,35 +73,41 @@ function qsm_options_results_tab_content() {
$variable_list['Core']['%RESULT_ID%'] = __( 'Show result id', 'quiz-master-next' );
$variable_list = qsm_extra_template_and_leaderboard($variable_list);
if ( ! class_exists('QSM_Analysis') ) {
global $mlwQuizMasterNext;
$template_array = array(
'%QSM_PIECHART_RESULT_X%' => __( 'X: Question ID, Display the answers piechart.', 'quiz-master-next' ),
);
if ( version_compare( $mlwQuizMasterNext->version, '7.3.4', '>' ) ) {
$template_array = array(
'%QSM_PIECHART_RESULT_X%' => __( 'X: Question ID, Display the answers piechart.', 'quiz-master-next' ),
'%QSM_BARCHART_RESULT_X%' => __( 'X: Question ID, Display the answers barchart.', 'quiz-master-next' ),
'%CATEGORY_POINTS_PIECHART%' => __( 'Display the point based category piechart.', 'quiz-master-next' ),
'%CATEGORY_POINTS_BARCHART%' => __( 'Display the point based category barchart.', 'quiz-master-next' ),
);
$analysis = array(
'Analysis' => $template_array,
);
} else {
$analysis = $template_array;
$variable_list = array_merge( $variable_list, $analysis );
}
$variable_list = array_merge( $variable_list, $analysis );
if ( ! class_exists('QSM_Advanced_Assessment') ) {
$template_array = array(
'%ANSWER_LABEL_POINTS%' => __( 'The amount of points of all labels earned.', 'quiz-master-next' ),
'%ANSWER_LABEL_POINTS_X%' => __( 'X: Answer label slug - The amount of points a specific label earned.', 'quiz-master-next' ),
'%ANSWER_LABEL_COUNTS%' => __( 'The amount of counts of all labels earned.', 'quiz-master-next' ),
'%ANSWER_LABEL_COUNTS_X%' => __( 'X: Answer label slug - The amount of counts a specific label earned.', 'quiz-master-next' ),
);
if ( ! empty( $_GET['tab'] ) && 'results-pages' === $_GET['tab'] ) {
$template_array['%ANSWER_LABEL_POINTS_PIE_CHART%'] = __( 'Display piechart based on points.', 'quiz-master-next' );
$template_array['%ANSWER_LABEL_COUNTS_PIE_CHART%'] = __( 'Display piechart based on counts.', 'quiz-master-next' );
}
$advanced_assessment = array(
'Advanced Assessment' => $template_array,
);
$variable_list = array_merge( $variable_list, $advanced_assessment );
}
if ( ! class_exists('QSM_Exporting') ) {
global $mlwQuizMasterNext;
$template_array = array(
'%PDF_BUTTON%' => __( 'Displays download button on the results page.', 'quiz-master-next' ),
);
$download_results = array(
'Export Results' => $template_array,
);
if ( version_compare( $mlwQuizMasterNext->version, '7.3.4', '>' ) ) {
$template_array = array(
'%PDF_BUTTON%' => __( 'Displays download button on the results page.', 'quiz-master-next' ),
);
$download_results = array(
'Export Results' => $template_array,
);
} else {
$download_results = $template_array ;
}
$variable_list = array_merge($variable_list, $download_results);
$variable_list = array_merge($variable_list, $download_results);
}
//filter to add or remove variables from variable list for pdf tab
$variable_list = apply_filters( 'qsm_text_variable_list_result', $variable_list );
Expand Down Expand Up @@ -142,26 +148,31 @@ function qsm_options_results_tab_content() {
$qsm_badge = "<a href =".$upgrade_link." target='_blank' class='qsm-upgrade-popup-badge'>".esc_html__( 'PRO', 'quiz-master-next' )."</a>";

}
if ( ( ! class_exists( 'QSM_Advanced_Assessment' ) ) && ( 'Advanced Assessment' == $category_name ) ) {
$upgrade_link = qsm_get_plugin_link( 'downloads/advanced-assessment/' );
$classname = "qsm-upgrade-popup-variable qsm-upgrade-popup-advanced-assessment-variable";
$qsm_badge = "<a href =".$upgrade_link." target='_blank' class='qsm-upgrade-popup-badge'>".esc_html__( 'PRO', 'quiz-master-next' )."</a>";
}
?>
<div><h2 class="qsm-upgrade-popup-category-name"><?php echo esc_attr( $category_name );?></h2><?php echo wp_kses_post( $qsm_badge ) ; ?></div>
<?php
foreach ( $category_variables as $variable_key => $variable ) {
?>
<div class="popup-template-span-wrap">
<span class="qsm-text-template-span <?php echo esc_attr( $classname );?>">
<?php if ( ( ( ! class_exists( 'QSM_Extra_Variables' ) ) && ( 'Extra Template Variables' == $category_name ) ) || (( ! class_exists( 'Mlw_Qmn_Al_Widget' ) ) && ( 'Advanced Leaderboard' == $category_name )) || ( ( ! class_exists( 'QSM_Exporting' ) ) && ( 'Export Results' == $category_name) ) || ( ( ! class_exists( 'QSM_Analysis' ) ) && ( 'Analysis' == $category_name ) ) ) {?>
<span class="button button-default template-variable qsm-tooltips-icon"><?php echo esc_attr( $variable_key ); ?>
<span class="qsm-tooltips qsm-upgrade-tooltip"><?php echo esc_html__( 'Available in pro', 'quiz-master-next' );?></span>
<?php if ( str_contains( $classname, 'qsm-upgrade-popup-variable') ) {?>
<span class="button button-default template-variable qsm-tooltips-icon"><?php echo esc_attr( $variable_key ); ?>
<span class="qsm-tooltips qsm-upgrade-tooltip"><?php echo esc_html__( 'Available in pro', 'quiz-master-next' );?></span>
</span>
<?php } else { ?>
<span class="button button-default template-variable"><?php echo esc_attr( $variable_key ); ?></span>
<span class='button click-to-copy'>Click to Copy</span>
<span class="temp-var-seperator">
<span class="dashicons dashicons-editor-help qsm-tooltips-icon">
<span class="qsm-tooltips"><?php echo esc_attr( $variable ); ?></span>
</span>
<?php } else { ?>
<span class="button button-default template-variable"><?php echo esc_attr( $variable_key ); ?></span>
<span class='button click-to-copy'>Click to Copy</span>
<span class="temp-var-seperator">
<span class="dashicons dashicons-editor-help qsm-tooltips-icon">
<span class="qsm-tooltips"><?php echo esc_attr( $variable ); ?></span>
</span>
</span>
<?php } ?>
</span>
<?php } ?>
</span>
</div>
<?php
Expand Down Expand Up @@ -278,8 +289,12 @@ function qsm_options_results_tab_template(){
<option value="category" <# if (data.category == 'category' || jQuery.inArray(data.category, categories_array) !== -1 ) { #>selected<# } #>><?php esc_html_e( 'Category', 'quiz-master-next' ); ?></option>
<?php } else { ?>
<option disabled value=""><?php esc_html_e( 'No Categories Available', 'quiz-master-next' ); ?></option>
<?php } ?>
<?php do_action( 'qsm_results_page_condition_category' ); ?>
<?php }
if ( ! class_exists( 'QSM_Advanced_Assessment' ) ) { ?>
<option value="option-pro"><?php esc_html_e( 'Option (pro)', 'quiz-master-next' ); ?></option>
<option value="label-pro"><?php esc_html_e( 'Label (pro)', 'quiz-master-next' ); ?></option>
<?php }
do_action( 'qsm_results_page_condition_category' ); ?>
</select>
</div>
<div class="results-page-extra-condition-category-container qsm-result-condition-container-inner">
Expand Down
Loading

0 comments on commit 879434c

Please sign in to comment.