/** * Create a new program type assignment activity * * 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. * The due data is added to the calendar * Tests are added to assignment_oj_tests table * * @param object $assignment The data from the form on mod.html * @return int The id of the assignment */ function add_instance($assignment) { // Add assignment instance $assignment->id = parent::add_instance($assignment); if ($assignment->id) { $this->after_add_update($assignment); } return $assignment->id; }