ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ilPRGAssignmentFilter Class Reference
+ Collaboration diagram for ilPRGAssignmentFilter:

Public Member Functions

 __construct (ilLanguage $lng)
 
 withValues (array $values)
 
 toConditions ()
 
 getItemConfig ()
 

Protected Member Functions

 getCleanedValues ()
 

Protected Attributes

ilLanguage $lng
 
array $values = []
 

Detailed Description

Definition at line 21 of file ilPRGAssignmentFilter.php.

Constructor & Destructor Documentation

◆ __construct()

ilPRGAssignmentFilter::__construct ( ilLanguage  $lng)

Definition at line 26 of file ilPRGAssignmentFilter.php.

References $lng, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Member Function Documentation

◆ getCleanedValues()

ilPRGAssignmentFilter::getCleanedValues ( )
protected

Definition at line 118 of file ilPRGAssignmentFilter.php.

References $id, ilTable2GUI\FILTER_CHECKBOX, ilTable2GUI\FILTER_DATE_RANGE, ilTable2GUI\FILTER_SELECT, ilTable2GUI\FILTER_TEXT, getItemConfig(), and ilStudyProgrammeUserTable\OPTION_ALL.

Referenced by toConditions().

118  : array
119  {
120  $ret = [];
121  foreach ($this->getItemConfig() as list($id, $type, $options)) {
122  if (array_key_exists($id, $this->values)) {
123  if ($type === ilTable2GUI::FILTER_SELECT
124  && (
126  || $this->values[$id] === false
127  )
128  ) {
129  continue;
130  }
131  if ($type === ilTable2GUI::FILTER_TEXT
132  && $this->values[$id] == ''
133  ) {
134  continue;
135  }
136  if ($type === ilTable2GUI::FILTER_CHECKBOX
137  && ($this->values[$id] == false || is_null($this->values[$id]))
138  ) {
139  continue;
140  }
141  if ($type === ilTable2GUI::FILTER_DATE_RANGE
142  && $this->values[$id]['from'] == []
143  && $this->values[$id]['to'] == []
144  ) {
145  continue;
146  }
147  $ret[$id] = $this->values[$id];
148  }
149  };
150  return $ret;
151  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getItemConfig()

ilPRGAssignmentFilter::getItemConfig ( )
Returns
array <string $id, string $type, null | array $options>

Definition at line 156 of file ilPRGAssignmentFilter.php.

References ilTable2GUI\FILTER_CHECKBOX, ilTable2GUI\FILTER_DATE_RANGE, ilTable2GUI\FILTER_SELECT, ilTable2GUI\FILTER_TEXT, ILIAS\Repository\lng(), null, ilStudyProgrammeUserTable\OPTION_ALL, ilStudyProgrammeUserTable\OPTION_USR_ACTIVE, ilStudyProgrammeUserTable\OPTION_USR_INACTIVE, ilPRGAssignmentDBRepository\PROGRESS_FIELD_DEADLINE, ilPRGAssignmentDBRepository\PROGRESS_FIELD_INVALIDATED, ilPRGAssignmentDBRepository\PROGRESS_FIELD_STATUS, ilPRGAssignmentDBRepository\PROGRESS_FIELD_VQ_DATE, ilPRGProgress\STATUS_ACCREDITED, ilPRGProgress\STATUS_COMPLETED, ilPRGProgress\STATUS_FAILED, ilPRGProgress\STATUS_IN_PROGRESS, ilPRGProgress\STATUS_NOT_RELEVANT, ilStudyProgrammeUserTable\VALIDITY_OPTION_INVALID, and ilStudyProgrammeUserTable\VALIDITY_OPTION_VALID.

Referenced by getCleanedValues().

156  : array
157  {
158  $items = [];
159 
160  $items[] = [
163  [
164  ilStudyProgrammeUserTable::OPTION_ALL => $this->lng->txt("all"),
165  ilStudyProgrammeUserTable::VALIDITY_OPTION_VALID => $this->lng->txt("prg_still_valid"),
166  ilStudyProgrammeUserTable::VALIDITY_OPTION_INVALID => $this->lng->txt("prg_not_valid")
167  ],
168  $this->lng->txt('prg_validity')
169  ];
170 
171  $items[] = [
174  [
175  ilStudyProgrammeUserTable::OPTION_ALL => $this->lng->txt("all"),
176  ilPRGProgress::STATUS_IN_PROGRESS => $this->lng->txt("prg_status_in_progress"),
177  ilPRGProgress::STATUS_COMPLETED => $this->lng->txt("prg_status_completed"),
178  ilPRGProgress::STATUS_ACCREDITED => $this->lng->txt("prg_status_accredited"),
179  ilPRGProgress::STATUS_NOT_RELEVANT => $this->lng->txt("prg_status_not_relevant"),
180  ilPRGProgress::STATUS_FAILED => $this->lng->txt("prg_status_failed")
181  ],
182  ''
183  ];
184 
185  $items[] = ['prg_status_hide_irrelevant', ilTable2GUI::FILTER_CHECKBOX, null, ''];
186 
187  $items[] = [
188  'usr_active',
190  [
191  ilStudyProgrammeUserTable::OPTION_ALL => $this->lng->txt("all"),
192  ilStudyProgrammeUserTable::OPTION_USR_ACTIVE => $this->lng->txt("active_only"),
193  ilStudyProgrammeUserTable::OPTION_USR_INACTIVE => $this->lng->txt("inactive_only")
194  ],
195  ''
196  ];
197 
198  $items[] = ['name', ilTable2GUI::FILTER_TEXT, null, ''];
199 
200  $items[] = [
203  null,
204  ''
205  ];
206 
207  $items[] = [
210  null,
211  ''
212  ];
213 
214  return $items;
215  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toConditions()

ilPRGAssignmentFilter::toConditions ( )

Definition at line 39 of file ilPRGAssignmentFilter.php.

References getCleanedValues(), IL_CAL_DATE, ilStudyProgrammeUserTable\OPTION_USR_ACTIVE, ilStudyProgrammeUserTable\OPTION_USR_INACTIVE, ilPRGAssignmentDBRepository\PROGRESS_FIELD_INVALIDATED, ilPRGAssignmentDBRepository\PROGRESS_FIELD_STATUS, ilPRGProgress\STATUS_ACCREDITED, ilPRGProgress\STATUS_COMPLETED, ilPRGProgress\STATUS_NOT_RELEVANT, ilStudyProgrammeUserTable\VALIDITY_OPTION_INVALID, and ilStudyProgrammeUserTable\VALIDITY_OPTION_VALID.

39  : array
40  {
41  $conditions = [];
42  foreach ($this->getCleanedValues() as $field => $value) {
43  switch ($field) {
44  case 'status':
45  if ($value) {
46  $conditions[] = ilPRGAssignmentDBRepository::PROGRESS_FIELD_STATUS . '=' . $value;
47  }
48  break;
49  case 'prg_status_hide_irrelevant':
51  break;
52  case 'name':
53  $conditions[] = '('
54  . 'memberdata.firstname LIKE \'%' . $value . '%\' OR' . PHP_EOL
55  . 'memberdata.lastname LIKE \'%' . $value . '%\' OR' . PHP_EOL
56  . 'memberdata.login LIKE \'%' . $value . '%\'' . PHP_EOL
57  . ')';
58  break;
59  case 'invalidated':
62  }
65  $conditions[] = '('
67  . ' OR '
69  . ')';
70  }
71  break;
72 
73  case 'usr_active':
74  if ((int) $value === ilStudyProgrammeUserTable::OPTION_USR_ACTIVE) {
75  $conditions[] = 'memberdata.active = 1';
76  }
78  $conditions[] = 'memberdata.active = 0';
79  }
80  break;
81  case 'vq_date':
82  list($from, $to) = array_values($value);
83  if ($from) {
84  $from = $from->get(IL_CAL_DATE);
85  $conditions[] = 'vq_date >= \'' . $from . ' 00:00:00\'';
86  }
87  if ($to) {
88  $to = $to->get(IL_CAL_DATE);
89  $conditions[] = 'vq_date <= \'' . $to . ' 23:59:59\'';
90  }
91  break;
92  case 'deadline':
93  list($from, $to) = array_values($value);
94  if ($to || $from) {
95  $conditions[] = 'deadline IS NOT NULL';
97  . ' NOT IN (' .
100  . ')';
101  }
102  if ($from) {
103  $from = $from->get(IL_CAL_DATE);
104  $conditions[] = 'deadline >= \'' . $from . '\'';
105  }
106  if ($to) {
107  $to = $to->get(IL_CAL_DATE);
108  $conditions[] = 'deadline <= \'' . $to . '\'';
109  }
110  break;
111  default:
112  throw new ilException("missing field in filter (to condition): " . $field, 1);
113  }
114  }
115  return $conditions;
116  }
const IL_CAL_DATE
+ Here is the call graph for this function:

◆ withValues()

ilPRGAssignmentFilter::withValues ( array  $values)

Definition at line 32 of file ilPRGAssignmentFilter.php.

References $values.

32  : self
33  {
34  $clone = clone $this;
35  $clone->values = $values;
36  return $clone;
37  }

Field Documentation

◆ $lng

ilLanguage ilPRGAssignmentFilter::$lng
protected

Definition at line 23 of file ilPRGAssignmentFilter.php.

Referenced by __construct().

◆ $values

array ilPRGAssignmentFilter::$values = []
protected

Definition at line 24 of file ilPRGAssignmentFilter.php.

Referenced by withValues().


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