mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 09:26:35 +02:00
Bug #3623 - doesn't like when $value = 0
This commit is contained in:
parent
1c58f4402c
commit
af834f3e7c
2 changed files with 5 additions and 5 deletions
|
@ -70,7 +70,7 @@ function choice_add_instance($choice) {
|
||||||
foreach ($choice as $name => $value) {
|
foreach ($choice as $name => $value) {
|
||||||
if (strstr($name, "newoption")) { /// New option
|
if (strstr($name, "newoption")) { /// New option
|
||||||
$value = trim($value);
|
$value = trim($value);
|
||||||
if ($value) {
|
if (isset($value) && $value <> '') {
|
||||||
$option = NULL;
|
$option = NULL;
|
||||||
$option->text = $value;
|
$option->text = $value;
|
||||||
$option->choiceid = $choice->id;
|
$option->choiceid = $choice->id;
|
||||||
|
@ -110,7 +110,7 @@ function choice_update_instance($choice) {
|
||||||
$value = trim($value);
|
$value = trim($value);
|
||||||
|
|
||||||
if (strstr($name, "oldoption")) { // Old option
|
if (strstr($name, "oldoption")) { // Old option
|
||||||
if ($value) {
|
if (isset($value) && $value <> '') {
|
||||||
$option = NULL;
|
$option = NULL;
|
||||||
$option->id = substr($name, 9); // Get the ID of the answer that needs to be updated.
|
$option->id = substr($name, 9); // Get the ID of the answer that needs to be updated.
|
||||||
$option->text = $value;
|
$option->text = $value;
|
||||||
|
@ -122,7 +122,7 @@ function choice_update_instance($choice) {
|
||||||
delete_records("choice_options", "id", substr($name, 9));
|
delete_records("choice_options", "id", substr($name, 9));
|
||||||
}
|
}
|
||||||
} else if (strstr($name, "newoption")) { /// New option
|
} else if (strstr($name, "newoption")) { /// New option
|
||||||
if ($value) {
|
if (isset($value)&& $value <> '') {
|
||||||
$option = NULL;
|
$option = NULL;
|
||||||
$option->text = $value;
|
$option->text = $value;
|
||||||
$option->choiceid = $choice->id;
|
$option->choiceid = $choice->id;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
require_once("../../config.php");
|
require_once("../../config.php");
|
||||||
require_once("lib.php");
|
require_once("lib.php");
|
||||||
|
|
||||||
$id = required_param('id',0,PARAM_INT); // Course Module ID
|
require_variable($id); // Course Module ID
|
||||||
|
|
||||||
if (! $cm = get_record("course_modules", "id", $id)) {
|
if (! $cm = get_record("course_modules", "id", $id)) {
|
||||||
error("Course Module ID was incorrect");
|
error("Course Module ID was incorrect");
|
||||||
|
@ -147,7 +147,7 @@
|
||||||
}
|
}
|
||||||
$maxans = $choice->maxanswers[$optionid];
|
$maxans = $choice->maxanswers[$optionid];
|
||||||
|
|
||||||
if ($text) {
|
if (isset($text)) {
|
||||||
echo "<td align=\"center\" valign=\"top\">";
|
echo "<td align=\"center\" valign=\"top\">";
|
||||||
echo "<input type=\"radio\" name=\"answer\" value=\"".$optionid."\" ".$answerchecked[$optionid]." alt=\"".strip_tags(format_text($text))."\"";
|
echo "<input type=\"radio\" name=\"answer\" value=\"".$optionid."\" ".$answerchecked[$optionid]." alt=\"".strip_tags(format_text($text))."\"";
|
||||||
if ($choice->limitanswers && ($countanswers >= $maxans) && !($answerchecked[$optionid]) ) {
|
if ($choice->limitanswers && ($countanswers >= $maxans) && !($answerchecked[$optionid]) ) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue