2014-09-07 07:09:28 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2014-09-15 11:47:45 +02:00
|
|
|
* Check to see if the currently accessed version is out of date or perhaps a
|
|
|
|
* future version rather than the stable edition.
|
2014-09-07 07:09:28 +02:00
|
|
|
*
|
|
|
|
* @return false|ArrayData
|
|
|
|
*/
|
|
|
|
|
|
|
|
class DocumentationViewerVersionWarning extends Extension {
|
|
|
|
|
|
|
|
public function VersionWarning() {
|
|
|
|
$page = $this->owner->getPage();
|
2014-09-15 11:47:45 +02:00
|
|
|
|
|
|
|
if(!$page) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$entity = $page->getEntity();
|
|
|
|
|
|
|
|
if(!$entity) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-09-19 13:29:22 +02:00
|
|
|
$versions = $this->owner->getManifest()->getAllVersionsOfEntity($entity);
|
2014-09-15 11:47:45 +02:00
|
|
|
|
|
|
|
if($entity->getIsStable()) {
|
|
|
|
return false;
|
2014-09-07 07:09:28 +02:00
|
|
|
}
|
2014-09-15 11:47:45 +02:00
|
|
|
|
|
|
|
$stable = $this->owner->getManifest()->getStableVersion($entity);
|
|
|
|
$compare = $entity->compare($stable);
|
2014-12-10 02:35:05 +01:00
|
|
|
|
2014-09-15 11:47:45 +02:00
|
|
|
if($entity->getVersion() == "master" || $compare > 0) {
|
|
|
|
return $this->owner->customise(new ArrayData(array(
|
|
|
|
'FutureRelease' => true,
|
2014-12-10 02:35:05 +01:00
|
|
|
'StableVersion' => DBField::create_field('HTMLText', $stable->getVersion())
|
2014-09-15 11:47:45 +02:00
|
|
|
)));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return $this->owner->customise(new ArrayData(array(
|
|
|
|
'OutdatedRelease' => true,
|
2014-12-10 02:35:05 +01:00
|
|
|
'StableVersion' => DBField::create_field('HTMLText', $stable->getVersion())
|
2014-09-15 11:47:45 +02:00
|
|
|
)));
|
|
|
|
}
|
|
|
|
|
2014-09-07 07:09:28 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|