ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilQuestionPoolPrintViewTableGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 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 include_once('./Services/Table/classes/class.ilTable2GUI.php');
25 
35 {
36  protected $outputmode;
37 
45  public function __construct($a_parent_obj, $a_parent_cmd, $outputmode = '')
46  {
47  $this->setId("qpl_print");
48  parent::__construct($a_parent_obj, $a_parent_cmd);
49 
50  global $lng, $ilCtrl;
51 
52  $this->lng = $lng;
53  $this->ctrl = $ilCtrl;
54  $this->outputmode = $outputmode;
55 
56  $this->setFormName('printviewform');
57  $this->setStyle('table', 'fullwidth');
58  $this->addColumn($this->lng->txt("title"),'title', '');
59  foreach ($this->getSelectedColumns() as $c)
60  {
61  if (strcmp($c, 'description') == 0) $this->addColumn($this->lng->txt("description"),'description', '');
62  if (strcmp($c, 'author') == 0) $this->addColumn($this->lng->txt("author"),'author', '');
63  if (strcmp($c, 'ttype') == 0) $this->addColumn($this->lng->txt("question_type"),'ttype', '');
64  if (strcmp($c, 'created') == 0) $this->addColumn($this->lng->txt("create_date"),'created', '');
65  if (strcmp($c, 'updated') == 0) $this->addColumn($this->lng->txt("last_update"),'updated', '');
66  }
67 
68  $this->addCommandButton('print', $this->lng->txt('print'), "javascript:window.print();return false;");
69 
70  $this->setRowTemplate("tpl.il_as_qpl_printview_row.html", "Modules/TestQuestionPool");
71 
72  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
73  $this->setDefaultOrderField("title");
74  $this->setDefaultOrderDirection("asc");
75  $this->setLimit(999);
76 
77  $this->enable('sort');
78  $this->enable('header');
79 // $this->disable('numinfo');
80  $this->disable('select_all');
81  }
82 
84  {
85  global $lng;
86  $cols["description"] = array(
87  "txt" => $lng->txt("description"),
88  "default" => true
89  );
90  $cols["author"] = array(
91  "txt" => $lng->txt("author"),
92  "default" => true
93  );
94  $cols["ttype"] = array(
95  "txt" => $lng->txt("question_type"),
96  "default" => true
97  );
98  $cols["created"] = array(
99  "txt" => $lng->txt("create_date"),
100  "default" => true
101  );
102  $cols["updated"] = array(
103  "txt" => $lng->txt("last_update"),
104  "default" => true
105  );
106  return $cols;
107  }
108 
116  public function fillRow($data)
117  {
118  $this->tpl->setVariable("TITLE", ilUtil::prepareFormOutput($data['title']));
119  foreach ($this->getSelectedColumns() as $c)
120  {
121  if (strcmp($c, 'description') == 0)
122  {
123  $this->tpl->setCurrentBlock('description');
124  $this->tpl->setVariable("DESCRIPTION", ilUtil::prepareFormOutput($data['description']));
125  $this->tpl->parseCurrentBlock();
126  }
127  if (strcmp($c, 'author') == 0)
128  {
129  $this->tpl->setCurrentBlock('author');
130  $this->tpl->setVariable("AUTHOR", ilUtil::prepareFormOutput($data['author']));
131  $this->tpl->parseCurrentBlock();
132  }
133  if (strcmp($c, 'ttype') == 0)
134  {
135  $this->tpl->setCurrentBlock('ttype');
136  $this->tpl->setVariable("TYPE", ilUtil::prepareFormOutput($data['ttype']));
137  $this->tpl->parseCurrentBlock();
138  }
139  if (strcmp($c, 'created') == 0)
140  {
141  $this->tpl->setCurrentBlock('created');
142  $this->tpl->setVariable("CREATED", ilDatePresentation::formatDate(new ilDate($data['created'],IL_CAL_UNIX)));
143  $this->tpl->parseCurrentBlock();
144  }
145  if (strcmp($c, 'updated') == 0)
146  {
147  $this->tpl->setCurrentBlock('updated');
148  $this->tpl->setVariable("UPDATED", ilDatePresentation::formatDate(new ilDate($data['tstamp'],IL_CAL_UNIX)));
149  $this->tpl->parseCurrentBlock();
150  }
151  }
152  if ((strcmp($this->outputmode, "detailed") == 0) || (strcmp($this->outputmode, "detailed_printview") == 0))
153  {
154  $this->tpl->setCurrentBlock("overview_row_detail");
155  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
156  $question_gui = assQuestion::_instanciateQuestionGUI($data["question_id"]);
157  if (strcmp($this->outputmode, "detailed") == 0)
158  {
159  $solutionoutput = $question_gui->getSolutionOutput($active_id = "", $pass = NULL, $graphicalOutput = FALSE, $result_output = FALSE, $show_question_only = FALSE, $show_feedback = FALSE, $show_correct_solution = true, $show_manual_scoring = false);
160  if (strlen($solutionoutput) == 0) $solutionoutput = $question_gui->getPreview();
161  $this->tpl->setVariable("DETAILS", $solutionoutput);
162  }
163  else
164  {
165  $this->tpl->setVariable("DETAILS", $question_gui->getPreview());
166  }
167  $this->tpl->parseCurrentBlock();
168  }
169  }
170 }
171 ?>