ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
class.ilTestPassOverviewTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/Table/classes/class.ilTable2GUI.php';
5
10{
14 const CONTEXT_SHORT = 1;
15
19 const CONTEXT_LONG = 2;
20
24 protected $pdf_view = false;
25
31 public function __construct($parent, $cmd, $context = self::CONTEXT_SHORT, $pdf_view = false)
32 {
33 $this->pdf_view = $pdf_view;
34
35 $this->setId('tst_pass_overview_' . $context . '_' . $parent->object->getId());
36 $this->setDefaultOrderField('pass');
37 $this->setDefaultOrderDirection('ASC');
38
39 parent::__construct($parent, $cmd, $context);
40
41 // Don't set any limit because of print/pdf views. Furthermore, this view is part of different summary views, and no cmd ist passed to he calling method.
42 $this->setLimit(PHP_INT_MAX);
43 if($this->pdf_view)
44 {
45 $this->disable('linkbar');
46 $this->disable('numinfo');
47 $this->disable('numinfo_header');
48 $this->disable('hits');
49 }
50 $this->disable('sort');
51
52 $this->initColumns();
53 $this->setRowTemplate('tpl.il_as_tst_pass_overview_row.html', 'Modules/Test');
54 }
55
60 public function numericOrdering($field)
61 {
62 switch($field)
63 {
64 case 'pass':
65 case 'date':
66 case 'percentage':
67 return true;
68 }
69
70 return false;
71 }
72
76 public function fillRow(array $row)
77 {
82
83 if(array_key_exists('percentage', $row))
84 {
85 $row['percentage'] = sprintf('%.2f', $row['percentage']) . '%';
86 }
87
88 if($this->pdf_view && array_key_exists('pass_details', $row))
89 {
90 unset($row['pass_details']);
91 }
92
93 parent::fillRow($row);
94 }
95
99 protected function initColumns()
100 {
101 if(self::CONTEXT_LONG == $this->getContext())
102 {
103 $this->addColumn($this->lng->txt('scored_pass'), '', '150');
104 }
105 $this->addColumn($this->lng->txt('pass'), '', '1%');
106 $this->addColumn($this->lng->txt('date'));
107 if(self::CONTEXT_LONG == $this->getContext())
108 {
109 $this->addColumn($this->lng->txt('tst_answered_questions'));
110 if($this->getParentObject()->object->isOfferingQuestionHintsEnabled())
111 {
112 $this->addColumn($this->lng->txt('tst_question_hints_requested_hint_count_header'));
113 }
114 $this->addColumn($this->lng->txt('tst_reached_points'));
115 $this->addColumn($this->lng->txt('tst_percent_solved'));
116 }
117 // pass details menu
118 if(!$this->pdf_view)
119 {
120 $this->addColumn('', '', '10%' );
121 }
122 }
123}
const IL_CAL_UNIX
static setUseRelativeDates($a_status)
set use relative dates
static formatDate(ilDateTime $date)
Format a date @access public.
static useRelativeDates()
check if relative dates are used
@classDescription Date and time handling
Class ilTable2GUI.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="")
Add a column to the header.
getParentObject()
Get parent object.
getContext()
Get context.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setId($a_val)
Set id.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
disable($a_module_name)
diesables particular modules of table
setLimit($a_limit=0, $a_default_limit=0)
set max.
Class ilTestPassOverviewTableGUI.
__construct($parent, $cmd, $context=self::CONTEXT_SHORT, $pdf_view=false)
$cmd
Definition: sahs_server.php:35