ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 34 of file class.ilMStListCompetencesSkills.php.

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

References $dic.

Member Function Documentation

◆ getAdditionalWhereStatement()

ilMStListCompetencesSkills::getAdditionalWhereStatement ( array  $filters)
protected

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

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

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 43 of file class.ilMStListCompetencesSkills.php.

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

References getAdditionalWhereStatement(), and ilOrgUnitOperation\OP_VIEW_COMPETENCES.

+ Here is the call graph for this function:

Field Documentation

◆ $dic

Container ilMStListCompetencesSkills::$dic
protected

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

Referenced by __construct().


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