ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilMDUtilSelect.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 
33 {
43  // BEGIN PATCH Lucene search
44  public static function _getLanguageSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
45  // END PATCH Lucene Search
46  {
47  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
48 
49  global $DIC;
50 
51  $lng = $DIC['lng'];
52 
54  $tmp_options[$code] = $lng->txt('meta_l_' . $code);
55  }
56  asort($tmp_options, SORT_STRING);
57 
58  foreach ($prepend as $value => $translation) {
59  $options[$value] = $translation;
60  }
61  $options = array_merge($options, $tmp_options);
62  // BEGIN PATCH Lucene search
63  return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
64  // END PATCH Lucene Search
65  return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
66  }
67 
77  // BEGIN PATCH Lucene search
78  public static function _getStructureSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
79  // END PATCH Lucene Search
80  {
81  global $DIC;
82 
83  $lng = $DIC['lng'];
84 
85  $items = array('Atomic','Collection','Networked','Hierarchical','Linear');
86 
87  foreach ($prepend as $value => $translation) {
88  $options[$value] = $translation;
89  }
90 
91  foreach ($items as $item) {
92  $options[$item] = $lng->txt('meta_' . strtolower($item));
93  }
94  // BEGIN PATCH Lucene search
95  return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
96  // END PATCH Lucene Search
97  return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
98  }
108  // BEGIN PATCH Lucene search
109  public static function _getStatusSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
110  // END PATCH Lucene Search
111  {
112  global $DIC;
113 
114  $lng = $DIC['lng'];
115 
116  $items = array('Draft','Final','Revised','Unavailable');
117 
118  foreach ($prepend as $value => $translation) {
119  $options[$value] = $translation;
120  }
121 
122  foreach ($items as $item) {
123  $options[$item] = $lng->txt('meta_' . strtolower($item));
124  }
125  // BEGIN PATCH Lucene search
126  return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
127  // END PATCH Lucene Search
128  return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
129  }
139  // BEGIN PATCH Lucene search
140  public static function _getRoleSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
141  // END PATCH Lucene Search
142  {
143  global $DIC;
144 
145  $lng = $DIC['lng'];
146 
147  $items = array('Author','Publisher','Unknown','Initiator','Terminator','Editor','GraphicalDesigner','TechnicalImplementer',
148  'ContentProvider','TechnicalValidator','EducationalValidator','ScriptWriter','InstructionalDesigner',
149  'SubjectMatterExpert','Creator','Validator','PointOfContact');
150 
151  foreach ($prepend as $value => $translation) {
152  $options[$value] = $translation;
153  }
154 
155  foreach ($items as $item) {
156  $options[$item] = $lng->txt('meta_' . strtolower($item));
157  }
158  // BEGIN PATCH Lucene search
159  return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
160  // END PATCH Lucene Search
161  return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
162  }
172  // BEGIN PATCH Lucene search
173  public static function _getOperatingSystemSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
174  // END PATCH Lucene Search
175  {
176  global $DIC;
177 
178  $lng = $DIC['lng'];
179 
180  $items = array('PC-DOS','MS-Windows','MAC-OS','Unix','Multi-OS','None');
181 
182  foreach ($prepend as $value => $translation) {
183  $options[$value] = $translation;
184  }
185 
186  foreach ($items as $item) {
187  $options[$item] = $item;
188  }
189  // BEGIN PATCH Lucene search
190  return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
191  // END PATCH Lucene Search
192  return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
193  }
203  // BEGIN PATCH Lucene search
204  public static function _getBrowserSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
205  // END PATCH Lucene Search
206  {
207  global $DIC;
208 
209  $lng = $DIC['lng'];
210 
211  $items = array('Any','NetscapeCommunicator','MS-InternetExplorer','Opera','Amaya','Mozilla');
212 
213  foreach ($prepend as $value => $translation) {
214  $options[$value] = $translation;
215  }
216 
217  foreach ($items as $item) {
218  $options[$item] = $item;
219  }
220  // BEGIN PATCH Lucene search
221  return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
222  // END PATCH Lucene Search
223  return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
224  }
235  // BEGIN PATCH Lucene search
236  public static function _getFormatSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
237  // END PATCH Lucene Search
238  {
239  global $DIC;
240 
241  $lng = $DIC['lng'];
242  $ilDB = $DIC['ilDB'];
243 
244  foreach ($prepend as $value => $translation) {
245  $options[$value] = $translation;
246  }
247 
248  $ilDB->setLimit(200, 0);
249  // In case an index is defined on field il_meta_format, this group by
250  // statement takes advantage of it to improve the performance of the query.
251  $query = "SELECT format as forma from il_meta_format GROUP BY format";
252  $res = $ilDB->query($query);
253  if (!$res->numRows()) {
254  return '';
255  }
256  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
257  if (strlen($row->format)) {
258  $options[$row->format] = substr($row->format, 0, 48);
259  }
260  }
261 
262  // BEGIN PATCH Lucene search
263  return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
264  // END PATCH Lucene Search
265  return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
266  }
277  public static function _getDurationSelect($a_selected, $a_name, $prepend = array())
278  {
279  global $DIC;
280 
281  $lng = $DIC['lng'];
282 
283  foreach ($prepend as $value => $translation) {
284  $options[$value] = $translation;
285  }
286 
287  $items = array(15 => '15 ' . $lng->txt('minutes'),
288  30 => '30 ' . $lng->txt('minutes'),
289  45 => '45 ' . $lng->txt('minutes'),
290  60 => '1 ' . $lng->txt('hour'),
291  90 => '1 ' . $lng->txt('hour') . ' 30 ' . $lng->txt('minutes'),
292  120 => '2 ' . $lng->txt('hours'),
293  180 => '3 ' . $lng->txt('hours'),
294  240 => '4 ' . $lng->txt('hours'));
295 
296  foreach ($items as $key => $item) {
297  $options[$key] = $item;
298  }
299  return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
300  }
311  // BEGIN PATCH Lucene search
312  public static function _getInteractivityTypeSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
313  // END PATCH Lucene Search
314  {
315  global $DIC;
316 
317  $lng = $DIC['lng'];
318 
319  $items = array('Actice','Expositive','Mixed');
320 
321  foreach ($prepend as $value => $translation) {
322  $options[$value] = $translation;
323  }
324 
325  foreach ($items as $item) {
326  $options[$item] = $item;
327  }
328  // BEGIN PATCH Lucene search
329  return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
330  // END PATCH Lucene Search
331  return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
332  }
343  // BEGIN PATCH Lucene search
344  public static function _getLearningResourceTypeSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
345  // END PATCH Lucene Search
346  {
347  global $DIC;
348 
349  $lng = $DIC['lng'];
350 
351  $items = array('Exercise','Simulation','Questionnaire','Diagram','Figure','Graph','Index',
352  'Slide','Table','NarrativeText','Exam','Experiment','ProblemStatement','SelfAssessment','Lecture');
353 
354  foreach ($prepend as $value => $translation) {
355  $options[$value] = $translation;
356  }
357 
358  foreach ($items as $item) {
359  $options[$item] = $item;
360  }
361  // BEGIN PATCH Lucene search
362  return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
363  // END PATCH Lucene Search
364  return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
365  }
376  public static function _getInteractivityLevelSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
377  {
378  global $DIC;
379 
380  $lng = $DIC['lng'];
381 
382  $items = array(1 => 'VeryLow',2 => 'Low',3 => 'Medium',4 => 'High',5 => 'VeryHigh');
383 
384  foreach ($prepend as $value => $translation) {
385  $options[$value] = $translation;
386  }
387 
388  foreach ($items as $key => $item) {
389  $options[$key] = $item;
390  }
391  // BEGIN PATCH Lucene search
392  return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
393  // END PATCH Lucene Search
394  return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
395  }
406  // BEGIN PATCH Lucene search
407  public static function _getSemanticDensitySelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
408  // END PATCH Lucene Search
409  {
410  global $DIC;
411 
412  $lng = $DIC['lng'];
413 
414  $items = array(1 => 'VeryLow',2 => 'Low',3 => 'Medium',4 => 'High',5 => 'VeryHigh');
415 
416  foreach ($prepend as $value => $translation) {
417  $options[$value] = $translation;
418  }
419 
420  foreach ($items as $key => $item) {
421  $options[$key] = $item;
422  }
423  // BEGIN PATCH Lucene search
424  return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
425  // END PATCH Lucene Search
426  return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
427  }
438  // BEGIN PATCH Lucene search
439  public static function _getIntendedEndUserRoleSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
440  // END PATCH Lucene Search
441  {
442  global $DIC;
443 
444  $lng = $DIC['lng'];
445 
446  $items = array('Teacher','Author','Learner','Manager');
447 
448  foreach ($prepend as $value => $translation) {
449  $options[$value] = $translation;
450  }
451 
452  foreach ($items as $item) {
453  $options[$item] = $item;
454  }
455  // BEGIN PATCH Lucene search
456  return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
457  // END PATCH Lucene Search
458  return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
459  }
469  // BEGIN PATCH Lucene search
470  public static function _getContextSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
471  // END PATCH Lucene Search
472  {
473  global $DIC;
474 
475  $lng = $DIC['lng'];
476 
477  $items = array('School','HigherEducation','Training','Other');
478 
479  foreach ($prepend as $value => $translation) {
480  $options[$value] = $translation;
481  }
482 
483  foreach ($items as $item) {
484  $options[$item] = $item;
485  }
486  // BEGIN PATCH Lucene search
487  return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
488  // END PATCH Lucene Search
489  return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
490  }
491 
492 
502  public static function _getLocationTypeSelect($a_selected, $a_name, $prepend = array())
503  {
504  global $DIC;
505 
506  $lng = $DIC['lng'];
507 
508  $items = array('LocalFile','Reference');
509 
510  foreach ($prepend as $value => $translation) {
511  $options[$value] = $translation;
512  }
513 
514  foreach ($items as $item) {
515  $options[$item] = $item;
516  }
517  return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
518  }
529  // BEGIN PATCH Lucene search
530  public static function _getDifficultySelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
531  // END PATCH Lucene Search
532  {
533  global $DIC;
534 
535  $lng = $DIC['lng'];
536 
537  $items = array(1 => 'VeryEasy',2 => 'Easy',3 => 'Medium',4 => 'Difficult',5 => 'VeryDifficult');
538 
539  foreach ($prepend as $value => $translation) {
540  $options[$value] = $translation;
541  }
542 
543  foreach ($items as $key => $item) {
544  $options[$key] = $item;
545  }
546  // BEGIN PATCH Lucene search
547  return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
548  // END PATCH Lucene Search
549  return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
550  }
561  public static function _getTypicalAgeRangeSelect($a_selected, $a_name, $prepend = array())
562  {
563  global $DIC;
564 
565  $lng = $DIC['lng'];
566 
567  foreach ($prepend as $value => $translation) {
568  $options[$value] = $translation;
569  }
570  for ($i = 1; $i < 100 ; $i++) {
571  $items[$i] = $i;
572  }
573  foreach ($items as $key => $item) {
574  $options[$key] = $item;
575  }
576  return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
577  }
578 
589  public static function _getTypicalLearningTimeSelect($a_selected, $a_name, $prepend = array())
590  {
591  global $DIC;
592 
593  $lng = $DIC['lng'];
594 
595  foreach ($prepend as $value => $translation) {
596  $options[$value] = $translation;
597  }
598  $items = array(15 => '15 ' . $lng->txt('minutes'),
599  30 => '30 ' . $lng->txt('minutes'),
600  45 => '45 ' . $lng->txt('minutes'),
601  60 => '1 ' . $lng->txt('hour'),
602  90 => '1 ' . $lng->txt('hour') . ' 30 ' . $lng->txt('minutes'),
603  120 => '2 ' . $lng->txt('hours'),
604  180 => '3 ' . $lng->txt('hours'),
605  240 => '4 ' . $lng->txt('hours'));
606 
607  foreach ($items as $key => $item) {
608  $options[$key] = $item;
609  }
610  return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
611  }
622  // BEGIN PATCH Lucene search
623  public static function _getCostsSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
624  // END PATCH Lucene Search
625  {
626  global $DIC;
627 
628  $lng = $DIC['lng'];
629 
630  $items = array('Yes','No');
631 
632  foreach ($prepend as $value => $translation) {
633  $options[$value] = $translation;
634  }
635 
636  foreach ($items as $item) {
637  $options[$item] = $item;
638  }
639  // BEGIN PATCH Lucene search
640  return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
641  // END PATCH Lucene Search
642  return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
643  }
654  // BEGIN PATCH Lucene search
655  public static function _getCopyrightAndOtherRestrictionsSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
656  // END PATCH Lucene Search
657  {
658  global $DIC;
659 
660  $lng = $DIC['lng'];
661 
662  $items = array('Yes','No');
663 
664  foreach ($prepend as $value => $translation) {
665  $options[$value] = $translation;
666  }
667 
668  foreach ($items as $item) {
669  $options[$item] = $item;
670  }
671  // BEGIN PATCH Lucene search
672  return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
673  // END PATCH Lucene Search
674  return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
675  }
686  // BEGIN PATCH Lucene search
687  public static function _getPurposeSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
688  // END PATCH Lucene Search
689  {
690  global $DIC;
691 
692  $lng = $DIC['lng'];
693 
694  $items = array('Discipline','Idea','Prerequisite','EducationalObjective','AccessibilityRestrictions',
695  'EducationalLevel','SkillLevel','SecurityLevel','Competency');
696 
697  foreach ($prepend as $value => $translation) {
698  $options[$value] = $translation;
699  }
700 
701  foreach ($items as $item) {
702  $options[$item] = $item;
703  }
704  // BEGIN PATCH Lucene search
705  return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
706  // END PATCH Lucene Search
707  return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
708  }
709 }
static _getCopyrightAndOtherRestrictionsSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta rights copyright and other restrictions All possible entries in meta_format are shown...
static _getIntendedEndUserRoleSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta educational intended end user role All possible entries in meta_format are shown...
static _getCostsSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta rights costs All possible entries in meta_format are shown.
static _getDurationSelect($a_selected, $a_name, $prepend=array())
Prepare a meta technical duration selector All possible entries in meta_format are shown...
static _getSemanticDensitySelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta educational semantic density All possible entries in meta_format are shown...
static _getLanguageSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta data language selector.
global $DIC
Definition: saml.php:7
static _getInteractivityLevelSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta educational interactivity level All possible entries in meta_format are shown...
$code
Definition: example_050.php:99
static _getLocationTypeSelect($a_selected, $a_name, $prepend=array())
Prepare a meta location type.
static _getLearningResourceTypeSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta educational learning resource type All possible entries in meta_format are shown...
static _getTypicalAgeRangeSelect($a_selected, $a_name, $prepend=array())
Prepare a meta educational typical age range All possible entries in meta_format are shown...
static _getStatusSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta lifecycle status selector.
static _getFormatSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta technical format selector All possible entries in meta_format are shown.
foreach($_POST as $key=> $value) $res
static _getBrowserSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta technical browser selector.
$lng
static _getDifficultySelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta educational difficulty All possible entries in meta_format are shown.
$query
static _getStructureSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta general structure selector.
$row
static _getOperatingSystemSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta technical os selector.
static _getContextSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta context.
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
static _getTypicalLearningTimeSelect($a_selected, $a_name, $prepend=array())
Prepare a meta educational typical learning time All possible entries in meta_format are shown...
static _getPurposeSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta rights copyright and other restrictions All possible entries in meta_format are shown...
global $ilDB
$i
Definition: disco.tpl.php:19
static _getRoleSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta lifecycle status selector.
$key
Definition: croninfo.php:18
static _getInteractivityTypeSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta educational interactivity type All possible entries in meta_format are shown...