Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Files | Namespaces | Classes | Functions | Variables
format_weeks

Files

file  events.php
 Format weeks event handler definition.
 
file  format.php
 Weeks course format.
 
file  lib.php
 This file contains main class for the course format Weeks.
 
file  observer.php
 Event observers used by the weeks course format.
 
file  provider.php
 Privacy Subsystem implementation for format_weeks.
 
file  renderer.php
 Renderer for outputting the weeks course format.
 
file  restore_format_weeks_plugin.class.php
 Specialised restore for format_weeks.
 
file  upgrade.php
 Upgrade scripts for course format "Weeks".
 
file  upgradelib.php
 Upgrade scripts for course format "Weeks".
 

Namespaces

 format_weeks\privacy
  
 

Classes

class  format_weeks
 Main class for the Weeks course format. More...
 
class  format_weeks\privacy\provider
 Privacy Subsystem for format_weeks implementing null_provider. More...
 
class  format_weeks_observer
 Event observer for format_weeks. More...
 
class  format_weeks_renderer
 Basic renderer for weeks format. More...
 
class  restore_format_weeks_plugin
 

Functions

 format_weeks_inplace_editable ($itemtype, $itemid, $newvalue)
 Implements callback inplace_editable() allowing to edit values in-place. More...
 
 format_weeks_upgrade_add_empty_sections ($courseid, $numsections)
 This method adds empty sections to courses which have fewer sections than their 'numsections' course format option and adds these empty sections. More...
 
 format_weeks_upgrade_hide_extra_sections ($courseid, $numsections)
 Find all sections in the course with sectionnum bigger than numsections. More...
 
 format_weeks_upgrade_remove_numsections ()
 This method finds all courses in 'topics' format that have actual number of sections different than their 'numsections' course format option. More...
 
 xmldb_format_weeks_upgrade ($oldversion)
 Upgrade script for format_weeks. More...
 

Variables

if($week=optional_param('week', 0, PARAM_INT)) $course = course_get_format($course)->get_course()
 
 $observers
 
 $renderer = $PAGE->get_renderer('format_weeks')
 
if(!empty($displaysection)) else
 

Detailed Description

Function Documentation

◆ format_weeks_inplace_editable()

format_weeks_inplace_editable (   $itemtype,
  $itemid,
  $newvalue 
)

Implements callback inplace_editable() allowing to edit values in-place.

Parameters
string$itemtype
int$itemid
mixed$newvalue
Return values
core

◆ format_weeks_upgrade_add_empty_sections()

format_weeks_upgrade_add_empty_sections (   $courseid,
  $numsections 
)

This method adds empty sections to courses which have fewer sections than their 'numsections' course format option and adds these empty sections.

Parameters
int$courseid
int$numsections

◆ format_weeks_upgrade_hide_extra_sections()

format_weeks_upgrade_hide_extra_sections (   $courseid,
  $numsections 
)

Find all sections in the course with sectionnum bigger than numsections.

Either delete these sections or hide them

We will only delete a section if it is completely empty and all sections below it are also empty

Parameters
int$courseid
int$numsections

◆ format_weeks_upgrade_remove_numsections()

format_weeks_upgrade_remove_numsections ( )

This method finds all courses in 'topics' format that have actual number of sections different than their 'numsections' course format option.

For courses where there are more sections than numsections, we call format_weeks_upgrade_hide_extra_sections() and either delete or hide "orphaned" sections. For courses where there are fewer sections than numsections, we call format_weeks_upgrade_add_empty_sections() to add these sections.

◆ xmldb_format_weeks_upgrade()

xmldb_format_weeks_upgrade (   $oldversion)

Upgrade script for format_weeks.

Parameters
int$oldversionthe version we are upgrading from
Return values
boolresult

Variable Documentation

◆ $observers

$observers
Initial value:
= array(
array(
'eventname' => '\core\event\course_updated',
'callback' => 'format_weeks_observer::course_updated',
),
array(
'eventname' => '\core\event\course_section_created',
'callback' => 'format_weeks_observer::course_section_created',
),
array(
'eventname' => '\core\event\course_section_deleted',
'callback' => 'format_weeks_observer::course_section_deleted',
)
)

◆ else

if (!empty( $displaysection)) else
Initial value:
{
$renderer->print_multiple_section_page($course, null, null, null, null)