ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilAssignmentsTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Table/classes/class.ilTable2GUI.php");
5 include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
6 
16 {
17 
21  function __construct($a_parent_obj, $a_parent_cmd, $a_exc)
22  {
23  global $ilCtrl, $lng, $ilAccess, $lng;
24 
25  $this->exc = $a_exc;
26  $this->setId("excass".$a_exc->getId());
27 
28  parent::__construct($a_parent_obj, $a_parent_cmd);
29 
30  $this->setTitle($lng->txt("exc_assignments"));
31  $this->setTopCommands(true);
32 
33  // if you add pagination and disable the unlimited setting:
34  // fix saving of ordering of single pages!
35  $this->setLimit(9999);
36 
37  $this->addColumn("", "", "1", true);
38  $this->addColumn($this->lng->txt("title"), "title");
39  $this->addColumn($this->lng->txt("exc_assignment_type"), "type");
40  $this->addColumn($this->lng->txt("exc_presentation_order"), "order_val");
41  $this->addColumn($this->lng->txt("exc_start_time"), "start_time");
42  $this->addColumn($this->lng->txt("exc_deadline"), "deadline");
43  $this->addColumn($this->lng->txt("exc_mandatory"), "mandatory");
44  $this->addColumn($this->lng->txt("exc_peer_review"), "peer");
45  $this->addColumn($this->lng->txt("exc_instruction"), "", "30%");
46  $this->addColumn($this->lng->txt("actions"));
47 
48  $this->setDefaultOrderField("val_order");
49  $this->setDefaultOrderDirection("asc");
50 
51  //$this->setDefaultOrderField("name");
52  //$this->setDefaultOrderDirection("asc");
53 
54  $this->setEnableHeader(true);
55  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
56  $this->setRowTemplate("tpl.exc_assignments_row.html", "Modules/Exercise");
57  //$this->disable("footer");
58  $this->setEnableTitle(true);
59  $this->setSelectAllCheckbox("id");
60 
61  $this->addMultiCommand("confirmAssignmentsDeletion", $lng->txt("delete"));
62 
63  $this->addCommandButton("orderAssignmentsByDeadline", $lng->txt("exc_order_by_deadline"));
64  $this->addCommandButton("saveAssignmentOrder", $lng->txt("exc_save_order"));
65  //$this->addCommandButton("addAssignment", $lng->txt("exc_add_assignment"));
66 
67  $types_map = array(
68  ilExAssignment::TYPE_UPLOAD => $lng->txt("exc_type_upload"),
69  ilExAssignment::TYPE_UPLOAD_TEAM => $lng->txt("exc_type_upload_team"),
70  ilExAssignment::TYPE_BLOG => $lng->txt("exc_type_blog"),
71  ilExAssignment::TYPE_PORTFOLIO => $lng->txt("exc_type_portfolio"),
72  ilExAssignment::TYPE_TEXT => $lng->txt("exc_type_text"),
73  );
74 
75  include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
77  foreach($data as $idx => $row)
78  {
79  $data[$idx]["type"] = $types_map[$row["type"]];
80  }
81 
82  $this->setData($data);
83  }
84 
85  function numericOrdering($a_field)
86  {
87  // #12000
88  if(in_array($a_field, array("order_val", "deadline", "start_time")))
89  {
90  return true;
91  }
92  return false;
93  }
94 
98  protected function fillRow($d)
99  {
100  global $lng, $ilCtrl;
101 
102  $this->tpl->setVariable("ID", $d["id"]);
103  if ($d["deadline"] > 0)
104  {
105  $this->tpl->setVariable("TXT_DEADLINE",
107  }
108  if ($d["start_time"] > 0)
109  {
110  $this->tpl->setVariable("TXT_START_TIME",
112  }
113  $this->tpl->setVariable("TXT_INSTRUCTIONS",
114  ilUtil::shortenText($d["instruction"], 200, true));
115 
116  if ($d["mandatory"])
117  {
118  $this->tpl->setVariable("TXT_MANDATORY", $lng->txt("yes"));
119  }
120  else
121  {
122  $this->tpl->setVariable("TXT_MANDATORY", $lng->txt("no"));
123  }
124 
125  if ($d["peer"])
126  {
127  $this->tpl->setVariable("TXT_PEER", $lng->txt("yes")." (".$d["peer_min"].")");
128  }
129  else
130  {
131  $this->tpl->setVariable("TXT_PEER", $lng->txt("no"));
132  }
133 
134  $this->tpl->setVariable("TXT_TITLE", $d["title"]);
135  $this->tpl->setVariable("TXT_TYPE", $d["type"]);
136  $this->tpl->setVariable("ORDER_VAL", $d["order_val"]);
137 
138  $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
139  $ilCtrl->setParameter($this->parent_obj, "ass_id", $d["id"]);
140  $this->tpl->setVariable("CMD_EDIT",
141  $ilCtrl->getLinkTarget($this->parent_obj, "editAssignment"));
142  }
143 
144 }
145 ?>