-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCourseTranslator.class.php
More file actions
executable file
·47 lines (39 loc) · 1.54 KB
/
CourseTranslator.class.php
File metadata and controls
executable file
·47 lines (39 loc) · 1.54 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
<?php
require_once __DIR__ . '/vendor/autoload.php';
class CourseTranslator extends StudIPPlugin implements SystemPlugin {
public function __construct() {
parent::__construct();
if(!$this->isTranslator()) return false;
$this->pluginClass = strtolower(__CLASS__);
$navigation = new AutoNavigation($this->getDisplayTitle());
$navigation->setUrl(PluginEngine::getURL($this->pluginClass . '/course/list/'), array());
$navigation->setImage($this->getPluginURL()
. '/public/images/header.png', array('title' => $this->getDisplayTitle()));
Navigation::addItem('/translator', $navigation);
$cssPath = $this->getPluginURL() . '/assets/css/style.css';
PageLayout::addStylesheet($cssPath);
}
public function getDisplayTitle() {
return _('Course Translator');
}
/**
* This method dispatches all actions.
*
* @param string part of the dispatch path that was not consumed
*/
function perform($unconsumed_path) {
$trails_root = $this->getPluginPath();
$dispatcher = new Trails_Dispatcher($trails_root, NULL, NULL);
$dispatcher->current_plugin = $this;
$dispatcher->dispatch($unconsumed_path);
}
private function isTranslator(){
if (RolePersistence::isAssignedRole($GLOBALS['user']->id, 'Translator')) {
return true;
}
if ($GLOBALS['perm']->have_perm('root')) {
return true;
}
return false;
}
}