echo "<p><input type=button onclick=\"window.location='gb-viewasid.php?stu={$stu}&gbmode={$gbmode}&cid={$cid}&from={$from}&asid={$_GET['asid']}&uid={$_GET['uid']}&breakfromgroup=confirmed'\" value=\"Really Separate\">\n"; echo "<input type=button value=\"Nevermind\" class=\"secondarybtn\" onclick=\"window.location='gb-viewasid.php?stu={$stu}&from={$from}&gbmode={$gbmode}&cid={$cid}&asid={$_GET['asid']}&uid={$_GET['uid']}'\"></p>\n"; exit; } } if (isset($_GET['clearscores']) && isset($_GET['asid']) && $isteacher) { if ($_GET['clearscores'] == "confirmed") { $query = "SELECT ias.assessmentid FROM imas_assessment_sessions AS ias "; $query .= "JOIN imas_assessments AS ia ON ias.assessmentid=ia.id WHERE ias.id='{$_GET['asid']}' AND ia.courseid='{$cid}'"; $result = mysql_query($query) or die("Query failed : {$query} " . mysql_error()); if (mysql_num_rows($result) > 0) { //check that is the right cid //$whereqry = getasidquery($_GET['asid']); $qp = getasidquery($_GET['asid']); //deleteasidfilesbyquery(array($qp[0]=>$qp[1]),1); deleteasidfilesbyquery2($qp[0], $qp[1], $qp[2], 1); $whereqry = " WHERE {$qp[0]}='{$qp[1]}' AND assessmentid='{$qp[2]}'"; $query = "SELECT seeds,lti_sourcedid FROM imas_assessment_sessions {$whereqry}"; $result = mysql_query($query) or die("Query failed : " . mysql_error()); $seeds = explode(',', mysql_result($result, 0, 0)); $ltisourcedid = mysql_result($result, 0, 1); if (strlen($ltisourcedid) > 1) { require_once "../includes/ltioutcomes.php"; updateLTIgrade('update', $ltisourcedid, $aid, 0); } $scores = array_fill(0, count($seeds), -1); $attempts = array_fill(0, count($seeds), 0); $lastanswers = array_fill(0, count($seeds), ''); $scorelist = implode(",", $scores); $attemptslist = implode(",", $attempts); $lalist = implode("~", $lastanswers);
function unenrollstu($cid, $tounenroll, $delforum = false, $deloffline = false, $withwithdraw = false, $delwikirev = false, $usereplaceby = false) { $forums = array(); $threads = array(); $query = "SELECT id FROM imas_forums WHERE courseid='{$cid}'"; $result = mysql_query($query) or die("Query failed : " . mysql_error()); while ($row = mysql_fetch_row($result)) { $forums[] = $row[0]; $q2 = "SELECT threadid FROM imas_forum_posts WHERE forumid='{$row[0]}'"; $r2 = mysql_query($q2) or die("Query failed : " . mysql_error()); while ($rw2 = mysql_fetch_row($r2)) { $threads[] = $rw2[0]; } } $threadlist = implode(',', $threads); $forumlist = implode(',', $forums); $assesses = array(); $query = "SELECT id FROM imas_assessments WHERE courseid='{$cid}'"; $result = mysql_query($query) or die("Query failed : " . mysql_error()); while ($row = mysql_fetch_row($result)) { $assesses[] = $row[0]; } $aidlist = implode(',', $assesses); $wikis = array(); $grpwikis = array(); $query = "SELECT id,groupsetid FROM imas_wikis WHERE courseid='{$cid}'"; $result = mysql_query($query) or die("Query failed : " . mysql_error()); while ($row = mysql_fetch_row($result)) { $wikis[] = $row[0]; if ($row[1] > 0) { $grpwikis[] = $row[0]; } } $wikilist = implode(',', $wikis); $grpwikilist = implode(',', $grpwikis); $drills = array(); $query = "SELECT id FROM imas_drillassess WHERE courseid='{$cid}'"; $result = mysql_query($query) or die("Query failed : " . mysql_error()); while ($row = mysql_fetch_row($result)) { $drills[] = $row[0]; } $drilllist = implode(',', $drills); $exttools = array(); $query = "SELECT id FROM imas_linkedtext WHERE courseid='{$cid}' AND points>0"; $result = mysql_query($query) or die("Query failed : " . mysql_error()); while ($row = mysql_fetch_row($result)) { $exttools[] = $row[0]; } $exttoolslist = implode(',', $exttools); $stugroups = array(); $query = "SELECT imas_stugroups.id FROM imas_stugroups JOIN imas_stugroupset ON imas_stugroups.groupsetid=imas_stugroupset.id WHERE imas_stugroupset.courseid='{$cid}'"; $result = mysql_query($query) or die("Query failed : " . mysql_error()); while ($row = mysql_fetch_row($result)) { $stugroups[] = $row[0]; } $curdir = rtrim(dirname(__FILE__), '/\\'); require_once "{$curdir}/filehandler.php"; if ($withwithdrawn == 'remove' || $usereplaceby) { require_once "{$curdir}/updateassess.php"; } if (count($tounenroll) > 0) { $gbitems = array(); $query = "SELECT id FROM imas_gbitems WHERE courseid='{$cid}'"; $result = mysql_query($query) or die("Query failed : " . mysql_error()); while ($row = mysql_fetch_row($result)) { $gbitems[] = $row[0]; } $gblist = implode(',', $gbitems); //new $stulist = "'" . implode("','", $tounenroll) . "'"; if (count($assesses) > 0) { deleteasidfilesbyquery2('userid', $tounenroll, $assesses); //deleteasidfilesbyquery(array('assessmentid'=>$assesses, 'userid'=>$tounenroll)); $query = "DELETE FROM imas_assessment_sessions WHERE assessmentid IN ({$aidlist}) AND userid IN ({$stulist})"; mysql_query($query) or die("Query failed : {$query}" . mysql_error()); $query = "DELETE FROM imas_exceptions WHERE assessmentid IN ({$aidlist}) AND userid IN ({$stulist})"; mysql_query($query) or die("Query failed : {$query}" . mysql_error()); } if (count($drills) > 0) { $query = "DELETE FROM imas_drillassess_sessions WHERE drillassessid IN ({$drilllist}) AND userid IN ({$stulist})"; mysql_query($query) or die("Query failed : {$query}" . mysql_error()); } if (count($exttools) > 0) { $query = "DELETE FROM imas_grades WHERE gradetype='exttool' AND gradetypeid IN ({$exttoolslist}) AND userid IN ({$stulist})"; mysql_query($query) or die("Query failed : {$query}" . mysql_error()); } if (count($gbitems) > 0) { $query = "DELETE FROM imas_grades WHERE gradetype='offline' AND gradetypeid IN ({$gblist}) AND userid IN ({$stulist})"; mysql_query($query) or die("Query failed : {$query}" . mysql_error()); } if (count($threads) > 0) { $query = "DELETE FROM imas_forum_views WHERE threadid IN ({$threadlist}) AND userid IN ({$stulist})"; mysql_query($query) or die("Query failed : {$query}" . mysql_error()); } if (count($wikis) > 0) { $query = "DELETE FROM imas_wiki_views WHERE wikiid IN ({$wikilist}) AND userid IN ({$stulist})"; mysql_query($query) or die("Query failed : {$query}" . mysql_error()); } if (count($stugroups) > 0) { $stugrouplist = implode(',', $stugroups); $query = "DELETE FROM imas_stugroupmembers WHERE userid IN ({$stulist}) AND stugroupid IN ({$stugrouplist})"; mysql_query($query) or die("Query failed : {$query}" . mysql_error()); } } if ($delforum && count($forums) > 0) { $query = "DELETE imas_forum_threads FROM imas_forum_posts JOIN imas_forum_threads ON imas_forum_posts.threadid=imas_forum_threads.id AND imas_forum_posts.posttype=0 WHERE imas_forum_threads.forumid IN ({$forumlist})"; mysql_query($query) or die("Query failed : " . mysql_error()); $query = "SELECT id FROM imas_forum_posts WHERE forumid IN ({$forumlist}) AND files<>''"; $result = mysql_query($query) or die("Query failed : " . mysql_error()); while ($row = mysql_fetch_row($result)) { deleteallpostfiles($row[0]); } $query = "DELETE FROM imas_forum_posts WHERE forumid IN ({$forumlist}) AND posttype=0"; mysql_query($query) or die("Query failed : " . mysql_error()); if (count($tounenroll) > 0) { $query = "DELETE FROM imas_grades WHERE gradetype='forum' AND gradetypeid IN ({$forumlist}) AND userid IN ({$stulist})"; mysql_query($query) or die("Query failed : " . mysql_error()); } /* //old foreach ($forums as $fid) { $query = "DELETE imas_forum_threads FROM imas_forum_posts JOIN imas_forum_threads ON imas_forum_posts.threadid=imas_forum_threads.id AND imas_forum_posts.posttype=0 WHERE imas_forum_threads.forumid='$fid'"; mysql_query($query) or die("Query failed : " . mysql_error()); $query = "DELETE FROM imas_forum_posts WHERE forumid='$fid' AND posttype=0"; mysql_query($query) or die("Query failed : " . mysql_error()); }*/ } if ($delwikirev === 1 && count($wikis) > 0) { $query = "DELETE FROM imas_wiki_revisions WHERE wikiid IN ({$wikilist})"; mysql_query($query) or die("Query failed : " . mysql_error()); } else { if ($delwikirev === 2 && count($grpwikis) > 0) { $query = "DELETE FROM imas_wiki_revisions WHERE wikiid IN ({$grpwikilist})"; mysql_query($query) or die("Query failed : " . mysql_error()); } } if ($deloffline) { $query = "DELETE FROM imas_gbitems WHERE courseid='{$cid}'"; mysql_query($query) or die("Query failed : " . mysql_error()); } if ($withwithdraw == 'unwithdraw' && count($assesses) > 0) { $query = "UPDATE imas_questions SET withdrawn=0 WHERE assessmentid IN ({$aidlist})"; mysql_query($query) or die("Query failed : " . mysql_error()); /*foreach ($assesses as $aid) { $query = "UPDATE imas_questions SET withdrawn=0 WHERE assessmentid='$aid'"; mysql_query($query) or die("Query failed : " . mysql_error()); }*/ } if ($withwithdrawn == 'remove' || $usereplaceby) { $msg = updateassess($cid, $withwithdraw == 'remove', $usereplaceby); } if (count($tounenroll) > 0) { $query = "DELETE FROM imas_students WHERE userid IN ({$stulist}) AND courseid='{$cid}'"; mysql_query($query) or die("Query failed : {$query}" . mysql_error()); $query = "DELETE FROM imas_login_log WHERE userid IN ({$stulist}) AND courseid='{$cid}'"; mysql_query($query) or die("Query failed : {$query}" . mysql_error()); $query = "DELETE FROM imas_content_track WHERE userid IN ({$stulist}) AND courseid='{$cid}'"; mysql_query($query) or die("Query failed : {$query}" . mysql_error()); } }
if ($lael == "ReGen") { $newla[] = "ReGen"; } } $newla[] = "ReGen"; $lastanswers[$i] = implode('##', $newla); $reattempting = array(); if (isset($qi[$questions[$i]]['answeights'])) { $reloadqi = true; } } } else { if ($_GET['regenall'] == "fromscratch" && $testsettings['testtype'] == "Practice" && !$isreview) { require_once "../includes/filehandler.php"; //deleteasidfilesbyquery(array('userid'=>$userid,'assessmentid'=>$testsettings['id']),1); deleteasidfilesbyquery2('userid', $userid, $testsettings['id'], 1); $query = "DELETE FROM imas_assessment_sessions WHERE userid='{$userid}' AND assessmentid='{$testsettings['id']}' LIMIT 1"; $result = mysql_query($query) or die("Query failed : {$query}: " . mysql_error()); header('Location: ' . $urlmode . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . "/showtest.php?cid={$testsettings['courseid']}&id={$testsettings['id']}"); exit; } } } recordtestdata(); } if (isset($_GET['jumptoans']) && $testsettings['showans'] === 'J') { $tojump = $_GET['jumptoans']; $attempts[$tojump] = $qi[$questions[$tojump]]['attempts']; if ($scores[$tojump] < 0) { $scores[$tojump] = 0; $rawscores[$tojump] = 0;
/*** pre-html data manipulation, including function code *******/ //set some page specific variables and counters $overwriteBody = 0; $body = ""; if (!isset($teacherid) && !isset($tutorid) && !isset($studentid) && !isset($guestid)) { // loaded by a NON-teacher $overwriteBody = 1; $body = _("You are not enrolled in this course. Please return to the <a href=\"../index.php\">Home Page</a> and enroll\n"); } else { // PERMISSIONS ARE OK, PROCEED WITH PROCESSING $cid = $_GET['cid']; if (isset($teacherid) && isset($sessiondata['sessiontestid']) && !isset($sessiondata['actas']) && $sessiondata['courseid'] == $cid) { //clean up coming out of an assessment require_once "../includes/filehandler.php"; //deleteasidfilesbyquery(array('id'=>$sessiondata['sessiontestid']),1); deleteasidfilesbyquery2('id', $sessiondata['sessiontestid'], null, 1); $query = "DELETE FROM imas_assessment_sessions WHERE id='{$sessiondata['sessiontestid']}' LIMIT 1"; $result = mysql_query($query) or die("Query failed : {$query}: " . mysql_error()); } if (isset($teacherid) && isset($_GET['from']) && isset($_GET['to'])) { $from = $_GET['from']; $to = $_GET['to']; $block = $_GET['block']; $query = "SELECT itemorder FROM imas_courses WHERE id='{$_GET['cid']}'"; $result = mysql_query($query) or die("Query failed : " . mysql_error()); $items = unserialize(mysql_result($result, 0, 0)); $blocktree = explode('-', $block); $sub =& $items; for ($i = 1; $i < count($blocktree) - 1; $i++) { $sub =& $sub[$blocktree[$i] - 1]['items']; //-1 to adjust for 1-indexing