Permalink
Browse files

Cleaned up the whole interface (more consistent now) and lots of labg…

…uage stuff
  • Loading branch information...
1 parent 0a40b98 commit e137027fa171ff6456aeafbe6037221dea284d3d martin committed Aug 12, 2002
Showing with 82 additions and 45 deletions.
  1. +82 −45 mod/survey/report.php
View
@@ -26,33 +26,59 @@
}
-
$ME = qualified_me()."?id=$id";
+ $strreport = get_string("report", "survey");
+ $strsurveys = get_string("modulenameplural", "survey");
+ $strsummary = get_string("summary", "survey");
+ $strscales = get_string("scales", "survey");
+ $strquestion = get_string("question", "survey");
+ $strquestions = get_string("questions", "survey");
+ $strdownload = get_string("download", "survey");
+ $strallscales = get_string("allscales", "survey");
+ $strallquestions = get_string("allquestions", "survey");
+ $strselectedquestions = get_string("selectedquestions", "survey");
+ $strseemoredetail = get_string("seemoredetail", "survey");
+ $strnotes = get_string("notes", "survey");
+
if (!$action) {
$display = "summary";
}
if ($display) { // Display the frame containing something.
-
add_to_log($course->id, "survey", "view report", "report.php?id=$cm->id", "$survey->id");
- echo "<HEAD><TITLE>Report: $survey->name</TITLE>\n";
- echo "<FRAMESET COLS=150,* BORDER=1> ";
- echo " <FRAME NAME=reportmenu SRC=\"report.php?action=menu&id=$id\"> \n";
- echo " <FRAME NAME=reportmain SRC=\"report.php?action=$display&id=$id\"> \n";
+ echo "<HEAD><TITLE>$course->shortname: $strreport: $survey->name</TITLE>\n";
+ echo "<FRAMESET ROWS=70,* BORDER=1> ";
+ echo " <FRAME NAME=reporttop SRC=\"report.php?action=top&id=$id\"> \n";
+ echo " <FRAMESET COLS=150,* BORDER=1> ";
+ echo " <FRAME NAME=reportmenu SRC=\"report.php?action=menu&id=$id\"> \n";
+ echo " <FRAME NAME=reportmain SRC=\"report.php?action=$display&id=$id\"> \n";
+ echo " </FRAMESET>\n";
echo "</FRAMESET>\n";
exit;
}
switch ($action) {
+ case "top":
+ if ($course->category) {
+ $navigation = "<A TARGET=_top HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->
+ <A TARGET=_top HREF=\"index.php?id=$course->id\">$strsurveys</A> ->
+ <A TARGET=_top HREF=\"view.php?id=$cm->id\">$survey->name</A> -> ";
+ } else {
+ $navigation = "<A TARGET=_top HREF=\"index.php?id=$course->id\">$strsurveys</A> ->
+ <A TARGET=_top HREF=\"view.php?id=$cm->id\">$survey->name</A> -> ";
+ }
+ print_header("$course->shortname: $survey->name", "$course->fullname", "$navigation $strreport");
+ break;
+
case "menu":
- print_header("Survey Report", "Survey Report");
+ print_header();
//echo "<FONT FACE=\"Verdana,Arial,Helvetica,sans-serif\">";
//echo "<P><B>Survey Report</B></P>";
- echo "<P><FONT SIZE=2><A TARGET=reportmain HREF=\"report.php?action=summary&id=$id\">Summary</A></FONT></P>";
- echo "<P><FONT SIZE=2><A TARGET=reportmain HREF=\"report.php?action=scales&id=$id\">Scales</A></FONT></P>";
- echo "<P><FONT SIZE=2><A TARGET=reportmain HREF=\"report.php?action=questions&id=$id\">Questions</A></FONT></P>";
- echo "<P><FONT SIZE=2><A TARGET=reportmain HREF=\"report.php?action=students&id=$id\">Students</A></FONT></P>";
+ echo "<P><FONT SIZE=2><A TARGET=reportmain HREF=\"report.php?action=summary&id=$id\">$strsummary</A></FONT></P>";
+ echo "<P><FONT SIZE=2><A TARGET=reportmain HREF=\"report.php?action=scales&id=$id\">$strscales</A></FONT></P>";
+ echo "<P><FONT SIZE=2><A TARGET=reportmain HREF=\"report.php?action=questions&id=$id\">$strquestions</A></FONT></P>";
+ echo "<P><FONT SIZE=2><A TARGET=reportmain HREF=\"report.php?action=students&id=$id\">$course->student:</A></FONT></P>";
if ($users = survey_get_responses($survey->id)) {
foreach ($users as $user) {
echo "<LI><FONT SIZE=1>";
@@ -61,28 +87,26 @@
echo "</A></FONT></LI>";
}
}
- echo "<P><FONT SIZE=2><A TARGET=reportmain HREF=\"report.php?action=download&id=$id\">Download</A></FONT></P>";
- echo "<HR SIZE=1 NOSHADE>";
- echo "<P align=center><FONT SIZE=2><A TARGET=_top HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A></FONT></P>";
+ echo "<P><FONT SIZE=2><A TARGET=reportmain HREF=\"report.php?action=download&id=$id\">$strdownload</A></FONT></P>";
break;
case "summary":
- print_header("Overall Summary", "$survey->name: Overall Summary", "", "");
+ print_header("$survey->name: $strsummary", "$strsummary");
- print_heading("All scales, all students");
+ print_heading($strallscales);
if (survey_count_responses($survey->id)) {
- echo "<P ALIGN=CENTER><A HREF=\"report.php?action=scales&id=$id\"><IMG HEIGHT=$SURVEY_GHEIGHT WIDTH=$SURVEY_GWIDTH ALT=\"Click here to see the scales in more detail\" BORDER=0 SRC=\"graph.php?id=$id&type=overall.png\"></A>";
+ echo "<P ALIGN=CENTER><A HREF=\"report.php?action=scales&id=$id\"><IMG HEIGHT=$SURVEY_GHEIGHT WIDTH=$SURVEY_GWIDTH tail\" BORDER=1 SRC=\"graph.php?id=$id&type=overall.png\"></A>";
} else {
- echo "<P ALIGN=CENTER>Nobody has yet completed this survey</P>";
+ echo "<P ALIGN=CENTER>".get_string("nobodyyet","survey")."</P>";
}
print_footer($course);
break;
case "scales":
- print_header("Scales", "$survey->name: Scales", "", "");
+ print_header("$survey->name: $strscales", "$strscales");
- print_heading("All scales, all students");
+ print_heading($strallscales);
$questions = get_records_sql("SELECT * FROM survey_questions WHERE id in ($survey->questions)");
$questionorder = explode(",", $survey->questions);
@@ -101,8 +125,8 @@
if ($virtualscales && $question->type > 0) { // Don't show non-virtual scales if virtual
continue;
}
- echo "<P ALIGN=center><A HREF=report.php?action=questions&id=$id&qid=$question->multi>";
- echo "<IMG HEIGHT=$SURVEY_GHEIGHT WIDTH=$SURVEY_GWIDTH ALT=\"Click here to see subquestions\" BORDER=0
+ echo "<P ALIGN=center><A TITLE=\"$strseemoredetail\" HREF=report.php?action=questions&id=$id&qid=$question->multi>";
+ echo "<IMG HEIGHT=$SURVEY_GHEIGHT WIDTH=$SURVEY_GWIDTH BORDER=1
SRC=\"graph.php?id=$id&qid=$question->id&type=multiquestion.png\">";
echo "</A></P><BR>";
}
@@ -112,19 +136,19 @@
break;
case "questions":
- print_header("Analysis by Question", "$survey->name: Questions", "", "");
+ print_header("$survey->name: $strquestions", "$strquestions");
if ($qid) { // just get one multi-question
$questions = get_records_sql("SELECT * FROM survey_questions WHERE id in ($qid)");
$questionorder = explode(",", $qid);
- print_heading("Selected questions from a scale, all students");
+ print_heading($strselectedquestions);
} else { // get all top-level questions
$questions = get_records_sql("SELECT * FROM survey_questions WHERE id in ($survey->questions)");
$questionorder = explode(",", $survey->questions);
- print_heading("All questions in order, all students");
+ print_heading($strallquestions);
}
foreach ($questionorder as $key => $val) {
@@ -150,15 +174,15 @@
foreach ($subquestionorder as $key => $val) {
$subquestion = $subquestions[$val];
if ($subquestion->type > 0) {
- echo "<P ALIGN=CENTER><A HREF=\"report.php?action=question&id=$id&qid=$subquestion->id\">
- <IMG HEIGHT=$SURVEY_GHEIGHT WIDTH=$SURVEY_GWIDTH ALT=\"Click here to see all responses\"
- BORDER=0 SRC=\"graph.php?id=$id&qid=$subquestion->id&type=question.png\"></A></P>";
+ echo "<P ALIGN=CENTER><A TITLE=\"$strseemoredetail\" HREF=\"report.php?action=question&id=$id&qid=$subquestion->id\">
+ <IMG HEIGHT=$SURVEY_GHEIGHT WIDTH=$SURVEY_GWIDTH
+ BORDER=1 SRC=\"graph.php?id=$id&qid=$subquestion->id&type=question.png\"></A></P>";
}
}
} else if ($question->type > 0 ) {
- echo "<P ALIGN=CENTER><A HREF=\"report.php?action=question&id=$id&qid=$question->id\">
- <IMG HEIGHT=$SURVEY_GHEIGHT WIDTH=$SURVEY_GWIDTH ALT=\"Click here to see all responses\"
- BORDER=0 SRC=\"graph.php?id=$id&qid=$question->id&type=question.png\"></A></P>";
+ echo "<P ALIGN=CENTER><A TITLE=\"$strseemoredetail\" HREF=\"report.php?action=question&id=$id&qid=$question->id\">
+ <IMG HEIGHT=$SURVEY_GHEIGHT WIDTH=$SURVEY_GWIDTH
+ BORDER=1 SRC=\"graph.php?id=$id&qid=$question->id&type=question.png\"></A></P>";
} else {
echo "<H3>$question->text</H3>";
if ($aaa = get_records_sql("SELECT sa.*, u.firstname,u.lastname FROM survey_answers sa, user u WHERE survey = '$survey->id' AND question = $question->id and sa.user = u.id")) {
@@ -181,13 +205,18 @@
$answers = explode(",", $question->options);
- print_header("All answers for a particular question", "$survey->name: Question Answers", "", "");
+ print_header("$survey->name: $strquestion", "$strquestion");
print_heading("$question->text");
$aaa = get_records_sql("SELECT sa.*,u.firstname,u.lastname,u.picture FROM survey_answers sa, user u WHERE sa.survey = '$survey->id' AND sa.question = $question->id AND u.id = sa.user ORDER by sa.answer1,sa.answer2 ASC");
- echo "<TABLE ALIGN=center CELLPADDING=0 CELLSPACING=10><TR><TD>&nbsp;<TH align=left>Name<TH align=left>Time<TH align=left>Actual<TH align=left>Preferred</TR>";
+ $strname = get_string("name", "survey");
+ $strtime = get_string("time", "survey");
+ $stractual = get_string("actual", "survey");
+ $strpreferred = get_string("preferred", "survey");
+
+ echo "<TABLE ALIGN=center CELLPADDING=0 CELLSPACING=10><TR><TD>&nbsp;<TH align=left>$strname<TH align=left>$strtime<TH align=left>$stractual<TH align=left>$strpreferred</TR>";
foreach ($aaa as $a) {
echo "<TR>";
echo "<TD WIDTH=35>";
@@ -218,10 +247,10 @@
case "students":
- print_header("Analysis by Student", "$survey->name: Students", "", "");
+ print_header("$survey->name: $course->student", get_string("analysisof", "survey", "$course->student"));
if (! $results = survey_get_responses($survey->id) ) {
- notify("There are no responses for this survey.");
+ notify(get_string("nobodyyet","survey"));
} else {
survey_print_all_responses($cm->id, $results);
}
@@ -234,16 +263,21 @@
error("Student doesn't exist");
}
+ print_header("$survey->name: $$user->firstname $user->lastname",
+ get_string("analysisof", "survey", "$user->firstname $user->lastname"));
- print_header("Analysis of $user->firstname $user->lastname", "$survey->name: Analysis of a student", "", "");
if (isset($notes)) {
if (survey_get_analysis($survey->id, $user->id)) {
if (! survey_update_analysis($survey->id, $user->id, $notes)) {
notify("An error occurred while saving your notes. Sorry.");
+ } else {
+ notify(get_string("savednotes", "survey"));
}
} else {
if (! survey_add_analysis($survey->id, $user->id, $notes)) {
notify("An error occurred while saving your notes. Sorry.");
+ } else {
+ notify(get_string("savednotes", "survey"));
}
}
}
@@ -275,8 +309,8 @@
if ($virtualscales && $question->type > 0) { // Don't show non-virtual scales if virtual
continue;
}
- echo "<P ALIGN=center><A HREF=report.php?action=questions&id=$id&qid=$question->multi>";
- echo "<IMG HEIGHT=$SURVEY_GHEIGHT WIDTH=$SURVEY_GWIDTH ALT=\"Click here to see subquestions\" BORDER=0
+ echo "<P ALIGN=center><A TITLE=\"$strseemoredetail\" HREF=report.php?action=questions&id=$id&qid=$question->multi>";
+ echo "<IMG HEIGHT=$SURVEY_GHEIGHT WIDTH=$SURVEY_GWIDTH BORDER=1
SRC=\"graph.php?id=$id&qid=$question->id&sid=$student&type=studentmultiquestion.png\">";
echo "</A></P><BR>";
}
@@ -290,15 +324,15 @@
echo "<HR NOSHADE SIZE=1>";
echo "<CENTER>";
echo "<FORM ACTION=report.php METHOD=post NAME=form>";
- echo "<H3>Your private analysis/notes:</H3>";
+ echo "<H3>$strnotes:</H3>";
echo "<BLOCKQUOTE>";
echo "<TEXTAREA NAME=notes ROWS=10 COLS=60>";
p($notes);
echo "</TEXTAREA><BR>";
echo "<INPUT TYPE=hidden NAME=action VALUE=student>";
echo "<INPUT TYPE=hidden NAME=student VALUE=$student>";
echo "<INPUT TYPE=hidden NAME=id VALUE=$cm->id>";
- echo "<INPUT TYPE=submit VALUE=\"Save these notes\">";
+ echo "<INPUT TYPE=submit VALUE=\"".get_string("savechanges")."\">";
echo "</BLOCKQUOTE>";
echo "</FORM>";
echo "</CENTER>";
@@ -308,13 +342,16 @@
break;
case "download":
- print_header("Download Data", "$survey->name: Download Data", "", "");
+ print_header("$survey->name: $strdownload", "$strdownload");
+
+ $strdownloadinfo = get_string("downloadinfo", "survey");
+ $strdownloadexcel = get_string("downloadexcel", "survey");
+ $strdownloadtext = get_string("downloadtext", "survey");
- echo "<P>You can download the complete raw data for this survey in a form suitable
- for analysis in Excel, SPSS or other package.</P>";
+ echo "<P>$strdownloadinfo</P>";
- echo "<H2 ALIGN=CENTER><A HREF=\"download.php?id=$id&type=xls\">Download data as Excel spreadsheet</A></H2>";
- echo "<H2 ALIGN=CENTER><A HREF=\"download.php?id=$id&type=text\">Download data as a plain text file</A></H2>";
+ echo "<H2 ALIGN=CENTER><A HREF=\"download.php?id=$id&type=xls\">$strdownloadexcel</A></H2>";
+ echo "<H2 ALIGN=CENTER><A HREF=\"download.php?id=$id&type=text\">$strdownloadtext</A></H2>";
print_footer($course);
break;

0 comments on commit e137027

Please sign in to comment.