mirrored from git://git.moodle.org/moodle.git
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved all mod.php functions from modules into lib.php, and
updated course/mod.php to use them there. No longer need module/mod.php
- Loading branch information
martin
committed
Aug 3, 2002
1 parent
8c3c848
commit 04eba58
Showing
12 changed files
with
355 additions
and
384 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
This directory contains all the learning modules. | ||
|
||
Standard components expected of each module: | ||
|
||
mod.html: a form to setup/update a module instance | ||
version.php: defines some meta-info and provides upgrading code | ||
icon.gif: a 16x16 icon for the module | ||
db/mysql.sql: an SQL dump of all the required db tables and data | ||
index.php: a page to list all instances in a course | ||
view.php: a page to view a particular instance | ||
lib.php: any/all functions defined by the module should be in here. | ||
constants should be defined using MODULENAME_xxxxxx | ||
functions should be defined using modulename_xxxxxx | ||
|
||
There are a number of standard functions: | ||
|
||
modulename_add_instance() | ||
modulename_update_instance() | ||
modulename_delete_instance() | ||
|
||
modulename_user_complete() | ||
modulename_user_outline() | ||
|
||
modulename_cron() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?PHP // $Id$ | ||
|
||
function assignment_add_instance($assignment) { | ||
// Given an object containing all the necessary data, | ||
// (defined by the form in mod.html) this function | ||
// will create a new instance and return the id number | ||
// of the new instance. | ||
|
||
$assignment->timemodified = time(); | ||
|
||
return insert_record("assignment", $assignment); | ||
} | ||
|
||
|
||
function assignment_update_instance($assignment) { | ||
// Given an object containing all the necessary data, | ||
// (defined by the form in mod.html) this function | ||
// will update an existing instance with new data. | ||
|
||
$assignment->timemodified = time(); | ||
$assignment->id = $assignment->instance; | ||
|
||
return update_record("assignment", $assignment); | ||
} | ||
|
||
|
||
function assignment_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. | ||
|
||
if (! $assignment = get_record("assignment", "id", "$id")) { | ||
return false; | ||
} | ||
|
||
$result = true; | ||
|
||
if (! delete_records("assignment_submissions", "assignment", "$assignment->id")) { | ||
$result = false; | ||
} | ||
|
||
if (! delete_records("assignment", "id", "$assignment->id")) { | ||
$result = false; | ||
} | ||
|
||
return $result; | ||
} | ||
|
||
|
||
?> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.