Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
383 lines (358 sloc) 12.2 KB
<?php
require("$CFG->dirroot/mod/workshop/lib.php"); // for parameter arrays
// ...and fill the form if needed
if (empty($form->name)) {
$form->name = "";
}
if (empty($form->description)) {
$form->description = "";
}
if (empty($form->format)) {
$form->format = "";
}
if (!isset($form->gradinggrade)) {
$form->gradinggrade = 100;
}
if (!isset($form->grade)) {
$form->grade = 100;
}
if (!isset($form->gradingstrategy)) {
$form->gradingstrategy = 1; // default is accumulative
}
if (!isset($form->nelements)) {
$form->nelements = 1;
}
if (!isset($form->nattachments)) {
$form->nattachments = 0;
}
if (empty($form->resubmit)) {
$form->resubmit = "";
}
if (!isset($form->ntassessments)) {
$form->ntassessments = 0;
}
if (!isset($form->assessmentcomps)) {
$form->assessmentcomps = 2;
}
if (!isset($form->nsassessments)) {
$form->nsassessments = 0;
}
if (!isset($form->teacherweight)) {
$form->teacherweight = 1;
}
if (!isset($form->overallocation)) {
$form->overallocation = 0;
}
if (empty($form->includeself)) {
$form->includeself = "";
}
if (empty($form->agreeassessments)) {
$form->agreeassessments = "";
}
if (empty($form->hidegrades)) {
$form->hidegrades = "";
}
if (empty($form->showleaguetable)) {
$form->showleaguetable = 0;
}
if (empty($form->anonymous)) {
$form->anonymous = 0;
}
if (empty($form->maxbytes)) {
$form->maxbytes = "";
}
if (empty($form->deadline)) {
$form->deadline = "";
}
?>
<form name="form" method="post" action="mod.php">
<table cellpadding="5">
<tr valign="top">
<td align="right"><p><b><?php print_string("title", "workshop") ?>:</b></p></td>
<td>
<input type="text" name="name" size="60" value="<?php p($form->name) ?>" />
</td>
</tr>
<tr valign="top">
<td align="right"><p><b><?php print_string("description", "workshop") ?>:</b></p>
<font size="1">
<?php
helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
echo "<br />";
if ($usehtmleditor) {
helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
} else {
helpbutton("text", get_string("helptext"), "moodle", true, true);
echo "<br />";
emoticonhelpbutton("form", "description", "moodle", true, true);
echo "<br />";
}
?>
<br />
</font>
<td>
<?php
print_textarea($usehtmleditor, 20, 60, 595, 400, "description", $form->description);
if ($usehtmleditor) {
echo '<input type="hidden" name="format" value="'.FORMAT_HTML.'" />';
} else {
echo '<p align="right">';
helpbutton("textformat", get_string("formattexttype"));
print_string("formattexttype");
echo ':&nbsp;';
if (!$form->format) {
$form->format = $defaultformat;
}
choose_from_menu(format_text_menu(), "format", $form->format, "");
echo '</p>';
}
?>
</td>
</tr>
<tr valign="top">
<td align="right"><p><b><?php print_string("gradeforassessments", "workshop") ?>:</b></p></td>
<td>
<?php
for ($i=100; $i>=0; $i--) {
$grades[$i] = $i;
}
choose_from_menu($grades, "gradinggrade", "$form->gradinggrade", "");
helpbutton("gradinggrade", get_string("gradeforassessments", "workshop"), "workshop");
?>
</td>
</tr>
<tr valign="top">
<td align="right"><p><b><?php print_string("gradeforsubmission", "workshop") ?>:</b></p></td>
<td>
<?php
choose_from_menu($grades, "grade", "$form->grade", "");
helpbutton("grade", get_string("gradeforsubmission", "workshop"), "workshop");
?>
</td>
</tr>
<tr valign="top">
<td align="right"><p><b><?php print_string("gradingstrategy", "workshop") ?>:</b></p></td>
<td>
<?php
choose_from_menu($WORKSHOP_TYPE, "gradingstrategy", $form->gradingstrategy, "");
helpbutton("gradingstrategy", get_string("gradingstrategy", "workshop"), "workshop");
?>
</td>
</tr>
<tr valign="top">
<td align="right"><p><b><?php print_string("numberofassessmentelements", "workshop") ?>:</b></p></td>
<td valign="middle">
<?php
for ($i=20; $i>=0; $i--) {
$numbers[$i] = $i;
}
choose_from_menu($numbers, "nelements", "$form->nelements", "");
helpbutton("nelements", get_string("numberofassessmentelements", "workshop"), "workshop");
?>
</td>
</tr>
<tr valign="top">
<td align="right"><p><b><?php print_string("numberofattachments", "workshop") ?>:</b></p></td>
<td valign="middle">
<?php
unset($numbers);
for ($i=5; $i>=0; $i--) {
$numbers[$i] = $i;
}
choose_from_menu($numbers, "nattachments", "$form->nattachments", "");
helpbutton("nattachments", get_string("numberofaattachments", "workshop"), "workshop");
?>
</td>
</tr>
<tr>
<td align="right"><p><b><?php print_string("allowresubmit", "workshop") ?>:</b></p></td>
<td>
<?php
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "resubmit", $form->resubmit, "");
helpbutton("resubmit", get_string("allowresubmit", "workshop"), "workshop");
?>
</td>
</tr>
<tr valign="top">
<td align="right"><p><b><?php print_string("numberofassessmentsofteachersexamples", "workshop") ?>:</b></p></td>
<td>
<?php
unset($numbers);
for ($i=20; $i>=0; $i--) {
$numbers[$i] = $i;
}
choose_from_menu($numbers, "ntassessments", $form->ntassessments, "");
helpbutton("nassessmentsofteachersexamples", get_string("numberofassessmentsofteachersexamples", "workshop"), "workshop");
?>
</td>
</tr>
<tr>
<td align="right"><p><b><?php print_string("comparisonofassessments", "workshop") ?>:</b></p></td>
<td>
<?php
// set up comparison names
foreach ($WORKSHOP_ASSESSMENT_COMPS as $KEY => $COMPARISON) {
$COMPARISONS[] = $COMPARISON['name'];
}
choose_from_menu($COMPARISONS, "assessmentcomps", $form->assessmentcomps, "");
helpbutton("comparisonofassessments", get_string("comparisonofassessments", "workshop"), "workshop");
?>
</td>
</tr>
<tr valign="top">
<td align="right"><p><b><?php print_string("numberofassessmentsofstudentsubmissions", "workshop") ?>:</b></p></td>
<td>
<?php
unset($numbers);
for ($i=20; $i>=0; $i--) {
$numbers[$i] = $i;
}
choose_from_menu($numbers, "nsassessments", $form->nsassessments, "");
helpbutton("nassessmentsofstudentsubmissions", get_string("numberofassessmentsofstudentsubmissions", "workshop"), "workshop");
?>
</td>
</tr>
<tr valign="top">
<td align="right"><p><b><?php print_string("weightforteacherassessments", "workshop") ?>:</b></p></td>
<td>
<?php
unset($numbers);
for ($i=10; $i>=0; $i--) {
$numbers[$i] = $i;
}
choose_from_menu($numbers, "teacherweight", $form->teacherweight, "");
helpbutton("teacherweight", get_string("weightforteacherassessments", "workshop"), "workshop");
?>
</td>
</tr>
<tr valign="top">
<td align="right"><p><b><?php print_string("overallocation", "workshop") ?>:</b></p></td>
<td>
<?php
unset($numbers);
for ($i=2; $i>=0; $i--) {
$numbers[$i] = $i;
}
choose_from_menu($numbers, "overallocation", "$form->overallocation", "");
helpbutton("overallocation", get_string("overallocation", "workshop"), "workshop");
?>
</td>
</tr>
<tr>
<td align="right"><p><b><?php print_string("selfassessment", "workshop") ?>:</b></p></td>
<td>
<?php
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "includeself", $form->includeself, "");
helpbutton("selfassessment", get_string("selfassessment", "workshop"), "workshop");
?>
</td>
</tr>
<tr>
<td align="right"><p><b><?php print_string("assessmentsmustbeagreed", "workshop") ?>:</b></p></td>
<td>
<?php
choose_from_menu($options, "agreeassessments", $form->agreeassessments, "");
helpbutton("agreeassessments", get_string("assessmentsmustbeagreed", "workshop"), "workshop");
?>
</td>
</tr>
<tr>
<td align="right"><p><b><?php print_string("hidegradesbeforeagreement", "workshop") ?>:</b></p></td>
<td>
<?php
choose_from_menu($options, "hidegrades", $form->hidegrades, "");
helpbutton("showinggrades", get_string("hidegradesbeforeagreement", "workshop"), "workshop");
?>
</td>
</tr>
<tr>
<td align="right"><p><b><?php print_string("leaguetable", "workshop"); ?>:</b></p></td>
<td>
<?php
unset($numbers);
$numbers[22] = '100';
$numbers[21] = 50;
for ($i=20; $i>=0; $i--) {
$numbers[$i] = $i;
}
choose_from_menu($numbers, "showleaguetable", $form->showleaguetable, "");
helpbutton("leaguetable", get_string("showleaguetable", "workshop"), "workshop");
?>
</td>
</tr>
<tr>
<td align="right"><p><b><?php print_string("hidenamesfromstudents", "workshop", $course->students) ?>:</b></p></td>
<td>
<?php
choose_from_menu($options, "anonymous", $form->anonymous, "");
helpbutton("anonymous", get_string("hidenamesfromstudents", "workshop", $course->students), "workshop");
?>
</td>
</tr>
<tr>
<td align="right"><p><b><?php print_string("usepassword", "workshop"); ?>:</b></p></td>
<td>
<?php
$options[0] = get_string("no"); $options[1] = get_string("yes");
choose_from_menu($options, "usepassword", $form->usepassword, "");
helpbutton("usepassword", get_string("usepassword", "workshop"), "workshop");
?>
</td>
</tr>
<tr>
<td align="right"><p><b><?php print_string("password"); ?>:</b></p></td>
<td>
<input type="text" name="password" size="10" value="" /> <?php echo " (".get_string("leavetokeep").")"; ?>
<?php helpbutton("password", get_string("password"), "workshop"); ?>
</td>
</tr>
<tr valign="top">
<td align="right"><p><b><?php print_string("maximumsize", "workshop") ?>:</b></p></td>
<td>
<?php
$sizelist = array("10Kb", "50Kb", "100Kb", "500Kb", "1Mb", "2Mb", "5Mb", "10Mb", "20Mb", "50Mb");
$maxsize = get_max_upload_file_size();
$sizeinlist = false;
foreach ($sizelist as $size) {
$sizebytes = get_real_size($size);
if ($sizebytes < $maxsize) {
$filesize[$sizebytes] = $size;
}
if ($form->maxbytes == $sizebytes) {
$sizeinlist = true;
}
}
$filesize[$maxsize] = display_size($maxsize);
if (!$sizeinlist) {
$form->maxbytes = get_real_size("500K");
}
ksort($filesize, SORT_NUMERIC);
choose_from_menu($filesize, "maxbytes", "$form->maxbytes", "");
?>
</td>
</tr>
<tr valign="top">
<td align="right"><p><b><?php print_string("deadline", "workshop") ?>:</b></td>
<td><?php
print_date_selector("deadlineday", "deadlinemonth", "deadlineyear", $form->deadline);
echo "&nbsp;-&nbsp;";
print_time_selector("deadlinehour", "deadlineminute", $form->deadline);
?></td>
</tr>
</table>
<br />
<center>
<input type="hidden" name="course" value="<?php p($form->course) ?>" />
<input type="hidden" name="coursemodule" value="<?php p($form->coursemodule) ?>" />
<input type="hidden" name="section" value="<?php p($form->section) ?>" />
<input type="hidden" name="module" value="<?php p($form->module) ?>" />
<input type="hidden" name="modulename" value="<?php p($form->modulename) ?>" />
<input type="hidden" name="instance" value="<?php p($form->instance) ?>" />
<input type="hidden" name="mode" value="<?php p($form->mode) ?>" />
<input type="submit" value="<?php print_string("savechanges") ?>" />
<input type="submit" name="cancel" value="<?php print_string("cancel") ?>" />
<p>
</center>
</form>
Something went wrong with that request. Please try again.