ILIAS  release_4-4 Revision
ilObjMediaCastGUI Class Reference

Class ilObjMediaCastGUI. More...

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

Public Member Functions

 ilObjMediaCastGUI ($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
 Constructor public. More...
 
 executeCommand ()
 
 afterSave ($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 ()
 
 _goto ($a_target)
 
 saveOrderObject ()
 
 showContentObject ()
 Show content. More...
 
 showGallery ()
 
 convertFileObject ()
 Convert file object. More...
 
 extractPreviewImageObject ()
 Extract preview image. More...
 
 handlePlayerEventObject ()
 Handle player event. More...
 
- Public Member Functions inherited from ilObjectGUI
 ilObjectGUI ($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
 Constructor public. More...
 
executeCommand ()
 execute command More...
 
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not) More...
 
 setCreationMode ($a_mode=true)
 if true, a creation screen is displayed the current $_GET[ref_id] don't belong to the current class! the mode is determined in ilrepositorygui More...
 
 getCreationMode ()
 get creation mode More...
 
 getAdminTabs (&$tabs_gui)
 administration tabs show only permissions and trash folder More...
 
 getHTML ()
 
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled More...
 
 cancelDeleteObject ()
 cancel deletion of object More...
 
 cancelObject ($in_rep=false)
 cancel action and go back to previous page public More...
 
 createObject ()
 create new object form More...
 
 cancelCreation ()
 cancel create action and go back to repository parent More...
 
 saveObject ()
 save object More...
 
 editObject ()
 edit object More...
 
 updateObject ()
 updates object entry in object_data More...
 
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g. More...
 
 isVisible ($a_ref_id, $a_type)
 
 viewObject ()
 list childs of current object More...
 
 deleteObject ($a_error=false)
 Display deletion confirmation screen. More...
 
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI. More...
 

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

Static Protected Member Functions

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

Private Member Functions

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

Private Attributes

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

Additional Inherited Members

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

Detailed Description

Member Function Documentation

◆ _goto()

ilObjMediaCastGUI::_goto (   $a_target)

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

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

1314  {
1315  global $ilAccess, $ilErr, $lng;
1316 
1317  if ($ilAccess->checkAccess("read", "", $a_target))
1318  {
1319  $_GET["cmd"] = "listItems";
1320  $_GET["ref_id"] = $a_target;
1321  $_GET["baseClass"] = "ilmediacasthandlergui";
1322  $_GET["cmdClass"] = "ilobjmediacastgui";
1323  include("ilias.php");
1324  exit;
1325  }
1326  else if ($ilAccess->checkAccess("visible", "", $a_target))
1327  {
1328  ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
1329  }
1330  else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
1331  {
1332  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
1335  }
1336 
1337  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
1338 
1339  }
exit
Definition: login.php:54
$_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)
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 265 of file class.ilObjMediaCastGUI.php.

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

266  {
267  global $tpl;
268 
269  $this->checkPermission("write");
270 
271  $this->initAddCastItemForm();
272  $tpl->setContent($this->form_gui->getHTML());
273  }
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 1081 of file class.ilObjMediaCastGUI.php.

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

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

1082  {
1083  global $ilTabs, $ilAccess, $lng;
1084 
1085  $ilTabs->addSubTab("content",
1086  $lng->txt("view"),
1087  $this->ctrl->getLinkTarget($this, "showContent"));
1088 
1089  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
1090  {
1091  $ilTabs->addSubTab("manage",
1092  $lng->txt("mcst_manage"),
1093  $this->ctrl->getLinkTarget($this, "listItems"));
1094 
1095  if ($this->object->getOrder() == ilObjMediaCast::ORDER_MANUAL)
1096  {
1097  $ilTabs->addSubTab("sorting",
1098  $lng->txt("mcst_ordering"),
1099  $this->ctrl->getLinkTarget($this, "editOrder"));
1100  }
1101  }
1102 
1103  $ilTabs->activateSubTab($a_active);
1104  $ilTabs->activateTab("content");
1105  }
$_GET["client_id"]
+ Here is the caller graph for this function:

◆ addLocatorItems()

ilObjMediaCastGUI::addLocatorItems ( )

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

References $_GET.

1304  {
1305  global $ilLocator;
1306 
1307  if (is_object($this->object))
1308  {
1309  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "listItems"), "", $_GET["ref_id"]);
1310  }
1311  }
$_GET["client_id"]

◆ afterSave()

ilObjMediaCastGUI::afterSave (   $newObj)

save object public

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

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

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

◆ confirmDeletionItemsObject()

ilObjMediaCastGUI::confirmDeletionItemsObject ( )

Confirmation Screen.

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

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

863  {
864  global $ilCtrl, $lng, $tpl, $ilTabs;
865 
866  $this->checkPermission("write");
867  $ilTabs->activateTab("edit_content");
868 
869  if (!is_array($_POST["item_id"]))
870  {
871  $this->listItemsObject();
872  return;
873  }
874 
875  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
876  $c_gui = new ilConfirmationGUI();
877 
878  // set confirm/cancel commands
879  $c_gui->setFormAction($ilCtrl->getFormAction($this, "deleteItems"));
880  $c_gui->setHeaderText($lng->txt("info_delete_sure"));
881  $c_gui->setCancel($lng->txt("cancel"), "listItems");
882  $c_gui->setConfirm($lng->txt("confirm"), "deleteItems");
883 
884  // add items to delete
885  include_once("./Services/News/classes/class.ilNewsItem.php");
886  foreach($_POST["item_id"] as $item_id)
887  {
888  $item = new ilNewsItem($item_id);
889  $c_gui->addItem("item_id[]", $item_id, $item->getTitle(),
890  ilUtil::getImagePath("icon_mcst.png"));
891  }
892 
893  $tpl->setContent($c_gui->getHTML());
894  }
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
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.
Confirmation screen class.
+ Here is the call graph for this function:

◆ convertFileObject()

ilObjMediaCastGUI::convertFileObject ( )

Convert file object.

Parameters

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

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

1569  {
1570  global $ilCtrl;
1571 
1572  $this->checkPermission("write");
1573 
1574  $this->mcst_item = new ilNewsItem($_GET["item_id"]);
1575  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1576  $mob = new ilObjMediaObject($this->mcst_item->getMobId());
1577 
1578  $target_purpose = ilUtil::stripSlashes($_POST["target_purpose"]);
1579  $target_format = ilUtil::stripSlashes($_POST["target_format"]);
1580 
1581  try
1582  {
1583  include_once("./Services/MediaObjects/classes/class.ilFFmpeg.php");
1584  $med = $mob->getMediaItem("Standard");
1585  $mob_file = ilObjMediaObject::_getDirectory($mob->getId())."/".$med->getLocation();
1586  $new_file = ilFFmpeg::convert($mob_file, $target_format);
1588  $pi = pathinfo($new_file);
1589  $med = $mob->getMediaItem($target_purpose);
1590  if (!is_object($med))
1591  {
1592  $med = new ilMediaItem();
1593  $med->setMobId($mob->getId());
1594  $mob->addMediaItem($med);
1595  $mob->update();
1596  $med->setPurpose($target_purpose);
1597  }
1598  $med->setFormat($target_format);
1599  $med->setLocation($pi["basename"]);
1600  $med->setLocationType("LocalFile");
1601  $med->update();
1602 
1603  $add = (is_array($ret) && count($ret) > 0)
1604  ? "<br />".implode($ret, "<br />")
1605  : "";
1606 
1607  ilUtil::sendInfo($this->lng->txt("mcst_converted_file").$add, true);
1608  }
1609  catch (ilException $e)
1610  {
1612  $add = (is_array($ret) && count($ret) > 0)
1613  ? "<br />".implode($ret, "<br />")
1614  : "";
1615  ilUtil::sendFailure($e->getMessage().$add, true);
1616  }
1617 
1618 
1619  $ilCtrl->redirect($this, "editCastItem");
1620  }
Base class for ILIAS Exception handling.
$_POST['username']
Definition: cron.php:12
static convert($a_file, $a_target_mime, $a_target_dir="", $a_target_filename="")
Convert file to target mime type.
$_GET["client_id"]
getLastReturnValues()
Get last return values.
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Class ilMediaItem.
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.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
_getDirectory($a_mob_id)
get directory for files of media object (static)
+ 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 670 of file class.ilObjMediaCastGUI.php.

References updateMediaItem().

Referenced by saveCastItemObject(), and updateCastItemObject().

671  {
672  $mediaItem = new ilMediaItem();
673  $mob->addMediaItem($mediaItem);
674  $mediaItem->setPurpose($purpose);
675  return $this->updateMediaItem($mob, $mediaItem);
676  }
updateMediaItem($mob, & $mediaItem)
update media item from form
Class ilMediaItem.
+ 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 899 of file class.ilObjMediaCastGUI.php.

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

900  {
901  global $ilCtrl;
902 
903  $this->checkPermission("write");
904 
905  // delete all selected news items
906  foreach($_POST["item_id"] as $item_id)
907  {
908  $mc_item = new ilNewsItem($item_id);
909  $mc_item->delete();
910  }
911 
912  $ilCtrl->redirect($this, "listItems");
913  }
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
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:

◆ determinePlaytimeObject()

ilObjMediaCastGUI::determinePlaytimeObject ( )

Delete news items.

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

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

935  {
936  global $ilCtrl, $lng;
937 
938  $mc_item = new ilNewsItem($_GET["item_id"]);
939  $mob = $mc_item->getMobId();
940  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
941  $mob = new ilObjMediaObject($mob);
942  $mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
943  $m_item = $mob->getMediaItem("Standard");
944  $file = $mob_dir."/".$m_item->getLocation();
945  $duration = $this->getDuration($file);
946  if ($duration != "00:00:00")
947  {
948  $mc_item->setPlaytime($duration);
949  $mc_item->update();
950  ilUtil::sendSuccess($lng->txt("mcst_set_playtime"), true);
951  }
952  else
953  {
954  ilUtil::sendFailure($lng->txt("mcst_unable_to_determin_playtime"), true);
955  }
956 
957  $ilCtrl->redirect($this, "listItems");
958  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
print $file
getDuration($file)
get duration from form or from file analyzer
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
Class ilObjMediaObject.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
_getDirectory($a_mob_id)
get directory for files of media object (static)
+ Here is the call graph for this function:

◆ downloadItemObject()

ilObjMediaCastGUI::downloadItemObject ( )

Download news media item.

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

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

919  {
920  global $ilCtrl;
921  $this->checkPermission("read");
922 
923  $news_item = new ilNewsItem($_GET["item_id"]);
924  if (!$news_item->deliverMobFile($_GET["purpose"], (int) $_GET["presentation"]))
925  {
926  $ilCtrl->redirect($this, "listItems");
927  }
928  exit;
929  }
exit
Definition: login.php:54
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
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:

◆ editCastItemObject()

ilObjMediaCastGUI::editCastItemObject ( )

Edit media cast item.

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

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

279  {
280  global $tpl, $ilToolbar, $ilCtrl;
281 
282  $this->checkPermission("write");
283 
284  // conversion toolbar
285  include_once("./Services/MediaObjects/classes/class.ilFFmpeg.php");
286  if (ilFFmpeg::enabled())
287  {
288  $this->mcst_item = new ilNewsItem($_GET["item_id"]);
289  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
290  $mob = new ilObjMediaObject($this->mcst_item->getMobId());
291 
292  $conv_cnt = 0;
293  // we had other purposes as source as well, but
294  // currently only "Standard" is implemented in the convertFile method
295  foreach (array("Standard") as $p)
296  {
297  /*
298  $med = $mob->getMediaItem($p);
299  if (is_object($med))
300  {
301  $options = ilFFmpeg::getPossibleTargetMimeTypes($med->getFormat());
302  if (count($options) > 0)
303  {
304  if ($conv_cnt > 0)
305  {
306  $ilToolbar->addSeparator();
307  }
308 
309  include_once("./Services/Form/classes/class.ilSelectInputGUI.php");
310  $si = new ilSelectInputGUI($this->lng->txt("mcst_conv_".
311  strtolower($p)."_to"), "target_format");
312  $si->setOptions($options);
313  $ilToolbar->addInputItem($si, true);
314 
315  $si = new ilSelectInputGUI(", ".$this->lng->txt("mcst_target").": ",
316  "target_purpose");
317  $si->setOptions(array("Standard" => $this->lng->txt("mcst_purpose_standard"),
318  "VideoAlternative" => $this->lng->txt("mcst_purpose_videoalternative")
319  ));
320  $si->setValue($p);
321  $ilToolbar->addInputItem($si, true);
322 
323  $ilToolbar->addFormButton($this->lng->txt("mcst_convert"), "convertFile");
324 
325  $conv_cnt++;
326  }
327  }
328  */
329 
330  $med = $mob->getMediaItem($p);
331  if (is_object($med))
332  {
333  if (ilFFmpeg::supportsImageExtraction($med->getFormat()))
334  {
335  // second
336  include_once("./Services/Form/classes/class.ilTextInputGUI.php");
337  $ni = new ilTextInputGUI($this->lng->txt("mcst_second"), "sec");
338  $ni->setMaxLength(4);
339  $ni->setSize(4);
340  $ni->setValue(1);
341  $ilToolbar->addInputItem($ni, true);
342 
343  $ilToolbar->addFormButton($this->lng->txt("mcst_extract_preview_image"), "extractPreviewImage");
344  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
345  }
346  }
347 
348  /*if ($conv_cnt > 0)
349  {
350  $ilToolbar->setFormAction($ilCtrl->getFormAction($this));
351  }*/
352  }
353  }
354 
355  $this->initAddCastItemForm("edit");
356  $this->getCastItemValues();
357  $tpl->setContent($this->form_gui->getHTML());
358  }
& getMediaItem($a_purpose)
get item for media purpose
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
initAddCastItemForm($a_mode="create")
Init add cast item form.
getCastItemValues()
Get cast item values into form.
This class represents a text property in a property form.
Class ilObjMediaObject.
setMaxLength($a_maxlength)
Set Max Length.
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 1400 of file class.ilObjMediaCastGUI.php.

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

1401  {
1402  global $ilTabs, $lng, $tpl;
1403 
1404  $this->checkPermission("write");
1405  $ilTabs->activateTab("edit_content");
1406 
1407  $this->addContentSubTabs("sorting");
1408 
1409  // sort by order setting
1410  switch($this->object->getOrder())
1411  {
1415  return $this->listItemsObject();
1416 
1418  // sub-tabs
1419  break;
1420  }
1421 
1422  include_once("./Modules/MediaCast/classes/class.ilMediaCastTableGUI.php");
1423  $table_gui = new ilMediaCastTableGUI($this, "editOrder", true);
1424 
1425  $table_gui->setTitle($lng->txt("mcst_media_cast"));
1426  $table_gui->setData($this->object->getSortedItemsArray());
1427 
1428  $table_gui->addCommandButton("saveOrder", $lng->txt("mcst_save_order"));
1429 
1430  $tpl->setContent($table_gui->getHTML());
1431  }
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 1111 of file class.ilObjMediaCastGUI.php.

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

1112  {
1113  global $tpl, $ilTabs;
1114 
1115  $this->checkPermission("write");
1116  $ilTabs->activateTab("id_settings");
1117 
1118  $this->initSettingsForm();
1119  $tpl->setContent($this->form_gui->getHtml());
1120  }
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 58 of file class.ilObjMediaCastGUI.php.

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

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

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

1629  {
1630  global $ilCtrl;
1631 
1632  $this->checkPermission("write");
1633 
1634  $this->mcst_item = new ilNewsItem($_GET["item_id"]);
1635  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1636  $mob = new ilObjMediaObject($this->mcst_item->getMobId());
1637 
1638  try
1639  {
1640  $sec = (int) $_POST["sec"];
1641  if ($sec < 0)
1642  {
1643  $sec = 0;
1644  }
1645  if ($mob->getVideoPreviewPic() != "")
1646  {
1647  $mob->removeAdditionalFile($mob->getVideoPreviewPic(true));
1648  }
1649  include_once("./Services/MediaObjects/classes/class.ilFFmpeg.php");
1650  $med = $mob->getMediaItem("Standard");
1651  $mob_file = ilObjMediaObject::_getDirectory($mob->getId())."/".$med->getLocation();
1652  $new_file = ilFFmpeg::extractImage($mob_file, "mob_vpreview.png",
1653  ilObjMediaObject::_getDirectory($mob->getId()), $sec);
1654 
1655  if ($new_file != "")
1656  {
1657  ilUtil::sendInfo($this->lng->txt("mcst_image_extracted"), true);
1658  }
1659  else
1660  {
1661  ilUtil::sendFailure($this->lng->txt("mcst_no_extraction_possible"), true);
1662  }
1663  }
1664  catch (ilException $e)
1665  {
1666  if (DEVMODE == 1)
1667  {
1669  $add = (is_array($ret) && count($ret) > 0)
1670  ? "<br />".implode($ret, "<br />")
1671  : "";
1672  }
1673  ilUtil::sendFailure($e->getMessage().$add, true);
1674  }
1675 
1676 
1677  $ilCtrl->redirect($this, "editCastItem");
1678  }
Base class for ILIAS Exception handling.
$_POST['username']
Definition: cron.php:12
$_GET["client_id"]
getLastReturnValues()
Get last return values.
static extractImage($a_file, $a_target_filename, $a_target_dir="", $a_sec=1)
Extract image from video file.
global $ilCtrl
Definition: ilias.php:18
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
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.
_getDirectory($a_mob_id)
get directory for files of media object (static)
+ Here is the call graph for this function:

◆ getCastItemValues()

ilObjMediaCastGUI::getCastItemValues ( )

Get cast item values into form.

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

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

Referenced by editCastItemObject().

487  {
488  global $lng;
489 
490  // get mob
491  $this->mcst_item = new ilNewsItem($_GET["item_id"]);
492  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
493  $mob = new ilObjMediaObject($this->mcst_item->getMobId());
494 
495  // preview
496  $ppic = $mob->getVideoPreviewPic();
497  if ($ppic != "")
498  {
499  $i = $this->form_gui->getItemByPostVar("preview_pic");
500  $i->setImage($ppic);
501  }
502 
503 
504  $values = array();
505  $mediaItems = $this->getMediaItems($_GET["item_id"]);
506  if (count ($mediaItems) > 0)
507  {
508  foreach ($mediaItems as $med)
509  {
510  if (!isset ($values["title"]))
511  {
512  // first item, so set title, description, ...
513  $values["title"] = $this->mcst_item->getTitle();
514  $values["description"] = $this->mcst_item->getContent();
515  $values["visibility"] = $this->mcst_item->getVisibility();
516  $length = explode(":", $this->mcst_item->getPlaytime());
517  $values["duration"] = array("hh" => $length[0], "mm" => $length[1], "ss" => $length[2]);
518  }
519 
520  $values["value_".$med->getPurpose()] = (strlen($med->getLocation())> 100) ? "...".substr($med->getLocation(), strlen($med->getLocation()) - 100) : $med->getLocation();
521  $values["label_value_".$med->getPurpose()] = (strlen($med->getLocation())> 100) ? "...".substr($med->getLocation(), strlen($med->getLocation()) - 100) : $med->getLocation();
522  $values["mimetype_".$med->getPurpose()] = $med->getFormat();
523  }
524  }
525  foreach (ilObjMediaCast::$purposes as $purpose) {
526  if (!isset ($values["value_".$purpose]))
527  {
528  $values["label_value_".$purpose] = $lng->txt("none");
529  $values["value_".$purpose] = $lng->txt("none");
530  }
531  }
532  $this->form_gui->setValuesByArray($values);
533  }
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
+ 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 642 of file class.ilObjMediaCastGUI.php.

References $file.

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

643  {
644  $duration = isset($this->form_gui)
645  ? $this->form_gui->getInput("duration")
646  : array("hh"=>0, "mm"=>0, "ss"=>0);
647  if ($duration["hh"] == 0 && $duration["mm"] == 0 && $duration["ss"] == 0 && is_file($file))
648  {
649  include_once("./Services/MediaObjects/classes/class.ilMediaAnalyzer.php");
650  $ana = new ilMediaAnalyzer();
651  $ana->setFile($file);
652  $ana->analyzeFile();
653  $dur = $ana->getPlaytimeString();
654  $dur = explode(":", $dur);
655  $duration["mm"] = $dur[0];
656  $duration["ss"] = $dur[1];
657  }
658  $duration = str_pad($duration["hh"], 2 , "0", STR_PAD_LEFT).":".
659  str_pad($duration["mm"], 2 , "0", STR_PAD_LEFT).":".
660  str_pad($duration["ss"], 2 , "0", STR_PAD_LEFT);
661  return $duration;
662  }
print $file
Analyzes media files.
+ Here is the caller graph for this function:

◆ getFeedIconsHTML()

ilObjMediaCastGUI::getFeedIconsHTML ( )

Get feed icons HTML.

Parameters

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

References ilObjectGUI\$lng, ilObjMediaCast\$purposes, ilBlockSetting\_lookup(), and ilUtil\getImagePath().

Referenced by listItemsObject(), and showGallery().

197  {
198  global $lng;
199 
200  $html = "";
201 
202  include_once("./Services/Block/classes/class.ilBlockSetting.php");
203  $public_feed = ilBlockSetting::_lookup("news", "public_feed",
204  0, $this->object->getId());
205 
206  // rss icon/link
207  if ($public_feed)
208  {
209  $news_set = new ilSetting("news");
210  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
211 
212  if ($enable_internal_rss)
213  {
214  // create dummy object in db (we need an id)
215  $items = $this->object->getItemsArray();
216  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
217  $html = "";
218  foreach (ilObjMediaCast::$purposes as $purpose)
219  {
220  foreach ($items as $id => $item)
221  {
222  $mob = new ilObjMediaObject($item["mob_id"]);
223  $mob->read();
224  if ($mob->hasPurposeItem($purpose))
225  {
226  if ($html == "")
227  {
228  $html = " ";
229  }
230  $url = ILIAS_HTTP_PATH."/feed.php?client_id=".rawurlencode(CLIENT_ID)."&"."ref_id=".$_GET["ref_id"]."&purpose=$purpose";
231  $title = $lng->txt("news_feed_url");
232  $icon = ilUtil::getImagePath("rss_icon_".strtolower($purpose).".png");
233  $target = "_blank";
234 
235  $row1 .= "<A href='$url' target='$target'><img src='$icon' alt='$title'/></A>";
236  if ($this->object->getPublicFiles())
237  {
238  $url = preg_replace("/https?/i","itpc",$url);
239  $title = $lng->txt("news_feed_url");
240  $icon = ilUtil::getImagePath("itunes_icon.png");
241  $row2 .= "<A href='$url' target='$target'><img src='$icon' alt='$title'/></A>";
242  }
243  break;
244  }
245 
246  }
247  }
248  if ($html != "")
249  {
250  $html .= $row1;
251  if ($row2 != "")
252  {
253  $html .= "&nbsp;&nbsp;".$row2;
254  }
255  }
256  }
257  }
258  return $html;
259  }
ILIAS Setting Class.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookup($a_type, $a_setting, $a_user=0, $a_block_id=0)
Lookup setting from database.
Class ilObjMediaObject.
+ 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 1357 of file class.ilObjMediaCastGUI.php.

References ilObjMediaObject\getMediaItem().

1357  {
1358  include_once("./Services/News/classes/class.ilNewsItem.php");
1359  $this->mcst_item = new ilNewsItem($id);
1360  // create dummy object in db (we need an id)
1361  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1362  $mob = new ilObjMediaObject($this->mcst_item->getMobId());
1363  return $mob->getMediaItem("Standard");
1364  }
& 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 1372 of file class.ilObjMediaCastGUI.php.

References ilObjMediaObject\getMediaItems().

Referenced by getCastItemValues().

1372  {
1373  include_once("./Services/News/classes/class.ilNewsItem.php");
1374  $this->mcst_item = new ilNewsItem($id);
1375  // create dummy object in db (we need an id)
1376  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1377  $mob = new ilObjMediaObject($this->mcst_item->getMobId());
1378  return $mob->getMediaItems();
1379  }
Class ilObjMediaObject.
& getMediaItems()
get all media items
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handlePlayerEventObject()

ilObjMediaCastGUI::handlePlayerEventObject ( )

Handle player event.

Parameters

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

References $_GET, and exit.

1687  {
1688  if ($_GET["event"] == "play")
1689  {
1690  $player = explode("_", $_GET["player"]);
1691  $news_id = (int) $player[1];
1692  include_once("./Services/News/classes/class.ilNewsItem.php");
1693  $item = new ilNewsItem($news_id);
1694  $item->increasePlayCounter();
1695  }
1696  exit;
1697  }
exit
Definition: login.php:54
$_GET["client_id"]

◆ ilObjMediaCastGUI()

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

Constructor public.

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

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

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

◆ infoScreen()

ilObjMediaCastGUI::infoScreen ( )

show information screen

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

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

Referenced by executeCommand(), and infoScreenObject().

977  {
978  global $ilAccess, $ilUser, $ilTabs;
979 
980  $ilTabs->activateTab("id_info");
981 
982  if (!$ilAccess->checkAccess("visible", "", $this->object->getRefId()))
983  {
984  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
985  }
986 
987  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
988  $info = new ilInfoScreenGUI($this);
989 
990  $info->enablePrivateNotes();
991 
992  /*
993  $info->enableNews();
994  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
995  {
996  //$info->enableNewsEditing();
997  $info->setBlockProperty("news", "settings", true);
998  }*/
999 
1000  // general information
1001  $this->lng->loadLanguageModule("meta");
1002  $this->lng->loadLanguageModule("mcst");
1003  $med_items = $this->object->getItemsArray();
1004  $info->addSection($this->lng->txt("meta_general"));
1005  $info->addProperty($this->lng->txt("mcst_nr_items"),
1006  (int) count($med_items));
1007 
1008  if (count($med_items) > 0)
1009  {
1010  $cur = current($med_items);
1011  $last = ilDatePresentation::formatDate(new ilDateTime($cur["creation_date"], IL_CAL_DATETIME));
1012  }
1013  else
1014  {
1015  $last = "-";
1016  }
1017 
1018  $info->addProperty($this->lng->txt("mcst_last_submission"), $last);
1019 
1020  // forward the command
1021  $this->ctrl->forwardCommand($info);
1022  }
Class ilInfoScreenGUI.
const IL_CAL_DATETIME
static formatDate(ilDateTime $date)
Format a date public.
Date and time handling
redirection script todo: (a better solution should control the processing via a xml file) ...
global $ilUser
Definition: imgupload.php:15
+ 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 965 of file class.ilObjMediaCastGUI.php.

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

966  {
967  $this->checkPermission("visible");
968  $this->ctrl->setCmd("showSummary");
969  $this->ctrl->setCmdClass("ilinfoscreengui");
970  $this->infoScreen();
971  }
infoScreen()
show information screen
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:

◆ initAddCastItemForm()

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

Init add cast item form.

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

References $file, $ilCtrl, ilObjectGUI\$lng, $options, ilObjMediaCast\$purposes, $section, ilObjectGUI\checkPermission(), ilRadioOption\setInfo(), ilFormPropertyGUI\setInfo(), ilTextInputGUI\setMaxLength(), ilRegExpInputGUI\setPattern(), ilFormPropertyGUI\setPostVar(), ilFormPropertyGUI\setRequired(), and ilFileInputGUI\setSuffixes().

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

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

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

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

◆ initSettingsForm()

ilObjMediaCastGUI::initSettingsForm ( )

Init Settings Form.

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

References $ilCtrl, ilObjectGUI\$lng, $options, $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(), ilTextInputGUI\setValue(), ilTextAreaInputGUI\setValue(), ilObjMediaCast\VIEW_GALLERY, and ilObjMediaCast\VIEW_LIST.

Referenced by editSettingsObject(), and saveSettingsObject().

1126  {
1127  global $tpl, $lng, $ilCtrl;
1128 
1129  $lng->loadLanguageModule("mcst");
1130 
1131  include("Services/Form/classes/class.ilPropertyFormGUI.php");
1132  $this->form_gui = new ilPropertyFormGUI();
1133  $this->form_gui->setTitle($lng->txt("mcst_settings"));
1134 
1135  // Title
1136  $tit = new ilTextInputGUI($lng->txt("title"), "title");
1137  $tit->setValue($this->object->getTitle());
1138  $tit->setRequired(true);
1139  $this->form_gui->addItem($tit);
1140 
1141  // description
1142  $des = new ilTextAreaInputGUI($lng->txt("description"), "description");
1143  $des->setValue($this->object->getLongDescription());
1144  $this->form_gui->addItem($des);
1145 
1146  $sh = new ilFormSectionHeaderGUI();
1147  $sh->setTitle($lng->txt("rep_activation_availability"));
1148  $this->form_gui->addItem($sh);
1149 
1150  // Online
1151  $online = new ilCheckboxInputGUI($lng->txt("online"), "online");
1152  $online->setChecked($this->object->getOnline());
1153  $this->form_gui->addItem($online);
1154 
1155  // presentation
1156  $sh = new ilFormSectionHeaderGUI();
1157  $sh->setTitle($lng->txt("obj_presentation"));
1158  $this->form_gui->addItem($sh);
1159 
1160  // Sorting
1161  $sort = new ilRadioGroupInputGUI($lng->txt("mcst_ordering"), "order");
1162  $sort->addOption(new ilRadioOption($lng->txt("mcst_ordering_title"),
1164  $sort->addOption(new ilRadioOption($lng->txt("mcst_ordering_creation_date_asc"),
1166  $sort->addOption(new ilRadioOption($lng->txt("mcst_ordering_creation_date_desc"),
1168  $sort->addOption(new ilRadioOption($lng->txt("mcst_ordering_manual"),
1170  $sort->setValue($this->object->getOrder());
1171  $this->form_gui->addItem($sort);
1172 
1173  // view mode
1174  $options = array(
1175  ilObjMediaCast::VIEW_LIST => $lng->txt("mcst_list"),
1176  ilObjMediaCast::VIEW_GALLERY => $lng->txt("mcst_gallery")
1177  );
1178  $si = new ilRadioGroupInputGUI($this->lng->txt("mcst_viewmode"), "viewmode");
1179  $si->addOption(new ilRadioOption($lng->txt("mcst_list"),
1181  $si->addOption(new ilRadioOption($lng->txt("mcst_gallery"),
1183 
1184 // $si->setOptions($options);
1185  $si->setValue($this->object->getViewMode());
1186  $this->form_gui->addItem($si);
1187 
1188 
1189  // Downloadable
1190  $downloadable = new ilCheckboxInputGUI($lng->txt("mcst_downloadable"), "downloadable");
1191  $downloadable->setChecked($this->object->getDownloadable());
1192  $downloadable->setInfo($lng->txt("mcst_downloadable_info"));
1193  $this->form_gui->addItem($downloadable);
1194 
1195  $news_set = new ilSetting("news");
1196  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1197 
1198  //Default Visibility
1199  if ($enable_internal_rss)
1200  {
1201  // webfeed
1202  $sh = new ilFormSectionHeaderGUI();
1203  $sh->setTitle($lng->txt("mcst_webfeed"));
1204  $this->form_gui->addItem($sh);
1205 
1206  $radio_group = new ilRadioGroupInputGUI($lng->txt("news_default_visibility"), "defaultaccess");
1207  $radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "0");
1208  $radio_option->setInfo($lng->txt("news_news_item_def_visibility_users_info"));
1209  $radio_group->addOption($radio_option);
1210  $radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "1");
1211  $radio_option->setInfo($lng->txt("news_news_item_def_visibility_public_info"));
1212  $radio_group->addOption($radio_option);
1213  $radio_group->setRequired(false);
1214  $radio_group->setValue($this->object->getDefaultAccess());
1215  #$ch->addSubItem($radio_group);
1216  $this->form_gui->addItem($radio_group);
1217 
1218  //Extra Feed
1219  include_once("./Services/Block/classes/class.ilBlockSetting.php");
1220  $public_feed = ilBlockSetting::_lookup("news", "public_feed", 0, $this->object->getId());
1221  $ch = new ilCheckboxInputGUI($lng->txt("news_public_feed"), "extra_feed");
1222  $ch->setInfo($lng->txt("news_public_feed_info"));
1223  $ch->setChecked($public_feed);
1224  $this->form_gui->addItem($ch);
1225 
1226  // keep minimal x number of items
1227  $ni = new ilNumberInputGUI($this->lng->txt("news_keep_minimal_x_items"), "keep_rss_min");
1228  $ni->setMaxValue(100);
1229  $ni->setMinValue(0);
1230  $ni->setMaxLength(3);
1231  $ni->setSize(3);
1232  $ni->setInfo($this->lng->txt("news_keep_minimal_x_items_info")." (".
1233  ilNewsItem::_lookupRSSPeriod()." ".(ilNewsItem::_lookupRSSPeriod() == 1 ? $lng->txt("day") : $lng->txt("days")).")");
1234  $ni->setValue((int) ilBlockSetting::_lookup("news", "keep_rss_min", 0, $this->object->getId()));
1235  $ch->addSubItem($ni);
1236 
1237  // Include Files in Pubic Items
1238  $incl_files = new ilCheckboxInputGUI($lng->txt("mcst_incl_files_in_rss"), "public_files");
1239  $incl_files->setChecked($this->object->getPublicFiles());
1240  $incl_files->setInfo($lng->txt("mcst_incl_files_in_rss_info"));
1241  #$ch->addSubItem($incl_files);
1242  $this->form_gui->addItem($incl_files);
1243  }
1244 
1245  // Form action and save button
1246  $this->form_gui->addCommandButton("saveSettings", $lng->txt("save"));
1247  $this->form_gui->setFormAction($ilCtrl->getFormAction($this, "saveSettings"));
1248  }
This class represents an option in a radio group.
ILIAS Setting Class.
This class represents a property form user interface.
This class represents a section header in a property form.
setMaxValue($a_maxvalue)
Set Maximum Value.
setValue($a_value)
Set Value.
This class represents a checkbox property in a property form.
global $ilCtrl
Definition: ilias.php:18
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.
if(!is_array($argv)) $options
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.
This class represents a text property in a property form.
This class represents a text area property in a property form.
setValue($a_value)
Set Value.
+ 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 1347 of file class.ilObjMediaCastGUI.php.

1347  {
1348  return strpos($extension,"audio") !== false;
1349  }

◆ listItemsObject()

ilObjMediaCastGUI::listItemsObject (   $a_presentation_mode = false)

List items of media cast.

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

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

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

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

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

Referenced by saveCastItemObject(), and updateCastItemObject().

1382  {
1383  global $tpl;
1384  //issue: we have to display the current settings
1385  // problem: POST does not contain values of disabled textfields
1386  // solution: use hidden field and label to display-> here we need to synchronize the labels
1387  // with the values from the hidden fields.
1388  foreach (ilObjMediaCast::$purposes as $purpose)
1389  {
1390  if ($_POST["value_".$purpose])
1391  {
1392  $_POST["label_value_".$purpose] = $_POST["value_".$purpose];
1393  }
1394  }
1395 
1396  $this->form_gui->setValuesByPost();
1397  $tpl->setContent($this->form_gui->getHTML());
1398  }
$_POST['username']
Definition: cron.php:12
+ Here is the caller graph for this function:

◆ saveCastItemObject()

ilObjMediaCastGUI::saveCastItemObject ( )

Save new cast item.

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

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

539  {
540  global $tpl, $ilCtrl, $ilUser, $lng, $ilTabs;
541 
542  $this->checkPermission("write");
543  $ilTabs->activateTab("edit_content");
544 
545  $this->initAddCastItemForm();
546 
547  if ($_POST["url_Standard"] == "" && !$_FILES['file_Standard']['tmp_name']) {
548  ilUtil::sendFailure($lng->txt("msg_input_either_file_or_url"));
549  $this->populateFormFromPost();
550  }
551  else if ($this->form_gui->checkInput())
552  {
553  // create dummy object in db (we need an id)
554  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
555  $mob = new ilObjMediaObject();
556  $mob->create();
557 
558  //handle standard purpose
559  $file = $this->createMediaItemForPurpose($mob, "Standard");
560 
561  // set title and description
562  // set title to basename of file if left empty
563  $title = $this->form_gui->getInput("title") != "" ? $this->form_gui->getInput("title") : basename($file);
564  $description = $this->form_gui->getInput("description");
565  $mob->setTitle($title);
566  $mob->setDescription($description);
567 
568  // save preview pic
569  $prevpic = $this->form_gui->getInput("preview_pic");
570  if ($prevpic["size"] > 0)
571  {
572  $mob->uploadVideoPreviewPic($prevpic);
573  }
574 
575  // determine duration for standard purpose
576  $duration = $this->getDuration($file);
577 
578  // handle other purposes
579  foreach ($this->additionalPurposes as $purpose)
580  {
581  // check if some purpose has been uploaded
582  $file_gui = $this->form_gui->getInput("file_".$purpose);
583  $url_gui = $this->form_gui->getInput("url_".$purpose);
584  if ($url_gui || $file_gui["size"] > 0)
585  {
586  $this->createMediaItemForPurpose ($mob, $purpose);
587  }
588  }
589 
590  $mob->update();
591 
592  if ($prevpic["size"] == 0)
593  {
594  // re-read media object
595  $mob = new ilObjMediaObject($mob->getId());
596  $mob->generatePreviewPic(320, 240);
597  }
598 
599  //
600  // @todo: save usage
601  //
602 
603  $news_set = new ilSetting("news");
604  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
605 
606  // create new media cast item
607  include_once("./Services/News/classes/class.ilNewsItem.php");
608  $mc_item = new ilNewsItem();
609  $mc_item->setMobId($mob->getId());
610  $mc_item->setContentType(NEWS_AUDIO);
611  $mc_item->setContextObjId($this->object->getId());
612  $mc_item->setContextObjType($this->object->getType());
613  $mc_item->setUserId($ilUser->getId());
614  $mc_item->setPlaytime($duration);
615  $mc_item->setTitle($title);
616  $mc_item->setContent($description);
617  $mc_item->setLimitation(false);
618  if ($enable_internal_rss)
619  {
620  $mc_item->setVisibility($this->form_gui->getInput("visibility"));
621  }
622  else
623  {
624  $mc_item->setVisibility("users");
625  }
626  $mc_item->create();
627 
628  $ilCtrl->redirect($this, "listItems");
629  }
630  else
631  {
632  $this->populateFormFromPost();
633  }
634  }
ILIAS Setting Class.
print $file
$_POST['username']
Definition: cron.php:12
getDuration($file)
get duration from form or from file analyzer
global $ilCtrl
Definition: ilias.php:18
initAddCastItemForm($a_mode="create")
Init add cast item form.
createMediaItemForPurpose($mob, $purpose)
handle media item for given purpose
Class ilObjMediaObject.
generatePreviewPic($a_width, $a_height)
Upload video preview picture.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilUser
Definition: imgupload.php:15
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
const NEWS_AUDIO
+ Here is the call graph for this function:

◆ saveOrderObject()

ilObjMediaCastGUI::saveOrderObject ( )

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

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

1434  {
1435  global $lng;
1436 
1437  asort($_POST["item_id"]);
1438 
1439  $items = array();
1440  foreach(array_keys($_POST["item_id"]) as $id)
1441  {
1442  $items[] = $id;
1443  }
1444  $this->object->saveOrder($items);
1445 
1446  ilUtil::sendSuccess($lng->txt("settings_saved"), true);
1447  $this->ctrl->redirect($this, "editOrder");
1448  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
+ Here is the call graph for this function:

◆ saveSettingsObject()

ilObjMediaCastGUI::saveSettingsObject ( )

Save Settings.

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

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

1254  {
1255  global $ilCtrl, $ilTabs;
1256 
1257  $this->checkPermission("write");
1258  $ilTabs->activateTab("id_settings");
1259 
1260  $this->initSettingsForm();
1261  if ($this->form_gui->checkInput())
1262  {
1263  $news_set = new ilSetting("news");
1264  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
1265 
1266  $this->object->setTitle($this->form_gui->getInput("title"));
1267  $this->object->setDescription($this->form_gui->getInput("description"));
1268  $this->object->setOnline($this->form_gui->getInput("online"));
1269  $this->object->setDownloadable($this->form_gui->getInput("downloadable"));
1270  $this->object->setOrder($this->form_gui->getInput("order"));
1271  $this->object->setViewMode($this->form_gui->getInput("viewmode"));
1272 
1273  if ($enable_internal_rss)
1274  {
1275  $this->object->setPublicFiles($this->form_gui->getInput("public_files"));
1276  $this->object->setDefaultAccess($this->form_gui->getInput("defaultaccess"));
1277  }
1278  $this->object->update();
1279 
1280  if ($enable_internal_rss)
1281  {
1282  include_once("./Services/Block/classes/class.ilBlockSetting.php");
1283  ilBlockSetting::_write("news", "public_feed",
1284  $this->form_gui->getInput("extra_feed"),
1285  0, $this->object->getId());
1286 
1287  ilBlockSetting::_write("news", "keep_rss_min",
1288  $this->form_gui->getInput("keep_rss_min"),
1289  0, $this->object->getId());
1290  }
1291 
1292  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
1293  $ilCtrl->redirect($this, "editSettings");
1294  }
1295  else
1296  {
1297  $this->form_gui->setValuesByPost();
1298  $this->tpl->setContent($this->form_gui->getHTML());
1299  }
1300  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
ILIAS Setting Class.
static _write($a_type, $a_setting, $a_value, $a_user=0, $a_block_id=0)
Write setting to database.
initSettingsForm()
Init Settings Form.
global $ilCtrl
Definition: ilias.php:18
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 1028 of file class.ilObjMediaCastGUI.php.

References ilObjectGUI\$lng.

1029  {
1030  global $ilAccess, $ilTabs, $lng, $ilHelp;
1031 
1032  $ilHelp->setScreenIdComponent("mcst");
1033 
1034  // list items
1035  if ($ilAccess->checkAccess('read', "", $this->object->getRefId()))
1036  {
1037  $ilTabs->addTab("content",
1038  $lng->txt("content"),
1039  $this->ctrl->getLinkTarget($this, "showContent"));
1040  }
1041 
1042  // info screen
1043  if ($ilAccess->checkAccess('visible', "", $this->object->getRefId()))
1044  {
1045  $ilTabs->addTab("id_info",
1046  $lng->txt("info_short"),
1047  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"));
1048  }
1049 
1050  // settings
1051  if ($ilAccess->checkAccess('write', "", $this->object->getRefId()))
1052  {
1053  $ilTabs->addTab("id_settings",
1054  $lng->txt("settings"),
1055  $this->ctrl->getLinkTarget($this, "editSettings"));
1056  }
1057 
1058  // export
1059  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
1060  {
1061  $ilTabs->addTab("export",
1062  $lng->txt("export"),
1063  $this->ctrl->getLinkTargetByClass("ilexportgui", ""));
1064  }
1065 
1066  // edit permissions
1067  if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId()))
1068  {
1069  $ilTabs->addTab("id_permissions",
1070  $lng->txt("perm_settings"),
1071  $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"));
1072  }
1073  }

◆ showContentObject()

ilObjMediaCastGUI::showContentObject ( )

Show content.

Parameters

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

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

1461  {
1462  if ($this->object->getViewMode() == ilObjMediaCast::VIEW_GALLERY)
1463  {
1464  $this->showGallery();
1465  }
1466  else
1467  {
1468  $this->listItemsObject(true);
1469  }
1470  }
listItemsObject($a_presentation_mode=false)
List items of media cast.
+ Here is the call graph for this function:

◆ showGallery()

ilObjMediaCastGUI::showGallery ( )

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

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

Referenced by showContentObject().

1473  {
1474  global $tpl, $ilTabs, $ilCtrl;
1475 
1476  $tpl->addJavascript("./Modules/MediaCast/js/MediaCast.js");
1477 
1478  $ilTabs->activateTab("content");
1479 
1480  $this->addContentSubTabs("content");
1481 
1482  $ctpl = new ilTemplate("tpl.mcst_content.html", true, true, "Modules/MediaCast");
1483 
1484  include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1485  foreach ($this->object->getSortedItemsArray() as $item)
1486  {
1487  $mob = new ilObjMediaObject($item["mob_id"]);
1488  $med = $mob->getMediaItem("Standard");
1489 
1490  $ctpl->setCurrentBlock("item");
1491  $ctpl->setVariable("TITLE", $item["title"]);
1492  $ctpl->setVariable("TIME", $item["playtime"]);
1493  $ctpl->setVariable("ID", $item["id"]);
1494 
1495  if ($mob->getVideoPreviewPic() != "")
1496  {
1497  $ctpl->setVariable("PREVIEW_PIC",
1498  ilUtil::img($mob->getVideoPreviewPic(), $item["title"], 320, 240));
1499  }
1500  else
1501  {
1502  $ctpl->setVariable("PREVIEW_PIC",
1503  ilUtil::img(ilUtil::getImagePath("mcst_preview.png"), $item["title"], 320, 240));
1504  }
1505 
1506  // player
1507  if (is_object($med))
1508  {
1509  include_once("./Services/MediaObjects/classes/class.ilMediaPlayerGUI.php");
1510 
1511  // the news id will be used as player id, see also ilMediaCastTableGUI
1512  $mpl = new ilMediaPlayerGUI($item["id"],
1513  $ilCtrl->getLinkTarget($this, "handlePlayerEvent", "", true, false));
1514 
1515  if (strcasecmp("Reference", $med->getLocationType()) == 0)
1516  {
1517  $mpl->setFile($med->getLocation());
1518  }
1519  else
1520  {
1521  $mpl->setFile(ilObjMediaObject::_getURL($mob->getId())."/".$med->getLocation());
1522  }
1523  $mpl->setMimeType ($med->getFormat());
1524  //$mpl->setDisplayHeight($med->getHeight());
1525  $mpl->setDisplayHeight("480");
1526  $mpl->setDisplayWidth("640");
1527  $mpl->setVideoPreviewPic($mob->getVideoPreviewPic());
1528  $mpl->setTitle($item["title"]);
1529  $mpl->setDescription($item["content"]);
1530  $mpl->setForceAudioPreview(true);
1531  if ($this->object->getDownloadable())
1532  {
1533  $ilCtrl->setParameterByClass("ilobjmediacastgui", "item_id", $item["id"]);
1534  $ilCtrl->setParameterByClass("ilobjmediacastgui", "purpose", "Standard");
1535  $mpl->setDownloadLink($ilCtrl->getLinkTargetByClass("ilobjmediacastgui", "downloadItem"));
1536  }
1537  $med_alt = $mob->getMediaItem("VideoAlternative");
1538  if (is_object($med_alt))
1539  {
1540  $mpl->setAlternativeVideoFile(ilObjMediaObject::_getURL($mob->getId())."/".
1541  $med_alt->getLocation());
1542  $mpl->setAlternativeVideoMimeType($med_alt->getFormat());
1543  }
1544 
1545  $ctpl->setVariable("PLAYER", $mpl->getPreviewHtml());
1546  }
1547 
1548 
1549  $ctpl->parseCurrentBlock();
1550  }
1551 
1552  $feed_icon_html = $this->getFeedIconsHTML();
1553 
1554  if ($feed_icon_html != "")
1555  {
1556  $feed_icon_html = '<p>'.$feed_icon_html.'</p>';
1557  }
1558 
1559  $tpl->setContent($feed_icon_html.$ctpl->get());
1560  }
static img($a_src, $a_alt="", $a_width="", $a_height="", $a_border=0, $a_id="")
Build img tag.
setFile($a_file)
Set File.
global $ilCtrl
Definition: ilias.php:18
_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)
special template class to simplify handling of ITX/PEAR
addContentSubTabs($a_active="content")
Add content subtabs.
Class ilObjMediaObject.
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 757 of file class.ilObjMediaCastGUI.php.

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

758  {
759  global $tpl, $lng, $ilCtrl, $ilUser, $log;
760 
761  $this->checkPermission("write");
762 
763  $this->initAddCastItemForm("edit");
764 
765  if ($this->form_gui->checkInput())
766  {
767  // create new media cast item
768  include_once("./Services/News/classes/class.ilNewsItem.php");
769  $mc_item = new ilNewsItem($_GET["item_id"]);
770  $mob_id = $mc_item->getMobId();
771 
772  // create dummy object in db (we need an id)
773  include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
774  $mob = new ilObjMediaObject($mob_id);
775 
776 
777  foreach (ilObjMediaCast::$purposes as $purpose)
778  {
779  if ($this->form_gui->getInput("delete_".$purpose))
780  {
781  $mob->removeMediaItem($purpose);
782  $log->write ("Mcst: deleting purpose $purpose");
783  continue;
784  }
785  $media_item = $mob->getMediaItem($purpose);
786  $url_gui = $this->form_gui->getInput("url_".$purpose);
787  $file_gui = $this->form_gui->getInput("file_".$purpose);
788 
789  if ($media_item == null)
790  {
791  if ($purpose != "Standard" &&
792  ($url_gui || $file_gui["size"]>0))
793  {
794  // check if we added an additional purpose when updating
795  // either by url or by file
796  $file = $this->createMediaItemForPurpose($mob, $purpose);
797  }
798  } else
799  {
800  $file = $this->updateMediaItem($mob, $media_item);
801  }
802 
803  if ($purpose == "Standard")
804  {
805  $duration = $this->getDuration($file);
806  $title = $this->form_gui->getInput("title") != "" ? $this->form_gui->getInput("title") : basename($file);
807  $description = $this->form_gui->getInput("description");
808 
809  $mob->setTitle($title);
810  $mob->setDescription($description);
811 
812  $prevpic = $this->form_gui->getInput("preview_pic");
813  if ($prevpic["size"] > 0)
814  {
815  $mob->uploadVideoPreviewPic($prevpic);
816  }
817  else
818  {
819  $prevpici = $this->form_gui->getItemByPostVar("preview_pic");
820  if ($prevpici->getDeletionFlag())
821  {
822  $mob->removeAdditionalFile($mob->getVideoPreviewPic(true));
823  }
824  }
825  }
826  }
827 
828  // set real meta and object data
829  $mob->update();
830 
831  //
832  // @todo: save usage
833  //
834 
835  $news_set = new ilSetting("news");
836  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
837 
838  $mc_item->setUserId($ilUser->getId());
839  if (isset($duration))
840  {
841  $mc_item->setPlaytime($duration);
842  }
843  $mc_item->setTitle($title);
844  $mc_item->setContent($description);
845  if ($enable_internal_rss)
846  {
847  $mc_item->setVisibility($this->form_gui->getInput("visibility"));
848  }
849  $mc_item->update();
850 
851  $ilCtrl->redirect($this, "listItems");
852  }
853  else
854  {
855  $this->populateFormFromPost();
856  }
857  }
ILIAS Setting Class.
print $file
getDuration($file)
get duration from form or from file analyzer
$_GET["client_id"]
updateMediaItem($mob, & $mediaItem)
update media item from form
global $ilCtrl
Definition: ilias.php:18
initAddCastItemForm($a_mode="create")
Init add cast item form.
createMediaItemForPurpose($mob, $purpose)
handle media item for given purpose
Class ilObjMediaObject.
global $ilUser
Definition: imgupload.php:15
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:

◆ updateMediaItem()

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

update media item from form

Parameters
IlObjectMediaObject$mob
IlMediaItem$mediaItem
Returns
string file

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

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

Referenced by createMediaItemForPurpose(), and updateCastItemObject().

686  {
687  $purpose = $mediaItem->getPurpose();
688  $url_gui = $this->form_gui->getInput ("url_".$purpose);
689  $file_gui = $this->form_gui->getInput ("file_".$purpose);
690  if ($url_gui)
691  {
692  // http
693  $file = $this->form_gui->getInput ("url_".$purpose);
694  $title = basename ($file);
695  $location = $this->form_gui->getInput ("url_".$purpose);
696  $locationType = "Reference";
697  } elseif ($file_gui["size"] > 0){
698  // lokal
699  // determine and create mob directory, move uploaded file to directory
700  $mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
701  if (!is_dir($mob_dir))
702  $mob->createDirectory();
703 
704  $file_name = ilUtil::getASCIIFilename($_FILES['file_'.$purpose]['name']);
705  $file_name = str_replace(" ", "_", $file_name);
706 
707  $file = $mob_dir."/".$file_name;
708  $title = $file_name;
709  $locationType = "LocalFile";
710  $location = $title;
711  ilUtil::moveUploadedFile($_FILES['file_'.$purpose]['tmp_name'], $file_name, $file);
712  ilUtil::renameExecutables($mob_dir);
713 
714  }
715 
716  // check if not automatic mimetype detection
717  if ($_POST["mimetype_".$purpose] != "")
718  {
719  $mediaItem->setFormat($_POST["mimetype_".$purpose]);
720  }
721  elseif ($mediaItem->getLocation () != "")
722  {
723  $format = ilObjMediaObject::getMimeType($mediaItem->getLocation());
724  $mediaItem->setFormat($format);
725  }
726 
727  if (isset($file))
728  {
729  // get mime type, if not already set!
730  if (!isset($format))
731  {
733  }
734 
735  // set real meta and object data
736  $mediaItem->setFormat($format);
737  $mediaItem->setLocation($location);
738  $mediaItem->setLocationType($locationType);
739  $mediaItem->setHAlign("Left");
740  $mediaItem->setHeight(self::isAudio($format)?0:180);
741  }
742 
743  if ($purpose == "Standard")
744  {
745  if (isset($title))
746  $mob->setTitle ($title);
747  if (isset($format))
748  $mob->setDescription($format);
749  }
750 
751  return $file;
752  }
print $file
$_POST['username']
Definition: cron.php:12
$location
Definition: buildRTE.php:44
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static getMimeType($a_file)
get mime type for file
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
_getDirectory($a_mob_id)
get directory for files of media object (static)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $additionalPurposes

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

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

◆ $mimeTypes

ilObjMediaCastGUI::$mimeTypes = array()
private

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

◆ $purposeSuffixes

ilObjMediaCastGUI::$purposeSuffixes = array ()
private

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


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