ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjMediaCastGUI Class Reference

Class ilObjMediaCastGUI. More...

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

Public Member Functions

 __construct ($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
 Constructor public. More...
 
 executeCommand ()
 
 afterSave (ilObject $newObj)
 save object 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 public More...
 
 addContentSubTabs ($a_active="content")
 Add content subtabs. More...
 
 editSettingsObject ()
 Edit settings. More...
 
 initSettingsForm ()
 Init Settings Form. More...
 
 saveSettingsObject ()
 Save Settings. More...
 
 addLocatorItems ()
 
 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
 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...
 
 prepareOutput ($a_show_subobjects=true)
 prepare output More...
 
 getAdminTabs ()
 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 ()
 cancel action and go back to previous page public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object 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...
 
 editObject ()
 edit object More...
 
 addExternalEditFormCustom (ilPropertyFormGUI $a_form)
 
 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 ()
 viewObject container presentation for "administration -> repository, trash, permissions" More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 
 redirectAfterCreation ()
 Redirect after creation, see https://docu.ilias.de/goto_docu_wiki_wpage_5035_1357.html. More...
 
 addToDeskObject ()
 
 removeFromDeskObject ()
 
- Public Member Functions inherited from ILIAS\Object\ImplementsCreationCallback
 callCreationCallback (\ilObject $object, \ilObjectDefinition $obj_definition, int $requested_crtcb)
 

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)
 
 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 ()
 
 handlePlayerCompletedEventObject ()
 
 afterUpload ($mob_id)
 After mob upload. More...
 
 afterUrlSaving ($mob_id, $long_desc)
 After mob upload. More...
 
 addMobsToCast ($mob_ids, $long_desc="")
 After mob upload. More...
 
 afterPoolInsert ($mob_ids)
 After pool insert. More...
 
 handleAutoplayTriggerObject ()
 
- Protected Member Functions inherited from ilObjectGUI
 getObjectService ()
 Get object service. More...
 
 assignObject ()
 
 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...
 
 setTabs ()
 set admin tabs public More...
 
 setAdminTabs ()
 set admin tabs 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...
 
 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, $a_catch_errors=true)
 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...
 
 getTabs ()
 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 (ilColumnGUI $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...
 

Protected Attributes

 $tabs
 
 $log
 
 $error
 
 $help
 
 $filesystem
 
- Protected Attributes inherited from ilObjectGUI
const UPLOAD_TYPE_LOCAL = 1
 
const UPLOAD_TYPE_UPLOAD_DIRECTORY = 2
 
 $ilErr
 
 $locator
 
 $user
 
 $access
 
 $rbacsystem
 
 $settings
 
 $rbacreview
 
 $toolbar
 
 $tmp_import_dir
 
 $tabs_gui = null
 
 $ctrl
 
 $object_service
 
 $favourites
 
 $request
 

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 = []
 
 $purposeSuffixes = array()
 
 $mimeTypes = array()
 

Additional Inherited Members

- Data Fields inherited from ilObjectGUI
const ALLOWED_TAGS_IN_TITLE_AND_DESCRIPTION
 
const COPY_WIZARD_NEEDS_PAGE = 1
 
 $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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor public.

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

References $DIC, ilObjectGUI\$lng, ilObjectGUI\$settings, ILIAS\GlobalScreen\Provider\__construct(), ilMediaCastSettings\_getInstance(), ilMimeTypeUtil\getExt2MimeMap(), help(), and user().

60  {
61  global $DIC;
62 
63  $this->ctrl = $DIC->ctrl();
64  $this->lng = $DIC->language();
65  $this->user = $DIC->user();
66  $this->tabs = $DIC->tabs();
67  $this->tpl = $DIC["tpl"];
68  $this->access = $DIC->access();
69  $this->toolbar = $DIC->toolbar();
70  $this->filesystem = $DIC->filesystem()->web();
71  $this->log = $DIC["ilLog"];
72  $this->error = $DIC["ilErr"];
73  $this->help = $DIC["ilHelp"];
74  $this->locator = $DIC["ilLocator"];
75  $ilCtrl = $DIC->ctrl();
76  $lng = $DIC->language();
77 
78  $this->type = "mcst";
79  parent::__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output);
80  $lng->loadLanguageModule("mcst");
81  $lng->loadLanguageModule("news");
82  $lng->loadLanguageModule("rep");
83 
84  $ilCtrl->saveParameter($this, "item_id");
85 
86  include_once("./Modules/MediaCast/classes/class.ilMediaCastSettings.php");
88  $this->purposeSuffixes = $settings->getPurposeSuffixes();
89  $this->mimeTypes = array();
90  $mime_types = $settings->getMimeTypes();
91  foreach ($mime_types as $mt) {
92  $this->mimeTypes[$mt] = $mt;
93  }
94 
95  include_once("./Services/Utilities/classes/class.ilMimeTypeUtil.php");
96  foreach (ilMimeTypeUtil::getExt2MimeMap() as $mt) {
97 // $this->mimeTypes[$mt] = $mt;
98  }
99  asort($this->mimeTypes);
100  }
user()
Definition: user.php:4
help()
Definition: help.php:2
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
static _getInstance()
get singleton instance
+ Here is the call graph for this function:

Member Function Documentation

◆ _goto()

static ilObjMediaCastGUI::_goto (   $a_target)
static

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

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

1417  {
1418  global $DIC;
1419 
1420  $ilAccess = $DIC->access();
1421  $ilErr = $DIC["ilErr"];
1422  $lng = $DIC->language();
1423 
1424  if ($ilAccess->checkAccess("read", "", $a_target)) {
1425  $_GET["cmd"] = "showContent";
1426  $_GET["ref_id"] = $a_target;
1427  $_GET["baseClass"] = "ilmediacasthandlergui";
1428  $_GET["cmdClass"] = "ilobjmediacastgui";
1429  include("ilias.php");
1430  exit;
1431  } elseif ($ilAccess->checkAccess("visible", "", $a_target)) {
1432  ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
1433  } elseif ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID)) {
1434  ilUtil::sendFailure(sprintf(
1435  $lng->txt("msg_no_perm_read_item"),
1437  ));
1439  }
1440 
1441  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1442  }
exit
Definition: login.php:29
const ROOT_FOLDER_ID
Definition: constants.php:30
$_GET["client_id"]
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
static _lookupTitle($a_id)
lookup object title
static _gotoRepositoryNode($a_ref_id, $a_cmd="frameset")
Goto repository root.
static _lookupObjId($a_id)
global $DIC
Definition: goto.php:24
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ addCastItemObject()

ilObjMediaCastGUI::addCastItemObject ( )

Add media cast item.

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

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

349  {
350  $tpl = $this->tpl;
351 
352  $this->checkPermission("write");
353 
354  $this->initAddCastItemForm();
355  $tpl->setContent($this->form_gui->getHTML());
356  }
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.
+ Here is the call graph for this function:

◆ addContentSubTabs()

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

Add content subtabs.

Parameters

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

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

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

1154  {
1155  $ilTabs = $this->tabs;
1156  $ilAccess = $this->access;
1157  $lng = $this->lng;
1158 
1159  $ilTabs->addSubTab(
1160  "content",
1161  $lng->txt("view"),
1162  $this->ctrl->getLinkTarget($this, "showContent")
1163  );
1164 
1165  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
1166  $ilTabs->addSubTab(
1167  "manage",
1168  $lng->txt("mcst_manage"),
1169  $this->ctrl->getLinkTarget($this, "listItems")
1170  );
1171 
1172  if ($this->object->getOrder() == ilObjMediaCast::ORDER_MANUAL) {
1173  $ilTabs->addSubTab(
1174  "sorting",
1175  $lng->txt("mcst_ordering"),
1176  $this->ctrl->getLinkTarget($this, "editOrder")
1177  );
1178  }
1179  }
1180 
1181  $ilTabs->activateSubTab($a_active);
1182  $ilTabs->activateTab("content");
1183  }
$_GET["client_id"]
+ Here is the caller graph for this function:

◆ addLocatorItems()

ilObjMediaCastGUI::addLocatorItems ( )

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

References $_GET, and ilObjectGUI\$locator.

1408  {
1409  $ilLocator = $this->locator;
1410 
1411  if (is_object($this->object)) {
1412  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "listItems"), "", $_GET["ref_id"]);
1413  }
1414  }
$_GET["client_id"]

◆ addMobsToCast()

ilObjMediaCastGUI::addMobsToCast (   $mob_ids,
  $long_desc = "" 
)
protected

After mob upload.

Parameters
array$mob_ids
string$long_desc

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

References ilObjectGUI\$ctrl, and ilObjectGUI\$user.

Referenced by afterPoolInsert(), afterUpload(), and afterUrlSaving().

1857  {
1858  $ctrl = $this->ctrl;
1859  $user = $this->user;
1860 
1861  $item_ids = [];
1862  foreach ($mob_ids as $mob_id) {
1863  $item_ids[] = $this->object->addMobToCast($mob_id, $user->getId(), $long_desc);
1864  }
1865 
1866  if (count($item_ids) == 1) {
1867  $ctrl->setParameter($this, "item_id", $item_ids[0]);
1868  $ctrl->setParameter($this, "pupose", "Standard");
1869  $ctrl->redirect($this, "editCastItem");
1870  }
1871  $ctrl->redirect($this, "listItems");
1872  }
+ Here is the caller graph for this function:

◆ afterPoolInsert()

ilObjMediaCastGUI::afterPoolInsert (   $mob_ids)
protected

After pool insert.

Parameters
$mob_ids

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

References addMobsToCast().

Referenced by executeCommand().

1880  {
1881  $this->addMobsToCast($mob_ids);
1882  }
addMobsToCast($mob_ids, $long_desc="")
After mob upload.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ afterSave()

ilObjMediaCastGUI::afterSave ( ilObject  $newObj)

save object public

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

References ilObject\getRefId(), and ilUtil\redirect().

212  {
213  // always send a message
214  ilUtil::sendSuccess($this->lng->txt("object_added"), true);
215  ilUtil::redirect("ilias.php?baseClass=ilMediaCastHandlerGUI&ref_id=" . $newObj->getRefId() . "&cmd=editSettings");
216  }
getRefId()
get reference id public
static redirect($a_script)
+ Here is the call graph for this function:

◆ afterUpload()

ilObjMediaCastGUI::afterUpload (   $mob_id)
protected

After mob upload.

Parameters
$mob_id

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

References addMobsToCast().

Referenced by executeCommand().

1833  {
1834  $mob = new ilObjMediaObject($mob_id);
1835  $med_item = $mob->getMediaItem("Standard");
1836  $med_item->determineDuration();
1837 
1838  $this->addMobsToCast([$mob_id]);
1839  }
addMobsToCast($mob_ids, $long_desc="")
After mob upload.
Class ilObjMediaObject.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ afterUrlSaving()

ilObjMediaCastGUI::afterUrlSaving (   $mob_id,
  $long_desc 
)
protected

After mob upload.

Parameters
$mob_id
$long_desc

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

References addMobsToCast().

Referenced by executeCommand().

1847  {
1848  $this->addMobsToCast([$mob_id], $long_desc);
1849  }
addMobsToCast($mob_ids, $long_desc="")
After mob upload.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDeletionItemsObject()

ilObjMediaCastGUI::confirmDeletionItemsObject ( )

Confirmation Screen.

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

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

920  {
921  $ilCtrl = $this->ctrl;
922  $lng = $this->lng;
923  $tpl = $this->tpl;
924  $ilTabs = $this->tabs;
925 
926  $this->checkPermission("write");
927  $ilTabs->activateTab("edit_content");
928 
929  if (!is_array($_POST["item_id"])) {
930  $this->listItemsObject();
931  return;
932  }
933 
934  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
935  $c_gui = new ilConfirmationGUI();
936 
937  // set confirm/cancel commands
938  $c_gui->setFormAction($ilCtrl->getFormAction($this, "deleteItems"));
939  $c_gui->setHeaderText($lng->txt("info_delete_sure"));
940  $c_gui->setCancel($lng->txt("cancel"), "listItems");
941  $c_gui->setConfirm($lng->txt("confirm"), "deleteItems");
942 
943  // add items to delete
944  include_once("./Services/News/classes/class.ilNewsItem.php");
945  foreach ($_POST["item_id"] as $item_id) {
946  $item = new ilNewsItem($item_id);
947  $c_gui->addItem(
948  "item_id[]",
949  $item_id,
950  $item->getTitle(),
951  ilUtil::getImagePath("icon_mcst.svg")
952  );
953  }
954 
955  $tpl->setContent($c_gui->getHTML());
956  }
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
listItemsObject($a_presentation_mode=false)
List items of media cast.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
$_POST["username"]
Confirmation screen class.
+ Here is the call graph for this function:

◆ convertFileObject()

ilObjMediaCastGUI::convertFileObject ( )

Convert file object.

Parameters

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

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

1687  {
1688  $ilCtrl = $this->ctrl;
1689 
1690  $this->checkPermission("write");
1691 
1692  $this->mcst_item = new ilNewsItem($_GET["item_id"]);
1693  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1694  $mob = new ilObjMediaObject($this->mcst_item->getMobId());
1695 
1696  $target_purpose = ilUtil::stripSlashes($_POST["target_purpose"]);
1697  $target_format = ilUtil::stripSlashes($_POST["target_format"]);
1698 
1699  try {
1700  include_once("./Services/MediaObjects/classes/class.ilFFmpeg.php");
1701  $med = $mob->getMediaItem("Standard");
1702  $mob_file = ilObjMediaObject::_getDirectory($mob->getId()) . "/" . $med->getLocation();
1703  $new_file = ilFFmpeg::convert($mob_file, $target_format);
1705  $pi = pathinfo($new_file);
1706  $med = $mob->getMediaItem($target_purpose);
1707  if (!is_object($med)) {
1708  $med = new ilMediaItem();
1709  $med->setMobId($mob->getId());
1710  $mob->addMediaItem($med);
1711  $mob->update();
1712  $med->setPurpose($target_purpose);
1713  }
1714  $med->setFormat($target_format);
1715  $med->setLocation($pi["basename"]);
1716  $med->setLocationType("LocalFile");
1717  $med->update();
1718 
1719  $add = (is_array($ret) && count($ret) > 0)
1720  ? "<br />" . implode("<br />", $ret)
1721  : "";
1722 
1723  ilUtil::sendInfo($this->lng->txt("mcst_converted_file") . $add, true);
1724  } catch (ilException $e) {
1726  $add = (is_array($ret) && count($ret) > 0)
1727  ? "<br />" . implode("<br />", $ret)
1728  : "";
1729  ilUtil::sendFailure($e->getMessage() . $add, true);
1730  }
1731 
1732 
1733  $ilCtrl->redirect($this, "editCastItem");
1734  }
static getLastReturnValues()
Get last return values.
static convert($a_file, $a_target_mime, $a_target_dir="", $a_target_filename="")
Convert file to target mime type.
$_GET["client_id"]
static _getDirectory($a_mob_id)
Get absolute directory.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Class ilMediaItem Media Item, component of a media object (file or reference)
Class ilObjMediaObject.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$ret
Definition: parser.php:6
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
$_POST["username"]
+ 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 736 of file class.ilObjMediaCastGUI.php.

References updateMediaItem().

Referenced by saveCastItemObject(), and updateCastItemObject().

737  {
738  $mediaItem = new ilMediaItem();
739  $mob->addMediaItem($mediaItem);
740  $mediaItem->setPurpose($purpose);
741  return $this->updateMediaItem($mob, $mediaItem);
742  }
updateMediaItem($mob, &$mediaItem)
update media item from form
Class ilMediaItem Media Item, component of a media object (file or reference)
+ 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 961 of file class.ilObjMediaCastGUI.php.

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

962  {
963  $ilCtrl = $this->ctrl;
964 
965  $this->checkPermission("write");
966 
967  // delete all selected news items
968  foreach ($_POST["item_id"] as $item_id) {
969  $mc_item = new ilNewsItem($item_id);
970  $mc_item->delete();
971  }
972 
973  $ilCtrl->redirect($this, "listItems");
974  }
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
$_POST["username"]
+ Here is the call graph for this function:

◆ determinePlaytimeObject()

ilObjMediaCastGUI::determinePlaytimeObject ( )

Delete news items.

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

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

997  {
998  $ilCtrl = $this->ctrl;
999  $lng = $this->lng;
1000 
1001  $mc_item = new ilNewsItem($_GET["item_id"]);
1002  $mob = $mc_item->getMobId();
1003  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1004  $mob = new ilObjMediaObject($mob);
1005  $mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
1006  $m_item = $mob->getMediaItem("Standard");
1007  $file = $mob_dir . "/" . $m_item->getLocation();
1008  $duration = $this->getDuration($file);
1009  if ($duration != "00:00:00") {
1010  $mc_item->setPlaytime($duration);
1011  $mc_item->update();
1012  ilUtil::sendSuccess($lng->txt("mcst_set_playtime"), true);
1013  } else {
1014  ilUtil::sendFailure($lng->txt("mcst_unable_to_determin_playtime"), true);
1015  }
1016 
1017  $ilCtrl->redirect($this, "listItems");
1018  }
getDuration($file)
get duration from form or from file analyzer
$_GET["client_id"]
static _getDirectory($a_mob_id)
Get absolute directory.
Class ilObjMediaObject.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ downloadItemObject()

ilObjMediaCastGUI::downloadItemObject ( )

Download news media item.

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

References $_GET, ilObjectGUI\$ctrl, $ilUser, ilObjectGUI\$user, ilObjectGUI\checkPermission(), and exit.

980  {
981  $ilCtrl = $this->ctrl;
983 
984  $this->checkPermission("read");
985  $news_item = new ilNewsItem($_GET["item_id"]);
986  $this->object->handleLPUpdate($ilUser->getId(), $news_item->getMobId());
987  if (!$news_item->deliverMobFile($_GET["purpose"], (int) $_GET["presentation"])) {
988  $ilCtrl->redirect($this, "listItems");
989  }
990  exit;
991  }
exit
Definition: login.php:29
$_GET["client_id"]
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ editCastItemObject()

ilObjMediaCastGUI::editCastItemObject ( )

Edit media cast item.

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

References $_GET, ilObjectGUI\$ctrl, ilObjectGUI\$toolbar, ilObjectGUI\$tpl, ilObjectGUI\checkPermission(), ilFFmpeg\enabled(), getCastItemValues(), ilObjMediaObject\getMediaItem(), initAddCastItemForm(), and ilFFmpeg\supportsImageExtraction().

362  {
363  $tpl = $this->tpl;
364  $ilToolbar = $this->toolbar;
365  $ilCtrl = $this->ctrl;
366 
367  $this->checkPermission("write");
368 
369  // conversion toolbar
370  include_once("./Services/MediaObjects/classes/class.ilFFmpeg.php");
371  if (ilFFmpeg::enabled()) {
372  $this->mcst_item = new ilNewsItem($_GET["item_id"]);
373  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
374  $mob = new ilObjMediaObject($this->mcst_item->getMobId());
375 
376  $conv_cnt = 0;
377  // we had other purposes as source as well, but
378  // currently only "Standard" is implemented in the convertFile method
379  foreach (array("Standard") as $p) {
380  /*
381  $med = $mob->getMediaItem($p);
382  if (is_object($med))
383  {
384  $options = ilFFmpeg::getPossibleTargetMimeTypes($med->getFormat());
385  if (count($options) > 0)
386  {
387  if ($conv_cnt > 0)
388  {
389  $ilToolbar->addSeparator();
390  }
391 
392  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
393  $si = new ilSelectInputGUI($this->lng->txt("mcst_conv_".
394  strtolower($p)."_to"), "target_format");
395  $si->setOptions($options);
396  $ilToolbar->addInputItem($si, true);
397 
398  $si = new ilSelectInputGUI(", ".$this->lng->txt("mcst_target").": ",
399  "target_purpose");
400  $si->setOptions(array("Standard" => $this->lng->txt("mcst_purpose_standard"),
401  "VideoAlternative" => $this->lng->txt("mcst_purpose_videoalternative")
402  ));
403  $si->setValue($p);
404  $ilToolbar->addInputItem($si, true);
405 
406  $ilToolbar->addFormButton($this->lng->txt("mcst_convert"), "convertFile");
407 
408  $conv_cnt++;
409  }
410  }
411  */
412 
413  $med = $mob->getMediaItem($p);
414  if (is_object($med)) {
415  if (ilFFmpeg::supportsImageExtraction($med->getFormat())) {
416  // second
417  include_once("./Services/Form/classes/class.ilTextInputGUI.php");
418  $ni = new ilTextInputGUI($this->lng->txt("mcst_second"), "sec");
419  $ni->setMaxLength(4);
420  $ni->setSize(4);
421  $ni->setValue(1);
422  $ilToolbar->addInputItem($ni, true);
423 
424  $ilToolbar->addFormButton($this->lng->txt("mcst_extract_preview_image"), "extractPreviewImage");
425  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
426  }
427  }
428 
429  /*if ($conv_cnt > 0)
430  {
431  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
432  }*/
433  }
434  }
435 
436  $this->initAddCastItemForm("edit");
437  $this->getCastItemValues();
438  $tpl->setContent($this->form_gui->getHTML());
439  }
getMediaItem($a_purpose)
get item for media purpose
$_GET["client_id"]
initAddCastItemForm($a_mode="create")
Init add cast item form.
getCastItemValues()
Get cast item values into form.
Class ilObjMediaObject.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
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.
+ Here is the call graph for this function:

◆ editOrderObject()

ilObjMediaCastGUI::editOrderObject ( )
protected

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

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

1505  {
1506  $ilTabs = $this->tabs;
1507  $lng = $this->lng;
1508  $tpl = $this->tpl;
1509 
1510  $this->checkPermission("write");
1511  $ilTabs->activateTab("edit_content");
1512 
1513  $this->addContentSubTabs("sorting");
1514 
1515  // sort by order setting
1516  switch ($this->object->getOrder()) {
1520  return $this->listItemsObject();
1521 
1523  // sub-tabs
1524  break;
1525  }
1526 
1527  include_once("./Modules/MediaCast/classes/class.ilMediaCastTableGUI.php");
1528  $table_gui = new ilMediaCastTableGUI($this, "editOrder", true);
1529 
1530  $table_gui->setTitle($lng->txt("mcst_media_cast"));
1531  $table_gui->setData($this->object->getSortedItemsArray());
1532 
1533  $table_gui->addCommandButton("saveOrder", $lng->txt("mcst_save_order"));
1534 
1535  $tpl->setContent($table_gui->getHTML());
1536  }
listItemsObject($a_presentation_mode=false)
List items of media cast.
addContentSubTabs($a_active="content")
Add content subtabs.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
TableGUI class for table NewsForContext.
+ Here is the call graph for this function:

◆ editSettingsObject()

ilObjMediaCastGUI::editSettingsObject ( )

Edit settings.

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

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

1190  {
1191  $tpl = $this->tpl;
1192  $ilTabs = $this->tabs;
1193 
1194  $this->checkPermission("write");
1195  $ilTabs->activateTab("id_settings");
1196 
1197  $this->initSettingsForm();
1198  $tpl->setContent($this->form_gui->getHtml());
1199  }
initSettingsForm()
Init Settings Form.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
+ Here is the call graph for this function:

◆ executeCommand()

ilObjMediaCastGUI::executeCommand ( )

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

References $_GET, $ilUser, $ret, $tabs, ilObjectGUI\$user, addContentSubTabs(), ilObjectGUI\addHeaderAction(), afterPoolInsert(), afterUpload(), afterUrlSaving(), ilObjectGUI\checkPermission(), ilObjectGUI\checkPermissionBool(), ilCommonActionDispatcherGUI\getInstanceFromAjaxCall(), infoScreen(), ilLearningProgressBaseGUI\LP_CONTEXT_REPOSITORY, ilObjectGUI\prepareOutput(), ilMediaCreationGUI\setAllSuffixes(), and ilMediaCreationGUI\TYPE_ALL.

103  {
105  $ilTabs = $this->tabs;
106 
107  $next_class = $this->ctrl->getNextClass($this);
108  $cmd = $this->ctrl->getCmd();
109  $this->prepareOutput();
110 
111  switch ($next_class) {
112 
113  case "ilmediacreationgui":
114  $this->ctrl->setReturn($this, "listItems");
115  $ilTabs->activateTab("content");
116  $this->addContentSubTabs("manage");
117  $creation = new ilMediaCreationGUI([ilMediaCreationGUI::TYPE_ALL], function ($mob_id) {
118  $this->afterUpload($mob_id);
119  }, function ($mob_id, $long_desc) {
120  $this->afterUrlSaving($mob_id, $long_desc);
121  }, function ($mob_ids) {
122  $this->afterPoolInsert($mob_ids);
123  });
124  $creation->setAllSuffixes($this->purposeSuffixes["Standard"]);
125  $creation->setAllMimeTypes($this->mimeTypes);
126  $this->ctrl->forwardCommand($creation);
127  break;
128 
129  case "ilinfoscreengui":
130  if (!$this->checkPermissionBool("read")) {
131  $this->checkPermission("visible");
132  }
133  $this->infoScreen(); // forwards command
134  break;
135 
136  case "ilexportgui":
137 // $this->prepareOutput();
138  $ilTabs->activateTab("export");
139  include_once("./Services/Export/classes/class.ilExportGUI.php");
140  $exp_gui = new ilExportGUI($this);
141  $exp_gui->addFormat("xml");
142  $ret = $this->ctrl->forwardCommand($exp_gui);
143 // $this->tpl->show();
144  break;
145 
146  case 'ilpermissiongui':
147  $ilTabs->activateTab("id_permissions");
148  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
149  $perm_gui = new ilPermissionGUI($this);
150  $ret = $this->ctrl->forwardCommand($perm_gui);
151  break;
152 
153  case 'ilobjectcopygui':
154  include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
155  $cp = new ilObjectCopyGUI($this);
156  $cp->setType('mcst');
157  $this->ctrl->forwardCommand($cp);
158  break;
159 
160  case "ilcommonactiondispatchergui":
161  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
163  $this->ctrl->forwardCommand($gui);
164  break;
165 
166  case "illearningprogressgui":
167  $ilTabs->activateTab('learning_progress');
168  require_once 'Services/Tracking/classes/class.ilLearningProgressGUI.php';
169  $new_gui = new ilLearningProgressGUI(
171  $this->object->getRefId(),
172  $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId()
173  );
174  $this->ctrl->forwardCommand($new_gui);
175  $this->tabs_gui->setTabActive('learning_progress');
176  break;
177 
178  default:
179  if (!$cmd) {
180  $cmd = "infoScreen";
181  }
182  $cmd .= "Object";
183  if ($cmd != "infoScreenObject") {
184  $this->checkPermission("read");
185  } else {
186  $this->checkPermission("visible");
187  }
188  $this->$cmd();
189 
190  break;
191  }
192 
193  $this->addHeaderAction();
194 
195  return true;
196  }
afterUrlSaving($mob_id, $long_desc)
After mob upload.
afterUpload($mob_id)
After mob upload.
GUI class for the workflow of copying objects.
$_GET["client_id"]
setAllSuffixes($a_val)
Set All suffixes.
Export User Interface Class.
prepareOutput($a_show_subobjects=true)
prepare output
afterPoolInsert($mob_ids)
After pool insert.
addContentSubTabs($a_active="content")
Add content subtabs.
$ret
Definition: parser.php:6
infoScreen()
show information screen
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
$ilUser
Definition: imgupload.php:18
addHeaderAction()
Add header action menu.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
Class ilObjUserTrackingGUI.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
+ Here is the call graph for this function:

◆ extractPreviewImageObject()

ilObjMediaCastGUI::extractPreviewImageObject ( )

Extract preview image.

Parameters

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

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

1743  {
1744  $ilCtrl = $this->ctrl;
1745 
1746  $this->checkPermission("write");
1747 
1748  $this->mcst_item = new ilNewsItem($_GET["item_id"]);
1749  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1750  $mob = new ilObjMediaObject($this->mcst_item->getMobId());
1751 
1752  try {
1753  $sec = (int) $_POST["sec"];
1754  if ($sec < 0) {
1755  $sec = 0;
1756  }
1757  if ($mob->getVideoPreviewPic() != "") {
1758  $mob->removeAdditionalFile($mob->getVideoPreviewPic(true));
1759  }
1760  include_once("./Services/MediaObjects/classes/class.ilFFmpeg.php");
1761  $med = $mob->getMediaItem("Standard");
1762  $mob_file = ilObjMediaObject::_getDirectory($mob->getId()) . "/" . $med->getLocation();
1763  $new_file = ilFFmpeg::extractImage(
1764  $mob_file,
1765  "mob_vpreview.png",
1766  ilObjMediaObject::_getDirectory($mob->getId()),
1767  $sec
1768  );
1769 
1770  if ($new_file != "") {
1771  ilUtil::sendInfo($this->lng->txt("mcst_image_extracted"), true);
1772  } else {
1773  ilUtil::sendFailure($this->lng->txt("mcst_no_extraction_possible"), true);
1774  }
1775  } catch (ilException $e) {
1776  if (DEVMODE == 1) {
1778  $add = (is_array($ret) && count($ret) > 0)
1779  ? "<br />" . implode("<br />", $ret)
1780  : "";
1781  }
1782  ilUtil::sendFailure($e->getMessage() . $add, true);
1783  }
1784 
1785 
1786  $ilCtrl->redirect($this, "editCastItem");
1787  }
static getLastReturnValues()
Get last return values.
$_GET["client_id"]
static _getDirectory($a_mob_id)
Get absolute directory.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static extractImage( $a_file, $a_target_filename, $a_target_dir="", $a_sec=1)
Extract image from video file.
Class ilObjMediaObject.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$ret
Definition: parser.php:6
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
$_POST["username"]
+ Here is the call graph for this function:

◆ getCastItemValues()

ilObjMediaCastGUI::getCastItemValues ( )

Get cast item values into form.

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

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

Referenced by editCastItemObject().

563  {
564  $lng = $this->lng;
565 
566  // get mob
567  $this->mcst_item = new ilNewsItem($_GET["item_id"]);
568  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
569  $mob = new ilObjMediaObject($this->mcst_item->getMobId());
570 
571  // preview
572  $ppic = $mob->getVideoPreviewPic();
573  if ($ppic != "") {
574  $i = $this->form_gui->getItemByPostVar("preview_pic");
575  $i->setImage($ppic);
576  }
577 
578 
579  $values = array();
580  $mediaItems = $this->getMediaItems($_GET["item_id"]);
581  if (count($mediaItems) > 0) {
582  foreach ($mediaItems as $med) {
583  if (!isset($values["title"])) {
584  // first item, so set title, description, ...
585  $values["title"] = $this->mcst_item->getTitle();
586  $values["description"] = $this->mcst_item->getContent();
587  $values["visibility"] = $this->mcst_item->getVisibility();
588  $length = explode(":", $this->mcst_item->getPlaytime());
589  $values["duration"] = array("hh" => $length[0], "mm" => $length[1], "ss" => $length[2]);
590  }
591 
592  $values["value_" . $med->getPurpose()] = (strlen($med->getLocation()) > 100) ? "..." . substr($med->getLocation(), strlen($med->getLocation()) - 100) : $med->getLocation();
593  $values["label_value_" . $med->getPurpose()] = (strlen($med->getLocation()) > 100) ? "..." . substr($med->getLocation(), strlen($med->getLocation()) - 100) : $med->getLocation();
594  $values["mimetype_" . $med->getPurpose()] = $med->getFormat();
595  }
596  }
597  foreach (ilObjMediaCast::$purposes as $purpose) {
598  if (!isset($values["value_" . $purpose])) {
599  $values["label_value_" . $purpose] = $lng->txt("none");
600  $values["value_" . $purpose] = $lng->txt("none");
601  }
602  }
603  $this->form_gui->setValuesByArray($values);
604  }
getVideoPreviewPic($a_filename_only=false)
Get video preview pic.
$_GET["client_id"]
Class ilObjMediaObject.
getMediaItems($id)
get MediaItems for id and updates local variable mcst_item
$i
Definition: metadata.php:24
+ 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 707 of file class.ilObjMediaCastGUI.php.

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

708  {
709  $duration = isset($this->form_gui)
710  ? $this->form_gui->getInput("duration")
711  : array("hh" => 0, "mm" => 0, "ss" => 0);
712  if ($duration["hh"] == 0 && $duration["mm"] == 0 && $duration["ss"] == 0 && is_file($file)) {
713  include_once("./Services/MediaObjects/classes/class.ilMediaAnalyzer.php");
714  $ana = new ilMediaAnalyzer();
715  $ana->setFile($file);
716  $ana->analyzeFile();
717  $dur = $ana->getPlaytimeString();
718  $dur = explode(":", $dur);
719  $cnt = count($dur);
720  $duration["hh"] = $dur[$cnt - 3] ?? 0;
721  $duration["mm"] = $dur[$cnt - 2] ?? 0;
722  $duration["ss"] = $dur[$cnt - 1];
723  }
724  $duration = str_pad($duration["hh"], 2, "0", STR_PAD_LEFT) . ":" .
725  str_pad($duration["mm"], 2, "0", STR_PAD_LEFT) . ":" .
726  str_pad($duration["ss"], 2, "0", STR_PAD_LEFT);
727  return $duration;
728  }
Analyzes media files.
+ Here is the caller graph for this function:

◆ getFeedIconsHTML()

ilObjMediaCastGUI::getFeedIconsHTML ( )

Get feed icons HTML.

Parameters

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

References $_GET, ilObjectGUI\$lng, ilObjMediaCast\$purposes, $url, ilBlockSetting\_lookup(), CLIENT_ID, ilRSSButtonGUI\get(), 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().

270  {
271  $lng = $this->lng;
272 
273  $html = "";
274 
275  include_once("./Services/Block/classes/class.ilBlockSetting.php");
276  $public_feed = ilBlockSetting::_lookup(
277  "news",
278  "public_feed",
279  0,
280  $this->object->getId()
281  );
282 
283  // rss icon/link
284  if ($public_feed) {
285  $news_set = new ilSetting("news");
286  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
287 
288  if ($enable_internal_rss) {
289  // create dummy object in db (we need an id)
290  $items = $this->object->getItemsArray();
291  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
292  $html = "";
293  foreach (ilObjMediaCast::$purposes as $purpose) {
294  foreach ($items as $id => $item) {
295  $mob = new ilObjMediaObject($item["mob_id"]);
296  $mob->read();
297  if ($mob->hasPurposeItem($purpose)) {
298  if ($html == "") {
299  $html = " ";
300  }
301  $url = ILIAS_HTTP_PATH . "/feed.php?client_id=" . rawurlencode(CLIENT_ID) . "&" . "ref_id=" . $_GET["ref_id"] . "&purpose=$purpose";
302  $title = $lng->txt("news_feed_url");
303 
304  include_once("./Services/News/classes/class.ilRSSButtonGUI.php");
305  switch (strtolower($purpose)) {
306  case "audioportable":
309  break;
310 
311  case "videoportable":
314  break;
315 
316  default:
317  $type1 = ilRSSButtonGUI::ICON_RSS;
319  break;
320  }
321  $row1 .= "&nbsp;" . ilRSSButtonGUI::get($type1, $url);
322  if ($this->object->getPublicFiles()) {
323  $url = preg_replace("/https?/i", "itpc", $url);
324  $title = $lng->txt("news_feed_url");
325 
326  include_once("./Services/News/classes/class.ilRSSButtonGUI.php");
327  $row2 .= "&nbsp;" . ilRSSButtonGUI::get($type2, $url);
328  }
329  break;
330  }
331  }
332  }
333  if ($html != "") {
334  $html .= $row1;
335  if ($row2 != "") {
336  $html .= $row2;
337  }
338  }
339  }
340  }
341  return $html;
342  }
static get($a_type, $a_href="")
Get icon html.
$_GET["client_id"]
const CLIENT_ID
Definition: constants.php:39
static _lookup($a_type, $a_setting, $a_user=0, $a_block_id=0)
Lookup setting from database.
Class ilObjMediaObject.
$url
+ 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 1461 of file class.ilObjMediaCastGUI.php.

References ilObjMediaObject\getMediaItem().

1462  {
1463  include_once("./Services/News/classes/class.ilNewsItem.php");
1464  $this->mcst_item = new ilNewsItem($id);
1465  // create dummy object in db (we need an id)
1466  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1467  $mob = new ilObjMediaObject($this->mcst_item->getMobId());
1468  return $mob->getMediaItem("Standard");
1469  }
getMediaItem($a_purpose)
get item for media purpose
Class ilObjMediaObject.
+ Here is the call graph for this function:

◆ getMediaItems()

ilObjMediaCastGUI::getMediaItems (   $id)
protected

get MediaItems for id and updates local variable mcst_item

Returns
array of ilMediaItem

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

References ilObjMediaObject\getMediaItems().

Referenced by getCastItemValues().

1478  {
1479  include_once("./Services/News/classes/class.ilNewsItem.php");
1480  $this->mcst_item = new ilNewsItem($id);
1481  // create dummy object in db (we need an id)
1482  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1483  $mob = new ilObjMediaObject($this->mcst_item->getMobId());
1484  return $mob->getMediaItems();
1485  }
Class ilObjMediaObject.
& getMediaItems()
get all media items
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleAutoplayTriggerObject()

ilObjMediaCastGUI::handleAutoplayTriggerObject ( )
protected

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

References $_GET, exit, and user().

1885  {
1886  $this->user->writePref("mcst_autoplay", (int) $_GET["autoplay"]);
1887  exit;
1888  }
exit
Definition: login.php:29
$_GET["client_id"]
user()
Definition: user.php:4
+ Here is the call graph for this function:

◆ handlePlayerCompletedEventObject()

ilObjMediaCastGUI::handlePlayerCompletedEventObject ( )
protected
Parameters

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

References $_GET, $ilUser, ilObjectGUI\$user, and exit.

1819  {
1820  $mob_id = (int) $_GET["mob_id"];
1821  if ($mob_id > 0) {
1822  $ilUser = $this->user;
1823  $this->object->handleLPUpdate($ilUser->getId(), $mob_id);
1824  }
1825  exit;
1826  }
exit
Definition: login.php:29
$_GET["client_id"]
$ilUser
Definition: imgupload.php:18

◆ handlePlayerEventObject()

ilObjMediaCastGUI::handlePlayerEventObject ( )

Handle player event.

Parameters

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

References $_GET, $ilUser, ilObjectGUI\$user, and exit.

1796  {
1797  if ($_GET["event"] == "play") {
1798  $player = explode("_", $_GET["player"]);
1799  $news_id = (int) $player[1];
1800  include_once("./Services/News/classes/class.ilNewsItem.php");
1801  $item = new ilNewsItem($news_id);
1802  $item->increasePlayCounter();
1803 
1804  $mob_id = $item->getMobId();
1805  if ($mob_id) {
1806  $ilUser = $this->user;
1807  $this->object->handleLPUpdate($ilUser->getId(), $mob_id);
1808  }
1809  }
1810  exit;
1811  }
exit
Definition: login.php:29
$_GET["client_id"]
$ilUser
Definition: imgupload.php:18

◆ infoScreen()

ilObjMediaCastGUI::infoScreen ( )

show information screen

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

References ilObjectGUI\$access, $error, ilObjectGUI\$ilErr, $tabs, ilObjectGUI\checkPermission(), ilObjectGUI\checkPermissionBool(), ilDatePresentation\formatDate(), and IL_CAL_DATETIME.

Referenced by executeCommand(), and infoScreenObject().

1039  {
1040  $ilAccess = $this->access;
1041  $ilErr = $this->error;
1042  $ilTabs = $this->tabs;
1043 
1044  $ilTabs->activateTab("id_info");
1045 
1046  if (!$this->checkPermissionBool("read")) {
1047  $this->checkPermission("visible");
1048  }
1049 
1050  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
1051  $info = new ilInfoScreenGUI($this);
1052 
1053  $info->enablePrivateNotes();
1054 
1055  // general information
1056  $this->lng->loadLanguageModule("meta");
1057  $this->lng->loadLanguageModule("mcst");
1058  $med_items = $this->object->getItemsArray();
1059  $info->addSection($this->lng->txt("meta_general"));
1060  $info->addProperty(
1061  $this->lng->txt("mcst_nr_items"),
1062  (int) count($med_items)
1063  );
1064 
1065  if (count($med_items) > 0) {
1066  $cur = current($med_items);
1067  $last = ilDatePresentation::formatDate(new ilDateTime($cur["creation_date"], IL_CAL_DATETIME));
1068  } else {
1069  $last = "-";
1070  }
1071 
1072  $info->addProperty($this->lng->txt("mcst_last_submission"), $last);
1073 
1074  // forward the command
1075  $this->ctrl->forwardCommand($info);
1076  }
Class ilInfoScreenGUI.
const IL_CAL_DATETIME
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
+ 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 1025 of file class.ilObjMediaCastGUI.php.

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

1026  {
1027  if (!$this->checkPermissionBool("read")) {
1028  $this->checkPermission("visible");
1029  }
1030  $this->ctrl->setCmd("showSummary");
1031  $this->ctrl->setCmdClass("ilinfoscreengui");
1032  $this->infoScreen();
1033  }
infoScreen()
show information screen
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
+ Here is the call graph for this function:

◆ initAddCastItemForm()

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

Init add cast item form.

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

References ilObjectGUI\$ctrl, ilObjectGUI\$lng, ilObjMediaCast\$purposes, $section, $tabs, ilObjectGUI\checkPermission(), ilRadioOption\setInfo(), ilFormPropertyGUI\setInfo(), ilRegExpInputGUI\setPattern(), ilFormPropertyGUI\setPostVar(), ilFormPropertyGUI\setRequired(), and ilFileInputGUI\setSuffixes().

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

445  {
446  $lng = $this->lng;
447  $ilCtrl = $this->ctrl;
448  $ilTabs = $this->tabs;
449 
450  $this->checkPermission("write");
451  $ilTabs->activateTab("edit_content");
452 
453  $lng->loadLanguageModule("mcst");
454 
455  $news_set = new ilSetting("news");
456  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
457 
458  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
459  $this->form_gui = new ilPropertyFormGUI();
460  $this->form_gui->setMultipart(true);
461 
462  // Property Title
463  $text_input = new ilTextInputGUI($lng->txt("title"), "title");
464  $text_input->setMaxLength(200);
465  $this->form_gui->addItem($text_input);
466 
467  // Property Content
468  $text_area = new ilTextAreaInputGUI($lng->txt("description"), "description");
469  $text_area->setRequired(false);
470  $this->form_gui->addItem($text_area);
471 
472  // Property Visibility
473  if ($enable_internal_rss) {
474  $radio_group = new ilRadioGroupInputGUI($lng->txt("access_scope"), "visibility");
475  $radio_option = new ilRadioOption($lng->txt("access_users"), "users");
476  $radio_group->addOption($radio_option);
477  $radio_option = new ilRadioOption($lng->txt("access_public"), "public");
478  $radio_group->addOption($radio_option);
479  $radio_group->setInfo($lng->txt("mcst_visibility_info"));
480  $radio_group->setRequired(true);
481  $radio_group->setValue($this->object->getDefaultAccess() == 0 ? "users" : "public");
482  $this->form_gui->addItem($radio_group);
483  }
484 
485  // Duration
486  $dur = new ilDurationInputGUI($lng->txt("mcst_duration"), "duration");
487  $dur->setInfo($lng->txt("mcst_duration_info"));
488  $dur->setShowDays(false);
489  $dur->setShowHours(true);
490  $dur->setShowSeconds(true);
491  $this->form_gui->addItem($dur);
492 
493  foreach (ilObjMediaCast::$purposes as $purpose) {
494  if ($purpose == "VideoAlternative" &&
495  $a_mode == "create") {
496  continue;
497  }
498 
500  $section->setTitle($lng->txt("mcst_" . strtolower($purpose) . "_title"));
501  $this->form_gui->addItem($section);
502  if ($a_mode != "create") {
503  $value = new ilHiddenInputGUI("value_" . $purpose);
504  $label = new ilNonEditableValueGUI($lng->txt("value"));
505  $label->setPostVar("label_value_" . $purpose);
506  $label->setInfo($lng->txt("mcst_current_value_info"));
507  $this->form_gui->addItem($label);
508  $this->form_gui->addItem($value);
509  }
510  $file = new ilFileInputGUI($lng->txt("file"), "file_" . $purpose);
511  $file->setSuffixes($this->purposeSuffixes[$purpose]);
512  $this->form_gui->addItem($file);
513  $text_input = new ilRegExpInputGUI($lng->txt("url"), "url_" . $purpose);
514  $text_input->setPattern("/https?\:\/\/.+/i");
515  $text_input->setInfo($lng->txt("mcst_reference_info"));
516  $this->form_gui->addItem($text_input);
517  if ($purpose != "Standard") {
518  $clearCheckBox = new ilCheckboxInputGUI();
519  $clearCheckBox->setPostVar("delete_" . $purpose);
520  $clearCheckBox->setTitle($lng->txt("mcst_clear_purpose_title"));
521  $this->form_gui->addItem($clearCheckBox);
522  } else {
523 
524  //
525  $ne = new ilNonEditableValueGUI($lng->txt("mcst_mimetype"), "mimetype_" . $purpose);
526  $this->form_gui->addItem($ne);
527 
528  // mime type selection
529  /*
530  $mimeTypeSelection = new ilSelectInputGUI();
531  $mimeTypeSelection->setPostVar("mimetype_" . $purpose);
532  $mimeTypeSelection->setTitle($lng->txt("mcst_mimetype"));
533  $mimeTypeSelection->setInfo($lng->txt("mcst_mimetype_info"));
534  $options = array("" => $lng->txt("mcst_automatic_detection"));
535  $options = array_merge($options, $this->mimeTypes);
536  $mimeTypeSelection->setOptions($options);
537  $this->form_gui->addItem($mimeTypeSelection);*/
538 
539  // preview picure
540  $pp = new ilImageFileInputGUI($lng->txt("mcst_preview_picture"), "preview_pic");
541  $pp->setSuffixes(array("png", "jpeg", "jpg"));
542  $pp->setInfo($lng->txt("mcst_preview_picture_info") . " mp4, mp3, png, jp(e)g, gif");
543  $this->form_gui->addItem($pp);
544  }
545  }
546 
547  // save/cancel button
548  if ($a_mode == "create") {
549  $this->form_gui->setTitle($lng->txt("mcst_add_new_item"));
550  $this->form_gui->addCommandButton("saveCastItem", $lng->txt("save"));
551  } else {
552  $this->form_gui->setTitle($lng->txt("mcst_edit_item"));
553  $this->form_gui->addCommandButton("updateCastItem", $lng->txt("save"));
554  }
555  $this->form_gui->addCommandButton("listItems", $lng->txt("cancel"));
556  $this->form_gui->setFormAction($ilCtrl->getFormAction($this, "saveCastItem"));
557  }
This class represents a duration (typical hh:mm:ss) property in a property form.
This class represents an option in a radio group.
This class represents a property form user interface.
This class represents a section header in a property form.
This class represents a file property in a property form.
setPostVar($a_postvar)
Set Post Variable.
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Info.
setInfo($a_info)
Set Information Text.
$section
Definition: Utf8Test.php:83
setPattern($pattern)
set pattern
This class represents a hidden form property in a property form.
This class represents a property in a property form.
This class represents a regular expression input 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 text area property in a property form.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
setSuffixes($a_suffixes)
Set Accepted Suffixes.
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initCreationForms()

ilObjMediaCastGUI::initCreationForms (   $a_new_type)
protected

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

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

199  {
200  $forms = array(self::CFORM_NEW => $this->initCreateForm($a_new_type),
201  self::CFORM_IMPORT => $this->initImportForm($a_new_type),
202  self::CFORM_CLONE => $this->fillCloneTemplate(null, $a_new_type));
203 
204  return $forms;
205  }
fillCloneTemplate($a_tpl_varname, $a_type)
Fill object clone template This method can be called from any object GUI class that wants to offer ob...
initImportForm($a_new_type)
Init object import form.
initCreateForm($a_new_type)
Init object creation form.
+ Here is the call graph for this function:

◆ initSettingsForm()

ilObjMediaCastGUI::initSettingsForm ( )

Init Settings Form.

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

References ilObjectGUI\$ctrl, ilObjectGUI\$lng, ilObjectGUI\$object_service, $si, ilObjectGUI\$tpl, ilBlockSetting\_lookup(), ilNewsItem\_lookupRSSPeriod(), ilRadioGroupInputGUI\addOption(), ilObjMediaCast\ORDER_CREATION_DATE_ASC, ilObjMediaCast\ORDER_CREATION_DATE_DESC, ilObjMediaCast\ORDER_MANUAL, ilObjMediaCast\ORDER_TITLE, ilCheckboxInputGUI\setChecked(), ilFormPropertyGUI\setInfo(), ilNumberInputGUI\setMaxValue(), ilTextAreaInputGUI\setValue(), ilObjMediaCast\VIEW_GALLERY, and ilObjMediaCast\VIEW_LIST.

Referenced by editSettingsObject(), and saveSettingsObject().

1205  {
1206  $tpl = $this->tpl;
1207  $lng = $this->lng;
1208  $ilCtrl = $this->ctrl;
1209  $obj_service = $this->object_service;
1210 
1211  $lng->loadLanguageModule("mcst");
1212 
1213  require_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1214  $this->form_gui = new ilPropertyFormGUI();
1215  $this->form_gui->setTitle($lng->txt("mcst_settings"));
1216 
1217  // Title
1218  $tit = new ilTextInputGUI($lng->txt("title"), "title");
1219  $tit->setValue($this->object->getTitle());
1220  $tit->setRequired(true);
1221  $this->form_gui->addItem($tit);
1222 
1223  // description
1224  $des = new ilTextAreaInputGUI($lng->txt("description"), "description");
1225  $des->setValue($this->object->getLongDescription());
1226  $this->form_gui->addItem($des);
1227 
1228  $sh = new ilFormSectionHeaderGUI();
1229  $sh->setTitle($lng->txt("rep_activation_availability"));
1230  $this->form_gui->addItem($sh);
1231 
1232  // Online
1233  $online = new ilCheckboxInputGUI($lng->txt("online"), "online");
1234  $online->setChecked($this->object->getOnline());
1235  $this->form_gui->addItem($online);
1236 
1237  // presentation
1238  $sh = new ilFormSectionHeaderGUI();
1239  $sh->setTitle($lng->txt("obj_presentation"));
1240  $this->form_gui->addItem($sh);
1241 
1242  // tile image
1243  $obj_service->commonSettings()->legacyForm($this->form_gui, $this->object)->addTileImage();
1244 
1245  // Sorting
1246  $sort = new ilRadioGroupInputGUI($lng->txt("mcst_ordering"), "order");
1247  $sort->addOption(new ilRadioOption(
1248  $lng->txt("mcst_ordering_title"),
1250  ));
1251  $sort->addOption(new ilRadioOption(
1252  $lng->txt("mcst_ordering_creation_date_asc"),
1254  ));
1255  $sort->addOption(new ilRadioOption(
1256  $lng->txt("mcst_ordering_creation_date_desc"),
1258  ));
1259  $sort->addOption(new ilRadioOption(
1260  $lng->txt("mcst_ordering_manual"),
1262  ));
1263  $sort->setValue($this->object->getOrder());
1264  $this->form_gui->addItem($sort);
1265 
1266  // view mode
1267  $options = array(
1268  ilObjMediaCast::VIEW_LIST => $lng->txt("mcst_list"),
1269  ilObjMediaCast::VIEW_GALLERY => $lng->txt("mcst_gallery")
1270  );
1271  $si = new ilRadioGroupInputGUI($this->lng->txt("mcst_viewmode"), "viewmode");
1272  $si->addOption(new ilRadioOption(
1273  $lng->txt("mcst_list"),
1275  ));
1276  $si->addOption(new ilRadioOption(
1277  $lng->txt("mcst_gallery"),
1279  ));
1280 
1281  // $si->setOptions($options);
1282  $si->setValue($this->object->getViewMode());
1283  $this->form_gui->addItem($si);
1284 
1285 
1286  // Downloadable
1287  $downloadable = new ilCheckboxInputGUI($lng->txt("mcst_downloadable"), "downloadable");
1288  $downloadable->setChecked($this->object->getDownloadable());
1289  $downloadable->setInfo($lng->txt("mcst_downloadable_info"));
1290  $this->form_gui->addItem($downloadable);
1291 
1292  $news_set = new ilSetting("news");
1293  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1294 
1295  //Default Visibility
1296  if ($enable_internal_rss) {
1297  // webfeed
1298  $sh = new ilFormSectionHeaderGUI();
1299  $sh->setTitle($lng->txt("mcst_webfeed"));
1300  $this->form_gui->addItem($sh);
1301 
1302  $radio_group = new ilRadioGroupInputGUI($lng->txt("news_default_visibility"), "defaultaccess");
1303  $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "0");
1304  $radio_option->setInfo($lng->txt("news_news_item_def_visibility_users_info"));
1305  $radio_group->addOption($radio_option);
1306  $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "1");
1307  $radio_option->setInfo($lng->txt("news_news_item_def_visibility_public_info"));
1308  $radio_group->addOption($radio_option);
1309  $radio_group->setRequired(false);
1310  $radio_group->setValue($this->object->getDefaultAccess());
1311  #$ch->addSubItem($radio_group);
1312  $this->form_gui->addItem($radio_group);
1313 
1314  //Extra Feed
1315  include_once("./Services/Block/classes/class.ilBlockSetting.php");
1316  $public_feed = ilBlockSetting::_lookup("news", "public_feed", 0, $this->object->getId());
1317  $ch = new ilCheckboxInputGUI($lng->txt("news_public_feed"), "extra_feed");
1318  $ch->setInfo($lng->txt("news_public_feed_info"));
1319  $ch->setChecked($public_feed);
1320  $this->form_gui->addItem($ch);
1321 
1322  // keep minimal x number of items
1323  $ni = new ilNumberInputGUI($this->lng->txt("news_keep_minimal_x_items"), "keep_rss_min");
1324  $ni->setMaxValue(100);
1325  $ni->setMinValue(0);
1326  $ni->setMaxLength(3);
1327  $ni->setSize(3);
1328  $ni->setInfo($this->lng->txt("news_keep_minimal_x_items_info") . " (" .
1329  ilNewsItem::_lookupRSSPeriod() . " " . (ilNewsItem::_lookupRSSPeriod() == 1 ? $lng->txt("day") : $lng->txt("days")) . ")");
1330  $ni->setValue((int) ilBlockSetting::_lookup("news", "keep_rss_min", 0, $this->object->getId()));
1331  $ch->addSubItem($ni);
1332 
1333  // Include Files in Pubic Items
1334  $incl_files = new ilCheckboxInputGUI($lng->txt("mcst_incl_files_in_rss"), "public_files");
1335  $incl_files->setChecked($this->object->getPublicFiles());
1336  $incl_files->setInfo($lng->txt("mcst_incl_files_in_rss_info"));
1337  #$ch->addSubItem($incl_files);
1338  $this->form_gui->addItem($incl_files);
1339  }
1340 
1341  // Form action and save button
1342  $this->form_gui->addCommandButton("saveSettings", $lng->txt("save"));
1343  $this->form_gui->setFormAction($ilCtrl->getFormAction($this, "saveSettings"));
1344  }
This class represents an option in a radio group.
static _lookupRSSPeriod()
This class represents a property form user interface.
This class represents a section header in a property form.
setValue($a_value)
Set Value.
This class represents a checkbox property in a property form.
setInfo($a_info)
Set Information Text.
setChecked($a_checked)
Set Checked.
This class represents a property in a property form.
addOption($a_option)
Add Option.
This class represents a number property in a property form.
static _lookup($a_type, $a_setting, $a_user=0, $a_block_id=0)
Lookup setting from database.
setMaxValue($a_maxvalue, $a_display_always=false)
Set Maximum Value.
This class represents a text area property in a property form.
+ 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 1450 of file class.ilObjMediaCastGUI.php.

1451  {
1452  return strpos($extension, "audio") !== false;
1453  }

◆ listItemsObject()

ilObjMediaCastGUI::listItemsObject (   $a_presentation_mode = false)

List items of media cast.

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

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

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

222  {
223  $tpl = $this->tpl;
224  $lng = $this->lng;
225  $ilAccess = $this->access;
226  $ilTabs = $this->tabs;
227  $ilToolbar = $this->toolbar;
228 
229  $this->checkPermission("read");
230 
231  if ($a_presentation_mode) {
232  $this->addContentSubTabs("content");
233  } else {
234  $this->addContentSubTabs("manage");
235  }
236 
237  $med_items = $this->object->getSortedItemsArray();
238 
239  include_once("./Modules/MediaCast/classes/class.ilMediaCastTableGUI.php");
240  if ($a_presentation_mode) {
241  $table_gui = new ilMediaCastTableGUI($this, "showContent", false, true);
242  } else {
243  $table_gui = new ilMediaCastTableGUI($this, "listItems");
244  }
245 
246  $table_gui->setData($med_items);
247 
248  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]) && !$a_presentation_mode) {
249  $ilToolbar->addButton($lng->txt("add"), $this->ctrl->getLinkTargetByClass("ilMediaCreationGUI", ""));
250 
251  $table_gui->addMultiCommand("confirmDeletionItems", $lng->txt("delete"));
252  $table_gui->setSelectAllCheckbox("item_id");
253  }
254 
255  $feed_icon_html = $this->getFeedIconsHTML();
256  if ($feed_icon_html != "") {
257  $table_gui->setHeaderHTML($feed_icon_html);
258  }
259 
260  $tpl->setContent($table_gui->getHTML());
261  }
$_GET["client_id"]
getFeedIconsHTML()
Get feed icons HTML.
addContentSubTabs($a_active="content")
Add content subtabs.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
TableGUI class for table NewsForContext.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ populateFormFromPost()

ilObjMediaCastGUI::populateFormFromPost ( )
private

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

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

Referenced by saveCastItemObject(), and updateCastItemObject().

1488  {
1489  $tpl = $this->tpl;
1490  //issue: we have to display the current settings
1491  // problem: POST does not contain values of disabled textfields
1492  // solution: use hidden field and label to display-> here we need to synchronize the labels
1493  // with the values from the hidden fields.
1494  foreach (ilObjMediaCast::$purposes as $purpose) {
1495  if ($_POST["value_" . $purpose]) {
1496  $_POST["label_value_" . $purpose] = $_POST["value_" . $purpose];
1497  }
1498  }
1499 
1500  $this->form_gui->setValuesByPost();
1501  $tpl->setContent($this->form_gui->getHTML());
1502  }
$_POST["username"]
+ Here is the caller graph for this function:

◆ saveCastItemObject()

ilObjMediaCastGUI::saveCastItemObject ( )

Save new cast item.

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

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

610  {
611  $tpl = $this->tpl;
612  $ilCtrl = $this->ctrl;
614  $lng = $this->lng;
615  $ilTabs = $this->tabs;
616 
617  $this->checkPermission("write");
618  $ilTabs->activateTab("edit_content");
619 
620  $this->initAddCastItemForm();
621 
622  if (!$this->form_gui->checkInput() ||
623  ($_POST["url_Standard"] == "" && !$_FILES['file_Standard']['tmp_name'])) {
624  if (($_POST["url_Standard"] == "" && !$_FILES['file_Standard']['tmp_name'])) {
625  ilUtil::sendFailure($lng->txt("mcst_input_either_file_or_url"));
626  }
627  $this->populateFormFromPost();
628  } else {
629  // create dummy object in db (we need an id)
630  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
631  $mob = new ilObjMediaObject();
632  $mob->create();
633 
634  //handle standard purpose
635  $file = $this->createMediaItemForPurpose($mob, "Standard");
636 
637  // set title and description
638  // set title to basename of file if left empty
639  $title = $this->form_gui->getInput("title") != "" ? $this->form_gui->getInput("title") : basename($file);
640  $description = $this->form_gui->getInput("description");
641  $mob->setTitle($title);
642  $mob->setDescription($description);
643 
644  // save preview pic
645  $prevpic = $this->form_gui->getInput("preview_pic");
646  if ($prevpic["size"] > 0) {
647  $mob->uploadVideoPreviewPic($prevpic);
648  }
649 
650  // determine duration for standard purpose
651  $duration = $this->getDuration($file);
652 
653  // handle other purposes
654  foreach ($this->additionalPurposes as $purpose) {
655  // check if some purpose has been uploaded
656  $file_gui = $this->form_gui->getInput("file_" . $purpose);
657  $url_gui = $this->form_gui->getInput("url_" . $purpose);
658  if ($url_gui || $file_gui["size"] > 0) {
659  $this->createMediaItemForPurpose($mob, $purpose);
660  }
661  }
662 
663  $mob->update();
664 
665  if ($prevpic["size"] == 0) {
666  // re-read media object
667  $mob = new ilObjMediaObject($mob->getId());
668  $mob->generatePreviewPic(320, 240);
669  }
670 
671  //
672  // @todo: save usage
673  //
674 
675  $news_set = new ilSetting("news");
676  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
677 
678  // create new media cast item
679  include_once("./Services/News/classes/class.ilNewsItem.php");
680  $mc_item = new ilNewsItem();
681  $mc_item->setMobId($mob->getId());
682  $mc_item->setContentType(NEWS_AUDIO);
683  $mc_item->setContextObjId($this->object->getId());
684  $mc_item->setContextObjType($this->object->getType());
685  $mc_item->setUserId($ilUser->getId());
686  $mc_item->setPlaytime($duration);
687  $mc_item->setTitle($title);
688  $mc_item->setContent($description);
689  $mc_item->setLimitation(false);
690  if ($enable_internal_rss) {
691  $mc_item->setVisibility($this->form_gui->getInput("visibility"));
692  } else {
693  $mc_item->setVisibility("users");
694  }
695  $mc_item->create();
696 
697  $ilCtrl->redirect($this, "listItems");
698  }
699  }
getDuration($file)
get duration from form or from file analyzer
initAddCastItemForm($a_mode="create")
Init add cast item form.
createMediaItemForPurpose($mob, $purpose)
handle media item for given purpose
Class ilObjMediaObject.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
const NEWS_AUDIO
$ilUser
Definition: imgupload.php:18
$_POST["username"]
+ Here is the call graph for this function:

◆ saveOrderObject()

ilObjMediaCastGUI::saveOrderObject ( )

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

References $_POST, and ilObjectGUI\$lng.

1539  {
1540  $lng = $this->lng;
1541 
1542  asort($_POST["item_id"]);
1543 
1544  $items = array();
1545  foreach (array_keys($_POST["item_id"]) as $id) {
1546  $items[] = $id;
1547  }
1548  $this->object->saveOrder($items);
1549 
1550  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
1551  $this->ctrl->redirect($this, "editOrder");
1552  }
$_POST["username"]

◆ saveSettingsObject()

ilObjMediaCastGUI::saveSettingsObject ( )

Save Settings.

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

References ilObjectGUI\$ctrl, ilObjectGUI\$object_service, $tabs, ilBlockSetting\_write(), ilObjectGUI\checkPermission(), and initSettingsForm().

1350  {
1351  $ilCtrl = $this->ctrl;
1352  $ilTabs = $this->tabs;
1353  $obj_service = $this->object_service;
1354 
1355  $this->checkPermission("write");
1356  $ilTabs->activateTab("id_settings");
1357 
1358  $this->initSettingsForm();
1359  if ($this->form_gui->checkInput()) {
1360  $news_set = new ilSetting("news");
1361  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1362 
1363  $this->object->setTitle($this->form_gui->getInput("title"));
1364  $this->object->setDescription($this->form_gui->getInput("description"));
1365  $this->object->setOnline($this->form_gui->getInput("online"));
1366  $this->object->setDownloadable($this->form_gui->getInput("downloadable"));
1367  $this->object->setOrder($this->form_gui->getInput("order"));
1368  $this->object->setViewMode($this->form_gui->getInput("viewmode"));
1369 
1370  // tile image
1371  $obj_service->commonSettings()->legacyForm($this->form_gui, $this->object)->saveTileImage();
1372 
1373  if ($enable_internal_rss) {
1374  $this->object->setPublicFiles($this->form_gui->getInput("public_files"));
1375  $this->object->setDefaultAccess($this->form_gui->getInput("defaultaccess"));
1376  }
1377  $this->object->update();
1378 
1379  if ($enable_internal_rss) {
1380  include_once("./Services/Block/classes/class.ilBlockSetting.php");
1382  "news",
1383  "public_feed",
1384  $this->form_gui->getInput("extra_feed"),
1385  0,
1386  $this->object->getId()
1387  );
1388 
1390  "news",
1391  "keep_rss_min",
1392  $this->form_gui->getInput("keep_rss_min"),
1393  0,
1394  $this->object->getId()
1395  );
1396  }
1397 
1398  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1399  $ilCtrl->redirect($this, "editSettings");
1400  } else {
1401  $this->form_gui->setValuesByPost();
1402  $this->tpl->setContent($this->form_gui->getHTML());
1403  }
1404  }
static _write($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
Write setting to database.
initSettingsForm()
Init Settings Form.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
+ Here is the call graph for this function:

◆ setTabs()

ilObjMediaCastGUI::setTabs ( )

get tabs public

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

References ilObjectGUI\$access, $help, ilObjectGUI\$lng, $tabs, and ilLearningProgressAccess\checkAccess().

1083  {
1084  $ilAccess = $this->access;
1085  $ilTabs = $this->tabs;
1086  $lng = $this->lng;
1087  $ilHelp = $this->help;
1088 
1089  $ilHelp->setScreenIdComponent("mcst");
1090 
1091  // list items
1092  if ($ilAccess->checkAccess('read', "", $this->object->getRefId())) {
1093  $ilTabs->addTab(
1094  "content",
1095  $lng->txt("content"),
1096  $this->ctrl->getLinkTarget($this, "showContent")
1097  );
1098  }
1099 
1100  // info screen
1101  if ($ilAccess->checkAccess('visible', "", $this->object->getRefId()) ||
1102  $ilAccess->checkAccess('read', "", $this->object->getRefId())) {
1103  $ilTabs->addTab(
1104  "id_info",
1105  $lng->txt("info_short"),
1106  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary")
1107  );
1108  }
1109 
1110  // settings
1111  if ($ilAccess->checkAccess('write', "", $this->object->getRefId())) {
1112  $ilTabs->addTab(
1113  "id_settings",
1114  $lng->txt("settings"),
1115  $this->ctrl->getLinkTarget($this, "editSettings")
1116  );
1117  }
1118 
1119  require_once 'Services/Tracking/classes/class.ilLearningProgressAccess.php';
1120  if (ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
1121  $ilTabs->addTab(
1122  'learning_progress',
1123  $lng->txt('learning_progress'),
1124  $this->ctrl->getLinkTargetByClass(array(__CLASS__, 'illearningprogressgui'), '')
1125  );
1126  }
1127 
1128  // export
1129  if ($ilAccess->checkAccess("write", "", $this->object->getRefId())) {
1130  $ilTabs->addTab(
1131  "export",
1132  $lng->txt("export"),
1133  $this->ctrl->getLinkTargetByClass("ilexportgui", "")
1134  );
1135  }
1136 
1137  // edit permissions
1138  if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId())) {
1139  $ilTabs->addTab(
1140  "id_permissions",
1141  $lng->txt("perm_settings"),
1142  $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm")
1143  );
1144  }
1145  }
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
+ Here is the call graph for this function:

◆ showContentObject()

ilObjMediaCastGUI::showContentObject ( )

Show content.

Parameters

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

References $ilUser, ilObjectGUI\$tpl, ilObjectGUI\$user, ilChangeEvent\_recordReadEvent(), ilLPStatusWrapper\_updateStatus(), listItemsObject(), showGallery(), and ilObjMediaCast\VIEW_GALLERY.

1565  {
1566  $tpl = $this->tpl;
1567  $ilUser = $this->user;
1568 
1569  // need read events for parent for LP statistics
1570  require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
1572  "mcst",
1573  $this->object->getRefId(),
1574  $this->object->getId(),
1575  $ilUser->getId()
1576  );
1577 
1578  // trigger LP update
1579  require_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
1580  ilLPStatusWrapper::_updateStatus($this->object->getId(), $ilUser->getId());
1581 
1582  if ($this->object->getViewMode() == ilObjMediaCast::VIEW_GALLERY) {
1583  $this->showGallery();
1584  } else {
1585  $this->listItemsObject(true);
1586  }
1587 
1588  $tpl->setPermanentLink($this->object->getType(), $this->object->getRefId());
1589  }
static _recordReadEvent( $a_type, $a_ref_id, $obj_id, $usr_id, $isCatchupWriteEvents=true, $a_ext_rc=false, $a_ext_time=false)
Records a read event and catches up with write events.
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
listItemsObject($a_presentation_mode=false)
List items of media cast.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ showGallery()

ilObjMediaCastGUI::showGallery ( )

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

References ilObjectGUI\$ctrl, $tabs, ilObjectGUI\$tpl, ilObjMediaObject\_getURL(), addContentSubTabs(), getFeedIconsHTML(), ilUtil\getImagePath(), ilUtil\img(), ilMediaPlayerGUI\setFile(), and ilWACSignedPath\signFile().

Referenced by showContentObject().

1592  {
1593  $tpl = $this->tpl;
1594  $ilTabs = $this->tabs;
1595  $ilCtrl = $this->ctrl;
1596 
1597  $tpl->addJavascript("./Modules/MediaCast/js/MediaCast.js");
1598 
1599  $ilTabs->activateTab("content");
1600 
1601  $this->addContentSubTabs("content");
1602 
1603  $ctpl = new ilTemplate("tpl.mcst_content.html", true, true, "Modules/MediaCast");
1604 
1605  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1606  require_once('./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
1607  foreach ($this->object->getSortedItemsArray() as $item) {
1608  $mob = new ilObjMediaObject($item["mob_id"]);
1609  $med = $mob->getMediaItem("Standard");
1610 
1611  $ctpl->setCurrentBlock("item");
1612  $ctpl->setVariable("TITLE", $item["title"]);
1613  $ctpl->setVariable("TIME", $item["playtime"]);
1614  $ctpl->setVariable("ID", $item["id"]);
1615 
1616  if ($mob->getVideoPreviewPic() != "") {
1617  $ctpl->setVariable(
1618  "PREVIEW_PIC",
1619  ilUtil::img(ilWACSignedPath::signFile($mob->getVideoPreviewPic()), $item["title"], 320, 240)
1620  );
1621  } else {
1622  $ctpl->setVariable(
1623  "PREVIEW_PIC",
1624  ilUtil::img(ilUtil::getImagePath("mcst_preview.svg"), $item["title"], 320, 240)
1625  );
1626  }
1627 
1628  // player
1629  if (is_object($med)) {
1630  include_once("./Services/MediaObjects/classes/class.ilMediaPlayerGUI.php");
1631 
1632  // the news id will be used as player id, see also ilMediaCastTableGUI
1633  $mpl = new ilMediaPlayerGUI(
1634  $item["id"],
1635  $ilCtrl->getLinkTarget($this, "handlePlayerEvent", "", true, false)
1636  );
1637 
1638  if (strcasecmp("Reference", $med->getLocationType()) == 0) {
1639  $mpl->setFile(ilWACSignedPath::signFile($med->getLocation()));
1640  } else {
1641  $path_to_file = ilObjMediaObject::_getURL($mob->getId()) . "/" . $med->getLocation();
1642  $mpl->setFile(ilWACSignedPath::signFile($path_to_file));
1643  }
1644  $mpl->setMimeType($med->getFormat());
1645  //$mpl->setDisplayHeight($med->getHeight());
1646  //$mpl->setDisplayHeight("480");
1647  //$mpl->setDisplayWidth("320px");
1648  $mpl->setVideoPreviewPic(ilWACSignedPath::signFile($mob->getVideoPreviewPic()));
1649  $mpl->setTitle($item["title"]);
1650  $mpl->setDescription($item["content"]);
1651  $mpl->setForceAudioPreview(true);
1652  if ($this->object->getDownloadable()) {
1653  $ilCtrl->setParameterByClass("ilobjmediacastgui", "item_id", $item["id"]);
1654  $ilCtrl->setParameterByClass("ilobjmediacastgui", "purpose", "Standard");
1655  $mpl->setDownloadLink($ilCtrl->getLinkTargetByClass("ilobjmediacastgui", "downloadItem"));
1656  }
1657  $med_alt = $mob->getMediaItem("VideoAlternative");
1658  if (is_object($med_alt)) {
1659  $mpl->setAlternativeVideoFile(ilWACSignedPath::signFile(ilObjMediaObject::_getURL($mob->getId()) . "/" .
1660  $med_alt->getLocation()));
1661  $mpl->setAlternativeVideoMimeType($med_alt->getFormat());
1662  }
1663 
1664  $ctpl->setVariable("PLAYER", $mpl->getPreviewHtml());
1665  }
1666 
1667 
1668  $ctpl->parseCurrentBlock();
1669  }
1670 
1671  $feed_icon_html = $this->getFeedIconsHTML();
1672 
1673  if ($feed_icon_html != "") {
1674  $feed_icon_html = '<p>' . $feed_icon_html . '</p>';
1675  }
1676 
1677  $tpl->setContent($feed_icon_html . $ctpl->get());
1678  }
setFile($a_file)
Set File.
static _getURL($a_mob_id)
get directory for files of media object (static)
getFeedIconsHTML()
Get feed icons HTML.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
addContentSubTabs($a_active="content")
Add content subtabs.
Class ilObjMediaObject.
static signFile($path_to_file)
static img($a_src, $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
User interface for media player.
+ 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 827 of file class.ilObjMediaCastGUI.php.

References $_GET, ilObjectGUI\$ctrl, $ilUser, $log, ilObjMediaCast\$purposes, ilObjectGUI\$user, ilObjectGUI\checkPermission(), createMediaItemForPurpose(), getDuration(), initAddCastItemForm(), populateFormFromPost(), and updateMediaItem().

828  {
829  $ilCtrl = $this->ctrl;
831  $ilLog = $this->log;
832 
833  $this->checkPermission("write");
834 
835  $this->initAddCastItemForm("edit");
836 
837  if ($this->form_gui->checkInput()) {
838  // create new media cast item
839  include_once("./Services/News/classes/class.ilNewsItem.php");
840  $mc_item = new ilNewsItem($_GET["item_id"]);
841  $mob_id = $mc_item->getMobId();
842 
843  // create dummy object in db (we need an id)
844  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
845  $mob = new ilObjMediaObject($mob_id);
846 
847 
848  foreach (ilObjMediaCast::$purposes as $purpose) {
849  if ($this->form_gui->getInput("delete_" . $purpose)) {
850  $mob->removeMediaItem($purpose);
851  $ilLog->write("Mcst: deleting purpose $purpose");
852  continue;
853  }
854  $media_item = $mob->getMediaItem($purpose);
855  $url_gui = $this->form_gui->getInput("url_" . $purpose);
856  $file_gui = $this->form_gui->getInput("file_" . $purpose);
857 
858  if ($media_item == null) {
859  if ($purpose != "Standard" &&
860  ($url_gui || $file_gui["size"] > 0)) {
861  // check if we added an additional purpose when updating
862  // either by url or by file
863  $file = $this->createMediaItemForPurpose($mob, $purpose);
864  }
865  } else {
866  $file = $this->updateMediaItem($mob, $media_item);
867  }
868 
869  if ($purpose == "Standard") {
870  $duration = $this->getDuration($file);
871  $title = $this->form_gui->getInput("title") != "" ? $this->form_gui->getInput("title") : basename($file);
872  $description = $this->form_gui->getInput("description");
873 
874  $mob->setTitle($title);
875  $mob->setDescription($description);
876 
877  $prevpic = $this->form_gui->getInput("preview_pic");
878  if ($prevpic["size"] > 0) {
879  $mob->uploadVideoPreviewPic($prevpic);
880  } else {
881  $prevpici = $this->form_gui->getItemByPostVar("preview_pic");
882  if ($prevpici->getDeletionFlag()) {
883  $mob->removeAdditionalFile($mob->getVideoPreviewPic(true));
884  }
885  }
886  }
887  }
888 
889  // set real meta and object data
890  $mob->update();
891 
892  //
893  // @todo: save usage
894  //
895 
896  $news_set = new ilSetting("news");
897  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
898 
899  $mc_item->setUserId($ilUser->getId());
900  if (isset($duration)) {
901  $mc_item->setPlaytime($duration);
902  }
903  $mc_item->setTitle($title);
904  $mc_item->setContent($description);
905  if ($enable_internal_rss) {
906  $mc_item->setVisibility($this->form_gui->getInput("visibility"));
907  }
908  $mc_item->update();
909 
910  $ilCtrl->redirect($this, "listItems");
911  } else {
912  $this->populateFormFromPost();
913  }
914  }
updateMediaItem($mob, &$mediaItem)
update media item from form
getDuration($file)
get duration from form or from file analyzer
$_GET["client_id"]
initAddCastItemForm($a_mode="create")
Init add cast item form.
createMediaItemForPurpose($mob, $purpose)
handle media item for given purpose
Class ilObjMediaObject.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
$ilUser
Definition: imgupload.php:18
+ 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
Exceptions
FileNotFoundException
IOException

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

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

Referenced by createMediaItemForPurpose(), and updateCastItemObject().

754  {
755  $purpose = $mediaItem->getPurpose();
756  $locationType = $mediaItem->getLocationType();
757  $url_gui = $this->form_gui->getInput("url_" . $purpose);
758  $file_gui = $this->form_gui->getInput("file_" . $purpose);
759  if ($url_gui) {
760  // http
761  $file = $this->form_gui->getInput("url_" . $purpose);
762  $title = basename($file);
763  $location = $this->form_gui->getInput("url_" . $purpose);
764  $locationType = "Reference";
765  } elseif ($file_gui["size"] > 0) {
766  // lokal
767  // determine and create mob directory, move uploaded file to directory
768  $mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
769  if (!is_dir($mob_dir)) {
770  $mob->createDirectory();
771  } else {
772  $dir = LegacyPathHelper::createRelativePath($mob_dir);
773  $old_files = $this->filesystem->finder()->in([$dir])->exclude([$dir . '/mob_vpreview.png'])->files();
774  foreach ($old_files as $file) {
775  $this->filesystem->delete($file->getPath());
776  }
777  }
778 
779  $file_name = ilUtil::getASCIIFilename($_FILES['file_' . $purpose]['name']);
780  $file_name = str_replace(" ", "_", $file_name);
781 
782  $file = $mob_dir . "/" . $file_name;
783  $title = $file_name;
784  $locationType = "LocalFile";
785  $location = $title;
786  ilUtil::moveUploadedFile($_FILES['file_' . $purpose]['tmp_name'], $file_name, $file);
787  ilUtil::renameExecutables($mob_dir);
788  }
789 
790  // check if not automatic mimetype detection
791 // if ($_POST["mimetype_" . $purpose] != "") {
792 // $mediaItem->setFormat($_POST["mimetype_" . $purpose]);
793 // } elseif ($mediaItem->getLocation() != "") {
794  $format = ilObjMediaObject::getMimeType($mediaItem->getLocation(), ($locationType == "Reference"));
795  $mediaItem->setFormat($format);
796 // }
797 
798  if (isset($file)) {
799  // get mime type, if not already set!
800  if (!isset($format)) {
801  $format = ilObjMediaObject::getMimeType($file, ($locationType == "Reference"));
802  }
803 
804  // set real meta and object data
805  $mediaItem->setFormat($format);
806  $mediaItem->setLocation($location);
807  $mediaItem->setLocationType($locationType);
808  $mediaItem->setHAlign("Left");
809  $mediaItem->setHeight(self::isAudio($format)?0:180);
810  }
811 
812  if ($purpose == "Standard") {
813  if (isset($title)) {
814  $mob->setTitle($title);
815  }
816  if (isset($format)) {
817  $mob->setDescription($format);
818  }
819  }
820 
821  return $file;
822  }
static getMimeType($a_file, $a_external=null)
get mime type for file
$location
Definition: buildRTE.php:44
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static _getDirectory($a_mob_id)
Get absolute directory.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
$format
Definition: metadata.php:218
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $additionalPurposes

ilObjMediaCastGUI::$additionalPurposes = []
private

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

◆ $error

ilObjMediaCastGUI::$error
protected

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

Referenced by infoScreen().

◆ $filesystem

ilObjMediaCastGUI::$filesystem
protected

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

◆ $help

ilObjMediaCastGUI::$help
protected

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

Referenced by setTabs().

◆ $log

ilObjMediaCastGUI::$log
protected

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

Referenced by updateCastItemObject().

◆ $mimeTypes

ilObjMediaCastGUI::$mimeTypes = array()
private

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

◆ $purposeSuffixes

ilObjMediaCastGUI::$purposeSuffixes = array()
private

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

◆ $tabs


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