ILIAS  release_7 Revision v7.30-3-g800a261c036
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

 $dic
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilMStListCompetencesSkills::__construct ( Container  $dic)

ilMStListCompetencesSkills constructor.

Parameters
Container$dic

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

References $dic.

26  {
27  $this->dic = $dic;
28  }

Member Function Documentation

◆ getAdditionalWhereStatement()

ilMStListCompetencesSkills::getAdditionalWhereStatement ( array  $filters)
protected
Parameters
array$filters
Returns
string

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

Referenced by getData().

111  : string
112  {
113  $wheres = [];
114 
115  if (!empty($filters['skill'])) {
116  $wheres[] = "sktree.title LIKE '%" . $filters['skill'] . "%'";
117  }
118 
119  if (!empty($filters['skill_level'])) {
120  $wheres[] = "lvl.title LIKE '%" . $filters['skill_level'] . "%'";
121  }
122 
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'] . "%") . ") ";
128  }
129 
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') . ')';
133  }
134 
135  return empty($wheres) ? '' : ' AND ' . implode(' AND ', $wheres);
136  }
+ Here is the caller graph for this function:

◆ getData()

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

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

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

37  {
38  //Permission Filter
39  $operation_access = ilOrgUnitOperation::OP_VIEW_COMPETENCES;
40 
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';
42 
43  $query = $select .
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 ' .
50  ' WHERE ';
51 
52  $data = [];
53  $users_per_position = ilMyStaffAccess::getInstance()->getUsersForUserPerPosition($this->dic->user()->getId());
54 
55  if (empty($users_per_position)) {
56  if ($options["count"]) {
57  return 0;
58  } else {
59  return [];
60  }
61  }
62 
63  $arr_query = [];
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')
67  . $this->getAdditionalWhereStatement($options['filters']);
68  }
69 
70  $union_query = "SELECT * FROM ((" . implode(') UNION (', $arr_query) . ")) as a_table";
71 
72  if ($options['count'] === true) {
73  $set = $this->dic->database()->query($union_query);
74 
75  return $this->dic->database()->numRows($set);
76  }
77 
78  if ($options['sort']) {
79  $union_query .= " ORDER BY " . $options['sort']['field'] . " " . $options['sort']['direction'];
80  }
81 
82  if (isset($options['limit']['start']) && isset($options['limit']['end'])) {
83  $union_query .= " LIMIT " . $options['limit']['start'] . "," . $options['limit']['end'];
84  }
85 
86  $set = $this->dic->database()->query($union_query);
87 
88  $skills = [];
89  while ($rec = $this->dic->database()->fetchAssoc($set)) {
90  $skills[] = new ilMStListCompetencesSkill(
91  $rec['skill_node_id'],
92  $rec['skill_title'],
93  $rec['skill_level'],
94  $rec['login'],
95  $rec['lastname'],
96  $rec['firstname'],
97  $rec['email'],
98  $rec['user_id']
99  );
100  }
101 
102  return $skills;
103  }
$data
Definition: storeScorm.php:23
$query
+ Here is the call graph for this function:

Field Documentation

◆ $dic

ilMStListCompetencesSkills::$dic
protected

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

Referenced by __construct().


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