Skip to content

Commit

Permalink
Add childof search to addquestions and manageqset
Browse files Browse the repository at this point in the history
Add self-study course selection warning on enroll
  • Loading branch information
drlippman committed Sep 5, 2013
1 parent d85a6fc commit 7d8ad4f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
2 changes: 2 additions & 0 deletions course/addquestions.php
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,8 @@
$searchlikes = "((imas_questionset.description LIKE '%".implode("%' AND imas_questionset.description LIKE '%",$searchterms)."%') ";
if (substr($safesearch,0,3)=='id=') {
$searchlikes = "imas_questionset.id='".substr($safesearch,3)."' AND ";
} else if (substr($safesearch,0,7)=='childof') {
$searchlikes = "imas_questionset.ancestors REGEXP '[[:<:]]".substr($safesearch,8)."[[:>:]]' AND ";
} else if (is_numeric($safesearch)) {
$searchlikes .= "OR imas_questionset.id='$safesearch') AND ";
} else {
Expand Down
2 changes: 2 additions & 0 deletions course/manageqset.php
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,8 @@
$searchlikes = "imas_questionset.description REGEXP '$safesearch' AND ";
} else if ($safesearch=='isbroken') {
$searchlikes = "imas_questionset.broken=1 AND ";
} else if (substr($safesearch,0,7)=='childof') {
$searchlikes = "imas_questionset.ancestors REGEXP '[[:<:]]".substr($safesearch,8)."[[:>:]]' AND ";
} else {$searchterms = explode(" ",$safesearch);
$searchlikes = "((imas_questionset.description LIKE '%".implode("%' AND imas_questionset.description LIKE '%",$searchterms)."%') ";
if (substr($safesearch,0,3)=='id=') {
Expand Down
20 changes: 16 additions & 4 deletions forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,26 @@
echo '<p>Select the course you\'d like to enroll in</p>';
echo '<p><select id="courseselect" name="courseselect" onchange="courseselectupdate(this);">';
echo '<option value="0" selected="selected">My teacher gave me a course ID (enter below)</option>';
echo '<optgroup label="Self-study courses">';
while ($row = mysql_fetch_row($result)) {
echo '<option value="'.$row[0].'">'.$row[1].'</option>';
}
echo '</optgroup>';
echo '</select></p>';
echo '<div id="courseinfo">';
echo '<script type="text/javascript"> function courseselectupdate(el) { var c = document.getElementById("courseinfo"); ';
echo 'if (el.value==0) {c.style.display="";} else {c.style.display="none";}}</script>';
echo '<script type="text/javascript"> function courseselectupdate(el) { var c = document.getElementById("courseinfo"); var c2 = document.getElementById("selfenrollwarn"); ';
echo 'if (el.value==0) {c.style.display="";c2.style.display="none";} else {c.style.display="none";c2.style.display="";}}</script>';
} else {
echo '<p>If you already know your course ID, you can enter it now. Otherwise, leave this blank and you can enroll later.</p>';
}
echo '<span class="form"><label for="courseid">Course ID:</label></span><input class="form" type="text" size="20" name="courseid"/><br class="form"/>';
echo '<span class="form"><label for="ekey">Enrollment Key:</label></span><input class="form" type="text" size="20" name="ekey"/><br class="form"/>';
if ($doselfenroll) {
echo '</div>';
echo '<div id="selfenrollwarn" style="color:red;display:none;">Warning: You have selected a non-credit self-study course. ';
echo 'If you are using '.$installname.' with an instructor-led course, this is NOT what you want; nothing you do in the self-study ';
echo 'course will be viewable by your instructor or count towards your course. For an instructor-led ';
echo 'course, you need to enter the course ID and key provided by your instructor.</div>';
}
}
echo "<div class=submit><input type=submit value='Sign Up'></div>\n";
Expand Down Expand Up @@ -217,20 +223,26 @@
echo '<p>Select the course you\'d like to enroll in</p>';
echo '<p><select id="courseselect" name="courseselect" onchange="courseselectupdate(this);">';
echo '<option value="0" selected="selected">My teacher gave me a course ID (enter below)</option>';
echo '<optgroup label="Self-study courses">';
while ($row = mysql_fetch_row($result)) {
echo '<option value="'.$row[0].'">'.$row[1].'</option>';
}
echo '</optgroup>';
echo '</select></p>';
echo '<div id="courseinfo">';
echo '<script type="text/javascript"> function courseselectupdate(el) { var c = document.getElementById("courseinfo"); ';
echo 'if (el.value==0) {c.style.display="";} else {c.style.display="none";}}</script>';
echo '<script type="text/javascript"> function courseselectupdate(el) { var c = document.getElementById("courseinfo"); var c2 = document.getElementById("selfenrollwarn"); ';
echo 'if (el.value==0) {c.style.display="";c2.style.display="none";} else {c.style.display="none";c2.style.display="";}}</script>';
} else {
echo '<p>If you already know your course ID, you can enter it now. Otherwise, leave this blank and you can enroll later.</p>';
}
echo '<span class="form"><label for="cid">Course ID:</label></span><input class="form" type="text" size="20" name="cid"/><br class="form"/>';
echo '<span class="form"><label for="ekey">Enrollment Key:</label></span><input class="form" type="text" size="20" name="ekey"/><br class="form"/>';
if ($doselfenroll) {
echo '</div>';
echo '<div id="selfenrollwarn" style="color:red;display:none;">Warning: You have selected a non-credit self-study course. ';
echo 'If you are using '.$installname.' with an instructor-led course, this is NOT what you want; nothing you do in the self-study ';
echo 'course will be viewable by your instructor or count towards your course. For an instructor-led ';
echo 'course, you need to enter the course ID and key provided by your instructor.</div>';
}
echo '<div class=submit><input type=submit value="Sign Up"></div></form>';
break;
Expand Down

0 comments on commit 7d8ad4f

Please sign in to comment.