2 if (empty($form->name
)) {
5 if (empty($form->text
)) {
8 if (empty($form->format
)) {
11 if (empty($form->display
)) {
14 if (empty($form->timeopen
)) {
16 $form->timerestrict
= 0;
18 $form->timerestrict
= 1;
20 if (empty($form->timeclose
)) {
21 $form->timeclose
= "";
23 if (empty($form->publish
)) {
26 if (empty($form->release
)) {
29 if (empty($form->allowupdate
)) {
30 $form->allowupdate
= 0;
32 if (empty($form->showunanswered
)) {
33 $form->showunanswered
= 0;
35 if (empty($form->limitanswers
)) {
36 $form->limitanswers
= 0;
40 <script type=
"text/javascript">
41 function lockselects(form
, master
, subitems
) {
42 // subitems is an array of names of sub items
43 // requires that each item in subitems has a
44 // companion hidden item in the form with the
45 // same name but prefixed by "h"
46 // master is the name of the selct
47 // x is the option that is selcted to enforce the lock.
48 if (eval("document."+form
+"."+master
+".selected")) {
49 for (i
=0; i
<subitems
.length
; i
++) {
50 lockoption(form
, subitems
[i
]);
53 for (i
=0; i
<subitems
.length
; i
++) {
54 unlockoption(form
, subitems
[i
]);
61 <form name=
"form" method=
"post" action=
"mod.php">
63 <table cellpadding=
"5">
66 <td align=
"right"><strong><?php print_string("choicename","choice") ?>:
</strong></td>
68 <input type=
"text" name=
"name" size=
"30" alt=
"<?php print_string("choicename
","choice
") ?>" value
="<?php p($form->name) ?>" />
73 <td align
="right"><strong
><?php
print_string("choicetext","choice") ?>:
</strong><br /><br />
75 helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
77 helpbutton("questions", get_string("helpquestions"), "moodle", true, true);
80 helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
82 emoticonhelpbutton("form", "text");
89 print_textarea($usehtmleditor, 20, 60, 680, 400, "text", $form->text
);
92 echo '<input type="hidden" name="format" value="'.FORMAT_HTML
.'" />';
94 echo "<div align=\"right\">";
95 helpbutton("textformat", get_string("formattexttype"));
96 print_string("formattexttype");
99 $form->format
= $defaultformat;
101 choose_from_menu(format_text_menu(), "format", $form->format
, "");
109 $standardblanks = 10;
111 $limitfieldlist = '';
112 if (($options = get_records_menu('choice_options','choiceid', $form->instance
, 'id', 'id,text')) && ($options2 = get_records_menu('choice_options','choiceid', $form->instance
, 'id', 'id,maxanswers')) ) {
113 foreach ($options as $id => $text) {
117 <td align=
"right"><strong><?php echo get_string("choice","choice").' '.$count; ?>:
</strong></td>
119 <input type=
"text" name=
"oldoption<?php p($id) ?>" size
="60" value
="<?php p($text) ?>" id
="oldoption<?php p($id) ?>" />
120 <?php
helpbutton("options", get_string("modulenameplural", "choice"), "choice") ?>
122 <td align=
"right"><strong><?php p(get_string("limit","choice")) ?>:
</strong>
123 <input type=
"text" name=
"oldlimit<?php p($id) ?>" size
="4" value
="<?php p($options2[$id]) ?>" id
="oldlimit<?php p($id) ?>" />
124 <input type
="hidden" name
="holdlimit<?php p($id) ?>" value
="0"/>
128 $limitfieldlist .= "'oldlimit".$id."',";
132 for ($i=1; $i<=$standardblanks; $i++
) {
136 <td align=
"right"><strong><?php echo get_string("choice","choice").' '.$count; ?>:
</strong></td>
138 <input type=
"text" name=
"newoption<?php p($i) ?>" size
="60" value
="" id
="newoption<?php p($i) ?>">
139 <?php
helpbutton("options", get_string("modulenameplural", "choice"), "choice") ?>
141 <td align=
"right"><strong><?php p(get_string("limit","choice")) ?>:
</strong>
142 <input type=
"text" name=
"newlimit<?php p($i)?>" size
="4" value
="0" id
="newlimit<?php p($i) ?>" />
143 <input type
="hidden" name
="hnewlimit<?php p($i) ?>" value
="0" />
147 $limitfieldlist .= "'newlimit".$i."',";
149 $limitfieldlist = trim($limitfieldlist, ",");
151 <script type=
"text/javascript">
152 limititems
= [<?php
p($limitfieldlist
); ?>];
156 <td align=
"right" colspan=
"2"><strong><?php print_string("limitanswers", "choice") ?>:
</strong></td>
159 $menuoptions[0] = get_string("disable");
160 $menuoptions[1] = get_string("enable");
161 helpbutton("limit", get_string("limit", "choice"), "choice");
163 choose_from_menu($menuoptions, "limitanswers", "$form->limitanswers", "", "return lockselects('form','limitanswers.options[0]', limititems)");
168 <?php if ($form->limitanswers
== 0) { //lock the limit fields if limit isn't used. ?>
169 <script type
="text/javascript">
170 lockoptions('form','limitanswers', limititems
);
175 <td align=
"right"><strong><?php print_string("timerestrict", "choice") ?>:
</strong></td>
177 <script type=
"text/javascript">
178 var timeitems
= ['openday','openmonth','openyear','openhour', 'openminute', 'closeday','closemonth','closeyear','closehour','closeminute'];
181 <input name=
"timerestrict" type=
"checkbox" value=
"1" alt=
"<?php print_string("timerestrict
", "choice
") ?>" onclick
="return lockoptions('form','timerestrict', timeitems)" <?php
if ($form->timerestrict
) echo 'checked="checked"'; ?> />
183 helpbutton("timerestrict", get_string("timerestrict","choice"), "choice");
192 <td align=
"right"><strong><?php print_string("choiceopen", "choice") ?>:
</strong></td>
196 if (!$form->timeopen
and $course->format
== "weeks") {
197 $form->timeopen
= $course->startdate +
(($form->section
- 1) * 608400);
199 print_date_selector("openday", "openmonth", "openyear", $form->timeopen
);
200 print_time_selector("openhour", "openminute", $form->timeopen
);
203 <input type=
"hidden" name=
"hopenday" value=
"0" />
204 <input type=
"hidden" name=
"hopenmonth" value=
"0" />
205 <input type=
"hidden" name=
"hopenyear" value=
"0" />
206 <input type=
"hidden" name=
"hopenhour" value=
"0" />
207 <input type=
"hidden" name=
"hopenminute" value=
"0" />
211 <td align=
"right"><strong><?php print_string("choiceclose", "choice") ?>:
</strong></td>
215 if (!$form->timeclose
and $course->format
== "weeks") {
216 $form->timeclose
= $course->startdate +
(($form->section
) * 608400);
218 print_date_selector("closeday", "closemonth", "closeyear", $form->timeclose
);
219 print_time_selector("closehour", "closeminute", $form->timeclose
);
222 <input type=
"hidden" name=
"hcloseday" value=
"0" />
223 <input type=
"hidden" name=
"hclosemonth" value=
"0" />
224 <input type=
"hidden" name=
"hcloseyear" value=
"0" />
225 <input type=
"hidden" name=
"hclosehour" value=
"0" />
226 <input type=
"hidden" name=
"hcloseminute" value=
"0" />
229 if (! $form->timerestrict
) {
230 echo "<script type=\"text/javascript\">";
231 echo "lockoptions('form','timerestrict', timeitems);";
244 <td align=
"right"><strong><?php print_string("displaymode","choice") ?>:
</strong></td>
247 require_once("$CFG->dirroot/mod/choice/lib.php");
248 choose_from_menu($CHOICE_DISPLAY, "display", "$form->display", "");
255 <td align=
"right"><strong><?php print_string("publish","choice") ?>:
</strong></td>
258 require_once("$CFG->dirroot/mod/choice/lib.php");
259 choose_from_menu($CHOICE_RELEASE, "release", "$form->release", "", "return lockselects('form','release.options[0]',['publish'])");
266 <td align=
"right"><strong><?php print_string("privacy","choice") ?>:
</strong></td>
269 require_once("$CFG->dirroot/mod/choice/lib.php");
270 choose_from_menu($CHOICE_PUBLISH, "publish", "$form->publish", "");
273 <input type=
"hidden" name=
"hpublish" value=
"0" />
276 <script type=
"text/javascript">
277 lockselects('form','release.options[0]',['publish']);
281 <td align=
"right"><strong><?php print_string("allowupdate","choice") ?>:
</strong></td>
284 $menuoptions[0] = get_string("no");
285 $menuoptions[1] = get_string("yes");
286 choose_from_menu($menuoptions, "allowupdate", "$form->allowupdate", "");
294 <td align=
"right"><strong><?php print_string("showunanswered","choice") ?>:
</strong></td>
297 $menuoptions[0] = get_string("no");
298 $menuoptions[1] = get_string("yes");
299 choose_from_menu($menuoptions, "showunanswered", "$form->showunanswered", "");
304 <?php print_standard_coursemodule_settings($form); ?>
308 <input type=
"hidden" name=
"course" value=
"<?php p($form->course) ?>" />
309 <input type
="hidden" name
="sesskey" value
="<?php p($form->sesskey) ?>" />
310 <input type
="hidden" name
="coursemodule" value
="<?php p($form->coursemodule) ?>" />
311 <input type
="hidden" name
="section" value
="<?php p($form->section) ?>" />
312 <input type
="hidden" name
="module" value
="<?php p($form->module) ?>" />
313 <input type
="hidden" name
="modulename" value
="<?php p($form->modulename) ?>" />
314 <input type
="hidden" name
="instance" value
="<?php p($form->instance) ?>" />
315 <input type
="hidden" name
="mode" value
="<?php p($form->mode) ?>" />
316 <input type
="submit" value
="<?php print_string("savechanges
") ?>" />
317 <input type
="submit" name
="cancel" value
="<?php print_string("cancel
") ?>" />