[LON-CAPA-users] Part list/order

Stuart Raeburn raeburn at msu.edu
Tue Jul 30 19:00:00 EDT 2013


Hi,

> Is there a way to determine the number of parts in a problem using the EXT
> function? or the part order?

No, not currently.

Could you provide more details of how and where you would like to use  
this information?

The expression: &EXT('resource.0.hiddenparts'); will give you a list  
of part IDs of hidden parts (set via Parameter) for the current user.

I could also add an additional item to lonnet::EXT(), e.g., accessible  
via: &EXT('resource.visibleparts'), to return a comma-separated list  
of part IDs for parts viewable by the current user (in course  
context). The implementation would make use of $res->parts() from  
lonnavmaps.pm

On a separate note, when authoring a problem you can also set up a  
counter in the problem itself, e.g., at the beginning of the problem  
you could include:
<script type="loncapa/perl">$numparts = 0; </script>

and then include an additional script block within each part containing:
<script type="loncapa/perl">$numparts ++; </script>

The total number of displayed parts would then be available after all  
parts had been parsed.


Stuart Raeburn
LON-CAPA Academic Consortium


Quoting hkng <hkng at fsu.edu>:

> Hi,
>
> Is there a way to determine the number of parts in a problem using the EXT
> function? or the part order?
>
> Thanks,
> -hk
>



More information about the LON-CAPA-users mailing list