ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilCourseCertificateAdapter Class Reference

Test certificate adapter. More...

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

Public Member Functions

 __construct (&$object)
 ilTestCertificateAdapter contructor
 getCertificatePath ()
 Returns the certificate path (with a trailing path separator)
 getCertificateVariablesForPreview ()
 Returns an array containing all variables and values which can be exchanged in the certificate.
 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.
 getCertificateVariablesDescription ()
 Returns a description of the available certificate parameters.
 getAdapterType ()
 Returns the adapter type This value will be used to generate file names for the certificates.
 getCertificateID ()
 Returns a certificate ID This value will be used to generate unique file names for the certificates.
- Public Member Functions inherited from ilCertificateAdapter
 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.
 addFormFieldsFromPOST (&$form_fields)
 Allows to add additional form values to the array of form values evaluating a HTTP POST action.
 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.
 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.
 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.
 getCertificateFilename ($params=array())
 Set the name of the certificate file This method will be called when the certificate will be generated.
 getUserIdForParams ($a_params)
 Get user id for params.

Static Public Member Functions

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

Protected Attributes

 $object

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.
 getBaseVariablesForPreview ($a_enable_last_access=true, $a_enable_completion_date=true)
 Get variable dummys.
 getBaseVariablesForPresentation ($a_user_data, $a_last_access=null, $a_completion_date=false)
 Get variable values.
 getUserCompletionDate ($a_user_id, $a_object_id=null)
 Get completion for user.

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

ilCourseCertificateAdapter::__construct ( $object)

ilTestCertificateAdapter contructor

Parameters
object$objectA reference to a test object

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

References $lng, and $object.

{
global $lng;
$this->object =& $object;
$lng->loadLanguageModule('certificate');
}

Member Function Documentation

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 215 of file class.ilCourseCertificateAdapter.php.

References ilCourseParticipants\getDateTimeOfPassed().

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

{
if (isset(self::$has_certificate[$a_usr_id][$a_obj_id]))
{
return self::$has_certificate[$a_usr_id][$a_obj_id];
}
// obsolete?
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
return ilCourseParticipants::getDateTimeOfPassed($a_obj_id, $a_usr_id);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 169 of file class.ilCourseCertificateAdapter.php.

References $ilDB, ilCertificate\areObjectsActive(), ilCourseParticipants\getPassedUsersForObjects(), and ilCertificate\isActive().

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

{
global $ilDB;
if (!is_array($a_usr_ids))
{
$a_usr_ids = array($a_usr_ids);
}
if (!is_array($a_obj_ids))
{
$a_obj_ids = array($a_obj_ids);
}
foreach ($a_usr_ids as $usr_id)
{
foreach ($a_obj_ids as $obj_id)
{
self::$has_certificate[$usr_id][$obj_id] = false;
}
}
include_once "Services/Certificate/classes/class.ilCertificate.php";
{
$obj_active = ilCertificate::areObjectsActive($a_obj_ids);
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
$data = ilCourseParticipants::getPassedUsersForObjects($a_obj_ids, $a_usr_ids);
foreach($data as $rec)
{
if($obj_active[$rec["obj_id"]])
{
self::$has_certificate[$rec["usr_id"]][$rec["obj_id"]] = true;
}
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Reimplemented from ilCertificateAdapter.

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

{
return "course";
}
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

Reimplemented from ilCertificateAdapter.

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

{
return $this->object->getId();
}
ilCourseCertificateAdapter::getCertificatePath ( )

Returns the certificate path (with a trailing path separator)

Returns
string The certificate path

Reimplemented from ilCertificateAdapter.

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

{
return CLIENT_WEB_DIR . "/course/certificates/" . $this->object->getId() . "/";
}
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

Reimplemented from ilCertificateAdapter.

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

References $lng, and ilCertificateAdapter\getBaseVariablesDescription().

{
global $lng;
$vars = $this->getBaseVariablesDescription(false);
$vars["COURSE_TITLE"] = $lng->txt("crs_title");
$template = new ilTemplate("tpl.il_as_tst_certificate_edit.html", TRUE, TRUE, "Modules/Test");
$template->setCurrentBlock("items");
foreach($vars as $id => $caption)
{
$template->setVariable("ID", $id);
$template->setVariable("TXT", $caption);
$template->parseCurrentBlock();
}
$template->setVariable("PH_INTRODUCTION", $lng->txt("certificate_ph_introduction"));
return $template->get();
}

+ Here is the call graph for this function:

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

Reimplemented from ilCertificateAdapter.

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

References $lng, ilObjUser\_lookupFields(), ilCertificateAdapter\getBaseVariablesForPresentation(), ilCourseParticipants\getDateTimeOfPassed(), and ilUtil\prepareFormOutput().

{
global $lng;
$user_id = $params["user_id"];
include_once './Services/User/classes/class.ilObjUser.php';
$user_data = ilObjUser::_lookupFields($user_id);
include_once './Modules/Course/classes/class.ilCourseParticipants.php';
$completion_date = ilCourseParticipants::getDateTimeOfPassed($this->object->getId(), $user_id);
$vars = $this->getBaseVariablesForPresentation($user_data, null, $completion_date);
$vars["COURSE_TITLE"] = ilUtil::prepareFormOutput($this->object->getTitle());
$insert_tags = array();
foreach($vars as $id => $caption)
{
$insert_tags["[".$id."]"] = $caption;
}
return $insert_tags;
}

+ Here is the call graph for this function:

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

Reimplemented from ilCertificateAdapter.

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

References $lng, ilCertificateAdapter\getBaseVariablesForPreview(), and ilUtil\prepareFormOutput().

{
global $lng;
$vars = $this->getBaseVariablesForPreview(false);
$vars["COURSE_TITLE"] = ilUtil::prepareFormOutput($this->object->getTitle());
$insert_tags = array();
foreach($vars as $id => $caption)
{
$insert_tags["[".$id."]"] = $caption;
}
return $insert_tags;
}

+ Here is the call graph for this function:

Field Documentation

ilCourseCertificateAdapter::$has_certificate = array()
staticprotected

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

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: