forked from anahitasocial/anahita
/
revision.php
74 lines (67 loc) · 1.87 KB
/
revision.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
<?php
/**
* LICENSE: ##LICENSE##
*
* @category Anahita
* @package Com_Pages
* @subpackage Controller
* @author Arash Sanieyan <ash@anahitapolis.com>
* @author Rastin Mehr <rastin@anahitapolis.com>
* @copyright 2008 - 2010 rmdStudio Inc./Peerglobe Technology Inc
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl-3.0.html>
* @version SVN: $Id: resource.php 11985 2012-01-12 10:53:20Z asanieyan $
* @link http://www.anahitapolis.com
*/
/**
* Revision Controller
*
* @category Anahita
* @package Com_pages
* @subpackage Controller
* @author Arash Sanieyan <ash@anahitapolis.com>
* @author Rastin Mehr <rastin@anahitapolis.com>
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl-3.0.html>
* @link http://www.anahitapolis.com
*/
class ComPagesControllerRevision extends ComMediumControllerDefault
{
/**
* Initializes the options for the object
*
* Called from {@link __construct()} as a first step of object instantiation.
*
* @param object An optional KConfig object with configuration options.
* @return void
*/
protected function _initialize(KConfig $config)
{
$config->append(array(
'behaviors' => array('parentable')
));
parent::_initialize($config);
}
/**
* Restores a page back to a revision
*
* @param KCommandContext $context Context paramter
*
* @return void
*/
protected function _actionRestore($context)
{
$revision = $this->getItem();
$page = $revision->page;
$page->restore($revision);
$msg = JText::sprintf('COM-PAGES-PAGE-REVISIONS-RESTORATION-CONFIRMATION', $revision->revisionNum);
$context->response->setRedirect($page->getURL().'&layout=edit', $msg);
}
/**
* Prevents deletion of a revision
*
* @return boolean
*/
public function canDelete()
{
return false;
}
}