diff --git a/TeachUOS.class.php b/TeachUOS.class.php index 4a40d55db7b3c79c4695f019aabd0ee13e58f18a..87b6d0bcaf12084d9fa338eaf5605964625c89ee 100644 --- a/TeachUOS.class.php +++ b/TeachUOS.class.php @@ -2,15 +2,12 @@ use Courseware\StructuralElement; -require_once __DIR__ . '/vendor/autoload.php'; - /** * [Description TeachUOS] */ class TeachUOS extends StudipPlugin implements StandardPlugin, - SystemPlugin, - PortalPlugin + SystemPlugin { /** */ @@ -33,16 +30,6 @@ class TeachUOS extends StudipPlugin implements ); $navigation->addSubNavigation("teachUOS", $teachUOS); } - - // more setup if this plugin is active in this course - $contextId = \Context::getId(); - if (\Context::getType() === \Context::COURSE && $this->isActivated($contextId)) { - if (!$GLOBALS['perm']->have_studip_perm('tutor', $contextId)) { - if (Navigation::hasItem('/course/courseware')) { - Navigation::removeItem('/course/courseware'); - } - } - } } /** @@ -63,44 +50,9 @@ class TeachUOS extends StudipPlugin implements */ public function isTeachUOSMember() { - $teachUOS_course_id = $this->getTeachUOSCourse(); - $teachUOSCourse = Course::find($teachUOS_course_id); - if (!$teachUOSCourse) { - return false; - } - $member_ids = $teachUOSCourse->members->pluck("user_id"); - $user_id = $GLOBALS["user"]->id; - return in_array($user_id, $member_ids); - } - - /** - * @return [type] - */ - public function getPluginName() - { - return "teachUOS"; - } - - /** - * Returns the portal widget template. - */ - function getPortalTemplate() - { - $template_path = $this->getPluginPath() . "/templates"; - $template_factory = new Flexi_TemplateFactory($template_path); - $template = $template_factory->open("widget"); - //set $teachUOS_course_id variable for widget template - $template->set_attribute( - "teachUOS_course_id", - $this->getTeachUOSCourse() - ); - //set $isMember variable if student is already member of teachuos course - $template->set_attribute("isMember", $this->isTeachUOSMember()); - - //TODO: set title of widget - $template->title = _("teachUOS"); + $course_id = $this->getTeachUOSCourse(); - return $template; + return $course_id && CourseMember::exists([$course_id, $GLOBALS['user']->id]); } /** @@ -173,13 +125,7 @@ class TeachUOS extends StudipPlugin implements */ public function getTabNavigation($course_id) { - //Link to overview page in the course - $tab = new Navigation( - $this->getPluginName(), - PluginEngine::getURL($this, [], "admin") - ); - - return [$this->getPluginName() => $tab]; + return []; } /** diff --git a/composer.json b/composer.json deleted file mode 100644 index 488ce30576f574b295b1eb26cf014e659e849646..0000000000000000000000000000000000000000 --- a/composer.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "elan-ev/teachuos-plugin", - "type": "project", - "license": "GPL-2.0+", - "autoload": { - "psr-4": { - "TeachUOSPlugin\\": "lib/" - } - }, - "scripts": { - "zip": "zip -r studip-plugin-teachuos.zip assets controllers migrations README.md templates dist plugin.manifest vendor lib TeachUOS.class.php views" - } -} diff --git a/composer.lock b/composer.lock deleted file mode 100644 index aad233230018cc72bbcab5a4a4e9be0603b72d50..0000000000000000000000000000000000000000 --- a/composer.lock +++ /dev/null @@ -1,18 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "ee7bd932978c1e52ebc34cfa946d1fae", - "packages": [], - "packages-dev": [], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": [], - "platform-dev": [], - "plugin-api-version": "2.3.0" -} diff --git a/controllers/admin.php b/controllers/admin.php deleted file mode 100644 index 52ac9c5a73675e1d7bdf20a12f76c2ce06ff6bf6..0000000000000000000000000000000000000000 --- a/controllers/admin.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php - -class AdminController extends StudipController -{ - // TODO: delete if unneccessary - public function __construct($dispatcher) - { - parent::__construct($dispatcher); - $this->plugin = $GLOBALS["plugin"]; - } - - //TODO: delete if unneccessary - public function before_filter(&$action, &$args) - { - parent::before_filter($action, $args); - Navigation::activateItem("/course/" . $this->plugin->getPluginName()); - } - - public function index_action() - { - $this->course_id = Context::getId(); - $this->teachUOS_course_id = $this->plugin->getTeachUOSCourse(); - $this->teachUOS_course_name = Course::find( - $this->teachUOS_course_id - )->name; - } -} diff --git a/controllers/index.php b/controllers/index.php index 59d09fb73affdde45ac57ecbb0cfad68e63af8a6..298e761ccb2604275edb52782aaa84052ac2438b 100644 --- a/controllers/index.php +++ b/controllers/index.php @@ -8,11 +8,14 @@ class IndexController extends StudipController $this->plugin = $GLOBALS["plugin"]; } - public function before_filter(&$action, &$args) + public function index_action() { - parent::before_filter($action, $args); // Set title of browser tab PageLayout::setTitle(_("teachUOS")); + + // Activate icon in main navigation + subnavigation + Navigation::activateItem("teachUOS/teachUOS"); + // Add stylesheets for index page PageLayout::addStylesheet( $this->plugin->getPluginURL() . "/assets/index.css" @@ -20,12 +23,6 @@ class IndexController extends StudipController PageLayout::addStylesheet( $this->plugin->getPluginURL() . "/assets/teachUOS.css" ); - // Activate icon in main navigation + subnavigation - Navigation::activateItem("teachUOS/teachUOS"); - } - - public function index_action() - { //define js file for layout PageLayout::addScript( $this->plugin->getPluginURL() . "/assets/index.js" diff --git a/controllers/pages.php b/controllers/pages.php index c9e7d5ab52b4306f85cffe9f048a52cfe0c65b5d..7f41a955d9a6f6be75ede8f6a340e3eec52a3cd1 100644 --- a/controllers/pages.php +++ b/controllers/pages.php @@ -1,5 +1,8 @@ <?php +require_once dirname(__DIR__) . '/lib/IncludesVite.php'; +require_once dirname(__DIR__) . '/lib/ViteManifest.php'; + use Courseware\StructuralElement; use TeachUOSPlugin\IncludesVite; diff --git a/migrations/001_add_tables.php b/migrations/001_add_tables.php index f5ef170dc7cc0006e865b1723ff296fe76be8849..e0cf02f5ffc19ed7518e339c93f563cc895724d3 100644 --- a/migrations/001_add_tables.php +++ b/migrations/001_add_tables.php @@ -11,8 +11,8 @@ class AddTables extends Migration { $db = DBManager::get(); $db->exec("CREATE TABLE IF NOT EXISTS `teachUOS_favourites` ( - `user_id` VARCHAR(32) NOT NULL, - `course_id` VARCHAR(32) NOT NULL, + `user_id` VARCHAR(32) COLLATE latin1_bin NOT NULL, + `course_id` VARCHAR(32) COLLATE latin1_bin NOT NULL, `block_id` INT(11) NOT NULL, `parent_id` INT(11) DEFAULT NULL, `title` VARCHAR(255) DEFAULT NULL, diff --git a/plugin.manifest b/plugin.manifest index a00430e6e66fdff46f01b3d497ed144b0a686ff8..57520878b94193bfbc0361b6371a98f619a0e882 100644 --- a/plugin.manifest +++ b/plugin.manifest @@ -1,6 +1,6 @@ pluginname=teachUOS pluginclassname=TeachUOS origin=virtUOS -version=1.1 +version=1.2 studipMinVersion=4.1 studipMaxVersion=5.1.99 diff --git a/templates/widget.php b/templates/widget.php deleted file mode 100644 index ca677909f4770c45868f2330f4e1014f73cd5418..0000000000000000000000000000000000000000 --- a/templates/widget.php +++ /dev/null @@ -1,17 +0,0 @@ -<article class="studip"> - <section> - <p><?= _("Info-Text zu teachUOS.") ?></p> - <? if (!$isMember) : ?> - <?= \Studip\LinkButton::create( - _("teachUOS für mich aktivieren"), - URLHelper::getLink( - "dispatch.php/course/enrolment/apply/" . $teachUOS_course_id - ), - [] - ) ?> - <? else : ?> - <p>teachUOS ist für dich bereits aktiviert !</p> - <? endif ?> - - </section> -</article> diff --git a/views/admin/index.php b/views/admin/index.php deleted file mode 100644 index 751f7222340df7c65fc96772692a5447271c9f0c..0000000000000000000000000000000000000000 --- a/views/admin/index.php +++ /dev/null @@ -1,11 +0,0 @@ -<!-- Show text inside of a MessageBox to indicate whether the plugin is activated in the current context or not --> -<? if (!strcmp($course_id, $teachUOS_course_id)) : ?> - <?= MessageBox::success( - "Das teachUOS-Plugin ist aktuell in dieser Veranstaltung aktiviert." - ) ?> -<? else : ?> - <?= MessageBox::info( - "Aktuell ist das teachUOS-Plugin in einer anderen Veranstaltung aktiviert: ", - [$teachUOS_course_name] - ) ?> -<? endif ?>