Browse files

removed line which was crippling quizzes with HTML in questions or an…

…swers

added check to detect when no grades were returned in the database
  • Loading branch information...
1 parent 59b5352 commit e0a53b4d0a9fd99efc7ae20212c9ac26f6402fec gbateson committed Sep 9, 2005
Showing with 13 additions and 12 deletions.
  1. +13 −12 mod/hotpot/lib.php
View
25 mod/hotpot/lib.php
@@ -425,11 +425,12 @@ function hotpot_get_grades($hotpot, $user_ids='') {
WHERE timefinish>0 AND hotpot='$hotpot->id' $userid_condition
GROUP BY userid
");
-
- if ($hotpot->grademethod==HOTPOT_GRADEMETHOD_FIRST || $hotpot->grademethod==HOTPOT_GRADEMETHOD_LAST) {
- // remove left hand characters in $grade (up to and including the underscore)
- foreach ($grades as $userid=>$grade) {
- $grades[$userid] = substr($grades[$userid], strpos($grades[$userid], '_')+1);
+ if ($grades) {
+ if ($hotpot->grademethod==HOTPOT_GRADEMETHOD_FIRST || $hotpot->grademethod==HOTPOT_GRADEMETHOD_LAST) {
+ // remove left hand characters in $grade (up to and including the underscore)
+ foreach ($grades as $userid=>$grade) {
+ $grades[$userid] = substr($grades[$userid], strpos($grades[$userid], '_')+1);
+ }
}
}
}
@@ -571,13 +572,13 @@ function xml_value($tags, $more_tags="[0]['#']") {
$value = strtr($value, array('&#x003C;'=>'<', '&#x003E;'=>'>', "\n"=>'<br />'));
// encode any orphaned angle brackets back to html entities
- if (empty($this->tag_pattern)) {
- $q = "'"; // single quote
- $qq = '"'; // double quote
- $this->tag_pattern = '<(([^>'.$q.$qq.']*)|('."{$q}[^$q]*$q".')|('."{$qq}[^$qq]*$qq".'))*>';
- }
- $value = preg_replace('/<([^>]*'.$this->tag_pattern.')/', '&lt;$1', $value);
- $value = preg_replace('/('.$this->tag_pattern.'[^<]*)>/', '$1&gt;', $value);
+ //if (empty($this->tag_pattern)) {
+ // $q = "'"; // single quote
+ // $qq = '"'; // double quote
+ // $this->tag_pattern = '<(([^>'.$q.$qq.']*)|('."{$q}[^$q]*$q".')|('."{$qq}[^$qq]*$qq".'))*>';
+ //}
+ //$value = preg_replace('/<([^>]*'.$this->tag_pattern.')/', '&lt;$1', $value);
+ //$value = preg_replace('/('.$this->tag_pattern.'[^<]*)>/', '$1&gt;', $value);
}
return $value;
}

0 comments on commit e0a53b4

Please sign in to comment.