Course Management block

From MoodleDocs

Block Description

The course management block was developed to increase site administrator's productivity and reduce peak load on Moodle servers caused by the restoring of courses. The Course management block allows Moodle site administrators to schedule restores of courses at non-peak Moodle usage times. It also allows Moodle site administrators to delete multiple courses at one time from one user interface.


NOTE: This was developed for Moodle 1.9. There is NO Moodle 2 version of this block.

If someone knows otherwise, please 1) post the link to the actual block, 2) update this documentation to indicate that and 3)remove this notice. 


Developers

Moodlerooms Inc, Michael Avelar, Sam Chaffee

Global Configuration Settings

To get to this block's global setting options, at the site page, click to 'Modules'>'Blocks'>'Course Management'. This screen provides 3 options for the block:

Max Restores: The maximum number of restores a restore is allow Ignore Currently Processing Flag: Allows the cron to be forced out of turn Enable Email Notification: Site Admin (Default) or alternate contact, will receive email notifications if an error occurs.

block setup

Choose a Restore File (No Metadata file)

Make sure you are on the site home page, then click on the 'Schedule Bulk Restore' link to start the bulk restore scheduling process . block iface.png

You will now see two sections: 'Choose a course to restore:' and 'Choose a course metadata file'. Only the first section has a required input field. To choose a restore zip:

  1. First, choose the location for the zip file. The site directory is chosen by default. If the restore zip is located in a course, choose that course's shortname from the dropdown.
  2. Click the 'Choose from Selected Course' button
  3. Navigate to the restore zip (if necessary), then click on the 'Choose' link next to the resource name.

choose file.png

The section here shows how to use the metadata section to help automate the next few steps. For now, we'll show how to setup the specifics manually. Click 'Continue'. There should be a brief pause, then you should see the following message:

restore validated.png

Click 'Continue'. This next screen is the final step in the restore scheduling process.

Setup Restore Options (No Metadata file)

The final screen should be split up into 4 sections: 'Course Defaults', 'Restore Options', 'Role Mappings', and 'Cron Settings'. When a metadata file was not uploaded, most of these options will be available to you. If a metadata file was uploaded, most of these options will be preselected for you.


Course Defaults

The 'Course Defaults' section should be filled out with data from the original restore. There are four fields in this section:

  • Category: The 'Category' section will default to the category the backup course originated from.
  • Short Name: The 'Short Name' field will be filled out with the original courses shortname.
  • Full Name: The 'Full Name' field will be filled out with the original courses fullname.
  • Course Start Date: The 'Course Start Date' field should also be populated with the original date (depending on original backup options)
  • NOTE: If another course already exist on the site with the same short/fullnames, the new course(s) will be appended with a number to differentiate the courses.

course defaults.png

Restore Options

Restore options availability are largely determined by the original backup file's backup options. EG: If not marked as a metacourse, the 'Metacourse' dropdown will be disabled. If the backup file didn't backup the Log records, the 'Logs' option will be disabled. There are 6-7 fields here (Depending on the original backup options):

  • Metacourse: Restores this course as a metacourse
  • Users: Restores this courses users
  • Logs: Restores the old log records specific to the old course
  • User Files: Restores all user's files into the new course directory
  • Course Files: Restores all course level files into the new course directory
  • Restore how many times?: How many times this course should be copied. Maximum number is determined at the global config level (see here
  • NOTE: All options default to 'No'/'None' to decrease processing time. All option availability is determined by the original backup's settings.

restore options.png

Role Mappings

This section allows you to optionally remap incoming user roles to another role on your Moodle installation. The length of this list is dependent upon the number of assigned roles in the old course. If there is a role match on your installation, it will be selected by default. If there is no match (e.g.: came from another installation), 'Choose a Role...' will be selected and a valid role must be selected before continuing.

role mappings.png


Cron Settings

This section is the only part specific to this block. This is where you set the details for the restore to be run on the cron job. There are 3 fields here:

  • Start Time: The 'Start Time' prevents this restore from starting a process on the cron any time before the 'Start Time'.
  • End Time: The 'End Time' prevents this restore from starting a process on the cron any time on or after the 'End Time'.
  • Priority: Priority is either 'Low' or 'High', and helps the cron to determine which process should be run first. The restore is brought in for next processing following this process:
    • Cron grabs all records that meet the following criteria:
      • Is the scheduled restore have any restores left to process?
      • Is the Current time greater than or equal to the Start Time?
      • Is the Current time less than End Time?
    • All restores that satisfy the above three questions are then further processed. If any are high priority, the low priority restores are automatically removed. The remaining restores then compare their time created timestamp, and the oldest restore is then selected to be processed next.
  • NOTE: All times are relative to the current server time, and are approximate.
  • NOTE: Cron runs approximately every 15 minutes on a default Moodle install. This means that cron times are approximated to 15 minutes + cron approximation.

cron settings.png

Choose a Restore File & Metadata CSV

Restoring a course with some metadata defined really only requires one extra step. You must upload a csv file with some requuired fields. The CSV File should look like the following:

csv.png

  • shortname: The shortname is the unique short name for the course, each entry in this field must be unique (meaning you cannot have more than one of the same shortname) or you will get an error when validating the CSV file.
  • fullname: The fullname is the full name of the course, it does not need to be unique.
  • description: The description is the course's description.
  • sitecat: The sitecat is the Category on the site you want the course to be placed in. If you are using sub-categories, then put in the category path (Category/Sub-Category/Sub-sub Category). The sitecat must match the existing course's category or you will get an error message.
  • startdate: The startdate is the start date for the course. It must be in mm/dd/yyyy, yyyy/mm/dd or mm/dd/yy format.


First, follow steps 1, 2, & 3 only, then instead of clicking continue, go to the 'Choose course metadata file' section. Choose a target course where your CSV is located ('Choose File Location Course'), then click 'Choose From Selected Course'. Navigate to your csv file (or upload it then), then click the 'Choose' link next to the resource.

choose metadata.png

Now, click continue. You should see a green 'Validating...' notice at the top of the screen, then if everything is valid, you should see the following screen:

restore meta validated.png

Click 'Continue' to go to the final step in the scheduling process.

an interface to set up the bulk creation includes identifying the zip file to restore from. an interface or a spreadsheet to upload data from with the following attributes: Course name Course description Site category Primary Facilitator ID Facilitator ID


View Restore Schedule

The View Restore Schedule option on the Course Management block allows the user with appropriate capabilities to view, edit, process, view error details, and reschedule a restore. To get to this page from the site home-page, click on the View Restore Schedule link in the Course Management block.

vrs menu.png


View Restore Schedule Landing Page

vrs view.png

Show Active Schedules Button

The landing page may look complicated, but it most of it is informational. The Show only Active Schedules button toggles display of the restores. This is the default, which displays completed/in-progress/failed restores. If clicked, this will display Show All Scheduled. When only the active are displayed, only the in-progress/failed restores remain visible.

Currently Processing: Yes/No flag

This text area notifies the user if a restore is currently processing that was triggered from this block.

List of Restores

Restores are listed with the most recently created restore at the top and the oldest at the bottom. However, this is not necessarily the order that these restores will be processed (see Cron Settings for more information).

Process Next Restore Now

This button fires the same restore process that the Moodle cron would run, but does so independently of the cron and does so immediately.

  • NOTE: This feature may be disabled if a restore is currently running if the global settings are set as such.

There are two ways to run the restore process 'manually', either by using the Process Next Restore Now button, or by visiting the Moodle cron script via the url (http://yourmoodlesite/admin/cron.php). Running the cron via the url method, then refreshing the View Restore Schedule page should show the Currently Processing flag as 'Yes', if the restored class is a larger class.

vrs curr yess.png

Restore Actions

The red X icon in the Actions column in the List of Restores section cancels the selected restore. It does so by setting the Remaining number of restores to 0, so the restore will no longer be in queue to be processed.

The standard Moodle Edit button allows you to modify only the cron for that restore, to allow the admin to 'reorder' restores as necessary.

vrs edit restore.png

Status: Failed

If for some reason a restore fails from anywhere, the restores' Status column will be filled with a linked, red Failed link, which can be clicked for details on the error, and potential resolution.

vrs failed restore.png vrs failed restore details.png


The error shown above details missing data files (e.g.: files were renamed, moved, or deleted). If the files can be replaced in the same location as before, the restore can be rescheduled and successfully run again.

Delete Multiple Courses

delete courses.png

This feature provides an easy, searchable and sortable interface to select and delete multiple courses. You can filter courses by their parent Course Category, and further filter results with the search field, which will search the fullname of the course for a matching string.

dmc landing.png

After finding the courses you wish to completely delete, check the boxes, and select Delete from the With Selected... option box.

dmc select delete.png

You will then see a Confirmation notice, since this will delete ALL data associated with the selected courses.

dmc confirmation.png

After confirming the courses to delete, each deleted item's status will be output, along with a green Success notification at the end of each class.

  • NOTE: This process can take a long time, depending on the size and content of each of the selected courses.

dmc deleted success.png

See also