Version Description
06 March, 2019 =
Added: button save, save and closed in quiz modal
Added: Registering user and redirect to Dashboard URL
Added: questions sorting in quiz builder
Added: question specific class in quiz answer options
Update: Quiz attempt design with questions
Update: some text, typo
Fixed: instructor database query in instructor lists
Fixed: query randomized questions limit by quiz
Fixed: Starting quiz for first time return 0, it should redirect to the quiz page
Download this release
Release Info
Developer | themeum |
Plugin | Tutor LMS – eLearning and online course solution |
Version | 1.0.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.0.2
- assets/css/tutor-admin.css +3 -0
- assets/css/tutor-front.css +148 -35
- assets/js/tutor-admin.js +34 -0
- classes/Quiz.php +17 -0
- classes/Student.php +6 -1
- classes/Utils.php +7 -4
- readme.txt +14 -2
- templates/single/quiz/body.php +25 -24
- tutor.php +2 -2
- views/metabox/instructors-metabox.php +1 -1
- views/modal/edit_quiz.php +14 -10
- views/modal/question_answer_edit_form.php +1 -1
- views/modal/question_answer_form.php +1 -1
assets/css/tutor-admin.css
CHANGED
@@ -997,6 +997,9 @@ Quiz Modal
|
|
997 |
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
998 |
transition: all 0.3s cubic-bezier(.25,.8,.25,1);
|
999 |
}
|
|
|
|
|
|
|
1000 |
|
1001 |
/** Tutor Quiz Modal Form */
|
1002 |
.tutor-quiz-builder-form-row{
|
997 |
box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
|
998 |
transition: all 0.3s cubic-bezier(.25,.8,.25,1);
|
999 |
}
|
1000 |
+
.advanced-options-tab-item{
|
1001 |
+
float: right;
|
1002 |
+
}
|
1003 |
|
1004 |
/** Tutor Quiz Modal Form */
|
1005 |
.tutor-quiz-builder-form-row{
|
assets/css/tutor-front.css
CHANGED
@@ -1197,7 +1197,7 @@ Instructor
|
|
1197 |
color: #ffffff;
|
1198 |
padding: 0 18px;
|
1199 |
display: inline-block;
|
1200 |
-
line-height:
|
1201 |
}
|
1202 |
.tutor-sidebar-tabs-wrap{
|
1203 |
border-top: 1px solid #E0E9EC;
|
@@ -1898,18 +1898,112 @@ Course question and answer
|
|
1898 |
border-bottom: 1px dashed;
|
1899 |
background-color: transparent;
|
1900 |
font-size: 14px;
|
1901 |
-
padding:
|
1902 |
border-radius: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1903 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1904 |
|
1905 |
-
|
1906 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1907 |
}
|
1908 |
.quiz-answer-image-wrap img{
|
1909 |
-
max-
|
1910 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1911 |
}
|
1912 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1913 |
.question-type-ordering-item {
|
1914 |
border: 1px solid #D4DADB;
|
1915 |
padding: 10px;
|
@@ -1918,6 +2012,9 @@ Course question and answer
|
|
1918 |
background-color: #fff;
|
1919 |
display: flex;
|
1920 |
}
|
|
|
|
|
|
|
1921 |
.question-type-ordering-item .answer-title {
|
1922 |
flex: 1;
|
1923 |
}
|
@@ -1925,32 +2022,50 @@ Course question and answer
|
|
1925 |
cursor: pointer;
|
1926 |
}
|
1927 |
.quiz-answer-item-matching {
|
1928 |
-
padding: 10px
|
1929 |
display: flex;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1930 |
}
|
1931 |
-
|
1932 |
-
|
|
|
|
|
1933 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
1934 |
.quiz-answer-matching-droppable {
|
1935 |
height: 48px;
|
1936 |
min-width: 200px;
|
1937 |
border: 1px dashed #D4DADB;
|
1938 |
}
|
1939 |
.quiz-draggable-answer-item {
|
1940 |
-
padding: 10px;
|
1941 |
border: 1px solid #D4DADB;
|
1942 |
margin-right: 10px;
|
1943 |
margin-bottom: 10px;
|
1944 |
-
max-width:
|
1945 |
background-color: #fff;
|
1946 |
display: inline-flex;
|
1947 |
-
width: 150px;
|
1948 |
}
|
1949 |
.quiz-draggable-answer-item .draggable-answer-title {
|
1950 |
flex: 1;
|
1951 |
}
|
1952 |
.quiz-draggable-rand-answers{
|
1953 |
-
|
|
|
1954 |
}
|
1955 |
.drop-hover{
|
1956 |
display: none;
|
@@ -1966,6 +2081,9 @@ Course question and answer
|
|
1966 |
width: 100%;
|
1967 |
max-width: 100%;
|
1968 |
}
|
|
|
|
|
|
|
1969 |
.answer-type-image_matching .quiz-answer-item-matching{
|
1970 |
/*display: inline-block;
|
1971 |
width: 190px;
|
@@ -1973,8 +2091,10 @@ Course question and answer
|
|
1973 |
display: block;
|
1974 |
}
|
1975 |
.answer-type-image_matching .quiz-answer-matching-items-wrap {
|
1976 |
-
|
1977 |
-
|
|
|
|
|
1978 |
}
|
1979 |
.answer-type-image_matching .quiz-answer-matching-droppable{
|
1980 |
width: 100%;
|
@@ -2010,40 +2130,33 @@ Course question and answer
|
|
2010 |
display: flex;
|
2011 |
flex-wrap: wrap;
|
2012 |
flex-direction: row;
|
2013 |
-
|
|
|
2014 |
}
|
2015 |
.quiz-image-answering-wrap img{
|
2016 |
max-width: 100%;
|
2017 |
height: auto;
|
2018 |
}
|
2019 |
.quiz-image-answering-answer {
|
2020 |
-
width: calc(1/4*100% - (1 - 1/4)*10px);
|
2021 |
margin-right: 10px;
|
|
|
|
|
2022 |
}
|
2023 |
.quiz-image-answering-image-wrap {
|
2024 |
margin-bottom: 20px;
|
2025 |
}
|
2026 |
-
|
2027 |
-
|
2028 |
-
display:
|
2029 |
-
align-items: center;
|
2030 |
-
}
|
2031 |
-
|
2032 |
-
.tutor-quiz-answers-wrap > label:not(:last-child){
|
2033 |
-
margin-bottom: 25px;
|
2034 |
-
}
|
2035 |
-
|
2036 |
-
.quiz-answer-input-body{
|
2037 |
-
display: inline-flex;
|
2038 |
-
align-items: center;
|
2039 |
-
padding: 11px 17px;
|
2040 |
border: 1px solid #D4DADB;
|
2041 |
-
|
2042 |
-
|
|
|
2043 |
}
|
2044 |
|
2045 |
-
.quiz-
|
2046 |
-
|
|
|
2047 |
}
|
2048 |
|
2049 |
|
1197 |
color: #ffffff;
|
1198 |
padding: 0 18px;
|
1199 |
display: inline-block;
|
1200 |
+
line-height: 68px;
|
1201 |
}
|
1202 |
.tutor-sidebar-tabs-wrap{
|
1203 |
border-top: 1px solid #E0E9EC;
|
1898 |
border-bottom: 1px dashed;
|
1899 |
background-color: transparent;
|
1900 |
font-size: 14px;
|
1901 |
+
padding: 0px;
|
1902 |
border-radius: 0;
|
1903 |
+
box-shadow: none;
|
1904 |
+
margin: 0 10px;
|
1905 |
+
}
|
1906 |
+
|
1907 |
+
.fill-in-the-blank-field .fill-in-the-blank-text-input:focus{
|
1908 |
+
background: none;
|
1909 |
+
outline: none;
|
1910 |
+
}
|
1911 |
+
|
1912 |
+
.tutor-quiz-answers-wrap {
|
1913 |
+
margin-bottom: 50px;
|
1914 |
}
|
1915 |
+
.tutor-quiz-answers-wrap textarea{
|
1916 |
+
background: transparent;
|
1917 |
+
border: 1px solid #D4DADB;
|
1918 |
+
height: 175px;
|
1919 |
+
border-radius: 5px;
|
1920 |
+
box-shadow: none;
|
1921 |
+
max-width: 740px;
|
1922 |
+
margin-bottom: 5px;
|
1923 |
+
}
|
1924 |
+
.tutor-quiz-answers-wrap textarea:focus{
|
1925 |
+
background: transparent;
|
1926 |
+
outline: none !important;
|
1927 |
|
1928 |
+
}
|
1929 |
+
|
1930 |
+
.tutor-quiz-answers-wrap p{
|
1931 |
+
margin: 0;
|
1932 |
+
line-height: 20px;
|
1933 |
+
}
|
1934 |
+
.quiz-answer-input-body .quiz-answer-image-wrap {
|
1935 |
+
margin-top: 10px;
|
1936 |
+
margin-bottom: 10px;
|
1937 |
+
max-width: 200px;
|
1938 |
}
|
1939 |
.quiz-answer-image-wrap img{
|
1940 |
+
max-width: 100%;
|
1941 |
+
height: auto;
|
1942 |
+
}
|
1943 |
+
|
1944 |
+
.tutor-quiz-answers-wrap label{
|
1945 |
+
display: block;
|
1946 |
+
margin-bottom: 15px;
|
1947 |
+
font-size: 14px;
|
1948 |
+
cursor: pointer;
|
1949 |
}
|
1950 |
|
1951 |
+
.tutor-quiz-answers-wrap label.answer-view-image,
|
1952 |
+
.tutor-quiz-answers-wrap label.answer-view-text_image{
|
1953 |
+
text-align: center;
|
1954 |
+
margin: 0 10px;
|
1955 |
+
display: inline-flex;
|
1956 |
+
max-width: 25%;
|
1957 |
+
}
|
1958 |
+
.quiz-answer-input-bottom{
|
1959 |
+
position: relative;
|
1960 |
+
display: inline-block;
|
1961 |
+
line-height: 20px;
|
1962 |
+
}
|
1963 |
+
|
1964 |
+
.tutor-quiz-answers-wrap label input{
|
1965 |
+
display: none;
|
1966 |
+
}
|
1967 |
+
|
1968 |
+
.tutor-quiz-answers-wrap label input + span{
|
1969 |
+
width: 20px;
|
1970 |
+
height: 20px;
|
1971 |
+
border: 1px solid #DEDEDE;
|
1972 |
+
display: inline-block;
|
1973 |
+
border-radius: 2px;
|
1974 |
+
position: relative;
|
1975 |
+
margin-right: 5px;
|
1976 |
+
}
|
1977 |
+
.tutor-quiz-answers-wrap label input:checked + span{
|
1978 |
+
background: #1B52D8;
|
1979 |
+
border-color: #1B52D8;
|
1980 |
+
}
|
1981 |
+
.tutor-quiz-answers-wrap label input:checked + span::after{
|
1982 |
+
content: '\e90f';
|
1983 |
+
position: absolute;
|
1984 |
+
font-family: 'tutor';
|
1985 |
+
color: #fff;
|
1986 |
+
top: 50%;
|
1987 |
+
left: 50%;
|
1988 |
+
transform: translate(-50%, -50%);
|
1989 |
+
font-size: 11px;
|
1990 |
+
line-height: 1;
|
1991 |
+
}
|
1992 |
+
.tutor-quiz-answers-wrap label input[type="radio"] + span{
|
1993 |
+
content: '';
|
1994 |
+
border-radius: 50%;
|
1995 |
+
margin-right: 4px;
|
1996 |
+
vertical-align: top;
|
1997 |
+
font-size: 1em;
|
1998 |
+
}
|
1999 |
+
.tutor-quiz-answers-wrap label input[type="radio"] + span::after{
|
2000 |
+
content: '';
|
2001 |
+
height: 8px;
|
2002 |
+
width: 8px;
|
2003 |
+
background: #fff;
|
2004 |
+
border-radius: 50%;
|
2005 |
+
left: 50%;
|
2006 |
+
}
|
2007 |
.question-type-ordering-item {
|
2008 |
border: 1px solid #D4DADB;
|
2009 |
padding: 10px;
|
2012 |
background-color: #fff;
|
2013 |
display: flex;
|
2014 |
}
|
2015 |
+
.question-type-ordering-item.ui-sortable-placeholder{
|
2016 |
+
background-color: transparent;
|
2017 |
+
}
|
2018 |
.question-type-ordering-item .answer-title {
|
2019 |
flex: 1;
|
2020 |
}
|
2022 |
cursor: pointer;
|
2023 |
}
|
2024 |
.quiz-answer-item-matching {
|
2025 |
+
padding: 10px;
|
2026 |
display: flex;
|
2027 |
+
width: 25%;
|
2028 |
+
}
|
2029 |
+
|
2030 |
+
.answer-type-matching .quiz-answer-matching-items-wrap .quiz-answer-item-matching{
|
2031 |
+
display: inline-block;
|
2032 |
+
max-width: none;
|
2033 |
+
padding-left: 0;
|
2034 |
+
padding-right: 0;
|
2035 |
+
width: 25%;
|
2036 |
+
padding: 0 10px;
|
2037 |
}
|
2038 |
+
|
2039 |
+
|
2040 |
+
.answer-type-matching .quiz-answer-matching-items-wrap{
|
2041 |
+
margin: 0 -10px;
|
2042 |
}
|
2043 |
+
|
2044 |
+
/*.answer-type-matching .quiz-answer-item-matching .quiz-answer-matching-droppable,*/
|
2045 |
+
/*.answer-type-matching .quiz-answer-item-matching .quiz-answer-matching-title{*/
|
2046 |
+
/*width: 50%;*/
|
2047 |
+
/*}*/
|
2048 |
+
|
2049 |
.quiz-answer-matching-droppable {
|
2050 |
height: 48px;
|
2051 |
min-width: 200px;
|
2052 |
border: 1px dashed #D4DADB;
|
2053 |
}
|
2054 |
.quiz-draggable-answer-item {
|
2055 |
+
padding: 10px 20px;
|
2056 |
border: 1px solid #D4DADB;
|
2057 |
margin-right: 10px;
|
2058 |
margin-bottom: 10px;
|
2059 |
+
max-width: 215px;
|
2060 |
background-color: #fff;
|
2061 |
display: inline-flex;
|
|
|
2062 |
}
|
2063 |
.quiz-draggable-answer-item .draggable-answer-title {
|
2064 |
flex: 1;
|
2065 |
}
|
2066 |
.quiz-draggable-rand-answers{
|
2067 |
+
display: flex;
|
2068 |
+
flex-wrap: wrap;
|
2069 |
}
|
2070 |
.drop-hover{
|
2071 |
display: none;
|
2081 |
width: 100%;
|
2082 |
max-width: 100%;
|
2083 |
}
|
2084 |
+
.quiz-draggable-answer-item .draggable-answer-icon{
|
2085 |
+
margin-left: 15px;
|
2086 |
+
}
|
2087 |
.answer-type-image_matching .quiz-answer-item-matching{
|
2088 |
/*display: inline-block;
|
2089 |
width: 190px;
|
2091 |
display: block;
|
2092 |
}
|
2093 |
.answer-type-image_matching .quiz-answer-matching-items-wrap {
|
2094 |
+
display: flex;
|
2095 |
+
flex-wrap: wrap;
|
2096 |
+
margin-left: -10px;
|
2097 |
+
margin-right: -10px;
|
2098 |
}
|
2099 |
.answer-type-image_matching .quiz-answer-matching-droppable{
|
2100 |
width: 100%;
|
2130 |
display: flex;
|
2131 |
flex-wrap: wrap;
|
2132 |
flex-direction: row;
|
2133 |
+
margin-left: -10px;
|
2134 |
+
margin-right: -10px;
|
2135 |
}
|
2136 |
.quiz-image-answering-wrap img{
|
2137 |
max-width: 100%;
|
2138 |
height: auto;
|
2139 |
}
|
2140 |
.quiz-image-answering-answer {
|
|
|
2141 |
margin-right: 10px;
|
2142 |
+
margin-left: 10px;
|
2143 |
+
width: 25%;
|
2144 |
}
|
2145 |
.quiz-image-answering-image-wrap {
|
2146 |
margin-bottom: 20px;
|
2147 |
}
|
2148 |
+
.tutor-quiz-answers-wrap .quiz-image-answering-input-field-wrap input{
|
2149 |
+
width: 100%;
|
2150 |
+
display: block;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2151 |
border: 1px solid #D4DADB;
|
2152 |
+
box-shadow: none;
|
2153 |
+
background: transparent;
|
2154 |
+
border-radius: 2px;
|
2155 |
}
|
2156 |
|
2157 |
+
.tutor-quiz-answers-wrap .quiz-image-answering-input-field-wrap input:focus{
|
2158 |
+
background: transparent;
|
2159 |
+
outline-offset: 0 !important;
|
2160 |
}
|
2161 |
|
2162 |
|
assets/js/tutor-admin.js
CHANGED
@@ -980,6 +980,7 @@ jQuery(document).ready(function($){
|
|
980 |
$('#tutor-quiz-modal-tab-items-wrap a[href="'+tabSelector+'"]').trigger('click');
|
981 |
}
|
982 |
tutor_slider_init();
|
|
|
983 |
},
|
984 |
complete: function () {
|
985 |
$that.removeClass('tutor-updating-message');
|
@@ -1008,6 +1009,9 @@ jQuery(document).ready(function($){
|
|
1008 |
},
|
1009 |
complete: function () {
|
1010 |
$that.removeClass('tutor-updating-message');
|
|
|
|
|
|
|
1011 |
}
|
1012 |
});
|
1013 |
});
|
@@ -1271,6 +1275,36 @@ jQuery(document).ready(function($){
|
|
1271 |
});
|
1272 |
});
|
1273 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1274 |
/**
|
1275 |
* Save answer sorting placement
|
1276 |
*
|
980 |
$('#tutor-quiz-modal-tab-items-wrap a[href="'+tabSelector+'"]').trigger('click');
|
981 |
}
|
982 |
tutor_slider_init();
|
983 |
+
enable_quiz_questions_sorting();
|
984 |
},
|
985 |
complete: function () {
|
986 |
$that.removeClass('tutor-updating-message');
|
1009 |
},
|
1010 |
complete: function () {
|
1011 |
$that.removeClass('tutor-updating-message');
|
1012 |
+
if ($that.attr('data-action') === 'modal_close'){
|
1013 |
+
$('.tutor-modal-wrap').removeClass('show');
|
1014 |
+
}
|
1015 |
}
|
1016 |
});
|
1017 |
});
|
1275 |
});
|
1276 |
});
|
1277 |
|
1278 |
+
/**
|
1279 |
+
* Sort quiz questions
|
1280 |
+
*/
|
1281 |
+
function enable_quiz_questions_sorting(){
|
1282 |
+
if (jQuery().sortable) {
|
1283 |
+
$(".quiz-builder-questions-wrap").sortable({
|
1284 |
+
handle: ".question-sorting",
|
1285 |
+
start: function (e, ui) {
|
1286 |
+
ui.placeholder.css('visibility', 'visible');
|
1287 |
+
},
|
1288 |
+
stop: function (e, ui) {
|
1289 |
+
tutor_save_sorting_quiz_questions_order();
|
1290 |
+
},
|
1291 |
+
});
|
1292 |
+
}
|
1293 |
+
}
|
1294 |
+
|
1295 |
+
function tutor_save_sorting_quiz_questions_order(){
|
1296 |
+
var questions = {};
|
1297 |
+
$('.quiz-builder-question-wrap').each(function(index, item){
|
1298 |
+
var $question = $(this);
|
1299 |
+
var question_id = parseInt($question.attr('data-question-id'), 10);
|
1300 |
+
questions[index] = question_id;
|
1301 |
+
});
|
1302 |
+
|
1303 |
+
$.ajax({url : ajaxurl, type : 'POST',
|
1304 |
+
data : {sorted_question_ids : questions, action: 'tutor_quiz_question_sorting'},
|
1305 |
+
});
|
1306 |
+
}
|
1307 |
+
|
1308 |
/**
|
1309 |
* Save answer sorting placement
|
1310 |
*
|
classes/Quiz.php
CHANGED
@@ -56,6 +56,7 @@ class Quiz {
|
|
56 |
add_action('wp_ajax_tutor_update_quiz_answer_options', array($this, 'tutor_update_quiz_answer_options'));
|
57 |
add_action('wp_ajax_tutor_quiz_builder_get_answers_by_question', array($this, 'tutor_quiz_builder_get_answers_by_question'));
|
58 |
add_action('wp_ajax_tutor_quiz_builder_delete_answer', array($this, 'tutor_quiz_builder_delete_answer'));
|
|
|
59 |
add_action('wp_ajax_tutor_quiz_answer_sorting', array($this, 'tutor_quiz_answer_sorting'));
|
60 |
add_action('wp_ajax_tutor_mark_answer_as_correct', array($this, 'tutor_mark_answer_as_correct'));
|
61 |
add_action('wp_ajax_tutor_quiz_modal_update_settings', array($this, 'tutor_quiz_modal_update_settings'));
|
@@ -967,6 +968,22 @@ class Quiz {
|
|
967 |
wp_send_json_success();
|
968 |
}
|
969 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
970 |
/**
|
971 |
* Save sorting data for quiz answers
|
972 |
*/
|
56 |
add_action('wp_ajax_tutor_update_quiz_answer_options', array($this, 'tutor_update_quiz_answer_options'));
|
57 |
add_action('wp_ajax_tutor_quiz_builder_get_answers_by_question', array($this, 'tutor_quiz_builder_get_answers_by_question'));
|
58 |
add_action('wp_ajax_tutor_quiz_builder_delete_answer', array($this, 'tutor_quiz_builder_delete_answer'));
|
59 |
+
add_action('wp_ajax_tutor_quiz_question_sorting', array($this, 'tutor_quiz_question_sorting'));
|
60 |
add_action('wp_ajax_tutor_quiz_answer_sorting', array($this, 'tutor_quiz_answer_sorting'));
|
61 |
add_action('wp_ajax_tutor_mark_answer_as_correct', array($this, 'tutor_mark_answer_as_correct'));
|
62 |
add_action('wp_ajax_tutor_quiz_modal_update_settings', array($this, 'tutor_quiz_modal_update_settings'));
|
968 |
wp_send_json_success();
|
969 |
}
|
970 |
|
971 |
+
/**
|
972 |
+
* Save quiz questions sorting
|
973 |
+
*/
|
974 |
+
public function tutor_quiz_question_sorting(){
|
975 |
+
global $wpdb;
|
976 |
+
|
977 |
+
$question_ids = tutor_utils()->avalue_dot('sorted_question_ids', $_POST);
|
978 |
+
if (is_array($question_ids) && count($question_ids) ){
|
979 |
+
$i = 0;
|
980 |
+
foreach ($question_ids as $key => $question_id){
|
981 |
+
$i++;
|
982 |
+
$wpdb->update($wpdb->prefix.'tutor_quiz_questions', array('question_order' => $i), array('question_id' => $question_id));
|
983 |
+
}
|
984 |
+
}
|
985 |
+
}
|
986 |
+
|
987 |
/**
|
988 |
* Save sorting data for quiz answers
|
989 |
*/
|
classes/Student.php
CHANGED
@@ -87,13 +87,18 @@ class Student {
|
|
87 |
wp_set_current_user( $user_id, $user->user_login );
|
88 |
wp_set_auth_cookie( $user_id );
|
89 |
}
|
|
|
|
|
|
|
|
|
90 |
}else{
|
91 |
$this->error_msgs = $user_id->get_error_messages();
|
92 |
add_filter('tutor_student_register_validation_errors', array($this, 'tutor_student_form_validation_errors'));
|
93 |
return;
|
94 |
}
|
95 |
|
96 |
-
|
|
|
97 |
die();
|
98 |
}
|
99 |
|
87 |
wp_set_current_user( $user_id, $user->user_login );
|
88 |
wp_set_auth_cookie( $user_id );
|
89 |
}
|
90 |
+
|
91 |
+
$dashboard_url = tutor_utils()->tutor_dashboard_url();
|
92 |
+
wp_redirect($dashboard_url);
|
93 |
+
die();
|
94 |
}else{
|
95 |
$this->error_msgs = $user_id->get_error_messages();
|
96 |
add_filter('tutor_student_register_validation_errors', array($this, 'tutor_student_form_validation_errors'));
|
97 |
return;
|
98 |
}
|
99 |
|
100 |
+
$registration_page = tutor_utils()->student_register_url();
|
101 |
+
wp_redirect($registration_page);
|
102 |
die();
|
103 |
}
|
104 |
|
classes/Utils.php
CHANGED
@@ -2042,11 +2042,11 @@ class Utils {
|
|
2042 |
|
2043 |
$instructors = $wpdb->get_results("select ID, display_name,
|
2044 |
get_course.meta_value as taught_course_id,
|
2045 |
-
tutor_job_title.meta_value as tutor_profile_job_title,
|
2046 |
tutor_bio.meta_value as tutor_profile_bio,
|
2047 |
tutor_photo.meta_value as tutor_profile_photo
|
2048 |
from {$wpdb->users}
|
2049 |
-
INNER JOIN {$wpdb->usermeta} get_course ON ID = get_course.user_id AND get_course.meta_value = {$course_id}
|
2050 |
LEFT JOIN {$wpdb->usermeta} tutor_job_title ON ID = tutor_job_title.user_id AND tutor_job_title.meta_key = '_tutor_profile_job_title'
|
2051 |
LEFT JOIN {$wpdb->usermeta} tutor_bio ON ID = tutor_bio.user_id AND tutor_bio.meta_key = '_tutor_profile_bio'
|
2052 |
LEFT JOIN {$wpdb->usermeta} tutor_photo ON ID = tutor_photo.user_id AND tutor_photo.meta_key = '_tutor_profile_photo'
|
@@ -3121,9 +3121,12 @@ class Utils {
|
|
3121 |
global $wpdb;
|
3122 |
|
3123 |
$quiz_id = $this->get_post_id($quiz_id);
|
3124 |
-
$
|
|
|
|
|
|
|
3125 |
|
3126 |
-
$questions = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}tutor_quiz_questions WHERE quiz_id = {$quiz_id} ORDER BY RAND() LIMIT {$
|
3127 |
|
3128 |
return $questions;
|
3129 |
}
|
2042 |
|
2043 |
$instructors = $wpdb->get_results("select ID, display_name,
|
2044 |
get_course.meta_value as taught_course_id,
|
2045 |
+
tutor_job_title.meta_value as tutor_profile_job_title,
|
2046 |
tutor_bio.meta_value as tutor_profile_bio,
|
2047 |
tutor_photo.meta_value as tutor_profile_photo
|
2048 |
from {$wpdb->users}
|
2049 |
+
INNER JOIN {$wpdb->usermeta} get_course ON ID = get_course.user_id AND get_course.meta_key = '_tutor_instructor_course_id' AND get_course.meta_value = {$course_id}
|
2050 |
LEFT JOIN {$wpdb->usermeta} tutor_job_title ON ID = tutor_job_title.user_id AND tutor_job_title.meta_key = '_tutor_profile_job_title'
|
2051 |
LEFT JOIN {$wpdb->usermeta} tutor_bio ON ID = tutor_bio.user_id AND tutor_bio.meta_key = '_tutor_profile_bio'
|
2052 |
LEFT JOIN {$wpdb->usermeta} tutor_photo ON ID = tutor_photo.user_id AND tutor_photo.meta_key = '_tutor_profile_photo'
|
3121 |
global $wpdb;
|
3122 |
|
3123 |
$quiz_id = $this->get_post_id($quiz_id);
|
3124 |
+
$attempt = $this->is_started_quiz($quiz_id);
|
3125 |
+
if ( ! $attempt){
|
3126 |
+
return false;
|
3127 |
+
}
|
3128 |
|
3129 |
+
$questions = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}tutor_quiz_questions WHERE quiz_id = {$quiz_id} ORDER BY RAND() LIMIT {$attempt->total_questions} ");
|
3130 |
|
3131 |
return $questions;
|
3132 |
}
|
readme.txt
CHANGED
@@ -3,9 +3,9 @@ Contributors: themeum
|
|
3 |
Donate link: https://www.themeum.com
|
4 |
Tags: lms, education, wp-lms, education management system
|
5 |
Requires at least: 4.5
|
6 |
-
Tested up to: 5.
|
7 |
Requires PHP: 5.4.0
|
8 |
-
Stable tag: 1.0.
|
9 |
License: GPLv3
|
10 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
@@ -128,6 +128,18 @@ This is an alpha version of Tutor, as bugs and issues expected, if you found any
|
|
128 |
|
129 |
== Changelog ==
|
130 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
= 1.0.1 - 05 March, 2019 =
|
132 |
|
133 |
* Added a course_column in attempts table
|
3 |
Donate link: https://www.themeum.com
|
4 |
Tags: lms, education, wp-lms, education management system
|
5 |
Requires at least: 4.5
|
6 |
+
Tested up to: 5.1
|
7 |
Requires PHP: 5.4.0
|
8 |
+
Stable tag: 1.0.2
|
9 |
License: GPLv3
|
10 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
128 |
|
129 |
== Changelog ==
|
130 |
|
131 |
+
= 1.0.2 - 06 March, 2019 =
|
132 |
+
|
133 |
+
* Added: button save, save and closed in quiz modal
|
134 |
+
* Added: Registering user and redirect to Dashboard URL
|
135 |
+
* Added: questions sorting in quiz builder
|
136 |
+
* Added: question specific class in quiz answer options
|
137 |
+
* Update: Quiz attempt design with questions
|
138 |
+
* Update: some text, typo
|
139 |
+
* Fixed: instructor database query in instructor lists
|
140 |
+
* Fixed: query randomized questions limit by quiz
|
141 |
+
* Fixed: Starting quiz for first time return 0, it should redirect to the quiz page
|
142 |
+
|
143 |
= 1.0.1 - 05 March, 2019 =
|
144 |
|
145 |
* Added a course_column in attempts table
|
templates/single/quiz/body.php
CHANGED
@@ -104,23 +104,15 @@ $attempt_remaining = $attempts_allowed - $attempted_count;
|
|
104 |
?>
|
105 |
<p class="question-description"><?php echo $question->question_description; ?></p>
|
106 |
|
107 |
-
<div class="tutor-quiz-answers-wrap">
|
108 |
<?php
|
109 |
if ( is_array($answers) && count($answers) ) {
|
110 |
foreach ($answers as $answer){
|
111 |
if ( $question_type === 'true_false' || $question_type === 'single_choice' ) {
|
112 |
?>
|
113 |
-
<label>
|
114 |
-
<div class="quiz-answer-input-field">
|
115 |
-
<input name="attempt[<?php echo $is_started_quiz->attempt_id; ?>][quiz_question][<?php echo $question->question_id; ?>]" type="radio" value="<?php echo $answer->answer_id; ?>">
|
116 |
-
<span> </span>
|
117 |
-
</div>
|
118 |
-
|
119 |
<div class="quiz-answer-input-body">
|
120 |
<?php
|
121 |
-
if ($answer->answer_view_format !== 'image'){
|
122 |
-
echo "<p class='tutor-quiz-answer-title'>{$answer->answer_title}</p>";
|
123 |
-
}
|
124 |
if ($answer->answer_view_format === 'image' || $answer->answer_view_format === 'text_image'){
|
125 |
?>
|
126 |
<div class="quiz-answer-image-wrap">
|
@@ -129,30 +121,39 @@ $attempt_remaining = $attempts_allowed - $attempted_count;
|
|
129 |
<?php
|
130 |
}
|
131 |
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
</div>
|
133 |
</label>
|
134 |
<?php
|
135 |
}elseif ($question_type === 'multiple_choice'){
|
136 |
?>
|
137 |
-
<label>
|
138 |
-
|
139 |
-
<input name="attempt[<?php echo $is_started_quiz->attempt_id; ?>][quiz_question][<?php echo $question->question_id; ?>][]" type="checkbox" value="<?php echo $answer->answer_id; ?>">
|
140 |
-
<span> </span>
|
141 |
-
</div>
|
142 |
|
143 |
<div class="quiz-answer-input-body">
|
144 |
-
<?php
|
145 |
-
if ($answer->answer_view_format !== 'image'){
|
146 |
-
echo "<p class='tutor-quiz-answer-title'>{$answer->answer_title}</p>";
|
147 |
-
}
|
148 |
-
if ($answer->answer_view_format === 'image' || $answer->answer_view_format === 'text_image'){
|
149 |
-
?>
|
150 |
<div class="quiz-answer-image-wrap">
|
151 |
<img src="<?php echo wp_get_attachment_image_url($answer->image_id, 'full') ?>" />
|
152 |
</div>
|
153 |
-
|
154 |
-
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
</div>
|
157 |
</label>
|
158 |
<?php
|
104 |
?>
|
105 |
<p class="question-description"><?php echo $question->question_description; ?></p>
|
106 |
|
107 |
+
<div class="tutor-quiz-answers-wrap question-type-<?php echo $question_type; ?>">
|
108 |
<?php
|
109 |
if ( is_array($answers) && count($answers) ) {
|
110 |
foreach ($answers as $answer){
|
111 |
if ( $question_type === 'true_false' || $question_type === 'single_choice' ) {
|
112 |
?>
|
113 |
+
<label class="answer-view-<?php echo $answer->answer_view_format; ?>">
|
|
|
|
|
|
|
|
|
|
|
114 |
<div class="quiz-answer-input-body">
|
115 |
<?php
|
|
|
|
|
|
|
116 |
if ($answer->answer_view_format === 'image' || $answer->answer_view_format === 'text_image'){
|
117 |
?>
|
118 |
<div class="quiz-answer-image-wrap">
|
121 |
<?php
|
122 |
}
|
123 |
?>
|
124 |
+
<div class="quiz-answer-input-bottom">
|
125 |
+
<div class="quiz-answer-input-field">
|
126 |
+
<input name="attempt[<?php echo $is_started_quiz->attempt_id; ?>][quiz_question][<?php echo $question->question_id; ?>]" type="radio" value="<?php echo $answer->answer_id; ?>">
|
127 |
+
<span> </span>
|
128 |
+
<?php
|
129 |
+
if ($answer->answer_view_format !== 'image'){ echo $answer->answer_title;}
|
130 |
+
?>
|
131 |
+
</div>
|
132 |
+
</div>
|
133 |
</div>
|
134 |
</label>
|
135 |
<?php
|
136 |
}elseif ($question_type === 'multiple_choice'){
|
137 |
?>
|
138 |
+
<label class="answer-view-<?php echo $answer->answer_view_format; ?>">
|
139 |
+
|
|
|
|
|
|
|
140 |
|
141 |
<div class="quiz-answer-input-body">
|
142 |
+
<?php if ($answer->answer_view_format === 'image' || $answer->answer_view_format === 'text_image'){ ?>
|
|
|
|
|
|
|
|
|
|
|
143 |
<div class="quiz-answer-image-wrap">
|
144 |
<img src="<?php echo wp_get_attachment_image_url($answer->image_id, 'full') ?>" />
|
145 |
</div>
|
146 |
+
<?php } ?>
|
147 |
+
|
148 |
+
<div class="quiz-answer-input-bottom">
|
149 |
+
<div class="quiz-answer-input-field">
|
150 |
+
<input name="attempt[<?php echo $is_started_quiz->attempt_id; ?>][quiz_question][<?php echo $question->question_id; ?>][]" type="checkbox" value="<?php echo $answer->answer_id; ?>">
|
151 |
+
<span> </span>
|
152 |
+
<?php if ($answer->answer_view_format !== 'image'){
|
153 |
+
echo $answer->answer_title;
|
154 |
+
} ?>
|
155 |
+
</div>
|
156 |
+
</div>
|
157 |
</div>
|
158 |
</label>
|
159 |
<?php
|
tutor.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://https://themeum.com/tutor
|
|
5 |
Description: Tutor is a complete solution for creating a Learning Management System in WordPress way. It can help you to create
|
6 |
courses, lessons and quizzes.
|
7 |
Author: Themeum
|
8 |
-
Version: 1.0.
|
9 |
Author URI: http://themeum.com
|
10 |
Requires at least: 4.5
|
11 |
Tested up to: 4.9
|
@@ -18,7 +18,7 @@ if ( ! defined( 'ABSPATH' ) )
|
|
18 |
/**
|
19 |
* Defined the tutor main file
|
20 |
*/
|
21 |
-
define('TUTOR_VERSION', '1.0.
|
22 |
define('TUTOR_FILE', __FILE__);
|
23 |
|
24 |
if ( ! function_exists('tutor')) {
|
5 |
Description: Tutor is a complete solution for creating a Learning Management System in WordPress way. It can help you to create
|
6 |
courses, lessons and quizzes.
|
7 |
Author: Themeum
|
8 |
+
Version: 1.0.2
|
9 |
Author URI: http://themeum.com
|
10 |
Requires at least: 4.5
|
11 |
Tested up to: 4.9
|
18 |
/**
|
19 |
* Defined the tutor main file
|
20 |
*/
|
21 |
+
define('TUTOR_VERSION', '1.0.2');
|
22 |
define('TUTOR_FILE', __FILE__);
|
23 |
|
24 |
if ( ! function_exists('tutor')) {
|
views/metabox/instructors-metabox.php
CHANGED
@@ -26,7 +26,7 @@
|
|
26 |
|
27 |
<div class="tutor-add-instructor-button-wrap">
|
28 |
<p>
|
29 |
-
<button type="button" class="tutor_btn_lg tutor-add-instructor-btn"> <i class="tutor-icon-add-line"></i> <?php _e('Add Instructor', 'tutor'); ?> </button>
|
30 |
</p>
|
31 |
</div>
|
32 |
|
26 |
|
27 |
<div class="tutor-add-instructor-button-wrap">
|
28 |
<p>
|
29 |
+
<button type="button" class="tutor_btn_lg tutor-add-instructor-btn"> <i class="tutor-icon-add-line"></i> <?php _e('Add More Instructor', 'tutor'); ?> </button>
|
30 |
</p>
|
31 |
</div>
|
32 |
|
views/modal/edit_quiz.php
CHANGED
@@ -30,7 +30,7 @@ if ( ! $quiz){
|
|
30 |
<a href="#quiz-builder-tab-settings" class="tutor-quiz-modal-tab-item">
|
31 |
<i class="tutor-icon-settings-1"></i> <?php _e('Settings', 'tutor'); ?>
|
32 |
</a>
|
33 |
-
<a href="#quiz-builder-tab-advanced-options" class="tutor-quiz-modal-tab-item">
|
34 |
<i class="tutor-icon-filter-tool-black-shape"></i> <?php _e('Advanced Options', 'tutor'); ?>
|
35 |
</a>
|
36 |
|
@@ -78,7 +78,7 @@ if ( ! $quiz){
|
|
78 |
if ($questions){
|
79 |
foreach ($questions as $question){
|
80 |
?>
|
81 |
-
<div class="quiz-builder-question-wrap">
|
82 |
<div class="quiz-builder-question">
|
83 |
<span class="question-sorting">
|
84 |
<i class="tutor-icon-move"></i>
|
@@ -224,11 +224,13 @@ if ( ! $quiz){
|
|
224 |
<div class="tutor-quiz-builder-modal-control-btn-group">
|
225 |
<div class="quiz-builder-btn-group-left">
|
226 |
<a href="#quiz-builder-tab-questions" class="quiz-modal-tab-navigation-btn quiz-modal-btn-back"><?php _e('Back', 'tutor'); ?></a>
|
227 |
-
<a href="#quiz-builder-tab-advanced-options" class="quiz-modal-tab-navigation-btn quiz-modal-settings-save-btn"><?php _e('Save
|
228 |
-
|
229 |
-
|
230 |
-
<a href="#quiz-builder-tab-questions" class="quiz-modal-tab-navigation-btn quiz-modal-btn-cancel"><?php _e('Cancel', 'tutor'); ?></a>
|
231 |
</div>
|
|
|
|
|
|
|
232 |
</div>
|
233 |
</div>
|
234 |
|
@@ -366,11 +368,13 @@ if ( ! $quiz){
|
|
366 |
<div class="tutor-quiz-builder-modal-control-btn-group">
|
367 |
<div class="quiz-builder-btn-group-left">
|
368 |
<a href="#quiz-builder-tab-settings" class="quiz-modal-tab-navigation-btn quiz-modal-btn-back"><?php _e('Back', 'tutor'); ?></a>
|
369 |
-
<a href="#quiz-builder-tab-advanced-options" class="quiz-modal-tab-navigation-btn quiz-modal-settings-save-btn"><?php _e('Save
|
370 |
-
|
371 |
-
|
372 |
-
<a href="#quiz-builder-tab-questions" class="quiz-modal-tab-navigation-btn quiz-modal-btn-cancel"><?php _e('Cancel', 'tutor'); ?></a>
|
373 |
</div>
|
|
|
|
|
|
|
374 |
</div>
|
375 |
|
376 |
|
30 |
<a href="#quiz-builder-tab-settings" class="tutor-quiz-modal-tab-item">
|
31 |
<i class="tutor-icon-settings-1"></i> <?php _e('Settings', 'tutor'); ?>
|
32 |
</a>
|
33 |
+
<a href="#quiz-builder-tab-advanced-options" class="advanced-options-tab-item tutor-quiz-modal-tab-item">
|
34 |
<i class="tutor-icon-filter-tool-black-shape"></i> <?php _e('Advanced Options', 'tutor'); ?>
|
35 |
</a>
|
36 |
|
78 |
if ($questions){
|
79 |
foreach ($questions as $question){
|
80 |
?>
|
81 |
+
<div class="quiz-builder-question-wrap" data-question-id="<?php echo $question->question_id; ?>">
|
82 |
<div class="quiz-builder-question">
|
83 |
<span class="question-sorting">
|
84 |
<i class="tutor-icon-move"></i>
|
224 |
<div class="tutor-quiz-builder-modal-control-btn-group">
|
225 |
<div class="quiz-builder-btn-group-left">
|
226 |
<a href="#quiz-builder-tab-questions" class="quiz-modal-tab-navigation-btn quiz-modal-btn-back"><?php _e('Back', 'tutor'); ?></a>
|
227 |
+
<a href="#quiz-builder-tab-advanced-options" class="quiz-modal-tab-navigation-btn quiz-modal-settings-save-btn"><?php _e('Save', 'tutor'); ?></a>
|
228 |
+
<a href="#quiz-builder-tab-advanced-options" class="quiz-modal-tab-navigation-btn quiz-modal-settings-save-btn"
|
229 |
+
data-action="modal_close"><?php _e('Save & Exit', 'tutor'); ?></a>
|
|
|
230 |
</div>
|
231 |
+
<!--<div class="quiz-builder-btn-group-right">
|
232 |
+
<a href="#quiz-builder-tab-questions" class="quiz-modal-tab-navigation-btn quiz-modal-btn-cancel"><?php /*_e('Cancel', 'tutor'); */?></a>
|
233 |
+
</div>-->
|
234 |
</div>
|
235 |
</div>
|
236 |
|
368 |
<div class="tutor-quiz-builder-modal-control-btn-group">
|
369 |
<div class="quiz-builder-btn-group-left">
|
370 |
<a href="#quiz-builder-tab-settings" class="quiz-modal-tab-navigation-btn quiz-modal-btn-back"><?php _e('Back', 'tutor'); ?></a>
|
371 |
+
<a href="#quiz-builder-tab-advanced-options" class="quiz-modal-tab-navigation-btn quiz-modal-settings-save-btn"><?php _e('Save', 'tutor'); ?></a>
|
372 |
+
<a href="#quiz-builder-tab-advanced-options" class="quiz-modal-tab-navigation-btn quiz-modal-settings-save-btn"
|
373 |
+
data-action="modal_close"><?php _e('Save & Exit', 'tutor'); ?></a>
|
|
|
374 |
</div>
|
375 |
+
<!--<div class="quiz-builder-btn-group-right">
|
376 |
+
<a href="#quiz-builder-tab-questions" class="quiz-modal-tab-navigation-btn quiz-modal-btn-cancel"><?php /*_e('Cancel', 'tutor'); */?></a>
|
377 |
+
</div>-->
|
378 |
</div>
|
379 |
|
380 |
|
views/modal/question_answer_edit_form.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
if ($question_type === 'open_ended'){
|
3 |
-
echo '<p style="color: #ff0000;">No
|
4 |
return '';
|
5 |
}
|
6 |
|
1 |
<?php
|
2 |
if ($question_type === 'open_ended'){
|
3 |
+
echo '<p style="color: #ff0000;">No option is necessary for this answer type</p>';
|
4 |
return '';
|
5 |
}
|
6 |
|
views/modal/question_answer_form.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
if ($question_type === 'open_ended' || $question_type === 'short_answer'){
|
3 |
-
echo '<p style="color: #ff0000;">No
|
4 |
return '';
|
5 |
}
|
6 |
|
1 |
<?php
|
2 |
if ($question_type === 'open_ended' || $question_type === 'short_answer'){
|
3 |
+
echo '<p style="color: #ff0000;">No option is necessary for this answer type</p>';
|
4 |
return '';
|
5 |
}
|
6 |
|