General developer forum

Manipulating Moosh command(activity-add) to add personal scorm packages in Course

Picture of Tomasz Muras
Re: Manipulating Moosh command(activity-add) to add personal scorm packages in Course
Core developersParticularly helpful MoodlersPlugin developersPlugins guardiansTranslators
It used to be not possible and options were actually not implemented in the  activity-add command but that has changed thanks to PR from  Dr Bean . In the latest (master form github) version of moosh you can now run  a command like:

moosh activity-add -n scorm1 -o '--intro=my intro ABC --forcenewattempt=1' scorm 2

to add scorm with name "scorm1" and description "My intro ABC" to course with ID 2.

To test the package and update frequency, you will need to use other options and pass them like I did with intro and forcenewattempt above.

To figure out the names of the options, it's easiest to review two places.
1. function create_instance from mod_scorm_generator class from file mod/scorm/tests/generator/lib.php.
The fragment you're interested in is:
// Add default values for scorm.
$record = (array)$record + array(
'scormtype' => SCORM_TYPE_LOCAL,
'packagefile' => '',
'packageurl' => '',
'updatefreq' => SCORM_UPDATE_NEVER,
'popup' => 0,
'width' => $cfgscorm->framewidth,
'height' => $cfgscorm->frameheight,
'skipview' => $cfgscorm->skipview,
'hidebrowse' => $cfgscorm->hidebrowse,
'displaycoursestructure' => $cfgscorm->displaycoursestructure,
'hidetoc' => $cfgscorm->hidetoc,
'nav' => $cfgscorm->nav,
'navpositionleft' => $cfgscorm->navpositionleft,
'navpositiontop' => $cfgscorm->navpositiontop,
'displayattemptstatus' => $cfgscorm->displayattemptstatus,
'timeopen' => 0,
'timeclose' => 0,
'grademethod' => GRADESCOES,
'maxgrade' => $cfgscorm->maxgrade,
'maxattempt' => $cfgscorm->maxattempt,
'whatgrade' => $cfgscorm->whatgrade,
'forcenewattempt' => $cfgscorm->forcenewattempt,
'lastattemptlock' => $cfgscorm->lastattemptlock,
'forcecompleted' => $cfgscorm->forcecompleted,
'masteryoverride' => $cfgscorm->masteryoverride,
'auto' => $cfgscorm->auto,
'displayactivityname' => $cfgscorm->displayactivityname

2. Database structure for table mdl_scorm, the names of the columns in Moodle 3.5 are: course,name,scormtype,reference,intro,introformat,version,maxgrade,grademethod,whatgrade,maxattempt,
Average of ratings: -