Contents
- 1 Project ROAR: Rhea Online Testing Resource
- 1.1 Introduction
- 1.2 The ROAR Team
- 1.3 Documentation
- 1.4 The initial thought process: how ROAR was born
- 1.5 Tools
- 1.6 Code Repository
- 1.7 <a href="#">Create your Own Quiz</a>
- 1.8 Select a question type to add to your quiz <form action="new.php?action=multiple" method="post"><input type="submit" value = "Multiple Choice"></form> <form action="new.php?action=numeric" method="post"><input type="submit" value = "Numeric"></form> <form action="new.php?action=text" method="post"><input type="submit" value = "Text"></form> </div> </div> </div> </div> </div> </div> FOO; return $out; } //Question forms begin here: function drawMCQ($assessment_id){ $MCQ_form = <<<MCQ_html <h2 class="title"><a href="#">New Question</a></h2> <form name="multiplechoice" method="post" action="new.php?action=writeMCQ2DB"> Enter Question Text: <input type = "text" name="qtext" cols="40" rows="5"> </textarea> A. <input name="A" type="text"/> B. <input name="B" type="text"/> C. <input name="C" type="text"/> D. <input name="D" type="text"/> Correct Option: <select name="answer"> <option value="1">A</option> <option value="2">B</option> <option value="3">C</option> <option value="4">D</option> </select> Total Points <input name="points" type="text"> <input type="submit" value="Submit" /> </form> </div> MCQ_html; list($html,$assessment_id,$_POST["qtext"],$_POST["A"],$_POST["B"],$_POST["C"],$_POST["D"],$_POST["answer"],$_POST["points"]) = $MCQ_stuff ; return $MCQ_form; //writeMCQ2DB($assessment_id,$_POST["qtext"],$_POST["A"],$_POST["B"],$_POST["C"],$_POST["D"],$_POST["answer"],$_POST["points"]); return $MCQ_form; } function drawNum($assessment_id){ $NUM_form = <<<NUM_html <h2 class="title"><a href="#">New Question</a></h2> Question number: <form name="Multiple choice" method="post" action="new.php?action=writeDB"> Enter Question Text: <textarea name="question text" cols="40" rows="5"> Enter question text here... </textarea> Correct Answer:<input name="correct" type="text"/> Total Points <input name="points" type="text"> <input type="submit" value="Submit" /> </form> </div> NUM_html; return $NUM_form; } function drawTxt($assessment_id){ $TXT_form = <<<TEXT_html <h2 class="title"><a href="#">New Question</a></h2> Question number: <form name="text" method="post" action="new.php?action=writeDB"> Enter Question Text: <textarea name="question text" cols="40" rows="5"> Enter question text here... </textarea> Correct Answer:<input name="correct" type="text"/> Total Points <input name="points" type="text"> <input type="submit" value="Submit" /> </form> </div> TEXT_html; return $TXT_form; } //********Cosmetic functions****** //******************************** function default_html() { $_html = <<<FOO <h2 class="title"><a href="#">Create your Own Quiz</a></h2> <form action="new.php?action=createQuiz" method="post"> Enter Quiz title : <input type="text" name="qname" /> Enter Total points : <input type="text" name="points" /> Time Limit? <input type="radio" name="time" value="Yes" /> Yes                        <input type="radio" name="time" value="no" /> No <button type="submit" name="create">Create</button> </form> </form> </div> FOO; return $_html; } function site_base(){ $base_html = <<<EOD <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="keywords" content="" /> <meta name="description" content="" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>ROAR - Create Quiz</title> <link href="style.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body> <a href="index.php"> <img src="images/logocool.gif" border="0" > </a> <a href="#">RHEA Home</a> <a href="#">New Assignments</a> <a href="#">Create Your Own Assignment</a> <a href="#">Scores</a> <a href="#">About</a> <a href="#">Links</a> <a href="#">Contact Us</a> EOD; return $base_html; } //******************************** //***GENERATES HTML BASED ON USER ACTION*** function handleAction($action){ if ($action == "createQuiz") { $assessment_id = doCreateQuiz(); $html .= drawNewQuestionForm($assesment_id); } else if ($action == "submitNewQuestion") { $assessment_id = $_POST["assessment_id"]; // doCreateQuestion($assessment_id) $html .= drawNewQuestionForm($assessment_id); } else if ($action == "addQuestion"){ $html .= addQuestion($assessment_id); //We have now selected the question }else if ($action == "multiple"){ $html .= drawMCQ($assessment_id); //Go to MCQ form }else if($action == "numeric"){ $html .= drawNum($assessment_id); //Go to Numeric form }else if($action == "text"){ $html .= drawTxt($assessment_id); //Go to Text Form //This action puts respective form data into the database }else if($action == "writeMCQ2DB"){ writeMCQ2DB($assessment_id,$_POST["qtext"],$_POST["A"],$_POST["B"],$_POST["C"],$_POST["D"],$_POST["answer"],$_POST["points"]); } else { // if createNewQuiz $html .= default_html(); } return $html; } //***************************************** $html = site_base(); //Draw basic page $action = $_GET["action"]; //Receive user action $html .= handleAction($action); //Menu to handle action echo $html; //Echo action specific html //**************************************** //**************************************** //**************************************** ?> <h2>Login</h2> <form> Username: <input type="text" name="" /> Password: <input type="text" name="" /> <input type="submit" value="login" /> </form> </a> <h2>Assigment list</h2> <a href="#">New Assignments</a> (3)note <a href="#">Completed</a> (42)list <h2><a href="">Make a quiz</a></h2> <h2>Archives</h2> <a href="#">December 2009</a> (29) <a href="#">November 2009</a> (30) <a href="#">October 2009</a> (31) </ul> </div> </div> </div> Rhea Online Assessment Resource</a>. </body> </html> Dlamba 20:47, 4 April 2010 (UTC)
Project ROAR: Rhea Online Testing Resource
Introduction
Project ROAR was initiated in the Spring semester of 2010, as an attempt to provide students and professors the ability to create online tests; a forum for academic interaction, where professors could test students, and students in turn could post their own questions. The inspiration for this project came from the evident lack of an open source testing platform. Freshmen in the school of engineering, physics and math for example, are required to pay as much as $25 for similar testing software, simply to have access to pre-existing quizzes and tests. The RHEA Development team decided to overcome this problem by conceptualizing an open source web-app based on the Rhea server, that would give students and professors the same ability without the need for these expensive third party software.
The ROAR Team
- Professor Mireille Boutin (Faculty Adviser)
- Zach Mason (Graduate Student Adviser)
- Aakash Lamba (Co-Project lead, programmer, Web Designer)
- Dhruv Lamba (Co-Project lead, programmer, Web Designer)
Documentation
- Project ROAR is intended to be a long-term project that starts off with a concept and basic functionality, which can then be expanded by future teams.
- This page will serve as the ROAR development team project log, wherein all the documentation and project details may be accessed by future development teams.
The initial thought process: how ROAR was born
This section includes a preview of what the development team initially came up with for how ROAR should look and feel, as well as its functionality. The following PDF includes the thinking behind the name ROAR, as well as a mock web page showing its intended features.
Tools
- Since the eventual goal for ROAR is to be integrated into the MediaWiki platform where RHEA lives, what is needed is a php or javascript based web app that communicated with the RHEA database.
- Therefore, for those interested in the project, a working knowledge of the following tools is recommended:
- HTML
- PHP
- CSS
- SQL
- In addition knowing how to set up and work on a LAMP/WAMP server is very useful.
Code Repository
//(for username and password contact the development team)
<?php
function writeMCQ2DB($assessment_id,$question_text,$choiceA,$choiceB,$choiceC,$choiceD,$correctChoice,$points){
echo $MCQ_stuff; $con = mysql_connect("localhost","username","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("rhea", $con);
mysql_query("INSERT INTO roar_MCQ (assessment_id,q_text,choice_a,choice_b,choice_c,choice_d,correct,points)
VALUES ('$assessment_id,$question_text,$choiceA,$choiceB,$choiceC,$choiceD,$correctChoice,$points')");
mysql_select_db("rhea", $con);
mysql_close($con);
}
function doCreateQuiz() { // session_start();
$con = mysql_connect("localhost","username","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("rhea", $con);
mysql_query("INSERT INTO roar_assessments (name) VALUES ('$_POST[qname]')");
mysql_select_db("rhea", $con);
$result = mysql_query("SELECT id FROM roar_assessments WHERE name = '$_POST[qname]'");
//echo $result;
$as_id = 0;
while($row = mysql_fetch_array($result)) { $as_id = $row['id'];
}
// echo $as_id;
$_SESSION['id'] = $as_id;
mysql_close($con); return $as_id; }
function drawNewQuestionForm($assessment_id) {
$out = <<<FOO
<a href="#">Create your Own Quiz</a>
<?php echo $id; ?>
Select a question type to add to your quiz
<form action="new.php?action=multiple" method="post"><input type="submit" value = "Multiple Choice"></form>
<form action="new.php?action=numeric" method="post"><input type="submit" value = "Numeric"></form>
<form action="new.php?action=text" method="post"><input type="submit" value = "Text"></form>
</div>
</div>
</div>
</div>
</div>
</div>
FOO;
return $out;
}
//Question forms begin here:
function drawMCQ($assessment_id){
$MCQ_form = <<<MCQ_html
<h2 class="title"><a href="#">New Question</a></h2>
<form name="multiplechoice" method="post" action="new.php?action=writeMCQ2DB">
Enter Question Text:
<input type = "text" name="qtext" cols="40" rows="5">
</textarea>
A. <input name="A" type="text"/>
B. <input name="B" type="text"/>
C. <input name="C" type="text"/>
D. <input name="D" type="text"/>
Correct Option:
<select name="answer">
<option value="1">A</option>
<option value="2">B</option>
<option value="3">C</option>
<option value="4">D</option>
</select>
Total Points <input name="points" type="text">
<input type="submit" value="Submit" />
</form>
</div>
MCQ_html;
list($html,$assessment_id,$_POST["qtext"],$_POST["A"],$_POST["B"],$_POST["C"],$_POST["D"],$_POST["answer"],$_POST["points"]) = $MCQ_stuff ;
return $MCQ_form;
//writeMCQ2DB($assessment_id,$_POST["qtext"],$_POST["A"],$_POST["B"],$_POST["C"],$_POST["D"],$_POST["answer"],$_POST["points"]);
return $MCQ_form;
}
function drawNum($assessment_id){
$NUM_form = <<<NUM_html
<h2 class="title"><a href="#">New Question</a></h2>
Question number:
<form name="Multiple choice" method="post" action="new.php?action=writeDB">
Enter Question Text:
<textarea name="question text" cols="40" rows="5">
Enter question text here...
</textarea>
Correct Answer:<input name="correct" type="text"/>
Total Points <input name="points" type="text">
<input type="submit" value="Submit" />
</form>
</div>
NUM_html;
return $NUM_form;
}
function drawTxt($assessment_id){
$TXT_form = <<<TEXT_html
<h2 class="title"><a href="#">New Question</a></h2>
Question number:
<form name="text" method="post" action="new.php?action=writeDB">
Enter Question Text:
<textarea name="question text" cols="40" rows="5">
Enter question text here...
</textarea>
Correct Answer:<input name="correct" type="text"/>
Total Points <input name="points" type="text">
<input type="submit" value="Submit" />
</form>
</div>
TEXT_html;
return $TXT_form;
}
//********Cosmetic functions******
//********************************
function default_html() {
$_html = <<<FOO
<h2 class="title"><a href="#">Create your Own Quiz</a></h2>
<form action="new.php?action=createQuiz" method="post">
Enter Quiz title :
<input type="text" name="qname" />
Enter Total points :
<input type="text" name="points" />
Time Limit?
<input type="radio" name="time" value="Yes" /> Yes
                      
<input type="radio" name="time" value="no" /> No
<button type="submit" name="create">Create</button>
</form>
</form>
</div>
FOO;
return $_html;
}
function site_base(){
$base_html = <<<EOD
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>ROAR - Create Quiz</title>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<a href="index.php">
<img src="images/logocool.gif" border="0" >
</a>
EOD;
return $base_html;
}
//********************************
//***GENERATES HTML BASED ON USER ACTION***
function handleAction($action){
if ($action == "createQuiz") {
$assessment_id = doCreateQuiz();
$html .= drawNewQuestionForm($assesment_id);
} else if ($action == "submitNewQuestion") {
$assessment_id = $_POST["assessment_id"];
// doCreateQuestion($assessment_id)
$html .= drawNewQuestionForm($assessment_id);
} else if ($action == "addQuestion"){
$html .= addQuestion($assessment_id);
//We have now selected the question
}else if ($action == "multiple"){
$html .= drawMCQ($assessment_id); //Go to MCQ form
}else if($action == "numeric"){
$html .= drawNum($assessment_id); //Go to Numeric form
}else if($action == "text"){
$html .= drawTxt($assessment_id); //Go to Text Form
//This action puts respective form data into the database
}else if($action == "writeMCQ2DB"){
writeMCQ2DB($assessment_id,$_POST["qtext"],$_POST["A"],$_POST["B"],$_POST["C"],$_POST["D"],$_POST["answer"],$_POST["points"]);
}
else {
// if createNewQuiz
$html .= default_html();
}
return $html;
}
//*****************************************
$html = site_base(); //Draw basic page
$action = $_GET["action"]; //Receive user action
$html .= handleAction($action); //Menu to handle action
echo $html; //Echo action specific html
//****************************************
//****************************************
//****************************************
?>
</div>
</div>
</div>
</body>
</html>
Dlamba 20:47, 4 April 2010 (UTC)
return $out; }
<h2 class="title"><a href="#">New Question</a></h2>
<form name="multiplechoice" method="post" action="new.php?action=writeMCQ2DB">
Enter Question Text:
<input type = "text" name="qtext" cols="40" rows="5">
</textarea>
A. <input name="A" type="text"/>
B. <input name="B" type="text"/>
C. <input name="C" type="text"/>
D. <input name="D" type="text"/>
Correct Option:
<select name="answer">
<option value="1">A</option> <option value="2">B</option> <option value="3">C</option> <option value="4">D</option> </select>
Total Points <input name="points" type="text">
<input type="submit" value="Submit" />
</form>
<h2 class="title"><a href="#">New Question</a></h2>
Question number:
<form name="Multiple choice" method="post" action="new.php?action=writeDB">
Enter Question Text:
<textarea name="question text" cols="40" rows="5">
Enter question text here...
</textarea>
Correct Answer:<input name="correct" type="text"/>
Total Points <input name="points" type="text">
<input type="submit" value="Submit" />
</form>
<h2 class="title"><a href="#">New Question</a></h2>
Question number:
<form name="text" method="post" action="new.php?action=writeDB">
Enter Question Text:
<textarea name="question text" cols="40" rows="5">
Enter question text here...
</textarea>
Correct Answer:<input name="correct" type="text"/>
Total Points <input name="points" type="text">
<input type="submit" value="Submit" />
</form>
<h2 class="title"><a href="#">Create your Own Quiz</a></h2>
<form action="new.php?action=createQuiz" method="post">
Enter Quiz title :
<input type="text" name="qname" />
Enter Total points :
<input type="text" name="points" />
Time Limit?
<input type="radio" name="time" value="Yes" /> Yes
                      
<input type="radio" name="time" value="no" /> No
<button type="submit" name="create">Create</button> </form>
</form>
<a href="index.php"> <img src="images/logocool.gif" border="0" > </a>
EOD;
return $base_html;
} //********************************
//***GENERATES HTML BASED ON USER ACTION***
function handleAction($action){
if ($action == "createQuiz") {
$assessment_id = doCreateQuiz();
$html .= drawNewQuestionForm($assesment_id);
} else if ($action == "submitNewQuestion") { $assessment_id = $_POST["assessment_id"]; // doCreateQuestion($assessment_id)
$html .= drawNewQuestionForm($assessment_id);
} else if ($action == "addQuestion"){
$html .= addQuestion($assessment_id); //We have now selected the question
}else if ($action == "multiple"){
$html .= drawMCQ($assessment_id); //Go to MCQ form
}else if($action == "numeric"){
$html .= drawNum($assessment_id); //Go to Numeric form
}else if($action == "text"){
$html .= drawTxt($assessment_id); //Go to Text Form
//This action puts respective form data into the database
}else if($action == "writeMCQ2DB"){ writeMCQ2DB($assessment_id,$_POST["qtext"],$_POST["A"],$_POST["B"],$_POST["C"],$_POST["D"],$_POST["answer"],$_POST["points"]);
}
else { // if createNewQuiz $html .= default_html(); }
return $html; } //*****************************************
$html = site_base(); //Draw basic page
$action = $_GET["action"]; //Receive user action
$html .= handleAction($action); //Menu to handle action
echo $html; //Echo action specific html //**************************************** //**************************************** //**************************************** ?>
</div> </div> </div>
</body> </html>