Moodle PHP Documentation 4.1
Moodle 4.1dev (Build: 20220512) (5e5e12e0)
Namespaces | Classes | Functions | Variables
mod_url

Namespaces

namespace  mod_url\analytics\indicator
  
 
namespace  mod_url\completion
  
 
namespace  mod_url\event
  
 
namespace  mod_url\privacy
  
 
namespace  mod_url\search
  
 

Classes

class  backup_url_activity_structure_step
 Define the complete url structure for backup, with file and id annotations. More...
 
class  backup_url_activity_task
 Provides all the settings and steps to perform one complete backup of the activity. More...
 
class  mod_url\analytics\indicator\activity_base
 Activity base class. More...
 
class  mod_url\analytics\indicator\cognitive_depth
 Cognitive depth indicator - url. More...
 
class  mod_url\analytics\indicator\social_breadth
 Social breadth indicator - url. More...
 
class  mod_url\completion\custom_completion
 
class  mod_url\event\course_module_instance_list_viewed
 The mod_url instance list viewed event class. More...
 
class  mod_url\event\course_module_viewed
 The mod_url course module viewed event class. More...
 
class  mod_url\privacy\provider
 The mod_url module does not store any data. More...
 
class  mod_url\search\activity
 Search area for mod_url activities. More...
 
class  mod_url_external
 
class  mod_url_generator
 
class  mod_url_mod_form
 
class  moodle1_mod_url_handler
 URL conversion handler. More...
 
class  restore_url_activity_structure_step
 Define all the restore steps that will be used by the restore_url_activity_task. More...
 
class  restore_url_activity_task
 url restore task that provides all the settings and steps to perform one complete restore of the activity More...
 

Functions

 mod_url_core_calendar_provide_event_action (calendar_event $event, core_calendar\action_factory $factory, $userid=0)
 This function receives a calendar event and returns the action associated with it, or null if there is none. More...
 
 url_add_instance ($data, $mform)
 Add url instance. More...
 
 url_appears_valid_url ($url)
 This methods does weak url validation, we are looking for major problems only, no strict RFE validation. More...
 
 url_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. More...
 
 url_delete_instance ($id)
 Delete url instance. More...
 
 url_display_embed ($url, $cm, $course)
 Display embedded url file. More...
 
 url_display_frame ($url, $cm, $course)
 Display url frames. More...
 
 url_dndupload_handle ($uploadinfo)
 Handle a file that has been uploaded. More...
 
 url_dndupload_register ()
 Register the ability to handle drag and drop file uploads. More...
 
 url_export_contents ($cm, $baseurl)
 Export URL resource contents. More...
 
 url_filter_callback ($matches)
 Unicode encoding helper callback.
 
 url_fix_submitted_url ($url)
 Fix common URL problems that we want teachers to see fixed the next time they edit the resource. More...
 
 url_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. More...
 
 url_get_encrypted_parameter ($url, $config)
 BC internal function. More...
 
 url_get_final_display_type ($url)
 Decide the best display format. More...
 
 url_get_full_url ($url, $cm, $course, $config=null)
 Return full url with all extra parameters. More...
 
 url_get_intro (object $url, object $cm, bool $ignoresettings=false)
 Get url introduction. More...
 
 url_get_post_actions ()
 List the actions that correspond to a post of this module. More...
 
 url_get_variable_options ($config)
 Get the parameters that may be appended to URL. More...
 
 url_get_variable_values ($url, $cm, $course, $config)
 Get the parameter values that may be appended to URL. More...
 
 url_get_view_actions ()
 List the actions that correspond to a view of this module. More...
 
 url_guess_icon ($fullurl, $size=null)
 Optimised mimetype detection from general URL. More...
 
 url_page_type_list ($pagetype, $parentcontext, $currentcontext)
 Return a list of page types. More...
 
 url_print_header ($url, $cm, $course)
 Print url header. More...
 
 url_print_heading ($url, $cm, $course, $notused=false)
 Print url heading. More...
 
 url_print_intro ($url, $cm, $course, $ignoresettings=false)
 Print url introduction. More...
 
 url_print_workaround ($url, $cm, $course)
 Print url info and link. More...
 
 url_reset_userdata ($data)
 This function is used by the reset_course_userdata function in moodlelib. More...
 
 url_supports ($feature)
 List of features supported in URL module. More...
 
 url_update_instance ($data, $mform)
 Update url instance. More...
 
 url_view ($url, $course, $cm, $context)
 Mark the activity completed (if required) and trigger the course_module_viewed event. More...
 
 xmldb_url_install ()
 
 xmldb_url_upgrade ($oldversion)
 

Variables

 $capabilities
 
 $functions
 
 $logs
 
 $plugin = 2022041200
 
$plugin component = 'mod_url'
 
$plugin cron = 0
 
$plugin version = 2022041900
 

Detailed Description

Function Documentation

◆ mod_url_core_calendar_provide_event_action()

mod_url_core_calendar_provide_event_action ( calendar_event  $event,
core_calendar\action_factory  $factory,
  $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$useridID override for calendar events
Return values
core_calendar::local::event::entities::action_interface|null

◆ url_add_instance()

url_add_instance (   $data,
  $mform 
)

Add url instance.

Parameters
object$data
object$mform
Return values
intnew url instance id

◆ url_appears_valid_url()

url_appears_valid_url (   $url)

This methods does weak url validation, we are looking for major problems only, no strict RFE validation.

Parameters
$url
Return values
booltrue is seems valid, false if definitely not valid URL

◆ url_check_updates_since()

url_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

◆ url_delete_instance()

url_delete_instance (   $id)

Delete url instance.

Parameters
int$id
Return values
booltrue

◆ url_display_embed()

url_display_embed (   $url,
  $cm,
  $course 
)

Display embedded url file.

Parameters
object$url
object$cm
object$course
Return values
doesnot return

◆ url_display_frame()

url_display_frame (   $url,
  $cm,
  $course 
)

Display url frames.

Parameters
object$url
object$cm
object$course
Return values
doesnot return

◆ url_dndupload_handle()

url_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

◆ url_dndupload_register()

url_dndupload_register ( )

Register the ability to handle drag and drop file uploads.

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

◆ url_export_contents()

url_export_contents (   $cm,
  $baseurl 
)

Export URL resource contents.

Return values
arrayof file content

◆ url_fix_submitted_url()

url_fix_submitted_url (   $url)

Fix common URL problems that we want teachers to see fixed the next time they edit the resource.

This function does not include any XSS protection.

Parameters
string$url
Return values
string

◆ url_get_coursemodule_info()

url_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 course_modinfo::get_array_of_activities()

Parameters
object$coursemodule
Return values
cached_cm_infoinfo

◆ url_get_encrypted_parameter()

url_get_encrypted_parameter (   $url,
  $config 
)

BC internal function.

Parameters
object$url
object$config
Return values
string

◆ url_get_final_display_type()

url_get_final_display_type (   $url)

Decide the best display format.

Parameters
object$url
Return values
intdisplay type constant

◆ url_get_full_url()

url_get_full_url (   $url,
  $cm,
  $course,
  $config = null 
)

Return full url with all extra parameters.

This function does not include any XSS protection.

Parameters
string$url
object$cm
object$course
object$config
Return values
stringurl with & encoded as &

◆ url_get_intro()

url_get_intro ( object  $url,
object  $cm,
bool  $ignoresettings = false 
)

Get url introduction.

Parameters
object$url
object$cm
bool$ignoresettingsprint even if not specified in modedit
Return values
string

◆ url_get_post_actions()

url_get_post_actions ( )

List the actions that correspond to a post of this module.

This is used by the participation report.

Note: This is not used by new logging system. Event with crud = ('c' || 'u' || 'd') and edulevel = LEVEL_PARTICIPATING will be considered as post action.

Return values
array

◆ url_get_variable_options()

url_get_variable_options (   $config)

Get the parameters that may be appended to URL.

Parameters
object$configurl module config options
Return values
arrayarray describing opt groups

◆ url_get_variable_values()

url_get_variable_values (   $url,
  $cm,
  $course,
  $config 
)

Get the parameter values that may be appended to URL.

Parameters
object$urlmodule instance
object$cm
object$course
object$configmodule config options
Return values
arrayof parameter values

◆ url_get_view_actions()

url_get_view_actions ( )

List the actions that correspond to a view of this module.

This is used by the participation report.

Note: This is not used by new logging system. Event with crud = 'r' and edulevel = LEVEL_PARTICIPATING will be considered as view action.

Return values
array

◆ url_guess_icon()

url_guess_icon (   $fullurl,
  $size = null 
)

Optimised mimetype detection from general URL.

Parameters
$fullurl
int$sizeof the icon.
Return values
string|nullmimetype or null when the filetype is not relevant.

◆ url_page_type_list()

url_page_type_list (   $pagetype,
  $parentcontext,
  $currentcontext 
)

Return a list of page types.

Parameters
string$pagetypecurrent page type
stdClass$parentcontextBlock's parent context
stdClass$currentcontextCurrent context of block

◆ url_print_header()

url_print_header (   $url,
  $cm,
  $course 
)

Print url header.

Parameters
object$url
object$cm
object$course
Return values
void

◆ url_print_heading()

url_print_heading (   $url,
  $cm,
  $course,
  $notused = false 
)

Print url heading.

Deprecated:
since 4.0
Parameters
object$url
object$cm
object$course
bool$notusedThis variable is no longer used.
Return values
void

◆ url_print_intro()

url_print_intro (   $url,
  $cm,
  $course,
  $ignoresettings = false 
)

Print url introduction.

Deprecated:
since 4.0
Parameters
object$url
object$cm
object$course
bool$ignoresettingsprint even if not specified in modedit
Return values
void

◆ url_print_workaround()

url_print_workaround (   $url,
  $cm,
  $course 
)

Print url info and link.

Parameters
object$url
object$cm
object$course
Return values
doesnot return

◆ url_reset_userdata()

url_reset_userdata (   $data)

This function is used by the reset_course_userdata function in moodlelib.

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

◆ url_supports()

url_supports (   $feature)

List of features supported in URL module.

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.

◆ url_update_instance()

url_update_instance (   $data,
  $mform 
)

Update url instance.

Parameters
object$data
object$mform
Return values
booltrue

◆ url_view()

url_view (   $url,
  $course,
  $cm,
  $context 
)

Mark the activity completed (if required) and trigger the course_module_viewed event.

Parameters
stdClass$urlurl object
stdClass$coursecourse object
stdClass$cmcourse module object
stdClass$contextcontext object
Since
Moodle 3.0

Variable Documentation

◆ $capabilities

$capabilities
Initial value:
= array(
'mod/url:view' => array(
'captype' => 'read',
'contextlevel' => CONTEXT_MODULE,
'archetypes' => array(
'guest' => CAP_ALLOW,
'user' => CAP_ALLOW,
)
),
'mod/url:addinstance' => array(
'riskbitmask' => RISK_XSS,
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
'clonepermissionsfrom' => 'moodle/course:manageactivities'
),
)
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_url_view_url' => array(
'classname' => 'mod_url_external',
'methodname' => 'view_url',
'description' => 'Trigger the course module viewed event and update the module completion status.',
'type' => 'write',
'capabilities' => 'mod/url:view',
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE)
),
'mod_url_get_urls_by_courses' => array(
'classname' => 'mod_url_external',
'methodname' => 'get_urls_by_courses',
'description' => 'Returns a list of urls in a provided list of courses, if no list is provided all urls that the user
can view will be returned.',
'type' => 'read',
'capabilities' => 'mod/url:view',
'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
),
)
const MOODLE_OFFICIAL_MOBILE_SERVICE
Moodle mobile app service name.
Definition: moodlelib.php:527

◆ $logs

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