ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
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  function _getLanguageSelect($a_selected,$a_name,$prepend = array())
44  {
45  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
46 
47  global $lng;
48 
50  {
51  $tmp_options[$code] = $lng->txt('meta_l_'.$code);
52  }
53  asort($tmp_options,SORT_STRING);
54 
55  foreach($prepend as $value => $translation)
56  {
57  $options[$value] = $translation;
58  }
59  $options = array_merge($options,$tmp_options);
60  return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
61  }
62 
72  function _getStructureSelect($a_selected,$a_name,$prepend = array())
73  {
74  global $lng;
75 
76  $items = array('Atomic','Collection','Networked','Hierarchical','Linear');
77 
78  foreach($prepend as $value => $translation)
79  {
80  $options[$value] = $translation;
81  }
82 
83  foreach($items as $item)
84  {
85  $options[$item] = $lng->txt('meta_'.strtolower($item));
86  }
87  return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
88  }
98  function _getStatusSelect($a_selected,$a_name,$prepend = array())
99  {
100  global $lng;
101 
102  $items = array('Draft','Final','Revised','Unavailable');
103 
104  foreach($prepend as $value => $translation)
105  {
106  $options[$value] = $translation;
107  }
108 
109  foreach($items as $item)
110  {
111  $options[$item] = $lng->txt('meta_'.strtolower($item));
112  }
113  return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
114  }
124  function _getRoleSelect($a_selected,$a_name,$prepend = array())
125  {
126  global $lng;
127 
128  $items = array('Author','Publisher','Unknown','Initiator','Terminator','Editor','GraphicalDesigner','TechnicalImplementer',
129  'ContentProvider','TechnicalValidator','EducationalValidator','ScriptWriter','InstructionalDesigner',
130  'SubjectMatterExpert','Creator','Validator');
131 
132  foreach($prepend as $value => $translation)
133  {
134  $options[$value] = $translation;
135  }
136 
137  foreach($items as $item)
138  {
139  $options[$item] = $lng->txt('meta_'.strtolower($item));
140  }
141  return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
142  }
152  function _getOperatingSystemSelect($a_selected,$a_name,$prepend = array())
153  {
154  global $lng;
155 
156  $items = array('PC-DOS','MS-Windows','MAC-OS','Unix','Multi-OS','None');
157 
158  foreach($prepend as $value => $translation)
159  {
160  $options[$value] = $translation;
161  }
162 
163  foreach($items as $item)
164  {
165  $options[$item] = $item;
166  }
167  return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
168  }
178  function _getBrowserSelect($a_selected,$a_name,$prepend = array())
179  {
180  global $lng;
181 
182  $items = array('Any','NetscapeCommunicator','MS-InternetExplorer','Opera','Amaya','Mozilla');
183 
184  foreach($prepend as $value => $translation)
185  {
186  $options[$value] = $translation;
187  }
188 
189  foreach($items as $item)
190  {
191  $options[$item] = $item;
192  }
193  return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
194  }
205  function _getFormatSelect($a_selected,$a_name,$prepend = array())
206  {
207  global $lng,$ilDB;
208 
209  foreach($prepend as $value => $translation)
210  {
211  $options[$value] = $translation;
212  }
213 
214 
215  // In case an index is defined on field il_meta_format, this group by
216  // statement takes advantage of it to improve the performance of the query.
217  $query = "SELECT format as forma from il_meta_format GROUP BY format LIMIT 200";
218  $res = $ilDB->query($query);
219  if(!$res->numRows())
220  {
221  return '';
222  }
223  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
224  {
225  if(strlen($row->forma))
226  {
227  $options[$row->forma] = substr($row->forma,0,48);
228  }
229  }
230 
231  return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
232  }
243  function _getDurationSelect($a_selected,$a_name,$prepend = array())
244  {
245  global $lng;
246 
247  foreach($prepend as $value => $translation)
248  {
249  $options[$value] = $translation;
250  }
251 
252  $items = array(15 => '15 '.$this->lng->txt('minutes'),
253  30 => '30 '.$this->lng->txt('minutes'),
254  45 => '45 '.$this->lng->txt('minutes'),
255  60 => '1 '. $this->lng->txt('hour'),
256  90 => '1 '. $this->lng->txt('hour').' 30 '.$this->lng->txt('minutes'),
257  120 => '2 '.$this->lng->txt('hours'),
258  180 => '3 '.$this->lng->txt('hours'),
259  240 => '4 '.$this->lng->txt('hours'));
260 
261  foreach($items as $key => $item)
262  {
263  $options[$key] = $item;
264  }
265  return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
266  }
277  function _getInteractivityTypeSelect($a_selected,$a_name,$prepend = array())
278  {
279  global $lng;
280 
281  $items = array('Actice','Expositive','Mixed');
282 
283  foreach($prepend as $value => $translation)
284  {
285  $options[$value] = $translation;
286  }
287 
288  foreach($items as $item)
289  {
290  $options[$item] = $item;
291  }
292  return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
293  }
304  function _getLearningResourceTypeSelect($a_selected,$a_name,$prepend = array())
305  {
306  global $lng;
307 
308  $items = array('Exercise','Simulation','Questionnaire','Diagram','Figure','Graph','Index',
309  'Slide','Table','NarrativeText','Exam','Experiment','ProblemStatement','SelfAssessment','Lecture');
310 
311  foreach($prepend as $value => $translation)
312  {
313  $options[$value] = $translation;
314  }
315 
316  foreach($items as $item)
317  {
318  $options[$item] = $item;
319  }
320  return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
321  }
332  function _getInteractivityLevelSelect($a_selected,$a_name,$prepend = array())
333  {
334  global $lng;
335 
336  $items = array(1 => 'VeryLow',2 => 'Low',3 => 'Medium',4 => 'High',5 => 'VeryHigh');
337 
338  foreach($prepend as $value => $translation)
339  {
340  $options[$value] = $translation;
341  }
342 
343  foreach($items as $key => $item)
344  {
345  $options[$key] = $item;
346  }
347  return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
348  }
359  function _getSemanticDensitySelect($a_selected,$a_name,$prepend = array())
360  {
361  global $lng;
362 
363  $items = array(1 => 'VeryLow',2 => 'Low',3 => 'Medium',4 => 'High',5 => 'VeryHigh');
364 
365  foreach($prepend as $value => $translation)
366  {
367  $options[$value] = $translation;
368  }
369 
370  foreach($items as $key => $item)
371  {
372  $options[$key] = $item;
373  }
374  return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
375  }
386  function _getIntendedEndUserRoleSelect($a_selected,$a_name,$prepend = array())
387  {
388  global $lng;
389 
390  $items = array('Teacher','Author','Learner','Manager');
391 
392  foreach($prepend as $value => $translation)
393  {
394  $options[$value] = $translation;
395  }
396 
397  foreach($items as $item)
398  {
399  $options[$item] = $item;
400  }
401  return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
402  }
412  function _getContextSelect($a_selected,$a_name,$prepend = array())
413  {
414  global $lng;
415 
416  $items = array('School','HigherEducation','Training','Other');
417 
418  foreach($prepend as $value => $translation)
419  {
420  $options[$value] = $translation;
421  }
422 
423  foreach($items as $item)
424  {
425  $options[$item] = $item;
426  }
427  return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
428  }
429 
430 
440  function _getLocationTypeSelect($a_selected,$a_name,$prepend = array())
441  {
442  global $lng;
443 
444  $items = array('LocalFile','Reference');
445 
446  foreach($prepend as $value => $translation)
447  {
448  $options[$value] = $translation;
449  }
450 
451  foreach($items as $item)
452  {
453  $options[$item] = $item;
454  }
455  return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
456  }
467  function _getDifficultySelect($a_selected,$a_name,$prepend = array())
468  {
469  global $lng;
470 
471  $items = array(1 => 'VeryEasy',2 => 'Easy',3 => 'Medium',4 => 'Difficult',5 => 'VeryDifficult');
472 
473  foreach($prepend as $value => $translation)
474  {
475  $options[$value] = $translation;
476  }
477 
478  foreach($items as $key => $item)
479  {
480  $options[$key] = $item;
481  }
482  return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
483  }
494  function _getTypicalAgeRangeSelect($a_selected,$a_name,$prepend = array())
495  {
496  global $lng;
497 
498  foreach($prepend as $value => $translation)
499  {
500  $options[$value] = $translation;
501  }
502  for($i = 1; $i < 100 ; $i++)
503  {
504  $items[$i] = $i;
505  }
506  foreach($items as $key => $item)
507  {
508  $options[$key] = $item;
509  }
510  return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
511  }
512 
523  function _getTypicalLearningTimeSelect($a_selected,$a_name,$prepend = array())
524  {
525  global $lng;
526 
527  foreach($prepend as $value => $translation)
528  {
529  $options[$value] = $translation;
530  }
531  $items = array(15 => '15 '.$this->lng->txt('minutes'),
532  30 => '30 '.$this->lng->txt('minutes'),
533  45 => '45 '.$this->lng->txt('minutes'),
534  60 => '1 '. $this->lng->txt('hour'),
535  90 => '1 '. $this->lng->txt('hour').' 30 '.$this->lng->txt('minutes'),
536  120 => '2 '.$this->lng->txt('hours'),
537  180 => '3 '.$this->lng->txt('hours'),
538  240 => '4 '.$this->lng->txt('hours'));
539 
540  foreach($items as $key => $item)
541  {
542  $options[$key] = $item;
543  }
544  return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
545  }
556  function _getCostsSelect($a_selected,$a_name,$prepend = array())
557  {
558  global $lng;
559 
560  $items = array('Yes','No');
561 
562  foreach($prepend as $value => $translation)
563  {
564  $options[$value] = $translation;
565  }
566 
567  foreach($items as $item)
568  {
569  $options[$item] = $item;
570  }
571  return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
572  }
583  function _getCopyrightAndOtherRestrictionsSelect($a_selected,$a_name,$prepend = array())
584  {
585  global $lng;
586 
587  $items = array('Yes','No');
588 
589  foreach($prepend as $value => $translation)
590  {
591  $options[$value] = $translation;
592  }
593 
594  foreach($items as $item)
595  {
596  $options[$item] = $item;
597  }
598  return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
599  }
610  function _getPurposeSelect($a_selected,$a_name,$prepend = array())
611  {
612  global $lng;
613 
614  $items = array('Discipline','Idea','Prerequisite','EducationalObjective','AccessibilityRestrictions',
615  'EducationalLevel','SkillLevel','SecurityLevel','Competency');
616 
617  foreach($prepend as $value => $translation)
618  {
619  $options[$value] = $translation;
620  }
621 
622  foreach($items as $item)
623  {
624  $options[$item] = $item;
625  }
626  return ilUtil::formSelect($a_selected,$a_name,$options,false,true);
627  }
628 
629 
630 }