For web output in a simple module, I use a dropdown menu box that list all activities/resources. The code is:
$lines = get_array_of_activities($course->id);
foreach ($lines as $line) {
$line->mod = get_string("modulename", "$line->mod");
$lo[] = $line->cm;
//I prefer the line below:
// $lo[] = $line->cm . ' - ' . $line->name . ' (' . $line->mod . ')';
// resources or activities id-name and module name in course
}
choose_from_menu($lo, "resource", $form->resource);
But in the field "resource" of my table is saved 7 (value array) instead of 12 (label array - $line->cm )...
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 6 [4] => 4 [5] => 5 [6] => 7 [7] => 12 [8] => 13 [9] => 15 )
What I have to do? Thanks