Resource list box?

Resource list box?

Vitor Gonçalves發表於
Number of replies: 1

Hi!

I'm trying to develop a simple module. In the form to add/edit data I need a list box field with the name of all resources (or/and activities) for each course).

I tried this code in mod.html file:

$resources = get_records_list("resource", "name", $mymodule->resource);
$allresources = explode(",", $mymodule->resource);
choose_from_menu($allresources, "resource", $form->resource);

But the result did't show any record of the table resource!

Anyone help me how to do this ? Thanks

附件 resource_listbox.JPG
評比平均分數: -
In reply to Vitor Gonçalves

Re: Resource list box?

Tim Hunt發表於
Core developers的相片 Documentation writers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片
Change your code to output some of the intermediate variable, so you can see what is going on. For example:

$resources = get_records_list("resource", "name", $mymodule->resource);
print_object($resources);
$allresources = explode(",", $mymodule->resource);
choose_from_menu($allresources, "resource", $form->resource);

That should give you some clues as to where you are going wrong.