/**
  * Update cast item
  */
 function updateCastItemObject()
 {
     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);
                 $prevpic = $this->form_gui->getInput("preview_pic");
                 if ($prevpic["size"] > 0) {
                     $mob->uploadVideoPreviewPic($prevpic);
                 } else {
                     $prevpici = $this->form_gui->getItemByPostVar("preview_pic");
                     if ($prevpici->getDeletionFlag()) {
                         $mob->removeAdditionalFile($mob->getVideoPreviewPic(true));
                     }
                 }
             }
         }
         // 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 {
         $this->populateFormFromPost();
     }
 }