ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilTestSkillEvaluationToolbarGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once 'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
5 require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
6 require_once 'Services/Form/classes/class.ilSelectInputGUI.php';
7 
15 {
16  const SKILL_PROFILE_PARAM = 'skill_profile';
17 
21  private $ctrl;
22 
26  private $lng;
27 
28  private $parentGUI;
29  private $parentCMD;
30 
32 
34 
36 
37  private $testResultButtonEnabled = false;
38 
40  {
41  $this->ctrl = $ctrl;
42  $this->lng = $lng;
43 
44  $this->parentGUI = $parentGUI;
45  $this->parentCMD = $parentCMD;
46 
47  parent::__construct();
48  }
49 
51  {
52  $this->availableSkillProfiles = $availableSkillProfiles;
53  }
54 
55  public function getAvailableSkillProfiles()
56  {
58  }
59 
61  {
62  $this->noSkillProfileOptionEnabled = $noSkillProfileOptionEnabled;
63  }
64 
66  {
68  }
69 
71  {
72  $this->selectedEvaluationMode = $selectedEvaluationMode;
73  }
74 
75  public function getSelectedEvaluationMode()
76  {
78  }
79 
80  public function isTestResultButtonEnabled()
81  {
83  }
84 
86  {
87  $this->testResultButtonEnabled = $testResultButtonEnabled;
88  }
89 
90  public function build()
91  {
92  if( $this->isTestResultButtonEnabled() )
93  {
94  $link = ilLinkButton::getInstance(); // always returns a new instance
95  $link->setUrl($this->ctrl->getLinkTargetByClass('ilTestEvaluationGUI', 'outUserResultsOverview'));
96  $link->setCaption($this->lng->txt("tst_show_results"), false);
97  $this->addButtonInstance($link);
98 
99  $this->addSeparator();
100  }
101 
102  $this->setFormAction($this->ctrl->getFormAction($this->parentGUI));
103 
104  $select = new ilSelectInputGUI($this->lng->txt("tst_analysis"), self::SKILL_PROFILE_PARAM);
105  $select->setOptions($this->buildEvaluationModeOptionsArray());
106  $select->setValue($this->getSelectedEvaluationMode());
107  $this->addInputItem($select, true);
108 
109  $this->addFormButton($this->lng->txt("select"), $this->parentCMD);
110  }
111 
113  {
114  $options = array();
115 
116  if( $this->isNoSkillProfileOptionEnabled() )
117  {
118  $options[0] = $this->lng->txt('tst_all_test_competences');;
119  }
120 
121  foreach($this->getAvailableSkillProfiles() as $skillProfileId => $skillProfileTitle)
122  {
123  $options[$skillProfileId] = "{$this->lng->txt('tst_gap_analysis')}: {$skillProfileTitle}";
124  }
125 
126  return $options;
127  }
128 
129  public static function fetchSkillProfileParam($postData)
130  {
131  if( isset($postData[self::SKILL_PROFILE_PARAM]) )
132  {
133  return (int)$postData[self::SKILL_PROFILE_PARAM];
134  }
135 
136  return 0;
137  }
138 }
This class provides processing control methods.
This class represents a selection list property in a property form.
setNoSkillProfileOptionEnabled($noSkillProfileOptionEnabled)
addButtonInstance(ilButtonBase $a_button)
Add button instance.
addInputItem(ilToolbarItem $a_item, $a_output_label=false)
Add input item.
setFormAction($a_val, $a_multipart=false, $a_target="")
Set form action (if form action is set, toolbar is wrapped into form tags)
if(!is_array($argv)) $options
addFormButton($a_txt, $a_cmd, $a_acc_key="", $a_primary=false, $a_class=false)
Add form button to toolbar.
addSeparator()
Add separator.
setOptions($a_options)
Set Options.
Create styles array
The data for the language used.
__construct(ilCtrl $ctrl, ilLanguage $lng, $parentGUI, $parentCMD)
language handling