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

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

by Muhammad Harith -
Number of replies: 1

Hi everyone. I have a very quick question regarding using the moosh. I want to create new activity consisting of Scorm packages. but i want to change the general content(name and description) and packages(Auto-update frequency and file that need to be uploaded) with my content. can i do so? currently i running moosh with this command "moosh activity-add --name "Testing" --section 1 scorm 3"

Another question is quite simple. What is the "-o, --options=any options that should be passed for activity creation" that need t parse when using command activity-add? can you give me some example about it.

Thank you in advance.

Average of ratings: -
In reply to Muhammad Harith

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

by Tomasz Muras -
Picture of Core developers Picture of Plugin developers Picture of Plugins guardians Picture of Translators
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,
forcecompleted,forcenewattempt,lastattemptlock,masteryoverride,displayattemptstatus,displaycoursestructure,updatefreq,
sha1hash,md5hash,revision,launch,skipview,hidebrowse,hidetoc,nav,navpositionleft,navpositiontop,
auto,popup,options,width,height,timeopen,timeclose,timemodified,
completionstatusrequired,completionscorerequired,completionstatusallscos,
displayactivityname,autocommit