-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4137 from TehThanos/master
- Loading branch information
Showing
25 changed files
with
585 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @copyright Copyright (c) 2016 Julius Härtl <[email protected]> | ||
* | ||
|
@@ -37,6 +40,8 @@ | |
* @method int getCreatedAt() | ||
* @method bool getArchived() | ||
* @method bool getNotified() | ||
* @method ?DateTime getDone() | ||
* @method void setDone(?DateTime $done) | ||
* | ||
* @method void setLabels(Label[] $labels) | ||
* @method null|Label[] getLabels() | ||
|
@@ -83,6 +88,7 @@ class Card extends RelationalEntity { | |
protected $owner; | ||
protected $order; | ||
protected $archived = false; | ||
protected $done = null; | ||
protected $duedate; | ||
protected $notified = false; | ||
protected $deletedAt = 0; | ||
|
@@ -106,6 +112,7 @@ public function __construct() { | |
$this->addType('lastModified', 'integer'); | ||
$this->addType('createdAt', 'integer'); | ||
$this->addType('archived', 'boolean'); | ||
$this->addType('done', 'datetime'); | ||
$this->addType('notified', 'boolean'); | ||
$this->addType('deletedAt', 'integer'); | ||
$this->addType('duedate', 'datetime'); | ||
|
@@ -139,19 +146,22 @@ public function getCalendarObject(): VCalendar { | |
$event->add('RELATED-TO', 'deck-stack-' . $this->getStackId()); | ||
|
||
// FIXME: For write support: CANCELLED / IN-PROCESS handling | ||
$event->STATUS = $this->getArchived() ? "COMPLETED" : "NEEDS-ACTION"; | ||
if ($this->getArchived()) { | ||
if ($this->getDone() || $this->getArchived()) { | ||
$date = new DateTime(); | ||
$date->setTimestamp($this->getLastModified()); | ||
$event->COMPLETED = $date; | ||
//$event->add('PERCENT-COMPLETE', 100); | ||
} | ||
if (count($this->getLabels()) > 0) { | ||
$event->CATEGORIES = array_map(function ($label) { | ||
return $label->getTitle(); | ||
}, $this->getLabels()); | ||
$event->STATUS = 'COMPLETED'; | ||
$event->COMPLETED = $this->getDone() ? $this->$this->getDone() : $this->getArchived(); | ||
} else { | ||
$event->STATUS = 'NEEDS-ACTION'; | ||
} | ||
|
||
// $event->add('PERCENT-COMPLETE', 100); | ||
|
||
$labels = $this->getLabels() ?? []; | ||
$event->CATEGORIES = array_map(function ($label): string { | ||
return $label->getTitle(); | ||
}, $labels); | ||
|
||
$event->SUMMARY = $this->getTitle(); | ||
$event->DESCRIPTION = $this->getDescription(); | ||
$calendar->add($event); | ||
|
@@ -177,7 +187,7 @@ public function getCalendarPrefix(): string { | |
return 'card'; | ||
} | ||
|
||
public function getETag() { | ||
public function getETag(): string { | ||
return md5((string)$this->getLastModified()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.