18 $res = $ilDB->queryF(
'
19 SELECT cmi_node.cmi_node_id
20 FROM cmi_node, cp_node
21 WHERE cp_node.slm_id = %s AND cmi_node.cp_node_id = cp_node.cp_node_id',
27 $cmi_node_values[] =
$data[
'cmi_node_id'];
32 $query =
'DELETE FROM cmi_custom WHERE obj_id = %s';
33 $ilDB->manipulateF(
$query, array(
'integer'), array($packageId));
36 $query =
'DELETE FROM cmi_gobjective WHERE scope_id = %s';
37 $ilDB->manipulateF(
$query, array(
'integer'), array($packageId));
40 if ($s_globalObjectiveId !=
"") {
42 'DELETE FROM cmi_gobjective WHERE scope_id = %s AND objective_id in ('.$s_globalObjectiveId.
')',
54 $res = $ilDB->queryF(
'
55 SELECT cmi_node.cmi_node_id
56 FROM cmi_node, cp_node
57 WHERE cmi_node.user_id = %s AND cmi_node.cp_node_id = cp_node.cp_node_id',
64 $cmi_node_values[] =
$data[
'cmi_node_id'];
70 'DELETE FROM cmi_custom WHERE user_id = %s',
77 'DELETE FROM cmi_gobjective WHERE user_id = %s',
88 $res = $ilDB->queryF(
'
89 SELECT cmi_node.cmi_node_id
90 FROM cmi_node, cp_node
91 WHERE cmi_node.user_id = %s AND cmi_node.cp_node_id = cp_node.cp_node_id AND cp_node.slm_id = %s',
92 array(
'integer',
'integer'),
93 array($user_id,$packageId)
97 $cmi_node_values[] =
$data[
'cmi_node_id'];
103 'DELETE FROM cmi_custom WHERE user_id = %s AND obj_id = %s',
104 array(
'integer',
'integer'),
105 array($user_id,$packageId)
110 'DELETE FROM cmi_gobjective WHERE user_id = %s AND scope_id = %s',
111 array(
'integer',
'integer'),
112 array($user_id,$packageId)
116 if ($s_globalObjectiveId !=
"") {
118 'DELETE FROM cmi_gobjective WHERE user_id = %s AND scope_id = %s AND objective_id in ('.$s_globalObjectiveId.
')',
119 array(
'integer',
'integer'),
130 $cmi_inode_values = array();
132 $query =
'SELECT cmi_interaction_id FROM cmi_interaction WHERE '
133 . $ilDB->in(
'cmi_interaction.cmi_node_id', $cmi_node_values,
false,
'integer');
137 $cmi_inode_values[] =
$data[
'cmi_interaction_id'];
141 $query =
'DELETE FROM cmi_correct_response WHERE '
142 . $ilDB->in(
'cmi_correct_response.cmi_interaction_id', $cmi_inode_values,
false,
'integer');
143 $ilDB->manipulate(
$query);
146 $query =
'DELETE FROM cmi_objective WHERE '
147 . $ilDB->in(
'cmi_objective.cmi_interaction_id', $cmi_inode_values,
false,
'integer');
148 $ilDB->manipulate(
$query);
151 $query =
'DELETE FROM cmi_objective WHERE '
152 . $ilDB->in(
'cmi_objective.cmi_node_id', $cmi_node_values,
false,
'integer');
153 $ilDB->manipulate(
$query);
156 $query =
'DELETE FROM cmi_interaction WHERE '
157 . $ilDB->in(
'cmi_interaction.cmi_node_id', $cmi_node_values,
false,
'integer');
158 $ilDB->manipulate(
$query);
161 $query =
'DELETE FROM cmi_comment WHERE '
162 . $ilDB->in(
'cmi_comment.cmi_node_id', $cmi_node_values,
false,
'integer');
163 $ilDB->manipulate(
$query);
166 $query =
'DELETE FROM cmi_node WHERE '
167 . $ilDB->in(
'cmi_node.cmi_node_id', $cmi_node_values,
false,
'integer');
168 $ilDB->manipulate(
$query);
175 $existing_key_template =
"";
176 $global_to_system = 1;
178 $res = $ilDB->queryF(
'SELECT global_to_system FROM cp_package WHERE obj_id = %s',
184 $global_to_system =
$data[
'global_to_system'];
186 if ($global_to_system == 0)
return "";
188 $res = $ilDB->queryF(
'
189 SELECT targetobjectiveid
190 FROM cp_mapinfo, cp_node
191 WHERE cp_node.slm_id = %s
192 AND cp_node.nodename = %s
193 AND cp_mapinfo.cp_node_id = cp_node.cp_node_id',
194 array(
'integer',
'text'),
195 array($packageId,
'mapInfo')
199 $existing_key_template .=
"'".$data[
'targetobjectiveid'].
"',";
202 $existing_key_template = substr($existing_key_template, 0, strlen($existing_key_template) - 1);
204 return $existing_key_template;