Completed
Push — master ( 780648...a93e4f )
by Daniel
06:19
created

CMSPageHistoryController::Breadcrumbs()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
namespace SilverStripe\CMS\Controllers;
4
5
use SilverStripe\Admin\LeftAndMainFormRequestHandler;
6
use SilverStripe\CMS\Model\SiteTree;
7
use SilverStripe\Control\Controller;
8
use SilverStripe\Control\HTTPRequest;
9
use SilverStripe\Control\HTTPResponse;
10
use SilverStripe\Forms\CheckboxField;
11
use SilverStripe\Forms\FieldList;
12
use SilverStripe\Forms\Form;
13
use SilverStripe\Forms\FormAction;
14
use SilverStripe\Forms\HiddenField;
15
use SilverStripe\Forms\HTMLReadonlyField;
16
use SilverStripe\Forms\LiteralField;
17
use SilverStripe\Forms\Tab;
18
use SilverStripe\ORM\FieldType\DBField;
19
use SilverStripe\Versioned\Versioned;
20
use SilverStripe\Security\Security;
21
use SilverStripe\View\ArrayData;
22
use SilverStripe\View\ViewableData;
23
24
class CMSPageHistoryController extends CMSMain
25
{
26
27
    private static $url_segment = 'pages/history';
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
28
29
    private static $url_rule = '/$Action/$ID/$VersionID/$OtherVersionID';
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
30
31
    private static $url_priority = 42;
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
32
33
    private static $menu_title = 'History';
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
34
35
    private static $required_permission_codes = 'CMS_ACCESS_CMSMain';
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
36
37
    private static $allowed_actions = array(
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
38
        'EditForm',
39
        'VersionsForm',
40
        'CompareVersionsForm',
41
        'show',
42
        'compare'
43
    );
44
45
    private static $url_handlers = array(
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
46
        '$Action/$ID/$VersionID/$OtherVersionID' => 'handleAction',
47
        'EditForm/$ID/$VersionID' => 'EditForm',
48
    );
49
50
    /**
51
     * Current version ID for this request. Can be 0 for latest version
52
     *
53
     * @var int
54
     */
55
    protected $versionID = null;
56
57
    public function getResponseNegotiator()
58
    {
59
        $negotiator = parent::getResponseNegotiator();
60
        $controller = $this;
61
        $negotiator->setCallback('CurrentForm', function () use (&$controller) {
62
            $form = $controller->getEditForm();
63
            if ($form) {
64
                return $form->forTemplate();
65
            } else {
66
                return $controller->renderWith($controller->getTemplatesWithSuffix('_Content'));
67
            }
68
        });
69
        $negotiator->setCallback('default', function () use (&$controller) {
70
            return $controller->renderWith($controller->getViewer('show'));
71
        });
72
        return $negotiator;
73
    }
74
75
    /**
76
     * @param HTTPRequest $request
77
     * @return HTTPResponse
78
     */
79
    public function show($request)
80
    {
81
        // Record id and version for this request
82
        $id = $request->param('ID');
83
        $this->setCurrentPageID($id);
84
        $versionID = $request->param('VersionID');
85
        $this->setVersionID($versionID);
86
87
        // Show id
88
        $form = $this->getEditForm();
89
90
        $negotiator = $this->getResponseNegotiator();
91
        $controller = $this;
92
        $negotiator->setCallback('CurrentForm', function () use (&$controller, &$form) {
93
            return $form
94
                ? $form->forTemplate()
95
                : $controller->renderWith($controller->getTemplatesWithSuffix('_Content'));
96
        });
97
        $negotiator->setCallback('default', function () use (&$controller, &$form) {
98
            return $controller
99
                ->customise(array('EditForm' => $form))
100
                ->renderWith($controller->getViewer('show'));
101
        });
102
103
        return $negotiator->respond($request);
104
    }
105
106
    /**
107
     * @param HTTPRequest $request
108
     * @return HTTPResponse
109
     */
110
    public function compare($request)
111
    {
112
        $form = $this->CompareVersionsForm(
113
            $request->param('VersionID'),
114
            $request->param('OtherVersionID')
115
        );
116
117
        $negotiator = $this->getResponseNegotiator();
118
        $controller = $this;
119
        $negotiator->setCallback('CurrentForm', function () use (&$controller, &$form) {
120
            return $form ? $form->forTemplate() : $controller->renderWith($controller->getTemplatesWithSuffix('_Content'));
121
        });
122
        $negotiator->setCallback('default', function () use (&$controller, &$form) {
123
            return $controller->customise(array('EditForm' => $form))->renderWith($controller->getViewer('show'));
124
        });
125
126
        return $negotiator->respond($request);
127
    }
128
129
    public function getSilverStripeNavigator()
130
    {
131
        $record = $this->getRecord($this->currentPageID(), $this->getRequest()->param('VersionID'));
132
        if ($record) {
133
            $navigator = new SilverStripeNavigator($record);
134
            return $navigator->renderWith($this->getTemplatesWithSuffix('_SilverStripeNavigator'));
135
        } else {
136
            return false;
0 ignored issues
show
Bug Best Practice introduced by
The return type of return false; (false) is incompatible with the return type of the parent method SilverStripe\Admin\LeftA...etSilverStripeNavigator of type SilverStripe\ORM\FieldType\DBHTMLText.

If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design.

Let’s take a look at an example:

class Author {
    private $name;

    public function __construct($name) {
        $this->name = $name;
    }

    public function getName() {
        return $this->name;
    }
}

abstract class Post {
    public function getAuthor() {
        return 'Johannes';
    }
}

class BlogPost extends Post {
    public function getAuthor() {
        return new Author('Johannes');
    }
}

class ForumPost extends Post { /* ... */ }

function my_function(Post $post) {
    echo strtoupper($post->getAuthor());
}

Our function my_function expects a Post object, and outputs the author of the post. The base class Post returns a simple string and outputting a simple string will work just fine. However, the child class BlogPost which is a sub-type of Post instead decided to return an object, and is therefore violating the SOLID principles. If a BlogPost were passed to my_function, PHP would not complain, but ultimately fail when executing the strtoupper call in its body.

Loading history...
137
        }
138
    }
139
140
    /**
141
     * @param HTTPRequest $request
142
     * @return Form
143
     */
144
    public function EditForm($request = null)
145
    {
146
        if ($request) {
147
            // Validate VersionID is present
148
            $versionID = $request->param('VersionID');
149
            if (!isset($versionID)) {
150
                $this->httpError(400);
151
                return null;
152
            }
153
            $this->setVersionID($versionID);
154
        }
155
        return parent::EditForm($request);
156
    }
157
158
    /**
159
     * Returns the read only version of the edit form. Detaches all {@link FormAction}
160
     * instances attached since only action relates to revert.
161
     *
162
     * Permission checking is done at the {@link CMSMain::getEditForm()} level.
163
     *
164
     * @param int $id ID of the record to show
165
     * @param array $fields optional
166
     * @param int $versionID
167
     * @param int $compareID Compare mode
168
     *
169
     * @return Form
170
     */
171
    public function getEditForm($id = null, $fields = null, $versionID = null, $compareID = null)
172
    {
173
        if (!$id) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $id of type integer|null is loosely compared to false; this is ambiguous if the integer can be zero. You might want to explicitly use === null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For integer values, zero is a special case, in particular the following results might be unexpected:

0   == false // true
0   == null  // true
123 == false // false
123 == null  // false

// It is often better to use strict comparison
0 === false // false
0 === null  // false
Loading history...
174
            $id = $this->currentPageID();
175
        }
176
        if (!$versionID) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $versionID of type integer|null is loosely compared to false; this is ambiguous if the integer can be zero. You might want to explicitly use === null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For integer values, zero is a special case, in particular the following results might be unexpected:

0   == false // true
0   == null  // true
123 == false // false
123 == null  // false

// It is often better to use strict comparison
0 === false // false
0 === null  // false
Loading history...
177
            $versionID = $this->getVersionID();
178
        }
179
180
        $record = $this->getRecord($id, $versionID);
181
        if (!$record) {
182
            return $this->EmptyForm();
183
        }
184
185
        // Refresh version ID
186
        $versionID = $record->Version;
0 ignored issues
show
Bug introduced by
The property Version does not seem to exist. Did you mean versioning?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
187
        $this->setVersionID($versionID);
188
189
        // Get edit form
190
        $form = parent::getEditForm($record, $record->getCMSFields());
0 ignored issues
show
Documentation introduced by
$record is of type object<SilverStripe\CMS\Model\SiteTree>, but the function expects a integer|null.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
191
        // Respect permission failures from parent implementation
192
        if (!($form instanceof Form)) {
193
            return $form;
194
        }
195
196
        // TODO: move to the SilverStripeNavigator structure so the new preview can pick it up.
197
        //$nav = new SilverStripeNavigatorItem_ArchiveLink($record);
198
199
        $actions = new FieldList(
200
            $revert = FormAction::create(
201
                'doRollback',
202
                _t('SilverStripe\\CMS\\Controllers\\CMSPageHistoryController.REVERTTOTHISVERSION', 'Revert to this version')
203
            )
204
                ->setUseButtonTag(true)
205
                ->addExtraClass('font-icon-back-in-time')
206
        );
207
        $actions->setForm($form);
208
        $form->setActions($actions);
209
210
        $fields = $form->Fields();
211
        $fields->removeByName("Status");
212
        $fields->push(new HiddenField("ID"));
213
        $fields->push(new HiddenField("Version"));
214
215
        $fields = $fields->makeReadonly();
216
217
        if ($compareID) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $compareID of type integer|null is loosely compared to true; this is ambiguous if the integer can be zero. You might want to explicitly use !== null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For integer values, zero is a special case, in particular the following results might be unexpected:

0   == false // true
0   == null  // true
123 == false // false
123 == null  // false

// It is often better to use strict comparison
0 === false // false
0 === null  // false
Loading history...
218
            $link = Controller::join_links(
219
                $this->Link('show'),
220
                $id
221
            );
222
223
            $view = _t('SilverStripe\\CMS\\Controllers\\CMSPageHistoryController.VIEW', "view");
224
225
            $message = _t(
226
                'SilverStripe\\CMS\\Controllers\\CMSPageHistoryController.COMPARINGVERSION',
227
                "Comparing versions {version1} and {version2}.",
228
                array(
229
                    'version1' => sprintf('%s (<a href="%s">%s</a>)', $versionID, Controller::join_links($link, $versionID), $view),
230
                    'version2' => sprintf('%s (<a href="%s">%s</a>)', $compareID, Controller::join_links($link, $compareID), $view)
231
                )
232
            );
233
234
            $revert->setReadonly(true);
235
        } else {
236
            if ($record->isLatestVersion()) {
0 ignored issues
show
Documentation Bug introduced by
The method isLatestVersion does not exist on object<SilverStripe\CMS\Model\SiteTree>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
237
                $message = _t('SilverStripe\\CMS\\Controllers\\CMSPageHistoryController.VIEWINGLATEST', 'Currently viewing the latest version.');
238
            } else {
239
                $message = _t(
240
                    'SilverStripe\\CMS\\Controllers\\CMSPageHistoryController.VIEWINGVERSION',
241
                    "Currently viewing version {version}.",
242
                    array('version' => $versionID)
243
                );
244
            }
245
        }
246
247
        /** @var Tab $mainTab */
248
        $mainTab = $fields->fieldByName('Root.Main');
249
        $mainTab->unshift(
250
            new LiteralField('CurrentlyViewingMessage', ArrayData::create(array(
251
                'Content' => DBField::create_field('HTMLFragment', $message),
252
                'Classes' => 'notice'
253
            ))->renderWith($this->getTemplatesWithSuffix('_notice')))
254
        );
255
256
        $form->setFields($fields->makeReadonly());
257
        $form->loadDataFrom(array(
258
            "ID" => $id,
259
            "Version" => $versionID,
260
        ));
261
262
        if ($record->isLatestVersion()) {
0 ignored issues
show
Documentation Bug introduced by
The method isLatestVersion does not exist on object<SilverStripe\CMS\Model\SiteTree>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
263
            $revert->setReadonly(true);
264
        }
265
266
        $form->removeExtraClass('cms-content');
267
268
        // History form has both ID and VersionID as suffixes
269
        $form->setRequestHandler(
270
            LeftAndMainFormRequestHandler::create($form, [$id, $versionID])
271
        );
272
273
        return $form;
274
    }
275
276
277
    /**
278
     * Version select form. Main interface between selecting versions to view
279
     * and comparing multiple versions.
280
     *
281
     * Because we can reload the page directly to a compare view (history/compare/1/2/3)
282
     * this form has to adapt to those parameters as well.
283
     *
284
     * @return Form
285
     */
286
    public function VersionsForm()
287
    {
288
        $id = $this->currentPageID();
289
        $page = $this->getRecord($id);
290
        $versionsHtml = '';
291
292
        $action = $this->getRequest()->param('Action');
293
        $versionID = $this->getRequest()->param('VersionID');
294
        $otherVersionID = $this->getRequest()->param('OtherVersionID');
295
296
        $showUnpublishedChecked = 0;
297
        $compareModeChecked = ($action == "compare");
298
299
        if ($page) {
300
            $versions = $page->allVersions();
0 ignored issues
show
Documentation Bug introduced by
The method allVersions does not exist on object<SilverStripe\CMS\Model\SiteTree>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
301
            $versionID = (!$versionID) ? $page->Version : $versionID;
0 ignored issues
show
Bug introduced by
The property Version does not seem to exist. Did you mean versioning?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
302
303
            if ($versions) {
304
                foreach ($versions as $k => $version) {
305
                    $active = false;
306
307
                    if ($version->Version == $versionID || $version->Version == $otherVersionID) {
308
                        $active = true;
309
310
                        if (!$version->WasPublished) {
311
                            $showUnpublishedChecked = 1;
312
                        }
313
                    }
314
315
                    $version->Active = ($active);
316
                }
317
            }
318
319
            $vd = new ViewableData();
320
321
            $versionsHtml = $vd->customise(array(
322
                'Versions' => $versions
323
            ))->renderWith($this->getTemplatesWithSuffix('_versions'));
324
        }
325
326
        $fields = new FieldList(
327
            new CheckboxField(
328
                'ShowUnpublished',
329
                _t('SilverStripe\\CMS\\Controllers\\CMSPageHistoryController.SHOWUNPUBLISHED', 'Show unpublished versions'),
330
                $showUnpublishedChecked
331
            ),
332
            new CheckboxField(
333
                'CompareMode',
334
                _t('SilverStripe\\CMS\\Controllers\\CMSPageHistoryController.COMPAREMODE', 'Compare mode (select two)'),
335
                $compareModeChecked
336
            ),
337
            new LiteralField('VersionsHtml', $versionsHtml),
0 ignored issues
show
Bug introduced by
It seems like $versionsHtml defined by $vd->customise(array('Ve...ithSuffix('_versions')) on line 321 can also be of type object<SilverStripe\ORM\FieldType\DBHTMLText>; however, SilverStripe\Forms\LiteralField::__construct() does only seem to accept string|object<SilverStripe\Forms\FormField>, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
338
            $hiddenID = new HiddenField('ID', false, "")
0 ignored issues
show
Documentation introduced by
false is of type boolean, but the function expects a null|string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
339
        );
340
341
        $form = Form::create(
342
            $this,
343
            'VersionsForm',
344
            $fields,
345
            new FieldList()
346
        )->setHTMLID('Form_VersionsForm');
347
        $form->loadDataFrom($this->getRequest()->requestVars());
348
        $hiddenID->setValue($id);
349
        $form->unsetValidator();
350
351
        $form
352
            ->addExtraClass('cms-versions-form') // placeholder, necessary for $.metadata() to work
353
            ->setAttribute('data-link-tmpl-compare', Controller::join_links($this->Link('compare'), '%s', '%s', '%s'))
354
            ->setAttribute('data-link-tmpl-show', Controller::join_links($this->Link('show'), '%s', '%s'));
355
356
        return $form;
357
    }
358
359
    /**
360
     * @param int $versionID
361
     * @param int $otherVersionID
362
     * @return mixed
363
     */
364
    public function CompareVersionsForm($versionID, $otherVersionID)
365
    {
366
        if ($versionID > $otherVersionID) {
367
            $toVersion = $versionID;
368
            $fromVersion = $otherVersionID;
369
        } else {
370
            $toVersion = $otherVersionID;
371
            $fromVersion = $versionID;
372
        }
373
374
        if (!$toVersion || !$fromVersion) {
375
            return null;
376
        }
377
378
        $id = $this->currentPageID();
379
        /** @var SiteTree $page */
380
        $page = SiteTree::get()->byID($id);
381
382
        $record = null;
383
        if ($page && $page->exists()) {
384
            if (!$page->canView()) {
385
                return Security::permissionFailure($this);
386
            }
387
388
            $record = $page->compareVersions($fromVersion, $toVersion);
0 ignored issues
show
Documentation Bug introduced by
The method compareVersions does not exist on object<SilverStripe\CMS\Model\SiteTree>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
389
        }
390
391
        $fromVersionRecord = Versioned::get_version(SiteTree::class, $id, $fromVersion);
392
        $toVersionRecord = Versioned::get_version(SiteTree::class, $id, $toVersion);
393
394
        if (!$fromVersionRecord) {
395
            user_error("Can't find version $fromVersion of page $id", E_USER_ERROR);
396
        }
397
398
        if (!$toVersionRecord) {
399
            user_error("Can't find version $toVersion of page $id", E_USER_ERROR);
400
        }
401
402
        if (!$record) {
403
            return null;
404
        }
405
        $form = $this->getEditForm($id, null, $fromVersion, $toVersion);
406
        $form->setActions(new FieldList());
407
        $form->addExtraClass('compare');
408
409
        $form->loadDataFrom($record);
410
        $form->loadDataFrom(array(
411
            "ID" => $id,
412
            "Version" => $fromVersion,
413
        ));
414
415
        // Comparison views shouldn't be editable.
416
        // As the comparison output is HTML and not valid values for the various field types
417
        $readonlyFields = $this->transformReadonly($form->Fields());
418
        $form->setFields($readonlyFields);
419
420
        return $form;
421
    }
422
423
    /**
424
     * Replace all data fields with HTML readonly fields to display diff
425
     *
426
     * @param FieldList $fields
427
     * @return FieldList
428
     */
429
    public function transformReadonly(FieldList $fields)
430
    {
431
        foreach ($fields->dataFields() as $field) {
432
            if ($field instanceof HiddenField) {
433
                continue;
434
            }
435
            $newField = $field->castedCopy(HTMLReadonlyField::class);
436
            $fields->replaceField($field->getName(), $newField);
437
        }
438
        return $fields;
439
    }
440
441
    /**
442
     * Set current version ID
443
     *
444
     * @param int $versionID
445
     * @return $this
446
     */
447
    public function setVersionID($versionID)
448
    {
449
        $this->versionID = $versionID;
450
        return $this;
451
    }
452
453
    /**
454
     * Get current version ID
455
     *
456
     * @return int
457
     */
458
    public function getVersionID()
459
    {
460
        return $this->versionID;
461
    }
462
463
    public function getTabIdentifier()
464
    {
465
        return 'history';
466
    }
467
}
468