41 $select =
'SELECT sktree.title as skill_title, skill_node_id, ulvl.trigger_obj_id, user_id, login, firstname, lastname, email, lvl.title as skill_level';
44 ' FROM skl_personal_skill sk ' .
45 ' INNER JOIN usr_data ud ON ud.usr_id = sk.user_id ' .
46 ' INNER JOIN skl_tree_node sktree ON sktree.obj_id = sk.skill_node_id ' .
47 ' INNER JOIN (SELECT trigger_obj_id, skill_id, MAX(level_id) AS level_id ' .
48 ' FROM skl_user_has_level WHERE self_eval = 0 GROUP BY skill_id) ulvl ON sk.skill_node_id = ulvl.skill_id ' .
49 ' INNER JOIN skl_level lvl ON lvl.id = ulvl.level_id ' .
53 $users_per_position = ilMyStaffAccess::getInstance()->getUsersForUserPerPosition($this->dic->user()->getId());
55 if (empty($users_per_position)) {
56 if ($options[
"count"]) {
64 foreach ($users_per_position as $position_id => $users) {
65 $obj_ids = ilMyStaffAccess::getInstance()->getIdsForUserAndOperation($this->dic->user()->getId(), $operation_access);
66 $arr_query[] =
$query . $this->dic->database()->in(
'ulvl.trigger_obj_id', $obj_ids,
false,
'integer') .
" AND " . $this->dic->database()->in(
'sk.user_id ', $users,
false,
'integer')
70 $union_query =
"SELECT * FROM ((" . implode(
') UNION (', $arr_query) .
")) as a_table";
72 if ($options[
'count'] ===
true) {
73 $set = $this->dic->database()->query($union_query);
75 return $this->dic->database()->numRows($set);
78 if ($options[
'sort']) {
79 $union_query .=
" ORDER BY " . $options[
'sort'][
'field'] .
" " . $options[
'sort'][
'direction'];
82 if (isset($options[
'limit'][
'start']) && isset($options[
'limit'][
'end'])) {
83 $union_query .=
" LIMIT " . $options[
'limit'][
'start'] .
"," . $options[
'limit'][
'end'];
86 $set = $this->dic->database()->query($union_query);
89 while ($rec = $this->dic->database()->fetchAssoc($set)) {
91 $rec[
'skill_node_id'],
115 if (!empty($filters[
'skill'])) {
116 $wheres[] =
"sktree.title LIKE '%" . $filters[
'skill'] .
"%'";
119 if (!empty($filters[
'skill_level'])) {
120 $wheres[] =
"lvl.title LIKE '%" . $filters[
'skill_level'] .
"%'";
123 if (!empty($filters[
'user'])) {
124 $wheres[] =
"(" . $this->dic->database()->like(
"ud.login",
"text",
"%" . $filters[
'user'] .
"%") .
" " .
"OR " . $this->dic->database()
125 ->like(
"ud.firstname",
"text",
"%" . $filters[
'user'] .
"%") .
" " .
"OR " . $this->dic->database()
126 ->like(
"ud.lastname",
"text",
"%" . $filters[
'user'] .
"%") .
" " .
"OR " . $this->dic->database()
127 ->like(
"ud.email",
"text",
"%" . $filters[
'user'] .
"%") .
") ";
130 if (!empty($filters[
'org_unit'])) {
131 $wheres[] =
'ud.usr_id IN (SELECT user_id FROM il_orgu_ua WHERE orgu_id = ' .
132 $this->dic->database()->quote($filters[
'org_unit'],
'integer') .
')';
135 return empty($wheres) ?
'' :
' AND ' . implode(
' AND ', $wheres);
Customizing of pimple-DIC for ILIAS.
const OP_VIEW_COMPETENCES
__construct(Container $dic)
ilMStListCompetencesSkills constructor.
getAdditionalWhereStatement(array $filters)