ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\MediaObjects\Video\GUIService Class Reference
+ Collaboration diagram for ILIAS\MediaObjects\Video\GUIService:

Public Member Functions

 __construct (InternalDomainService $domain_service, InternalGUIService $gui_service)
 
 addPreviewExtractionToToolbar (int $mob_id, string $gui_class, string $extract_cmd="extractPreviewImage")
 
 handleExtractionRequest (int $mob_id)
 
 addPreviewInput (\ilPropertyFormGUI $form, int $mob_id=0)
 
 savePreviewInput (\ilPropertyFormGUI $form, int $mob_id)
 

Protected Member Functions

 checkPreviewPossible (int $mob_id)
 

Protected Attributes

ilGlobalTemplateInterface $tpl
 
InternalGUIService $gui_service
 
InternalDomainService $domain_service
 

Detailed Description

Definition at line 26 of file class.GUIService.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\MediaObjects\Video\GUIService::__construct ( InternalDomainService  $domain_service,
InternalGUIService  $gui_service 
)

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

35 {
36 $this->gui_service = $gui_service;
37 $this->domain_service = $domain_service;
38 $this->tpl = $gui_service->ui()->mainTemplate();
39 $lng = $this->domain_service->lng();
40 $lng->loadLanguageModule("mob");
41 }
global $lng
Definition: privfeed.php:31

References ILIAS\MediaObjects\Video\GUIService\$domain_service, ILIAS\MediaObjects\Video\GUIService\$gui_service, and $lng.

Member Function Documentation

◆ addPreviewExtractionToToolbar()

ILIAS\MediaObjects\Video\GUIService::addPreviewExtractionToToolbar ( int  $mob_id,
string  $gui_class,
string  $extract_cmd = "extractPreviewImage" 
)

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

47 : void {
48 $toolbar = $this->gui_service->toolbar();
49 $ctrl = $this->gui_service->ctrl();
50 $lng = $this->domain_service->lng();
51
52 if (\ilFFmpeg::enabled()) {
53 $mob = new \ilObjMediaObject($mob_id);
54
55 $conv_cnt = 0;
56 // we had other purposes as source as well, but
57 // currently only "Standard" is implemented in the convertFile method
58 $p = "Standard";
59 $med = $mob->getMediaItem($p);
60 if (is_object($med)) {
61 if (\ilFFmpeg::supportsImageExtraction($med->getFormat())) {
62 // second
63 $ni = new \ilTextInputGUI($lng->txt("mob_second"), "sec");
64 $ni->setMaxLength(4);
65 $ni->setSize(4);
66 $ni->setValue(1);
67 $toolbar->addInputItem($ni, true);
68
69 $toolbar->addFormButton($lng->txt("mob_extract_preview_image"), "extractPreviewImage");
70 $toolbar->setFormAction($ctrl->getFormActionByClass($gui_class));
71 }
72 }
73 }
74 }
static enabled()
Checks, whether FFmpeg support is enabled (path is set in the setup)
static supportsImageExtraction(string $a_mime)
Check if mime type supports image extraction.

References $lng, and ilFFmpeg\supportsImageExtraction().

+ Here is the call graph for this function:

◆ addPreviewInput()

ILIAS\MediaObjects\Video\GUIService::addPreviewInput ( \ilPropertyFormGUI  $form,
int  $mob_id = 0 
)

Definition at line 120 of file class.GUIService.php.

120 : void
121 {
122 if (!$this->checkPreviewPossible($mob_id)) {
123 return;
124 }
125 $lng = $this->domain_service->lng();
126 $pp = new \ilImageFileInputGUI($lng->txt("mob_preview_picture"), "preview_pic");
127 $pp->setSuffixes(array("png", "jpeg", "jpg"));
128 $form->addItem($pp);
129
130 if ($mob_id > 0) {
131 $mob = new \ilObjMediaObject($mob_id);
132 // preview
133 $ppic = $mob->getVideoPreviewPic();
134 if ($ppic !== "") {
135 $pp->setImage($ppic . "?rand=" . rand(0, 1000));
136 }
137 }
138 }

References $lng, and ilPropertyFormGUI\addItem().

+ Here is the call graph for this function:

◆ checkPreviewPossible()

ILIAS\MediaObjects\Video\GUIService::checkPreviewPossible ( int  $mob_id)
protected

Definition at line 105 of file class.GUIService.php.

105 : bool
106 {
107 if ($mob_id === 0) {
108 return false;
109 }
110 $mob = new \ilObjMediaObject($mob_id);
111 $med = $mob->getMediaItem("Standard");
112 if (is_object($med)) {
113 if (\ilFFmpeg::supportsImageExtraction($med->getFormat())) {
114 return true;
115 }
116 }
117 return false;
118 }

References ilFFmpeg\supportsImageExtraction().

+ Here is the call graph for this function:

◆ handleExtractionRequest()

ILIAS\MediaObjects\Video\GUIService::handleExtractionRequest ( int  $mob_id)

Definition at line 76 of file class.GUIService.php.

78 : void {
79 $mob = new \ilObjMediaObject($mob_id);
80 $lng = $this->domain_service->lng();
81 $add = "";
82 try {
83 $sec = $this->gui_service->standardRequest()->getSeconds();
84 if ($sec < 0) {
85 $sec = 0;
86 }
87
88 $mob->generatePreviewPic(320, 240, $sec);
89 if ($mob->getVideoPreviewPic() !== "") {
90 $this->tpl->setOnScreenMessage('info', $lng->txt("mob_image_extracted"), true);
91 } else {
92 $this->tpl->setOnScreenMessage('failure', $lng->txt("mob_no_extraction_possible"), true);
93 }
94 } catch (\ilException $e) {
95 if (DEVMODE === 1) {
97 $add = (is_array($ret) && count($ret) > 0)
98 ? "<br />" . implode("<br />", $ret)
99 : "";
100 }
101 $this->tpl->setOnScreenMessage('failure', $e->getMessage() . $add, true);
102 }
103 }
Base class for ILIAS Exception handling.
static getLastReturnValues()
Get last return values.

References $lng.

◆ savePreviewInput()

ILIAS\MediaObjects\Video\GUIService::savePreviewInput ( \ilPropertyFormGUI  $form,
int  $mob_id 
)

Definition at line 140 of file class.GUIService.php.

140 : void
141 {
142 if (!$this->checkPreviewPossible($mob_id)) {
143 return;
144 }
145 $prevpic = $form->getInput("preview_pic");
146 if ($prevpic["size"] > 0) {
147 $mob = new \ilObjMediaObject($mob_id);
148 $mob->uploadVideoPreviewPic($prevpic);
149 } else {
150 $prevpici = $form->getItemByPostVar("preview_pic");
151 if ($prevpici->getDeletionFlag()) {
152 $mob = new \ilObjMediaObject($mob_id);
153 $mob->removeAdditionalFile($mob->getVideoPreviewPic(true));
154 }
155 }
156
157 }

References ilPropertyFormGUI\getInput(), and ilPropertyFormGUI\getItemByPostVar().

+ Here is the call graph for this function:

Field Documentation

◆ $domain_service

InternalDomainService ILIAS\MediaObjects\Video\GUIService::$domain_service
protected

◆ $gui_service

InternalGUIService ILIAS\MediaObjects\Video\GUIService::$gui_service
protected

◆ $tpl

ilGlobalTemplateInterface ILIAS\MediaObjects\Video\GUIService::$tpl
protected

Definition at line 28 of file class.GUIService.php.


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