Public Member Functions | Protected Member Functions | Static Protected Member Functions

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
 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
 getTabs (&$tabs_gui)
 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)

Protected Member Functions

 getMediaItem ($id)
 get MediaItem for id and updates local variable mcst_item

Static Protected Member Functions

static isAudio ($extension)
 detect audio mimetype

Detailed Description

Class ilObjMediaCastGUI.

Author:
Alex Killing <alex.killing@gmx.de>
Version:
$Id$

ilObjMediaCastGUI: ilPermissionGUI, ilInfoScreenGUI ilObjMediaCastGUI: ilRepositoryGUI, ilAdministrationGUI

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


Member Function Documentation

ilObjMediaCastGUI::_goto ( a_target  ) 

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

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

        {
                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");
                        exit;
                }
                else if ($ilAccess->checkAccess("visible", "", $a_target))
                {
                        $_GET["cmd"] = "infoScreen";
                        $_GET["ref_id"] = $a_target;
                        include("repository.php");
                        exit;
                }
                else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
                {
                        $_GET["cmd"] = "frameset";
                        $_GET["target"] = "";
                        $_GET["ref_id"] = ROOT_FOLDER_ID;
                        ilUtil::sendInfo(sprintf($lng->txt("msg_no_perm_read_item"),
                                ilObject::_lookupTitle(ilObject::_lookupObjId($a_target))), true);
                        include("repository.php");
                        exit;
                }

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

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

        {
                global $tpl;
                
                $this->checkPermission("write");
                
                $this->initAddCastItemForm();
                $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 870 of file class.ilObjMediaCastGUI.php.

References $_GET.

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

ilObjMediaCastGUI::confirmDeletionItemsObject (  ) 

Confirmation Screen.

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

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

        {
                global $ilCtrl, $lng, $tpl;
                
                $this->checkPermission("write");
                
                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::deleteItemsObject (  ) 

Delete news items.

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

References $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 614 of file class.ilObjMediaCastGUI.php.

References $_GET, $file, $ilCtrl, and ilObjMediaObject::_getDirectory().

        {
                global $ilCtrl;
                
                $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();
                
                include_once("./Services/MediaObjects/classes/class.ilMediaAnalyzer.php");
                $ana = new ilMediaAnalyzer();
                $ana->setFile($file);
                $ana->analyzeFile();
                $dur = $ana->getPlaytimeString();
                $dur = explode(":", $dur);
                $duration["hh"] = "00";
                $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);

                $mc_item->setPlaytime($duration);
                $mc_item->update();

                $ilCtrl->redirect($this, "listItems");
        }

Here is the call graph for this function:

ilObjMediaCastGUI::downloadItemObject (  ) 

Delete news items.

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

References $_GET, $file, ilObjMediaObject::_getDirectory(), ilObjectGUI::checkPermission(), ilUtil::deliverFile(), and exit.

        {
                $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());
                $m_item = $mob->getMediaItem("Standard");
                $file = $mob_dir."/".$m_item->getLocation();
                ilUtil::deliverFile($file, $m_item->getLocation());
                exit;
        }

Here is the call graph for this function:

ilObjMediaCastGUI::editCastItemObject (  ) 

Edit media cast item.

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

References $_GET, ilObjectGUI::$tpl, ilObjectGUI::checkPermission(), getCastItemValues(), getMediaItem(), and initAddCastItemForm().

        {
                global $tpl;
                
                $this->checkPermission("write");
                $med = $this->getMediaItem($_GET["item_id"]);           
                $this->initAddCastItemForm(strcasecmp($med->getLocationType(),"Reference") == 0? "edit_reference": "edit_local");
                $this->getCastItemValues();
                $tpl->setContent($this->form_gui->getHTML());
        }

Here is the call graph for this function:

ilObjMediaCastGUI::editSettingsObject (  ) 

Edit settings.

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

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

        {
                global $tpl;
                
                $this->checkPermission("write");
                
                $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 53 of file class.ilObjMediaCastGUI.php.

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

        {
                global $ilUser;
  
                $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 'ilpermissiongui':
                                include_once("./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 284 of file class.ilObjMediaCastGUI.php.

References $_GET, and getMediaItem().

Referenced by editCastItemObject().

        {
                $values = array();
                $med = $this->getMediaItem($_GET["item_id"]);
                $values["title"] = $this->mcst_item->getTitle();
                $values["description"] = $this->mcst_item->getContent();
                $values["visibility"] = $this->mcst_item->getVisibility();
                if (strcasecmp("Reference", $med->getLocationType()) == 0)
                        $values["url"] = $med->getLocation(); 
                $length = explode(":", $this->mcst_item->getPlaytime());
                $values["duration"] = array("hh" => $length[0], "mm" => $length[1], "ss" => $length[2]);
                
                $this->form_gui->setValuesByArray($values);
        }

Here is the call graph for this function:

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

Referenced by editCastItemObject(), and 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->getMediaItem("Standard");                                          
        }

Here is the caller graph for this function:

ilObjMediaCastGUI::getTabs ( &$  tabs_gui  ) 

get tabs public

Parameters:
object tabs gui object

Reimplemented from ilObjectGUI.

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

References $_GET, and $ilCtrl.

        {
                global $ilCtrl, $ilAccess;
                
                // list items
                if ($ilAccess->checkAccess('read', "", $this->object->getRefId()))
                {
                        $tabs_gui->addTarget("view_content",
                                $this->ctrl->getLinkTarget($this, "listItems"), array("", "listItems"),
                                array(strtolower(get_class($this)), ""));
                }

                // info screen
                if ($ilAccess->checkAccess('visible', "", $this->object->getRefId()))
                {
                        $force_active = ($ilCtrl->getNextClass() == "ilinfoscreengui"
                                || $_GET["cmd"] == "infoScreen")
                                ? true
                                : false;
                        $tabs_gui->addTarget("info_short",
                                $this->ctrl->getLinkTargetByClass(
                                "ilinfoscreengui", "showSummary"),
                                "showSummary",
                                "", "", $force_active);
                }

                // settings
                if ($ilAccess->checkAccess('write', "", $this->object->getRefId()))
                {
                        $tabs_gui->addTarget("settings",
                                $this->ctrl->getLinkTarget($this, "editSettings"), array("editSettings"),
                                array(strtolower(get_class($this)), ""));
                }

                // edit permissions
                if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId()))
                {
                        $tabs_gui->addTarget("perm_settings",
                                $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"), array("perm","info","owner"), 'ilpermissiongui');
                }
        }

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

Constructor public.

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

References $ilCtrl, ilObjectGUI::$lng, 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");
        }

Here is the call graph for this function:

ilObjMediaCastGUI::infoScreen (  ) 

show information screen

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

Referenced by executeCommand(), and infoScreenObject().

        {
                global $ilAccess, $ilUser;

                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 = $cur["creation_date"];
                }
                else
                {
                        $last = "-";
                }

                $info->addProperty($this->lng->txt("mcst_last_submission"), $last);

                // forward the command
                $this->ctrl->forwardCommand($info);
        }

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

References $file, $ilCtrl, ilObjectGUI::$lng, ilRadioGroupInputGUI::addOption(), and ilObjectGUI::checkPermission().

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

        {
                global $lng, $ilCtrl;
                
                $this->checkPermission("write");
                
                $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();
                
                // Property Title
                $text_input = new ilTextInputGUI($lng->txt("title"), "title");
                $text_input->setRequired(true);
                $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("users");
                        $this->form_gui->addItem($radio_group);
                }
                
                // File
                //if ($a_mode == "edit_local" || $a_mode == "create") 
                {
                        $file = new ilFileInputGUI($lng->txt("file"), "file");          
                        $file->setSuffixes(array("mp3","flv","gif", "png"));
                        $this->form_gui->addItem($file);
                }

                // Property URL
                //if ($a_mode == "edit_reference" || $a_mode == "create") 
                {               
                        $text_input = new ilRegExpInputGUI($lng->txt("url"), "url");
                        $text_input->setPattern("/https?\:\/\/.+/i");
                        $text_input->setInfo($lng->txt("mcst_reference_info"));
                        $this->form_gui->addItem($text_input);
                }
                
                
                
                // 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);
                
                // save/cancel button
                if ($a_mode == "create")
                {
                        $this->form_gui->addCommandButton("saveCastItem", $lng->txt("save"));
                }
                else
                {
                        $this->form_gui->addCommandButton("updateCastItem", $lng->txt("save"));
                }
                $this->form_gui->addCommandButton("listItems", $lng->txt("cancel"));
                $this->form_gui->setFormAction($ilCtrl->getFormAction($this, "saveCastItem"));
                
                $this->form_gui->setTitle($lng->txt("mcst_add_new_item"));
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjMediaCastGUI::initSettingsForm (  ) 

Init Settings Form.

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

References $ilCtrl, ilObjectGUI::$lng, ilObjectGUI::$tpl, and ilBlockSetting::_lookup().

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);
                
                $news_set = new ilSetting("news");
                $enable_internal_rss = $news_set->get("enable_rss_for_internal");

                // if rss is globally activated...
                if ($enable_internal_rss)
                {
                
                        // 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"));
                        $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  )  [static, protected]

detect audio mimetype

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

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

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

ilObjMediaCastGUI::listItemsObject (  ) 

List items of media cast.

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

References $_GET, ilObjectGUI::$lng, ilObjectGUI::$tpl, ilBlockSetting::_lookup(), ilObjectGUI::checkPermission(), and ilUtil::getImagePath().

Referenced by confirmDeletionItemsObject().

        {
                global $tpl, $lng, $ilAccess;
                
                $this->checkPermission("read");
                
                $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)
                        {
                                $table_gui->addHeaderCommand(
                                                ILIAS_HTTP_PATH."/feed.php?client_id=".rawurlencode(CLIENT_ID)."&".
                                                        "ref_id=".$_GET["ref_id"],
                                                        $lng->txt("news_feed_url"), "_blank",
                                                        ilUtil::getImagePath("rss.gif"));
                        }
                }

                $tpl->setContent($table_gui->getHTML());

        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjMediaCastGUI::saveCastItemObject (  ) 

Save new cast item.

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

References $file, $file_name, $ilCtrl, ilObjectGUI::$lng, $location, $title, ilObjectGUI::$tpl, ilObjMediaObject::_getDirectory(), ilObjectGUI::checkPermission(), ilUtil::getASCIIFilename(), ilObjMediaObject::getMimeType(), initAddCastItemForm(), ilUtil::moveUploadedFile(), ilUtil::renameExecutables(), and ilUtil::sendInfo().

        {
                global $tpl, $ilCtrl, $ilUser, $lng;
                
                $this->checkPermission("write");
                
                $this->initAddCastItemForm();
                
                if ($_POST["url"] == "" && !$_FILES['file']['tmp_name']) {
                        ilUtil::sendInfo($lng->txt("msg_input_either_file_or_url"));                    
                        $this->form_gui->setValuesByPost();
                        $tpl->setContent($this->form_gui->getHTML());                   
                } 
                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->setTitle($this->form_gui->getInput("title"));
                        $mob->setDescription("");
                        $mob->create();

                        $media_item =& new ilMediaItem();
                        $mob->addMediaItem($media_item);
                        $media_item->setPurpose("Standard");

                        if ($this->form_gui->getInput ("url"))
                        {
                                // http 
                                $file = $this->form_gui->getInput ("url");
                                $title = basename ($file);
                                $location = $this->form_gui->getInput ("url");
                                $locationType = "Reference";
                        } else {
                                // lokal
                                // determine and create mob directory, move uploaded file to directory
                                //$mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$this->object->getId();
                                $mob->createDirectory();
                                $mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
                
                                $file_name = ilUtil::getASCIIFilename($_FILES['file']['name']);
                                $file_name = str_replace(" ", "_", $file_name);
                                
                                $file = $mob_dir."/".$file_name;
                                $title = $file_name; 
                                $locationType = "LocalFile";
                                $location = $title;
                                ilUtil::moveUploadedFile($_FILES['file']['tmp_name'],
                                        $file_name, $file);                             
                        }
                        
                        // determine duration
                        $duration = $this->form_gui->getInput("duration");
                        if ($duration["hh"] == 0 && $duration["mm"] == 0 && $duration["ss"] == 0)
                        {
                                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);
                        
                        
                        // get mime type
                        $format = ilObjMediaObject::getMimeType($file);

                        // set real meta and object data
                        $media_item->setFormat($format);
                        $media_item->setLocation($location);
                        $media_item->setLocationType($locationType);
                        $media_item->setHeight(self::isAudio($format)?0:180);
                        $mob->setTitle($title);
                        $mob->setDescription($format);
                        $media_item->setHAlign("Left");

                        ilUtil::renameExecutables($mob_dir);
                        $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($this->form_gui->getInput("title"));
                        $mc_item->setContent($this->form_gui->getInput("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
                {
                        $this->form_gui->setValuesByPost();
                        $tpl->setContent($this->form_gui->getHTML());
                }
        }

Here is the call graph for this function:

ilObjMediaCastGUI::saveObject (  ) 

save object public

Reimplemented from ilObjectGUI.

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

References ilUtil::redirect(), and ilUtil::sendInfo().

        {
                global $rbacadmin;

                // create and insert forum in objecttree
                $newObj = parent::saveObject();

                // setup rolefolder & default local roles
                //$roles = $newObj->initDefaultRoles();

                // ...finally assign role to creator of object
                //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "y");

                // put here object specific stuff
                        
                // always send a message
                ilUtil::sendInfo($this->lng->txt("object_added"),true);
                
                ilUtil::redirect("ilias.php?baseClass=ilMediaCastHandlerGUI&ref_id=".$newObj->getRefId()."&cmd=listItems");
        }

Here is the call graph for this function:

ilObjMediaCastGUI::saveSettingsObject (  ) 

Save Settings.

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

References $ilCtrl, ilBlockSetting::_write(), ilObjectGUI::checkPermission(), initSettingsForm(), and ilUtil::sendInfo().

        {
                global $ilCtrl;
                
                $this->checkPermission("write");
                
                $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"));
                        if ($enable_internal_rss)
                        {
                                $this->object->setPublicFiles($this->form_gui->getInput("public_files"));
                        }
                        $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::sendInfo($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::updateCastItemObject (  ) 

Update cast item.

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

References $_GET, $file, $file_name, $ilCtrl, $location, ilObjectGUI::$tpl, ilObjMediaObject::_getDirectory(), ilObjectGUI::checkPermission(), ilUtil::getASCIIFilename(), ilObjMediaObject::getMimeType(), initAddCastItemForm(), ilUtil::moveUploadedFile(), and ilUtil::renameExecutables().

        {
                global $tpl, $ilCtrl, $ilUser;
                
                $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);

                        $mob->setTitle($this->form_gui->getInput("title"));
                        $mob->setDescription("");

                        // determine and create mob directory, move uploaded file to directory
                        //$mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$this->object->getId();
                        $mob->createDirectory();
                        $mob_dir = ilObjMediaObject::_getDirectory($mob->getId());

                        $media_item = $mob->getMediaItem("Standard");
                        $file = $mob_dir."/".$media_item->getLocation();
                        if ($_FILES['file']['name'] != "") // && strcasecmp ($media_item->getLocationType(), "LocaleFile") == 0)
                        {
                                $file_name = ilUtil::getASCIIFilename($_FILES['file']['name']);
                                $file_name = str_replace(" ", "_", $file_name);
                                
                                $file = $mob_dir."/".$file_name;
                                ilUtil::moveUploadedFile($_FILES['file']['tmp_name'],
                                        $file_name, $file);
                                // get mime type
                                $format = ilObjMediaObject::getMimeType($file);
                                $location = $file_name;
                                $media_item->setFormat($format);
                                $media_item->setLocation($location);
                                $media_item->setLocationType("LocalFile");
                                $mob->setTitle($file_name);
                                $mob->setDescription($format);
                                $media_item->setHAlign("Left");
                                $media_item->setHeight(self::isAudio($format)?0:180);
                                ilUtil::renameExecutables($mob_dir);
                        } elseif ($this->form_gui->getInput ("url")) // && strcasecmp ($media_item->getLocationType(), "Reference") == 0)
                        {
                                $location = $this->form_gui->getInput ("url");
                                $format = ilObjMediaObject::getMimeType($location);
                                $media_item->setHeight(self::isAudio($format)?0:180);
                                $media_item->setFormat($format);                                
                                $media_item->setLocation($location);
                                $media_item->setLocationType("Reference");
                        }
                        
                        

                        // set real meta and object data
                        $mob->update();

                        // determine duration
                        $duration = $this->form_gui->getInput("duration");
                        if ($duration["hh"] == 0 && $duration["mm"] == 0 && $duration["ss"] == 0)
                        {
                                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);
                        
                        
                        //
                        // @todo: save usage
                        //
                        
                        $news_set = new ilSetting("news");
                        $enable_internal_rss = $news_set->get("enable_rss_for_internal");

                        $mc_item->setUserId($ilUser->getId());
                        $mc_item->setPlaytime($duration);
                        $mc_item->setTitle($this->form_gui->getInput("title"));
                        $mc_item->setContent($this->form_gui->getInput("description"));
                        if ($enable_internal_rss)
                        {
                                $mc_item->setVisibility($this->form_gui->getInput("visibility"));
                        }
                        $mc_item->update();

                        $ilCtrl->redirect($this, "listItems");
                }
                else
                {
                        $this->form_gui->setValuesByPost();
                        $tpl->setContent($this->form_gui->getHTML());
                }
        }

Here is the call graph for this function:


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