-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExternalLinkPlugin.php
More file actions
74 lines (63 loc) · 2.47 KB
/
ExternalLinkPlugin.php
File metadata and controls
74 lines (63 loc) · 2.47 KB
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
<?php
/**
* ExternalLinkPlugin.php - Display and copy a link to the current course.
*
* This file contains the main class of the ExternalLink plugin.
*
* 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.
*
* @author Robert Costa <rcosta@uos.de>
* @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
* @category Stud.IP
*/
include_once 'ExternalLinkPluginUtils.php';
/**
* Initializes and displays the ExternalLink plugin.
**/
class ExternalLinkPlugin extends StudIPPlugin implements StandardPlugin {
/**
* Constructor of the class.
*
* Configures the navigation link where the plugin can be reached in
* Stud.IP and does some general plugin initialization stuff.
*/
public function __construct() {
parent::__construct();
$navigation = new AutoNavigation(_('Externer Link'));
$navigation->setURL(PluginEngine::GetLink($this, array(), 'show'));
$navigation->setImage(Assets::image_path('blank.gif'));
Navigation::addItem('/course/main/externallink', $navigation);
$this->template_factory = new Flexi_TemplateFactory($this->getPluginPath() . '/templates');
}
/**
* Loads stylesheets and scripts needed for executing the plugin.
*/
public function initialize () {
PageLayout::addStylesheet($this->getPluginURL() . '/assets/styles.css');
PageLayout::addScript($this->getPluginURL() . '/assets/ZeroClipboard.js');
PageLayout::addScript($this->getPluginURL() . '/assets/script.js');
}
/**
* Implements abstract method of base class.
*/
public function getIconNavigation($course_id, $last_visit) {
}
/**
* Implements abstract method of base class.
*/
public function getInfoTemplate($course_id) {
}
/**
* Sets the fields in the plugin's show.php template to correct values.
*/
public function show_action() {
$template = $this->template_factory->open('show');
$template->set_layout($GLOBALS['template_factory']->open('layouts/base'));
$query = http_build_query(array('sem_id'=>ExternalLinkPluginUtils::getSeminarId(), 'again'=>'yes'));
$template->external_link = ExternalLinkPluginUtils::getBaseUrl() . 'details.php?' . $query;
echo $template->render();
}
}