Browse Source

In mod_form.php checks if the selected category corresponds to selected glossary

MOODLE_20_STABLE
Vasilis Daloukas 8 years ago
parent
commit
d0cd349f51
  1. 8
      mod_form.php

8
mod_form.php

@ -118,7 +118,13 @@ class mod_game_mod_form extends moodleform_mod {
$select = 'g.id IN ('.substr( $select, 1).')'; $select = 'g.id IN ('.substr( $select, 1).')';
} }
$a = array(); $a = array();
$a[ ] = ''; $sql = "SELECT g.id, g.name, COUNT(*) as c ".
"FROM {$CFG->prefix}glossary_entries ge, {$CFG->prefix}glossary g ".
"WHERE $select AND ge.glossaryid=g.id";
$recs = $DB->get_records_sql( $sql);
foreach( $recs as $rec) {
$a[ -$rec->id] = $rec->name.' -> ('.$rec->c.')';
}
$sql2 = "SELECT COUNT(*) ". $sql2 = "SELECT COUNT(*) ".
" FROM {$CFG->prefix}glossary_entries ge, {$CFG->prefix}glossary_entries_categories gec". " FROM {$CFG->prefix}glossary_entries ge, {$CFG->prefix}glossary_entries_categories gec".
" WHERE gec.categoryid=gc.id AND gec.entryid=ge.id"; " WHERE gec.categoryid=gc.id AND gec.entryid=ge.id";

Loading…
Cancel
Save