ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilExerciseVerificationTableGUI.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 
13 {
20  public function __construct($a_parent_obj, $a_parent_cmd = "")
21  {
22  global $ilCtrl;
23 
24  parent::__construct($a_parent_obj, $a_parent_cmd);
25 
26  $this->addColumn($this->lng->txt("title"), "title");
27  $this->addColumn($this->lng->txt("passed"), "passed");
28  $this->addColumn($this->lng->txt("action"), "");
29 
30  $this->setTitle($this->lng->txt("excv_create"));
31  $this->setDescription($this->lng->txt("excv_create_info"));
32 
33  $this->setRowTemplate("tpl.exc_verification_row.html", "Modules/Exercise");
34  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
35 
36  $this->getItems();
37  }
38 
42  protected function getItems()
43  {
44  global $ilUser;
45 
46  include_once "Modules/Exercise/classes/class.ilObjExercise.php";
47 
48  $data = array();
49  foreach(ilObjExercise::_lookupFinishedUserExercises($ilUser->getId()) as $exercise_id => $passed)
50  {
51  // #11210 - only available certificates!
52  $exc = new ilObjExercise($exercise_id, false);
53  if($exc->hasUserCertificate($ilUser->getId()))
54  {
55  $adapter = new ilExerciseCertificateAdapter($exc);
56  if(ilCertificate::_isComplete($adapter))
57  {
58  $data[] = array("id" => $exercise_id,
59  "title" => ilObject::_lookupTitle($exercise_id),
60  "passed" => $passed);
61  }
62  }
63  }
64 
65  $this->setData($data);
66  }
67 
73  protected function fillRow($a_set)
74  {
75  global $ilCtrl;
76 
77  $this->tpl->setVariable("TITLE", $a_set["title"]);
78  $this->tpl->setVariable("PASSED", ($a_set["passed"]) ? $this->lng->txt("yes") :
79  $this->lng->txt("no"));
80  $this->tpl->setVariable("TXT_SELECT", $this->lng->txt("select"));
81 
82  $ilCtrl->setParameter($this->parent_obj, "exc_id", $a_set["id"]);
83  $action = $ilCtrl->getLinkTarget($this->parent_obj, "save");
84  $this->tpl->setVariable("URL_SELECT", $action);
85  }
86 }
87 
88 ?>