1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:
14:
15: 16: 17: 18: 19:
20: class ClipitPost extends UBMessage {
21: 22: 23:
24: const SUBTYPE = "ClipitPost";
25: const REL_MESSAGE_DESTINATION = "ClipitPost-destination";
26: const REL_MESSAGE_FILE = "ClipitPost-ClipitFile";
27: const REL_MESSAGE_USER = "ClipitPost-ClipitUser";
28: const REL_POST_STORYBOARD = "ClipitPost-ClipitStoryboard";
29: const REL_POST_VIDEO = "ClipitPost-ClipitVideo";
30:
31: public $topic_id = 0;
32: public $storyboard_array = array();
33: public $video_array = array();
34:
35: 36: 37: 38: 39:
40: protected function copy_from_elgg($elgg_entity) {
41: parent::copy_from_elgg($elgg_entity);
42: $this->topic_id = (int)$elgg_entity->get("topic_id");
43: $this->storyboard_array = (array)static::get_storyboards((int)$this->id);
44: $this->video_array = (array)static::get_videos((int)$this->id);
45: }
46:
47: 48: 49: 50: 51:
52: protected function copy_to_elgg($elgg_entity) {
53: parent::copy_to_elgg($elgg_entity);
54: $elgg_entity->set("topic_id", $this->topic_id);
55: }
56:
57: 58: 59: 60: 61:
62: protected function save($double_save=false) {
63: parent::save($double_save);
64: static::set_storyboards($this->id, $this->storyboard_array);
65: static::set_videos($this->id, $this->video_array);
66: return $this->id;
67: }
68:
69:
70: static function add_storyboards($id, $storyboard_array) {
71: return UBCollection::add_items($id, $storyboard_array, static::REL_POST_STORYBOARD);
72: }
73:
74: static function set_storyboards($id, $storyboard_array) {
75: return UBCollection::set_items($id, $storyboard_array, static::REL_POST_STORYBOARD);
76: }
77:
78: static function remove_storyboards($id, $storyboard_array) {
79: return UBCollection::remove_items($id, $storyboard_array, static::REL_POST_STORYBOARD);
80: }
81:
82: static function get_storyboards($id) {
83: return UBCollection::get_items($id, static::REL_POST_STORYBOARD);
84: }
85:
86:
87: static function add_videos($id, $video_array) {
88: return UBCollection::add_items($id, $video_array, static::REL_POST_VIDEO);
89: }
90:
91: static function set_videos($id, $video_array) {
92: return UBCollection::set_items($id, $video_array, static::REL_POST_VIDEO);
93: }
94:
95: static function remove_videos($id, $video_array) {
96: return UBCollection::remove_items($id, $video_array, static::REL_POST_VIDEO);
97: }
98:
99: static function get_videos($id) {
100: return UBCollection::get_items($id, static::REL_POST_VIDEO);
101: }
102: }