Converted to PSR-2

This commit is contained in:
helpfulrobot 2015-11-18 16:38:28 +13:00
parent ddf5052503
commit 98c125360b
3 changed files with 25 additions and 25 deletions

View File

@ -352,7 +352,7 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
$userField = ListboxField::create("OwnerUsers", _t("ContentReview.PAGEOWNERUSERS", "Users"), $usersMap) $userField = ListboxField::create("OwnerUsers", _t("ContentReview.PAGEOWNERUSERS", "Users"), $usersMap)
->setMultiple(true) ->setMultiple(true)
->addExtraClass('custom-setting') ->addExtraClass('custom-setting')
->setAttribute("data-placeholder", _t("ContentReview.ADDUSERS", "Add users")) ->setAttribute("data-placeholder", _t("ContentReview.ADDUSERS", "Add users"))
->setDescription(_t('ContentReview.OWNERUSERSDESCRIPTION', 'Page owners that are responsible for reviews')); ->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) $groupField = ListboxField::create("OwnerGroups", _t("ContentReview.PAGEOWNERGROUPS", "Groups"), $groupsMap)
->setMultiple(true) ->setMultiple(true)
->addExtraClass('custom-setting') ->addExtraClass('custom-setting')
->setAttribute("data-placeholder", _t("ContentReview.ADDGROUP", "Add groups")) ->setAttribute("data-placeholder", _t("ContentReview.ADDGROUP", "Add groups"))
->setDescription(_t("ContentReview.OWNERGROUPSDESCRIPTION", "Page owners that are responsible for reviews")); ->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")); ->setDescription(_t("ContentReview.NEXTREVIEWDATADESCRIPTION", "Leave blank for no review"));
$reviewFrequency = DropdownField::create( $reviewFrequency = DropdownField::create(
"ReviewPeriodDays", "ReviewPeriodDays",
_t("ContentReview.REVIEWFREQUENCY", "Review frequency"), _t("ContentReview.REVIEWFREQUENCY", "Review frequency"),
self::get_schedule() self::get_schedule()
) )
->addExtraClass('custom-setting') ->addExtraClass('custom-setting')
->setDescription(_t("ContentReview.REVIEWFREQUENCYDESCRIPTION", "The review date will be set to this far in the future whenever the page is published")); ->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()); $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() protected function setDefaultReviewDateForCustom()
{ {
// Don't overwrite existing value // Don't overwrite existing value
if ($this->owner->NextReviewDate) { if ($this->owner->NextReviewDate) {
return; return;
} }
@ -536,10 +536,10 @@ class SiteTreeContentReview extends DataExtension implements PermissionProvider
protected function setDefaultReviewDateForInherited() protected function setDefaultReviewDateForInherited()
{ {
// Don't overwrite existing value // Don't overwrite existing value
if($this->owner->NextReviewDate) { if ($this->owner->NextReviewDate) {
return; return;
} }
$options = $this->getOptions(); $options = $this->getOptions();
$nextDate = null; $nextDate = null;

View File

@ -167,7 +167,7 @@ class PagesDueForReviewReport extends SS_Report
if (!empty($params["OnlyMyPages"])) { if (!empty($params["OnlyMyPages"])) {
$currentUser = Member::currentUser(); $currentUser = Member::currentUser();
$records = $records->filterByCallback(function($page) use ($currentUser) { $records = $records->filterByCallback(function ($page) use ($currentUser) {
$options = $page->getOptions(); $options = $page->getOptions();
foreach ($options->ContentReviewOwners() as $owner) { foreach ($options->ContentReviewOwners() as $owner) {

View File

@ -68,16 +68,16 @@ class ContentReviewSettingsTest extends SapphireTest
public function testAdvanceReviewFromInheritedSettings() 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"); $parentPage = $this->objFromFixture("Page", "page-1");
$this->assertTrue($parentPage->advanceReviewDate()); $this->assertTrue($parentPage->advanceReviewDate());
$parentPage->write(); $parentPage->write();
$page = $this->objFromFixture("Page", "page-1-1"); $page = $this->objFromFixture("Page", "page-1-1");
$this->assertEquals(date("Y-m-d", strtotime("now + 5 days")), $parentPage->NextReviewDate); $this->assertEquals(date("Y-m-d", strtotime("now + 5 days")), $parentPage->NextReviewDate);
$this->assertEquals('2011-04-12', $page->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()); $this->assertTrue($page->advanceReviewDate());
$page->write(); $page->write();
$this->assertEquals(date("Y-m-d", strtotime("now + 5 days")), $page->NextReviewDate); $this->assertEquals(date("Y-m-d", strtotime("now + 5 days")), $page->NextReviewDate);
@ -185,7 +185,7 @@ class ContentReviewSettingsTest extends SapphireTest
public function testGetNextReviewDateFromPageInheritedSetting() 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"); $page = $this->objFromFixture("Page", "page-1-1");
$nextReviewDate = $page->getReviewDate(); $nextReviewDate = $page->getReviewDate();
$this->assertInstanceOf("Date", $nextReviewDate); $this->assertInstanceOf("Date", $nextReviewDate);
@ -242,7 +242,7 @@ class ContentReviewSettingsTest extends SapphireTest
/** @var Page|SiteTreeContentReview $childPage */ /** @var Page|SiteTreeContentReview $childPage */
$childPage = $this->objFromFixture("Page", "page-1-1"); $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); $this->assertNotEquals($parentPage->NextReviewDate, $childPage->NextReviewDate);
// But if we change the parent page ReviewPeriodDays to 10, the childs stays the same // 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('2011-04-12', $childPage->NextReviewDate);
$this->assertEquals($this->addDaysToDate(date("Y-m-d"), 10), $parentPage->NextReviewDate); $this->assertEquals($this->addDaysToDate(date("Y-m-d"), 10), $parentPage->NextReviewDate);
// Reviewing the child page should, however, advance its review by 10 days // Reviewing the child page should, however, advance its review by 10 days
$childPage->advanceReviewDate(); $childPage->advanceReviewDate();
$childPage->write(); $childPage->write();
$this->assertEquals($this->addDaysToDate(date("Y-m-d"), 10), $childPage->NextReviewDate); $this->assertEquals($this->addDaysToDate(date("Y-m-d"), 10), $childPage->NextReviewDate);
} }