ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $lng;
50
52 $tmp_options[$code] = $lng->txt('meta_l_' . $code);
53 }
54 asort($tmp_options, SORT_STRING);
55
56 foreach ($prepend as $value => $translation) {
57 $options[$value] = $translation;
58 }
59 $options = array_merge($options, $tmp_options);
60 // BEGIN PATCH Lucene search
61 return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
62 // END PATCH Lucene Search
63 return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
64 }
65
75 // BEGIN PATCH Lucene search
76 public static function _getStructureSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
77 // END PATCH Lucene Search
78 {
79 global $lng;
80
81 $items = array('Atomic','Collection','Networked','Hierarchical','Linear');
82
83 foreach ($prepend as $value => $translation) {
84 $options[$value] = $translation;
85 }
86
87 foreach ($items as $item) {
88 $options[$item] = $lng->txt('meta_' . strtolower($item));
89 }
90 // BEGIN PATCH Lucene search
91 return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
92 // END PATCH Lucene Search
93 return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
94 }
104 // BEGIN PATCH Lucene search
105 public static function _getStatusSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
106 // END PATCH Lucene Search
107 {
108 global $lng;
109
110 $items = array('Draft','Final','Revised','Unavailable');
111
112 foreach ($prepend as $value => $translation) {
113 $options[$value] = $translation;
114 }
115
116 foreach ($items as $item) {
117 $options[$item] = $lng->txt('meta_' . strtolower($item));
118 }
119 // BEGIN PATCH Lucene search
120 return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
121 // END PATCH Lucene Search
122 return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
123 }
133 // BEGIN PATCH Lucene search
134 public static function _getRoleSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
135 // END PATCH Lucene Search
136 {
137 global $lng;
138
139 $items = array('Author','Publisher','Unknown','Initiator','Terminator','Editor','GraphicalDesigner','TechnicalImplementer',
140 'ContentProvider','TechnicalValidator','EducationalValidator','ScriptWriter','InstructionalDesigner',
141 'SubjectMatterExpert','Creator','Validator','PointOfContact');
142
143 foreach ($prepend as $value => $translation) {
144 $options[$value] = $translation;
145 }
146
147 foreach ($items as $item) {
148 $options[$item] = $lng->txt('meta_' . strtolower($item));
149 }
150 // BEGIN PATCH Lucene search
151 return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
152 // END PATCH Lucene Search
153 return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
154 }
164 // BEGIN PATCH Lucene search
165 public static function _getOperatingSystemSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
166 // END PATCH Lucene Search
167 {
168 global $lng;
169
170 $items = array('PC-DOS','MS-Windows','MAC-OS','Unix','Multi-OS','None');
171
172 foreach ($prepend as $value => $translation) {
173 $options[$value] = $translation;
174 }
175
176 foreach ($items as $item) {
177 $options[$item] = $item;
178 }
179 // BEGIN PATCH Lucene search
180 return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
181 // END PATCH Lucene Search
182 return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
183 }
193 // BEGIN PATCH Lucene search
194 public static function _getBrowserSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
195 // END PATCH Lucene Search
196 {
197 global $lng;
198
199 $items = array('Any','NetscapeCommunicator','MS-InternetExplorer','Opera','Amaya','Mozilla');
200
201 foreach ($prepend as $value => $translation) {
202 $options[$value] = $translation;
203 }
204
205 foreach ($items as $item) {
206 $options[$item] = $item;
207 }
208 // BEGIN PATCH Lucene search
209 return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
210 // END PATCH Lucene Search
211 return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
212 }
223 // BEGIN PATCH Lucene search
224 public static function _getFormatSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
225 // END PATCH Lucene Search
226 {
227 global $lng,$ilDB;
228
229 foreach ($prepend as $value => $translation) {
230 $options[$value] = $translation;
231 }
232
233 $ilDB->setLimit(200, 0);
234 // In case an index is defined on field il_meta_format, this group by
235 // statement takes advantage of it to improve the performance of the query.
236 $query = "SELECT format as forma from il_meta_format GROUP BY format";
237 $res = $ilDB->query($query);
238 if (!$res->numRows()) {
239 return '';
240 }
241 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
242 if (strlen($row->format)) {
243 $options[$row->format] = substr($row->format, 0, 48);
244 }
245 }
246
247 // BEGIN PATCH Lucene search
248 return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
249 // END PATCH Lucene Search
250 return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
251 }
262 public static function _getDurationSelect($a_selected, $a_name, $prepend = array())
263 {
264 global $lng;
265
266 foreach ($prepend as $value => $translation) {
267 $options[$value] = $translation;
268 }
269
270 $items = array(15 => '15 ' . $lng->txt('minutes'),
271 30 => '30 ' . $lng->txt('minutes'),
272 45 => '45 ' . $lng->txt('minutes'),
273 60 => '1 ' . $lng->txt('hour'),
274 90 => '1 ' . $lng->txt('hour') . ' 30 ' . $lng->txt('minutes'),
275 120 => '2 ' . $lng->txt('hours'),
276 180 => '3 ' . $lng->txt('hours'),
277 240 => '4 ' . $lng->txt('hours'));
278
279 foreach ($items as $key => $item) {
280 $options[$key] = $item;
281 }
282 return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
283 }
294 // BEGIN PATCH Lucene search
295 public static function _getInteractivityTypeSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
296 // END PATCH Lucene Search
297 {
298 global $lng;
299
300 $items = array('Actice','Expositive','Mixed');
301
302 foreach ($prepend as $value => $translation) {
303 $options[$value] = $translation;
304 }
305
306 foreach ($items as $item) {
307 $options[$item] = $item;
308 }
309 // BEGIN PATCH Lucene search
310 return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
311 // END PATCH Lucene Search
312 return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
313 }
324 // BEGIN PATCH Lucene search
325 public static function _getLearningResourceTypeSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
326 // END PATCH Lucene Search
327 {
328 global $lng;
329
330 $items = array('Exercise','Simulation','Questionnaire','Diagram','Figure','Graph','Index',
331 'Slide','Table','NarrativeText','Exam','Experiment','ProblemStatement','SelfAssessment','Lecture');
332
333 foreach ($prepend as $value => $translation) {
334 $options[$value] = $translation;
335 }
336
337 foreach ($items as $item) {
338 $options[$item] = $item;
339 }
340 // BEGIN PATCH Lucene search
341 return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
342 // END PATCH Lucene Search
343 return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
344 }
355 public static function _getInteractivityLevelSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
356 {
357 global $lng;
358
359 $items = array(1 => 'VeryLow',2 => 'Low',3 => 'Medium',4 => 'High',5 => 'VeryHigh');
360
361 foreach ($prepend as $value => $translation) {
362 $options[$value] = $translation;
363 }
364
365 foreach ($items as $key => $item) {
366 $options[$key] = $item;
367 }
368 // BEGIN PATCH Lucene search
369 return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
370 // END PATCH Lucene Search
371 return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
372 }
383 // BEGIN PATCH Lucene search
384 public static function _getSemanticDensitySelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
385 // END PATCH Lucene Search
386 {
387 global $lng;
388
389 $items = array(1 => 'VeryLow',2 => 'Low',3 => 'Medium',4 => 'High',5 => 'VeryHigh');
390
391 foreach ($prepend as $value => $translation) {
392 $options[$value] = $translation;
393 }
394
395 foreach ($items as $key => $item) {
396 $options[$key] = $item;
397 }
398 // BEGIN PATCH Lucene search
399 return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
400 // END PATCH Lucene Search
401 return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
402 }
413 // BEGIN PATCH Lucene search
414 public static function _getIntendedEndUserRoleSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
415 // END PATCH Lucene Search
416 {
417 global $lng;
418
419 $items = array('Teacher','Author','Learner','Manager');
420
421 foreach ($prepend as $value => $translation) {
422 $options[$value] = $translation;
423 }
424
425 foreach ($items as $item) {
426 $options[$item] = $item;
427 }
428 // BEGIN PATCH Lucene search
429 return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
430 // END PATCH Lucene Search
431 return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
432 }
442 // BEGIN PATCH Lucene search
443 public static function _getContextSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
444 // END PATCH Lucene Search
445 {
446 global $lng;
447
448 $items = array('School','HigherEducation','Training','Other');
449
450 foreach ($prepend as $value => $translation) {
451 $options[$value] = $translation;
452 }
453
454 foreach ($items as $item) {
455 $options[$item] = $item;
456 }
457 // BEGIN PATCH Lucene search
458 return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
459 // END PATCH Lucene Search
460 return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
461 }
462
463
473 public static function _getLocationTypeSelect($a_selected, $a_name, $prepend = array())
474 {
475 global $lng;
476
477 $items = array('LocalFile','Reference');
478
479 foreach ($prepend as $value => $translation) {
480 $options[$value] = $translation;
481 }
482
483 foreach ($items as $item) {
484 $options[$item] = $item;
485 }
486 return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
487 }
498 // BEGIN PATCH Lucene search
499 public static function _getDifficultySelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
500 // END PATCH Lucene Search
501 {
502 global $lng;
503
504 $items = array(1 => 'VeryEasy',2 => 'Easy',3 => 'Medium',4 => 'Difficult',5 => 'VeryDifficult');
505
506 foreach ($prepend as $value => $translation) {
507 $options[$value] = $translation;
508 }
509
510 foreach ($items as $key => $item) {
511 $options[$key] = $item;
512 }
513 // BEGIN PATCH Lucene search
514 return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
515 // END PATCH Lucene Search
516 return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
517 }
528 public static function _getTypicalAgeRangeSelect($a_selected, $a_name, $prepend = array())
529 {
530 global $lng;
531
532 foreach ($prepend as $value => $translation) {
533 $options[$value] = $translation;
534 }
535 for ($i = 1; $i < 100 ; $i++) {
536 $items[$i] = $i;
537 }
538 foreach ($items as $key => $item) {
539 $options[$key] = $item;
540 }
541 return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
542 }
543
554 public static function _getTypicalLearningTimeSelect($a_selected, $a_name, $prepend = array())
555 {
556 global $lng;
557
558 foreach ($prepend as $value => $translation) {
559 $options[$value] = $translation;
560 }
561 $items = array(15 => '15 ' . $lng->txt('minutes'),
562 30 => '30 ' . $lng->txt('minutes'),
563 45 => '45 ' . $lng->txt('minutes'),
564 60 => '1 ' . $lng->txt('hour'),
565 90 => '1 ' . $lng->txt('hour') . ' 30 ' . $lng->txt('minutes'),
566 120 => '2 ' . $lng->txt('hours'),
567 180 => '3 ' . $lng->txt('hours'),
568 240 => '4 ' . $lng->txt('hours'));
569
570 foreach ($items as $key => $item) {
571 $options[$key] = $item;
572 }
573 return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
574 }
585 // BEGIN PATCH Lucene search
586 public static function _getCostsSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
587 // END PATCH Lucene Search
588 {
589 global $lng;
590
591 $items = array('Yes','No');
592
593 foreach ($prepend as $value => $translation) {
594 $options[$value] = $translation;
595 }
596
597 foreach ($items as $item) {
598 $options[$item] = $item;
599 }
600 // BEGIN PATCH Lucene search
601 return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
602 // END PATCH Lucene Search
603 return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
604 }
615 // BEGIN PATCH Lucene search
616 public static function _getCopyrightAndOtherRestrictionsSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
617 // END PATCH Lucene Search
618 {
619 global $lng;
620
621 $items = array('Yes','No');
622
623 foreach ($prepend as $value => $translation) {
624 $options[$value] = $translation;
625 }
626
627 foreach ($items as $item) {
628 $options[$item] = $item;
629 }
630 // BEGIN PATCH Lucene search
631 return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
632 // END PATCH Lucene Search
633 return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
634 }
645 // BEGIN PATCH Lucene search
646 public static function _getPurposeSelect($a_selected, $a_name, $prepend = array(), $a_options_only = false)
647 // END PATCH Lucene Search
648 {
649 global $lng;
650
651 $items = array('Discipline','Idea','Prerequisite','EducationalObjective','AccessibilityRestrictions',
652 'EducationalLevel','SkillLevel','SecurityLevel','Competency');
653
654 foreach ($prepend as $value => $translation) {
655 $options[$value] = $translation;
656 }
657
658 foreach ($items as $item) {
659 $options[$item] = $item;
660 }
661 // BEGIN PATCH Lucene search
662 return $a_options_only ? $options : ilUtil::formSelect($a_selected, $a_name, $options, false, true);
663 // END PATCH Lucene Search
664 return ilUtil::formSelect($a_selected, $a_name, $options, false, true);
665 }
666}
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
An exception for terminatinating execution or to throw for unit testing.
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.
static _getLocationTypeSelect($a_selected, $a_name, $prepend=array())
Prepare a meta location type.
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.
static _getTypicalLearningTimeSelect($a_selected, $a_name, $prepend=array())
Prepare a meta educational typical learning time All possible entries in meta_format are shown.
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 _getOperatingSystemSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta technical os selector.
static _getStatusSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta lifecycle status selector.
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 _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.
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 _getBrowserSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta technical browser 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.
static _getLanguageSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta data language selector.
static _getDurationSelect($a_selected, $a_name, $prepend=array())
Prepare a meta technical duration selector 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 _getStructureSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta general structure selector.
static _getContextSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta context.
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 _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 _getRoleSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta lifecycle status selector.
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.
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.
$key
Definition: croninfo.php:18
$i
Definition: disco.tpl.php:19
$code
Definition: example_050.php:99
global $lng
Definition: privfeed.php:17
$query
foreach($_POST as $key=> $value) $res
global $ilDB