ItemEdit.php
1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
require_once (B2S_PLUGIN_DIR . 'includes/B2S/Ship/Item.php');
class B2S_Calendar_ItemEdit extends B2S_Ship_Item {
private $calenderItem = null;
private $b2s_id = null;
public function setB2SId($value)
{
if(is_numeric($value))
{
$this->b2s_id = $value;
}
return $this;
}
private function getCalendarItem()
{
if(is_null($this->calenderItem))
{
if($this->b2s_id)
{
$this->calenderItem = B2S_Calendar_Filter::getById($this->b2s_id);
return $this->calenderItem;
}
$filter = B2S_Calendar_Filter::getByPostId($this->getPostId());
$items = $filter->getItems();
if(count($filter->getItems()) > 0) {
$this->calenderItem = $items[0];
}
}
return $this->calenderItem;
}
protected function hook_message($message)
{
if($this->getCalendarItem())
{
$sched_data = $this->getCalendarItem()->getSchedData();
if($sched_data)
{
return $sched_data['content'];
}
}
return $message;
}
protected function hook_sched_data(array $schedData)
{
if($this->getCalendarItem())
{
$schedData = $this->getCalendarItem()->getSchedData();
}
return $schedData;
}
protected function hook_meta(array $meta)
{
if($this->getCalendarItem())
{
$meta['image'] = $this->getCalendarItem()->getImageUrl();
}
return $meta;
}
}