ILIAS  Release_4_0_x_branch Revision 61816
 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  parent::__construct($a_parent_obj, $a_parent_cmd);
48 
49  global $lng, $ilCtrl;
50 
51  $this->lng = $lng;
52  $this->ctrl = $ilCtrl;
53  $this->outputmode = $outputmode;
54 
55  $this->setFormName('printviewform');
56  $this->setStyle('table', 'fullwidth');
57  $this->addColumn($this->lng->txt("title"),'title', '');
58  $this->addColumn($this->lng->txt("description"),'description', '');
59  $this->addColumn($this->lng->txt("author"),'author', '');
60  $this->addColumn($this->lng->txt("question_type"),'ttype', '');
61  $this->addColumn($this->lng->txt("create_date"),'created', '');
62  $this->addColumn($this->lng->txt("last_update"),'updated', '');
63 
64  $this->addCommandButton('print', $this->lng->txt('print'), "javascript:window.print();return false;");
65 
66  $this->setRowTemplate("tpl.il_as_qpl_printview_row.html", "Modules/TestQuestionPool");
67 
68  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
69  $this->setDefaultOrderField("title");
70  $this->setDefaultOrderDirection("asc");
71  $this->setLimit(999);
72 
73  $this->enable('sort');
74  $this->enable('header');
75 // $this->disable('numinfo');
76  $this->disable('select_all');
77  }
78 
86  public function fillRow($data)
87  {
88  $this->tpl->setVariable("TITLE", ilUtil::prepareFormOutput($data['title']));
89  $this->tpl->setVariable("DESCRIPTION", ilUtil::prepareFormOutput($data['description']));
90  $this->tpl->setVariable("AUTHOR", ilUtil::prepareFormOutput($data['author']));
91  $this->tpl->setVariable("TYPE", ilUtil::prepareFormOutput($data['ttype']));
92  $this->tpl->setVariable("CREATED", ilDatePresentation::formatDate(new ilDate($data['created'],IL_CAL_UNIX)));
93  $this->tpl->setVariable("UPDATED", ilDatePresentation::formatDate(new ilDate($data['tstamp'],IL_CAL_UNIX)));
94  if ((strcmp($this->outputmode, "detailed") == 0) || (strcmp($this->outputmode, "detailed_printview") == 0))
95  {
96  $this->tpl->setCurrentBlock("overview_row_detail");
97  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
98  $question_gui = assQuestion::_instanciateQuestionGUI($data["question_id"]);
99  if (strcmp($this->outputmode, "detailed") == 0)
100  {
101  $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);
102  if (strlen($solutionoutput) == 0) $solutionoutput = $question_gui->getPreview();
103  $this->tpl->setVariable("DETAILS", $solutionoutput);
104  }
105  else
106  {
107  $this->tpl->setVariable("DETAILS", $question_gui->getPreview());
108  }
109  $this->tpl->parseCurrentBlock();
110  }
111  }
112 }
113 ?>