mirror of
https://github.com/silverstripe/silverstripe-contentreview
synced 2024-10-22 17:05:47 +02:00
Converted to PSR-2
This commit is contained in:
parent
ddf5052503
commit
98c125360b
@ -352,7 +352,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
||||
|
||||
$userField = ListboxField::create("OwnerUsers", _t("ContentReview.PAGEOWNERUSERS", "Users"), $usersMap)
|
||||
->setMultiple(true)
|
||||
->addExtraClass('custom-setting')
|
||||
->addExtraClass('custom-setting')
|
||||
->setAttribute("data-placeholder", _t("ContentReview.ADDUSERS", "Add users"))
|
||||
->setDescription(_t('ContentReview.OWNERUSERSDESCRIPTION', 'Page owners that are responsible for reviews'));
|
||||
|
||||
@ -365,7 +365,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
||||
|
||||
$groupField = ListboxField::create("OwnerGroups", _t("ContentReview.PAGEOWNERGROUPS", "Groups"), $groupsMap)
|
||||
->setMultiple(true)
|
||||
->addExtraClass('custom-setting')
|
||||
->addExtraClass('custom-setting')
|
||||
->setAttribute("data-placeholder", _t("ContentReview.ADDGROUP", "Add groups"))
|
||||
->setDescription(_t("ContentReview.OWNERGROUPSDESCRIPTION", "Page owners that are responsible for reviews"));
|
||||
|
||||
@ -376,11 +376,11 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
||||
->setDescription(_t("ContentReview.NEXTREVIEWDATADESCRIPTION", "Leave blank for no review"));
|
||||
|
||||
$reviewFrequency = DropdownField::create(
|
||||
"ReviewPeriodDays",
|
||||
_t("ContentReview.REVIEWFREQUENCY", "Review frequency"),
|
||||
self::get_schedule()
|
||||
)
|
||||
->addExtraClass('custom-setting')
|
||||
"ReviewPeriodDays",
|
||||
_t("ContentReview.REVIEWFREQUENCY", "Review frequency"),
|
||||
self::get_schedule()
|
||||
)
|
||||
->addExtraClass('custom-setting')
|
||||
->setDescription(_t("ContentReview.REVIEWFREQUENCYDESCRIPTION", "The review date will be set to this far in the future whenever the page is published"));
|
||||
|
||||
$notesField = GridField::create("ReviewNotes", "Review Notes", $this->owner->ReviewLogs(), GridFieldConfig_RecordEditor::create());
|
||||
@ -519,7 +519,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
||||
|
||||
protected function setDefaultReviewDateForCustom()
|
||||
{
|
||||
// Don't overwrite existing value
|
||||
// Don't overwrite existing value
|
||||
if ($this->owner->NextReviewDate) {
|
||||
return;
|
||||
}
|
||||
@ -536,10 +536,10 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
|
||||
|
||||
protected function setDefaultReviewDateForInherited()
|
||||
{
|
||||
// Don't overwrite existing value
|
||||
if($this->owner->NextReviewDate) {
|
||||
return;
|
||||
}
|
||||
// Don't overwrite existing value
|
||||
if ($this->owner->NextReviewDate) {
|
||||
return;
|
||||
}
|
||||
|
||||
$options = $this->getOptions();
|
||||
$nextDate = null;
|
||||
|
@ -167,7 +167,7 @@ class PagesDueForReviewReport extends SS_Report
|
||||
if (!empty($params["OnlyMyPages"])) {
|
||||
$currentUser = Member::currentUser();
|
||||
|
||||
$records = $records->filterByCallback(function($page) use ($currentUser) {
|
||||
$records = $records->filterByCallback(function ($page) use ($currentUser) {
|
||||
$options = $page->getOptions();
|
||||
|
||||
foreach ($options->ContentReviewOwners() as $owner) {
|
||||
|
@ -68,16 +68,16 @@ class ContentReviewSettingsTest extends SapphireTest
|
||||
|
||||
public function testAdvanceReviewFromInheritedSettings()
|
||||
{
|
||||
// When a parent page is advanced, the next review date of the child is not automatically advanced
|
||||
// When a parent page is advanced, the next review date of the child is not automatically advanced
|
||||
$parentPage = $this->objFromFixture("Page", "page-1");
|
||||
$this->assertTrue($parentPage->advanceReviewDate());
|
||||
$parentPage->write();
|
||||
$this->assertTrue($parentPage->advanceReviewDate());
|
||||
$parentPage->write();
|
||||
|
||||
$page = $this->objFromFixture("Page", "page-1-1");
|
||||
$this->assertEquals(date("Y-m-d", strtotime("now + 5 days")), $parentPage->NextReviewDate);
|
||||
$this->assertEquals('2011-04-12', $page->NextReviewDate);
|
||||
$this->assertEquals(date("Y-m-d", strtotime("now + 5 days")), $parentPage->NextReviewDate);
|
||||
$this->assertEquals('2011-04-12', $page->NextReviewDate);
|
||||
|
||||
// When a sub page is advanced, the next review date is advanced by the number of days in the parent
|
||||
// When a sub page is advanced, the next review date is advanced by the number of days in the parent
|
||||
$this->assertTrue($page->advanceReviewDate());
|
||||
$page->write();
|
||||
$this->assertEquals(date("Y-m-d", strtotime("now + 5 days")), $page->NextReviewDate);
|
||||
@ -185,7 +185,7 @@ class ContentReviewSettingsTest extends SapphireTest
|
||||
|
||||
public function testGetNextReviewDateFromPageInheritedSetting()
|
||||
{
|
||||
// Although page-1-1 inherits from page-1, it has an independent review date
|
||||
// Although page-1-1 inherits from page-1, it has an independent review date
|
||||
$page = $this->objFromFixture("Page", "page-1-1");
|
||||
$nextReviewDate = $page->getReviewDate();
|
||||
$this->assertInstanceOf("Date", $nextReviewDate);
|
||||
@ -242,7 +242,7 @@ class ContentReviewSettingsTest extends SapphireTest
|
||||
/** @var Page|SiteTreeContentReview $childPage */
|
||||
$childPage = $this->objFromFixture("Page", "page-1-1");
|
||||
|
||||
// Parent and child pages have different review dates
|
||||
// Parent and child pages have different review dates
|
||||
$this->assertNotEquals($parentPage->NextReviewDate, $childPage->NextReviewDate);
|
||||
|
||||
// But if we change the parent page ReviewPeriodDays to 10, the childs stays the same
|
||||
@ -262,9 +262,9 @@ class ContentReviewSettingsTest extends SapphireTest
|
||||
$this->assertEquals('2011-04-12', $childPage->NextReviewDate);
|
||||
$this->assertEquals($this->addDaysToDate(date("Y-m-d"), 10), $parentPage->NextReviewDate);
|
||||
|
||||
// Reviewing the child page should, however, advance its review by 10 days
|
||||
$childPage->advanceReviewDate();
|
||||
$childPage->write();
|
||||
// Reviewing the child page should, however, advance its review by 10 days
|
||||
$childPage->advanceReviewDate();
|
||||
$childPage->write();
|
||||
$this->assertEquals($this->addDaysToDate(date("Y-m-d"), 10), $childPage->NextReviewDate);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user