ILIAS  release_4-4 Revision
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 ?>
setDescription($a_val)
Set description.
_isComplete($adapter)
Checks the status of the certificate.
static _lookupTitle($a_id)
lookup object title
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilObjExercise.
Class ilTable2GUI.
List all completed exercises for current user.
addColumn($a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="")
Add a column to the header.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
static _lookupFinishedUserExercises($a_user_id)
Get all exercises for user.
global $ilUser
Definition: imgupload.php:15
setFormAction($a_form_action)
Set Form action parameter.
__construct($a_parent_obj, $a_parent_cmd="")
Constructor.