ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilMediaObjectsPlayerWrapperGUI Class Reference
+ Collaboration diagram for ilMediaObjectsPlayerWrapperGUI:

Public Member Functions

 __construct (InternalDomainService $domain_service, InternalGUIService $gui_service)
 
 executeCommand ()
 
 audio (ilObjMediaObject $mob, int $tracking_container_ref_id=0)
 

Protected Member Functions

 saveCompletion ()
 

Protected Attributes

ILIAS MediaObjects Tracking TrackingManager $tracking
 
ILIAS MediaObjects Player PlayerGUIRequest $request
 
ILIAS MediaObjects MediaType MediaTypeManager $media_type
 
InternalGUIService $gui
 
InternalDomainService $domain
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilMediaObjectsPlayerWrapperGUI::__construct ( InternalDomainService  $domain_service,
InternalGUIService  $gui_service 
)

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

References ILIAS\MediaObjects\InternalDomainService\mediaType(), and ILIAS\MediaObjects\InternalGUIService\player().

38  {
39  $this->gui = $gui_service;
40  $this->domain = $domain_service;
41  $this->media_type = $this->domain->mediaType();
42  $this->request = $gui_service->player()->request();
43  $this->tracking = $this->domain->tracking();
44  }
+ Here is the call graph for this function:

Member Function Documentation

◆ audio()

ilMediaObjectsPlayerWrapperGUI::audio ( ilObjMediaObject  $mob,
int  $tracking_container_ref_id = 0 
)
Exceptions
ilCtrlException

Definition at line 64 of file class.ilMediaObjectsPlayerWrapperGUI.php.

References $id, $url, ilMediaCastSettings\_getInstance(), ilObjMediaObject\_getURL(), ilObject\getId(), ilObjMediaObject\getMediaItem(), and ILIAS\Repository\int().

68  $main_tpl = $this->gui->ui()->mainTemplate();
69 
70  $ctrl = $this->gui->ctrl();
71 
72  $med = $mob->getMediaItem("Standard");
73 
74  if (is_null($med) || !$this->media_type->isAudio($med->getFormat())) {
75  return null;
76  }
77 
78  if ($med->getLocationType() === "Reference") {
79  $resource = $med->getLocation();
80  } else {
81  $path_to_file = \ilObjMediaObject::_getURL($mob->getId()) . "/" . $med->getLocation();
82  $resource = $path_to_file;
83  }
84 
85  $audio = $this->gui->ui()->factory()->player()->audio(
86  $resource,
87  ""
88  );
89 
90  if ($tracking_container_ref_id > 0) {
91  // @todo: make this a media object general setting
92  $mcst_settings = ilMediaCastSettings::_getInstance();
93  $treshold = (int) $mcst_settings->getVideoCompletionThreshold();
94 
95  $main_tpl->addJavaScript("./Services/MediaObjects/js/MediaObjectsCompletion.js");
96  $ctrl->setParameter($this, "mob_tracking_ref_id", $tracking_container_ref_id);
97  $ctrl->setParameter($this, "mob_tracking_mob_id", $mob->getId());
98  $url = $ctrl->getLinkTarget($this, "saveCompletion");
99  $audio = $audio->withAdditionalOnLoadCode(function ($id) use ($url, $treshold) {
100  $js = <<<EOT
101  document.getElementById('$id').dataset.mobCompletionCallback = '$url';
102  document.getElementById('$id').dataset.mobCompletionThreshold = '$treshold';
103  il.MediaObjectsCompletion.init();
104 EOT;
105  return $js;
106  });
107  }
108  return $audio;
109  }
getMediaItem(string $a_purpose)
get item for media purpose
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
$url
static _getURL(int $a_mob_id)
get directory for files of media object
+ Here is the call graph for this function:

◆ executeCommand()

ilMediaObjectsPlayerWrapperGUI::executeCommand ( )

Definition at line 46 of file class.ilMediaObjectsPlayerWrapperGUI.php.

46  : void
47  {
48  $ctrl = $this->gui->ctrl();
49 
50  $next_class = $ctrl->getNextClass($this);
51  $cmd = $ctrl->getCmd("show");
52 
53  switch ($next_class) {
54  default:
55  if (in_array($cmd, array("saveCompletion"))) {
56  $this->$cmd();
57  }
58  }
59  }

◆ saveCompletion()

ilMediaObjectsPlayerWrapperGUI::saveCompletion ( )
protected

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

References $ref_id.

111  : void
112  {
113  $ref_id = $this->request->getTrackingRefId();
114  $mob_id = $this->request->getTrackingMobId();
115  $this->tracking->saveCompletion($mob_id, $ref_id);
116  }
$ref_id
Definition: ltiauth.php:67

Field Documentation

◆ $domain

InternalDomainService ilMediaObjectsPlayerWrapperGUI::$domain
protected

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

◆ $gui

InternalGUIService ilMediaObjectsPlayerWrapperGUI::$gui
protected

Definition at line 32 of file class.ilMediaObjectsPlayerWrapperGUI.php.

◆ $media_type

ILIAS MediaObjects MediaType MediaTypeManager ilMediaObjectsPlayerWrapperGUI::$media_type
protected

Definition at line 31 of file class.ilMediaObjectsPlayerWrapperGUI.php.

◆ $request

ILIAS MediaObjects Player PlayerGUIRequest ilMediaObjectsPlayerWrapperGUI::$request
protected

Definition at line 30 of file class.ilMediaObjectsPlayerWrapperGUI.php.

◆ $tracking

ILIAS MediaObjects Tracking TrackingManager ilMediaObjectsPlayerWrapperGUI::$tracking
protected

Definition at line 29 of file class.ilMediaObjectsPlayerWrapperGUI.php.


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