ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilObjMediaCastGUI Class Reference

Class ilObjMediaCastGUI. More...

+ Inheritance diagram for ilObjMediaCastGUI:
+ Collaboration diagram for ilObjMediaCastGUI:

Public Member Functions

 ilObjMediaCastGUI ($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
 Constructor @access public. More...
 
 executeCommand ()
 execute command More...
 
 afterSave ($newObj)
 save object @access public More...
 
 listItemsObject ($a_presentation_mode=false)
 List items of media cast. More...
 
 getFeedIconsHTML ()
 Get feed icons HTML. More...
 
 addCastItemObject ()
 Add media cast item. More...
 
 editCastItemObject ()
 Edit media cast item. More...
 
 initAddCastItemForm ($a_mode="create")
 Init add cast item form. More...
 
 getCastItemValues ()
 Get cast item values into form. More...
 
 saveCastItemObject ()
 Save new cast item. More...
 
 updateCastItemObject ()
 Update cast item. More...
 
 confirmDeletionItemsObject ()
 Confirmation Screen. More...
 
 deleteItemsObject ()
 Delete news items. More...
 
 downloadItemObject ()
 Download news media item. More...
 
 determinePlaytimeObject ()
 Delete news items. More...
 
 infoScreenObject ()
 this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually, if everything works through ilCtrl in the future this may be changed More...
 
 infoScreen ()
 show information screen More...
 
 setTabs ()
 get tabs @access public More...
 
 addContentSubTabs ($a_active="content")
 Add content subtabs. More...
 
 editSettingsObject ()
 Edit settings. More...
 
 initSettingsForm ()
 Init Settings Form. More...
 
 saveSettingsObject ()
 Save Settings. More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 saveOrderObject ()
 
 showContentObject ()
 Show content. More...
 
 showGallery ()
 
 convertFileObject ()
 Convert file object. More...
 
 extractPreviewImageObject ()
 Extract preview image. More...
 
 handlePlayerEventObject ()
 Handle player event. More...
 
- Public Member Functions inherited from ilObjectGUI
 ilObjectGUI ($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
 Constructor @access public. More...
 
executeCommand ()
 execute command More...
 
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode ($a_mode=true)
 if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! the mode is determined in ilrepositorygui More...
 
 getCreationMode ()
 get creation mode More...
 
 getAdminTabs (&$tabs_gui)
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ($in_rep=false)
 cancel action and go back to previous page @access public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object More...
 
 editObject ()
 edit object More...
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g. More...
 
 isVisible ($a_ref_id, $a_type)
 
 viewObject ()
 list childs of current object More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 

Static Public Member Functions

static _goto ($a_target)
 
- Static Public Member Functions inherited from ilObjectGUI
static _gotoRepositoryRoot ($a_raise_error=false)
 Goto repository root. More...
 
static _gotoRepositoryNode ($a_ref_id, $a_cmd="frameset")
 Goto repository root. More...
 

Protected Member Functions

 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 getMediaItem ($id)
 get MediaItem for id and updates local variable mcst_item More...
 
 getMediaItems ($id)
 get MediaItems for id and updates local variable mcst_item More...
 
 editOrderObject ()
 
- Protected Member Functions inherited from ilObjectGUI
 assignObject ()
 
 prepareOutput ()
 prepare output More...
 
 setTitleAndDescription ()
 called by prepare output More...
 
 initHeaderAction ($a_sub_type=null, $a_sub_id=null)
 Add header action menu. More...
 
 insertHeaderAction ($a_list_gui)
 Insert header action into main template. More...
 
 addHeaderAction ()
 Add header action menu. More...
 
 redrawHeaderActionObject ()
 Ajax call: redraw action header only. More...
 
 showMountWebfolderIcon ()
 
 setTabs ()
 set admin tabs @access public More...
 
 setAdminTabs ()
 set admin tabs @access public More...
 
 setLocator ()
 set Locator More...
 
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 omitLocator ($a_omit=true)
 
 addAdminLocatorItems ($a_do_not_add_object=false)
 should be overwritten to add object specific items (repository items are preloaded) More...
 
 initCreationForms ($a_new_type)
 Init creation froms. More...
 
 getCreationFormsHTML (array $a_forms)
 Get HTML for creation forms (accordion) More...
 
 initCreateForm ($a_new_type)
 Init object creation form. More...
 
 initDidacticTemplate (ilPropertyFormGUI $form)
 Show didactic template types. More...
 
 addDidacticTemplateOptions (array &$a_options)
 Add custom templates. More...
 
 getDidacticTemplateVar ($a_type)
 Get didactic template setting from creation screen. More...
 
 putObjectInTree (ilObject $a_obj, $a_parent_node_id=null)
 Add object to tree at given position. More...
 
 afterSave (ilObject $a_new_object)
 Post (successful) object creation hook. More...
 
 initEditForm ()
 Init object edit form. More...
 
 initEditCustomForm (ilPropertyFormGUI $a_form)
 Add custom fields to update form. More...
 
 getEditFormValues ()
 Get values for edit form. More...
 
 getEditFormCustomValues (array &$a_values)
 Add values to custom edit fields. More...
 
 validateCustom (ilPropertyFormGUI $a_form)
 Validate custom values (if not possible with checkInput()) More...
 
 updateCustom (ilPropertyFormGUI $a_form)
 Insert custom update form values into object. More...
 
 afterUpdate ()
 Post (successful) object update hook. More...
 
 initImportForm ($a_new_type)
 Init object import form. More...
 
 importFileObject ($parent_id=null)
 Import. More...
 
 afterImport (ilObject $a_new_object)
 Post (successful) object import hook. More...
 
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command More...
 
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g. More...
 
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command More...
 
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g. More...
 
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command More...
 
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu) More...
 
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl. More...
 
 getTitlesByRefId ($a_ref_ids)
 get Titles of objects this method is used for error messages in methods cut/copy/paste More...
 
 getTabs (&$tabs_gui)
 get tabs abstract method. More...
 
 __showButton ($a_cmd, $a_text, $a_target='')
 
 hitsperpageObject ()
 
__initTableGUI ()
 
 __setTableGUIBasicData (&$tbl, &$result_set, $a_from="")
 standard implementation for tables use 'from' variable use different initial setting of table More...
 
 redirectToRefId ($a_ref_id, $a_cmd="")
 redirects to (repository) view per ref id usually to a container and usually used at the end of a save/import method where the object gui type (of the new object) doesn't match with the type of the current $_GET["ref_id"] value More...
 
 fillCloneTemplate ($a_tpl_varname, $a_type)
 Fill object clone template This method can be called from any object GUI class that wants to offer object cloning. More...
 
 getCenterColumnHTML ()
 Get center column. More...
 
 getRightColumnHTML ()
 Display right column. More...
 
 setColumnSettings ($column_gui)
 May be overwritten in subclasses. More...
 
 checkPermission ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission and redirect on error. More...
 
 checkPermissionBool ($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
 Check permission. More...
 
 enableDragDropFileUpload ()
 Enables the file upload into this object by dropping files. More...
 
 handleAutoRating (ilObject $a_new_obj)
 Activate rating automatically if parent container setting. More...
 

Static Protected Member Functions

static isAudio ($extension)
 detect audio mimetype More...
 

Private Member Functions

 getDuration ($file)
 get duration from form or from file analyzer More...
 
 createMediaItemForPurpose ($mob, $purpose)
 handle media item for given purpose More...
 
 updateMediaItem ($mob, & $mediaItem)
 update media item from form More...
 
 populateFormFromPost ()
 

Private Attributes

 $additionalPurposes = array ("VideoPortable", "AudioPortable")
 
 $purposeSuffixes = array ()
 
 $mimeTypes = array()
 

Additional Inherited Members

- Data Fields inherited from ilObjectGUI
const COPY_WIZARD_NEEDS_PAGE = 1
 
 $ilias
 
 $objDefinition
 
 $tpl
 
 $tree
 
 $lng
 
 $data
 
 $object
 
 $ref_id
 
 $obj_id
 
 $maxcount
 
 $formaction
 
 $return_location
 
 $target_frame
 
 $tab_target_script
 
 $actions
 
 $sub_objects
 
 $omit_locator = false
 
const CFORM_NEW = 1
 
const CFORM_IMPORT = 2
 
const CFORM_CLONE = 3
 

Detailed Description

Member Function Documentation

◆ _goto()

static ilObjMediaCastGUI::_goto (   $a_target)
static

Definition at line 1329 of file class.ilObjMediaCastGUI.php.

1330 {
1331 global $ilAccess, $ilErr, $lng;
1332
1333 if ($ilAccess->checkAccess("read", "", $a_target))
1334 {
1335 $_GET["cmd"] = "listItems";
1336 $_GET["ref_id"] = $a_target;
1337 $_GET["baseClass"] = "ilmediacasthandlergui";
1338 $_GET["cmdClass"] = "ilobjmediacastgui";
1339 include("ilias.php");
1340 exit;
1341 }
1342 else if ($ilAccess->checkAccess("visible", "", $a_target))
1343 {
1344 ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
1345 }
1346 else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
1347 {
1348 ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
1351 }
1352
1353 $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1354
1355 }
$_GET["client_id"]
static _gotoRepositoryNode($a_ref_id, $a_cmd="frameset")
Goto repository root.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
exit
Definition: login.php:54

References $_GET, $ilErr, ilObjectGUI\$lng, ilObjectGUI\_gotoRepositoryNode(), ilObjectGUI\_gotoRepositoryRoot(), ilObject\_lookupObjId(), ilObject\_lookupTitle(), exit, and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ addCastItemObject()

ilObjMediaCastGUI::addCastItemObject ( )

Add media cast item.

Definition at line 281 of file class.ilObjMediaCastGUI.php.

282 {
283 global $tpl;
284
285 $this->checkPermission("write");
286
287 $this->initAddCastItemForm();
288 $tpl->setContent($this->form_gui->getHTML());
289 }
initAddCastItemForm($a_mode="create")
Init add cast item form.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.

References ilObjectGUI\$tpl, ilObjectGUI\checkPermission(), and initAddCastItemForm().

+ Here is the call graph for this function:

◆ addContentSubTabs()

ilObjMediaCastGUI::addContentSubTabs (   $a_active = "content")

Add content subtabs.

Parameters

return

Definition at line 1097 of file class.ilObjMediaCastGUI.php.

1098 {
1099 global $ilTabs, $ilAccess, $lng;
1100
1101 $ilTabs->addSubTab("content",
1102 $lng->txt("view"),
1103 $this->ctrl->getLinkTarget($this, "showContent"));
1104
1105 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
1106 {
1107 $ilTabs->addSubTab("manage",
1108 $lng->txt("mcst_manage"),
1109 $this->ctrl->getLinkTarget($this, "listItems"));
1110
1111 if ($this->object->getOrder() == ilObjMediaCast::ORDER_MANUAL)
1112 {
1113 $ilTabs->addSubTab("sorting",
1114 $lng->txt("mcst_ordering"),
1115 $this->ctrl->getLinkTarget($this, "editOrder"));
1116 }
1117 }
1118
1119 $ilTabs->activateSubTab($a_active);
1120 $ilTabs->activateTab("content");
1121 }

References $_GET, ilObjectGUI\$lng, and ilObjMediaCast\ORDER_MANUAL.

Referenced by editOrderObject(), listItemsObject(), and showGallery().

+ Here is the caller graph for this function:

◆ addLocatorItems()

ilObjMediaCastGUI::addLocatorItems ( )

should be overwritten to add object specific items (repository items are preloaded)

Reimplemented from ilObjectGUI.

Definition at line 1319 of file class.ilObjMediaCastGUI.php.

1320 {
1321 global $ilLocator;
1322
1323 if (is_object($this->object))
1324 {
1325 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "listItems"), "", $_GET["ref_id"]);
1326 }
1327 }

References $_GET.

◆ afterSave()

ilObjMediaCastGUI::afterSave (   $newObj)

save object @access public

Definition at line 132 of file class.ilObjMediaCastGUI.php.

133 {
134 // always send a message
135 ilUtil::sendSuccess($this->lng->txt("object_added"),true);
136 ilUtil::redirect("ilias.php?baseClass=ilMediaCastHandlerGUI&ref_id=".$newObj->getRefId()."&cmd=editSettings");
137 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static redirect($a_script)
http redirect to other script

References ilUtil\redirect(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ confirmDeletionItemsObject()

ilObjMediaCastGUI::confirmDeletionItemsObject ( )

Confirmation Screen.

Definition at line 878 of file class.ilObjMediaCastGUI.php.

879 {
880 global $ilCtrl, $lng, $tpl, $ilTabs;
881
882 $this->checkPermission("write");
883 $ilTabs->activateTab("edit_content");
884
885 if (!is_array($_POST["item_id"]))
886 {
887 $this->listItemsObject();
888 return;
889 }
890
891 include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
892 $c_gui = new ilConfirmationGUI();
893
894 // set confirm/cancel commands
895 $c_gui->setFormAction($ilCtrl->getFormAction($this, "deleteItems"));
896 $c_gui->setHeaderText($lng->txt("info_delete_sure"));
897 $c_gui->setCancel($lng->txt("cancel"), "listItems");
898 $c_gui->setConfirm($lng->txt("confirm"), "deleteItems");
899
900 // add items to delete
901 include_once("./Services/News/classes/class.ilNewsItem.php");
902 foreach($_POST["item_id"] as $item_id)
903 {
904 $item = new ilNewsItem($item_id);
905 $c_gui->addItem("item_id[]", $item_id, $item->getTitle(),
906 ilUtil::getImagePath("icon_mcst.svg"));
907 }
908
909 $tpl->setContent($c_gui->getHTML());
910 }
Confirmation screen class.
listItemsObject($a_presentation_mode=false)
List items of media cast.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18

References $_POST, $ilCtrl, ilObjectGUI\$lng, ilObjectGUI\$tpl, ilObjectGUI\checkPermission(), ilUtil\getImagePath(), and listItemsObject().

+ Here is the call graph for this function:

◆ convertFileObject()

ilObjMediaCastGUI::convertFileObject ( )

Convert file object.

Parameters

return

Definition at line 1584 of file class.ilObjMediaCastGUI.php.

1585 {
1586 global $ilCtrl;
1587
1588 $this->checkPermission("write");
1589
1590 $this->mcst_item = new ilNewsItem($_GET["item_id"]);
1591 include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1592 $mob = new ilObjMediaObject($this->mcst_item->getMobId());
1593
1594 $target_purpose = ilUtil::stripSlashes($_POST["target_purpose"]);
1595 $target_format = ilUtil::stripSlashes($_POST["target_format"]);
1596
1597 try
1598 {
1599 include_once("./Services/MediaObjects/classes/class.ilFFmpeg.php");
1600 $med = $mob->getMediaItem("Standard");
1601 $mob_file = ilObjMediaObject::_getDirectory($mob->getId())."/".$med->getLocation();
1602 $new_file = ilFFmpeg::convert($mob_file, $target_format);
1604 $pi = pathinfo($new_file);
1605 $med = $mob->getMediaItem($target_purpose);
1606 if (!is_object($med))
1607 {
1608 $med = new ilMediaItem();
1609 $med->setMobId($mob->getId());
1610 $mob->addMediaItem($med);
1611 $mob->update();
1612 $med->setPurpose($target_purpose);
1613 }
1614 $med->setFormat($target_format);
1615 $med->setLocation($pi["basename"]);
1616 $med->setLocationType("LocalFile");
1617 $med->update();
1618
1619 $add = (is_array($ret) && count($ret) > 0)
1620 ? "<br />".implode($ret, "<br />")
1621 : "";
1622
1623 ilUtil::sendInfo($this->lng->txt("mcst_converted_file").$add, true);
1624 }
1625 catch (ilException $e)
1626 {
1628 $add = (is_array($ret) && count($ret) > 0)
1629 ? "<br />".implode($ret, "<br />")
1630 : "";
1631 ilUtil::sendFailure($e->getMessage().$add, true);
1632 }
1633
1634
1635 $ilCtrl->redirect($this, "editCastItem");
1636 }
Base class for ILIAS Exception handling.
static convert($a_file, $a_target_mime, $a_target_dir="", $a_target_filename="")
Convert file to target mime type.
getLastReturnValues()
Get last return values.
Class ilMediaItem.
Class ilObjMediaObject.
_getDirectory($a_mob_id)
get directory for files of media object (static)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $_GET, $_POST, $ilCtrl, $ret, ilObjMediaObject\_getDirectory(), ilObjectGUI\checkPermission(), ilFFmpeg\convert(), ilFFmpeg\getLastReturnValues(), ilUtil\sendFailure(), ilUtil\sendInfo(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ createMediaItemForPurpose()

ilObjMediaCastGUI::createMediaItemForPurpose (   $mob,
  $purpose 
)
private

handle media item for given purpose

Parameters
ilMediaObject$mob
stringfile

Definition at line 686 of file class.ilObjMediaCastGUI.php.

687 {
688 $mediaItem = new ilMediaItem();
689 $mob->addMediaItem($mediaItem);
690 $mediaItem->setPurpose($purpose);
691 return $this->updateMediaItem($mob, $mediaItem);
692 }
updateMediaItem($mob, & $mediaItem)
update media item from form

References updateMediaItem().

Referenced by saveCastItemObject(), and updateCastItemObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteItemsObject()

ilObjMediaCastGUI::deleteItemsObject ( )

Delete news items.

Definition at line 915 of file class.ilObjMediaCastGUI.php.

916 {
917 global $ilCtrl;
918
919 $this->checkPermission("write");
920
921 // delete all selected news items
922 foreach($_POST["item_id"] as $item_id)
923 {
924 $mc_item = new ilNewsItem($item_id);
925 $mc_item->delete();
926 }
927
928 $ilCtrl->redirect($this, "listItems");
929 }

References $_POST, $ilCtrl, and ilObjectGUI\checkPermission().

+ Here is the call graph for this function:

◆ determinePlaytimeObject()

ilObjMediaCastGUI::determinePlaytimeObject ( )

Delete news items.

Definition at line 950 of file class.ilObjMediaCastGUI.php.

951 {
952 global $ilCtrl, $lng;
953
954 $mc_item = new ilNewsItem($_GET["item_id"]);
955 $mob = $mc_item->getMobId();
956 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
957 $mob = new ilObjMediaObject($mob);
958 $mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
959 $m_item = $mob->getMediaItem("Standard");
960 $file = $mob_dir."/".$m_item->getLocation();
961 $duration = $this->getDuration($file);
962 if ($duration != "00:00:00")
963 {
964 $mc_item->setPlaytime($duration);
965 $mc_item->update();
966 ilUtil::sendSuccess($lng->txt("mcst_set_playtime"), true);
967 }
968 else
969 {
970 ilUtil::sendFailure($lng->txt("mcst_unable_to_determin_playtime"), true);
971 }
972
973 $ilCtrl->redirect($this, "listItems");
974 }
print $file
getDuration($file)
get duration from form or from file analyzer

References $_GET, $file, $ilCtrl, ilObjectGUI\$lng, ilObjMediaObject\_getDirectory(), getDuration(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ downloadItemObject()

ilObjMediaCastGUI::downloadItemObject ( )

Download news media item.

Definition at line 934 of file class.ilObjMediaCastGUI.php.

935 {
936 global $ilCtrl;
937 $this->checkPermission("read");
938
939 $news_item = new ilNewsItem($_GET["item_id"]);
940 if (!$news_item->deliverMobFile($_GET["purpose"], (int) $_GET["presentation"]))
941 {
942 $ilCtrl->redirect($this, "listItems");
943 }
944 exit;
945 }

References $_GET, $ilCtrl, ilObjectGUI\checkPermission(), and exit.

+ Here is the call graph for this function:

◆ editCastItemObject()

ilObjMediaCastGUI::editCastItemObject ( )

Edit media cast item.

Definition at line 294 of file class.ilObjMediaCastGUI.php.

295 {
296 global $tpl, $ilToolbar, $ilCtrl;
297
298 $this->checkPermission("write");
299
300 // conversion toolbar
301 include_once("./Services/MediaObjects/classes/class.ilFFmpeg.php");
302 if (ilFFmpeg::enabled())
303 {
304 $this->mcst_item = new ilNewsItem($_GET["item_id"]);
305 include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
306 $mob = new ilObjMediaObject($this->mcst_item->getMobId());
307
308 $conv_cnt = 0;
309 // we had other purposes as source as well, but
310 // currently only "Standard" is implemented in the convertFile method
311 foreach (array("Standard") as $p)
312 {
313 /*
314 $med = $mob->getMediaItem($p);
315 if (is_object($med))
316 {
317 $options = ilFFmpeg::getPossibleTargetMimeTypes($med->getFormat());
318 if (count($options) > 0)
319 {
320 if ($conv_cnt > 0)
321 {
322 $ilToolbar->addSeparator();
323 }
324
325 include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
326 $si = new ilSelectInputGUI($this->lng->txt("mcst_conv_".
327 strtolower($p)."_to"), "target_format");
328 $si->setOptions($options);
329 $ilToolbar->addInputItem($si, true);
330
331 $si = new ilSelectInputGUI(", ".$this->lng->txt("mcst_target").": ",
332 "target_purpose");
333 $si->setOptions(array("Standard" => $this->lng->txt("mcst_purpose_standard"),
334 "VideoAlternative" => $this->lng->txt("mcst_purpose_videoalternative")
335 ));
336 $si->setValue($p);
337 $ilToolbar->addInputItem($si, true);
338
339 $ilToolbar->addFormButton($this->lng->txt("mcst_convert"), "convertFile");
340
341 $conv_cnt++;
342 }
343 }
344 */
345
346 $med = $mob->getMediaItem($p);
347 if (is_object($med))
348 {
349 if (ilFFmpeg::supportsImageExtraction($med->getFormat()))
350 {
351 // second
352 include_once("./Services/Form/classes/class.ilTextInputGUI.php");
353 $ni = new ilTextInputGUI($this->lng->txt("mcst_second"), "sec");
354 $ni->setMaxLength(4);
355 $ni->setSize(4);
356 $ni->setValue(1);
357 $ilToolbar->addInputItem($ni, true);
358
359 $ilToolbar->addFormButton($this->lng->txt("mcst_extract_preview_image"), "extractPreviewImage");
360 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
361 }
362 }
363
364 /*if ($conv_cnt > 0)
365 {
366 $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
367 }*/
368 }
369 }
370
371 $this->initAddCastItemForm("edit");
372 $this->getCastItemValues();
373 $tpl->setContent($this->form_gui->getHTML());
374 }
static enabled()
Checks, whether FFmpeg support is enabled (path is set in the setup)
static supportsImageExtraction($a_mime)
Check if mime type supports image extraction.
getCastItemValues()
Get cast item values into form.
This class represents a text property in a property form.

References $_GET, $ilCtrl, ilObjectGUI\$tpl, ilObjectGUI\checkPermission(), ilFFmpeg\enabled(), getCastItemValues(), initAddCastItemForm(), and ilFFmpeg\supportsImageExtraction().

+ Here is the call graph for this function:

◆ editOrderObject()

ilObjMediaCastGUI::editOrderObject ( )
protected

Definition at line 1416 of file class.ilObjMediaCastGUI.php.

1417 {
1418 global $ilTabs, $lng, $tpl;
1419
1420 $this->checkPermission("write");
1421 $ilTabs->activateTab("edit_content");
1422
1423 $this->addContentSubTabs("sorting");
1424
1425 // sort by order setting
1426 switch($this->object->getOrder())
1427 {
1431 return $this->listItemsObject();
1432
1434 // sub-tabs
1435 break;
1436 }
1437
1438 include_once("./Modules/MediaCast/classes/class.ilMediaCastTableGUI.php");
1439 $table_gui = new ilMediaCastTableGUI($this, "editOrder", true);
1440
1441 $table_gui->setTitle($lng->txt("mcst_media_cast"));
1442 $table_gui->setData($this->object->getSortedItemsArray());
1443
1444 $table_gui->addCommandButton("saveOrder", $lng->txt("mcst_save_order"));
1445
1446 $tpl->setContent($table_gui->getHTML());
1447 }
TableGUI class for table NewsForContext.
addContentSubTabs($a_active="content")
Add content subtabs.

References ilObjectGUI\$lng, ilObjectGUI\$tpl, addContentSubTabs(), ilObjectGUI\checkPermission(), listItemsObject(), ilObjMediaCast\ORDER_CREATION_DATE_ASC, ilObjMediaCast\ORDER_CREATION_DATE_DESC, ilObjMediaCast\ORDER_MANUAL, and ilObjMediaCast\ORDER_TITLE.

+ Here is the call graph for this function:

◆ editSettingsObject()

ilObjMediaCastGUI::editSettingsObject ( )

Edit settings.

Definition at line 1127 of file class.ilObjMediaCastGUI.php.

1128 {
1129 global $tpl, $ilTabs;
1130
1131 $this->checkPermission("write");
1132 $ilTabs->activateTab("id_settings");
1133
1134 $this->initSettingsForm();
1135 $tpl->setContent($this->form_gui->getHtml());
1136 }
initSettingsForm()
Init Settings Form.

References ilObjectGUI\$tpl, ilObjectGUI\checkPermission(), and initSettingsForm().

+ Here is the call graph for this function:

◆ executeCommand()

ilObjMediaCastGUI::executeCommand ( )

execute command

Reimplemented from ilObjectGUI.

Definition at line 58 of file class.ilObjMediaCastGUI.php.

59 {
60 global $ilUser, $ilTabs;
61
62 $next_class = $this->ctrl->getNextClass($this);
63 $cmd = $this->ctrl->getCmd();
64 $this->prepareOutput();
65
66 switch($next_class)
67 {
68 case "ilinfoscreengui":
69 $this->checkPermission("visible");
70 $this->infoScreen(); // forwards command
71 break;
72
73 case "ilexportgui":
74// $this->prepareOutput();
75 $ilTabs->activateTab("export");
76 include_once("./Services/Export/classes/class.ilExportGUI.php");
77 $exp_gui = new ilExportGUI($this);
78 $exp_gui->addFormat("xml");
79 $ret = $this->ctrl->forwardCommand($exp_gui);
80// $this->tpl->show();
81 break;
82
83 case 'ilpermissiongui':
84 $ilTabs->activateTab("id_permissions");
85 include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
86 $perm_gui =& new ilPermissionGUI($this);
87 $ret =& $this->ctrl->forwardCommand($perm_gui);
88 break;
89
90 case "ilcommonactiondispatchergui":
91 include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
93 $this->ctrl->forwardCommand($gui);
94 break;
95
96 default:
97 if(!$cmd)
98 {
99 $cmd = "infoScreen";
100 }
101 $cmd .= "Object";
102 if ($cmd != "infoScreenObject")
103 {
104 $this->checkPermission("read");
105 }
106 else
107 {
108 $this->checkPermission("visible");
109 }
110 $this->$cmd();
111
112 break;
113 }
114
115 $this->addHeaderAction();
116
117 return true;
118 }
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
Export User Interface Class.
infoScreen()
show information screen
prepareOutput()
prepare output
addHeaderAction()
Add header action menu.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
$cmd
Definition: sahs_server.php:35
global $ilUser
Definition: imgupload.php:15

References $cmd, $ilUser, $ret, ilObjectGUI\addHeaderAction(), ilObjectGUI\checkPermission(), ilCommonActionDispatcherGUI\getInstanceFromAjaxCall(), infoScreen(), and ilObjectGUI\prepareOutput().

+ Here is the call graph for this function:

◆ extractPreviewImageObject()

ilObjMediaCastGUI::extractPreviewImageObject ( )

Extract preview image.

Parameters

return

Definition at line 1644 of file class.ilObjMediaCastGUI.php.

1645 {
1646 global $ilCtrl;
1647
1648 $this->checkPermission("write");
1649
1650 $this->mcst_item = new ilNewsItem($_GET["item_id"]);
1651 include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1652 $mob = new ilObjMediaObject($this->mcst_item->getMobId());
1653
1654 try
1655 {
1656 $sec = (int) $_POST["sec"];
1657 if ($sec < 0)
1658 {
1659 $sec = 0;
1660 }
1661 if ($mob->getVideoPreviewPic() != "")
1662 {
1663 $mob->removeAdditionalFile($mob->getVideoPreviewPic(true));
1664 }
1665 include_once("./Services/MediaObjects/classes/class.ilFFmpeg.php");
1666 $med = $mob->getMediaItem("Standard");
1667 $mob_file = ilObjMediaObject::_getDirectory($mob->getId())."/".$med->getLocation();
1668 $new_file = ilFFmpeg::extractImage($mob_file, "mob_vpreview.png",
1669 ilObjMediaObject::_getDirectory($mob->getId()), $sec);
1670
1671 if ($new_file != "")
1672 {
1673 ilUtil::sendInfo($this->lng->txt("mcst_image_extracted"), true);
1674 }
1675 else
1676 {
1677 ilUtil::sendFailure($this->lng->txt("mcst_no_extraction_possible"), true);
1678 }
1679 }
1680 catch (ilException $e)
1681 {
1682 if (DEVMODE == 1)
1683 {
1685 $add = (is_array($ret) && count($ret) > 0)
1686 ? "<br />".implode($ret, "<br />")
1687 : "";
1688 }
1689 ilUtil::sendFailure($e->getMessage().$add, true);
1690 }
1691
1692
1693 $ilCtrl->redirect($this, "editCastItem");
1694 }
static extractImage($a_file, $a_target_filename, $a_target_dir="", $a_sec=1)
Extract image from video file.

References $_GET, $_POST, $ilCtrl, $ret, ilObjMediaObject\_getDirectory(), ilObjectGUI\checkPermission(), ilFFmpeg\extractImage(), ilFFmpeg\getLastReturnValues(), ilUtil\sendFailure(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ getCastItemValues()

ilObjMediaCastGUI::getCastItemValues ( )

Get cast item values into form.

Definition at line 502 of file class.ilObjMediaCastGUI.php.

503 {
504 global $lng;
505
506 // get mob
507 $this->mcst_item = new ilNewsItem($_GET["item_id"]);
508 include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
509 $mob = new ilObjMediaObject($this->mcst_item->getMobId());
510
511 // preview
512 $ppic = $mob->getVideoPreviewPic();
513 if ($ppic != "")
514 {
515 $i = $this->form_gui->getItemByPostVar("preview_pic");
516 $i->setImage($ppic);
517 }
518
519
520 $values = array();
521 $mediaItems = $this->getMediaItems($_GET["item_id"]);
522 if (count ($mediaItems) > 0)
523 {
524 foreach ($mediaItems as $med)
525 {
526 if (!isset ($values["title"]))
527 {
528 // first item, so set title, description, ...
529 $values["title"] = $this->mcst_item->getTitle();
530 $values["description"] = $this->mcst_item->getContent();
531 $values["visibility"] = $this->mcst_item->getVisibility();
532 $length = explode(":", $this->mcst_item->getPlaytime());
533 $values["duration"] = array("hh" => $length[0], "mm" => $length[1], "ss" => $length[2]);
534 }
535
536 $values["value_".$med->getPurpose()] = (strlen($med->getLocation())> 100) ? "...".substr($med->getLocation(), strlen($med->getLocation()) - 100) : $med->getLocation();
537 $values["label_value_".$med->getPurpose()] = (strlen($med->getLocation())> 100) ? "...".substr($med->getLocation(), strlen($med->getLocation()) - 100) : $med->getLocation();
538 $values["mimetype_".$med->getPurpose()] = $med->getFormat();
539 }
540 }
541 foreach (ilObjMediaCast::$purposes as $purpose) {
542 if (!isset ($values["value_".$purpose]))
543 {
544 $values["label_value_".$purpose] = $lng->txt("none");
545 $values["value_".$purpose] = $lng->txt("none");
546 }
547 }
548 $this->form_gui->setValuesByArray($values);
549 }
getMediaItems($id)
get MediaItems for id and updates local variable mcst_item

References $_GET, ilObjectGUI\$lng, ilObjMediaCast\$purposes, and getMediaItems().

Referenced by editCastItemObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDuration()

ilObjMediaCastGUI::getDuration (   $file)
private

get duration from form or from file analyzer

Parameters
unknown_type$file
Returns
unknown

Definition at line 658 of file class.ilObjMediaCastGUI.php.

659 {
660 $duration = isset($this->form_gui)
661 ? $this->form_gui->getInput("duration")
662 : array("hh"=>0, "mm"=>0, "ss"=>0);
663 if ($duration["hh"] == 0 && $duration["mm"] == 0 && $duration["ss"] == 0 && is_file($file))
664 {
665 include_once("./Services/MediaObjects/classes/class.ilMediaAnalyzer.php");
666 $ana = new ilMediaAnalyzer();
667 $ana->setFile($file);
668 $ana->analyzeFile();
669 $dur = $ana->getPlaytimeString();
670 $dur = explode(":", $dur);
671 $duration["mm"] = $dur[0];
672 $duration["ss"] = $dur[1];
673 }
674 $duration = str_pad($duration["hh"], 2 , "0", STR_PAD_LEFT).":".
675 str_pad($duration["mm"], 2 , "0", STR_PAD_LEFT).":".
676 str_pad($duration["ss"], 2 , "0", STR_PAD_LEFT);
677 return $duration;
678 }
Analyzes media files.

References $file.

Referenced by determinePlaytimeObject(), saveCastItemObject(), and updateCastItemObject().

+ Here is the caller graph for this function:

◆ getFeedIconsHTML()

ilObjMediaCastGUI::getFeedIconsHTML ( )

Get feed icons HTML.

Parameters

return

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

197 {
198 global $lng;
199
200 $html = "";
201
202 include_once("./Services/Block/classes/class.ilBlockSetting.php");
203 $public_feed = ilBlockSetting::_lookup("news", "public_feed",
204 0, $this->object->getId());
205
206 // rss icon/link
207 if ($public_feed)
208 {
209 $news_set = new ilSetting("news");
210 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
211
212 if ($enable_internal_rss)
213 {
214 // create dummy object in db (we need an id)
215 $items = $this->object->getItemsArray();
216 include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
217 $html = "";
218 foreach (ilObjMediaCast::$purposes as $purpose)
219 {
220 foreach ($items as $id => $item)
221 {
222 $mob = new ilObjMediaObject($item["mob_id"]);
223 $mob->read();
224 if ($mob->hasPurposeItem($purpose))
225 {
226 if ($html == "")
227 {
228 $html = " ";
229 }
230 $url = ILIAS_HTTP_PATH."/feed.php?client_id=".rawurlencode(CLIENT_ID)."&"."ref_id=".$_GET["ref_id"]."&purpose=$purpose";
231 $title = $lng->txt("news_feed_url");
232
233 include_once("./Services/News/classes/class.ilRSSButtonGUI.php");
234 switch (strtolower($purpose))
235 {
236 case "audioportable":
239 break;
240
241 case "videoportable":
244 break;
245
246 default:
249 break;
250 }
251 $row1 .= "&nbsp;".ilRSSButtonGUI::get($type1, $url);
252 if ($this->object->getPublicFiles())
253 {
254 $url = preg_replace("/https?/i","itpc",$url);
255 $title = $lng->txt("news_feed_url");
256
257 include_once("./Services/News/classes/class.ilRSSButtonGUI.php");
258 $row2 .= "&nbsp;".ilRSSButtonGUI::get($type2, $url);
259 }
260 break;
261 }
262 }
263 }
264 if ($html != "")
265 {
266 $html .= $row1;
267 if ($row2 != "")
268 {
269 $html .= $row2;
270 }
271 }
272 }
273 }
274 return $html;
275 }
static _lookup($a_type, $a_setting, $a_user=0, $a_block_id=0)
Lookup setting from database.
ILIAS Setting Class.

References ilObjectGUI\$lng, ilObjMediaCast\$purposes, ilBlockSetting\_lookup(), ilRSSButtonGUI\ICON_ITUNES, ilRSSButtonGUI\ICON_ITUNES_AUDIO, ilRSSButtonGUI\ICON_ITUNES_VIDEO, ilRSSButtonGUI\ICON_RSS, ilRSSButtonGUI\ICON_RSS_AUDIO, and ilRSSButtonGUI\ICON_RSS_VIDEO.

Referenced by listItemsObject(), and showGallery().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getMediaItem()

ilObjMediaCastGUI::getMediaItem (   $id)
protected

get MediaItem for id and updates local variable mcst_item

Returns
ilMediaItem

Definition at line 1373 of file class.ilObjMediaCastGUI.php.

1373 {
1374 include_once("./Services/News/classes/class.ilNewsItem.php");
1375 $this->mcst_item = new ilNewsItem($id);
1376 // create dummy object in db (we need an id)
1377 include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1378 $mob = new ilObjMediaObject($this->mcst_item->getMobId());
1379 return $mob->getMediaItem("Standard");
1380 }

◆ getMediaItems()

ilObjMediaCastGUI::getMediaItems (   $id)
protected

get MediaItems for id and updates local variable mcst_item

Returns
array of ilMediaItem

Definition at line 1388 of file class.ilObjMediaCastGUI.php.

1388 {
1389 include_once("./Services/News/classes/class.ilNewsItem.php");
1390 $this->mcst_item = new ilNewsItem($id);
1391 // create dummy object in db (we need an id)
1392 include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1393 $mob = new ilObjMediaObject($this->mcst_item->getMobId());
1394 return $mob->getMediaItems();
1395 }

Referenced by getCastItemValues().

+ Here is the caller graph for this function:

◆ handlePlayerEventObject()

ilObjMediaCastGUI::handlePlayerEventObject ( )

Handle player event.

Parameters

return

Definition at line 1702 of file class.ilObjMediaCastGUI.php.

1703 {
1704 if ($_GET["event"] == "play")
1705 {
1706 $player = explode("_", $_GET["player"]);
1707 $news_id = (int) $player[1];
1708 include_once("./Services/News/classes/class.ilNewsItem.php");
1709 $item = new ilNewsItem($news_id);
1710 $item->increasePlayCounter();
1711 }
1712 exit;
1713 }

References $_GET, and exit.

◆ ilObjMediaCastGUI()

ilObjMediaCastGUI::ilObjMediaCastGUI (   $a_data,
  $a_id,
  $a_call_by_reference,
  $a_prepare_output = true 
)

Constructor @access public.

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

29 {
30 global $ilCtrl, $lng;
31
32 $this->type = "mcst";
33 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
34 $lng->loadLanguageModule("mcst");
35 $lng->loadLanguageModule("news");
36 $lng->loadLanguageModule("rep");
37
38 $ilCtrl->saveParameter($this, "item_id");
39
40 include_once ("./Modules/MediaCast/classes/class.ilMediaCastSettings.php");
42 $this->purposeSuffixes = $settings->getPurposeSuffixes();
43 $this->mimeTypes = array();
44 $mime_types = $settings->getMimeTypes();
45 foreach ($mime_types as $mt)
46 {
47 $this->mimeTypes[$mt] = $mt;
48 }
49
50 include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
51 foreach (ilMimeTypeUtil::getExt2MimeMap() as $mt)
52 {
53 $this->mimeTypes[$mt] = $mt;
54 }
55 asort($this->mimeTypes);
56 }
static _getInstance()
get singleton instance
static getExt2MimeMap()
get file extension to mime type map
ilObjectGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor @access public.

References $ilCtrl, ilObjectGUI\$lng, ilMediaCastSettings\_getInstance(), ilMimeTypeUtil\getExt2MimeMap(), and ilObjectGUI\ilObjectGUI().

+ Here is the call graph for this function:

◆ infoScreen()

ilObjMediaCastGUI::infoScreen ( )

show information screen

Definition at line 992 of file class.ilObjMediaCastGUI.php.

993 {
994 global $ilAccess, $ilUser, $ilTabs;
995
996 $ilTabs->activateTab("id_info");
997
998 if (!$ilAccess->checkAccess("visible", "", $this->object->getRefId()))
999 {
1000 $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
1001 }
1002
1003 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1004 $info = new ilInfoScreenGUI($this);
1005
1006 $info->enablePrivateNotes();
1007
1008 /*
1009 $info->enableNews();
1010 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
1011 {
1012 //$info->enableNewsEditing();
1013 $info->setBlockProperty("news", "settings", true);
1014 }*/
1015
1016 // general information
1017 $this->lng->loadLanguageModule("meta");
1018 $this->lng->loadLanguageModule("mcst");
1019 $med_items = $this->object->getItemsArray();
1020 $info->addSection($this->lng->txt("meta_general"));
1021 $info->addProperty($this->lng->txt("mcst_nr_items"),
1022 (int) count($med_items));
1023
1024 if (count($med_items) > 0)
1025 {
1026 $cur = current($med_items);
1027 $last = ilDatePresentation::formatDate(new ilDateTime($cur["creation_date"], IL_CAL_DATETIME));
1028 }
1029 else
1030 {
1031 $last = "-";
1032 }
1033
1034 $info->addProperty($this->lng->txt("mcst_last_submission"), $last);
1035
1036 // forward the command
1037 $this->ctrl->forwardCommand($info);
1038 }
const IL_CAL_DATETIME
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
Class ilInfoScreenGUI.
redirection script todo: (a better solution should control the processing via a xml file)

References $ilUser, ilDatePresentation\formatDate(), and IL_CAL_DATETIME.

Referenced by executeCommand(), and infoScreenObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ infoScreenObject()

ilObjMediaCastGUI::infoScreenObject ( )

this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually, if everything works through ilCtrl in the future this may be changed

Definition at line 981 of file class.ilObjMediaCastGUI.php.

982 {
983 $this->checkPermission("visible");
984 $this->ctrl->setCmd("showSummary");
985 $this->ctrl->setCmdClass("ilinfoscreengui");
986 $this->infoScreen();
987 }

References ilObjectGUI\checkPermission(), and infoScreen().

+ Here is the call graph for this function:

◆ initAddCastItemForm()

ilObjMediaCastGUI::initAddCastItemForm (   $a_mode = "create")

Init add cast item form.

Definition at line 379 of file class.ilObjMediaCastGUI.php.

380 {
381 global $lng, $ilCtrl, $ilTabs;
382
383 $this->checkPermission("write");
384 $ilTabs->activateTab("edit_content");
385
386 $lng->loadLanguageModule("mcst");
387
388 $news_set = new ilSetting("news");
389 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
390
391 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
392 $this->form_gui = new ilPropertyFormGUI();
393 $this->form_gui->setMultipart(true);
394
395 // Property Title
396 $text_input = new ilTextInputGUI($lng->txt("title"), "title");
397 $text_input->setMaxLength(200);
398 $this->form_gui->addItem($text_input);
399
400 // Property Content
401 $text_area = new ilTextAreaInputGUI($lng->txt("description"), "description");
402 $text_area->setRequired(false);
403 $this->form_gui->addItem($text_area);
404
405 // Property Visibility
406 if ($enable_internal_rss)
407 {
408 $radio_group = new ilRadioGroupInputGUI($lng->txt("access_scope"), "visibility");
409 $radio_option = new ilRadioOption($lng->txt("access_users"), "users");
410 $radio_group->addOption($radio_option);
411 $radio_option = new ilRadioOption($lng->txt("access_public"), "public");
412 $radio_group->addOption($radio_option);
413 $radio_group->setInfo($lng->txt("mcst_visibility_info"));
414 $radio_group->setRequired(true);
415 $radio_group->setValue($this->object->getDefaultAccess() == 0 ? "users" : "public");
416 $this->form_gui->addItem($radio_group);
417 }
418
419 // Duration
420 $dur = new ilDurationInputGUI($lng->txt("mcst_duration"), "duration");
421 $dur->setInfo($lng->txt("mcst_duration_info"));
422 $dur->setShowDays(false);
423 $dur->setShowHours(true);
424 $dur->setShowSeconds(true);
425 $this->form_gui->addItem($dur);
426
427 foreach (ilObjMediaCast::$purposes as $purpose)
428 {
429 if ($purpose == "VideoAlternative" &&
430 $a_mode == "create")
431 {
432 continue;
433 }
434
436 $section->setTitle($lng->txt("mcst_".strtolower($purpose)."_title"));
437 $this->form_gui->addItem($section);
438 if ($a_mode != "create")
439 {
440 $value = new ilHiddenInputGUI("value_".$purpose);
441 $label = new ilNonEditableValueGUI($lng->txt("value"));
442 $label->setPostVar("label_value_".$purpose);
443 $label->setInfo($lng->txt("mcst_current_value_info"));
444 $this->form_gui->addItem($label);
445 $this->form_gui->addItem($value);
446
447 }
448 $file = new ilFileInputGUI($lng->txt("file"), "file_".$purpose);
449 $file->setSuffixes($this->purposeSuffixes[$purpose]);
450 $this->form_gui->addItem($file);
451 $text_input = new ilRegExpInputGUI($lng->txt("url"), "url_".$purpose);
452 $text_input->setPattern("/https?\:\/\/.+/i");
453 $text_input->setInfo($lng->txt("mcst_reference_info"));
454 $this->form_gui->addItem($text_input);
455 if ($purpose != "Standard")
456 {
457 $clearCheckBox = new ilCheckboxInputGUI();
458 $clearCheckBox->setPostVar("delete_".$purpose);
459 $clearCheckBox->setTitle($lng->txt("mcst_clear_purpose_title"));
460 $this->form_gui->addItem($clearCheckBox);
461 } else {
462
463 // mime type selection
464 $mimeTypeSelection = new ilSelectInputGUI();
465 $mimeTypeSelection->setPostVar("mimetype_".$purpose);
466 $mimeTypeSelection->setTitle($lng->txt("mcst_mimetype"));
467 $mimeTypeSelection->setInfo($lng->txt("mcst_mimetype_info"));
468 $options = array("" => $lng->txt("mcst_automatic_detection"));
469 $options = array_merge($options, $this->mimeTypes);
470 $mimeTypeSelection->setOptions($options);
471 $this->form_gui->addItem($mimeTypeSelection);
472
473 // preview picure
474 $pp = new ilImageFileInputGUI($lng->txt("mcst_preview_picture"), "preview_pic");
475 $pp->setSuffixes(array("png", "jpeg", "jpg"));
476 $pp->setInfo($lng->txt("mcst_preview_picture_info")." mp4, mp3, png, jp(e)g, gif");
477 $this->form_gui->addItem($pp);
478
479 }
480
481 }
482
483 // save/cancel button
484 if ($a_mode == "create")
485 {
486 $this->form_gui->setTitle($lng->txt("mcst_add_new_item"));
487 $this->form_gui->addCommandButton("saveCastItem", $lng->txt("save"));
488 }
489 else
490 {
491 $this->form_gui->setTitle($lng->txt("mcst_edit_item"));
492 $this->form_gui->addCommandButton("updateCastItem", $lng->txt("save"));
493 }
494 $this->form_gui->addCommandButton("listItems", $lng->txt("cancel"));
495 $this->form_gui->setFormAction($ilCtrl->getFormAction($this, "saveCastItem"));
496
497 }
$section
Definition: Utf8Test.php:84
This class represents a checkbox property in a property form.
This class represents a duration (typical hh:mm:ss) property in a property form.
This class represents a file property in a property form.
This class represents a section header in a property form.
This class represents a hidden form property in a property form.
This class represents an image file property in a property form.
This class represents a non editable value in a property form.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
This class represents a regular expression input property in a property form.
This class represents a selection list property in a property form.
This class represents a text area property in a property form.
if(!is_array($argv)) $options

References $file, $ilCtrl, ilObjectGUI\$lng, $options, ilObjMediaCast\$purposes, $section, and ilObjectGUI\checkPermission().

Referenced by addCastItemObject(), editCastItemObject(), saveCastItemObject(), and updateCastItemObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCreationForms()

ilObjMediaCastGUI::initCreationForms (   $a_new_type)
protected

Init creation froms.

this will create the default creation forms: new, import, clone

Parameters
string$a_new_type
Returns
array

Reimplemented from ilObjectGUI.

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

121 {
122 $forms = array(self::CFORM_NEW => $this->initCreateForm($a_new_type),
123 self::CFORM_IMPORT => $this->initImportForm($a_new_type));
124
125 return $forms;
126 }
initImportForm($a_new_type)
Init object import form.
initCreateForm($a_new_type)
Init object creation form.

References ilObjectGUI\initCreateForm(), and ilObjectGUI\initImportForm().

+ Here is the call graph for this function:

◆ initSettingsForm()

ilObjMediaCastGUI::initSettingsForm ( )

Init Settings Form.

Definition at line 1141 of file class.ilObjMediaCastGUI.php.

1142 {
1143 global $tpl, $lng, $ilCtrl;
1144
1145 $lng->loadLanguageModule("mcst");
1146
1147 include("Services/Form/classes/class.ilPropertyFormGUI.php");
1148 $this->form_gui = new ilPropertyFormGUI();
1149 $this->form_gui->setTitle($lng->txt("mcst_settings"));
1150
1151 // Title
1152 $tit = new ilTextInputGUI($lng->txt("title"), "title");
1153 $tit->setValue($this->object->getTitle());
1154 $tit->setRequired(true);
1155 $this->form_gui->addItem($tit);
1156
1157 // description
1158 $des = new ilTextAreaInputGUI($lng->txt("description"), "description");
1159 $des->setValue($this->object->getLongDescription());
1160 $this->form_gui->addItem($des);
1161
1162 $sh = new ilFormSectionHeaderGUI();
1163 $sh->setTitle($lng->txt("rep_activation_availability"));
1164 $this->form_gui->addItem($sh);
1165
1166 // Online
1167 $online = new ilCheckboxInputGUI($lng->txt("online"), "online");
1168 $online->setChecked($this->object->getOnline());
1169 $this->form_gui->addItem($online);
1170
1171 // presentation
1172 $sh = new ilFormSectionHeaderGUI();
1173 $sh->setTitle($lng->txt("obj_presentation"));
1174 $this->form_gui->addItem($sh);
1175
1176 // Sorting
1177 $sort = new ilRadioGroupInputGUI($lng->txt("mcst_ordering"), "order");
1178 $sort->addOption(new ilRadioOption($lng->txt("mcst_ordering_title"),
1180 $sort->addOption(new ilRadioOption($lng->txt("mcst_ordering_creation_date_asc"),
1182 $sort->addOption(new ilRadioOption($lng->txt("mcst_ordering_creation_date_desc"),
1184 $sort->addOption(new ilRadioOption($lng->txt("mcst_ordering_manual"),
1186 $sort->setValue($this->object->getOrder());
1187 $this->form_gui->addItem($sort);
1188
1189 // view mode
1190 $options = array(
1191 ilObjMediaCast::VIEW_LIST => $lng->txt("mcst_list"),
1192 ilObjMediaCast::VIEW_GALLERY => $lng->txt("mcst_gallery")
1193 );
1194 $si = new ilRadioGroupInputGUI($this->lng->txt("mcst_viewmode"), "viewmode");
1195 $si->addOption(new ilRadioOption($lng->txt("mcst_list"),
1197 $si->addOption(new ilRadioOption($lng->txt("mcst_gallery"),
1199
1200// $si->setOptions($options);
1201 $si->setValue($this->object->getViewMode());
1202 $this->form_gui->addItem($si);
1203
1204
1205 // Downloadable
1206 $downloadable = new ilCheckboxInputGUI($lng->txt("mcst_downloadable"), "downloadable");
1207 $downloadable->setChecked($this->object->getDownloadable());
1208 $downloadable->setInfo($lng->txt("mcst_downloadable_info"));
1209 $this->form_gui->addItem($downloadable);
1210
1211 $news_set = new ilSetting("news");
1212 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1213
1214 //Default Visibility
1215 if ($enable_internal_rss)
1216 {
1217 // webfeed
1218 $sh = new ilFormSectionHeaderGUI();
1219 $sh->setTitle($lng->txt("mcst_webfeed"));
1220 $this->form_gui->addItem($sh);
1221
1222 $radio_group = new ilRadioGroupInputGUI($lng->txt("news_default_visibility"), "defaultaccess");
1223 $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "0");
1224 $radio_option->setInfo($lng->txt("news_news_item_def_visibility_users_info"));
1225 $radio_group->addOption($radio_option);
1226 $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "1");
1227 $radio_option->setInfo($lng->txt("news_news_item_def_visibility_public_info"));
1228 $radio_group->addOption($radio_option);
1229 $radio_group->setRequired(false);
1230 $radio_group->setValue($this->object->getDefaultAccess());
1231 #$ch->addSubItem($radio_group);
1232 $this->form_gui->addItem($radio_group);
1233
1234 //Extra Feed
1235 include_once("./Services/Block/classes/class.ilBlockSetting.php");
1236 $public_feed = ilBlockSetting::_lookup("news", "public_feed", 0, $this->object->getId());
1237 $ch = new ilCheckboxInputGUI($lng->txt("news_public_feed"), "extra_feed");
1238 $ch->setInfo($lng->txt("news_public_feed_info"));
1239 $ch->setChecked($public_feed);
1240 $this->form_gui->addItem($ch);
1241
1242 // keep minimal x number of items
1243 $ni = new ilNumberInputGUI($this->lng->txt("news_keep_minimal_x_items"), "keep_rss_min");
1244 $ni->setMaxValue(100);
1245 $ni->setMinValue(0);
1246 $ni->setMaxLength(3);
1247 $ni->setSize(3);
1248 $ni->setInfo($this->lng->txt("news_keep_minimal_x_items_info")." (".
1249 ilNewsItem::_lookupRSSPeriod()." ".(ilNewsItem::_lookupRSSPeriod() == 1 ? $lng->txt("day") : $lng->txt("days")).")");
1250 $ni->setValue((int) ilBlockSetting::_lookup("news", "keep_rss_min", 0, $this->object->getId()));
1251 $ch->addSubItem($ni);
1252
1253 // Include Files in Pubic Items
1254 $incl_files = new ilCheckboxInputGUI($lng->txt("mcst_incl_files_in_rss"), "public_files");
1255 $incl_files->setChecked($this->object->getPublicFiles());
1256 $incl_files->setInfo($lng->txt("mcst_incl_files_in_rss_info"));
1257 #$ch->addSubItem($incl_files);
1258 $this->form_gui->addItem($incl_files);
1259 }
1260
1261 // Form action and save button
1262 $this->form_gui->addCommandButton("saveSettings", $lng->txt("save"));
1263 $this->form_gui->setFormAction($ilCtrl->getFormAction($this, "saveSettings"));
1264 }
This class represents a number property in a property form.

References $ilCtrl, ilObjectGUI\$lng, $options, $si, ilObjectGUI\$tpl, ilBlockSetting\_lookup(), ilNewsItem\_lookupRSSPeriod(), ilObjMediaCast\ORDER_CREATION_DATE_ASC, ilObjMediaCast\ORDER_CREATION_DATE_DESC, ilObjMediaCast\ORDER_MANUAL, ilObjMediaCast\ORDER_TITLE, ilObjMediaCast\VIEW_GALLERY, and ilObjMediaCast\VIEW_LIST.

Referenced by editSettingsObject(), and saveSettingsObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAudio()

static ilObjMediaCastGUI::isAudio (   $extension)
staticprotected

detect audio mimetype

Parameters
string$extension
Returns
true, if extension contains string "audio"

Definition at line 1363 of file class.ilObjMediaCastGUI.php.

1363 {
1364 return strpos($extension,"audio") !== false;
1365 }

◆ listItemsObject()

ilObjMediaCastGUI::listItemsObject (   $a_presentation_mode = false)

List items of media cast.

Definition at line 142 of file class.ilObjMediaCastGUI.php.

143 {
144 global $tpl, $lng, $ilAccess, $ilTabs, $ilToolbar;
145
146 $this->checkPermission("read");
147
148 if ($a_presentation_mode)
149 {
150 $this->addContentSubTabs("content");
151 }
152 else
153 {
154 $this->addContentSubTabs("manage");
155 }
156
157 $med_items = $this->object->getSortedItemsArray();
158
159 include_once("./Modules/MediaCast/classes/class.ilMediaCastTableGUI.php");
160 if ($a_presentation_mode)
161 {
162 $table_gui = new ilMediaCastTableGUI($this, "showContent", false, true);
163 }
164 else
165 {
166 $table_gui = new ilMediaCastTableGUI($this, "listItems");
167 }
168
169 $table_gui->setData($med_items);
170
171 if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]) && !$a_presentation_mode)
172 {
173 $ilToolbar->addButton($lng->txt("add"), $this->ctrl->getLinkTarget($this, "addCastItem"));
174
175 $table_gui->addMultiCommand("confirmDeletionItems", $lng->txt("delete"));
176 $table_gui->setSelectAllCheckbox("item_id");
177 }
178
179 $feed_icon_html = $this->getFeedIconsHTML();
180 if ($feed_icon_html != "")
181 {
182 $table_gui->setHeaderHTML($feed_icon_html);
183 }
184
185 $tpl->setContent($table_gui->getHTML());
186
187 $tpl->setPermanentLink($this->object->getType(), $this->object->getRefId());
188 }
getFeedIconsHTML()
Get feed icons HTML.

References $_GET, ilObjectGUI\$lng, ilObjectGUI\$tpl, addContentSubTabs(), ilObjectGUI\checkPermission(), and getFeedIconsHTML().

Referenced by confirmDeletionItemsObject(), editOrderObject(), and showContentObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateFormFromPost()

ilObjMediaCastGUI::populateFormFromPost ( )
private

Definition at line 1397 of file class.ilObjMediaCastGUI.php.

1398 {
1399 global $tpl;
1400 //issue: we have to display the current settings
1401 // problem: POST does not contain values of disabled textfields
1402 // solution: use hidden field and label to display-> here we need to synchronize the labels
1403 // with the values from the hidden fields.
1404 foreach (ilObjMediaCast::$purposes as $purpose)
1405 {
1406 if ($_POST["value_".$purpose])
1407 {
1408 $_POST["label_value_".$purpose] = $_POST["value_".$purpose];
1409 }
1410 }
1411
1412 $this->form_gui->setValuesByPost();
1413 $tpl->setContent($this->form_gui->getHTML());
1414 }

References $_POST, ilObjMediaCast\$purposes, and ilObjectGUI\$tpl.

Referenced by saveCastItemObject(), and updateCastItemObject().

+ Here is the caller graph for this function:

◆ saveCastItemObject()

ilObjMediaCastGUI::saveCastItemObject ( )

Save new cast item.

Definition at line 554 of file class.ilObjMediaCastGUI.php.

555 {
556 global $tpl, $ilCtrl, $ilUser, $lng, $ilTabs;
557
558 $this->checkPermission("write");
559 $ilTabs->activateTab("edit_content");
560
561 $this->initAddCastItemForm();
562
563 if ($_POST["url_Standard"] == "" && !$_FILES['file_Standard']['tmp_name']) {
564 ilUtil::sendFailure($lng->txt("msg_input_either_file_or_url"));
565 $this->populateFormFromPost();
566 }
567 else if ($this->form_gui->checkInput())
568 {
569 // create dummy object in db (we need an id)
570 include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
571 $mob = new ilObjMediaObject();
572 $mob->create();
573
574 //handle standard purpose
575 $file = $this->createMediaItemForPurpose($mob, "Standard");
576
577 // set title and description
578 // set title to basename of file if left empty
579 $title = $this->form_gui->getInput("title") != "" ? $this->form_gui->getInput("title") : basename($file);
580 $description = $this->form_gui->getInput("description");
581 $mob->setTitle($title);
582 $mob->setDescription($description);
583
584 // save preview pic
585 $prevpic = $this->form_gui->getInput("preview_pic");
586 if ($prevpic["size"] > 0)
587 {
588 $mob->uploadVideoPreviewPic($prevpic);
589 }
590
591 // determine duration for standard purpose
592 $duration = $this->getDuration($file);
593
594 // handle other purposes
595 foreach ($this->additionalPurposes as $purpose)
596 {
597 // check if some purpose has been uploaded
598 $file_gui = $this->form_gui->getInput("file_".$purpose);
599 $url_gui = $this->form_gui->getInput("url_".$purpose);
600 if ($url_gui || $file_gui["size"] > 0)
601 {
602 $this->createMediaItemForPurpose ($mob, $purpose);
603 }
604 }
605
606 $mob->update();
607
608 if ($prevpic["size"] == 0)
609 {
610 // re-read media object
611 $mob = new ilObjMediaObject($mob->getId());
612 $mob->generatePreviewPic(320, 240);
613 }
614
615 //
616 // @todo: save usage
617 //
618
619 $news_set = new ilSetting("news");
620 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
621
622 // create new media cast item
623 include_once("./Services/News/classes/class.ilNewsItem.php");
624 $mc_item = new ilNewsItem();
625 $mc_item->setMobId($mob->getId());
626 $mc_item->setContentType(NEWS_AUDIO);
627 $mc_item->setContextObjId($this->object->getId());
628 $mc_item->setContextObjType($this->object->getType());
629 $mc_item->setUserId($ilUser->getId());
630 $mc_item->setPlaytime($duration);
631 $mc_item->setTitle($title);
632 $mc_item->setContent($description);
633 $mc_item->setLimitation(false);
634 if ($enable_internal_rss)
635 {
636 $mc_item->setVisibility($this->form_gui->getInput("visibility"));
637 }
638 else
639 {
640 $mc_item->setVisibility("users");
641 }
642 $mc_item->create();
643
644 $ilCtrl->redirect($this, "listItems");
645 }
646 else
647 {
648 $this->populateFormFromPost();
649 }
650 }
const NEWS_AUDIO
createMediaItemForPurpose($mob, $purpose)
handle media item for given purpose

References $_POST, $file, $ilCtrl, $ilUser, ilObjectGUI\$lng, ilObjectGUI\$tpl, ilObjectGUI\checkPermission(), createMediaItemForPurpose(), getDuration(), initAddCastItemForm(), NEWS_AUDIO, populateFormFromPost(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ saveOrderObject()

ilObjMediaCastGUI::saveOrderObject ( )

Definition at line 1449 of file class.ilObjMediaCastGUI.php.

1450 {
1451 global $lng;
1452
1453 asort($_POST["item_id"]);
1454
1455 $items = array();
1456 foreach(array_keys($_POST["item_id"]) as $id)
1457 {
1458 $items[] = $id;
1459 }
1460 $this->object->saveOrder($items);
1461
1462 ilUtil::sendSuccess($lng->txt("settings_saved"), true);
1463 $this->ctrl->redirect($this, "editOrder");
1464 }

References $_POST, ilObjectGUI\$lng, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ saveSettingsObject()

ilObjMediaCastGUI::saveSettingsObject ( )

Save Settings.

Definition at line 1269 of file class.ilObjMediaCastGUI.php.

1270 {
1271 global $ilCtrl, $ilTabs;
1272
1273 $this->checkPermission("write");
1274 $ilTabs->activateTab("id_settings");
1275
1276 $this->initSettingsForm();
1277 if ($this->form_gui->checkInput())
1278 {
1279 $news_set = new ilSetting("news");
1280 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1281
1282 $this->object->setTitle($this->form_gui->getInput("title"));
1283 $this->object->setDescription($this->form_gui->getInput("description"));
1284 $this->object->setOnline($this->form_gui->getInput("online"));
1285 $this->object->setDownloadable($this->form_gui->getInput("downloadable"));
1286 $this->object->setOrder($this->form_gui->getInput("order"));
1287 $this->object->setViewMode($this->form_gui->getInput("viewmode"));
1288
1289 if ($enable_internal_rss)
1290 {
1291 $this->object->setPublicFiles($this->form_gui->getInput("public_files"));
1292 $this->object->setDefaultAccess($this->form_gui->getInput("defaultaccess"));
1293 }
1294 $this->object->update();
1295
1296 if ($enable_internal_rss)
1297 {
1298 include_once("./Services/Block/classes/class.ilBlockSetting.php");
1299 ilBlockSetting::_write("news", "public_feed",
1300 $this->form_gui->getInput("extra_feed"),
1301 0, $this->object->getId());
1302
1303 ilBlockSetting::_write("news", "keep_rss_min",
1304 $this->form_gui->getInput("keep_rss_min"),
1305 0, $this->object->getId());
1306 }
1307
1308 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
1309 $ilCtrl->redirect($this, "editSettings");
1310 }
1311 else
1312 {
1313 $this->form_gui->setValuesByPost();
1314 $this->tpl->setContent($this->form_gui->getHTML());
1315 }
1316 }
static _write($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
Write setting to database.

References $ilCtrl, ilBlockSetting\_write(), ilObjectGUI\checkPermission(), initSettingsForm(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ setTabs()

ilObjMediaCastGUI::setTabs ( )

get tabs @access public

Reimplemented from ilObjectGUI.

Definition at line 1044 of file class.ilObjMediaCastGUI.php.

1045 {
1046 global $ilAccess, $ilTabs, $lng, $ilHelp;
1047
1048 $ilHelp->setScreenIdComponent("mcst");
1049
1050 // list items
1051 if ($ilAccess->checkAccess('read', "", $this->object->getRefId()))
1052 {
1053 $ilTabs->addTab("content",
1054 $lng->txt("content"),
1055 $this->ctrl->getLinkTarget($this, "showContent"));
1056 }
1057
1058 // info screen
1059 if ($ilAccess->checkAccess('visible', "", $this->object->getRefId()))
1060 {
1061 $ilTabs->addTab("id_info",
1062 $lng->txt("info_short"),
1063 $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"));
1064 }
1065
1066 // settings
1067 if ($ilAccess->checkAccess('write', "", $this->object->getRefId()))
1068 {
1069 $ilTabs->addTab("id_settings",
1070 $lng->txt("settings"),
1071 $this->ctrl->getLinkTarget($this, "editSettings"));
1072 }
1073
1074 // export
1075 if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
1076 {
1077 $ilTabs->addTab("export",
1078 $lng->txt("export"),
1079 $this->ctrl->getLinkTargetByClass("ilexportgui", ""));
1080 }
1081
1082 // edit permissions
1083 if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId()))
1084 {
1085 $ilTabs->addTab("id_permissions",
1086 $lng->txt("perm_settings"),
1087 $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"));
1088 }
1089 }

References ilObjectGUI\$lng.

◆ showContentObject()

ilObjMediaCastGUI::showContentObject ( )

Show content.

Parameters

return

Definition at line 1476 of file class.ilObjMediaCastGUI.php.

1477 {
1478 if ($this->object->getViewMode() == ilObjMediaCast::VIEW_GALLERY)
1479 {
1480 $this->showGallery();
1481 }
1482 else
1483 {
1484 $this->listItemsObject(true);
1485 }
1486 }

References listItemsObject(), showGallery(), and ilObjMediaCast\VIEW_GALLERY.

+ Here is the call graph for this function:

◆ showGallery()

ilObjMediaCastGUI::showGallery ( )

Definition at line 1488 of file class.ilObjMediaCastGUI.php.

1489 {
1490 global $tpl, $ilTabs, $ilCtrl;
1491
1492 $tpl->addJavascript("./Modules/MediaCast/js/MediaCast.js");
1493
1494 $ilTabs->activateTab("content");
1495
1496 $this->addContentSubTabs("content");
1497
1498 $ctpl = new ilTemplate("tpl.mcst_content.html", true, true, "Modules/MediaCast");
1499
1500 include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1501 foreach ($this->object->getSortedItemsArray() as $item)
1502 {
1503 $mob = new ilObjMediaObject($item["mob_id"]);
1504 $med = $mob->getMediaItem("Standard");
1505
1506 $ctpl->setCurrentBlock("item");
1507 $ctpl->setVariable("TITLE", $item["title"]);
1508 $ctpl->setVariable("TIME", $item["playtime"]);
1509 $ctpl->setVariable("ID", $item["id"]);
1510
1511 if ($mob->getVideoPreviewPic() != "")
1512 {
1513 $ctpl->setVariable("PREVIEW_PIC",
1514 ilUtil::img($mob->getVideoPreviewPic(), $item["title"], 320, 240));
1515 }
1516 else
1517 {
1518 $ctpl->setVariable("PREVIEW_PIC",
1519 ilUtil::img(ilUtil::getImagePath("mcst_preview.svg"), $item["title"], 320, 240));
1520 }
1521
1522 // player
1523 if (is_object($med))
1524 {
1525 include_once("./Services/MediaObjects/classes/class.ilMediaPlayerGUI.php");
1526
1527 // the news id will be used as player id, see also ilMediaCastTableGUI
1528 $mpl = new ilMediaPlayerGUI($item["id"],
1529 $ilCtrl->getLinkTarget($this, "handlePlayerEvent", "", true, false));
1530
1531 if (strcasecmp("Reference", $med->getLocationType()) == 0)
1532 {
1533 $mpl->setFile($med->getLocation());
1534 }
1535 else
1536 {
1537 $mpl->setFile(ilObjMediaObject::_getURL($mob->getId())."/".$med->getLocation());
1538 }
1539 $mpl->setMimeType ($med->getFormat());
1540 //$mpl->setDisplayHeight($med->getHeight());
1541 $mpl->setDisplayHeight("480");
1542 $mpl->setDisplayWidth("640");
1543 $mpl->setVideoPreviewPic($mob->getVideoPreviewPic());
1544 $mpl->setTitle($item["title"]);
1545 $mpl->setDescription($item["content"]);
1546 $mpl->setForceAudioPreview(true);
1547 if ($this->object->getDownloadable())
1548 {
1549 $ilCtrl->setParameterByClass("ilobjmediacastgui", "item_id", $item["id"]);
1550 $ilCtrl->setParameterByClass("ilobjmediacastgui", "purpose", "Standard");
1551 $mpl->setDownloadLink($ilCtrl->getLinkTargetByClass("ilobjmediacastgui", "downloadItem"));
1552 }
1553 $med_alt = $mob->getMediaItem("VideoAlternative");
1554 if (is_object($med_alt))
1555 {
1556 $mpl->setAlternativeVideoFile(ilObjMediaObject::_getURL($mob->getId())."/".
1557 $med_alt->getLocation());
1558 $mpl->setAlternativeVideoMimeType($med_alt->getFormat());
1559 }
1560
1561 $ctpl->setVariable("PLAYER", $mpl->getPreviewHtml());
1562 }
1563
1564
1565 $ctpl->parseCurrentBlock();
1566 }
1567
1568 $feed_icon_html = $this->getFeedIconsHTML();
1569
1570 if ($feed_icon_html != "")
1571 {
1572 $feed_icon_html = '<p>'.$feed_icon_html.'</p>';
1573 }
1574
1575 $tpl->setContent($feed_icon_html.$ctpl->get());
1576 }
User interface for media player.
_getURL($a_mob_id)
get directory for files of media object (static)
special template class to simplify handling of ITX/PEAR
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.

References $ilCtrl, ilObjectGUI\$tpl, ilObjMediaObject\_getURL(), addContentSubTabs(), getFeedIconsHTML(), ilUtil\getImagePath(), and ilUtil\img().

Referenced by showContentObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateCastItemObject()

ilObjMediaCastGUI::updateCastItemObject ( )

Update cast item.

Definition at line 773 of file class.ilObjMediaCastGUI.php.

774 {
775 global $tpl, $lng, $ilCtrl, $ilUser, $log;
776
777 $this->checkPermission("write");
778
779 $this->initAddCastItemForm("edit");
780
781 if ($this->form_gui->checkInput())
782 {
783 // create new media cast item
784 include_once("./Services/News/classes/class.ilNewsItem.php");
785 $mc_item = new ilNewsItem($_GET["item_id"]);
786 $mob_id = $mc_item->getMobId();
787
788 // create dummy object in db (we need an id)
789 include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
790 $mob = new ilObjMediaObject($mob_id);
791
792
793 foreach (ilObjMediaCast::$purposes as $purpose)
794 {
795 if ($this->form_gui->getInput("delete_".$purpose))
796 {
797 $mob->removeMediaItem($purpose);
798 $log->write ("Mcst: deleting purpose $purpose");
799 continue;
800 }
801 $media_item = $mob->getMediaItem($purpose);
802 $url_gui = $this->form_gui->getInput("url_".$purpose);
803 $file_gui = $this->form_gui->getInput("file_".$purpose);
804
805 if ($media_item == null)
806 {
807 if ($purpose != "Standard" &&
808 ($url_gui || $file_gui["size"]>0))
809 {
810 // check if we added an additional purpose when updating
811 // either by url or by file
812 $file = $this->createMediaItemForPurpose($mob, $purpose);
813 }
814 } else
815 {
816 $file = $this->updateMediaItem($mob, $media_item);
817 }
818
819 if ($purpose == "Standard")
820 {
821 $duration = $this->getDuration($file);
822 $title = $this->form_gui->getInput("title") != "" ? $this->form_gui->getInput("title") : basename($file);
823 $description = $this->form_gui->getInput("description");
824
825 $mob->setTitle($title);
826 $mob->setDescription($description);
827
828 $prevpic = $this->form_gui->getInput("preview_pic");
829 if ($prevpic["size"] > 0)
830 {
831 $mob->uploadVideoPreviewPic($prevpic);
832 }
833 else
834 {
835 $prevpici = $this->form_gui->getItemByPostVar("preview_pic");
836 if ($prevpici->getDeletionFlag())
837 {
838 $mob->removeAdditionalFile($mob->getVideoPreviewPic(true));
839 }
840 }
841 }
842 }
843
844 // set real meta and object data
845 $mob->update();
846
847 //
848 // @todo: save usage
849 //
850
851 $news_set = new ilSetting("news");
852 $enable_internal_rss = $news_set->get("enable_rss_for_internal");
853
854 $mc_item->setUserId($ilUser->getId());
855 if (isset($duration))
856 {
857 $mc_item->setPlaytime($duration);
858 }
859 $mc_item->setTitle($title);
860 $mc_item->setContent($description);
861 if ($enable_internal_rss)
862 {
863 $mc_item->setVisibility($this->form_gui->getInput("visibility"));
864 }
865 $mc_item->update();
866
867 $ilCtrl->redirect($this, "listItems");
868 }
869 else
870 {
871 $this->populateFormFromPost();
872 }
873 }

References $_GET, $file, $ilCtrl, $ilUser, ilObjectGUI\$lng, $log, ilObjMediaCast\$purposes, ilObjectGUI\$tpl, ilObjectGUI\checkPermission(), createMediaItemForPurpose(), getDuration(), initAddCastItemForm(), populateFormFromPost(), and updateMediaItem().

+ Here is the call graph for this function:

◆ updateMediaItem()

ilObjMediaCastGUI::updateMediaItem (   $mob,
$mediaItem 
)
private

update media item from form

Parameters
IlObjectMediaObject$mob
IlMediaItem$mediaItem
Returns
string file

Definition at line 701 of file class.ilObjMediaCastGUI.php.

702 {
703 $purpose = $mediaItem->getPurpose();
704 $url_gui = $this->form_gui->getInput ("url_".$purpose);
705 $file_gui = $this->form_gui->getInput ("file_".$purpose);
706 if ($url_gui)
707 {
708 // http
709 $file = $this->form_gui->getInput ("url_".$purpose);
710 $title = basename ($file);
711 $location = $this->form_gui->getInput ("url_".$purpose);
712 $locationType = "Reference";
713 } elseif ($file_gui["size"] > 0){
714 // lokal
715 // determine and create mob directory, move uploaded file to directory
716 $mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
717 if (!is_dir($mob_dir))
718 $mob->createDirectory();
719
720 $file_name = ilUtil::getASCIIFilename($_FILES['file_'.$purpose]['name']);
721 $file_name = str_replace(" ", "_", $file_name);
722
723 $file = $mob_dir."/".$file_name;
724 $title = $file_name;
725 $locationType = "LocalFile";
726 $location = $title;
727 ilUtil::moveUploadedFile($_FILES['file_'.$purpose]['tmp_name'], $file_name, $file);
729
730 }
731
732 // check if not automatic mimetype detection
733 if ($_POST["mimetype_".$purpose] != "")
734 {
735 $mediaItem->setFormat($_POST["mimetype_".$purpose]);
736 }
737 elseif ($mediaItem->getLocation () != "")
738 {
739 $format = ilObjMediaObject::getMimeType($mediaItem->getLocation(), ($locationType == "Reference"));
740 $mediaItem->setFormat($format);
741 }
742
743 if (isset($file))
744 {
745 // get mime type, if not already set!
746 if (!isset($format))
747 {
748 $format = ilObjMediaObject::getMimeType($file, ($locationType == "Reference"));
749 }
750
751 // set real meta and object data
752 $mediaItem->setFormat($format);
753 $mediaItem->setLocation($location);
754 $mediaItem->setLocationType($locationType);
755 $mediaItem->setHAlign("Left");
756 $mediaItem->setHeight(self::isAudio($format)?0:180);
757 }
758
759 if ($purpose == "Standard")
760 {
761 if (isset($title))
762 $mob->setTitle ($title);
763 if (isset($format))
764 $mob->setDescription($format);
765 }
766
767 return $file;
768 }
$location
Definition: buildRTE.php:44
static getMimeType($a_file)
get mime type for file
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.

References $_POST, $file, $location, ilObjMediaObject\_getDirectory(), ilUtil\getASCIIFilename(), ilObjMediaObject\getMimeType(), ilUtil\moveUploadedFile(), and ilUtil\renameExecutables().

Referenced by createMediaItemForPurpose(), and updateCastItemObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $additionalPurposes

ilObjMediaCastGUI::$additionalPurposes = array ("VideoPortable", "AudioPortable")
private

Definition at line 20 of file class.ilObjMediaCastGUI.php.

◆ $mimeTypes

ilObjMediaCastGUI::$mimeTypes = array()
private

Definition at line 22 of file class.ilObjMediaCastGUI.php.

◆ $purposeSuffixes

ilObjMediaCastGUI::$purposeSuffixes = array ()
private

Definition at line 21 of file class.ilObjMediaCastGUI.php.


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