5 require_once
"./classes/class.ilObjectGUI.php";
32 $this->
ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
33 $lng->loadLanguageModule(
"mcst");
34 $lng->loadLanguageModule(
"news");
36 $ilCtrl->saveParameter($this,
"item_id");
38 include_once (
"./Modules/MediaCast/classes/class.ilMediaCastSettings.php");
40 $this->purposeSuffixes = $settings->getPurposeSuffixes();
41 $this->mimeTypes = $settings->getMimeTypes();
48 $next_class = $this->ctrl->getNextClass($this);
49 $cmd = $this->ctrl->getCmd();
54 case "ilinfoscreengui":
59 case 'ilpermissiongui':
60 include_once(
"Services/AccessControl/classes/class.ilPermissionGUI.php");
62 $ret =& $this->ctrl->forwardCommand($perm_gui);
71 if (
$cmd !=
"infoScreenObject")
109 ilUtil::redirect(
"ilias.php?baseClass=ilMediaCastHandlerGUI&ref_id=".$newObj->getRefId().
"&cmd=editSettings");
122 $med_items = $this->
object->getItemsArray();
124 include_once(
"./Modules/MediaCast/classes/class.ilMediaCastTableGUI.php");
127 $table_gui->setTitle($lng->txt(
"mcst_media_cast"));
128 $table_gui->setData($med_items);
130 if ($ilAccess->checkAccess(
"write",
"",
$_GET[
"ref_id"]))
132 $table_gui->addCommandButton(
"addCastItem", $lng->txt(
"add"));
133 $table_gui->addMultiCommand(
"confirmDeletionItems", $lng->txt(
"delete"));
134 $table_gui->setSelectAllCheckbox(
"item_id");
137 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
139 0, $this->object->getId());
145 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
148 if ($enable_internal_rss)
151 $items = $this->
object->getItemsArray();
152 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
157 foreach ($items as $id => $item)
161 if ($mob->hasPurposeItem($purpose))
167 $url = ILIAS_HTTP_PATH.
"/feed.php?client_id=".rawurlencode(CLIENT_ID).
"&".
"ref_id=".$_GET[
"ref_id"].
"&purpose=$purpose";
168 $title = $lng->txt(
"news_feed_url");
173 $row1 .=
"<A href='$url' target='$target'><img src='$icon' alt='$title'/></A>";
174 if ($this->object->getPublicFiles())
176 $url = preg_replace(
"/https?/i",
"itpc",$url);
177 $title = $lng->txt(
"news_feed_url");
180 $row2 .=
"<A href='$url' target='$target'><img src='$icon' alt='$title'/></A>";
192 $html .=
" ".$row2;
196 $table_gui->setHeaderHTML($html);
201 $tpl->setContent($table_gui->getHTML());
203 $tpl->setPermanentLink($this->object->getType(), $this->
object->getRefId());
216 $tpl->setContent($this->form_gui->getHTML());
228 $tpl->setContent($this->form_gui->getHTML());
240 $lng->loadLanguageModule(
"mcst");
243 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
245 include(
"Services/Form/classes/class.ilPropertyFormGUI.php");
247 $this->form_gui->setMultipart(
true);
252 $this->form_gui->addItem($text_input);
257 $this->form_gui->addItem($text_area);
260 if ($enable_internal_rss)
263 $radio_option =
new ilRadioOption($lng->txt(
"access_users"),
"users");
264 $radio_group->addOption($radio_option);
265 $radio_option =
new ilRadioOption($lng->txt(
"access_public"),
"public");
266 $radio_group->addOption($radio_option);
267 $radio_group->
setInfo($lng->txt(
"mcst_visibility_info"));
268 $radio_group->setRequired(
true);
269 $radio_group->setValue($this->object->getDefaultAccess() == 0 ?
"users" :
"public");
270 $this->form_gui->addItem($radio_group);
275 $dur->
setInfo($lng->txt(
"mcst_duration_info"));
276 $dur->setShowDays(
false);
277 $dur->setShowHours(
true);
278 $dur->setShowSeconds(
true);
279 $this->form_gui->addItem($dur);
284 $section->setTitle($lng->txt(
"mcst_".strtolower($purpose).
"_title"));
286 if ($a_mode !=
"create")
291 $label->setInfo($lng->txt(
"mcst_current_value_info"));
292 $this->form_gui->addItem($label);
293 $this->form_gui->addItem($value);
297 $file->setSuffixes($this->purposeSuffixes[$purpose]);
298 $this->form_gui->addItem(
$file);
301 $text_input->setInfo($lng->txt(
"mcst_reference_info"));
302 $this->form_gui->addItem($text_input);
303 if ($purpose !=
"Standard")
306 $clearCheckBox->setPostVar(
"delete_".$purpose);
307 $clearCheckBox->setTitle($lng->txt(
"mcst_clear_purpose_title"));
308 $this->form_gui->addItem($clearCheckBox);
311 $mimeTypeSelection->setPostVar(
"mimetype_".$purpose);
312 $mimeTypeSelection->setTitle($lng->txt(
"mcst_mimetype"));
313 $mimeTypeSelection->setInfo($lng->txt(
"mcst_mimetype_info"));
314 $options = array($lng->txt(
"mcst_automatic_detection"));
315 $options = array_merge($options, $this->mimeTypes);
316 $mimeTypeSelection->setOptions($options);
317 $this->form_gui->addItem($mimeTypeSelection);
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();
362 $mimeTypesValuesAsKey = array_flip($this->mimeTypes);
363 if (array_key_exists($med->getFormat(), $mimeTypesValuesAsKey))
364 $values[
"mimetype_".$med->getPurpose()] = $mimeTypesValuesAsKey[$med->getFormat()]+1;
368 if (!isset ($values[
"value_".$purpose]))
370 $values[
"label_value_".$purpose] = $lng->txt(
"none");
371 $values[
"value_".$purpose] = $lng->txt(
"none");
374 $this->form_gui->setValuesByArray($values);
388 if (
$_POST[
"url_Standard"] ==
"" && !$_FILES[
'file_Standard'][
'tmp_name']) {
391 }
else if ($this->form_gui->checkInput())
395 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
404 $title = $this->form_gui->getInput(
"title") !=
"" ? $this->form_gui->getInput(
"title") : basename(
$file);
405 $description = $this->form_gui->getInput(
"description");
407 $mob->setDescription($description);
414 foreach ($this->additionalPurposes as $purpose)
417 $file_gui = $this->form_gui->getInput(
"file_".$purpose);
418 $url_gui = $this->form_gui->getInput(
"url_".$purpose);
419 if ($url_gui || $file_gui[
"size"] > 0)
432 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
435 include_once(
"./Services/News/classes/class.ilNewsItem.php");
437 $mc_item->setMobId($mob->getId());
439 $mc_item->setContextObjId($this->object->getId());
440 $mc_item->setContextObjType($this->object->getType());
441 $mc_item->setUserId($ilUser->getId());
442 $mc_item->setPlaytime($duration);
443 $mc_item->setTitle(
$title);
444 $mc_item->setContent($description);
445 $mc_item->setLimitation(
false);
446 if ($enable_internal_rss)
448 $mc_item->setVisibility($this->form_gui->getInput(
"visibility"));
452 $mc_item->setVisibility(
"users");
456 $ilCtrl->redirect($this,
"listItems");
472 $duration = isset($this->form_gui) ? $this->form_gui->getInput(
"duration") :
"";
473 if ($duration[
"hh"] == 0 && $duration[
"mm"] == 0 && $duration[
"ss"] == 0 && is_file(
$file))
475 include_once(
"./Services/MediaObjects/classes/class.ilMediaAnalyzer.php");
477 $ana->setFile(
$file);
479 $dur = $ana->getPlaytimeString();
480 $dur = explode(
":", $dur);
481 $duration[
"mm"] = $dur[0];
482 $duration[
"ss"] = $dur[1];
484 $duration = str_pad($duration[
"hh"], 2 ,
"0", STR_PAD_LEFT).
":".
485 str_pad($duration[
"mm"], 2 ,
"0", STR_PAD_LEFT).
":".
486 str_pad($duration[
"ss"], 2 ,
"0", STR_PAD_LEFT);
499 $mob->addMediaItem($mediaItem);
500 $mediaItem->setPurpose($purpose);
512 $purpose = $mediaItem->getPurpose();
513 $url_gui = $this->form_gui->getInput (
"url_".$purpose);
514 $file_gui = $this->form_gui->getInput (
"file_".$purpose);
518 $file = $this->form_gui->getInput (
"url_".$purpose);
520 $location = $this->form_gui->getInput (
"url_".$purpose);
521 $locationType =
"Reference";
522 }
elseif ($file_gui[
"size"] > 0){
526 if (!is_dir($mob_dir))
527 $mob->createDirectory();
534 $locationType =
"LocalFile";
541 if ((
int)
$_POST[
"mimetype_".$purpose] != 0) {
544 if ((
int)
$_POST[
"mimetype_".$purpose]-1 < count ($this->mimeTypes))
546 $format = $this->mimeTypes[(int)
$_POST[
"mimetype_".$purpose] - 1];
547 $mediaItem->setFormat($format);
549 }
elseif ($mediaItem->getLocation () !=
"") {
551 $mediaItem->setFormat($format);
563 $mediaItem->setFormat($format);
565 $mediaItem->setLocationType($locationType);
566 $mediaItem->setHAlign(
"Left");
567 $mediaItem->setHeight(self::isAudio($format)?0:180);
570 if ($purpose ==
"Standard")
575 $mob->setDescription($format);
592 if ($this->form_gui->checkInput())
595 include_once(
"./Services/News/classes/class.ilNewsItem.php");
597 $mob_id = $mc_item->getMobId();
600 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
606 if ($this->form_gui->getInput(
"delete_".$purpose))
608 $mob->removeMediaItem($purpose);
609 $log->write (
"Mcst: deleting purpose $purpose");
612 $media_item = $mob->getMediaItem($purpose);
613 $url_gui = $this->form_gui->getInput(
"url_".$purpose);
614 $file_gui = $this->form_gui->getInput(
"file_".$purpose);
616 if ($media_item == null)
618 if ($purpose !=
"Standard" &&
619 ($url_gui || $file_gui[
"size"]>0))
630 if ($purpose ==
"Standard")
633 $title = $this->form_gui->getInput(
"title") !=
"" ? $this->form_gui->getInput(
"title") : basename(
$file);
634 $description = $this->form_gui->getInput(
"description");
637 $mob->setDescription($description);
650 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
652 $mc_item->setUserId($ilUser->getId());
653 if (isset($duration))
655 $mc_item->setPlaytime($duration);
657 $mc_item->setTitle(
$title);
658 $mc_item->setContent($description);
659 if ($enable_internal_rss)
661 $mc_item->setVisibility($this->form_gui->getInput(
"visibility"));
665 $ilCtrl->redirect($this,
"listItems");
682 if (!is_array(
$_POST[
"item_id"]))
688 include_once(
"Services/Utilities/classes/class.ilConfirmationGUI.php");
692 $c_gui->setFormAction($ilCtrl->getFormAction($this,
"deleteItems"));
693 $c_gui->setHeaderText($lng->txt(
"info_delete_sure"));
694 $c_gui->setCancel($lng->txt(
"cancel"),
"listItems");
695 $c_gui->setConfirm($lng->txt(
"confirm"),
"deleteItems");
698 include_once(
"./Services/News/classes/class.ilNewsItem.php");
699 foreach(
$_POST[
"item_id"] as $item_id)
702 $c_gui->addItem(
"item_id[]", $item_id, $item->getTitle(),
706 $tpl->setContent($c_gui->getHTML());
719 foreach(
$_POST[
"item_id"] as $item_id)
725 $ilCtrl->redirect($this,
"listItems");
737 $mob = $mc_item->getMobId();
738 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
741 $purpose =
$_GET[
"purpose"];
742 $m_item = $mob->getMediaItem($purpose);
743 if ($m_item->getLocationType() !=
"Reference")
745 $file = $mob_dir.
"/".$m_item->getLocation();
752 $ilCtrl->redirect($this,
"listItems");
770 $mob = $mc_item->getMobId();
771 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
774 $m_item = $mob->getMediaItem(
"Standard");
775 $file = $mob_dir.
"/".$m_item->getLocation();
777 if ($duration !=
"00:00:00")
779 $mc_item->setPlaytime($duration);
788 $ilCtrl->redirect($this,
"listItems");
799 $this->ctrl->setCmd(
"showSummary");
800 $this->ctrl->setCmdClass(
"ilinfoscreengui");
809 global $ilAccess, $ilUser;
811 if (!$ilAccess->checkAccess(
"visible",
"", $this->object->getRefId()))
813 $this->ilias->raiseError($this->lng->txt(
"msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
816 include_once(
"./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
819 $info->enablePrivateNotes();
830 $this->lng->loadLanguageModule(
"meta");
831 $this->lng->loadLanguageModule(
"mcst");
832 $med_items = $this->
object->getItemsArray();
833 $info->addSection($this->lng->txt(
"meta_general"));
834 $info->addProperty($this->lng->txt(
"mcst_nr_items"),
835 (int) count($med_items));
837 if (count($med_items) > 0)
839 $cur = current($med_items);
847 $info->addProperty($this->lng->txt(
"mcst_last_submission"), $last);
850 $this->ctrl->forwardCommand($info);
863 if ($ilAccess->checkAccess(
'read',
"", $this->object->getRefId()))
865 $tabs_gui->addTarget(
"view_content",
866 $this->ctrl->getLinkTarget($this,
"listItems"), array(
"",
"listItems"),
867 array(strtolower(get_class($this)),
""));
871 if ($ilAccess->checkAccess(
'visible',
"", $this->object->getRefId()))
873 $force_active = ($ilCtrl->getNextClass() ==
"ilinfoscreengui"
874 ||
$_GET[
"cmd"] ==
"infoScreen")
877 $tabs_gui->addTarget(
"info_short",
878 $this->ctrl->getLinkTargetByClass(
879 "ilinfoscreengui",
"showSummary"),
881 "",
"", $force_active);
885 if ($ilAccess->checkAccess(
'write',
"", $this->object->getRefId()))
887 $tabs_gui->addTarget(
"settings",
888 $this->ctrl->getLinkTarget($this,
"editSettings"), array(
"editSettings"),
889 array(strtolower(get_class($this)),
""));
893 if ($ilAccess->checkAccess(
'edit_permission',
"", $this->object->getRefId()))
895 $tabs_gui->addTarget(
"perm_settings",
896 $this->ctrl->getLinkTargetByClass(
"ilpermissiongui",
"perm"), array(
"perm",
"info",
"owner"),
'ilpermissiongui');
910 $tpl->setContent($this->form_gui->getHtml());
920 $lng->loadLanguageModule(
"mcst");
922 include(
"Services/Form/classes/class.ilPropertyFormGUI.php");
924 $this->form_gui->setTitle($lng->txt(
"mcst_settings"));
928 $tit->
setValue($this->object->getTitle());
929 $tit->setRequired(
true);
930 $this->form_gui->addItem($tit);
934 $des->
setValue($this->object->getLongDescription());
935 $this->form_gui->addItem($des);
939 $online->
setChecked($this->object->getOnline());
940 $this->form_gui->addItem($online);
943 $downloadable =
new ilCheckboxInputGUI($lng->txt(
"mcst_downloadable"),
"downloadable");
944 $downloadable->
setChecked($this->object->getDownloadable());
945 $downloadable->setInfo($lng->txt(
"mcst_downloadable_info"));
946 $this->form_gui->addItem($downloadable);
949 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
952 if ($enable_internal_rss)
955 $radio_option =
new ilRadioOption($lng->txt(
"news_visibility_users"),
"0");
956 $radio_group->addOption($radio_option);
957 $radio_option =
new ilRadioOption($lng->txt(
"news_visibility_public"),
"1");
958 $radio_group->addOption($radio_option);
959 $radio_group->
setInfo($lng->txt(
"news_news_item_visibility_info"));
960 $radio_group->setRequired(
false);
961 $radio_group->setValue($this->object->getDefaultAccess());
962 #$ch->addSubItem($radio_group);
963 $this->form_gui->addItem($radio_group);
966 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
969 $ch->
setInfo($lng->txt(
"news_public_feed_info"));
970 $ch->setChecked($public_feed);
971 $this->form_gui->addItem($ch);
974 $incl_files =
new ilCheckboxInputGUI($lng->txt(
"mcst_incl_files_in_rss"),
"public_files");
975 $incl_files->
setChecked($this->object->getPublicFiles());
976 $incl_files->setInfo($lng->txt(
"mcst_incl_files_in_rss_info"));
977 #$ch->addSubItem($incl_files);
978 $this->form_gui->addItem($incl_files);
982 $this->form_gui->addCommandButton(
"saveSettings", $lng->txt(
"save"));
983 $this->form_gui->setFormAction($ilCtrl->getFormAction($this,
"saveSettings"));
996 if ($this->form_gui->checkInput())
999 $enable_internal_rss = $news_set->get(
"enable_rss_for_internal");
1001 $this->
object->setTitle($this->form_gui->getInput(
"title"));
1002 $this->
object->setDescription($this->form_gui->getInput(
"description"));
1003 $this->
object->setOnline($this->form_gui->getInput(
"online"));
1004 $this->
object->setDownloadable($this->form_gui->getInput(
"downloadable"));
1006 if ($enable_internal_rss)
1008 $this->
object->setPublicFiles($this->form_gui->getInput(
"public_files"));
1009 $this->
object->setDefaultAccess($this->form_gui->getInput(
"defaultaccess"));
1011 $this->
object->update();
1013 if ($enable_internal_rss)
1015 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
1017 $this->form_gui->getInput(
"extra_feed"),
1018 0, $this->
object->getId());
1022 $ilCtrl->redirect($this,
"editSettings");
1026 $this->form_gui->setValuesByPost();
1027 $this->tpl->setContent($this->form_gui->getHTML());
1036 if (is_object($this->
object))
1038 $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this,
"listItems"),
"",
$_GET[
"ref_id"]);
1046 if ($ilAccess->checkAccess(
"read",
"", $a_target))
1048 $_GET[
"cmd"] =
"listItems";
1049 $_GET[
"ref_id"] = $a_target;
1050 $_GET[
"baseClass"] =
"ilmediacasthandlergui";
1051 $_GET[
"cmdClass"] =
"ilobjmediacastgui";
1052 include(
"ilias.php");
1055 else if ($ilAccess->checkAccess(
"visible",
"", $a_target))
1057 $_GET[
"cmd"] =
"infoScreen";
1058 $_GET[
"ref_id"] = $a_target;
1059 include(
"repository.php");
1062 else if ($ilAccess->checkAccess(
"read",
"", ROOT_FOLDER_ID))
1064 $_GET[
"cmd"] =
"frameset";
1065 $_GET[
"target"] =
"";
1066 $_GET[
"ref_id"] = ROOT_FOLDER_ID;
1069 include(
"repository.php");
1073 $ilErr->raiseError($lng->txt(
"msg_no_perm_read"), $ilErr->FATAL);
1084 return strpos($extension,
"audio") !==
false;
1094 include_once(
"./Services/News/classes/class.ilNewsItem.php");
1097 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1109 include_once(
"./Services/News/classes/class.ilNewsItem.php");
1112 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php");
1126 if (
$_POST[
"value_".$purpose])
1128 $_POST[
"label_value_".$purpose] =
$_POST[
"value_".$purpose];
1132 $this->form_gui->setValuesByPost();
1133 $tpl->setContent($this->form_gui->getHTML());