ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilCourseVerificationTableGUI.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 {
15 
21  public function __construct(
22  $a_parent_obj,
23  $a_parent_cmd = "",
25  ) {
26  global $DIC;
27 
28  $ilCtrl = $DIC['ilCtrl'];
29  $database = $DIC->database();
30  $logger = $DIC->logger()->root();
31 
32  if (null === $userCertificateRepository) {
34  }
35  $this->userCertificateRepository = $userCertificateRepository;
36 
37  parent::__construct($a_parent_obj, $a_parent_cmd);
38 
39  $this->addColumn($this->lng->txt("title"), "title");
40  $this->addColumn($this->lng->txt("passed"), "passed");
41  $this->addColumn($this->lng->txt("action"), "");
42 
43  $this->setTitle($this->lng->txt("crsv_create"));
44  $this->setDescription($this->lng->txt("crsv_create_info"));
45 
46  $this->setRowTemplate("tpl.crs_verification_row.html", "Modules/Course");
47  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, $a_parent_cmd));
48 
49  $this->getItems();
50  }
51 
55  protected function getItems()
56  {
57  global $DIC;
58 
59  $ilUser = $DIC['ilUser'];
60 
61  $data = array();
62 
63  $userId = $ilUser->getId();
64 
65  $certificateArray = $this->userCertificateRepository->fetchActiveCertificatesByTypeForPresentation($userId, 'crs');
66 
67  $data = array();
68  foreach ($certificateArray as $certificate) {
69  $data[] = array(
70  'id' => $certificate->getUserCertificate()->getObjId(),
71  'title' => $certificate->getObjectTitle(),
72  'passed' => true
73  );
74  }
75 
76  $this->setData($data);
77  }
78 
84  protected function fillRow($a_set)
85  {
86  global $DIC;
87 
88  $ilCtrl = $DIC['ilCtrl'];
89 
90  $this->tpl->setVariable("TITLE", $a_set["title"]);
91  $this->tpl->setVariable("PASSED", ($a_set["passed"]) ? $this->lng->txt("yes") :
92  $this->lng->txt("no"));
93 
94  if ($a_set["passed"]) {
95  $ilCtrl->setParameter($this->parent_obj, "crs_id", $a_set["id"]);
96  $action = $ilCtrl->getLinkTarget($this->parent_obj, "save");
97  $this->tpl->setVariable("URL_SELECT", $action);
98  $this->tpl->setVariable("TXT_SELECT", $this->lng->txt("select"));
99  }
100  }
101 }
setDescription($a_val)
Set description.
$action
global $DIC
Definition: saml.php:7
List all completed course for current user.
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
__construct( $a_parent_obj, $a_parent_cmd="", ilUserCertificateRepository $userCertificateRepository=null)
Class ilTable2GUI.
$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.