ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
 executeCommand ()
 execute command
 createObject ()
 Create new object form.
 initCreationForm ()
 Init Settings Form.
 initImportForm ($a_new_type="")
 Init object import form.
 importFileObject ()
 Import.
 afterSave ($newObj)
 save object public
 saveObject ()
 save object public
 listItemsObject ()
 List items of media cast.
 addCastItemObject ()
 Add media cast item.
 editCastItemObject ()
 Edit media cast item.
 initAddCastItemForm ($a_mode="create")
 Init add cast item form.
 getCastItemValues ()
 Get cast item values into form.
 saveCastItemObject ()
 Save new cast item.
 updateCastItemObject ()
 Update cast item.
 confirmDeletionItemsObject ()
 Confirmation Screen.
 deleteItemsObject ()
 Delete news items.
 downloadItemObject ()
 Delete news items.
 determinePlaytimeObject ()
 Delete news items.
 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
 infoScreen ()
 show information screen
 setTabs ()
 get tabs public
 editSettingsObject ()
 Edit settings.
 initSettingsForm ()
 Init Settings Form.
 saveSettingsObject ()
 Save Settings.
 addLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded)
 _goto ($a_target)
- Public Member Functions inherited from ilObjectGUI
 ilObjectGUI ($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
 Constructor public.
 withReferences ()
 determines wether objects are referenced or not (got ref ids or not)
 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
 getCreationMode ()
 get creation mode
 getAdminTabs (&$tabs_gui)
 administration tabs show only permissions and trash folder
 getHTML ()
 undeleteObject ()
 Get objects back from trash.
 confirmedDeleteObject ()
 confirmed deletion of object -> objects are moved to trash or deleted immediately, if trash is disabled
 cancelDeleteObject ()
 cancel deletion of object
 removeFromSystemObject ()
 remove objects from trash bin and all entries therefore every object needs a specific deleteObject() method
 cancelObject ($in_rep=false)
 cancel action and go back to previous page public
 editObject ()
 edit object
 updateObject ()
 updates object entry in object_data
 getFormAction ($a_cmd, $a_formaction="")
 get form action for command (command is method name without "Object", e.g.
 isVisible ($a_ref_id, $a_type)
 viewObject ()
 list childs of current object
 deleteObject ($a_error=false)
 Display deletion confirmation screen.
 trashObject ()
 Show trash content of object.
 getTemplateFile ($a_cmd, $a_type="")
 get a template blockfile format: tpl.
 cloneAllObject ()
 Clone single (not container object) Method is overwritten in ilContainerGUI.
 copyWizardHasOptions ($a_mode)
 Check if there is any modules specific option.

Protected Member Functions

 getMediaItem ($id)
 get MediaItem for id and updates local variable mcst_item
 getMediaItems ($id)
 get MediaItems for id and updates local variable mcst_item
- Protected Member Functions inherited from ilObjectGUI
 assignObject ()
 prepareOutput ()
 prepare output
 setTitleAndDescription ()
 called by prepare output
 showUpperIcon ()
 setAdminTabs ()
 set admin tabs public
 setLocator ()
 set Locator
 omitLocator ($a_omit=true)
 addAdminLocatorItems ()
 should be overwritten to add object specific items (repository items are preloaded)
 displayEditForm ($fields)
 display edit form (usually called by editObject)
 afterUpdate ()
 setFormAction ($a_cmd, $a_formaction)
 set specific form action for command
 getReturnLocation ($a_cmd, $a_location="")
 get return location for command (command is method name without "Object", e.g.
 setReturnLocation ($a_cmd, $a_location)
 set specific return location for command
 getTargetFrame ($a_cmd, $a_target_frame="")
 get target frame for command (command is method name without "Object", e.g.
 setTargetFrame ($a_cmd, $a_target_frame)
 set specific target frame for command
 showPossibleSubObjects ()
 show possible subobjects (pulldown menu)
 getTitlesByRefId ($a_ref_ids)
 get Titles of objects this method is used for error messages in methods cut/copy/paste
 getTabs (&$tabs_gui)
 get tabs abstract method.
 __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
 __showClipboardTable ($a_result_set, $a_from="")
 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
 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.
 getCenterColumnHTML ()
 Get center column.
 getRightColumnHTML ()
 Display right column.
 setColumnSettings ($column_gui)
 May be overwritten in subclasses.
 checkPermission ($a_perm, $a_cmd="")

Static Protected Member Functions

static isAudio ($extension)
 detect audio mimetype

Private Member Functions

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

Private Attributes

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

Additional Inherited Members

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

Detailed Description

Member Function Documentation

ilObjMediaCastGUI::_goto (   $a_target)

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

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

{
global $ilAccess, $ilErr, $lng;
if ($ilAccess->checkAccess("read", "", $a_target))
{
$_GET["cmd"] = "listItems";
$_GET["ref_id"] = $a_target;
$_GET["baseClass"] = "ilmediacasthandlergui";
$_GET["cmdClass"] = "ilobjmediacastgui";
include("ilias.php");
}
else if ($ilAccess->checkAccess("visible", "", $a_target))
{
$_GET["cmd"] = "infoScreen";
$_GET["ref_id"] = $a_target;
include("repository.php");
}
else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
{
$_GET["cmd"] = "frameset";
$_GET["target"] = "";
$_GET["ref_id"] = ROOT_FOLDER_ID;
ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
include("repository.php");
}
$ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
}

+ Here is the call graph for this function:

ilObjMediaCastGUI::addCastItemObject ( )

Add media cast item.

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

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

{
global $tpl;
$this->checkPermission("write");
$tpl->setContent($this->form_gui->getHTML());
}

+ Here is the call graph for this function:

ilObjMediaCastGUI::addLocatorItems ( )

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

Reimplemented from ilObjectGUI.

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

References $_GET.

{
global $ilLocator;
if (is_object($this->object))
{
$ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "listItems"), "", $_GET["ref_id"]);
}
}
ilObjMediaCastGUI::afterSave (   $newObj)

save object public

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

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

Referenced by importFileObject().

{
// always send a message
ilUtil::sendSuccess($this->lng->txt("object_added"),true);
ilUtil::redirect("ilias.php?baseClass=ilMediaCastHandlerGUI&ref_id=".$newObj->getRefId()."&cmd=editSettings");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjMediaCastGUI::confirmDeletionItemsObject ( )

Confirmation Screen.

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

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

{
global $ilCtrl, $lng, $tpl, $ilTabs;
$this->checkPermission("write");
$ilTabs->activateTab("id_content");
if (!is_array($_POST["item_id"]))
{
$this->listItemsObject();
return;
}
include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
$c_gui = new ilConfirmationGUI();
// set confirm/cancel commands
$c_gui->setFormAction($ilCtrl->getFormAction($this, "deleteItems"));
$c_gui->setHeaderText($lng->txt("info_delete_sure"));
$c_gui->setCancel($lng->txt("cancel"), "listItems");
$c_gui->setConfirm($lng->txt("confirm"), "deleteItems");
// add items to delete
include_once("./Services/News/classes/class.ilNewsItem.php");
foreach($_POST["item_id"] as $item_id)
{
$item = new ilNewsItem($item_id);
$c_gui->addItem("item_id[]", $item_id, $item->getTitle(),
ilUtil::getImagePath("icon_mcst.gif"));
}
$tpl->setContent($c_gui->getHTML());
}

+ Here is the call graph for this function:

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

handle media item for given purpose

Parameters
ilMediaObject$mob
stringfile

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

References updateMediaItem().

Referenced by saveCastItemObject(), and updateCastItemObject().

{
$mediaItem = new ilMediaItem();
$mob->addMediaItem($mediaItem);
$mediaItem->setPurpose($purpose);
return $this->updateMediaItem($mob, $mediaItem);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjMediaCastGUI::createObject ( )

Create new object form.

Reimplemented from ilObjectGUI.

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

References $_GET, $_POST, ilObjectGUI\$tpl, initCreationForm(), and initImportForm().

{
global $rbacsystem;
$new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $new_type))
{
$this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
}
else
{
global $tpl;
$this->initCreationForm();
$html1 = $this->form->getHtml();
$this->initImportForm("mcst");
$html2 = $this->form->getHTML();
$tpl->setContent($html1."<br/>".$html2);
}
}

+ Here is the call graph for this function:

ilObjMediaCastGUI::deleteItemsObject ( )

Delete news items.

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

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

{
global $ilCtrl;
$this->checkPermission("write");
// delete all selected news items
foreach($_POST["item_id"] as $item_id)
{
$mc_item = new ilNewsItem($item_id);
$mc_item->delete();
}
$ilCtrl->redirect($this, "listItems");
}

+ Here is the call graph for this function:

ilObjMediaCastGUI::determinePlaytimeObject ( )

Delete news items.

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

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

{
global $ilCtrl, $lng;
$mc_item = new ilNewsItem($_GET["item_id"]);
$mob = $mc_item->getMobId();
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
$mob = new ilObjMediaObject($mob);
$mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
$m_item = $mob->getMediaItem("Standard");
$file = $mob_dir."/".$m_item->getLocation();
$duration = $this->getDuration($file);
if ($duration != "00:00:00")
{
$mc_item->setPlaytime($duration);
$mc_item->update();
ilUtil::sendSuccess($lng->txt("mcst_set_playtime"), true);
}
else
{
ilUtil::sendFailure($lng->txt("mcst_unable_to_determin_playtime"), true);
}
$ilCtrl->redirect($this, "listItems");
}

+ Here is the call graph for this function:

ilObjMediaCastGUI::downloadItemObject ( )

Delete news items.

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

References $_GET, $file, $ilCtrl, ilObjMediaObject\_getDirectory(), ilObjectGUI\checkPermission(), ilUtil\deliverFile(), exit, ilUtil\redirect(), and ilUtil\sendFailure().

{
global $ilCtrl;
$this->checkPermission("read");
$mc_item = new ilNewsItem($_GET["item_id"]);
$mob = $mc_item->getMobId();
include_once("./Services/MediaObjects/classes/class.ilObjMediaObject.php");
$mob = new ilObjMediaObject($mob);
$mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
$purpose = $_GET["purpose"];
$m_item = $mob->getMediaItem($purpose);
if ($m_item->getLocationType() != "Reference")
{
$file = $mob_dir."/".$m_item->getLocation();
if (file_exists($file) && is_file($file))
{
ilUtil::deliverFile($file, $m_item->getLocation());
}
else {
ilUtil::sendFailure("File not found!",true);
$ilCtrl->redirect($this, "listItems");
}
}
else
{
ilUtil::redirect($m_item->getLocation());
}
}

+ Here is the call graph for this function:

ilObjMediaCastGUI::editCastItemObject ( )

Edit media cast item.

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

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

{
global $tpl;
$this->checkPermission("write");
$this->initAddCastItemForm("edit");
$tpl->setContent($this->form_gui->getHTML());
}

+ Here is the call graph for this function:

ilObjMediaCastGUI::editSettingsObject ( )

Edit settings.

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

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

{
global $tpl, $ilTabs;
$this->checkPermission("write");
$ilTabs->activateTab("id_settings");
$this->initSettingsForm();
$tpl->setContent($this->form_gui->getHtml());
}

+ Here is the call graph for this function:

ilObjMediaCastGUI::executeCommand ( )

execute command

Reimplemented from ilObjectGUI.

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

References $cmd, $ret, ilObjectGUI\checkPermission(), infoScreen(), and ilObjectGUI\prepareOutput().

{
global $ilUser, $ilTabs;
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->ctrl->getCmd();
$this->prepareOutput();
switch($next_class)
{
case "ilinfoscreengui":
$this->checkPermission("visible");
$this->infoScreen(); // forwards command
break;
case "ilexportgui":
// $this->prepareOutput();
$ilTabs->activateTab("export");
include_once("./Services/Export/classes/class.ilExportGUI.php");
$exp_gui = new ilExportGUI($this);
$exp_gui->addFormat("xml");
$ret = $this->ctrl->forwardCommand($exp_gui);
// $this->tpl->show();
break;
case 'ilpermissiongui':
$ilTabs->activateTab("id_permissions");
include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
$perm_gui =& new ilPermissionGUI($this);
$ret =& $this->ctrl->forwardCommand($perm_gui);
break;
default:
if(!$cmd)
{
$cmd = "infoScreen";
}
$cmd .= "Object";
if ($cmd != "infoScreenObject")
{
$this->checkPermission("read");
}
else
{
$this->checkPermission("visible");
}
$this->$cmd();
break;
}
return true;
}

+ Here is the call graph for this function:

ilObjMediaCastGUI::getCastItemValues ( )

Get cast item values into form.

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

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

Referenced by editCastItemObject().

{
global $lng;
$values = array();
$mediaItems = $this->getMediaItems($_GET["item_id"]);
if (count ($mediaItems) > 0)
{
foreach ($mediaItems as $med)
{
if (!isset ($values["title"]))
{
// first item, so set title, description, ...
$values["title"] = $this->mcst_item->getTitle();
$values["description"] = $this->mcst_item->getContent();
$values["visibility"] = $this->mcst_item->getVisibility();
$length = explode(":", $this->mcst_item->getPlaytime());
$values["duration"] = array("hh" => $length[0], "mm" => $length[1], "ss" => $length[2]);
}
$values["value_".$med->getPurpose()] = (strlen($med->getLocation())> 100) ? "...".substr($med->getLocation(), strlen($med->getLocation()) - 100) : $med->getLocation();
$values["label_value_".$med->getPurpose()] = (strlen($med->getLocation())> 100) ? "...".substr($med->getLocation(), strlen($med->getLocation()) - 100) : $med->getLocation();
$mimeTypesValuesAsKey = array_flip($this->mimeTypes);
if (array_key_exists($med->getFormat(), $mimeTypesValuesAsKey))
$values["mimetype_".$med->getPurpose()] = $mimeTypesValuesAsKey[$med->getFormat()]+1;
}
}
foreach (ilObjMediaCast::$purposes as $purpose) {
if (!isset ($values["value_".$purpose]))
{
$values["label_value_".$purpose] = $lng->txt("none");
$values["value_".$purpose] = $lng->txt("none");
}
}
$this->form_gui->setValuesByArray($values);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjMediaCastGUI::getDuration (   $file)
private

get duration from form or from file analyzer

Parameters
unknown_type$file
Returns
unknown

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

References $file.

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

{
$duration = isset($this->form_gui) ? $this->form_gui->getInput("duration") : "";
if ($duration["hh"] == 0 && $duration["mm"] == 0 && $duration["ss"] == 0 && is_file($file))
{
include_once("./Services/MediaObjects/classes/class.ilMediaAnalyzer.php");
$ana = new ilMediaAnalyzer();
$ana->setFile($file);
$ana->analyzeFile();
$dur = $ana->getPlaytimeString();
$dur = explode(":", $dur);
$duration["mm"] = $dur[0];
$duration["ss"] = $dur[1];
}
$duration = str_pad($duration["hh"], 2 , "0", STR_PAD_LEFT).":".
str_pad($duration["mm"], 2 , "0", STR_PAD_LEFT).":".
str_pad($duration["ss"], 2 , "0", STR_PAD_LEFT);
return $duration;
}

+ Here is the caller graph for this function:

ilObjMediaCastGUI::getMediaItem (   $id)
protected

get MediaItem for id and updates local variable mcst_item

Returns
ilMediaItem

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

References ilObjMediaObject\getMediaItem().

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

+ Here is the call graph for this function:

ilObjMediaCastGUI::getMediaItems (   $id)
protected

get MediaItems for id and updates local variable mcst_item

Returns
array of ilMediaItem

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

References ilObjMediaObject\getMediaItems().

Referenced by getCastItemValues().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Constructor public.

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

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

{
global $ilCtrl, $lng;
$this->type = "mcst";
$this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
$lng->loadLanguageModule("mcst");
$lng->loadLanguageModule("news");
$ilCtrl->saveParameter($this, "item_id");
include_once ("./Modules/MediaCast/classes/class.ilMediaCastSettings.php");
$this->purposeSuffixes = $settings->getPurposeSuffixes();
$this->mimeTypes = $settings->getMimeTypes();
}

+ Here is the call graph for this function:

ilObjMediaCastGUI::importFileObject ( )

Import.

public

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

References $_GET, $_POST, ilObjectGUI\$lng, ilObjectGUI\$objDefinition, ilObjectGUI\$tpl, afterSave(), ilObjectFactory\getInstanceByObjId(), initImportForm(), and ilUtil\sendSuccess().

{
global $rbacsystem, $objDefinition, $tpl, $lng;
$new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
// create permission is already checked in createObject. This check here is done to prevent hacking attempts
if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $new_type))
{
$this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->MESSAGE);
}
$this->ctrl->setParameter($this, "new_type", $new_type);
$this->initImportForm($new_type);
if ($this->form->checkInput())
{
// todo: make some check on manifest file
include_once("./Services/Export/classes/class.ilImport.php");
$imp = new ilImport((int) $_GET['ref_id']);
$new_id = $imp->importObject($newObj, $_FILES["importfile"]["tmp_name"],
$_FILES["importfile"]["name"], $new_type);
// put new object id into tree
if ($new_id > 0)
{
$newObj->createReference();
$newObj->putInTree($_GET["ref_id"]);
$newObj->setPermissions($_GET["ref_id"]);
ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
$this->afterSave($newObj);
}
return;
}
$this->form->setValuesByPost();
$tpl->setContent($this->form->getHtml());
}

+ Here is the call graph for this function:

ilObjMediaCastGUI::infoScreen ( )

show information screen

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

References ilDatePresentation\formatDate(), and IL_CAL_DATETIME.

Referenced by executeCommand(), and infoScreenObject().

{
global $ilAccess, $ilUser, $ilTabs;
$ilTabs->activateTab("id_info");
if (!$ilAccess->checkAccess("visible", "", $this->object->getRefId()))
{
$this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
}
include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
$info = new ilInfoScreenGUI($this);
$info->enablePrivateNotes();
/*
$info->enableNews();
if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
{
//$info->enableNewsEditing();
$info->setBlockProperty("news", "settings", true);
}*/
// general information
$this->lng->loadLanguageModule("meta");
$this->lng->loadLanguageModule("mcst");
$med_items = $this->object->getItemsArray();
$info->addSection($this->lng->txt("meta_general"));
$info->addProperty($this->lng->txt("mcst_nr_items"),
(int) count($med_items));
if (count($med_items) > 0)
{
$cur = current($med_items);
$last = ilDatePresentation::formatDate(new ilDateTime($cur["creation_date"], IL_CAL_DATETIME));
}
else
{
$last = "-";
}
$info->addProperty($this->lng->txt("mcst_last_submission"), $last);
// forward the command
$this->ctrl->forwardCommand($info);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 961 of file class.ilObjMediaCastGUI.php.

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

{
$this->checkPermission("visible");
$this->ctrl->setCmd("showSummary");
$this->ctrl->setCmdClass("ilinfoscreengui");
$this->infoScreen();
}

+ Here is the call graph for this function:

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

Init add cast item form.

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

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

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

{
global $lng, $ilCtrl, $ilTabs;
$this->checkPermission("write");
$ilTabs->activateTab("id_content");
$lng->loadLanguageModule("mcst");
$news_set = new ilSetting("news");
$enable_internal_rss = $news_set->get("enable_rss_for_internal");
include("Services/Form/classes/class.ilPropertyFormGUI.php");
$this->form_gui = new ilPropertyFormGUI();
$this->form_gui->setMultipart(true);
// Property Title
$text_input = new ilTextInputGUI($lng->txt("title"), "title");
$text_input->setMaxLength(200);
$this->form_gui->addItem($text_input);
// Property Content
$text_area = new ilTextAreaInputGUI($lng->txt("description"), "description");
$text_area->setRequired(false);
$this->form_gui->addItem($text_area);
// Property Visibility
if ($enable_internal_rss)
{
$radio_group = new ilRadioGroupInputGUI($lng->txt("access_scope"), "visibility");
$radio_option = new ilRadioOption($lng->txt("access_users"), "users");
$radio_group->addOption($radio_option);
$radio_option = new ilRadioOption($lng->txt("access_public"), "public");
$radio_group->addOption($radio_option);
$radio_group->setInfo($lng->txt("mcst_visibility_info"));
$radio_group->setRequired(true);
$radio_group->setValue($this->object->getDefaultAccess() == 0 ? "users" : "public");
$this->form_gui->addItem($radio_group);
}
// Duration
$dur = new ilDurationInputGUI($lng->txt("mcst_duration"), "duration");
$dur->setInfo($lng->txt("mcst_duration_info"));
$dur->setShowDays(false);
$dur->setShowHours(true);
$dur->setShowSeconds(true);
$this->form_gui->addItem($dur);
foreach (ilObjMediaCast::$purposes as $purpose)
{
$section->setTitle($lng->txt("mcst_".strtolower($purpose)."_title"));
$this->form_gui->addItem($section);
if ($a_mode != "create")
{
$value = new ilHiddenInputGUI("value_".$purpose);
$label = new ilNonEditableValueGUI($lng->txt("value"));
$label->setPostVar("label_value_".$purpose);
$label->setInfo($lng->txt("mcst_current_value_info"));
$this->form_gui->addItem($label);
$this->form_gui->addItem($value);
}
$file = new ilFileInputGUI($lng->txt("file"), "file_".$purpose);
$file->setSuffixes($this->purposeSuffixes[$purpose]);
$this->form_gui->addItem($file);
$text_input = new ilRegExpInputGUI($lng->txt("url"), "url_".$purpose);
$text_input->setPattern("/https?\:\/\/.+/i");
$text_input->setInfo($lng->txt("mcst_reference_info"));
$this->form_gui->addItem($text_input);
if ($purpose != "Standard")
{
$clearCheckBox = new ilCheckboxInputGUI();
$clearCheckBox->setPostVar("delete_".$purpose);
$clearCheckBox->setTitle($lng->txt("mcst_clear_purpose_title"));
$this->form_gui->addItem($clearCheckBox);
} else {
$mimeTypeSelection = new ilSelectInputGUI();
$mimeTypeSelection->setPostVar("mimetype_".$purpose);
$mimeTypeSelection->setTitle($lng->txt("mcst_mimetype"));
$mimeTypeSelection->setInfo($lng->txt("mcst_mimetype_info"));
$options = array($lng->txt("mcst_automatic_detection"));
$options = array_merge($options, $this->mimeTypes);
$mimeTypeSelection->setOptions($options);
$this->form_gui->addItem($mimeTypeSelection);
}
}
// save/cancel button
if ($a_mode == "create")
{
$this->form_gui->setTitle($lng->txt("mcst_add_new_item"));
$this->form_gui->addCommandButton("saveCastItem", $lng->txt("save"));
}
else
{
$this->form_gui->setTitle($lng->txt("mcst_edit_item"));
$this->form_gui->addCommandButton("updateCastItem", $lng->txt("save"));
}
$this->form_gui->addCommandButton("listItems", $lng->txt("cancel"));
$this->form_gui->setFormAction($ilCtrl->getFormAction($this, "saveCastItem"));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjMediaCastGUI::initCreationForm ( )

Init Settings Form.

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

References $ilCtrl, ilObjectGUI\$lng, ilObjectGUI\$tpl, ilFormPropertyGUI\setRequired(), and ilFormPropertyGUI\setTitle().

Referenced by createObject(), and saveObject().

{
global $tpl, $lng, $ilCtrl, $ilTabs;
$lng->loadLanguageModule("mcst");
$ilTabs->activateTab("settings");
include("Services/Form/classes/class.ilPropertyFormGUI.php");
$this->form = new ilPropertyFormGUI();
// Title
$tit = new ilTextInputGUI($lng->txt("title"), "title");
$tit->setRequired(true);
$this->form->addItem($tit);
// Description
$des = new ilTextAreaInputGUI($lng->txt("description"), "description");
$this->form->addItem($des);
$this->form->setTitle($lng->txt("mcst_new"));
$this->form->addCommandButton("save", $lng->txt("mcst_add"));
$this->form->addCommandButton("cancel", $lng->txt("cancel"));
// set values
$ilCtrl->setParameter($this, "new_type", "mcst");
$this->form->setFormAction($ilCtrl->getFormAction($this, "save"));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjMediaCastGUI::initImportForm (   $a_new_type = "")

Init object import form.

Parameters
stringnew type

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

References $ilCtrl, ilObjectGUI\$lng, and ilFileInputGUI\setSuffixes().

Referenced by createObject(), and importFileObject().

{
global $lng, $ilCtrl;
$lng->loadLanguageModule("mcst");
include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
$this->form = new ilPropertyFormGUI();
$this->form->setTarget("_top");
// Import file
include_once("./Services/Form/classes/class.ilFileInputGUI.php");
$fi = new ilFileInputGUI($lng->txt("import_file"), "importfile");
$fi->setSuffixes(array("zip"));
$fi->setRequired(true);
$this->form->addItem($fi);
$this->form->addCommandButton("importFile", $lng->txt("import"));
$this->form->addCommandButton("cancel", $lng->txt("cancel"));
$this->form->setTitle($lng->txt($a_new_type."_import"));
$this->form->setFormAction($ilCtrl->getFormAction($this));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjMediaCastGUI::initSettingsForm ( )

Init Settings Form.

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

References $ilCtrl, ilObjectGUI\$lng, ilObjectGUI\$tpl, ilBlockSetting\_lookup(), ilCheckboxInputGUI\setChecked(), ilRadioOption\setInfo(), ilFormPropertyGUI\setInfo(), ilTextInputGUI\setValue(), and ilTextAreaInputGUI\setValue().

Referenced by editSettingsObject(), and saveSettingsObject().

{
global $tpl, $lng, $ilCtrl;
$lng->loadLanguageModule("mcst");
include("Services/Form/classes/class.ilPropertyFormGUI.php");
$this->form_gui = new ilPropertyFormGUI();
$this->form_gui->setTitle($lng->txt("mcst_settings"));
// Title
$tit = new ilTextInputGUI($lng->txt("title"), "title");
$tit->setValue($this->object->getTitle());
$tit->setRequired(true);
$this->form_gui->addItem($tit);
// description
$des = new ilTextAreaInputGUI($lng->txt("description"), "description");
$des->setValue($this->object->getLongDescription());
$this->form_gui->addItem($des);
// Online
$online = new ilCheckboxInputGUI($lng->txt("online"), "online");
$online->setChecked($this->object->getOnline());
$this->form_gui->addItem($online);
// Downloadable
$downloadable = new ilCheckboxInputGUI($lng->txt("mcst_downloadable"), "downloadable");
$downloadable->setChecked($this->object->getDownloadable());
$downloadable->setInfo($lng->txt("mcst_downloadable_info"));
$this->form_gui->addItem($downloadable);
$news_set = new ilSetting("news");
$enable_internal_rss = $news_set->get("enable_rss_for_internal");
//Default Visibility
if ($enable_internal_rss)
{
$radio_group = new ilRadioGroupInputGUI($lng->txt("news_default_visibility"), "defaultaccess");
$radio_option = new ilRadioOption($lng->txt("news_visibility_users"), "0");
$radio_group->addOption($radio_option);
$radio_option = new ilRadioOption($lng->txt("news_visibility_public"), "1");
$radio_group->addOption($radio_option);
$radio_group->setInfo($lng->txt("news_news_item_visibility_info"));
$radio_group->setRequired(false);
$radio_group->setValue($this->object->getDefaultAccess());
#$ch->addSubItem($radio_group);
$this->form_gui->addItem($radio_group);
//Extra Feed
include_once("./Services/Block/classes/class.ilBlockSetting.php");
$public_feed = ilBlockSetting::_lookup("news", "public_feed", 0, $this->object->getId());
$ch = new ilCheckboxInputGUI($lng->txt("news_public_feed"), "extra_feed");
$ch->setInfo($lng->txt("news_public_feed_info"));
$ch->setChecked($public_feed);
$this->form_gui->addItem($ch);
// Include Files in Pubic Items
$incl_files = new ilCheckboxInputGUI($lng->txt("mcst_incl_files_in_rss"), "public_files");
$incl_files->setChecked($this->object->getPublicFiles());
$incl_files->setInfo($lng->txt("mcst_incl_files_in_rss_info"));
#$ch->addSubItem($incl_files);
$this->form_gui->addItem($incl_files);
}
// Form action and save button
$this->form_gui->addCommandButton("saveSettings", $lng->txt("save"));
$this->form_gui->setFormAction($ilCtrl->getFormAction($this, "saveSettings"));
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilObjMediaCastGUI::isAudio (   $extension)
staticprotected

detect audio mimetype

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

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

{
return strpos($extension,"audio") !== false;
}
ilObjMediaCastGUI::listItemsObject ( )

List items of media cast.

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

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

Referenced by confirmDeletionItemsObject().

{
global $tpl, $lng, $ilAccess, $ilTabs;
$this->checkPermission("read");
$ilTabs->activateTab("id_content");
$med_items = $this->object->getItemsArray();
include_once("./Modules/MediaCast/classes/class.ilMediaCastTableGUI.php");
$table_gui = new ilMediaCastTableGUI($this, "listItems");
$table_gui->setTitle($lng->txt("mcst_media_cast"));
$table_gui->setData($med_items);
if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
{
$table_gui->addCommandButton("addCastItem", $lng->txt("add"));
$table_gui->addMultiCommand("confirmDeletionItems", $lng->txt("delete"));
$table_gui->setSelectAllCheckbox("item_id");
}
include_once("./Services/Block/classes/class.ilBlockSetting.php");
$public_feed = ilBlockSetting::_lookup("news", "public_feed",
0, $this->object->getId());
// rss icon/link
if ($public_feed)
{
$news_set = new ilSetting("news");
$enable_internal_rss = $news_set->get("enable_rss_for_internal");
if ($enable_internal_rss)
{
// create dummy object in db (we need an id)
$items = $this->object->getItemsArray();
include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
$html = "";
foreach (ilObjMediaCast::$purposes as $purpose)
{
foreach ($items as $id => $item)
{
$mob = new ilObjMediaObject($item["mob_id"]);
$mob->read();
if ($mob->hasPurposeItem($purpose))
{
if ($html == "") {
//$html = "<TABLE cellpadding='1' cellspacing='0'><TR>";
$html = " ";
}
$url = ILIAS_HTTP_PATH."/feed.php?client_id=".rawurlencode(CLIENT_ID)."&"."ref_id=".$_GET["ref_id"]."&purpose=$purpose";
$title = $lng->txt("news_feed_url");
$icon = ilUtil::getImagePath("rss_icon_".strtolower($purpose).".gif");
$target = "_blank";
//$row1 .= "<TD><A href='$url' target='$target'><img src='$icon' alt='$title'/></A></TD>";
$row1 .= "<A href='$url' target='$target'><img src='$icon' alt='$title'/></A>";
if ($this->object->getPublicFiles())
{
$url = preg_replace("/https?/i","itpc",$url);
$title = $lng->txt("news_feed_url");
$icon = ilUtil::getImagePath("itunes_icon.gif");
//$row2 .= "<TD><A href='$url' target='$target'><img src='$icon' alt='$title'/></A></TD>";
$row2 .= "<A href='$url' target='$target'><img src='$icon' alt='$title'/></A>";
}
break;
}
}
}
if ($html != "") {
//$html .= $row1."</TR>";
$html .= $row1;
if ($row2 != "")
{
$html .= "&nbsp;&nbsp;".$row2;
//$html .= "<TR>".$row2."</TR>";
}
//$html .= "</TABLE>";
$table_gui->setHeaderHTML($html);
}
}
}
$tpl->setContent($table_gui->getHTML());
$tpl->setPermanentLink($this->object->getType(), $this->object->getRefId());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilObjMediaCastGUI::populateFormFromPost ( )
private

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

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

Referenced by saveCastItemObject(), and updateCastItemObject().

{
global $tpl;
//issue: we have to display the current settings
// problem: POST does not contain values of disabled textfields
// solution: use hidden field and label to display-> here we need to synchronize the labels
// with the values from the hidden fields.
foreach (ilObjMediaCast::$purposes as $purpose)
{
if ($_POST["value_".$purpose])
{
$_POST["label_value_".$purpose] = $_POST["value_".$purpose];
}
}
$this->form_gui->setValuesByPost();
$tpl->setContent($this->form_gui->getHTML());
}

+ Here is the caller graph for this function:

ilObjMediaCastGUI::saveCastItemObject ( )

Save new cast item.

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

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

{
global $tpl, $ilCtrl, $ilUser, $lng, $ilTabs;
$this->checkPermission("write");
$ilTabs->activateTab("id_content");
if ($_POST["url_Standard"] == "" && !$_FILES['file_Standard']['tmp_name']) {
ilUtil::sendFailure($lng->txt("msg_input_either_file_or_url"));
} else if ($this->form_gui->checkInput())
{
// create dummy object in db (we need an id)
include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
$mob = new ilObjMediaObject();
$mob->create();
//handle standard purpose
$file = $this->createMediaItemForPurpose($mob, "Standard");
// set title and description
// set title to basename of file if left empty
$title = $this->form_gui->getInput("title") != "" ? $this->form_gui->getInput("title") : basename($file);
$description = $this->form_gui->getInput("description");
$mob->setTitle($title);
$mob->setDescription($description);
// determine duration for standard purpose
$duration = $this->getDuration($file);
// handle other purposes
foreach ($this->additionalPurposes as $purpose)
{
// check if some purpose has been uploaded
$file_gui = $this->form_gui->getInput("file_".$purpose);
$url_gui = $this->form_gui->getInput("url_".$purpose);
if ($url_gui || $file_gui["size"] > 0)
{
$this->createMediaItemForPurpose ($mob, $purpose);
}
}
$mob->update();
//
// @todo: save usage
//
$news_set = new ilSetting("news");
$enable_internal_rss = $news_set->get("enable_rss_for_internal");
// create new media cast item
include_once("./Services/News/classes/class.ilNewsItem.php");
$mc_item = new ilNewsItem();
$mc_item->setMobId($mob->getId());
$mc_item->setContentType(NEWS_AUDIO);
$mc_item->setContextObjId($this->object->getId());
$mc_item->setContextObjType($this->object->getType());
$mc_item->setUserId($ilUser->getId());
$mc_item->setPlaytime($duration);
$mc_item->setTitle($title);
$mc_item->setContent($description);
$mc_item->setLimitation(false);
if ($enable_internal_rss)
{
$mc_item->setVisibility($this->form_gui->getInput("visibility"));
}
else
{
$mc_item->setVisibility("users");
}
$mc_item->create();
$ilCtrl->redirect($this, "listItems");
}
else
{
}
}

+ Here is the call graph for this function:

ilObjMediaCastGUI::saveObject ( )

save object public

Reimplemented from ilObjectGUI.

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

References $_POST, ilObjectGUI\$tpl, initCreationForm(), ilUtil\redirect(), and ilUtil\sendSuccess().

{
global $tpl;
$this->initCreationForm();
if ($this->form->checkInput())
{
$_POST["Fobject"]["title"] = $_POST["title"];
$_POST["Fobject"]["desc"] = $_POST["description"];
// create and insert forum in objecttree
$newObj = parent::saveObject();
// put here object specific stuff
// always send a message
ilUtil::sendSuccess($this->lng->txt("object_added"),true);
ilUtil::redirect("ilias.php?baseClass=ilMediaCastHandlerGUI&ref_id=".$newObj->getRefId()."&cmd=editSettings");
}
$this->form->setValuesByPost();
$tpl->setContent($this->form->getHtml());
}

+ Here is the call graph for this function:

ilObjMediaCastGUI::saveSettingsObject ( )

Save Settings.

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

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

{
global $ilCtrl, $ilTabs;
$this->checkPermission("write");
$ilTabs->activateTab("id_settings");
$this->initSettingsForm();
if ($this->form_gui->checkInput())
{
$news_set = new ilSetting("news");
$enable_internal_rss = $news_set->get("enable_rss_for_internal");
$this->object->setTitle($this->form_gui->getInput("title"));
$this->object->setDescription($this->form_gui->getInput("description"));
$this->object->setOnline($this->form_gui->getInput("online"));
$this->object->setDownloadable($this->form_gui->getInput("downloadable"));
if ($enable_internal_rss)
{
$this->object->setPublicFiles($this->form_gui->getInput("public_files"));
$this->object->setDefaultAccess($this->form_gui->getInput("defaultaccess"));
}
$this->object->update();
if ($enable_internal_rss)
{
include_once("./Services/Block/classes/class.ilBlockSetting.php");
ilBlockSetting::_write("news", "public_feed",
$this->form_gui->getInput("extra_feed"),
0, $this->object->getId());
}
ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"),true);
$ilCtrl->redirect($this, "editSettings");
}
else
{
$this->form_gui->setValuesByPost();
$this->tpl->setContent($this->form_gui->getHTML());
}
}

+ Here is the call graph for this function:

ilObjMediaCastGUI::setTabs ( )

get tabs public

Reimplemented from ilObjectGUI.

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

References ilObjectGUI\$lng.

{
global $ilAccess, $ilTabs, $lng;
// list items
if ($ilAccess->checkAccess('read', "", $this->object->getRefId()))
{
$ilTabs->addTab("id_content",
$lng->txt("content"),
$this->ctrl->getLinkTarget($this, "listItems"));
}
// info screen
if ($ilAccess->checkAccess('visible', "", $this->object->getRefId()))
{
$ilTabs->addTab("id_info",
$lng->txt("info_short"),
$this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"));
}
// settings
if ($ilAccess->checkAccess('write', "", $this->object->getRefId()))
{
$ilTabs->addTab("id_settings",
$lng->txt("settings"),
$this->ctrl->getLinkTarget($this, "editSettings"));
}
// export
if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
{
$ilTabs->addTab("export",
$lng->txt("export"),
$this->ctrl->getLinkTargetByClass("ilexportgui", ""));
}
// edit permissions
if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId()))
{
$ilTabs->addTab("id_permissions",
$lng->txt("perm_settings"),
$this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"));
}
}
ilObjMediaCastGUI::updateCastItemObject ( )

Update cast item.

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

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

{
global $tpl, $lng, $ilCtrl, $ilUser, $log;
$this->checkPermission("write");
$this->initAddCastItemForm("edit");
if ($this->form_gui->checkInput())
{
// create new media cast item
include_once("./Services/News/classes/class.ilNewsItem.php");
$mc_item = new ilNewsItem($_GET["item_id"]);
$mob_id = $mc_item->getMobId();
// create dummy object in db (we need an id)
include_once("./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
$mob = new ilObjMediaObject($mob_id);
foreach (ilObjMediaCast::$purposes as $purpose)
{
if ($this->form_gui->getInput("delete_".$purpose))
{
$mob->removeMediaItem($purpose);
$log->write ("Mcst: deleting purpose $purpose");
continue;
}
$media_item = $mob->getMediaItem($purpose);
$url_gui = $this->form_gui->getInput("url_".$purpose);
$file_gui = $this->form_gui->getInput("file_".$purpose);
if ($media_item == null)
{
if ($purpose != "Standard" &&
($url_gui || $file_gui["size"]>0))
{
// check if we added an additional purpose when updating
// either by url or by file
$file = $this->createMediaItemForPurpose($mob, $purpose);
}
} else
{
$file = $this->updateMediaItem($mob, $media_item);
}
if ($purpose == "Standard")
{
$duration = $this->getDuration($file);
$title = $this->form_gui->getInput("title") != "" ? $this->form_gui->getInput("title") : basename($file);
$description = $this->form_gui->getInput("description");
$mob->setTitle($title);
$mob->setDescription($description);
}
}
// set real meta and object data
$mob->update();
//
// @todo: save usage
//
$news_set = new ilSetting("news");
$enable_internal_rss = $news_set->get("enable_rss_for_internal");
$mc_item->setUserId($ilUser->getId());
if (isset($duration))
{
$mc_item->setPlaytime($duration);
}
$mc_item->setTitle($title);
$mc_item->setContent($description);
if ($enable_internal_rss)
{
$mc_item->setVisibility($this->form_gui->getInput("visibility"));
}
$mc_item->update();
$ilCtrl->redirect($this, "listItems");
}
else
{
}
}

+ Here is the call graph for this function:

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

update media item from form

Parameters
IlObjectMediaObject$mob
IlMediaItem$mediaItem
Returns
string file

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

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

Referenced by createMediaItemForPurpose(), and updateCastItemObject().

{
$purpose = $mediaItem->getPurpose();
$url_gui = $this->form_gui->getInput ("url_".$purpose);
$file_gui = $this->form_gui->getInput ("file_".$purpose);
if ($url_gui)
{
// http
$file = $this->form_gui->getInput ("url_".$purpose);
$title = basename ($file);
$location = $this->form_gui->getInput ("url_".$purpose);
$locationType = "Reference";
} elseif ($file_gui["size"] > 0){
// lokal
// determine and create mob directory, move uploaded file to directory
$mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
if (!is_dir($mob_dir))
$mob->createDirectory();
$file_name = ilUtil::getASCIIFilename($_FILES['file_'.$purpose]['name']);
$file_name = str_replace(" ", "_", $file_name);
$file = $mob_dir."/".$file_name;
$locationType = "LocalFile";
ilUtil::moveUploadedFile($_FILES['file_'.$purpose]['tmp_name'], $file_name, $file);
}
// check if not automatic mimetype detection
if ((int) $_POST["mimetype_".$purpose] != 0) {
// check if deleted or changed to prevent array index out of bounds!
// keep in mind, that first entry was automatic selection!
if ((int) $_POST["mimetype_".$purpose]-1 < count ($this->mimeTypes))
{
$format = $this->mimeTypes[(int) $_POST["mimetype_".$purpose] - 1];
$mediaItem->setFormat($format);
}
} elseif ($mediaItem->getLocation () != "") {
$format = ilObjMediaObject::getMimeType($mediaItem->getLocation());
$mediaItem->setFormat($format);
}
if (isset($file))
{
// get mime type, if not already set!
if (!isset($format))
{
}
// set real meta and object data
$mediaItem->setFormat($format);
$mediaItem->setLocation($location);
$mediaItem->setLocationType($locationType);
$mediaItem->setHAlign("Left");
$mediaItem->setHeight(self::isAudio($format)?0:180);
}
if ($purpose == "Standard")
{
if (isset($title))
$mob->setTitle ($title);
if (isset($format))
$mob->setDescription($format);
}
return $file;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

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

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

ilObjMediaCastGUI::$mimeTypes = array()
private

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

ilObjMediaCastGUI::$purposeSuffixes = array ()
private

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


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