Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
mod_label

Namespaces

namespace  mod_label\analytics\indicator
  
 
namespace  mod_label\completion
  
 
namespace  mod_label\navigation\views
  
 
namespace  mod_label\privacy
  
 
namespace  mod_label\search
  
 

Classes

class  backup_label_activity_structure_step
 Define all the backup steps that will be used by the backup_label_activity_task. More...
 
class  backup_label_activity_task
 Provides the steps to perform one complete backup of the Label instance. More...
 
class  mod_label\analytics\indicator\activity_base
 Activity base class. More...
 
class  mod_label\analytics\indicator\cognitive_depth
 Cognitive depth indicator - label. More...
 
class  mod_label\analytics\indicator\social_breadth
 Social breadth indicator - label. More...
 
class  mod_label\completion\custom_completion
 
class  mod_label\navigation\views\secondary
 
class  mod_label\privacy\provider
 The mod_label module does not store any data. More...
 
class  mod_label\search\activity
 Search area for mod_label activities. More...
 
class  mod_label_external
 Label external functions. More...
 
class  mod_label_generator
 Label module data generator class. More...
 
class  mod_label_mod_form
 
class  moodle1_mod_label_handler
 Label conversion handler. More...
 
class  restore_label_activity_structure_step
 Define all the restore steps that will be used by the restore_url_activity_task. More...
 
class  restore_label_activity_task
 label restore task that provides all the settings and steps to perform one complete restore of the activity More...
 

Functions

 get_label_name ($label)
 @uses LABEL_MAX_NAME_LENGTH
 
object label_add_instance ($label)
 Given an object containing all the necessary data, (defined by the form in mod_form.php) this function will create a new instance and return the id number of the new instance.
 
 label_check_updates_since (cm_info $cm, $from, $filter=array())
 Check if the module has any update that affects the current user since a given time.
 
 label_cm_info_view (cm_info $cm)
 Sets the special label display on course page.
 
object label_delete_instance ($id)
 Given an ID of an instance of this module, this function will permanently delete the instance and any data that depends on it.
 
 label_dndupload_handle ($uploadinfo)
 Handle a file that has been uploaded.
 
 label_dndupload_register ()
 Register the ability to handle drag and drop file uploads.
 
 label_generate_resized_image (stored_file $file, $maxwidth, $maxheight)
 Resize the image, if required, then generate an img tag and, if required, a link to the full-size image.
 
object label_get_coursemodule_info ($coursemodule)
 Given a course_module object, this function returns any "extra" information that may be needed when printing this activity in a course listing.
 
 label_reset_userdata ($data)
 This function is used by the reset_course_userdata function in moodlelib.
 
 label_supports ($feature)
 @uses FEATURE_IDNUMBER @uses FEATURE_GROUPS @uses FEATURE_GROUPINGS @uses FEATURE_MOD_INTRO @uses FEATURE_COMPLETION_TRACKS_VIEWS @uses FEATURE_GRADE_HAS_GRADE @uses FEATURE_GRADE_OUTCOMES
 
object label_update_instance ($label)
 Given an object containing all the necessary data, (defined by the form in mod_form.php) this function will update an existing instance with new data.
 
 mod_label_core_calendar_provide_event_action (calendar_event $event, core_calendar\action_factory $factory, int $userid=0)
 This function receives a calendar event and returns the action associated with it, or null if there is none.
 
 xmldb_label_upgrade ($oldversion)
 

Variables

 $capabilities
 
 $functions
 
 $logs
 
 $plugin = 2024041600
 
$plugin component = 'mod_label'
 
$plugin cron = 0
 
const LABEL_MAX_NAME_LENGTH 50
 LABEL_MAX_NAME_LENGTH = 50.
 
$plugin version = 2024042200
 

Detailed Description

Function Documentation

◆ get_label_name()

get_label_name ( $label)

@uses LABEL_MAX_NAME_LENGTH

Parameters
object$label
Return values
string

◆ label_add_instance()

object label_add_instance ( $label)

Given an object containing all the necessary data, (defined by the form in mod_form.php) this function will create a new instance and return the id number of the new instance.

Parameters
object$label
Return values
bool|int

◆ label_check_updates_since()

label_check_updates_since ( cm_info $cm,
$from,
$filter = array() )

Check if the module has any update that affects the current user since a given time.

Parameters
cm_info$cmcourse module data
int$fromthe time to check updates from
array$filterif we need to check only specific updates
Return values
stdClassan object with the different type of areas indicating if they were updated or not
Since
Moodle 3.2

◆ label_cm_info_view()

label_cm_info_view ( cm_info $cm)

Sets the special label display on course page.

Parameters
cm_info$cmCourse-module object

◆ label_delete_instance()

object label_delete_instance ( $id)

Given an ID of an instance of this module, this function will permanently delete the instance and any data that depends on it.

Parameters
int$id
Return values
bool

◆ label_dndupload_handle()

label_dndupload_handle ( $uploadinfo)

Handle a file that has been uploaded.

Parameters
object$uploadinfodetails of the file / content that has been uploaded
Return values
intinstance id of the newly created mod

◆ label_dndupload_register()

label_dndupload_register ( )

Register the ability to handle drag and drop file uploads.

Return values
arraycontaining details of the files / types the mod can handle

◆ label_generate_resized_image()

label_generate_resized_image ( stored_file $file,
$maxwidth,
$maxheight )

Resize the image, if required, then generate an img tag and, if required, a link to the full-size image.

Parameters
stored_file$filethe image file to process
int$maxwidththe maximum width allowed for the image
int$maxheightthe maximum height allowed for the image
Return values
stringHTML fragment to add to the label

◆ label_get_coursemodule_info()

object label_get_coursemodule_info ( $coursemodule)

Given a course_module object, this function returns any "extra" information that may be needed when printing this activity in a course listing.

See get_array_of_activities() in course/lib.php

Parameters
object$coursemodule
Return values
cached_cm_info|null

◆ label_reset_userdata()

label_reset_userdata ( $data)

This function is used by the reset_course_userdata function in moodlelib.

Parameters
object$datathe data submitted from the reset course.
Return values
arraystatus array

◆ label_supports()

label_supports ( $feature)

@uses FEATURE_IDNUMBER @uses FEATURE_GROUPS @uses FEATURE_GROUPINGS @uses FEATURE_MOD_INTRO @uses FEATURE_COMPLETION_TRACKS_VIEWS @uses FEATURE_GRADE_HAS_GRADE @uses FEATURE_GRADE_OUTCOMES

Parameters
string$featureFEATURE_xx constant for requested feature
Return values
mixedTrue if module supports feature, false if not, null if doesn't know or string for the module purpose.

◆ label_update_instance()

object label_update_instance ( $label)

Given an object containing all the necessary data, (defined by the form in mod_form.php) this function will update an existing instance with new data.

Parameters
object$label
Return values
bool

◆ mod_label_core_calendar_provide_event_action()

mod_label_core_calendar_provide_event_action ( calendar_event $event,
core_calendar\action_factory $factory,
int $userid = 0 )

This function receives a calendar event and returns the action associated with it, or null if there is none.

This is used by block_myoverview in order to display the event appropriately. If null is returned then the event is not displayed on the block.

Parameters
calendar_event$event
core_calendar\action_factory$factory
int$useridUser id to use for all capability checks, etc. Set to 0 for current user (default).
Return values
core_calendar\local\event\entities\action_interface|null

Variable Documentation

◆ $capabilities

$capabilities
Initial value:
= array(
'mod/label:addinstance' => array(
'riskbitmask' => RISK_XSS,
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/course:manageactivities'
),
'mod/label:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'user' => CAP_ALLOW,
'guest' => CAP_ALLOW
)
),
)
const CONTEXT_COURSE
Course context level - one instances for each course.
Definition accesslib.php:128
const CAP_ALLOW
Allow permission, overrides CAP_PREVENT defined in parent contexts.
Definition accesslib.php:115
const RISK_XSS
Capability allows user to add scripted content - see
Definition accesslib.php:143
const CONTEXT_MODULE
Course module context level - one instance for each course module.
Definition accesslib.php:130

◆ $functions

$functions
Initial value:
= array(
'mod_label_get_labels_by_courses' => array(
'classname' => 'mod_label_external',
'methodname' => 'get_labels_by_courses',
'description' => 'Returns a list of labels in a provided list of courses, if no list is provided all labels that the user
can view will be returned.',
'type' => 'read',
'capabilities' => 'mod/label:view',
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
),
)
const MOODLE_OFFICIAL_MOBILE_SERVICE
Moodle mobile app service name.
Definition moodlelib.php:555

◆ $logs

$logs
Initial value:
= array(
array('module'=>'label', 'action'=>'add', 'mtable'=>'label', 'field'=>'name'),
array('module'=>'label', 'action'=>'update', 'mtable'=>'label', 'field'=>'name'),
)