5 require_once
"./classes/class.ilObjectGUI.php";
33 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
34 $lng->loadLanguageModule(
"mcst");
35 $lng->loadLanguageModule(
"news");
37 $ilCtrl->saveParameter($this,
"item_id");
39 include_once (
"./Modules/MediaCast/classes/class.ilMediaCastSettings.php");
41 $this->purposeSuffixes = $settings->getPurposeSuffixes();
42 $this->mimeTypes = $settings->getMimeTypes();
47 global $ilUser, $ilTabs;
49 $next_class = $this->ctrl->getNextClass($this);
50 $cmd = $this->ctrl->getCmd();
55 case "ilinfoscreengui":
62 $ilTabs->activateTab(
"export");
63 include_once(
"./Services/Export/classes/class.ilExportGUI.php");
65 $exp_gui->addFormat(
"xml");
66 $ret = $this->ctrl->forwardCommand($exp_gui);
70 case 'ilpermissiongui':
71 $ilTabs->activateTab(
"id_permissions");
72 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
74 $ret =& $this->ctrl->forwardCommand($perm_gui);
77 case "ilcommonactiondispatchergui":
78 include_once(
"Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
80 $this->ctrl->forwardCommand($gui);
89 if (
$cmd !=
"infoScreenObject")
109 $forms = array(self::CFORM_NEW => $this->
initCreateForm($a_new_type),
123 ilUtil::redirect(
"ilias.php?baseClass=ilMediaCastHandlerGUI&ref_id=".$newObj->getRefId().
"&cmd=editSettings");
131 global
$tpl,
$lng, $ilAccess, $ilTabs;
134 $ilTabs->activateTab(
"id_content");
136 $med_items = $this->
object->getItemsArray();
138 include_once(
"./Modules/MediaCast/classes/class.ilMediaCastTableGUI.php");
141 $table_gui->setTitle($lng->txt(
"mcst_media_cast"));
142 $table_gui->setData($med_items);
144 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"]))
146 $table_gui->addCommandButton(
"addCastItem", $lng->txt(
"add"));
147 $table_gui->addMultiCommand(
"confirmDeletionItems", $lng->txt(
"delete"));
148 $table_gui->setSelectAllCheckbox(
"item_id");
151 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
153 0, $this->object->getId());
159 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
162 if ($enable_internal_rss)
165 $items = $this->
object->getItemsArray();
166 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
171 foreach ($items as $id => $item)
175 if ($mob->hasPurposeItem($purpose))
181 $url = ILIAS_HTTP_PATH.
"/feed.php?client_id=".rawurlencode(CLIENT_ID).
"&".
"ref_id=".$_GET[
"ref_id"].
"&purpose=$purpose";
182 $title = $lng->txt(
"news_feed_url");
187 $row1 .=
"<A href='$url' target='$target'><img src='$icon' alt='$title'/></A>";
188 if ($this->object->getPublicFiles())
190 $url = preg_replace(
"/https?/i",
"itpc",$url);
191 $title = $lng->txt(
"news_feed_url");
194 $row2 .=
"<A href='$url' target='$target'><img src='$icon' alt='$title'/></A>";
206 $html .=
" ".$row2;
210 $table_gui->setHeaderHTML($html);
215 $tpl->setContent($table_gui->getHTML());
217 $tpl->setPermanentLink($this->object->getType(), $this->
object->getRefId());
230 $tpl->setContent($this->form_gui->getHTML());
242 $tpl->setContent($this->form_gui->getHTML());
253 $ilTabs->activateTab(
"id_content");
255 $lng->loadLanguageModule(
"mcst");
258 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
260 include(
"Services/Form/classes/class.ilPropertyFormGUI.php");
262 $this->form_gui->setMultipart(
true);
267 $this->form_gui->addItem($text_input);
272 $this->form_gui->addItem($text_area);
275 if ($enable_internal_rss)
278 $radio_option =
new ilRadioOption($lng->txt(
"access_users"),
"users");
279 $radio_group->addOption($radio_option);
280 $radio_option =
new ilRadioOption($lng->txt(
"access_public"),
"public");
281 $radio_group->addOption($radio_option);
282 $radio_group->
setInfo($lng->txt(
"mcst_visibility_info"));
283 $radio_group->setRequired(
true);
284 $radio_group->setValue($this->object->getDefaultAccess() == 0 ?
"users" :
"public");
285 $this->form_gui->addItem($radio_group);
290 $dur->
setInfo($lng->txt(
"mcst_duration_info"));
291 $dur->setShowDays(
false);
292 $dur->setShowHours(
true);
293 $dur->setShowSeconds(
true);
294 $this->form_gui->addItem($dur);
299 $section->setTitle($lng->txt(
"mcst_".strtolower($purpose).
"_title"));
301 if ($a_mode !=
"create")
306 $label->setInfo($lng->txt(
"mcst_current_value_info"));
307 $this->form_gui->addItem($label);
308 $this->form_gui->addItem($value);
312 $file->setSuffixes($this->purposeSuffixes[$purpose]);
313 $this->form_gui->addItem(
$file);
316 $text_input->setInfo($lng->txt(
"mcst_reference_info"));
317 $this->form_gui->addItem($text_input);
318 if ($purpose !=
"Standard")
321 $clearCheckBox->setPostVar(
"delete_".$purpose);
322 $clearCheckBox->setTitle($lng->txt(
"mcst_clear_purpose_title"));
323 $this->form_gui->addItem($clearCheckBox);
326 $mimeTypeSelection->setPostVar(
"mimetype_".$purpose);
327 $mimeTypeSelection->setTitle($lng->txt(
"mcst_mimetype"));
328 $mimeTypeSelection->setInfo($lng->txt(
"mcst_mimetype_info"));
329 $options = array($lng->txt(
"mcst_automatic_detection"));
330 $options = array_merge($options, $this->mimeTypes);
331 $mimeTypeSelection->setOptions($options);
332 $this->form_gui->addItem($mimeTypeSelection);
338 if ($a_mode ==
"create")
340 $this->form_gui->setTitle($lng->txt(
"mcst_add_new_item"));
341 $this->form_gui->addCommandButton(
"saveCastItem", $lng->txt(
"save"));
345 $this->form_gui->setTitle($lng->txt(
"mcst_edit_item"));
346 $this->form_gui->addCommandButton(
"updateCastItem", $lng->txt(
"save"));
348 $this->form_gui->addCommandButton(
"listItems", $lng->txt(
"cancel"));
349 $this->form_gui->setFormAction($ilCtrl->getFormAction($this,
"saveCastItem"));
361 if (count ($mediaItems) > 0)
363 foreach ($mediaItems as $med)
365 if (!isset ($values[
"title"]))
368 $values[
"title"] = $this->mcst_item->getTitle();
369 $values[
"description"] = $this->mcst_item->getContent();
370 $values[
"visibility"] = $this->mcst_item->getVisibility();
371 $length = explode(
":", $this->mcst_item->getPlaytime());
372 $values[
"duration"] = array(
"hh" => $length[0],
"mm" => $length[1],
"ss" => $length[2]);
375 $values[
"value_".$med->getPurpose()] = (strlen($med->getLocation())> 100) ?
"...".substr($med->getLocation(), strlen($med->getLocation()) - 100) : $med->getLocation();
376 $values[
"label_value_".$med->getPurpose()] = (strlen($med->getLocation())> 100) ?
"...".substr($med->getLocation(), strlen($med->getLocation()) - 100) : $med->getLocation();
377 $mimeTypesValuesAsKey = array_flip($this->mimeTypes);
378 if (array_key_exists($med->getFormat(), $mimeTypesValuesAsKey))
379 $values[
"mimetype_".$med->getPurpose()] = $mimeTypesValuesAsKey[$med->getFormat()]+1;
383 if (!isset ($values[
"value_".$purpose]))
385 $values[
"label_value_".$purpose] = $lng->txt(
"none");
386 $values[
"value_".$purpose] = $lng->txt(
"none");
389 $this->form_gui->setValuesByArray($values);
400 $ilTabs->activateTab(
"id_content");
404 if (
$_POST[
"url_Standard"] ==
"" && !$_FILES[
'file_Standard'][
'tmp_name']) {
407 }
else if ($this->form_gui->checkInput())
411 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
420 $title = $this->form_gui->getInput(
"title") !=
"" ? $this->form_gui->getInput(
"title") : basename(
$file);
421 $description = $this->form_gui->getInput(
"description");
423 $mob->setDescription($description);
430 foreach ($this->additionalPurposes as $purpose)
433 $file_gui = $this->form_gui->getInput(
"file_".$purpose);
434 $url_gui = $this->form_gui->getInput(
"url_".$purpose);
435 if ($url_gui || $file_gui[
"size"] > 0)
448 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
451 include_once(
"./Services/News/classes/class.ilNewsItem.php");
453 $mc_item->setMobId($mob->getId());
455 $mc_item->setContextObjId($this->object->getId());
456 $mc_item->setContextObjType($this->object->getType());
457 $mc_item->setUserId($ilUser->getId());
458 $mc_item->setPlaytime($duration);
459 $mc_item->setTitle(
$title);
460 $mc_item->setContent($description);
461 $mc_item->setLimitation(
false);
462 if ($enable_internal_rss)
464 $mc_item->setVisibility($this->form_gui->getInput(
"visibility"));
468 $mc_item->setVisibility(
"users");
472 $ilCtrl->redirect($this,
"listItems");
488 $duration = isset($this->form_gui) ? $this->form_gui->getInput(
"duration") :
"";
489 if ($duration[
"hh"] == 0 && $duration[
"mm"] == 0 && $duration[
"ss"] == 0 && is_file(
$file))
491 include_once(
"./Services/MediaObjects/classes/class.ilMediaAnalyzer.php");
493 $ana->setFile(
$file);
495 $dur = $ana->getPlaytimeString();
496 $dur = explode(
":", $dur);
497 $duration[
"mm"] = $dur[0];
498 $duration[
"ss"] = $dur[1];
500 $duration = str_pad($duration[
"hh"], 2 ,
"0", STR_PAD_LEFT).
":".
501 str_pad($duration[
"mm"], 2 ,
"0", STR_PAD_LEFT).
":".
502 str_pad($duration[
"ss"], 2 ,
"0", STR_PAD_LEFT);
515 $mob->addMediaItem($mediaItem);
516 $mediaItem->setPurpose($purpose);
528 $purpose = $mediaItem->getPurpose();
529 $url_gui = $this->form_gui->getInput (
"url_".$purpose);
530 $file_gui = $this->form_gui->getInput (
"file_".$purpose);
534 $file = $this->form_gui->getInput (
"url_".$purpose);
536 $location = $this->form_gui->getInput (
"url_".$purpose);
537 $locationType =
"Reference";
538 } elseif ($file_gui[
"size"] > 0){
542 if (!is_dir($mob_dir))
543 $mob->createDirectory();
550 $locationType =
"LocalFile";
557 if ((
int)
$_POST[
"mimetype_".$purpose] != 0) {
560 if ((
int)
$_POST[
"mimetype_".$purpose]-1 < count ($this->mimeTypes))
562 $format = $this->mimeTypes[(int)
$_POST[
"mimetype_".$purpose] - 1];
563 $mediaItem->setFormat($format);
565 } elseif ($mediaItem->getLocation () !=
"") {
567 $mediaItem->setFormat($format);
579 $mediaItem->setFormat($format);
581 $mediaItem->setLocationType($locationType);
582 $mediaItem->setHAlign(
"Left");
583 $mediaItem->setHeight(self::isAudio($format)?0:180);
586 if ($purpose ==
"Standard")
591 $mob->setDescription($format);
608 if ($this->form_gui->checkInput())
611 include_once(
"./Services/News/classes/class.ilNewsItem.php");
613 $mob_id = $mc_item->getMobId();
616 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
622 if ($this->form_gui->getInput(
"delete_".$purpose))
624 $mob->removeMediaItem($purpose);
625 $log->write (
"Mcst: deleting purpose $purpose");
628 $media_item = $mob->getMediaItem($purpose);
629 $url_gui = $this->form_gui->getInput(
"url_".$purpose);
630 $file_gui = $this->form_gui->getInput(
"file_".$purpose);
632 if ($media_item == null)
634 if ($purpose !=
"Standard" &&
635 ($url_gui || $file_gui[
"size"]>0))
646 if ($purpose ==
"Standard")
649 $title = $this->form_gui->getInput(
"title") !=
"" ? $this->form_gui->getInput(
"title") : basename(
$file);
650 $description = $this->form_gui->getInput(
"description");
653 $mob->setDescription($description);
666 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
668 $mc_item->setUserId($ilUser->getId());
669 if (isset($duration))
671 $mc_item->setPlaytime($duration);
673 $mc_item->setTitle(
$title);
674 $mc_item->setContent($description);
675 if ($enable_internal_rss)
677 $mc_item->setVisibility($this->form_gui->getInput(
"visibility"));
681 $ilCtrl->redirect($this,
"listItems");
697 $ilTabs->activateTab(
"id_content");
699 if (!is_array(
$_POST[
"item_id"]))
705 include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
709 $c_gui->setFormAction($ilCtrl->getFormAction($this,
"deleteItems"));
710 $c_gui->setHeaderText($lng->txt(
"info_delete_sure"));
711 $c_gui->setCancel($lng->txt(
"cancel"),
"listItems");
712 $c_gui->setConfirm($lng->txt(
"confirm"),
"deleteItems");
715 include_once(
"./Services/News/classes/class.ilNewsItem.php");
716 foreach(
$_POST[
"item_id"] as $item_id)
719 $c_gui->addItem(
"item_id[]", $item_id, $item->getTitle(),
723 $tpl->setContent($c_gui->getHTML());
736 foreach(
$_POST[
"item_id"] as $item_id)
742 $ilCtrl->redirect($this,
"listItems");
754 $mob = $mc_item->getMobId();
755 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
758 $purpose =
$_GET[
"purpose"];
759 $m_item = $mob->getMediaItem($purpose);
760 if ($m_item->getLocationType() !=
"Reference")
762 $file = $mob_dir.
"/".$m_item->getLocation();
769 $ilCtrl->redirect($this,
"listItems");
787 $mob = $mc_item->getMobId();
788 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
791 $m_item = $mob->getMediaItem(
"Standard");
792 $file = $mob_dir.
"/".$m_item->getLocation();
794 if ($duration !=
"00:00:00")
796 $mc_item->setPlaytime($duration);
805 $ilCtrl->redirect($this,
"listItems");
816 $this->ctrl->setCmd(
"showSummary");
817 $this->ctrl->setCmdClass(
"ilinfoscreengui");
826 global $ilAccess, $ilUser, $ilTabs;
828 $ilTabs->activateTab(
"id_info");
830 if (!$ilAccess->checkAccess(
"visible",
"", $this->object->getRefId()))
832 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
835 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
838 $info->enablePrivateNotes();
849 $this->lng->loadLanguageModule(
"meta");
850 $this->lng->loadLanguageModule(
"mcst");
851 $med_items = $this->
object->getItemsArray();
852 $info->addSection($this->lng->txt(
"meta_general"));
853 $info->addProperty($this->lng->txt(
"mcst_nr_items"),
854 (int) count($med_items));
856 if (count($med_items) > 0)
858 $cur = current($med_items);
866 $info->addProperty($this->lng->txt(
"mcst_last_submission"), $last);
869 $this->ctrl->forwardCommand($info);
878 global $ilAccess, $ilTabs,
$lng;
881 if ($ilAccess->checkAccess(
'read',
"", $this->object->getRefId()))
883 $ilTabs->addTab(
"id_content",
884 $lng->txt(
"content"),
885 $this->ctrl->getLinkTarget($this,
"listItems"));
889 if ($ilAccess->checkAccess(
'visible',
"", $this->object->getRefId()))
891 $ilTabs->addTab(
"id_info",
892 $lng->txt(
"info_short"),
893 $this->ctrl->getLinkTargetByClass(
"ilinfoscreengui",
"showSummary"));
897 if ($ilAccess->checkAccess(
'write',
"", $this->object->getRefId()))
899 $ilTabs->addTab(
"id_settings",
900 $lng->txt(
"settings"),
901 $this->ctrl->getLinkTarget($this,
"editSettings"));
905 if ($ilAccess->checkAccess(
"write",
"", $this->object->getRefId()))
907 $ilTabs->addTab(
"export",
909 $this->ctrl->getLinkTargetByClass(
"ilexportgui",
""));
913 if ($ilAccess->checkAccess(
'edit_permission',
"", $this->object->getRefId()))
915 $ilTabs->addTab(
"id_permissions",
916 $lng->txt(
"perm_settings"),
917 $this->ctrl->getLinkTargetByClass(
"ilpermissiongui",
"perm"));
926 global
$tpl, $ilTabs;
929 $ilTabs->activateTab(
"id_settings");
932 $tpl->setContent($this->form_gui->getHtml());
942 $lng->loadLanguageModule(
"mcst");
944 include(
"Services/Form/classes/class.ilPropertyFormGUI.php");
946 $this->form_gui->setTitle($lng->txt(
"mcst_settings"));
950 $tit->
setValue($this->object->getTitle());
951 $tit->setRequired(
true);
952 $this->form_gui->addItem($tit);
956 $des->
setValue($this->object->getLongDescription());
957 $this->form_gui->addItem($des);
961 $online->
setChecked($this->object->getOnline());
962 $this->form_gui->addItem($online);
965 $downloadable =
new ilCheckboxInputGUI($lng->txt(
"mcst_downloadable"),
"downloadable");
966 $downloadable->
setChecked($this->object->getDownloadable());
967 $downloadable->setInfo($lng->txt(
"mcst_downloadable_info"));
968 $this->form_gui->addItem($downloadable);
971 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
974 if ($enable_internal_rss)
977 $radio_option =
new ilRadioOption($lng->txt(
"news_visibility_users"),
"0");
978 $radio_group->addOption($radio_option);
979 $radio_option =
new ilRadioOption($lng->txt(
"news_visibility_public"),
"1");
980 $radio_group->addOption($radio_option);
981 $radio_group->
setInfo($lng->txt(
"news_news_item_visibility_info"));
982 $radio_group->setRequired(
false);
983 $radio_group->setValue($this->object->getDefaultAccess());
984 #$ch->addSubItem($radio_group);
985 $this->form_gui->addItem($radio_group);
988 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
991 $ch->
setInfo($lng->txt(
"news_public_feed_info"));
992 $ch->setChecked($public_feed);
993 $this->form_gui->addItem($ch);
996 $incl_files =
new ilCheckboxInputGUI($lng->txt(
"mcst_incl_files_in_rss"),
"public_files");
997 $incl_files->
setChecked($this->object->getPublicFiles());
998 $incl_files->setInfo($lng->txt(
"mcst_incl_files_in_rss_info"));
999 #$ch->addSubItem($incl_files);
1000 $this->form_gui->addItem($incl_files);
1004 $this->form_gui->addCommandButton(
"saveSettings", $lng->txt(
"save"));
1005 $this->form_gui->setFormAction($ilCtrl->getFormAction($this,
"saveSettings"));
1016 $ilTabs->activateTab(
"id_settings");
1019 if ($this->form_gui->checkInput())
1022 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
1024 $this->
object->setTitle($this->form_gui->getInput(
"title"));
1025 $this->
object->setDescription($this->form_gui->getInput(
"description"));
1026 $this->
object->setOnline($this->form_gui->getInput(
"online"));
1027 $this->
object->setDownloadable($this->form_gui->getInput(
"downloadable"));
1029 if ($enable_internal_rss)
1031 $this->
object->setPublicFiles($this->form_gui->getInput(
"public_files"));
1032 $this->
object->setDefaultAccess($this->form_gui->getInput(
"defaultaccess"));
1034 $this->
object->update();
1036 if ($enable_internal_rss)
1038 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
1040 $this->form_gui->getInput(
"extra_feed"),
1041 0, $this->
object->getId());
1045 $ilCtrl->redirect($this,
"editSettings");
1049 $this->form_gui->setValuesByPost();
1050 $this->tpl->setContent($this->form_gui->getHTML());
1059 if (is_object($this->
object))
1061 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
"listItems"),
"",
$_GET[
"ref_id"]);
1069 if ($ilAccess->checkAccess(
"read",
"", $a_target))
1071 $_GET[
"cmd"] =
"listItems";
1072 $_GET[
"ref_id"] = $a_target;
1073 $_GET[
"baseClass"] =
"ilmediacasthandlergui";
1074 $_GET[
"cmdClass"] =
"ilobjmediacastgui";
1075 include(
"ilias.php");
1078 else if ($ilAccess->checkAccess(
"visible",
"", $a_target))
1080 $_GET[
"cmd"] =
"infoScreen";
1081 $_GET[
"ref_id"] = $a_target;
1082 include(
"repository.php");
1085 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
1087 $_GET[
"cmd"] =
"frameset";
1088 $_GET[
"target"] =
"";
1089 $_GET[
"ref_id"] = ROOT_FOLDER_ID;
1092 include(
"repository.php");
1096 $ilErr->raiseError($lng->txt(
"msg_no_perm_read"), $ilErr->FATAL);
1107 return strpos($extension,
"audio") !==
false;
1117 include_once(
"./Services/News/classes/class.ilNewsItem.php");
1120 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1132 include_once(
"./Services/News/classes/class.ilNewsItem.php");
1135 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1149 if (
$_POST[
"value_".$purpose])
1151 $_POST[
"label_value_".$purpose] =
$_POST[
"value_".$purpose];
1155 $this->form_gui->setValuesByPost();
1156 $tpl->setContent($this->form_gui->getHTML());