Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Some work so far on the assignment module ... NOT FINISHED YET!

I just want to get it out the way of some other commits
  • Loading branch information...
commit 21999551b17e25a81ed010e1da712562d3241a34 1 parent 1ea8303
martin authored
View
0  mod/assignment/lib.php
No changes.
View
35 mod/assignment/mod.html
@@ -0,0 +1,35 @@
+<form name="form" method="post" action="<?=$ME ?>">
+<table cellpadding=5>
+<tr valign=top>
+ <td align=right><P><B>Assignment Name:</B></P></TD>
+ <td>
+ <input type="text" name="name" size=30 value="<? p($form->name) ?>">
+ </td>
+</tr>
+<tr valign=top>
+ <td align=right><P><B>Description:</B></P></TD>
+ <td>
+ <textarea name="description" rows=15 cols=30 wrap="virtual"><? p($form->description) ?></textarea>
+ </td>
+</tr>
+<tr valign=top>
+ <td align=right><P><B>Due date:</B></td>
+ <td><?
+ print_date_selector("dueday", "duemonth", "dueyear", $form->dueday, $form->duemonth, $form->dueyear);
+ echo "-";
+ print_time_selector("duehour", "dueminute", $form->duehour, $form->dueminute);
+ formerr($err["duedate"]);
+ ?></td>
+</tr>
+</table>
+<CENTER>
+<input type="hidden" name=course value="<? p($form->course) ?>">
+<input type="hidden" name=coursemodule value="<? p($form->coursemodule) ?>">
+<input type="hidden" name=section value="<? p($form->section) ?>">
+<input type="hidden" name=module value="<? p($form->module) ?>">
+<input type="hidden" name=modulename value="<? p($form->modulename) ?>">
+<input type="hidden" name=instance value="<? p($form->instance) ?>">
+<input type="hidden" name=mode value="<? p($form->mode) ?>">
+<input type="submit" value="Save these settings">
+</CENTER>
+</FORM>
View
59 mod/assignment/mod.php
@@ -0,0 +1,59 @@
+<?PHP // $Id$
+
+/////////////////////////////////////////////////////////////
+//
+// MOD.PHP - contains functions to add, update and delete
+// an instance of this module
+//
+// Generally called from /course/mod.php
+//
+/////////////////////////////////////////////////////////////
+
+function 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 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 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;
+}
+
+
+?>

0 comments on commit 2199955

Please sign in to comment.
Something went wrong with that request. Please try again.