@@ -540,7 +540,18 @@ private function createBlock($block, $container)
540540 $ addBlock = true ;
541541 break ;
542542 case 'BlubberBlock ' :
543- // we skip this block type
543+ // convert this to a LinkBlock
544+ $ title = 'Konversation in Blubber ' ;
545+ $ url = \URLHelper::getLink ('dispatch.php/course/messenger/course ' , ['cid ' => $ this ->cid ]);
546+
547+ $ payload = array (
548+ 'type ' => 'external ' ,
549+ 'target ' => '' ,
550+ 'url ' => $ url ,
551+ 'title ' => $ title
552+ );
553+ $ block_type = 'link ' ;
554+ $ addBlock = true ;
544555 break ;
545556 case 'CanvasBlock ' :
546557 $ canvas_content = json_decode ($ block ['fields ' ]['canvas_content ' ]);
@@ -616,7 +627,18 @@ private function createBlock($block, $container)
616627 $ addBlock = true ;
617628 break ;
618629 case 'DiscussionBlock ' :
619- // we skip this block type
630+ // convert this to a LinkBlock
631+ $ title = 'Konversation in Blubber ' ;
632+ $ url = \URLHelper::getLink ('dispatch.php/course/messenger/course ' , ['cid ' => $ this ->cid ]);
633+
634+ $ payload = array (
635+ 'type ' => 'external ' ,
636+ 'target ' => '' ,
637+ 'url ' => $ url ,
638+ 'title ' => $ title
639+ );
640+ $ block_type = 'link ' ;
641+ $ addBlock = true ;
620642 break ;
621643 case 'DownloadBlock ' :
622644 $ payload = array (
@@ -644,7 +666,15 @@ private function createBlock($block, $container)
644666 $ addBlock = true ;
645667 break ;
646668 case 'EvaluationBlock ' :
647- //we skip this block type
669+ // convert this to a LinkBlock
670+ $ block_type = 'link ' ;
671+ $ payload = array (
672+ 'type ' => 'external ' ,
673+ 'target ' => '' ,
674+ 'url ' => \URLHelper::getLink ('dispatch.php/course/overview ' , ['cid ' => $ this ->cid ]),
675+ 'title ' => 'Evaluationen '
676+ );
677+ $ addBlock = true ;
648678 break ;
649679 case 'FolderBlock ' :
650680 $ folder_content = json_decode ($ block ['fields ' ]['folder_content ' ]);
@@ -656,7 +686,19 @@ private function createBlock($block, $container)
656686 $ addBlock = true ;
657687 break ;
658688 case 'ForumBlock ' :
659- //we skip this block type
689+ // convert this to a LinkBlock
690+ $ block_type = 'link ' ;
691+ $ area_id = $ block ['fields ' ]['area_id ' ];
692+ $ area = \ForumEntry::getConstraints ($ area_id );
693+ $ title = $ area ? $ area ['name ' ] : 'Forum ' ;
694+ $ url = \URLHelper::getLink ('plugins.php/coreforum/index/index/ ' . $ area_id );
695+ $ payload = array (
696+ 'type ' => 'external ' ,
697+ 'target ' => '' ,
698+ 'url ' => $ url ,
699+ 'title ' => $ title
700+ );
701+ $ addBlock = true ;
660702 break ;
661703 case 'GalleryBlock ' :
662704 $ payload = array (
@@ -813,7 +855,13 @@ private function createBlock($block, $container)
813855 //we skip this block type
814856 break ;
815857 case 'SearchBlock ' :
816- //we skip this block type
858+ $ block_type = 'text ' ;
859+ $ title = '<h3>Suche</h3> ' ;
860+ $ hint = '<p>An dieser Stelle befand sich ein Such-Block. Ab Stud.IP 5.2 befindet sich die Courseware-Suche in der Sidebar.</p> ' ;
861+ $ payload = array (
862+ 'text ' => $ title . $ hint
863+ );
864+ $ addBlock = true ;
817865 break ;
818866 case 'TestBlock ' :
819867 $ payload = array (
@@ -846,6 +894,33 @@ private function createBlock($block, $container)
846894 $ file_id = $ webvideo ->file_id ;
847895 $ web_url = '' ;
848896 }
897+ if ($ webvideo ->src ) {
898+ $ url = $ webvideo ->src ;
899+ if (strpos ($ url , 'youtube.com ' ) || strpos ($ url , 'youtu.be ' )) {
900+ // convert this to a EmbedBlock
901+ $ payload = array (
902+ 'title ' => '' ,
903+ 'url ' => $ url ,
904+ 'source ' => 'youtube '
905+ );
906+ $ block_type = 'embed ' ;
907+ $ addBlock = true ;
908+ break ;
909+ } else {
910+ parse_str (parse_url ($ webvideo ->src )['query ' ], $ src_params );
911+ $ file_id = $ src_params ['file_id ' ];
912+ $ file = \FileRef::find ($ file_id );
913+ if ($ file ) {
914+ $ source = 'studip ' ;
915+ $ file_id = $ file_id ;
916+ $ web_url = '' ;
917+ } else {
918+ $ source = 'web ' ;
919+ $ file_id = '' ;
920+ $ web_url = $ webvideo ->src ;
921+ }
922+ }
923+ }
849924 $ payload = array (
850925 'title ' => $ block ['fields ' ]['videoTitle ' ],
851926 'source ' => $ source ,
0 commit comments