You are here

function question_list_instances in Quiz 6.5

Same name and namespace in other branches
  1. 6.6 includes/moodle/lib/questionlib.php \question_list_instances()

Returns an array of names of activity modules that use this question

Parameters

object $questionid:

Return value

array of strings

2 calls to question_list_instances()
delete_question in includes/moodle/lib/questionlib.php
Deletes question and all associated data from the database
question_category_isused in includes/moodle/lib/questionlib.php
Tests whether a category is in use by any activity module

File

includes/moodle/lib/questionlib.php, line 255

Code

function question_list_instances($questionid) {
  global $CFG;
  $instances = array();
  $modules = get_records('modules');
  foreach ($modules as $module) {
    $fullmod = $CFG->dirroot . '/mod/' . $module->name;
    if (file_exists($fullmod . '/lib.php')) {
      include_once $fullmod . '/lib.php';
      $fn = $module->name . '_question_list_instances';
      if (function_exists($fn)) {
        $instances = $instances + $fn($questionid);
      }
    }
  }
  return $instances;
}