ILIAS  release_4-3 Revision
 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("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_instruction"), "", "40%");
45  $this->addColumn($this->lng->txt("actions"));
46 
47  $this->setDefaultOrderField("val_order");
48  $this->setDefaultOrderDirection("asc");
49 
50  //$this->setDefaultOrderField("name");
51  //$this->setDefaultOrderDirection("asc");
52 
53  $this->setEnableHeader(true);
54  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
55  $this->setRowTemplate("tpl.exc_assignments_row.html", "Modules/Exercise");
56  //$this->disable("footer");
57  $this->setEnableTitle(true);
58  $this->setSelectAllCheckbox("id");
59 
60  $this->addMultiCommand("confirmAssignmentsDeletion", $lng->txt("delete"));
61 
62  $this->addCommandButton("orderAssignmentsByDeadline", $lng->txt("exc_order_by_deadline"));
63  $this->addCommandButton("saveAssignmentOrder", $lng->txt("exc_save_order"));
64  //$this->addCommandButton("addAssignment", $lng->txt("exc_add_assignment"));
65 
66  $types_map = array(
67  ilExAssignment::TYPE_UPLOAD => $lng->txt("exc_type_upload"),
68  ilExAssignment::TYPE_UPLOAD_TEAM => $lng->txt("exc_type_upload_team"),
69  ilExAssignment::TYPE_BLOG => $lng->txt("exc_type_blog"),
70  ilExAssignment::TYPE_PORTFOLIO => $lng->txt("exc_type_portfolio")
71  );
72 
73  include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
75  foreach($data as $idx => $row)
76  {
77  $data[$idx]["type"] = $types_map[$row["type"]];
78  }
79 
80  $this->setData($data);
81  }
82 
83  function numericOrdering($a_field)
84  {
85  // #12000
86  if(in_array($a_field, array("order_val", "deadline", "start_time")))
87  {
88  return true;
89  }
90  return false;
91  }
92 
96  protected function fillRow($d)
97  {
98  global $lng, $ilCtrl;
99 
100  $this->tpl->setVariable("ID", $d["id"]);
101  if ($d["deadline"] > 0)
102  {
103  $this->tpl->setVariable("TXT_DEADLINE",
105  }
106  if ($d["start_time"] > 0)
107  {
108  $this->tpl->setVariable("TXT_START_TIME",
110  }
111  $this->tpl->setVariable("TXT_INSTRUCTIONS",
112  ilUtil::shortenText($d["instruction"], 200, true));
113 
114  if ($d["mandatory"])
115  {
116  $this->tpl->setVariable("TXT_MANDATORY", $lng->txt("yes"));
117  }
118  else
119  {
120  $this->tpl->setVariable("TXT_MANDATORY", $lng->txt("no"));
121  }
122 
123  $this->tpl->setVariable("TXT_TITLE", $d["title"]);
124  $this->tpl->setVariable("TXT_TYPE", $d["type"]);
125  $this->tpl->setVariable("ORDER_VAL", $d["order_val"]);
126 
127  $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
128  $ilCtrl->setParameter($this->parent_obj, "ass_id", $d["id"]);
129  $this->tpl->setVariable("CMD_EDIT",
130  $ilCtrl->getLinkTarget($this->parent_obj, "editAssignment"));
131  }
132 
133 }
134 ?>