ILIAS  Release_4_2_x_branch Revision 61807
 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_BLOG => $lng->txt("exc_type_blog"),
69  ilExAssignment::TYPE_PORTFOLIO => $lng->txt("exc_type_portfolio")
70  );
71 
72  include_once("./Modules/Exercise/classes/class.ilExAssignment.php");
74  foreach($data as $idx => $row)
75  {
76  $data[$idx]["type"] = $types_map[$row["type"]];
77  }
78 
79  $this->setData($data);
80  }
81 
85  protected function fillRow($d)
86  {
87  global $lng, $ilCtrl;
88 
89  $this->tpl->setVariable("ID", $d["id"]);
90  $this->tpl->setVariable("TXT_DEADLINE",
92  if ($d["start_time"] > 0)
93  {
94  $this->tpl->setVariable("TXT_START_TIME",
96  }
97  $this->tpl->setVariable("TXT_INSTRUCTIONS",
98  ilUtil::shortenText($d["instruction"], 200, true));
99 
100  if ($d["mandatory"])
101  {
102  $this->tpl->setVariable("TXT_MANDATORY", $lng->txt("yes"));
103  }
104  else
105  {
106  $this->tpl->setVariable("TXT_MANDATORY", $lng->txt("no"));
107  }
108 
109  $this->tpl->setVariable("TXT_TITLE", $d["title"]);
110  $this->tpl->setVariable("TXT_TYPE", $d["type"]);
111  $this->tpl->setVariable("ORDER_VAL", $d["order_val"]);
112 
113  $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
114  $ilCtrl->setParameter($this->parent_obj, "ass_id", $d["id"]);
115  $this->tpl->setVariable("CMD_EDIT",
116  $ilCtrl->getLinkTarget($this->parent_obj, "editAssignment"));
117  }
118 
119 }
120 ?>