Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
|
Topics | |
backup | |
event | |
external | |
grade | |
log | |
test | |
Directories | |
directory | analytics |
| |
directory | backup |
| |
directory | local |
| |
Namespaces | |
namespace | mod_lesson |
| |
namespace | mod_lesson\analytics\indicator |
Activity base class. | |
namespace | mod_lesson\cache |
| |
namespace | mod_lesson\completion |
| |
namespace | mod_lesson\event |
The mod_lesson content page viewed event class. | |
namespace | mod_lesson\external |
Class for exporting partial lesson data. | |
namespace | mod_lesson\local\numeric |
Lesson's numeric helper lib. | |
namespace | mod_lesson\output |
Output the actionbar for this activity. | |
namespace | mod_lesson\privacy |
Data provider. | |
namespace | mod_lesson\search |
Search area for mod_lesson activities. | |
Functions | |
lesson_add_fake_blocks ($page, $cm, $lesson, $timer=null) | |
lesson_add_header_buttons ($cm, $context, $extraeditbuttons=false, $lessonpageid=null) | |
Adds header buttons to the page for the lesson. | |
lesson_clock_block_contents ($cmid, $lesson, $timer, $page) | |
If a timed lesson and not a teacher, then return a block_contents containing the clock. | |
lesson_display_teacher_warning ($lesson) | |
Any other lesson functions go here. | |
lesson_displayleftif ($lesson) | |
Determines if a user can view the left menu. | |
lesson_get_completion_state () | |
List of deprecated mod_lesson functions. | |
object | lesson_get_media_html ($lesson, $context) |
This is a function used to detect media types and generate html code. | |
lesson_get_overview_report_table_and_data (lesson $lesson, $currentgroup) | |
Return the overview report table and data. | |
lesson_get_user_deadline ($courseid) | |
Return user's deadline for all lessons in a course, hereby taking into account group and user overrides. | |
lesson_get_user_detailed_report_data (lesson $lesson, $userid, $attempt) | |
Return information about one user attempt (including answers) | |
lesson_grade ($lesson, $ntries, $userid=0) | |
Calculates a user's grade for a lesson. | |
lesson_import_question_files ($field, $data, $answer, $contextid) | |
Import files embedded into answer or response. | |
lesson_mediafile_block_contents ($cmid, $lesson) | |
If there is a media file associated with this lesson, return a block_contents that displays it. | |
lesson_menu_block_contents ($cmid, $lesson) | |
If left menu is turned on, then this will print the menu in a block. | |
lesson_process_group_deleted_in_course ($courseid, $groupid=null) | |
Logic to happen when a/some group(s) has/have been deleted in a course. | |
lesson_random_question_jump ($lesson, $pageid) | |
Handles the random jump between a branch table and end of branch or end of lesson (LESSON_RANDOMPAGE). | |
lesson_save_question_options ($question, $lesson, $contextid) | |
Given some question info and some data about the the answers this function parses, organises and saves the question. | |
lesson_unseen_branch_jump ($lesson, $userid) | |
Handles the unseen branch table jump. | |
lesson_unseen_question_jump ($lesson, $user, $pageid) | |
Interprets the LESSON_UNSEENBRANCHPAGE jump. | |
stdClass | xmldb_lesson_upgrade ($oldversion) |
$CFG @global moodle_database $DB | |
Variables | |
$attemptscount = $DB->count_records('lesson_grades', array('lessonid'=>$lesson->id)) | |
user attempt count for reports link hover (completed attempts - much faster) | |
$capabilities | |
global | $DB |
This file to be included so we can assume config.php has already been included. | |
$definitions | |
$messageproviders | |
Defines message providers (types of messages being sent) | |
$plugin = 2023100400 | |
$row [] = new tabobject('view', "$CFG->wwwroot/mod/lesson/view.php?id=$cm->id", get_string('preview', 'lesson'), get_string('previewlesson', 'lesson', format_string($lesson->name))) | |
if(empty( $lesson)) if(!isset($currenttab)) if(!isset( $cm)) if(!isset($course)) | $tabs = $row = $inactive = $activated = array() |
if(has_capability( 'mod/lesson:viewreports', $context)) if(has_capability('mod/lesson:grade', $context)) | $tabs [] = $row |
$plugin | component = 'mod_lesson' |
$plugin | cron = 0 |
const | LESSON_ANSWER_HTML "HTML" |
Answer format is HTML. | |
const | LESSON_CLUSTERJUMP -80 |
Cluster Jump. | |
const | LESSON_EOL -9 |
End of Lesson. | |
const | LESSON_MAX_EVENT_LENGTH "432000" |
LESSON_MAX_EVENT_LENGTH = 432000 ; 5 days maximum. | |
const | LESSON_NEXTPAGE -1 |
Jump to Next Page. | |
const | LESSON_OTHER_ANSWERS "@#wronganswer#@" |
Placeholder answer for all other answers. | |
const | LESSON_PAGE_BRANCHTABLE "20" |
Branch Table page. | |
const | LESSON_PAGE_CLUSTER "30" |
Start of Cluster page. | |
const | LESSON_PAGE_ENDOFBRANCH "21" |
End of Branch page. | |
const | LESSON_PAGE_ENDOFCLUSTER "31" |
End of Cluster page. | |
const | LESSON_PAGE_ESSAY "10" |
Essay question type. | |
const | LESSON_PAGE_MATCHING "5" |
Matching question type. | |
const | LESSON_PAGE_MULTICHOICE "3" |
Multichoice question type. | |
const | LESSON_PAGE_NUMERICAL "8" |
Numerical question type. | |
const | LESSON_PAGE_SHORTANSWER "1" |
Short answer question type. | |
const | LESSON_PAGE_TRUEFALSE "2" |
True/False question type. | |
const | LESSON_PREVIOUSPAGE -40 |
Jump to Previous Page. | |
const | LESSON_RANDOMBRANCH -70 |
Jump to a random Branch. | |
const | LESSON_RANDOMPAGE -60 |
Jump to a random page within a branch and end of branch or end of lesson. | |
const | LESSON_THISPAGE 0 |
Include the files that are required by this module. | |
const | LESSON_UNANSWEREDPAGE 2 |
Next page -> any page not answered correctly. | |
const | LESSON_UNDEFINED -99 |
Undefined. | |
const | LESSON_UNSEENBRANCHPAGE -50 |
Jump to an unseen page within a branch and end of branch or end of lesson. | |
const | LESSON_UNSEENPAGE 1 |
Next page -> any page not seen before. | |
$plugin | version = 2023100900 |
lesson_add_fake_blocks | ( | $page, | |
$cm, | |||
$lesson, | |||
$timer = null ) |
$cm | |
$lesson | |
$page |
unknown_type |
lesson_add_header_buttons | ( | $cm, | |
$context, | |||
$extraeditbuttons = false, | |||
$lessonpageid = null ) |
Adds header buttons to the page for the lesson.
object | $cm | |
object | $context | |
bool | $extraeditbuttons | |
int | $lessonpageid |
lesson_clock_block_contents | ( | $cmid, | |
$lesson, | |||
$timer, | |||
$page ) |
If a timed lesson and not a teacher, then return a block_contents containing the clock.
int | $cmid | Course Module ID for this lesson |
object | $lesson | Full lesson record object |
object | $timer | Full timer record object |
block_contents |
lesson_display_teacher_warning | ( | $lesson | ) |
Any other lesson functions go here.
Each of them must have a name that starts with lesson_ Checks to see if a LESSON_CLUSTERJUMP or a LESSON_UNSEENBRANCHPAGE is used in a lesson.
This function is only executed when a teacher is checking the navigation for a lesson.
stdClass | $lesson | Id of the lesson that is to be checked. |
boolean | True or false. |
lesson_displayleftif | ( | $lesson | ) |
Determines if a user can view the left menu.
The determining factor is whether a user has a grade greater than or equal to the lesson setting of displayleftif
object | $lesson | Lesson object of the current lesson |
boolean | 0 if the user cannot see, or $lesson->displayleft to keep displayleft unchanged |
lesson_get_completion_state | ( | ) |
List of deprecated mod_lesson functions.
object lesson_get_media_html | ( | $lesson, | |
$context ) |
This is a function used to detect media types and generate html code.
$CFG @global object $PAGE
object | $lesson | |
object | $context |
string\$code | the html code of media |
lesson_get_overview_report_table_and_data | ( | lesson | $lesson, |
$currentgroup ) |
Return the overview report table and data.
lesson | $lesson | lesson instance |
mixed | $currentgroup | false if not group used, 0 for all groups, group id (int) to filter by that groups |
mixed | false if there is no information otherwise html_table and stdClass with the table and data |
lesson_get_user_deadline | ( | $courseid | ) |
Return user's deadline for all lessons in a course, hereby taking into account group and user overrides.
int | $courseid | the course id. |
object | An object with of all lessonsids and close unixdates in this course, taking into account the most lenient overrides, if existing and 0 if no close date is set. |
lesson_get_user_detailed_report_data | ( | lesson | $lesson, |
$userid, | |||
$attempt ) |
Return information about one user attempt (including answers)
lesson | $lesson | lesson instance |
int | $userid | the user id |
int | $attempt | the attempt number |
array | the user answers (array) and user data stats (object) |
lesson_grade | ( | $lesson, | |
$ntries, | |||
$userid = 0 ) |
Calculates a user's grade for a lesson.
object | $lesson | The lesson that the user is taking. |
int | $retries | The attempt number. |
int | $userid | Id of the user (optional, default current user). |
object | { nquestions => number of questions answered attempts => number of question attempts total => max points possible earned => points earned by student grade => calculated percentage grade nmanual => number of manually graded questions manualpoints => point value for manually graded questions } |
lesson_import_question_files | ( | $field, | |
$data, | |||
$answer, | |||
$contextid ) |
Import files embedded into answer or response.
string | $field | nfield name (answer or response) |
array | $data | imported data |
object | $answer | answer object |
int | $contextid |
lesson_mediafile_block_contents | ( | $cmid, | |
$lesson ) |
If there is a media file associated with this lesson, return a block_contents that displays it.
int | $cmid | Course Module ID for this lesson |
object | $lesson | Full lesson record object |
block_contents |
lesson_menu_block_contents | ( | $cmid, | |
$lesson ) |
If left menu is turned on, then this will print the menu in a block.
int | $cmid | Course Module ID for this lesson |
lesson | $lesson | Full lesson record object |
void |
lesson_process_group_deleted_in_course | ( | $courseid, | |
$groupid = null ) |
Logic to happen when a/some group(s) has/have been deleted in a course.
int | $courseid | The course ID. |
int | $groupid | The group id if it is known |
void |
lesson_random_question_jump | ( | $lesson, | |
$pageid ) |
Handles the random jump between a branch table and end of branch or end of lesson (LESSON_RANDOMPAGE).
lesson | $lesson | |
int | $pageid | The id of the page that we are jumping from (?) |
int | The pageid of a random page that is within a branch table |
lesson_save_question_options | ( | $question, | |
$lesson, | |||
$contextid ) |
Given some question info and some data about the the answers this function parses, organises and saves the question.
This is only used when IMPORTING questions and is only called from format.php Lifted from mod/quiz/lib.php -
object | $question | Contains question data like question, type and answers. |
object | $lesson | |
int | $contextid |
object | Returns $result->error or $result->notice. |
lesson_unseen_branch_jump | ( | $lesson, | |
$userid ) |
Handles the unseen branch table jump.
lesson | $lesson | |
int | $userid | User id. |
int | Will return the page id of a branch table or end of lesson |
lesson_unseen_question_jump | ( | $lesson, | |
$user, | |||
$pageid ) |
Interprets the LESSON_UNSEENBRANCHPAGE jump.
will return the pageid of a random unseen page that is within a branch
lesson | $lesson | |
int | $userid | Id of the user. |
int | $pageid | Id of the page from which we are jumping. |
int | Id of the next page. |
stdClass xmldb_lesson_upgrade | ( | $oldversion | ) |
$definitions |
$messageproviders |
Defines message providers (types of messages being sent)
const LESSON_THISPAGE 0 |
Include the files that are required by this module.
This page