Changeset View
Changeset View
Standalone View
Standalone View
plugins/libkolab/lib/kolab_format_task.php
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | public function set(&$object) | ||||
$status = kolabformat::StatusUndefined; | $status = kolabformat::StatusUndefined; | ||||
if ($object['complete'] == 100 && !array_key_exists('status', $object)) | if ($object['complete'] == 100 && !array_key_exists('status', $object)) | ||||
$status = kolabformat::StatusCompleted; | $status = kolabformat::StatusCompleted; | ||||
else if ($object['status'] && array_key_exists($object['status'], $this->status_map)) | else if ($object['status'] && array_key_exists($object['status'], $this->status_map)) | ||||
$status = $this->status_map[$object['status']]; | $status = $this->status_map[$object['status']]; | ||||
$this->obj->setStatus($status); | $this->obj->setStatus($status); | ||||
$this->obj->setStart(self::get_datetime($object['start'], null, $object['start']->_dateonly)); | $this->obj->setStart(self::get_datetime($object['start'] ?? null, null, ($object['start'] ?? null) ? $object['start']->_dateonly : null)); | ||||
$this->obj->setDue(self::get_datetime($object['due'], null, $object['due']->_dateonly)); | $this->obj->setDue(self::get_datetime($object['due'] ?? null, null, ($object['due'] ?? null) ? $object['due']->_dateonly : null)); | ||||
$related = new vectors; | $related = new vectors; | ||||
if (!empty($object['parent_id'])) | if (!empty($object['parent_id'])) | ||||
$related->push($object['parent_id']); | $related->push($object['parent_id']); | ||||
$this->obj->setRelatedTo($related); | $this->obj->setRelatedTo($related); | ||||
// cache this data | // cache this data | ||||
$this->data = $object; | $this->data = $object; | ||||
▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | class kolab_format_task extends kolab_format_xcal | ||||
* | * | ||||
* @return array List of tags to save in cache | * @return array List of tags to save in cache | ||||
*/ | */ | ||||
public function get_tags($obj = null) | public function get_tags($obj = null) | ||||
{ | { | ||||
$tags = parent::get_tags($obj); | $tags = parent::get_tags($obj); | ||||
$object = $obj ?: $this->data; | $object = $obj ?: $this->data; | ||||
if ($object['status'] == 'COMPLETED' || ($object['complete'] == 100 && empty($object['status']))) | if (($object['status'] ?? null) == 'COMPLETED' || (($object['complete'] ?? null) == 100 && empty($object['status'] ?? null))) | ||||
$tags[] = 'x-complete'; | $tags[] = 'x-complete'; | ||||
if ($object['priority'] == 1) | if (($object['priority'] ?? 0) == 1) | ||||
$tags[] = 'x-flagged'; | $tags[] = 'x-flagged'; | ||||
if ($object['parent_id']) | if ($object['parent_id'] ?? false) | ||||
$tags[] = 'x-parent:' . $object['parent_id']; | $tags[] = 'x-parent:' . $object['parent_id']; | ||||
return array_unique($tags); | return array_unique($tags); | ||||
} | } | ||||
} | } |