Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block plugins #196

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions Courseware.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class Courseware extends StudIPPlugin implements StandardPlugin
*/
private $container;

public static $registered_blocks = [];

public function __construct()
{
parent::__construct();
Expand All @@ -45,6 +47,8 @@ public function __construct()

// set text-domain for translations in this plugin
bindtextdomain('courseware', dirname(__FILE__).'/locale');

\NotificationCenter::postNotification('CoursewareRegisterBlocks', \Context::getId());
}

public function getPluginname()
Expand Down Expand Up @@ -91,7 +95,7 @@ public function getTabNavigation($courseId)
);
$settingsUrl = PluginEngine::getURL($this, compact('cid'), 'courseware/settings', true);
$navigation->addSubnavigation(
'settings',
'settings',
new Navigation(_cw('Einstellungen'), $settingsUrl)
);
$navigation->addSubnavigation(
Expand Down Expand Up @@ -176,7 +180,7 @@ public function getIconNavigation($courseId, $last_visit, $user_id)
seminar_id = :cid
AND
chdate >= :last_visit
AND
AND
type NOT IN ('Courseware', 'Chapter', 'Subchapter', 'Section')
");
$stmt->bindParam(':cid', $courseId);
Expand All @@ -189,7 +193,7 @@ public function getIconNavigation($courseId, $last_visit, $user_id)
if ($plugin_manager->getPluginInfo('VipsPlugin') == null){
$vips = false;
}
if($plugin_manager->getPlugin('VipsPlugin')){
if($plugin_manager->getPlugin('VipsPlugin')){
$version = $plugin_manager->getPluginManifest($plugin_manager->getPlugin('VipsPlugin')->getPluginPath())['version'];
if (version_compare('1.3',$version) > 0) {
$vips = false;
Expand Down Expand Up @@ -517,19 +521,19 @@ public static function deleteUserdata($user_id)

$stmt = $db->prepare('
DELETE FROM
mooc_userprogress
WHERE
mooc_userprogress
WHERE
user_id = :uid
');
$stmt->bindParam(':uid', $user_id);
$exec = $stmt->execute();

$stmt = $db->prepare('
DELETE FROM
mooc_fields
WHERE
mooc_fields
WHERE
user_id = :uid
AND
AND
(name = "visited" OR name = "lastSelected")
');
$stmt->bindParam(':uid', $user_id);
Expand All @@ -538,4 +542,13 @@ public static function deleteUserdata($user_id)
return $exec;
}

public static function addBlock($plugin_name, $rel_path)
{
$path = PluginEngine::getPlugin($plugin_name)->getPluginPath();

self::$registered_blocks[] = [
'plugin' => $plugin_name,
'path' => $path .'/'. $rel_path,
];
}
}
6 changes: 5 additions & 1 deletion assets/js/courseware.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import $ from 'jquery'
import Backbone from 'backbone'
import helper from './url'
import BlockModel from './block_model'
import block_types from './block_types';
import AuthorView from 'js/author_view'
import StudentView from 'js/student_view'

import '../less/courseware.less'

Expand Down Expand Up @@ -31,7 +34,6 @@ import 'ImageMapBlock/js/ImageMapBlock'
import 'InteractiveVideoBlock/js/InteractiveVideoBlock'
import 'KeyPointBlock/js/KeyPointBlock'
import 'LinkBlock/js/LinkBlock'
import 'OpenCastBlock/js/OpenCastBlock'
import 'PdfBlock/js/PdfBlock'
import 'PostBlock/js/PostBlock'
import 'ScrollyBlock/js/ScrollyBlock'
Expand Down Expand Up @@ -103,3 +105,5 @@ function patchBackbone() {
return (xhr !== false) ? xhr : Promise.reject(new Error('ModelError'));
};
}

export {$, Backbone, AuthorView, StudentView, helper, block_types };
19 changes: 0 additions & 19 deletions blocks/OpenCastBlock/css/opencast_block.less

This file was deleted.

16 changes: 0 additions & 16 deletions blocks/OpenCastBlock/js/OpenCastBlock.js

This file was deleted.

109 changes: 0 additions & 109 deletions blocks/OpenCastBlock/js/author_view.js

This file was deleted.

33 changes: 0 additions & 33 deletions blocks/OpenCastBlock/js/student_view.js

This file was deleted.

8 changes: 0 additions & 8 deletions blocks/OpenCastBlock/schema/opencast-1.0.xsd

This file was deleted.

55 changes: 0 additions & 55 deletions blocks/OpenCastBlock/templates/author_view.mustache

This file was deleted.

1 change: 0 additions & 1 deletion blocks/OpenCastBlock/templates/preview_view.mustache

This file was deleted.

23 changes: 0 additions & 23 deletions blocks/OpenCastBlock/templates/student_view.mustache

This file was deleted.

Loading