Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
0  mod/assignment/lib.php
No changes.
35 mod/assignment/mod.html
... ... @@ -0,0 +1,35 @@
  1 +<form name="form" method="post" action="<?=$ME ?>">
  2 +<table cellpadding=5>
  3 +<tr valign=top>
  4 + <td align=right><P><B>Assignment Name:</B></P></TD>
  5 + <td>
  6 + <input type="text" name="name" size=30 value="<? p($form->name) ?>">
  7 + </td>
  8 +</tr>
  9 +<tr valign=top>
  10 + <td align=right><P><B>Description:</B></P></TD>
  11 + <td>
  12 + <textarea name="description" rows=15 cols=30 wrap="virtual"><? p($form->description) ?></textarea>
  13 + </td>
  14 +</tr>
  15 +<tr valign=top>
  16 + <td align=right><P><B>Due date:</B></td>
  17 + <td><?
  18 + print_date_selector("dueday", "duemonth", "dueyear", $form->dueday, $form->duemonth, $form->dueyear);
  19 + echo "-";
  20 + print_time_selector("duehour", "dueminute", $form->duehour, $form->dueminute);
  21 + formerr($err["duedate"]);
  22 + ?></td>
  23 +</tr>
  24 +</table>
  25 +<CENTER>
  26 +<input type="hidden" name=course value="<? p($form->course) ?>">
  27 +<input type="hidden" name=coursemodule value="<? p($form->coursemodule) ?>">
  28 +<input type="hidden" name=section value="<? p($form->section) ?>">
  29 +<input type="hidden" name=module value="<? p($form->module) ?>">
  30 +<input type="hidden" name=modulename value="<? p($form->modulename) ?>">
  31 +<input type="hidden" name=instance value="<? p($form->instance) ?>">
  32 +<input type="hidden" name=mode value="<? p($form->mode) ?>">
  33 +<input type="submit" value="Save these settings">
  34 +</CENTER>
  35 +</FORM>
59 mod/assignment/mod.php
... ... @@ -0,0 +1,59 @@
  1 +<?PHP // $Id$
  2 +
  3 +/////////////////////////////////////////////////////////////
  4 +//
  5 +// MOD.PHP - contains functions to add, update and delete
  6 +// an instance of this module
  7 +//
  8 +// Generally called from /course/mod.php
  9 +//
  10 +/////////////////////////////////////////////////////////////
  11 +
  12 +function add_instance($assignment) {
  13 +// Given an object containing all the necessary data,
  14 +// (defined by the form in mod.html) this function
  15 +// will create a new instance and return the id number
  16 +// of the new instance.
  17 +
  18 + $assignment->timemodified = time();
  19 +
  20 + return insert_record("assignment", $assignment);
  21 +}
  22 +
  23 +
  24 +function update_instance($assignment) {
  25 +// Given an object containing all the necessary data,
  26 +// (defined by the form in mod.html) this function
  27 +// will update an existing instance with new data.
  28 +
  29 + $assignment->timemodified = time();
  30 + $assignment->id = $assignment->instance;
  31 +
  32 + return update_record("assignment", $assignment);
  33 +}
  34 +
  35 +
  36 +function delete_instance($id) {
  37 +// Given an ID of an instance of this module,
  38 +// this function will permanently delete the instance
  39 +// and any data that depends on it.
  40 +
  41 + if (! $assignment = get_record("assignment", "id", "$id")) {
  42 + return false;
  43 + }
  44 +
  45 + $result = true;
  46 +
  47 + if (! delete_records("assignment_submissions", "assignment", "$assignment->id")) {
  48 + $result = false;
  49 + }
  50 +
  51 + if (! delete_records("assignment", "id", "$assignment->id")) {
  52 + $result = false;
  53 + }
  54 +
  55 + return $result;
  56 +}
  57 +
  58 +
  59 +?>

0 comments on commit 2199955

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