|
Moodle
2.2.1
http://www.collinsharper.com
|

| add_instance | ( | $ | assignment | ) |
Create a new assignment activity
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. The due data is added to the calendar This is common to all assignment types.
object object
| object | $assignment | The data from the form on mod_form.php |
Definition at line 463 of file lib.php.

| assignment_base | ( | $ | cmid = 'staticonly', |
| $ | assignment = NULL, |
||
| $ | cm = NULL, |
||
| $ | course = NULL |
||
| ) |
Constructor for the base assignment class
Constructor for the base assignment class. If cmid is set create the cm, course, assignment objects. If the assignment is hidden and the user is not a teacher then this prints a page header and notice.
object object
| int | $cmid | the current course module id - not set for new assignments |
| object | $assignment | usually null, but if we have it we pass it to save db access |
| object | $cm | usually null, but if we have it we pass it to save db access |
| object | $course | usually null, but if we have it we pass it to save db access |
Set up things for a HTML editor if it's needed
Definition at line 99 of file lib.php.


| static backup_one_mod | ( | $ | bf, |
| $ | preferences, | ||
| $ | assignment | ||
| ) | [static] |
| static backup_one_submission | ( | $ | bf, |
| $ | preferences, | ||
| $ | assignment, | ||
| $ | submission | ||
| ) | [static] |
base implementation for backing up subtype specific information for one single submission
| filehandle | $bf | file handle for xml file to write to |
| mixed | $preferences | the complete backup preference object |
| object | $submission | the assignment submission db record |
| count_real_submissions | ( | $ | groupid = 0 | ) |
Counts all real assignment submissions by ENROLLED students (not empty ones)
| int | $groupid | optional If nonzero then count is restricted to this group |
Definition at line 1888 of file lib.php.


| count_user_files | ( | $ | itemid | ) |
| cron | ( | ) |
| custom_feedbackform | ( | $ | submission, |
| $ | return = false |
||
| ) |
| delete | ( | ) |
Empty method stub for all delete actions.
Reimplemented in assignment_upload.
Definition at line 2218 of file lib.php.

| delete_instance | ( | $ | assignment | ) |
Return true if is set description is hidden till available date
This is needed by calendar so that hidden descriptions do not come up in upcoming events.
Check that description is hidden till available date By default return false Assignments types should implement this method if needed
Reimplemented in assignment_upload.
| display_grade | ( | $ | grade | ) |
| display_lateness | ( | $ | timesubmitted | ) |
Return a string indicating how late a submission is
| $timesubmitted | int |
Reimplemented in assignment_offline.
Definition at line 2211 of file lib.php.


| display_submission | ( | $ | offset = -1, |
| $ | userid = -1, |
||
| $ | display = true |
||
| ) |
Display a single submission, ready for grading on a popup window
This default method prints the teacher info and submissioncomment box at the top and the student info and submission at the bottom. This method also fetches the necessary data in order to be able to provide a "Next submission" button. Calls preprocess_submission() to give assignment type plug-ins a chance to process submissions before they are graded This method gets its arguments from the page parameters userid and offset
object object
| string | $extra_javascript |
construct SQL, using current offset to find the data of the next student
Get all ppl that can submit assignments
Definition at line 958 of file lib.php.


| display_submissions | ( | $ | message = '' | ) |
Display all the submissions ready for grading
object object object object
| string | $message |
Some shortcuts to make the code read better
Check to see if groups are being used in this assignment
find out current groups mode
Print quickgrade form around the table
Get all ppl that are allowed to submit assignments
Construct the SQL
offset used to calculate index of student in that particular query, needed for the pop up to know who's next
Prints student answer and student modified date attach file or print link to student answer, depending on the type of the assignment. Refer to print_student_answer in inherited classes.
Print grade, dropdown or text
Print Comment
Confirm we have exclusively 0 or 1
No more buttons, we use popups ;-).
Print the whole table
Print quickgrade form around the table
End of fast grading form
Mini form for setting user preference
Definition at line 1161 of file lib.php.


| email_teachers | ( | $ | submission | ) |
Alerts teachers by email of new or changed assignments that need grading
First checks whether the option to email teachers is set for this assignment. Sends an email to ALL teachers in the course (or in the group if using separate groups). Uses the methods email_teachers_text() and email_teachers_html() to construct the content.
object object
| $submission | object The submission that has changed |
Definition at line 1904 of file lib.php.


| email_teachers_html | ( | $ | info | ) |
| email_teachers_text | ( | $ | info | ) |
| form_data_preprocessing | ( | &$ | default_values, |
| $ | form | ||
| ) |
| form_validation | ( | $ | data, |
| $ | files | ||
| ) |
Any extra validation checks needed for the settings form for this assignment type
See lib/formslib.php, 'validation' function for details
| get_coursemodule_info | ( | $ | coursemodule | ) |
Add a get_coursemodule_info function in case any assignment type wants to add 'extra' information for the course (see resource).
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.
| $coursemodule | object The coursemodule object (record). |
| get_graders | ( | $ | user | ) |
| get_submission | ( | $ | userid = 0, |
| $ | createnew = false, |
||
| $ | teachermodified = false |
||
| ) |
Load the submission object for a particular user
object object
| $userid | int The id of the user whose submission we want or 0 in which case USER->id is used | |
| $createnew | boolean optional Defaults to false. If set to true a new submission object will be created in the database | |
| bool | $teachermodified | student submission set if false |
Definition at line 1809 of file lib.php.

| get_submissions | ( | $ | sort = '', |
| $ | dir = 'DESC' |
||
| ) |
Return all assignment submissions by ENROLLED students (even empty)
| string | $sort | optional field names for the ORDER BY in the sql query |
| string | $dir | optional specifying the sort direction, defaults to DESC |
Definition at line 1878 of file lib.php.


| is_submitted_with_required_data | ( | $ | submission | ) |
Check the given submission is complete. Preliminary rows are often created in the assignment_submissions table before a submission actually takes place. This function checks to see if the given submission has actually been submitted.
| stdClass | $submission | The submission we want to check for completion |
Reimplemented in assignment_upload, and assignment_uploadsingle.
Definition at line 1835 of file lib.php.

| isopen | ( | ) |
Reimplemented in assignment_upload, assignment_online, and assignment_uploadsingle.
| prepare_new_submission | ( | $ | userid, |
| $ | teachermodified = false |
||
| ) |
Instantiates a new submission object for a given user
Sets the assignment, userid and times, everything else is set to default values.
| int | $userid | The userid for which we want a submission object |
| bool | $teachermodified | student submission set if false |
Definition at line 1848 of file lib.php.

| preprocess_submission | ( | &$ | submission | ) |
Preprocess submission before grading
Called by display_submission() The default type does nothing here.
| object | $submission | The submission object |
Reimplemented in assignment_online.
Definition at line 1148 of file lib.php.

| print_user_files | ( | $ | userid = 0, |
| $ | return = false |
||
| ) |
Produces a list of links to the files uploaded by a user
| $userid | int optional id of the user. If 0 then $USER->id is used. |
| $return | boolean optional defaults to false. If true the list is returned rather than printed |
Reimplemented in assignment_upload, and assignment_online.
Definition at line 2047 of file lib.php.


| process_feedback | ( | $ | formdata = null | ) |
Process teacher feedback submission
This is called by submissions() when a grading even has taken place. It gets its data from the submitted form.
object object object
For save and next, we need to know the userid to save, and the userid to go We use a new hidden field in the form, and set it to -1. If it's set, we use this as the userid to store
Definition at line 1703 of file lib.php.


| process_outcomes | ( | $ | userid | ) |
| quickgrade_mode_allowed | ( | ) | [final] |
Checks if grading method allows quickgrade mode. At the moment it is hardcoded that advanced grading methods do not allow quickgrade.
Assignment type plugins are not allowed to override this method
Definition at line 803 of file lib.php.


| reset_userdata | ( | $ | data | ) |
| static restore_one_mod | ( | $ | info, |
| $ | restore, | ||
| $ | assignment | ||
| ) | [static] |
| static restore_one_submission | ( | $ | info, |
| $ | restore, | ||
| $ | assignment, | ||
| $ | submission | ||
| ) | [static] |
| send_file | ( | $ | filearea, |
| $ | args | ||
| ) |
| string | $filearea | |
| array | $args |
Reimplemented in assignment_upload, assignment_online, and assignment_uploadsingle.
Definition at line 1956 of file lib.php.

| setup_elements | ( | &$ | mform | ) |
Reimplemented in assignment_upload, assignment_online, and assignment_uploadsingle.
| submissions | ( | $ | mode | ) |
Top-level function for handling of submissions called by submissions.php
This is for handling the teacher interaction with the grading interface This should be suitable for most assignment types.
object
| string | $mode | Specifies the kind of teacher interaction taking place |
The main switch is changed to facilitate 1) Batch fast grading 2) Skip to the next one on the popup 3) Save and Skip to the next one on the popup
do the fast grading stuff - this process should work for all 3 subclasses
We are in pop up. save the current one and go to the next one.
We are currently in pop up, but we want to skip to next one without saving. This turns out to be similar to a single case The URL used is for the next submission.
Reimplemented in assignment_upload.
Definition at line 611 of file lib.php.

| submittedlink | ( | $ | allgroups = false | ) |
Returns a link with info about the state of the assignment submissions
This is used by view_header to put this link at the top right of the page. For teachers it gives the number of submitted assignments with a link For students it gives the time of their submission. This will be suitable for most assignment types.
object object
| bool | $allgroup | print all groups info if user can access all groups, suitable for index.php |
Definition at line 376 of file lib.php.

| update_grade | ( | $ | submission | ) |
| update_instance | ( | $ | assignment | ) |
Updates a new assignment activity
Given an object containing all the necessary data, (defined by the form in mod_form.php) this function will update the assignment instance and return the id number The due date is updated in the calendar This is common to all assignment types.
object object
| object | $assignment | The data from the form on mod_form.php |
Definition at line 549 of file lib.php.

| update_main_listing | ( | $ | submission | ) |
Helper method updating the listing on the main script from popup using javascript
object object
| $submission | object The submission whose data is to be updated on the main page |
Run some Javascript to try and update the parent page
Definition at line 819 of file lib.php.

| user_complete | ( | $ | user, |
| $ | grade = null |
||
| ) |
| user_outline | ( | $ | grade | ) |
| validate_and_preprocess_feedback | ( | ) | [protected] |
If the form was cancelled ('Cancel' or 'Next' was pressed), call cancel method from advanced grading (if applicable) and returns true If the form was submitted, validates it and returns false if validation did not pass. If validation passes, preprocess advanced grading (if applicable) and returns true.
Note to the developers: This is NOT the correct way to implement advanced grading in grading form. The assignment grading was written long time ago and unfortunately does not fully use the mforms. Usually function is_validated() is called to validate the form and get_data() is called to get the data from the form.
Here we have to push the calculated grade to $_POST['xgrade'] because further processing of the form gets the data not from form->get_data(), but from $_POST (using statement like $feedback = data_submitted() )
Definition at line 1655 of file lib.php.


| view | ( | ) |
Display the assignment, used by view.php
This in turn calls the methods producing individual parts of the page
Reimplemented in assignment_uploadsingle, assignment_upload, and assignment_online.
Definition at line 154 of file lib.php.

| view_dates | ( | ) |
Display the assignment dates
Prints the assignment start and end dates in a box. This will be suitable for most assignment types
Reimplemented in assignment_online.
Definition at line 223 of file lib.php.

| view_feedback | ( | $ | submission = NULL | ) |
Display the feedback to the student
This default method prints the teacher picture and name, date when marked, grade and teacher submissioncomment. If advanced grading is used the method render_grade from the advanced grading controller is called to display the grade.
object object object
| object | $submission | The submission object or NULL in which case it will be loaded |
Get submission for this assignment
Nothing to show yet
We need the teacher info
Print the feedback
Reimplemented in assignment_upload.
Definition at line 268 of file lib.php.


| view_footer | ( | ) |
| view_header | ( | $ | subpage = '' | ) |
Display the header and top of a page
(this doesn't change much for assignment types) This is used by the view() method to print the header of view.php but it can be used on other pages in which case the string to denote the page in the navigation trail should be passed as an argument
object
| string | $subpage | Description of subpage to be used in navigation trail |
Definition at line 184 of file lib.php.


| view_intro | ( | ) |
| const FILTER_ALL = 0 |
| const FILTER_REQUIRE_GRADING = 2 |
| const FILTER_SUBMITTED = 1 |