-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLearningNet.php
119 lines (102 loc) · 3.41 KB
/
LearningNet.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
<?php
require_once __DIR__.'/vendor/autoload.php';
/**
* dgettext with domain for this plugin.
* @param string $message to be passed to dgettext.
*/
function _ln($message)
{
return dgettext('learningnet', $message);
}
/**
* Main class of the LearningNet plugin.
* Sets up the plugin title and tab navigation.
*
* @author <milsen@uos.de>
*/
class LearningNet extends StudIPPlugin implements StandardPlugin
{
public function __construct()
{
parent::__construct();
/* $this->setupAutoload(); */
// Set text-domain for translations in this plugin.
bindtextdomain('learningnet', dirname(__FILE__) . '/locale');
}
/**
* Executed when calling the plugin from plugin.php/learningnet/
*/
public function initialize()
{
// Set title.
$headerLine = class_exists('Context') ?
Context::getHeaderLine() :
$_SESSION['SessSemName']['header_line'];
PageLayout::setTitle($headerLine . ' - ' . $this->getPluginName());
}
/**
* {@inheritdoc}
*/
public function getTabNavigation($courseId)
{
// Otherwise two params are given to URL.
$cid = $courseId;
// Create navigation.
$navigation = new Navigation(
$this->getPluginName(),
PluginEngine::getURL($this, compact('cid'), 'net', true)
);
// In current StudIP version, images are only shown in top navigation.
// Add images in case changes to this occur in the future.
$navigation->setImage(Icon::create('group3', 'info_alt'));
$navigation->setActiveImage(Icon::create('group3', 'info'));
// Add subnavigation.
// TODO disable complete plugin without courseware
$this->addSubnavigation($navigation, _cw('LearningNet'), 'index');
if ($GLOBALS['perm']->have_studip_perm('tutor', $courseId, $GLOBALS['user_id'])) {
$this->addSubnavigation($navigation, _cw('Stuktur bearbeiten'), 'edit');
$this->addSubnavigation($navigation, _cw('Einstellungen'), 'settings');
/* $this->addSubnavigation($navigation, _cw('Export'), 'export'); */
/* $this->addSubnavigation($navigation, _cw('Import'), 'import'); */
}
$tabs = [];
$tabs['learningnet'] = $navigation;
return $tabs;
}
/**
* Adds a subnavigation to be shown in the left sidebar.
* @param Navigation navigation Navigation to which a subnavigation is edded.
* @param string title Label shown in the sidebar.
* @param string route Subroute of this plugin linked to.
*/
private function addSubnavigation(&$navigation, $title, $route)
{
$url = PluginEngine::getURL($this, compact('cid'), 'net/' . $route, true);
$nav_item = new Navigation($title, $url);
$navigation->addSubnavigation($route, $nav_item);
}
/**
* {@inheritdoc}
*/
public function getIconNavigation($courseId, $last_visit, $user_id)
{
// Icon shown in "Veranstaltungen". Not needed.
return null;
}
/**
* {@inheritdoc}
*/
public function getInfoTemplate($courseId)
{
// Template to be rendered on the course summary page. Not needed.
return null;
}
/**
* {@inheritdoc}
*/
public function getMetadata()
{
// Metadata to be rendered on the course summary page. Not needed.
return [];
}
}