ILIAS  release_4-3 Revision
 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  // #11818
49  include_once "./Modules/Exercise/classes/class.ilExerciseCertificateAdapter.php";
50  include_once "./Services/Certificate/classes/class.ilCertificate.php";
51 
52  $data = array();
53  foreach(ilObjExercise::_lookupFinishedUserExercises($ilUser->getId()) as $exercise_id => $passed)
54  {
55  // #11210 - only available certificates!
56  $exc = new ilObjExercise($exercise_id, false);
57  if($exc->hasUserCertificate($ilUser->getId()))
58  {
59  $adapter = new ilExerciseCertificateAdapter($exc);
60  if(ilCertificate::_isComplete($adapter))
61  {
62  $data[] = array("id" => $exercise_id,
63  "title" => ilObject::_lookupTitle($exercise_id),
64  "passed" => $passed);
65  }
66  }
67  }
68 
69  $this->setData($data);
70  }
71 
77  protected function fillRow($a_set)
78  {
79  global $ilCtrl;
80 
81  $this->tpl->setVariable("TITLE", $a_set["title"]);
82  $this->tpl->setVariable("PASSED", ($a_set["passed"]) ? $this->lng->txt("yes") :
83  $this->lng->txt("no"));
84 
85  if($a_set["passed"])
86  {
87  $ilCtrl->setParameter($this->parent_obj, "exc_id", $a_set["id"]);
88  $action = $ilCtrl->getLinkTarget($this->parent_obj, "save");
89  $this->tpl->setVariable("URL_SELECT", $action);
90  $this->tpl->setVariable("TXT_SELECT", $this->lng->txt("select"));
91  }
92  }
93 }
94 
95 ?>