[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/mod/workshop/ -> lib.php (summary)

Library of workshop module functions needed by Moodle core and other subsystems All the functions neeeded by Moodle core, gradebook, file subsystem etc are placed here.

Copyright: 2009 David Mudrak <david.mudrak@gmail.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 1842 lines (80 kb)
Included or required: 8 times
Referenced: 0 times
Includes or requires: 2 files
 mod/workshop/locallib.php
 mod/workshop/lib.php

Defines 28 functions

  workshop_supports()
  workshop_add_instance()
  workshop_update_instance()
  workshop_delete_instance()
  workshop_get_view_actions()
  workshop_get_post_actions()
  workshop_user_outline()
  workshop_user_complete()
  workshop_print_recent_activity()
  workshop_get_recent_mod_activity()
  workshop_print_recent_mod_activity()
  workshop_cron()
  workshop_scale_used()
  workshop_scale_used_anywhere()
  workshop_get_extra_capabilities()
  workshop_grade_item_update()
  workshop_update_grades()
  workshop_grade_item_category_update()
  workshop_get_file_areas()
  workshop_pluginfile()
  workshop_get_file_info()
  workshop_extend_navigation()
  workshop_extend_settings_navigation()
  workshop_page_type_list()
  workshop_calendar_update()
  workshop_reset_course_form_definition()
  workshop_reset_course_form_defaults()
  workshop_reset_userdata()

Functions
Functions that are not part of a class:

workshop_supports($feature)   X-Ref
Returns the information if the module supports a feature

param: string $feature FEATURE_xx constant for requested feature
return: mixed true if the feature is supported, null if unknown

workshop_add_instance(stdclass $workshop)   X-Ref
Saves a new instance of the workshop into the database

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

param: stdClass $workshop An object from the form in mod_form.php
return: int The id of the newly inserted workshop record

workshop_update_instance(stdclass $workshop)   X-Ref
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.

param: stdClass $workshop An object from the form in mod_form.php
return: bool success

workshop_delete_instance($id)   X-Ref
Given an ID of an instance of this module,
this function will permanently delete the instance
and any data that depends on it.

param: int $id Id of the module instance
return: boolean Success/Failure

workshop_get_view_actions()   X-Ref
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: array

workshop_get_post_actions()   X-Ref
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: array

workshop_user_outline($course, $user, $mod, $workshop)   X-Ref
Return a small object with summary information about what a
user has done with a given particular instance of this module
Used for user activity reports.
$return->time = the time they did it
$return->info = a short text description

param: stdClass $course The course record.
param: stdClass $user The user record.
param: cm_info|stdClass $mod The course module info object or record.
param: stdClass $workshop The workshop instance record.
return: stdclass|null

workshop_user_complete($course, $user, $mod, $workshop)   X-Ref
Print a detailed representation of what a user has done with
a given particular instance of this module, for user activity reports.

param: stdClass $course The course record.
param: stdClass $user The user record.
param: cm_info|stdClass $mod The course module info object or record.
param: stdClass $workshop The workshop instance record.
return: string HTML

workshop_print_recent_activity($course, $viewfullnames, $timestart)   X-Ref
Given a course and a time, this module should find recent activity
that has occurred in workshop activities and print it out.
Return true if there was output, or false is there was none.

param: stdClass $course
param: bool $viewfullnames
param: int $timestart
return: boolean

workshop_get_recent_mod_activity(&$activities, &$index, $timestart, $courseid, $cmid, $userid=0, $groupid=0)   X-Ref
Returns all activity in course workshops since a given time

param: array $activities sequentially indexed array of objects
param: int $index
param: int $timestart
param: int $courseid
param: int $cmid
param: int $userid defaults to 0
param: int $groupid defaults to 0
return: void adds items into $activities and increases $index

workshop_print_recent_mod_activity($activity, $courseid, $detail, $modnames, $viewfullnames)   X-Ref
Print single activity item prepared by {@see workshop_get_recent_mod_activity()}


workshop_cron()   X-Ref
Regular jobs to execute via cron

return: boolean true on success, false otherwise

workshop_scale_used($workshopid, $scaleid)   X-Ref
Is a given scale used by the instance of workshop?

The function asks all installed grading strategy subplugins. The workshop
core itself does not use scales. Both grade for submission and grade for
assessments do not use scales.

param: int $workshopid id of workshop instance
param: int $scaleid id of the scale to check
return: bool

workshop_scale_used_anywhere($scaleid)   X-Ref
Is a given scale used by any instance of workshop?

The function asks all installed grading strategy subplugins. The workshop
core itself does not use scales. Both grade for submission and grade for
assessments do not use scales.

param: int $scaleid id of the scale to check
return: bool

workshop_get_extra_capabilities()   X-Ref
Returns all other caps used in the module

return: array

workshop_grade_item_update(stdclass $workshop, $submissiongrades=null, $assessmentgrades=null)   X-Ref
Creates or updates grade items for the give workshop instance

Needed by grade_update_mod_grades() in lib/gradelib.php. Also used by
{@link workshop_update_grades()}.

param: stdClass $workshop instance object with extra cmidnumber property
param: stdClass $submissiongrades data for the first grade item
param: stdClass $assessmentgrades data for the second grade item
return: void

workshop_update_grades(stdclass $workshop, $userid=0)   X-Ref
Update workshop grades in the gradebook

Needed by grade_update_mod_grades() in lib/gradelib.php

param: stdClass $workshop instance object with extra cmidnumber and modname property
param: int $userid        update grade of specific user only, 0 means all participants
return: void

workshop_grade_item_category_update($workshop)   X-Ref
Update the grade items categories if they are changed via mod_form.php

We must do it manually here in the workshop module because modedit supports only
single grade item while we use two.

param: stdClass $workshop An object from the form in mod_form.php

workshop_get_file_areas($course, $cm, $context)   X-Ref
Returns the lists of all browsable file areas within the given module context

The file area workshop_intro for the activity introduction field is added automatically
by {@link file_browser::get_file_info_context_module()}

param: stdClass $course
param: stdClass $cm
param: stdClass $context
return: array of [(string)filearea] => (string)description

workshop_pluginfile($course, $cm, $context, $filearea, array $args, $forcedownload, array $options=array()   X-Ref
Serves the files from the workshop file areas

Apart from module intro (handled by pluginfile.php automatically), workshop files may be
media inserted into submission content (like images) and submission attachments. For these two,
the fileareas submission_content and submission_attachment are used.
Besides that, areas instructauthors, instructreviewers and conclusion contain the media
embedded using the mod_form.php.

param: stdClass $course the course object
param: stdClass $cm the course module object
param: stdClass $context the workshop's context
param: string $filearea the name of the file area
param: array $args extra arguments (itemid, path)
param: bool $forcedownload whether or not force download
param: array $options additional options affecting the file serving
return: bool false if the file not found, just send the file otherwise and do not return anything

workshop_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename)   X-Ref
File browsing support for workshop file areas

param: file_browser $browser
param: array $areas
param: stdClass $course
param: stdClass $cm
param: stdClass $context
param: string $filearea
param: int $itemid
param: string $filepath
param: string $filename
return: file_info instance or null if not found

workshop_extend_navigation(navigation_node $navref, stdclass $course, stdclass $module, cm_info $cm)   X-Ref
Extends the global navigation tree by adding workshop nodes if there is a relevant content

This can be called by an AJAX request so do not rely on $PAGE as it might not be set up properly.

param: navigation_node $navref An object representing the navigation tree node of the workshop module instance
param: stdClass $course
param: stdClass $module
param: cm_info $cm

workshop_extend_settings_navigation(settings_navigation $settingsnav, navigation_node $workshopnode=null)   X-Ref
Extends the settings navigation with the Workshop settings
This function is called when the context for the page is a workshop module. This is not called by AJAX
so it is safe to rely on the $PAGE.

param: settings_navigation $settingsnav {@link settings_navigation}
param: navigation_node $workshopnode {@link navigation_node}

workshop_page_type_list($pagetype, $parentcontext, $currentcontext)   X-Ref
Return a list of page types

param: string $pagetype current page type
param: stdClass $parentcontext Block's parent context
param: stdClass $currentcontext Current context of block

workshop_calendar_update(stdClass $workshop, $cmid)   X-Ref
Updates the calendar events associated to the given workshop

param: stdClass $workshop the workshop instance record
param: int $cmid course module id

workshop_reset_course_form_definition($mform)   X-Ref
Extends the course reset form with workshop specific settings.

param: MoodleQuickForm $mform

workshop_reset_course_form_defaults(stdClass $course)   X-Ref
Provides default values for the workshop settings in the course reset form.

param: stdClass $course The course to be reset.

workshop_reset_userdata(stdClass $data)   X-Ref
Performs the reset of all workshop instances in the course.

param: stdClass $data The actual course reset settings.
return: array List of results, each being array[(string)component, (string)item, (string)error]



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1