ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilTestManScoringParticipantsTableGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once('./Services/Table/classes/class.ilTable2GUI.php');
6 
16 {
17  const PARENT_DEFAULT_CMD = 'showManScoringParticipantsTable';
18  const PARENT_APPLY_FILTER_CMD = 'applyManScoringParticipantsFilter';
19  const PARENT_RESET_FILTER_CMD = 'resetManScoringParticipantsFilter';
20 
21  const PARENT_EDIT_SCORING_CMD = 'showManScoringParticipantScreen';
22 
28  public function __construct($parentObj)
29  {
30  parent::__construct($parentObj, self::PARENT_DEFAULT_CMD);
31 
32  $this->setFilterCommand(self::PARENT_APPLY_FILTER_CMD);
33  $this->setResetCommand(self::PARENT_RESET_FILTER_CMD);
34 
35  global $ilCtrl;
36 
37  $this->setPrefix('manScorePartTable');
38 
39  $this->setFormName('manScorePartTable');
40  $this->setStyle('table', 'fullwidth');
41 
42  $this->enable('header');
43 
44  $this->setFormAction($ilCtrl->getFormAction($parentObj, self::PARENT_DEFAULT_CMD));
45 
46  $this->setRowTemplate("tpl.il_as_tst_man_scoring_participant_tblrow.html", "Modules/Test");
47 
48  $this->initColumns();
49  $this->initOrdering();
50 
51  $this->initFilter();
52  }
53 
54  private function initColumns()
55  {
56  global $lng;
57 
58  if( $this->parent_obj->object->getAnonymity() )
59  {
60  $this->addColumn($lng->txt("name"),'lastname', '100%');
61  }
62  else
63  {
64  $this->addColumn($lng->txt("lastname"),'lastname', '');
65  $this->addColumn($lng->txt("firstname"),'firstname', '');
66  $this->addColumn($lng->txt("login"),'login', '');
67  }
68 
69  $this->addColumn('','', '1%');
70  }
71 
72  private function initOrdering()
73  {
74  $this->enable('sort');
75 
76  $this->setDefaultOrderField("lastname");
77  $this->setDefaultOrderDirection("asc");
78  }
79 
80  public function initFilter()
81  {
82  global $lng;
83 
84  $this->setDisableFilterHiding(true);
85 
86  include_once 'Services/Form/classes/class.ilSelectInputGUI.php';
87  $participantStatus = new ilSelectInputGUI($lng->txt('tst_participant_status'), 'participant_status');
88 
89  $statusOptions = array();
90  $statusOptions[ ilTestScoringGUI::PART_FILTER_ALL_USERS ] = $lng->txt("all_users");
91  $statusOptions[ ilTestScoringGUI::PART_FILTER_ACTIVE_ONLY ] = $lng->txt("usr_active_only");
92  $statusOptions[ ilTestScoringGUI::PART_FILTER_INACTIVE_ONLY ] = $lng->txt("usr_inactive_only");
93  $statusOptions[ ilTestScoringGUI::PART_FILTER_MANSCORING_DONE ] = $lng->txt("manscoring_done");
94  $statusOptions[ ilTestScoringGUI::PART_FILTER_MANSCORING_NONE ] = $lng->txt("manscoring_none");
95  //$statusOptions[ ilTestScoringGUI::PART_FILTER_MANSCORING_PENDING ] = $lng->txt("manscoring_pending");
96 
97  $participantStatus->setOptions($statusOptions);
98 
99  $this->addFilterItem($participantStatus);
100 
101  $participantStatus->readFromSession();
102 
103  if(!$participantStatus->getValue())
104  {
105  $participantStatus->setValue(ilTestScoringGUI::PART_FILTER_ALL_USERS);
106  }
107 
108  }
109 
115  public function fillRow($row)
116  {
117  //vd($row);
118 
119  global $ilCtrl, $lng;
120 
121  $ilCtrl->setParameter($this->parent_obj, 'active_id', $row['active_id']);
122 
123  if( !$this->parent_obj->object->getAnonymity() )
124  {
125  $this->tpl->setCurrentBlock('personal');
126  $this->tpl->setVariable("PARTICIPANT_FIRSTNAME", $row['firstname']);
127  $this->tpl->setVariable("PARTICIPANT_LOGIN", $row['login']);
128  $this->tpl->parseCurrentBlock();
129  }
130 
131  $this->tpl->setVariable("PARTICIPANT_LASTNAME", $row['lastname']);
132 
133  $this->tpl->setVariable("HREF_SCORE_PARTICIPANT", $ilCtrl->getLinkTarget($this->parent_obj, self::PARENT_EDIT_SCORING_CMD));
134  $this->tpl->setVariable("TXT_SCORE_PARTICIPANT", $lng->txt('tst_edit_scoring'));
135  }
136 }