[LON-CAPA-users] Get problem type

Stuart Raeburn raeburn at msu.edu
Wed Jun 14 20:08:01 EDT 2017


Hi HK,

> Is there a function call that returns the problem type (like problem, exam,
> survey ...)?

You can call the &parameter_setting() function.

It takes two arguments: $which and $partid (the first is required, the  
second is optional), and returns the value currently in effect for  
$which.

To retrieve the problem type, the first argument passed to the  
function will be 'type'.

If you do not pass a partID, it will default to using the partID for  
the problem (i.e., part 0).

So, put this in a script block within a problem part:

$type = &parameter_setting('type',$external::part);

if you will be setting a part-specific question type, or in a script  
block outside any part tags if you will be setting a specific question  
type for the problem as a whole.

Note: this is equivalent to the &EXT call:
$type = &EXT("resource.$external::part.type");


Stuart Raeburn
LON-CAPA Academic Consortium


Quoting "H. K. Ng" <hkng at fsu.edu>:

> Hi,
>
> Is there a function call that returns the problem type (like problem, exam,
> survey ...)?
>
> Regards,
> -hk
>



More information about the LON-CAPA-users mailing list