From eb4231fc4c4d429b08f4fa0e5291656bcc776b90 Mon Sep 17 00:00:00 2001 From: drlippman Date: Thu, 13 Oct 2011 15:18:50 +0000 Subject: [PATCH] bug fix grade record error in forum replies add course selfenroll option to course enroll form git-svn-id: http://imathas.googlecode.com/svn/trunk@763 c89b4f0b-ac2a-0410-9773-c9071ee4f95d --- actions.php | 4 ++++ forms.php | 29 +++++++++++++++++++++++------ forums/posthandler.php | 8 ++++++-- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/actions.php b/actions.php index ad11503544..cbb0b4959d 100644 --- a/actions.php +++ b/actions.php @@ -265,6 +265,10 @@ echo "\nError: Guests can't enroll in courses0) { + $_POST['cid'] = $_POST['courseselect']; + $_POST['ekey'] = ''; + } if ($_POST['cid']=="" || !is_numeric($_POST['cid'])) { echo "\n"; echo "Please include Course ID. Try Again\n"; diff --git a/forms.php b/forms.php index 18201175b6..581c58f62d 100644 --- a/forms.php +++ b/forms.php @@ -201,12 +201,29 @@ case "enroll": echo '

Enroll in a Course

'; echo "
"; - echo ' -
- -
-
-
'; + if (isset($CFG['GEN']['selfenrolluser'])) { + echo '

Select the course you\'d like to enroll in

'; + echo '

'; + echo '
'; + echo ''; + } else { + echo '

If you already know your course ID, you can enter it now. Otherwise, leave this blank and you can enroll later.

'; + } + echo '
'; + echo '
'; + if (isset($CFG['GEN']['selfenrolluser'])) { + echo '
'; + } + echo '
'; break; case "unenroll": if (!isset($_GET['cid'])) { echo "Course ID not specified\n"; break;} diff --git a/forums/posthandler.php b/forums/posthandler.php index 131e94fc71..63a3b4216d 100644 --- a/forums/posthandler.php +++ b/forums/posthandler.php @@ -47,8 +47,11 @@ //$query = "UPDATE imas_forum_posts SET points='{$_POST['points']}' WHERE id='{$_GET['replyto']}'"; mysql_query($query) or die("Query failed : $query " . mysql_error()); } else { + $query = "SELECT userid FROM imas_forum_posts WHERE id='{$_GET['replyto']}'"; + $result = mysql_query($query) or die("Query failed : $query " . mysql_error()); + $uid = mysql_result($result,0,0); $query = "INSERT INTO imas_grades (gradetype,gradetypeid,userid,refid,score) VALUES "; - $query .= "('forum','$forumid','$userid','{$_GET['replyto']}','{$_POST['points']}')"; + $query .= "('forum','$forumid','$uid','{$_GET['replyto']}','{$_POST['points']}')"; mysql_query($query) or die("Query failed : $query " . mysql_error()); } } @@ -123,7 +126,7 @@ if ($line['isanon']==1) {echo "checked=1";} echo ">
"; } - if ($isteacher && $haspoints) { + if ($isteacher && $haspoints && $_GET['modify']=='reply') { echo 'Points for message you\'re replying to:'; echo '
'; } @@ -166,6 +169,7 @@ function printparents($id) { } printparents($_GET['replyto']); } + echo ''; require("../footer.php"); exit; }