ILIAS  release_8 Revision v8.24
ilMStListCompetencesSkills Class Reference

Class ilMStListCompetencesSkills. More...

+ Collaboration diagram for ilMStListCompetencesSkills:

Public Member Functions

 __construct (Container $dic)
 ilMStListCompetencesSkills constructor. More...
 
 getData (array $options)
 

Protected Member Functions

 getAdditionalWhereStatement (array $filters)
 

Protected Attributes

Container $dic
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilMStListCompetencesSkills::__construct ( Container  $dic)

ilMStListCompetencesSkills constructor.

Parameters
Container$dic

Definition at line 35 of file class.ilMStListCompetencesSkills.php.

36 {
37 $this->dic = $dic;
38 }

References $dic.

Member Function Documentation

◆ getAdditionalWhereStatement()

ilMStListCompetencesSkills::getAdditionalWhereStatement ( array  $filters)
protected

Definition at line 113 of file class.ilMStListCompetencesSkills.php.

113 : string
114 {
115 $wheres = [];
116
117 if (!empty($filters['skill'])) {
118 $wheres[] = "sktree.title LIKE '%" . $filters['skill'] . "%'";
119 }
120
121 if (!empty($filters['skill_level'])) {
122 $wheres[] = "lvl.title LIKE '%" . $filters['skill_level'] . "%'";
123 }
124
125 if (!empty($filters['user'])) {
126 $wheres[] = "(" . $this->dic->database()->like(
127 "ud.login",
128 "text",
129 "%" . $filters['user'] . "%"
130 ) . " " . "OR " . $this->dic->database()
131 ->like(
132 "ud.firstname",
133 "text",
134 "%" . $filters['user'] . "%"
135 ) . " " . "OR " . $this->dic->database()
136 ->like(
137 "ud.lastname",
138 "text",
139 "%" . $filters['user'] . "%"
140 ) . " " . "OR " . $this->dic->database()
141 ->like(
142 "ud.email",
143 "text",
144 "%" . $filters['user'] . "%"
145 ) . ") ";
146 }
147
148 if (!empty($filters['org_unit'])) {
149 $wheres[] = 'ud.usr_id IN (SELECT user_id FROM il_orgu_ua WHERE orgu_id = ' .
150 $this->dic->database()->quote($filters['org_unit'], 'integer') . ')';
151 }
152
153 return empty($wheres) ? '' : ' AND ' . implode(' AND ', $wheres);
154 }

Referenced by getData().

+ Here is the caller graph for this function:

◆ getData()

ilMStListCompetencesSkills::getData ( array  $options)
final
Parameters
int[]$options
Returns
ilMStListCompetencesSkill[]

Definition at line 44 of file class.ilMStListCompetencesSkills.php.

45 {
46 //Permission Filter
48
49 $select = 'SELECT sktree.title as skill_title, skill_node_id, ulvl.trigger_obj_id, ulvl.user_id, login, firstname, lastname, email, lvl.title as skill_level';
50
51 $query = $select .
52 ' FROM skl_personal_skill sk ' .
53 ' INNER JOIN usr_data ud ON ud.usr_id = sk.user_id ' .
54 ' INNER JOIN skl_tree_node sktree ON sktree.obj_id = sk.skill_node_id ' .
55 ' INNER JOIN (SELECT user_id, trigger_obj_id, skill_id, MAX(level_id) AS level_id ' .
56 ' FROM skl_user_has_level WHERE self_eval = 0 GROUP BY skill_id, user_id) ulvl ON sk.skill_node_id = ulvl.skill_id AND sk.user_id = ulvl.user_id ' .
57 ' INNER JOIN skl_level lvl ON lvl.id = ulvl.level_id ' .
58 ' WHERE ';
59
60 $users_per_position = ilMyStaffAccess::getInstance()->getUsersForUserPerPosition($this->dic->user()->getId());
61
62 if (empty($users_per_position)) {
63 return new ListFetcherResult([], 0);
64 }
65
66 $arr_query = [];
67 foreach ($users_per_position as $position_id => $users) {
68 $obj_ids = ilMyStaffAccess::getInstance()->getIdsForUserAndOperation(
69 $this->dic->user()->getId(),
70 $operation_access
71 );
72 $arr_query[] = $query . $this->dic->database()->in(
73 'ulvl.trigger_obj_id',
74 $obj_ids,
75 false,
76 'integer'
77 ) . " AND " . $this->dic->database()->in('sk.user_id ', $users, false, 'integer')
78 . $this->getAdditionalWhereStatement((array) $options['filters']);
79 }
80
81 $union_query = "SELECT * FROM ((" . implode(') UNION (', $arr_query) . ")) as a_table";
82
83 $set = $this->dic->database()->query($union_query);
84 $numRows = $this->dic->database()->numRows($set);
85
86 if ($options['sort']) {
87 $union_query .= " ORDER BY " . $options['sort']['field'] . " " . $options['sort']['direction'];
88 }
89
90 if (isset($options['limit']['start']) && isset($options['limit']['end'])) {
91 $union_query .= " LIMIT " . $options['limit']['start'] . "," . $options['limit']['end'];
92 }
93
94 $set = $this->dic->database()->query($union_query);
95
96 $skills = [];
97 while ($rec = $this->dic->database()->fetchAssoc($set)) {
98 $skills[] = new ilMStListCompetencesSkill(
99 intval($rec['skill_node_id']),
100 $rec['skill_title'],
101 $rec['skill_level'],
102 $rec['login'],
103 $rec['lastname'],
104 $rec['firstname'],
105 $rec['email'],
106 intval($rec['user_id'])
107 );
108 }
109
110 return new ListFetcherResult($skills, $numRows);
111 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$query

References $query, getAdditionalWhereStatement(), and ilOrgUnitOperation\OP_VIEW_COMPETENCES.

+ Here is the call graph for this function:

Field Documentation

◆ $dic

Container ilMStListCompetencesSkills::$dic
protected

Definition at line 29 of file class.ilMStListCompetencesSkills.php.

Referenced by __construct().


The documentation for this class was generated from the following file: