-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathArchivesPlugin.inc.php
106 lines (92 loc) · 3.8 KB
/
ArchivesPlugin.inc.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
<?php
/**
* @file ArchivesPlugin.inc.php
*
* Copyright (c) 2003-2011 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* With contributions from:
* - 2014 Instituto Nacional de Investigacion y Tecnologia Agraria y Alimentaria
*
* @class ArchivesPlugin
* @ingroup plugins_generic_counter
*
* @brief COUNTER plugin; provides COUNTER statistics.
*/
import('lib.pkp.classes.plugins.GenericPlugin');
class ArchivesPlugin extends GenericPlugin {
/**
* Called as a plugin is registered to the registry
* @param $category String Name of category plugin was registered to
* @return boolean True iff plugin initialized successfully; if false,
* the plugin will not be registered.
*/
function register($category, $path) {
$success = parent::register($category, $path);
if ($success && $this->getEnabled()) {
HookRegistry::register ('Templates::Editor::Index::Submissions', array(&$this, 'displayMenuArchives'));
HookRegistry::register ('LoadHandler', array(&$this, 'handleRequest'));
$this->import('EditorSubmissionArchivesDAO');
$editorSubmissionArchivesDAO = new EditorSubmissionArchivesDAO();
DAORegistry::registerDAO('EditorSubmissionArchivesDAO', $editorSubmissionArchivesDAO);
}
return $success;
}
function getDisplayName() {
return Locale::translate('plugins.generic.Archives.displayName');
}
function getDescription() {
return Locale::translate('plugins.generic.Archives.description');
}
/**
* Get the management plugin
* @return object
*/
function &getManagerPlugin() {
$plugin =& PluginRegistry::getPlugin('generic', $this->parentPluginName);
return $plugin;
}
/**
* Get the Template path for this plugin.
*/
function getTemplatePath() {
return parent::getTemplatePath() . 'templates' . DIRECTORY_SEPARATOR ;
}
function displayMenuArchives($hookName, $args) {
$params =& $args[0];
$smarty =& $args[1];
$output =& $args[2];
$output = ' <ul> <li>» <a href="'. Request::url(null,'editor','submissions','submissionsArchivesArchived') .'">'.Locale::translate('plugins.generic.Archives.submissionsArchivesArchived').'</a></li>';
$output .= ' <li>» <a href="'. Request::url(null,'editor','submissions','submissionsArchivesPublished') .'">'.Locale::translate('plugins.generic.Archives.submissionsArchivesPublished').'</a></li>';
$output .= ' <li>» <a href="'. Request::url(null,'editor','submissions','submissionsArchivesDeclined') .'">'.Locale::translate('plugins.generic.Archives.submissionsArchivesDeclined').'</a></li></ul>';
return false;
}
function handleRequest($hookName, $args) {
$page =& $args[0];
$op =& $args[1];
$sourceFile =& $args[2];
$accion = Request::getRequestedArgs();
// print_r($accion);
// If the request is for the log analyzer itself, handle it.
if ($page === 'editor') {
if($op){
if($op =='submissions' or $op =="deleteSubmission"){
if($accion[0]){
$editorPages = array(
'submissionsArchivesArchived',
'submissionsArchivesPublished',
'submissionsArchivesDeclined');
if (in_array($accion[0], $editorPages) or $op =="deleteSubmission" ) {
$this->import('ArchivesHandler');
Registry::set('plugin', $this);
define('HANDLER_CLASS', 'ArchivesHandler');
return true;
}
return false;
}
}
}
}
}
}
?>