ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 {
17  protected $user;
18 
25  public function __construct($a_parent_obj, $a_parent_cmd = "")
26  {
27  global $DIC;
28 
29  $this->ctrl = $DIC->ctrl();
30  $this->user = $DIC->user();
31  $ilCtrl = $DIC->ctrl();
32 
33  parent::__construct($a_parent_obj, $a_parent_cmd);
34 
35  $this->addColumn($this->lng->txt("title"), "title");
36  $this->addColumn($this->lng->txt("passed"), "passed");
37  $this->addColumn($this->lng->txt("action"), "");
38 
39  $this->setTitle($this->lng->txt("excv_create"));
40  $this->setDescription($this->lng->txt("excv_create_info"));
41 
42  $this->setRowTemplate("tpl.exc_verification_row.html", "Modules/Exercise");
43  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
44 
45  $this->getItems();
46  }
47 
51  protected function getItems()
52  {
54 
55  include_once "Modules/Exercise/classes/class.ilObjExercise.php";
56  include_once "./Modules/Exercise/classes/class.ilExerciseCertificateAdapter.php";
57  include_once "./Services/Certificate/classes/class.ilCertificate.php";
58 
59  $data = array();
60  foreach (ilObjExercise::_lookupFinishedUserExercises($ilUser->getId()) as $exercise_id => $passed) {
61  // #11210 - only available certificates!
62  $exc = new ilObjExercise($exercise_id, false);
63  if ($exc->hasUserCertificate($ilUser->getId())) {
66  $data[] = array("id" => $exercise_id,
67  "title" => ilObject::_lookupTitle($exercise_id),
68  "passed" => $passed);
69  }
70  }
71  }
72 
73  $this->setData($data);
74  }
75 
81  protected function fillRow($a_set)
82  {
84 
85  $this->tpl->setVariable("TITLE", $a_set["title"]);
86  $this->tpl->setVariable("PASSED", ($a_set["passed"]) ? $this->lng->txt("yes") :
87  $this->lng->txt("no"));
88 
89  if ($a_set["passed"]) {
90  $ilCtrl->setParameter($this->parent_obj, "exc_id", $a_set["id"]);
91  $action = $ilCtrl->getLinkTarget($this->parent_obj, "save");
92  $this->tpl->setVariable("URL_SELECT", $action);
93  $this->tpl->setVariable("TXT_SELECT", $this->lng->txt("select"));
94  }
95  }
96 }
setDescription($a_val)
Set description.
static _isComplete($adapter)
Checks the status of the certificate.
$action
global $DIC
Definition: saml.php:7
static _lookupTitle($a_id)
lookup object title
user()
Definition: user.php:4
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.
$ilUser
Definition: imgupload.php:18
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
static _lookupFinishedUserExercises($a_user_id)
Get all exercises for user.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
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.
__construct($a_parent_obj, $a_parent_cmd="")
Constructor.