mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
MDL-24091 workshop: deleting subplugins data together with the workshop instance
This commit is contained in:
parent
8b6f4e6626
commit
346af1a431
12 changed files with 153 additions and 5 deletions
|
@ -356,6 +356,19 @@ class workshop_accumulative_strategy implements workshop_strategy {
|
|||
return $DB->record_exists('workshopform_accumulative', $conditions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all data related to a given workshop module instance
|
||||
*
|
||||
* @see workshop_delete_instance()
|
||||
* @param int $workshopid id of the workshop module instance being deleted
|
||||
* @return void
|
||||
*/
|
||||
public static function delete_instance($workshopid) {
|
||||
global $DB;
|
||||
|
||||
$DB->delete_records('workshopform_accumulative', array('workshopid' => $workshopid));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Internal methods //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -341,6 +341,19 @@ class workshop_comments_strategy implements workshop_strategy {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all data related to a given workshop module instance
|
||||
*
|
||||
* @see workshop_delete_instance()
|
||||
* @param int $workshopid id of the workshop module instance being deleted
|
||||
* @return void
|
||||
*/
|
||||
public static function delete_instance($workshopid) {
|
||||
global $DB;
|
||||
|
||||
$DB->delete_records('workshopform_comments', array('workshopid' => $workshopid));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Internal methods //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -115,4 +115,14 @@ interface workshop_strategy {
|
|||
* @return bool
|
||||
*/
|
||||
public static function scale_used($scaleid, $workshopid=null);
|
||||
|
||||
/**
|
||||
* Delete all data related to a given workshop module instance
|
||||
*
|
||||
* This is called from {@link workshop_delete_instance()}.
|
||||
*
|
||||
* @param int $workshopid id of the workshop module instance being deleted
|
||||
* @return void
|
||||
*/
|
||||
public static function delete_instance($workshopid);
|
||||
}
|
||||
|
|
|
@ -373,6 +373,20 @@ class workshop_numerrors_strategy implements workshop_strategy {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all data related to a given workshop module instance
|
||||
*
|
||||
* @see workshop_delete_instance()
|
||||
* @param int $workshopid id of the workshop module instance being deleted
|
||||
* @return void
|
||||
*/
|
||||
public static function delete_instance($workshopid) {
|
||||
global $DB;
|
||||
|
||||
$DB->delete_records('workshopform_numerrors', array('workshopid' => $workshopid));
|
||||
$DB->delete_records('workshopform_numerrors_map', array('workshopid' => $workshopid));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Internal methods //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -386,6 +386,22 @@ class workshop_rubric_strategy implements workshop_strategy {
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all data related to a given workshop module instance
|
||||
*
|
||||
* @see workshop_delete_instance()
|
||||
* @param int $workshopid id of the workshop module instance being deleted
|
||||
* @return void
|
||||
*/
|
||||
public static function delete_instance($workshopid) {
|
||||
global $DB;
|
||||
|
||||
$dimensions = $DB->get_records('workshopform_rubric', array('workshopid' => $workshopid), '', 'id');
|
||||
$DB->delete_records_list('workshopform_rubric_levels', 'dimensionid', array_keys($dimensions));
|
||||
$DB->delete_records('workshopform_rubric', array('workshopid' => $workshopid));
|
||||
$DB->delete_records('workshopform_rubric_config', array('workshopid' => $workshopid));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Internal methods //
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue