Line 22: Line 22:
  
 
[[Media:roar_concept.pdf]]
 
[[Media:roar_concept.pdf]]
 +
 +
 +
==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
 +
<div class="box">
 +
 +
 +
<div class="post">
 +
<div class="post-bgtop">
 +
<div class="post-bgbtm">
 +
<h2 class="title"><a href="#">Create your Own Quiz</a></h2>
 +
 +
 +
<div class="entry">
 +
   
 +
 +
                    <?php echo $id; ?>
 +
 +
<!--QUESTION TYPES -->
 +
<h2>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 style="clear: both;">&nbsp;</div>
 +
</div>
 +
FOO;
 +
 +
   
 +
return $out;
 +
}
 +
 +
//Question forms begin here:
 +
function drawMCQ($assessment_id){
 +
 +
 +
 +
$MCQ_form = <<<MCQ_html
 +
<div class="box">
 +
 +
 +
<div class="post">
 +
<div class="post-bgtop">
 +
<div class="post-bgbtm">
 +
<h2 class="title"><a href="#">New Question</a></h2>
 +
 +
 +
<form name="multiplechoice" method="post" action="new.php?action=writeMCQ2DB">
 +
<br/>
 +
<br/>
 +
Enter Question Text:
 +
<br />
 +
<input  type = "text" name="qtext" cols="40" rows="5">
 +
 +
</textarea>
 +
<br/>
 +
<br/>
 +
A. <input name="A" type="text"/>
 +
<br />
 +
B. <input name="B" type="text"/>
 +
<br />
 +
C. <input name="C" type="text"/>
 +
<br />
 +
D. <input name="D" type="text"/>
 +
<br />
 +
<br/>
 +
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>
 +
 +
<br />
 +
<br />
 +
Total Points <input name="points" type="text">
 +
<br/>
 +
<br/>
 +
<input type="submit" value="Submit" />
 +
</form>
 +
</div>
 +
</div>
 +
</div>
 +
 +
 +
 +
</div>
 +
<div style="clear: both;">&nbsp;</div>
 +
</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
 +
 +
<div class="box">
 +
 +
 +
<div class="post">
 +
<div class="post-bgtop">
 +
<div class="post-bgbtm">
 +
<h2 class="title"><a href="#">New Question</a></h2>
 +
 +
 +
Question number:
 +
<form name="Multiple choice" method="post" action="new.php?action=writeDB">
 +
<br/>
 +
<br/>
 +
Enter Question Text:
 +
<br />
 +
<textarea name="question text" cols="40" rows="5">
 +
Enter question text here...
 +
</textarea>
 +
<br/>
 +
<br/>
 +
Correct Answer:<input name="correct" type="text"/>
 +
<br />
 +
<br />
 +
Total Points <input name="points" type="text">
 +
<br/>
 +
<br/>
 +
<input type="submit" value="Submit" />
 +
</form>
 +
 +
</div>
 +
</div>
 +
</div>
 +
 +
 +
 +
</div>
 +
<div style="clear: both;">&nbsp;</div>
 +
</div>
 +
NUM_html;
 +
 +
return $NUM_form;
 +
}
 +
function drawTxt($assessment_id){
 +
$TXT_form = <<<TEXT_html
 +
 +
<div class="box">
 +
 +
 +
<div class="post">
 +
<div class="post-bgtop">
 +
<div class="post-bgbtm">
 +
<h2 class="title"><a href="#">New Question</a></h2>
 +
 +
 +
Question number:
 +
<form name="text" method="post" action="new.php?action=writeDB">
 +
<br/>
 +
<br/>
 +
Enter Question Text:
 +
<br />
 +
<textarea name="question text" cols="40" rows="5">
 +
Enter question text here...
 +
</textarea>
 +
<br/>
 +
<br/>
 +
Correct Answer:<input name="correct" type="text"/>
 +
<br />
 +
<br />
 +
Total Points <input name="points" type="text">
 +
<br/>
 +
<br/>
 +
<input type="submit" value="Submit" />
 +
</form>
 +
 +
</div>
 +
</div>
 +
</div>
 +
 +
 +
 +
</div>
 +
<div style="clear: both;">&nbsp;</div>
 +
</div>
 +
TEXT_html;
 +
 +
return $TXT_form;
 +
}
 +
 +
 +
 +
//********Cosmetic functions******
 +
//********************************
 +
function default_html() {
 +
$_html = <<<FOO
 +
<div class="box">
 +
<div class="post">
 +
<div class="post-bgtop">
 +
<div class="post-bgbtm">
 +
<h2 class="title"><a href="#">Create your Own Quiz</a></h2>
 +
 +
 +
<div class="entry">
 +
    <form action="new.php?action=createQuiz" method="post">
 +
    Enter Quiz title : 
 +
<input type="text" name="qname" />
 +
<br /><br />
 +
Enter Total points :
 +
<input type="text" name="points" />
 +
 +
 +
<br /><br />
 +
Time Limit?
 +
<input type="radio" name="time" value="Yes" /> Yes
 +
<br />
 +
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
 +
<input type="radio" name="time" value="no" /> No
 +
 +
<br/><br/>
 +
 +
<br/>
 +
<br/>
 +
 +
<button type="submit" name="create">Create</button>
 +
</form>
 +
 +
 +
</form>
 +
</div>
 +
</div>
 +
</div>
 +
</div>
 +
 +
 +
 +
</div>
 +
<div style="clear: both;">&nbsp;</div>
 +
</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>
 +
<div id="wrapper">
 +
<div id="header">
 +
<a href="index.php">
 +
<img src="images/logocool.gif" border="0" >
 +
</a>
 +
<div id="logo">
 +
   
 +
 +
 +
</div>
 +
</div>
 +
 +
</div>
 +
 +
 +
 +
<!-- end #header -->
 +
<div id="menu">
 +
<ul>
 +
<li class="current_page_item"><a href="#">RHEA Home</a></li>
 +
<li><a href="#">New Assignments</a></li>
 +
<li><a href="#">Create Your Own Assignment</a></li>
 +
<li><a href="#">Scores</a></li>
 +
<li><a href="#">About</a></li>
 +
<li><a href="#">Links</a></li>
 +
<li><a href="#">Contact Us</a></li>
 +
</ul>
 +
</div>
 +
 +
 +
<!-- end #menu -->
 +
 +
<!-- <p><font color='white'><big><strong><font color='black'>R</font></strong>hea <strong><font color='black'>O</font></strong>nline <strong><font color='black'>A</font></strong>ssessment <strong><font color='black'>R</font></strong>esource </big></font></p> -->
 +
<div id="page">
 +
<div id="page-bgtop">
 +
<div id="page-bgbtm">
 +
<div id="content">
 +
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
 +
//****************************************
 +
//****************************************
 +
//****************************************
 +
?>
 +
 +
 +
<!--User Interaction ends here-->
 +
<div id="sidebar">
 +
    <div class="box">
 +
<ul>
 +
<li>
 +
<h2>Login</h2>
 +
 +
<form>
 +
                    Username:  <input type="text" name="" />
 +
                    <br />
 +
                    Password:  <input type="text" name="" />
 +
<br />
 +
<input type="submit" value="login" />
 +
                    </form>
 +
</a>
 +
</li>
 +
    <li>
 +
<h2>Assigment list</h2>
 +
<ul>
 +
<li><a href="#">New Assignments</a> (3)<span>note</span></li>
 +
<li><a href="#">Completed</a> (42)<span>list</span></li>
 +
</ul>
 +
</li>
 +
<li>
 +
<h2><a href=""><font color="white">Make a quiz</font></a></h2>
 +
<ul>
 +
<li> </li>
 +
<li> </li>
 +
<li> </li>
 +
</ul>
 +
</li>
 +
<li>
 +
<h2>Archives</h2>
 +
<ul>
 +
<li><a href="#">December 2009</a>&nbsp;(29)<span></span></li>
 +
<li><a href="#">November 2009</a>&nbsp;(30)<span></span></li>
 +
<li><a href="#">October 2009</a>&nbsp;(31)<span></span></li>
 +
</ul>
 +
</li>
 +
</ul>
 +
</div>
 +
</div>
 +
 +
<!-- end #sidebar -->
 +
<div style="clear: both;">&nbsp;</div>
 +
</div>
 +
</div>
 +
</div>
 +
<!-- end #page -->
 +
</div>
 +
<div id="footer">
 +
<p>Rhea Online Assessment Resource</a>.</p>
 +
</div>
 +
<!-- end #footer -->
 +
</body>
 +
</html>
 +
 +
 +
 +
 +
 +
  
  
 
[[User:Dlamba|Dlamba]] 20:47, 4 April 2010 (UTC)
 
[[User:Dlamba|Dlamba]] 20:47, 4 April 2010 (UTC)

Revision as of 23:33, 8 April 2010

Contents

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

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.

Media:roar_concept.pdf


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
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp <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>



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)

Alumni Liaison

Basic linear algebra uncovers and clarifies very important geometry and algebra.

Dr. Paul Garrett