ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilCourseCertificateAdapter Class Reference

Test certificate adapter. More...

+ Inheritance diagram for ilCourseCertificateAdapter:
+ Collaboration diagram for ilCourseCertificateAdapter:

Public Member Functions

 __construct ($object)
 ilTestCertificateAdapter contructor More...
 
 getCertificatePath ()
 Returns the certificate path (with a trailing path separator) More...
 
 getCertificateVariablesForPreview ()
 Returns an array containing all variables and values which can be exchanged in the certificate. More...
 
 getCertificateVariablesForPresentation ($params=array())
 Returns an array containing all variables and values which can be exchanged in the certificate The values should be calculated from real data. More...
 
 getCertificateVariablesDescription ()
 Returns a description of the available certificate parameters. More...
 
 getAdapterType ()
 Returns the adapter type This value will be used to generate file names for the certificates. More...
 
 getCertificateID ()
 Returns a certificate ID This value will be used to generate unique file names for the certificates. More...
 
- Public Member Functions inherited from ilCertificateAdapter
 __construct ()
 ilCertificateAdapter constructor. More...
 
 getCertificatePath ()
 Returns the certificate path (with a trailing path separator) More...
 
 getCertificateVariablesForPreview ()
 Returns an array containing all variables and values which can be exchanged in the certificate. More...
 
 getCertificateVariablesForPresentation ($params=array())
 Returns an array containing all variables and values which can be exchanged in the certificate The values should be calculated from real data. More...
 
 getCertificateVariablesDescription ()
 Returns a description of the available certificate parameters. More...
 
 getAdapterType ()
 Returns the adapter type This value will be used to generate file names for the certificates. More...
 
 getCertificateID ()
 Returns a certificate ID This value will be used to generate unique file names for the certificates. More...
 
 addAdditionalFormElements (&$form, $form_fields)
 Allows to add additional form fields to the certificate editor form This method will be called when the certificate editor form will built using the ilPropertyFormGUI class. More...
 
 addFormFieldsFromPOST (&$form_fields)
 Allows to add additional form values to the array of form values evaluating a HTTP POST action. More...
 
 addFormFieldsFromObject (&$form_fields)
 Allows to add additional form values to the array of form values evaluating the associated adapter class if one exists This method will be called when the certificate editor form will be shown and the content of the form has to be retrieved from wherever the form values are saved. More...
 
 saveFormFields (&$form_fields)
 Allows to save additional adapter form fields This method will be called when the certificate editor form is complete and the form values will be saved. More...
 
 deleteCertificate ()
 Is called when the certificate is deleted Add some adapter specific code if more work has to be done when the certificate file was deleted. More...
 
 getCertificateFilename ($params=array())
 Set the name of the certificate file This method will be called when the certificate will be generated. More...
 
 getUserIdForParams ($a_params)
 Get user id for params. More...
 

Static Public Member Functions

static _preloadListData ($a_usr_ids, $a_obj_ids)
 Get certificate/passed status for all given objects and users. More...
 
static _hasUserCertificate ($a_usr_id, $a_obj_id)
 Check if user has certificate for course. More...
 

Protected Attributes

 $object
 
- Protected Attributes inherited from ilCertificateAdapter
 $lng
 

Static Protected Attributes

static $has_certificate = array()
 

Additional Inherited Members

- Protected Member Functions inherited from ilCertificateAdapter
 getBaseVariablesDescription ($a_enable_last_access=true, $a_enable_completion_date=true)
 Get variable descriptions. More...
 
 getBaseVariablesForPreview ($a_enable_last_access=true, $a_enable_completion_date=true)
 Get variable dummys. More...
 
 getBaseVariablesForPresentation ($a_user_data, $a_last_access=null, $a_completion_date=false)
 Get variable values. More...
 
 getUserCompletionDate ($a_user_id, $a_object_id=null)
 Get completion for user. More...
 

Detailed Description

Test certificate adapter.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Version
Id
class.ilTestCertificateAdapter.php 30898 2011-09-29 12:47:24Z jluetzen

Definition at line 33 of file class.ilCourseCertificateAdapter.php.

Constructor & Destructor Documentation

◆ __construct()

ilCourseCertificateAdapter::__construct (   $object)

ilTestCertificateAdapter contructor

Parameters
object$objectA reference to a test object

Definition at line 43 of file class.ilCourseCertificateAdapter.php.

References $object.

44  {
45  $this->object = $object;
46  parent::__construct();
47  }

Member Function Documentation

◆ _hasUserCertificate()

static ilCourseCertificateAdapter::_hasUserCertificate (   $a_usr_id,
  $a_obj_id 
)
static

Check if user has certificate for course.

Used in ilObjCourseListGUI

Parameters
int$a_usr_id
int$a_obj_id
Returns
bool

Definition at line 196 of file class.ilCourseCertificateAdapter.php.

Referenced by ilCourseVerificationTableGUI\getItems(), and ilObjCourseListGUI\getProperties().

197  {
198  self::_preloadListData($a_usr_id, $a_obj_id);
199 
200  if (isset(self::$has_certificate[$a_usr_id][$a_obj_id])) {
201  return self::$has_certificate[$a_usr_id][$a_obj_id];
202  }
203  return false;
204  }
+ Here is the caller graph for this function:

◆ _preloadListData()

static ilCourseCertificateAdapter::_preloadListData (   $a_usr_ids,
  $a_obj_ids 
)
static

Get certificate/passed status for all given objects and users.

Used in ilObjCourseAccess for ilObjCourseListGUI

Parameters
array$a_usr_ids
array$a_obj_ids

Definition at line 159 of file class.ilCourseCertificateAdapter.php.

References $data, array, ilCourseParticipants\getPassedUsersForObjects(), and ilCertificate\isActive().

Referenced by ilObjCourseAccess\_preloadData(), and ilCourseVerificationTableGUI\getItems().

160  {
161  if (!is_array($a_usr_ids)) {
162  $a_usr_ids = array($a_usr_ids);
163  }
164  if (!is_array($a_obj_ids)) {
165  $a_obj_ids = array($a_obj_ids);
166  }
167  foreach ($a_usr_ids as $usr_id) {
168  foreach ($a_obj_ids as $obj_id) {
169  self::$has_certificate[$usr_id][$obj_id] = false;
170  }
171  }
172 
173  include_once "Services/Certificate/classes/class.ilCertificate.php";
174  if (ilCertificate::isActive()) {
175  $obj_active = ilCertificate::areObjectsActive($a_obj_ids);
176 
177  include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
178  $data = ilCourseParticipants::getPassedUsersForObjects($a_obj_ids, $a_usr_ids);
179  foreach ($data as $rec) {
180  if ($obj_active[$rec["obj_id"]]) {
181  self::$has_certificate[$rec["usr_id"]][$rec["obj_id"]] = true;
182  }
183  }
184  }
185  }
static getPassedUsersForObjects(array $a_obj_ids, array $a_usr_ids)
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAdapterType()

ilCourseCertificateAdapter::getAdapterType ( )

Returns the adapter type This value will be used to generate file names for the certificates.

Returns
string A string value to represent the adapter type

Definition at line 135 of file class.ilCourseCertificateAdapter.php.

136  {
137  return "course";
138  }

◆ getCertificateID()

ilCourseCertificateAdapter::getCertificateID ( )

Returns a certificate ID This value will be used to generate unique file names for the certificates.

Returns
mixed A unique ID which represents a certificate

Definition at line 146 of file class.ilCourseCertificateAdapter.php.

147  {
148  return $this->object->getId();
149  }

◆ getCertificatePath()

ilCourseCertificateAdapter::getCertificatePath ( )

Returns the certificate path (with a trailing path separator)

Returns
string The certificate path

Definition at line 54 of file class.ilCourseCertificateAdapter.php.

55  {
56  return CLIENT_WEB_DIR . "/course/certificates/" . $this->object->getId() . "/";
57  }

◆ getCertificateVariablesDescription()

ilCourseCertificateAdapter::getCertificateVariablesDescription ( )

Returns a description of the available certificate parameters.

The description will be shown at the bottom of the certificate editor text area.

Returns
string The certificate parameters description

Definition at line 111 of file class.ilCourseCertificateAdapter.php.

References $id, $template, and ilCertificateAdapter\getBaseVariablesDescription().

112  {
113  $vars = $this->getBaseVariablesDescription(false);
114  $vars["COURSE_TITLE"] = $this->lng->txt("crs_title");
115 
116  $template = new ilTemplate("tpl.il_as_tst_certificate_edit.html", true, true, "Modules/Test");
117  $template->setCurrentBlock("items");
118  foreach ($vars as $id => $caption) {
119  $template->setVariable("ID", $id);
120  $template->setVariable("TXT", $caption);
121  $template->parseCurrentBlock();
122  }
123 
124  $template->setVariable("PH_INTRODUCTION", $this->lng->txt("certificate_ph_introduction"));
125 
126  return $template->get();
127  }
$template
if(!array_key_exists('StateId', $_REQUEST)) $id
special template class to simplify handling of ITX/PEAR
getBaseVariablesDescription($a_enable_last_access=true, $a_enable_completion_date=true)
Get variable descriptions.
+ Here is the call graph for this function:

◆ getCertificateVariablesForPresentation()

ilCourseCertificateAdapter::getCertificateVariablesForPresentation (   $params = array())

Returns an array containing all variables and values which can be exchanged in the certificate The values should be calculated from real data.

The $params parameter array should contain all necessary information to calculate the values.

Parameters
array$paramsAn array of parameters to calculate the certificate parameter values
Returns
array The certificate variables

Definition at line 85 of file class.ilCourseCertificateAdapter.php.

References $id, $params, ilObjUser\_lookupFields(), array, ilCertificateAdapter\getBaseVariablesForPresentation(), ilCourseParticipants\getDateTimeOfPassed(), object, and ilUtil\prepareFormOutput().

86  {
87  $user_id = $params["user_id"];
88 
89  include_once './Services/User/classes/class.ilObjUser.php';
90  $user_data = ilObjUser::_lookupFields($user_id);
91 
92  include_once './Modules/Course/classes/class.ilCourseParticipants.php';
93  $completion_date = ilCourseParticipants::getDateTimeOfPassed($this->object->getId(), $user_id);
94 
95  $vars = $this->getBaseVariablesForPresentation($user_data, null, $completion_date);
96  $vars["COURSE_TITLE"] = ilUtil::prepareFormOutput($this->object->getTitle());
97 
98  $insert_tags = array();
99  foreach ($vars as $id => $caption) {
100  $insert_tags["[" . $id . "]"] = $caption;
101  }
102  return $insert_tags;
103  }
$params
Definition: disable.php:11
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
static getDateTimeOfPassed($a_obj_id, $a_usr_id)
if(!array_key_exists('StateId', $_REQUEST)) $id
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
static _lookupFields($a_user_id)
lookup fields (deprecated; use more specific methods instead)
getBaseVariablesForPresentation($a_user_data, $a_last_access=null, $a_completion_date=false)
Get variable values.
+ Here is the call graph for this function:

◆ getCertificateVariablesForPreview()

ilCourseCertificateAdapter::getCertificateVariablesForPreview ( )

Returns an array containing all variables and values which can be exchanged in the certificate.

The values will be taken for the certificate preview.

Returns
array The certificate variables

Definition at line 65 of file class.ilCourseCertificateAdapter.php.

References $id, array, ilCertificateAdapter\getBaseVariablesForPreview(), object, and ilUtil\prepareFormOutput().

66  {
67  $vars = $this->getBaseVariablesForPreview(false);
68  $vars["COURSE_TITLE"] = ilUtil::prepareFormOutput($this->object->getTitle());
69 
70  $insert_tags = array();
71  foreach ($vars as $id => $caption) {
72  $insert_tags["[" . $id . "]"] = $caption;
73  }
74  return $insert_tags;
75  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
if(!array_key_exists('StateId', $_REQUEST)) $id
Create styles array
The data for the language used.
Create new PHPExcel object
obj_idprivate
getBaseVariablesForPreview($a_enable_last_access=true, $a_enable_completion_date=true)
Get variable dummys.
+ Here is the call graph for this function:

Field Documentation

◆ $has_certificate

ilCourseCertificateAdapter::$has_certificate = array()
staticprotected

Definition at line 36 of file class.ilCourseCertificateAdapter.php.

◆ $object

ilCourseCertificateAdapter::$object
protected

Definition at line 35 of file class.ilCourseCertificateAdapter.php.

Referenced by __construct().


The documentation for this class was generated from the following file: