DocumentIndexAction.php
1.29 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
<?php
require_once(KT_LIB_DIR . '/actions/documentaction.inc.php');
require_once(KT_LIB_DIR . '/plugins/plugin.inc.php');
require_once(KT_LIB_DIR . '/plugins/pluginregistry.inc.php');
class DocumentIndexAction extends KTDocumentAction
{
var $sName = 'ktcore.search2.index.action';
var $_sShowPermission = "ktcore.permissions.write";
function DocumentIndexAction($oDocument = null, $oUser = null, $oPlugin = null)
{
parent::KTDocumentAction($oDocument, $oUser, $oPlugin);
$this->sDisplayName=_kt('Schedule Indexing');
}
function getName()
{
return _kt('Document Indexer');
}
function getDisplayName()
{
if (Permission::userIsSystemAdministrator() && $_SESSION['adminmode'])
{
if (Indexer::isDocumentScheduled($this->oDocument->getId()))
{
return _kt('Unschedule Indexing');
}
else
{
return _kt('Schedule Indexing');
}
}
return '';
}
function do_main()
{
$doc=$this->oDocument;
$docid=$doc->getId();
if (Permission::userIsSystemAdministrator())
{
if (Indexer::isDocumentScheduled($docid))
{
Indexer::unqueueDocument($docid);
}
else
{
Indexer::index($doc, 'A');
}
}
redirect("view.php?fDocumentId=$docid");
}
}
?>