53 public function __construct(
int $a_skill_id = 0,
int $a_tref_id = 0)
57 $this->db = $DIC->database();
58 $this->tree = $DIC->repositoryTree();
62 if ($a_skill_id > 0) {
69 $this->base_skill_id = $a_val;
79 $this->tref_id = $a_val;
93 "SELECT * FROM skl_skill_resource " .
94 " WHERE base_skill_id = " .
$ilDB->quote($this->getBaseSkillId(),
"integer") .
95 " AND tref_id = " .
$ilDB->quote($this->getTemplateRefId(),
"integer")
97 while ($rec =
$ilDB->fetchAssoc($set)) {
98 if ($tree->
isInTree($rec[
"rep_ref_id"])) {
99 $this->resources[(
int) $rec[
"level_id"]][(
int) $rec[
"rep_ref_id"]] = array(
100 "level_id" => (
int) $rec[
"level_id"],
101 "rep_ref_id" => (
int) $rec[
"rep_ref_id"],
102 "trigger" => (
int) $rec[
"ltrigger"],
103 "imparting" => (
int) $rec[
"imparting"]
114 "DELETE FROM skl_skill_resource WHERE " .
115 " base_skill_id = " .
$ilDB->quote($this->getBaseSkillId(),
"integer") .
116 " AND tref_id = " .
$ilDB->quote($this->getTemplateRefId(),
"integer")
119 foreach ($l as
$ref_id => $r) {
120 if ($r[
"imparting"] || $r[
"trigger"]) {
121 $ilDB->manipulate(
"INSERT INTO skl_skill_resource " .
122 "(base_skill_id, tref_id, level_id, rep_ref_id, imparting, ltrigger) VALUES (" .
123 $ilDB->quote($this->getBaseSkillId(),
"integer") .
"," .
124 $ilDB->quote($this->getTemplateRefId(),
"integer") .
"," .
125 $ilDB->quote($level_id,
"integer") .
"," .
127 $ilDB->quote((
int) $r[
"imparting"],
"integer") .
"," .
128 $ilDB->quote((
int) $r[
"trigger"],
"integer") .
148 $ret = (isset($this->resources[$a_level_id]) && is_array($this->resources[$a_level_id]))
149 ? $this->resources[$a_level_id]
157 if (!isset($this->resources[$a_level_id]) || !is_array($this->resources[$a_level_id])) {
158 $this->resources[$a_level_id] = [];
160 if (!isset($this->resources[$a_level_id][$a_rep_ref_id]) || !is_array($this->resources[$a_level_id][$a_rep_ref_id])) {
161 $this->resources[$a_level_id][$a_rep_ref_id] = [];
164 $this->resources[$a_level_id][$a_rep_ref_id][
"trigger"] = $a_trigger;
169 if (!isset($this->resources[$a_level_id]) || !is_array($this->resources[$a_level_id])) {
170 $this->resources[$a_level_id] = [];
172 if (!isset($this->resources[$a_level_id][$a_rep_ref_id]) || !is_array($this->resources[$a_level_id][$a_rep_ref_id])) {
173 $this->resources[$a_level_id][$a_rep_ref_id] = [];
176 $this->resources[$a_level_id][$a_rep_ref_id][
"imparting"] = $a_imparting;
189 "skl_skill_resource",
202 $db = $DIC->database();
204 $set = $db->
query(
"SELECT * FROM skl_skill_resource " .
205 " WHERE rep_ref_id = " . $db->
quote($a_ref_id,
"integer") .
206 " AND ltrigger = " . $db->
quote(1,
"integer"));
210 $skill_levels[] = array(
211 "base_skill_id" => (
int) $rec[
"base_skill_id"],
212 "tref_id" => (
int) $rec[
"tref_id"],
213 "level_id" => (
int) $rec[
"level_id"]
216 return $skill_levels;
Get info on usages of skills.
setResourceAsTrigger(int $a_level_id, int $a_rep_ref_id, bool $a_trigger=true)
fetchAssoc(ilDBStatement $statement)
getResourcesOfLevel(int $a_level_id)
static getTriggerLevelsForRefId(int $a_ref_id)
isInTree(?int $a_node_id)
get all information of a node.
quote($value, string $type)
setBaseSkillId(int $a_val)
__construct(int $a_skill_id=0, int $a_tref_id=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
query(string $query)
Run a (read-only) Query on the database.
setTemplateRefId(int $a_val)
static getUsageInfoGeneric(array $a_cskill_ids, string $a_usage_type, string $a_table, string $a_key_field, string $a_skill_field="skill_id", string $a_tref_field="tref_id")
Get standard usage query.
static getUsageInfo(array $a_cskill_ids)
setResourceAsImparting(int $a_level_id, int $a_rep_ref_id, bool $a_imparting=true)