-
Notifications
You must be signed in to change notification settings - Fork 0
/
SCMPlugin.php
134 lines (105 loc) · 4.4 KB
/
SCMPlugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?php
require_once dirname(__FILE__) .'/models/ScmTabEntry.class.php';
/*
* Copyright (c) 2015 Annelene Sudau <asudau@uos.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*/
//require_once 'lib/modules/StudipModule.class.php';
class SCMPlugin extends StudIPPlugin implements StandardPlugin {
public function __construct() {
parent::__construct();
$this->course = Course::findCurrent();
$this->course_id = $this->course->id;
}
public function initialize ()
{
//PageLayout::addStylesheet($this->getPluginUrl() . '/css/style.css');
//PageLayout::addStylesheet($this->getPluginURL().'/assets/style.css');
//PageLayout::addScript($this->getPluginURL().'/js/script.js');
$this->setupAutoload();
}
public function perform($unconsumed_path) {
$dispatcher = new Trails_Dispatcher(
$this->getPluginPath(),
rtrim(PluginEngine::getLink($this, array(), null), '/'),
'show'
);
$dispatcher->plugin = $this;
$dispatcher->dispatch($unconsumed_path);
}
private function setupAutoload() {
if (class_exists("StudipAutoloader")) {
StudipAutoloader::addAutoloadPath(__DIR__ . '/models');
} else {
spl_autoload_register(function ($class) {
include_once __DIR__ . $class . '.php';
});
}
}
function getIconNavigation($course_id, $last_visit, $user_id) {
return null;
}
function getTabNavigation($course_id) {
if (TRUE){
$temp = ScmTabEntry::findByRange_id($course_id, 'ORDER BY position ASC');
if($temp){
$scms = SimpleORMapCollection::createFromArray($temp);
$navigation = new Navigation($scms->first()->tab_name ?: _('Informationen'));
$navigation->setImage('icons/16/white/infopage.png');
$navigation->setActiveImage('icons/16/black/infopage.png');
foreach ($scms as $scm) {
$scm_link = PluginEngine::getLink($this, array(), 'show/'.$scm->id);
$nav = new Navigation($scm['tab_name'], $scm_link);
$nav->setImage('icons/16/white/infopage.png');
$nav->setActiveImage('icons/16/black/infopage.png');
Navigation::addItem('course/scmTabs' . $scm->id, $nav);
}
return null;//array('scm' => $navigation);
} else {
$scm = new ScmTabEntry($id);
$scm->tab_name = 'Infoseite';
$scm->user_id = $GLOBALS['user']->id;
$scm->range_id = $GLOBALS['SessSemName'][1];
$scm->store();
$scm_link = PluginEngine::getLink($this, array(), 'show/'.$scm->id);
$nav = new Navigation($scm->tab_name, $scm_link);
$nav->setImage('icons/16/white/infopage.png');
$nav->setActiveImage('icons/16/black/infopage.png');
Navigation::addItem('course/scmTabs' . $scm->id, $nav);
return null;
}
} else {
return null;
}
}
function getNotificationObjects($course_id, $since, $user_id)
{
return null;
}
public function getInfoTemplate($course_id){
return null;
}
/**
* @see StudipModule::getMetadata()
*/
function getMetadata()
{
return array(
'summary' => _('Die Lehrenden bestimmen, wie Titel und Inhalt dieser Seiten aussehen.'),
'description' => _('Die ist eine Abwandlung der freien Informationsseite. Anders '.
'als dort werden hier weitere Einträge in separaten Kartenreitern dargestellt. '.'Lehrende können beliebig viele Seiten nach ihren speziellen '.
'Anforderungen einrichten. So kann z.B. der Titel im Kartenreiter '.
'selbst definiert werden. Für jeden neuen Eintrag '.
'öffnet sich eine Seite mit einem Text-Editor, in den '.
'beliebiger Text eingegeben und formatiert werden kann. Oft '.
'werden solche Seiten für die Angabe von Literatur genutzt als '.
'Alternative zum Plugin Literatur. Sie können aber auch für '.
'andere beliebige Zusatzinformationen (Links, Protokolle '.
'etc.) verwendet werden.')
);
}
}