error("You can't modify this course!");
}
- print_header("$course->shortname: Editing a survey", "$course->shortname: Editing a survey",
- "<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A> ->
- Editing a survey", "");
+ $streditingasurvey = get_string("editingasurvey", "survey");
+
+ print_header("$course->shortname: $streditingasurvey", "$course->fullname",
+ "<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A>
+ -> $streditingasurvey");
+
+ if (!$form->name or !$form->template) {
+ error(get_string("filloutallfields"), $HTTP_REFERER);
+ }
print_simple_box_start("center", "", "$THEME->cellheading");
?>
<FORM NAME=form METHOD=post ACTION="<? p($form->destination)?>">
<TABLE CELLPADDING=5 ALIGN=CENTER>
- <TR><TD ALIGN=right NOWRAP><P><B>Name:</B></P></TD>
+ <TR><TD ALIGN=right NOWRAP><P><B><? print_string("name") ?>:</B></P></TD>
<TD><P><? p($form->name) ?></P></A></TD></TR>
<TR VALIGN=top>
<TD ALIGN=right NOWRAP>
- <P><B>Introduction Text:</B></P>
+ <P><B><? print_string("introtext", "survey") ?>:</B></P><BR>
+ <? helpbutton("text", get_string("helptext")) ?>
</TD>
<TD>
<TEXTAREA NAME="intro" ROWS=20 COLS=50 WRAP="virtual"><?
<input type="hidden" name=instance value="<? p($form->instance) ?>">
<input type="hidden" name=mode value="<? p($form->mode) ?>">
<CENTER>
- <input type="submit" value="Save these settings">
+ <input type="submit" value="<? print_string("savechanges") ?>">
</CENTER>
</FORM>
<?
print_simple_box_end();
print_footer($course);
+ } else {
+ error("You can't use this page like that!");
}
?>
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
- print_header("$course->shortname: Surveys", "$course->fullname", "$navigation Surveys", "");
+ $strsurveys = get_string("modulenameplural", "survey");
+ $strweek = get_string("week");
+ $strtopic = get_string("topic");
+ $strname = get_string("name");
+ $strstatus = get_string("status");
+ $strdone = get_string("done", "survey");
+ $strnotdone = get_string("notdone", "survey");
+
+ print_header("$course->shortname: $strsurveys", "$course->fullname", "$navigation $strsurveys", "");
if (! $surveys = get_all_instances_in_course("survey", $course->id, "cw.section ASC")) {
notice("There are no surveys.", "../../course/view.php?id=$course->id");
}
if ($course->format == "weeks") {
- $table->head = array ("Week", "Name", "Status");
+ $table->head = array ($strweek, $strname, $strstatus);
$table->align = array ("CENTER", "LEFT", "LEFT");
} else if ($course->format == "topics") {
- $table->head = array ("Topic", "Name", "Status");
+ $table->head = array ($strtopic, $strname, $strstatus);
$table->align = array ("CENTER", "LEFT", "LEFT");
} else {
- $table->head = array ("Name", "Status");
+ $table->head = array ($strname, $strstatus);
$table->align = array ("LEFT", "LEFT");
}
foreach ($surveys as $survey) {
if (survey_already_done($survey->id, $USER->id)) {
- $ss = "Done";
+ $ss = $strdone;
} else {
- $ss = "<A HREF=\"view.php?id=$survey->coursemodule\">Not done yet</A>";
+ $ss = $strnotdone;
}
if ($course->format == "weeks" or $course->format == "topics") {
$table->data[] = array ("$survey->section",
"<A HREF=\"view.php?id=$survey->coursemodule\">$survey->name</A>",
- "$ss");
+ "<A HREF=\"view.php?id=$survey->coursemodule\">$ss</A>");
} else {
$table->data[] = array ("<A HREF=\"view.php?id=$survey->coursemodule\">$survey->name</A>",
- "$ss");
+ "<A HREF=\"view.php?id=$survey->coursemodule\">$ss</A>");
}
}
return record_exists_sql("SELECT * FROM survey_answers WHERE survey='$survey' AND user='$user'");
}
-function survey_get_status($survey) {
-
- $timenow = time();
- if ($survey->locked) {
- if (($survey->timeopen <= $timenow) && ($timenow <= $survey->timeclose)) {
- return "released";
- } else if ($survey->timenow >= $survey->timeclose) {
- return "finished";
- } else {
- return "error";
- }
- } else {
- return "editing";
- }
-
-}
function survey_get_responses($survey) {
return get_records_sql("SELECT a.time as time, count(*) as numanswers, u.*
$lastanswer = array_pop($answers);
- $result->info = "Done";
+ $result->info = get_string("done", "survey");
$result->time = $lastanswer->time;
return $result;
}
if (survey_already_done($survey->id, $user->id)) {
echo "<IMG SRC=\"$CFG->wwwroot/mod/survey/graph.php?id=$mod->id&sid=$user->id&type=student.png\">";
} else {
- echo "Not done yet";
+ print_string("notdone", "survey");
}
}
GLOBAL $db, $qnum, $checklist, $THEME;
+ $stripreferthat = get_string("ipreferthat", "survey");
+ $strifoundthat = get_string("ifoundthat", "survey");
echo "<P> </P>\n";
echo "<P><FONT SIZE=4><B>$question->text</B></FONT></P>";
} else {
echo "<TD WIDTH=10 VALIGN=middle rowspan=2><P><B>$qnum</B></P></TD>";
- echo "<TD WIDTH=10% NOWRAP><P><FONT SIZE=1>I prefer that </FONT></P></TD>";
+ echo "<TD WIDTH=10% NOWRAP><P><FONT SIZE=1>$stripreferthat </FONT></P></TD>";
echo "<TD WIDTH=40% VALIGN=middle rowspan=2><P>$q->text</P></TD>";
for ($i=1;$i<=$numoptions;$i++) {
echo "<TD WIDTH=10% ALIGN=CENTER><INPUT TYPE=radio NAME=qP$q->id VALUE=$i></TD>";
echo "</TR>";
echo "<TR BGCOLOR=$bgcolor>";
- echo "<TD WIDTH=10% NOWRAP><P><FONT SIZE=1>I found that </P></TD>";
+ echo "<TD WIDTH=10% NOWRAP><P><FONT SIZE=1>$strifoundthat </P></TD>";
for ($i=1;$i<=$numoptions;$i++) {
echo "<TD WIDTH=10% ALIGN=CENTER><INPUT TYPE=radio NAME=q$q->id VALUE=$i></TD>";
}
echo "<TEXTAREA ROWS=3 COLS=30 WRAP=virtual NAME=\"$question->id\">$question->options</TEXTAREA>";
} else if ($question->type > 0) { // Choose one of a number
+ $strchoose = get_string("choose");
echo "<SELECT NAME=$question->id>";
- echo "<OPTION VALUE=0 SELECTED>Choose...</OPTION>";
+ echo "<OPTION VALUE=0 SELECTED>$strchoose...</OPTION>";
$options = explode( ",", $question->options);
foreach ($options as $key => $val) {
$key++;
<form name="form" method="post" action="<?=$CFG->wwwroot ?>/mod/survey/details.php">
<table cellpadding=5>
<tr valign=top>
- <td align=right><P><B>Survey Name:</B></P></TD>
+ <td align=right><P><B><? print_string("surveyname", "survey") ?>:</B></P></TD>
<td>
<input type="text" name="name" size=30 value="<? p($form->name) ?>">
</td>
</tr>
<tr>
- <td align=right><P><B>Survey Type:</B></P></TD>
+ <td align=right><P><B><? print_string("surveytype", "survey") ?>:</B></P></TD>
<td>
<?
if ($options = get_records_sql_menu("SELECT id, name FROM survey WHERE template='0'")) {
choose_from_menu($options, "template", $form->template);
+ helpbutton("surveys", get_string("helpsurveys", "survey"));
} else {
echo "No surveys to choose from!";
}
<input type="hidden" name=modulename value="<? p($form->modulename) ?>">
<input type="hidden" name=instance value="<? p($form->instance) ?>">
<input type="hidden" name=mode value="<? p($form->mode) ?>">
-<input type="submit" value="Save these settings">
+<input type="submit" value="<? print_string("savechanges") ?>">
</CENTER>
</FORM>
add_to_log($course->id, "survey", "submit", "view.php?id=$cm->id", "$survey->id");
if (survey_already_done($survey->id, $USER->id)) {
- notice("You've already submitted this survey!", $HTTP_REFERER);
+ notice(get_string("alreadysubmitted", "survey"), $HTTP_REFERER);
exit;
}
// Print the page and finish up.
- print_header("$course->shortname: Survey sent", "$course->fullname",
+ $strsurveys = get_string("modulenameplural", "survey");
+ $strsurveysaved = get_string("surveysaved", "survey");
+
+ print_header("$course->shortname: $strsurveysaved", "$course->fullname",
"<A HREF=/course/view.php?id=$course->id>$course->shortname</A> ->
- <A HREF=index.php?id=$course->id>Surveys</A> -> $survey->name -> Survey sent", "");
+ <A HREF=index.php?id=$course->id>$strsurveys</A> -> $survey->name -> $strsurveysaved", "");
- notice("Thanks for your answers, $USER->firstname.", "$CFG->wwwroot/course/view.php?id=$course->id");
+ notice(get_string("thanksforanswers","survey", $USER->firstname), "$CFG->wwwroot/course/view.php?id=$course->id");
exit;
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
}
+
+ $strsurveys = get_string("modulenameplural", "survey");
+
print_header("$course->shortname: $survey->name", "$course->fullname",
- "$navigation <A HREF=index.php?id=$course->id>Surveys</A> -> $survey->name", "", "", true,
+ "$navigation <A HREF=index.php?id=$course->id>$strsurveys</A> -> $survey->name", "", "", true,
update_module_icon($cm->id, $course->id));
if (isteacher($course->id)) {
- echo "<P align=right><A HREF=\"report.php?id=$cm->id\">View all responses</A></P>";
+ $numusers = survey_count_responses($survey->id);
+ echo "<P align=right><A HREF=\"report.php?id=$cm->id\">".
+ get_string("viewsurveyresponses", "survey", $numusers)."</A></P>";
}
if (survey_already_done($survey->id, $USER->id)) {
add_to_log($course->id, "survey", "view graph", "view.php?id=$cm->id", "$survey->id");
- print_heading("You've completed this survey. The graph below shows a summary of your results compared to the class averages.");
+ print_heading(get_string("surveycompleted", "survey"));
$numusers = survey_count_responses($survey->id);
- print_heading("$numusers people have completed the survey so far");
+ print_heading(get_string("peoplecompleted", "survey", $numusers));
echo "<CENTER>";
echo "<IMG SRC=\"$CFG->wwwroot/mod/survey/graph.php?id=$cm->id&sid=$USER->id&type=student.png\">";
echo "</CENTER>";