ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 {
14 
19 
23  protected $user;
24 
30  public function __construct(
31  $a_parent_obj,
32  $a_parent_cmd = "",
34  ) {
35  global $DIC;
36 
37  $this->ctrl = $DIC->ctrl();
38  $this->user = $DIC->user();
39  $database = $DIC->database();
40  $logger = $DIC->logger()->root();
41  $ilCtrl = $DIC->ctrl();
42 
43  if (null === $userCertificateRepository) {
45  }
46  $this->userCertificateRepository = $userCertificateRepository;
47 
48  parent::__construct($a_parent_obj, $a_parent_cmd);
49 
50  $this->addColumn($this->lng->txt("title"), "title");
51  $this->addColumn($this->lng->txt("passed"), "passed");
52  $this->addColumn($this->lng->txt("action"), "");
53 
54  $this->setTitle($this->lng->txt("excv_create"));
55  $this->setDescription($this->lng->txt("excv_create_info"));
56 
57  $this->setRowTemplate("tpl.exc_verification_row.html", "Modules/Exercise");
58  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
59 
60  $this->getItems();
61  }
62 
66  protected function getItems()
67  {
69  $userId = $ilUser->getId();
70 
71  $certificateArray = $this->userCertificateRepository
72  ->fetchActiveCertificatesByTypeForPresentation($userId, 'exc');
73 
74  $data = array();
75 
76  foreach ($certificateArray as $certificate) {
77  $data[] = array(
78  'id' => $certificate->getUserCertificate()->getObjId(),
79  'title' => $certificate->getObjectTitle(),
80  'passed' => true
81  );
82  }
83 
84  $this->setData($data);
85  }
86 
92  protected function fillRow($a_set)
93  {
95 
96  $this->tpl->setVariable("TITLE", $a_set["title"]);
97  $this->tpl->setVariable("PASSED", ($a_set["passed"]) ? $this->lng->txt("yes") :
98  $this->lng->txt("no"));
99 
100  if ($a_set["passed"]) {
101  $ilCtrl->setParameter($this->parent_obj, "exc_id", $a_set["id"]);
102  $action = $ilCtrl->getLinkTarget($this->parent_obj, "save");
103  $this->tpl->setVariable("URL_SELECT", $action);
104  $this->tpl->setVariable("TXT_SELECT", $this->lng->txt("select"));
105  }
106  }
107 }
setDescription($a_val)
Set description.
$action
global $DIC
Definition: saml.php:7
__construct( $a_parent_obj, $a_parent_cmd="", ilUserCertificateRepository $userCertificateRepository=null)
getItems()
Get all achieved test certificates for the current user.
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.
if(@file_exists(dirname(__FILE__).'/lang/eng.php')) $certificate
Definition: example_052.php:77
Class ilTable2GUI.
List all completed exercises for current user.
$ilUser
Definition: imgupload.php:18
setRowTemplate($a_template, $a_template_dir="")
Set row template.
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.