ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\Extract\Video\GUIService Class Reference
+ Collaboration diagram for ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\Extract\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\ResourceStorage\Flavour\Machine\DefaultMachines\Extract\Video\GUIService::__construct ( InternalDomainService  $domain_service,
InternalGUIService  $gui_service 
)

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

References ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\Extract\Video\GUIService\$domain_service, ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\Extract\Video\GUIService\$gui_service, and $lng.

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

Member Function Documentation

◆ addPreviewExtractionToToolbar()

ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\Extract\Video\GUIService::addPreviewExtractionToToolbar ( int  $mob_id,
string  $gui_class,
string  $extract_cmd = "extractPreviewImage" 
)

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

References $lng, ilFFmpeg\enabled(), and ilFFmpeg\supportsImageExtraction().

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 supportsImageExtraction(string $a_mime)
Check if mime type supports image extraction.
global $lng
Definition: privfeed.php:31
static enabled()
Checks, whether FFmpeg support is enabled (path is set in the setup)
+ Here is the call graph for this function:

◆ addPreviewInput()

ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\Extract\Video\GUIService::addPreviewInput ( \ilPropertyFormGUI  $form,
int  $mob_id = 0 
)

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

References $lng, ilPropertyFormGUI\addItem(), and ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\Extract\Video\GUIService\checkPreviewPossible().

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  }
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:

◆ checkPreviewPossible()

ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\Extract\Video\GUIService::checkPreviewPossible ( int  $mob_id)
protected

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

References ilFFmpeg\supportsImageExtraction().

Referenced by ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\Extract\Video\GUIService\addPreviewInput(), and ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\Extract\Video\GUIService\savePreviewInput().

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  }
static supportsImageExtraction(string $a_mime)
Check if mime type supports image extraction.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleExtractionRequest()

ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\Extract\Video\GUIService::handleExtractionRequest ( int  $mob_id)

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

References Vendor\Package\$e, $lng, and ilFFmpeg\getLastReturnValues().

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  }
static getLastReturnValues()
Get last return values.
global $lng
Definition: privfeed.php:31
+ Here is the call graph for this function:

◆ savePreviewInput()

ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\Extract\Video\GUIService::savePreviewInput ( \ilPropertyFormGUI  $form,
int  $mob_id 
)

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

References ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\Extract\Video\GUIService\checkPreviewPossible(), ilPropertyFormGUI\getInput(), and ilPropertyFormGUI\getItemByPostVar().

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  }
+ Here is the call graph for this function:

Field Documentation

◆ $domain_service

InternalDomainService ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\Extract\Video\GUIService::$domain_service
protected

◆ $gui_service

InternalGUIService ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\Extract\Video\GUIService::$gui_service
protected

◆ $tpl

ilGlobalTemplateInterface ILIAS\ResourceStorage\Flavour\Machine\DefaultMachines\Extract\Video\GUIService::$tpl
protected

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


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