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