5 include_once(
"./Services/Skill/interfaces/interface.ilSkillUsageInfo.php");
57 $this->db = $DIC->database();
58 $this->tree = $DIC->repositoryTree();
62 if ($a_skill_id > 0) {
74 $this->base_skill_id = (int) $a_val;
94 $this->tref_id = (int) $a_val;
119 "SELECT * FROM skl_skill_resource " .
120 " WHERE base_skill_id = " .
$ilDB->quote($this->getBaseSkillId(),
"integer") .
121 " AND tref_id = " .
$ilDB->quote($this->getTemplateRefId(),
"integer")
123 while ($rec =
$ilDB->fetchAssoc($set)) {
124 if (
$tree->isInTree($rec[
"rep_ref_id"])) {
125 $this->resources[$rec[
"level_id"]][$rec[
"rep_ref_id"]] = array(
126 "level_id" => $rec[
"level_id"],
127 "rep_ref_id" => $rec[
"rep_ref_id"],
128 "trigger" => $rec[
"ltrigger"],
129 "imparting" => $rec[
"imparting"]
143 "DELETE FROM skl_skill_resource WHERE " .
144 " base_skill_id = " .
$ilDB->quote((
int) $this->getBaseSkillId(),
"integer") .
145 " AND tref_id = " .
$ilDB->quote((
int) $this->getTemplateRefId(),
"integer")
148 foreach (
$l as $ref_id =>
$r) {
149 if (
$r[
"imparting"] ||
$r[
"trigger"]) {
150 $ilDB->manipulate(
"INSERT INTO skl_skill_resource " .
151 "(base_skill_id, tref_id, level_id, rep_ref_id, imparting, ltrigger) VALUES (" .
152 $ilDB->quote((
int) $this->getBaseSkillId(),
"integer") .
"," .
153 $ilDB->quote((
int) $this->getTemplateRefId(),
"integer") .
"," .
154 $ilDB->quote((
int) $level_id,
"integer") .
"," .
155 $ilDB->quote((
int) $ref_id,
"integer") .
"," .
156 $ilDB->quote((
int)
$r[
"imparting"],
"integer") .
"," .
157 $ilDB->quote((
int) $r[
"trigger"],
"integer") .
182 $ret = (is_array($this->resources[$a_level_id]))
183 ? $this->resources[$a_level_id]
198 if (!is_array($this->resources[$a_level_id])) {
199 $this->resources[$a_level_id] = array();
201 if (!is_array($this->resources[$a_level_id][$a_rep_ref_id])) {
202 $this->resources[$a_level_id][$a_rep_ref_id] = array();
205 $this->resources[$a_level_id][$a_rep_ref_id][
"trigger"] = $a_trigger;
217 if (!is_array($this->resources[$a_level_id])) {
218 $this->resources[$a_level_id] = array();
220 if (!is_array($this->resources[$a_level_id][$a_rep_ref_id])) {
221 $this->resources[$a_level_id][$a_rep_ref_id] = array();
224 $this->resources[$a_level_id][$a_rep_ref_id][
"imparting"] = $a_imparting;
237 $ilDB = $DIC->database();
239 include_once(
"./Services/Skill/classes/class.ilSkillUsage.php");
244 "skl_skill_resource",
260 $db = $DIC->database();
262 $set =
$db->query(
"SELECT * FROM skl_skill_resource " .
263 " WHERE rep_ref_id = " .
$db->quote($a_ref_id,
"integer") .
264 " AND ltrigger = " .
$db->quote(1,
"integer"));
266 $skill_levels = array();
267 while ($rec =
$db->fetchAssoc($set)) {
268 $skill_levels[] = array(
269 "base_skill_id" => $rec[
"base_skill_id"],
270 "tref_id" => $rec[
"tref_id"],
271 "level_id" => $rec[
"level_id"]
274 return $skill_levels;
Get info on usages of skills.
getTemplateRefId()
Get template reference id.
setResourceAsImparting($a_level_id, $a_rep_ref_id, $a_imparting=true)
Set resource as imparting resource.
getBaseSkillId()
Get base skill id.
static getUsageInfo($a_cskill_ids, &$a_usages)
Get usage info.
setBaseSkillId($a_val)
Set base skill id.
static getUsageInfoGeneric( $a_cskill_ids, &$a_usages, $a_usage_type, $a_table, $a_key_field, $a_skill_field="skill_id", $a_tref_field="tref_id")
Get standard usage query.
setResourceAsTrigger($a_level_id, $a_rep_ref_id, $a_trigger=true)
Set resource as trigger.
readResources()
Read resources.
Manages resources for skills.
setTemplateRefId($a_val)
Set template reference id.
getResources()
Get resources.
getResourcesOfLevel($a_level_id)
Get resoures for level id.
__construct($a_skill_id=0, $a_tref_id=0)
Constructor.
static getTriggerLevelsForRefId($a_ref_id)
Get levels for trigger per ref id.