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