Pré-enquête d’activité
Pour continuer, merci de remplir ce court questionnaire.
‘);
var close_button = $(‘Fermer l’enquête’)
.addClass(‘btn btn-md btn-default pull-right’)
.on(‘click’, function(e) {
e.preventDefault();
modal.modal(‘hide’);
}
);
switch (code) {
case ‘94221’:
custom_html.append(‘
Pour participer à cette activité, vous devez être inscrit à la Réunion annuelle 2022 sur la Médecine Interne ACP, ce qui nécessite une inscription payante distincte. Si vous n’êtes pas encore inscrit, vous pouvez le faire en cliquant sur « Inscription ACP » ou cliquer sur « Fermer l’enquête » pour mettre fin à l’enquête.
‘);
custom_html.append( »);
custom_html.append(‘Inscription ACP’);
custom_html.append(close_button);
custom_html.append( »);
form.html(custom_html);
break;
case ‘77213’:
custom_html.append(‘
Pour participer à cette activité, vous devez être inscrit à la Réunion annuelle 2022 de ACMG, ce qui nécessite une inscription payante distincte. Si vous n’êtes pas encore inscrit, vous pouvez le faire en cliquant sur « Inscription ACMG » ou cliquer sur « Fermer l’enquête » pour mettre fin à l’enquête.
‘);
custom_html.append( »);
custom_html.append(‘Inscription ACMG’);
custom_html.append(close_button);
custom_html.append( »);
form.html(custom_html);
break;
case ‘222116’:
custom_html.append(‘
Pour participer à cette activité, vous devez être inscrit à la Réunion annuelle CMSC 2022, ce qui nécessite une inscription payante distincte. Si vous n’êtes pas encore inscrit, vous pouvez le faire en cliquant sur « Inscription CMSC » ou cliquer sur « Fermer l’enquête » pour mettre fin à l’enquête.
‘);
custom_html.append( »);
custom_html.append(‘Inscription CMSC’);
custom_html.append(close_button);
custom_html.append( »);
form.html(custom_html);
break;
}
};
$(document).ready(function() {
var touchURL, pre_fired = [];
var survey_id = 5320;
var modal,form = $(‘#surveyform’ + survey_id);
if (form.closest(‘.modal’).length) {
modal = form.closest(‘.modal’);
}
function pretestFirer(program_code) {
if (pre_fired[program_code] !== undefined) return;
pre_fired[program_code] = 1;
if (typeof program_code === ‘number’) {
if (programID) program_code = programID;
}
// Ensure program_code is a string
program_code = program_code + »;
if ( program_code.indexOf(‘WC’) >= 0
|| program_code.indexOf(‘LV’) >= 0
|| program_code.indexOf(‘HY’) >= 0
|| program_code.indexOf(‘LS’) >= 0
|| program_code.indexOf(‘VM’) >= 0
|| program_code.indexOf(‘VS’) >= 0
) {
firePrimeEvent(‘learnerLive’);
} else {
firePrimeEvent(‘learner’);
}
// Track in DB
touchURL = ‘https://primeinc.org’;
touchURL += ‘/inc/learner-touch.php?sid=84831009&phpsession=oghfu812hs3l1jdi15qiopr0c1&hr= » + howRegistered;
$.get(touchURL);
}
// Survey in view (learner)
if ($(« .surveyform[data-surveytype= »pre »]’).is(‘:hidden’)) {
$(‘.surveyform[data-surveytype= »pre »]’).each(function() {
program_code = $(this).data(‘programcode’);
$(this).closest(‘#modal, .modal’).on(‘DOMSubtreeModified shown.bs.modal’, function() {
if ($(this).find(‘.surveyform[data-surveytype= »pre »]:visible’).length) {
$(this).off(‘DOMSubtreeModified shown.bs.modal’);
$(« html, body »).animate({ scrollTop: 0 }, « fast »);
pretestFirer(program_code);
}
});
});
} else if ($(‘.surveyform[data-surveytype= »pre »]’).is(‘:visible’)) {
program_code = $(‘.surveyform[data-surveytype= »pre »]’).data(‘programcode’);
pretestFirer(program_code);
}
// Trigger appropriate « start » event for activity
var triggerGaEvent = function() {
if (typeof(program_code) == ‘undefined’ || !program_code || typeof program_code === ‘number’) {
if (window.programID) {
program_code = window.programID;
} else if (form.is(‘[data-programcode]’)) {
program_code = form.data(‘programcode’);
}
}
if ( program_code.toString().indexOf(‘WC’) >= 0
|| program_code.toString().indexOf(‘LV’) >= 0
|| program_code.toString().indexOf(‘HY’) >= 0
|| program_code.toString().indexOf(‘LS’) >= 0
|| program_code.toString().indexOf(‘VM’) >= 0
|| program_code.toString().indexOf(‘VS’) >= 0
) {
waitForGlobalRegisteredActivityCode();
firePrimeEvent(‘startPretestLive’);
} else {
waitForGlobalRegisteredActivityCode();
firePrimeEvent(‘startPretest’);
}
if (modal) modal.off(‘shown.bs.modal’, triggerGaEvent);
};
// Grading
$(document).on(‘click change’, ‘fieldset.previously-graded’, function(e) {
e.preventDefault();
return false;
});
$(document).on(‘change’, ‘[data-grade]’, function(e) {
var selection = $(e.currentTarget);
var selection_label = selection.closest(‘label’);
var selection_id = selection.attr(‘id’);
var fieldset = selection.closest(‘fieldset’);
// Prevent changes to already-graded questions
if (fieldset.is(‘.previously-graded’)) {
e.preventDefault();
return false;
}
// Get incorrect & correct solutions
var incorrect_selections = fieldset.find(‘[data-grade=0]:checked’).map(function() {
return $(this).closest(‘label’);
});
var correct_selections = fieldset.find(‘[data-grade=1]’).map(function() {
return $(this).closest(‘label’);
});
// Check if correct answer was selected
var correct_answer_selected = correct_selections.filter(function() {
return $(this).find(‘input’).attr(‘id’) == selection_id;
}).length > 0;
if (correct_answer_selected) {
correct_selections.map(function() { $(this).addClass(‘correct-selection-success’); });
} else {
incorrect_selections.map(function() { $(this).addClass(‘incorrect-selection’); });
correct_selections.map(function() { $(this).addClass(‘correct-selection-missed’); });
}
// Disable further selections
fieldset.addClass(‘previously-graded’);
});
// Only call if there is actually a valid survey
// Survey is a modal; call when modal is shown
if (modal) {
modal.on(‘shown.bs.modal’, triggerGaEvent);
// Call immediately
} else {
triggerGaEvent();
}
});
}