ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 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 {
53 $tmp_options[$code] = $lng->txt('meta_l_'.$code);
54 }
55 asort($tmp_options,SORT_STRING);
56
57 foreach($prepend as $value => $translation)
58 {
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 function _getStructureSelect($a_selected,$a_name,$prepend = array(),$a_options_only = false)
79 // END PATCH Lucene Search
80 {
81 global $lng;
82
83 $items = array('Atomic','Collection','Networked','Hierarchical','Linear');
84
85 foreach($prepend as $value => $translation)
86 {
87 $options[$value] = $translation;
88 }
89
90 foreach($items as $item)
91 {
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 function _getStatusSelect($a_selected,$a_name,$prepend = array(), $a_options_only = false)
110 // END PATCH Lucene Search
111 {
112 global $lng;
113
114 $items = array('Draft','Final','Revised','Unavailable');
115
116 foreach($prepend as $value => $translation)
117 {
118 $options[$value] = $translation;
119 }
120
121 foreach($items as $item)
122 {
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 function _getRoleSelect($a_selected,$a_name,$prepend = array(),$a_options_only = false)
141 // END PATCH Lucene Search
142 {
143 global $lng;
144
145 $items = array('Author','Publisher','Unknown','Initiator','Terminator','Editor','GraphicalDesigner','TechnicalImplementer',
146 'ContentProvider','TechnicalValidator','EducationalValidator','ScriptWriter','InstructionalDesigner',
147 'SubjectMatterExpert','Creator','Validator','PointOfContact');
148
149 foreach($prepend as $value => $translation)
150 {
151 $options[$value] = $translation;
152 }
153
154 foreach($items as $item)
155 {
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 function _getOperatingSystemSelect($a_selected,$a_name,$prepend = array(), $a_options_only = false)
174 // END PATCH Lucene Search
175 {
176 global $lng;
177
178 $items = array('PC-DOS','MS-Windows','MAC-OS','Unix','Multi-OS','None');
179
180 foreach($prepend as $value => $translation)
181 {
182 $options[$value] = $translation;
183 }
184
185 foreach($items as $item)
186 {
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 function _getBrowserSelect($a_selected,$a_name,$prepend = array(), $a_options_only = false)
205 // END PATCH Lucene Search
206 {
207 global $lng;
208
209 $items = array('Any','NetscapeCommunicator','MS-InternetExplorer','Opera','Amaya','Mozilla');
210
211 foreach($prepend as $value => $translation)
212 {
213 $options[$value] = $translation;
214 }
215
216 foreach($items as $item)
217 {
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 function _getFormatSelect($a_selected,$a_name,$prepend = array(), $a_options_only = false)
237 // END PATCH Lucene Search
238 {
239 global $lng,$ilDB;
240
241 foreach($prepend as $value => $translation)
242 {
243 $options[$value] = $translation;
244 }
245
246 $ilDB->setLimit(200,0);
247 // In case an index is defined on field il_meta_format, this group by
248 // statement takes advantage of it to improve the performance of the query.
249 $query = "SELECT format as forma from il_meta_format GROUP BY format";
250 $res = $ilDB->query($query);
251 if(!$res->numRows())
252 {
253 return '';
254 }
255 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
256 {
257 if(strlen($row->format))
258 {
259 $options[$row->format] = substr($row->format,0,48);
260 }
261 }
262
263 // BEGIN PATCH Lucene search
264 return $a_options_only ? $options : ilUtil::formSelect($a_selected,$a_name,$options,false,true);
265 // END PATCH Lucene Search
266 return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
267 }
278 function _getDurationSelect($a_selected,$a_name,$prepend = array())
279 {
280 global $lng;
281
282 foreach($prepend as $value => $translation)
283 {
284 $options[$value] = $translation;
285 }
286
287 $items = array(15 => '15 '.$this->lng->txt('minutes'),
288 30 => '30 '.$this->lng->txt('minutes'),
289 45 => '45 '.$this->lng->txt('minutes'),
290 60 => '1 '. $this->lng->txt('hour'),
291 90 => '1 '. $this->lng->txt('hour').' 30 '.$this->lng->txt('minutes'),
292 120 => '2 '.$this->lng->txt('hours'),
293 180 => '3 '.$this->lng->txt('hours'),
294 240 => '4 '.$this->lng->txt('hours'));
295
296 foreach($items as $key => $item)
297 {
298 $options[$key] = $item;
299 }
300 return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
301 }
312 // BEGIN PATCH Lucene search
313 function _getInteractivityTypeSelect($a_selected,$a_name,$prepend = array(), $a_options_only = false)
314 // END PATCH Lucene Search
315 {
316 global $lng;
317
318 $items = array('Actice','Expositive','Mixed');
319
320 foreach($prepend as $value => $translation)
321 {
322 $options[$value] = $translation;
323 }
324
325 foreach($items as $item)
326 {
327 $options[$item] = $item;
328 }
329 // BEGIN PATCH Lucene search
330 return $a_options_only ? $options : ilUtil::formSelect($a_selected,$a_name,$options,false,true);
331 // END PATCH Lucene Search
332 return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
333 }
344 // BEGIN PATCH Lucene search
345 function _getLearningResourceTypeSelect($a_selected,$a_name,$prepend = array(), $a_options_only = false)
346 // END PATCH Lucene Search
347 {
348 global $lng;
349
350 $items = array('Exercise','Simulation','Questionnaire','Diagram','Figure','Graph','Index',
351 'Slide','Table','NarrativeText','Exam','Experiment','ProblemStatement','SelfAssessment','Lecture');
352
353 foreach($prepend as $value => $translation)
354 {
355 $options[$value] = $translation;
356 }
357
358 foreach($items as $item)
359 {
360 $options[$item] = $item;
361 }
362 // BEGIN PATCH Lucene search
363 return $a_options_only ? $options : ilUtil::formSelect($a_selected,$a_name,$options,false,true);
364 // END PATCH Lucene Search
365 return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
366 }
377 function _getInteractivityLevelSelect($a_selected,$a_name,$prepend = array(), $a_options_only = false)
378 {
379 global $lng;
380
381 $items = array(1 => 'VeryLow',2 => 'Low',3 => 'Medium',4 => 'High',5 => 'VeryHigh');
382
383 foreach($prepend as $value => $translation)
384 {
385 $options[$value] = $translation;
386 }
387
388 foreach($items as $key => $item)
389 {
390 $options[$key] = $item;
391 }
392 // BEGIN PATCH Lucene search
393 return $a_options_only ? $options : ilUtil::formSelect($a_selected,$a_name,$options,false,true);
394 // END PATCH Lucene Search
395 return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
396 }
407 // BEGIN PATCH Lucene search
408 function _getSemanticDensitySelect($a_selected,$a_name,$prepend = array(), $a_options_only = false)
409 // END PATCH Lucene Search
410 {
411 global $lng;
412
413 $items = array(1 => 'VeryLow',2 => 'Low',3 => 'Medium',4 => 'High',5 => 'VeryHigh');
414
415 foreach($prepend as $value => $translation)
416 {
417 $options[$value] = $translation;
418 }
419
420 foreach($items as $key => $item)
421 {
422 $options[$key] = $item;
423 }
424 // BEGIN PATCH Lucene search
425 return $a_options_only ? $options : ilUtil::formSelect($a_selected,$a_name,$options,false,true);
426 // END PATCH Lucene Search
427 return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
428 }
439 // BEGIN PATCH Lucene search
440 function _getIntendedEndUserRoleSelect($a_selected,$a_name,$prepend = array(), $a_options_only = false)
441 // END PATCH Lucene Search
442 {
443 global $lng;
444
445 $items = array('Teacher','Author','Learner','Manager');
446
447 foreach($prepend as $value => $translation)
448 {
449 $options[$value] = $translation;
450 }
451
452 foreach($items as $item)
453 {
454 $options[$item] = $item;
455 }
456 // BEGIN PATCH Lucene search
457 return $a_options_only ? $options : ilUtil::formSelect($a_selected,$a_name,$options,false,true);
458 // END PATCH Lucene Search
459 return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
460 }
470 // BEGIN PATCH Lucene search
471 function _getContextSelect($a_selected,$a_name,$prepend = array(), $a_options_only = false)
472 // END PATCH Lucene Search
473 {
474 global $lng;
475
476 $items = array('School','HigherEducation','Training','Other');
477
478 foreach($prepend as $value => $translation)
479 {
480 $options[$value] = $translation;
481 }
482
483 foreach($items as $item)
484 {
485 $options[$item] = $item;
486 }
487 // BEGIN PATCH Lucene search
488 return $a_options_only ? $options : ilUtil::formSelect($a_selected,$a_name,$options,false,true);
489 // END PATCH Lucene Search
490 return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
491 }
492
493
503 function _getLocationTypeSelect($a_selected,$a_name,$prepend = array())
504 {
505 global $lng;
506
507 $items = array('LocalFile','Reference');
508
509 foreach($prepend as $value => $translation)
510 {
511 $options[$value] = $translation;
512 }
513
514 foreach($items as $item)
515 {
516 $options[$item] = $item;
517 }
518 return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
519 }
530 // BEGIN PATCH Lucene search
531 function _getDifficultySelect($a_selected,$a_name,$prepend = array(), $a_options_only = false)
532 // END PATCH Lucene Search
533 {
534 global $lng;
535
536 $items = array(1 => 'VeryEasy',2 => 'Easy',3 => 'Medium',4 => 'Difficult',5 => 'VeryDifficult');
537
538 foreach($prepend as $value => $translation)
539 {
540 $options[$value] = $translation;
541 }
542
543 foreach($items as $key => $item)
544 {
545 $options[$key] = $item;
546 }
547 // BEGIN PATCH Lucene search
548 return $a_options_only ? $options : ilUtil::formSelect($a_selected,$a_name,$options,false,true);
549 // END PATCH Lucene Search
550 return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
551 }
562 function _getTypicalAgeRangeSelect($a_selected,$a_name,$prepend = array())
563 {
564 global $lng;
565
566 foreach($prepend as $value => $translation)
567 {
568 $options[$value] = $translation;
569 }
570 for($i = 1; $i < 100 ; $i++)
571 {
572 $items[$i] = $i;
573 }
574 foreach($items as $key => $item)
575 {
576 $options[$key] = $item;
577 }
578 return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
579 }
580
591 function _getTypicalLearningTimeSelect($a_selected,$a_name,$prepend = array())
592 {
593 global $lng;
594
595 foreach($prepend as $value => $translation)
596 {
597 $options[$value] = $translation;
598 }
599 $items = array(15 => '15 '.$this->lng->txt('minutes'),
600 30 => '30 '.$this->lng->txt('minutes'),
601 45 => '45 '.$this->lng->txt('minutes'),
602 60 => '1 '. $this->lng->txt('hour'),
603 90 => '1 '. $this->lng->txt('hour').' 30 '.$this->lng->txt('minutes'),
604 120 => '2 '.$this->lng->txt('hours'),
605 180 => '3 '.$this->lng->txt('hours'),
606 240 => '4 '.$this->lng->txt('hours'));
607
608 foreach($items as $key => $item)
609 {
610 $options[$key] = $item;
611 }
612 return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
613 }
624 // BEGIN PATCH Lucene search
625 function _getCostsSelect($a_selected,$a_name,$prepend = array(), $a_options_only = false)
626 // END PATCH Lucene Search
627 {
628 global $lng;
629
630 $items = array('Yes','No');
631
632 foreach($prepend as $value => $translation)
633 {
634 $options[$value] = $translation;
635 }
636
637 foreach($items as $item)
638 {
639 $options[$item] = $item;
640 }
641 // BEGIN PATCH Lucene search
642 return $a_options_only ? $options : ilUtil::formSelect($a_selected,$a_name,$options,false,true);
643 // END PATCH Lucene Search
644 return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
645 }
656 // BEGIN PATCH Lucene search
657 function _getCopyrightAndOtherRestrictionsSelect($a_selected,$a_name,$prepend = array(), $a_options_only = false)
658 // END PATCH Lucene Search
659 {
660 global $lng;
661
662 $items = array('Yes','No');
663
664 foreach($prepend as $value => $translation)
665 {
666 $options[$value] = $translation;
667 }
668
669 foreach($items as $item)
670 {
671 $options[$item] = $item;
672 }
673 // BEGIN PATCH Lucene search
674 return $a_options_only ? $options : ilUtil::formSelect($a_selected,$a_name,$options,false,true);
675 // END PATCH Lucene Search
676 return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
677 }
688 // BEGIN PATCH Lucene search
689 function _getPurposeSelect($a_selected,$a_name,$prepend = array(), $a_options_only = false)
690 // END PATCH Lucene Search
691 {
692 global $lng;
693
694 $items = array('Discipline','Idea','Prerequisite','EducationalObjective','AccessibilityRestrictions',
695 'EducationalLevel','SkillLevel','SecurityLevel','Competency');
696
697 foreach($prepend as $value => $translation)
698 {
699 $options[$value] = $translation;
700 }
701
702 foreach($items as $item)
703 {
704 $options[$item] = $item;
705 }
706 // BEGIN PATCH Lucene search
707 return $a_options_only ? $options : ilUtil::formSelect($a_selected,$a_name,$options,false,true);
708 // END PATCH Lucene Search
709 return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
710 }
711
712
713}
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
_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.
_getTypicalLearningTimeSelect($a_selected, $a_name, $prepend=array())
Prepare a meta educational typical learning time All possible entries in meta_format are shown.
_getRoleSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta lifecycle status selector.
_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.
_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.
_getDurationSelect($a_selected, $a_name, $prepend=array())
Prepare a meta technical duration selector All possible entries in meta_format are shown.
_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.
_getLanguageSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta data language selector.
_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.
_getCostsSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta rights costs All possible entries in meta_format are shown.
_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.
_getLocationTypeSelect($a_selected, $a_name, $prepend=array())
Prepare a meta location type.
_getDifficultySelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta educational difficulty All possible entries in meta_format are shown.
_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.
_getStatusSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta lifecycle status selector.
_getBrowserSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta technical browser selector.
_getTypicalAgeRangeSelect($a_selected, $a_name, $prepend=array())
Prepare a meta educational typical age range All possible entries in meta_format are shown.
_getOperatingSystemSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta technical os selector.
_getStructureSelect($a_selected, $a_name, $prepend=array(), $a_options_only=false)
Prepare a meta general structure selector.
_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.
_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.
$code
Definition: example_050.php:99
global $lng
Definition: privfeed.php:40
global $ilDB
if(!is_array($argv)) $options