$msg .= get_string('instance_deleted', 'referentiel') . ' ' . $that_instance->name; } } } // Supprimer l'instance if (!referentiel_delete_instance($that_instance->id)) { $record_course = $DB->get_record('course', array('id' => $that_instance->course)); $msg .= "<br />" . get_string('instance', 'referentiel') . " {$that_instance->name} (#{$that_instance->id}) " . get_string('course') . " {$record_course->fullname} ({$record_course->shortname}) " . get_string('not_deleted', 'referentiel') . "\n"; } } } } } } else { // cette 'instance' n'existe dans aucun module, c'est juste un fantome, on peut la detruire if (!referentiel_delete_instance($val)) { $record_instance = referentiel_get_referentiel($val); $record_course = $DB->get_record('course', array('id' => $record_instance->course)); $msg .= "<br />" . get_string('instance', 'referentiel') . " {$record_instance->name} (#{$record_instance->id}) " . get_string('course') . " {$record_course->fullname} ({$record_course->shortname}) " . get_string('not_deleted', 'referentiel') . "\n"; } } } } } if (!empty($form->referentiel_id)) { $records_instance = referentiel_referentiel_list_of_instance($form->referentiel_id); if ($records_instance) { foreach ($records_instance as $r_instance) { $record_instance = referentiel_get_referentiel($r_instance->id); $record_course = $DB->get_record('course', array('id' => $record_instance->course)); $msg .= "<br />" . get_string('instance', 'referentiel') . " {$record_instance->name} (#{$record_instance->id}) " . get_string('course') . " {$record_course->fullname} ({$record_course->shortname}) " . get_string('not_deleted', 'referentiel') . "\n";
/** * This function is used by the reset_course_userdata function in moodlelib. * This function will remove clean up any related data. * * @global object * @global object * @param $data the data submitted from the reset course. * @return array status array */ function referentiel_reset_userdata($data) { global $CFG, $DB; // DEBUG // echo "<br />DEBUG :: lib.php :: 2076<br />\n"; // print_object($data); // exit; $componentstr = get_string('modulenameplural', 'referentiel'); $status = array(); $strstatus = ''; if ($data->reset_referentiel_declaration) { if ($instances = $DB->get_records('referentiel', array('course' => $data->courseid))) { foreach ($instances as $instance) { referentiel_delete_instance($instance->id, false); $strstatus .= $instance->name . ", "; } $status[] = array('component' => $componentstr, 'item' => $strstatus, 'error' => false); } } return $status; }
/** * * */ function referentiel_instance_suppression($id, $base_url) { // suppression du référentiel_referentiel global $SITE; global $CFG; global $base_url; // print_object($SITE); // exit; $ok = referentiel_delete_instance($id); if ($ok) { $msg = get_string('deleteinstance', 'referentiel') . ' ' . $id; add_to_log($SITE->id, "referentiel", "delete", "{$base_url}/delete.php?i=" . $id, $msg); } return $ok; }
/** * * */ function referentiel_instance_suppression($id, $base_url) { // occurrence suppression global $SITE; global $CFG; global $base_url; // print_object($SITE); // exit; $ok = referentiel_delete_instance($id); return $ok; }