ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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 110 of file class.ilMStListCompetencesSkills.php.

Referenced by getData().

110  : string
111  {
112  $wheres = [];
113 
114  if (!empty($filters['skill'])) {
115  $wheres[] = "sktree.title LIKE '%" . $filters['skill'] . "%'";
116  }
117 
118  if (!empty($filters['skill_level'])) {
119  $wheres[] = "lvl.title LIKE '%" . $filters['skill_level'] . "%'";
120  }
121 
122  if (!empty($filters['user'])) {
123  $wheres[] = "(" . $this->dic->database()->like("ud.login", "text", "%" . $filters['user'] . "%") . " " . "OR " . $this->dic->database()
124  ->like("ud.firstname", "text", "%" . $filters['user'] . "%") . " " . "OR " . $this->dic->database()
125  ->like("ud.lastname", "text", "%" . $filters['user'] . "%") . " " . "OR " . $this->dic->database()
126  ->like("ud.email", "text", "%" . $filters['user'] . "%") . ") ";
127  }
128 
129  if (!empty($arr_filter['org_unit'])) {
130  $wheres[] = 'ud.usr_id IN (SELECT user_id FROM il_orgu_ua WHERE orgu_id = ' .
131  $this->dic->database()->quote($filters['org_unit'], 'integer') . ')';
132  }
133 
134  return empty($wheres) ? '' : ' AND ' . implode(' AND ', $wheres);
135  }
+ 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 = $options['count'] === true ?
42  'SELECT count(*)' : 'SELECT sktree.title as skill_title, skill_node_id, ulvl.trigger_obj_id, user_id, login, firstname, lastname, lvl.title as skill_level';
43 
44  $query = $select .
45  ' FROM skl_personal_skill sk ' .
46  ' INNER JOIN usr_data ud ON ud.usr_id = sk.user_id ' .
47  ' INNER JOIN skl_tree_node sktree ON sktree.obj_id = sk.skill_node_id ' .
48  ' INNER JOIN (SELECT trigger_obj_id, skill_id, MAX(level_id) AS level_id ' .
49  ' FROM skl_user_has_level WHERE self_eval = 0 GROUP BY skill_id) ulvl ON sk.skill_node_id = ulvl.skill_id ' .
50  ' INNER JOIN skl_level lvl ON lvl.id = ulvl.level_id ' .
51  ' WHERE ';
52 
53  $data = [];
54  $users_per_position = ilMyStaffAccess::getInstance()->getUsersForUserPerPosition($this->dic->user()->getId());
55 
56  if (empty($users_per_position)) {
57  if ($options["count"]) {
58  return 0;
59  } else {
60  return [];
61  }
62  }
63 
64  $arr_query = [];
65  foreach ($users_per_position as $position_id => $users) {
66  $obj_ids = ilMyStaffAccess::getInstance()->getIdsForUserAndOperation($this->dic->user()->getId(), $operation_access);
67  $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')
68  . $this->getAdditionalWhereStatement($options['filters']);
69  }
70 
71  $union_query = "SELECT * FROM ((" . implode(') UNION (', $arr_query) . ")) as a_table";
72 
73  if ($options['count'] === true) {
74  $set = $this->dic->database()->query($union_query);
75 
76  return $this->dic->database()->numRows($set);
77  }
78 
79  if ($options['sort']) {
80  $union_query .= " ORDER BY " . $options['sort']['field'] . " " . $options['sort']['direction'];
81  }
82 
83  if (isset($options['limit']['start']) && isset($options['limit']['end'])) {
84  $union_query .= " LIMIT " . $options['limit']['start'] . "," . $options['limit']['end'];
85  }
86 
87  $set = $this->dic->database()->query($union_query);
88 
89  $skills = [];
90  while ($rec = $this->dic->database()->fetchAssoc($set)) {
91  $skills[] = new ilMStListCompetencesSkill(
92  $rec['skill_title'],
93  $rec['skill_level'],
94  $rec['login'],
95  $rec['lastname'],
96  $rec['firstname'],
97  $rec['user_id']
98  );
99  }
100 
101  return $skills;
102  }
$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: