24 require_once
"./classes/class.ilObjectGUI.php";
50 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
51 $lng->loadLanguageModule(
"mcst");
52 $lng->loadLanguageModule(
"news");
54 $ilCtrl->saveParameter($this,
"item_id");
56 include_once (
"./Modules/MediaCast/classes/class.ilMediaCastSettings.php");
58 $this->purposeSuffixes = $settings->getPurposeSuffixes();
65 $next_class = $this->ctrl->getNextClass($this);
66 $cmd = $this->ctrl->getCmd();
71 case "ilinfoscreengui":
76 case 'ilpermissiongui':
77 include_once(
"./classes/class.ilPermissionGUI.php");
79 $ret =& $this->ctrl->forwardCommand($perm_gui);
88 if (
$cmd !=
"infoScreenObject")
126 ilUtil::redirect(
"ilias.php?baseClass=ilMediaCastHandlerGUI&ref_id=".$newObj->getRefId().
"&cmd=editSettings");
139 $med_items = $this->
object->getItemsArray();
141 include_once(
"./Modules/MediaCast/classes/class.ilMediaCastTableGUI.php");
144 $table_gui->setTitle($lng->txt(
"mcst_media_cast"));
145 $table_gui->setData($med_items);
147 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"]))
149 $table_gui->addCommandButton(
"addCastItem", $lng->txt(
"add"));
150 $table_gui->addMultiCommand(
"confirmDeletionItems", $lng->txt(
"delete"));
151 $table_gui->setSelectAllCheckbox(
"item_id");
154 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
156 0, $this->object->getId());
162 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
165 if ($enable_internal_rss)
168 $items = $this->
object->getItemsArray();
169 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
174 foreach ($items as $id => $item)
178 if ($mob->hasPurposeItem($purpose))
181 $html =
"<TABLE cellpadding='1' cellspacing='0'><TR>";
183 $url = ILIAS_HTTP_PATH.
"/feed.php?client_id=".rawurlencode(CLIENT_ID).
"&".
"ref_id=".$_GET[
"ref_id"].
"&purpose=$purpose";
184 $title = $lng->txt(
"news_feed_url");
188 $row1 .=
"<TD><A href='$url' target='$target'><img src='$icon' alt='$title'/></A></TD>";
189 if ($this->object->getPublicFiles())
191 $url = preg_replace(
"/https?/i",
"itpc",$url);
192 $title = $lng->txt(
"news_feed_url");
194 $row2 .=
"<TD><A href='$url' target='$target'><img src='$icon' alt='$title'/></A></TD>";
202 $html .= $row1.
"</TR>";
204 $html .=
"<TR>".$row2.
"</TR>";
206 $table_gui->setHeaderHTML($html);
211 $tpl->setContent($table_gui->getHTML());
225 $tpl->setContent($this->form_gui->getHTML());
237 $tpl->setContent($this->form_gui->getHTML());
249 $lng->loadLanguageModule(
"mcst");
252 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
254 include(
"Services/Form/classes/class.ilPropertyFormGUI.php");
256 $this->form_gui->setMultipart(
true);
261 $this->form_gui->addItem($text_input);
266 $this->form_gui->addItem($text_area);
269 if ($enable_internal_rss)
272 $radio_option =
new ilRadioOption($lng->txt(
"access_users"),
"users");
273 $radio_group->addOption($radio_option);
274 $radio_option =
new ilRadioOption($lng->txt(
"access_public"),
"public");
275 $radio_group->addOption($radio_option);
276 $radio_group->
setInfo($lng->txt(
"mcst_visibility_info"));
277 $radio_group->setRequired(
true);
278 $radio_group->setValue($this->object->getDefaultAccess() == 0 ?
"users" :
"public");
279 $this->form_gui->addItem($radio_group);
284 $dur->
setInfo($lng->txt(
"mcst_duration_info"));
285 $dur->setShowDays(
false);
286 $dur->setShowHours(
true);
287 $dur->setShowSeconds(
true);
288 $this->form_gui->addItem($dur);
293 $section->setTitle($lng->txt(
"mcst_".strtolower($purpose).
"_title"));
295 if ($a_mode !=
"create")
300 $label->setInfo($lng->txt(
"mcst_current_value_info"));
301 $this->form_gui->addItem($label);
302 $this->form_gui->addItem($value);
306 $file->setSuffixes($this->purposeSuffixes[$purpose]);
307 $this->form_gui->addItem(
$file);
310 $text_input->setInfo($lng->txt(
"mcst_reference_info"));
311 $this->form_gui->addItem($text_input);
312 if ($purpose !=
"Standard")
315 $clearCheckBox->setPostVar(
"delete_".$purpose);
316 $clearCheckBox->setTitle($lng->txt(
"mcst_clear_purpose_title"));
317 $this->form_gui->addItem($clearCheckBox);
323 if ($a_mode ==
"create")
325 $this->form_gui->setTitle($lng->txt(
"mcst_add_new_item"));
326 $this->form_gui->addCommandButton(
"saveCastItem", $lng->txt(
"save"));
330 $this->form_gui->setTitle($lng->txt(
"mcst_edit_item"));
331 $this->form_gui->addCommandButton(
"updateCastItem", $lng->txt(
"save"));
333 $this->form_gui->addCommandButton(
"listItems", $lng->txt(
"cancel"));
334 $this->form_gui->setFormAction($ilCtrl->getFormAction($this,
"saveCastItem"));
346 if (count ($mediaItems) > 0)
348 foreach ($mediaItems as $med)
350 if (!isset ($values[
"title"]))
353 $values[
"title"] = $this->mcst_item->getTitle();
354 $values[
"description"] = $this->mcst_item->getContent();
355 $values[
"visibility"] = $this->mcst_item->getVisibility();
356 $length = explode(
":", $this->mcst_item->getPlaytime());
357 $values[
"duration"] = array(
"hh" => $length[0],
"mm" => $length[1],
"ss" => $length[2]);
360 $values[
"value_".$med->getPurpose()] = (strlen($med->getLocation())> 100) ?
"...".substr($med->getLocation(), strlen($med->getLocation()) - 100) : $med->getLocation();
361 $values[
"label_value_".$med->getPurpose()] = (strlen($med->getLocation())> 100) ?
"...".substr($med->getLocation(), strlen($med->getLocation()) - 100) : $med->getLocation();
365 if (!isset ($values[
"value_".$purpose]))
367 $values[
"label_value_".$purpose] = $lng->txt(
"none");
368 $values[
"value_".$purpose] = $lng->txt(
"none");
371 $this->form_gui->setValuesByArray($values);
385 if ($_POST[
"url_Standard"] ==
"" && !$_FILES[
'file_Standard'][
'tmp_name']) {
388 }
else if ($this->form_gui->checkInput())
392 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
401 $title = $this->form_gui->getInput(
"title") !=
"" ? $this->form_gui->getInput(
"title") : basename(
$file);
402 $description = $this->form_gui->getInput(
"description");
404 $mob->setDescription($description);
411 foreach ($this->additionalPurposes as $purpose)
414 $file_gui = $this->form_gui->getInput(
"file_".$purpose);
415 $url_gui = $this->form_gui->getInput(
"url_".$purpose);
416 if ($url_gui || $file_gui[
"size"] > 0)
429 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
432 include_once(
"./Services/News/classes/class.ilNewsItem.php");
434 $mc_item->setMobId($mob->getId());
436 $mc_item->setContextObjId($this->object->getId());
437 $mc_item->setContextObjType($this->object->getType());
438 $mc_item->setUserId($ilUser->getId());
439 $mc_item->setPlaytime($duration);
440 $mc_item->setTitle(
$title);
441 $mc_item->setContent($description);
442 $mc_item->setLimitation(
false);
443 if ($enable_internal_rss)
445 $mc_item->setVisibility($this->form_gui->getInput(
"visibility"));
449 $mc_item->setVisibility(
"users");
453 $ilCtrl->redirect($this,
"listItems");
469 $duration = isset($this->form_gui) ? $this->form_gui->getInput(
"duration") :
"";
470 if ($duration[
"hh"] == 0 && $duration[
"mm"] == 0 && $duration[
"ss"] == 0 && is_file(
$file))
472 include_once(
"./Services/MediaObjects/classes/class.ilMediaAnalyzer.php");
474 $ana->setFile(
$file);
476 $dur = $ana->getPlaytimeString();
477 $dur = explode(
":", $dur);
478 $duration[
"mm"] = $dur[0];
479 $duration[
"ss"] = $dur[1];
481 $duration = str_pad($duration[
"hh"], 2 ,
"0", STR_PAD_LEFT).
":".
482 str_pad($duration[
"mm"], 2 ,
"0", STR_PAD_LEFT).
":".
483 str_pad($duration[
"ss"], 2 ,
"0", STR_PAD_LEFT);
496 $mob->addMediaItem($mediaItem);
497 $mediaItem->setPurpose($purpose);
509 $purpose = $mediaItem->getPurpose();
510 $url_gui = $this->form_gui->getInput (
"url_".$purpose);
511 $file_gui = $this->form_gui->getInput (
"file_".$purpose);
515 $file = $this->form_gui->getInput (
"url_".$purpose);
517 $location = $this->form_gui->getInput (
"url_".$purpose);
518 $locationType =
"Reference";
519 } elseif ($file_gui[
"size"] > 0){
523 if (!is_dir($mob_dir))
524 $mob->createDirectory();
531 $locationType =
"LocalFile";
543 $mediaItem->setFormat($format);
545 $mediaItem->setLocationType($locationType);
546 $mediaItem->setHAlign(
"Left");
547 $mediaItem->setHeight(self::isAudio($format)?0:180);
551 if ($purpose ==
"Standard")
556 $mob->setDescription($format);
573 if ($this->form_gui->checkInput())
576 include_once(
"./Services/News/classes/class.ilNewsItem.php");
578 $mob_id = $mc_item->getMobId();
581 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
587 if ($this->form_gui->getInput(
"delete_".$purpose))
589 $mob->removeMediaItem($purpose);
590 $log->write (
"Mcst: deleting purpose $purpose");
593 $media_item = $mob->getMediaItem($purpose);
594 $url_gui = $this->form_gui->getInput(
"url_".$purpose);
595 $file_gui = $this->form_gui->getInput(
"file_".$purpose);
597 if ($media_item == null)
599 if ($purpose !=
"Standard" &&
600 ($url_gui || $file_gui[
"size"]>0))
611 if ($purpose ==
"Standard")
614 $title = $this->form_gui->getInput(
"title") !=
"" ? $this->form_gui->getInput(
"title") : basename(
$file);
615 $description = $this->form_gui->getInput(
"description");
618 $mob->setDescription($description);
631 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
633 $mc_item->setUserId($ilUser->getId());
634 if (isset($duration))
636 $mc_item->setPlaytime($duration);
638 $mc_item->setTitle(
$title);
639 $mc_item->setContent($description);
640 if ($enable_internal_rss)
642 $mc_item->setVisibility($this->form_gui->getInput(
"visibility"));
646 $ilCtrl->redirect($this,
"listItems");
663 if (!is_array($_POST[
"item_id"]))
669 include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
673 $c_gui->setFormAction($ilCtrl->getFormAction($this,
"deleteItems"));
674 $c_gui->setHeaderText($lng->txt(
"info_delete_sure"));
675 $c_gui->setCancel($lng->txt(
"cancel"),
"listItems");
676 $c_gui->setConfirm($lng->txt(
"confirm"),
"deleteItems");
679 include_once(
"./Services/News/classes/class.ilNewsItem.php");
680 foreach($_POST[
"item_id"] as $item_id)
683 $c_gui->addItem(
"item_id[]", $item_id, $item->getTitle(),
687 $tpl->setContent($c_gui->getHTML());
700 foreach($_POST[
"item_id"] as $item_id)
706 $ilCtrl->redirect($this,
"listItems");
718 $mob = $mc_item->getMobId();
719 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
722 $purpose =
$_GET[
"purpose"];
723 $m_item = $mob->getMediaItem($purpose);
724 if ($m_item->getLocationType() !=
"Reference")
726 $file = $mob_dir.
"/".$m_item->getLocation();
733 $ilCtrl->redirect($this,
"listItems");
751 $mob = $mc_item->getMobId();
752 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
755 $m_item = $mob->getMediaItem(
"Standard");
756 $file = $mob_dir.
"/".$m_item->getLocation();
759 $mc_item->setPlaytime($duration);
762 $ilCtrl->redirect($this,
"listItems");
773 $this->ctrl->setCmd(
"showSummary");
774 $this->ctrl->setCmdClass(
"ilinfoscreengui");
783 global $ilAccess, $ilUser;
785 if (!$ilAccess->checkAccess(
"visible",
"", $this->object->getRefId()))
787 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
790 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
793 $info->enablePrivateNotes();
804 $this->lng->loadLanguageModule(
"meta");
805 $this->lng->loadLanguageModule(
"mcst");
806 $med_items = $this->
object->getItemsArray();
807 $info->addSection($this->lng->txt(
"meta_general"));
808 $info->addProperty($this->lng->txt(
"mcst_nr_items"),
809 (int) count($med_items));
811 if (count($med_items) > 0)
813 $cur = current($med_items);
821 $info->addProperty($this->lng->txt(
"mcst_last_submission"), $last);
824 $this->ctrl->forwardCommand($info);
837 if ($ilAccess->checkAccess(
'read',
"", $this->object->getRefId()))
839 $tabs_gui->addTarget(
"view_content",
840 $this->ctrl->getLinkTarget($this,
"listItems"), array(
"",
"listItems"),
841 array(strtolower(get_class($this)),
""));
845 if ($ilAccess->checkAccess(
'visible',
"", $this->object->getRefId()))
847 $force_active = ($ilCtrl->getNextClass() ==
"ilinfoscreengui"
848 ||
$_GET[
"cmd"] ==
"infoScreen")
851 $tabs_gui->addTarget(
"info_short",
852 $this->ctrl->getLinkTargetByClass(
853 "ilinfoscreengui",
"showSummary"),
855 "",
"", $force_active);
859 if ($ilAccess->checkAccess(
'write',
"", $this->object->getRefId()))
861 $tabs_gui->addTarget(
"settings",
862 $this->ctrl->getLinkTarget($this,
"editSettings"), array(
"editSettings"),
863 array(strtolower(get_class($this)),
""));
867 if ($ilAccess->checkAccess(
'edit_permission',
"", $this->object->getRefId()))
869 $tabs_gui->addTarget(
"perm_settings",
870 $this->ctrl->getLinkTargetByClass(
"ilpermissiongui",
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
884 $tpl->setContent($this->form_gui->getHtml());
894 $lng->loadLanguageModule(
"mcst");
896 include(
"Services/Form/classes/class.ilPropertyFormGUI.php");
898 $this->form_gui->setTitle($lng->txt(
"mcst_settings"));
902 $tit->
setValue($this->object->getTitle());
903 $tit->setRequired(
true);
904 $this->form_gui->addItem($tit);
908 $des->
setValue($this->object->getLongDescription());
909 $this->form_gui->addItem($des);
913 $online->
setChecked($this->object->getOnline());
914 $this->form_gui->addItem($online);
917 $downloadable =
new ilCheckboxInputGUI($lng->txt(
"mcst_downloadable"),
"downloadable");
918 $downloadable->
setChecked($this->object->getDownloadable());
919 $downloadable->setInfo($lng->txt(
"mcst_downloadable_info"));
920 $this->form_gui->addItem($downloadable);
923 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
927 $radio_option =
new ilRadioOption($lng->txt(
"news_visibility_users"),
"0");
928 $radio_group->addOption($radio_option);
929 $radio_option =
new ilRadioOption($lng->txt(
"news_visibility_public"),
"1");
930 $radio_group->addOption($radio_option);
931 $radio_group->
setInfo($lng->txt(
"news_news_item_visibility_info"));
932 $radio_group->setRequired(
false);
933 $radio_group->setValue($this->object->getDefaultAccess());
934 #$ch->addSubItem($radio_group);
935 $this->form_gui->addItem($radio_group);
938 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
941 $ch->
setInfo($lng->txt(
"news_public_feed_info"));
942 $ch->setChecked($public_feed);
943 $this->form_gui->addItem($ch);
946 $incl_files =
new ilCheckboxInputGUI($lng->txt(
"mcst_incl_files_in_rss"),
"public_files");
947 $incl_files->
setChecked($this->object->getPublicFiles());
948 $incl_files->setInfo($lng->txt(
"mcst_incl_files_in_rss_info"));
949 #$ch->addSubItem($incl_files);
950 $this->form_gui->addItem($incl_files);
953 $this->form_gui->addCommandButton(
"saveSettings", $lng->txt(
"save"));
954 $this->form_gui->setFormAction($ilCtrl->getFormAction($this,
"saveSettings"));
967 if ($this->form_gui->checkInput())
970 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
972 $this->
object->setTitle($this->form_gui->getInput(
"title"));
973 $this->
object->setDescription($this->form_gui->getInput(
"description"));
974 $this->
object->setOnline($this->form_gui->getInput(
"online"));
975 $this->
object->setDownloadable($this->form_gui->getInput(
"downloadable"));
977 if ($enable_internal_rss)
979 $this->
object->setPublicFiles($this->form_gui->getInput(
"public_files"));
980 $this->
object->setDefaultAccess($this->form_gui->getInput(
"defaultaccess"));
982 $this->
object->update();
984 if ($enable_internal_rss)
986 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
988 $this->form_gui->getInput(
"extra_feed"),
989 0, $this->
object->getId());
993 $ilCtrl->redirect($this,
"editSettings");
997 $this->form_gui->setValuesByPost();
998 $this->tpl->setContent($this->form_gui->getHTML());
1007 if (is_object($this->
object))
1009 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
"listItems"),
"",
$_GET[
"ref_id"]);
1017 if ($ilAccess->checkAccess(
"read",
"", $a_target))
1019 $_GET[
"cmd"] =
"listItems";
1020 $_GET[
"ref_id"] = $a_target;
1021 $_GET[
"baseClass"] =
"ilmediacasthandlergui";
1022 $_GET[
"cmdClass"] =
"ilobjmediacastgui";
1023 include(
"ilias.php");
1026 else if ($ilAccess->checkAccess(
"visible",
"", $a_target))
1028 $_GET[
"cmd"] =
"infoScreen";
1029 $_GET[
"ref_id"] = $a_target;
1030 include(
"repository.php");
1033 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
1035 $_GET[
"cmd"] =
"frameset";
1036 $_GET[
"target"] =
"";
1037 $_GET[
"ref_id"] = ROOT_FOLDER_ID;
1040 include(
"repository.php");
1044 $ilErr->raiseError($lng->txt(
"msg_no_perm_read"), $ilErr->FATAL);
1055 return strpos($extension,
"audio") !==
false;
1065 include_once(
"./Services/News/classes/class.ilNewsItem.php");
1068 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1080 include_once(
"./Services/News/classes/class.ilNewsItem.php");
1083 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1097 if ($_POST[
"value_".$purpose])
1099 $_POST[
"label_value_".$purpose] = $_POST[
"value_".$purpose];
1103 $this->form_gui->setValuesByPost();
1104 $tpl->setContent($this->form_gui->getHTML());