} } if ($action_on_element == 'gsg') { foreach ($value as $del_check_id) { $subgroupChecksDAO->deleteChecksByTypeAndID('subgroup', $action_on_id, substr($del_check_id, strlen($value_prefix) + 1)); } } } } } } } // remove groups and subgroups if ($_GET['action'] == 'remove') { if (isset($_GET['gsg'])) { $guidelineSubgroupsDAO->Delete($_GET['gsg']); } if (isset($_GET['gg'])) { $guidelineGroupsDAO->Delete($_GET['gg']); } header('Location: create_edit_guideline.php?id=' . $gid); exit; } // interface display if (!isset($gid)) { // create guideline $checksDAO = new ChecksDAO(); $savant->assign('author', $_current_user->getUserName()); } else { // edit existing guideline $checksDAO = new ChecksDAO();
/** * Delete all entries of given group ID * @access public * @param $groupID : group id * @return true : if successful * false : if not successful * @author Cindy Qi Li */ public function Delete($groupID) { require_once AC_INCLUDE_PATH . 'classes/DAO/GuidelineSubgroupsDAO.class.php'; $groupID = intval($groupID); // Delete all subgroups $guidelineSubgroupsDAO = new GuidelineSubgroupsDAO(); $sql = "SELECT subgroup_id FROM " . TABLE_PREFIX . "guideline_subgroups\n\t\t WHERE group_id = " . $groupID; $rows = $this->execute($sql); if (is_array($rows)) { foreach ($rows as $row) { $guidelineSubgroupsDAO->Delete($row['subgroup_id']); } } // delete language for group name $sql = "DELETE FROM " . TABLE_PREFIX . "language_text \n\t\t WHERE variable='_guideline' \n\t\t AND term=(SELECT name \n\t\t FROM " . TABLE_PREFIX . "guideline_groups\n\t\t WHERE group_id=" . $groupID . ")"; $this->execute($sql); // delete guideline_groups $sql = "DELETE FROM " . TABLE_PREFIX . "guideline_groups WHERE group_id=" . $groupID; return $this->execute($sql); }