-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathPluginCommunityEventComment.class.php
More file actions
47 lines (42 loc) · 1.23 KB
/
PluginCommunityEventComment.class.php
File metadata and controls
47 lines (42 loc) · 1.23 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
<?php
/**
* This file is part of the OpenPNE package.
* (c) OpenPNE Project (http://www.openpne.jp/)
*
* For the full copyright and license information, please view the LICENSE
* file and the NOTICE file that were distributed with this source code.
*/
/**
* PluginCommunityEvent
*
* @package opCommunityTopicPlugin
* @subpackage CommunityEventComment
* @author Kousuke Ebihara <ebihara@tejimaya.com>
*/
abstract class PluginCommunityEventComment extends BaseCommunityEventComment
{
public function isDeletable($memberId)
{
return ($this->getMemberId() === $memberId || $this->getCommunityEvent()->isEditable($memberId));
}
public function preSave($event)
{
$modified = $this->getModified();
if ($this->isNew() && empty($modified['number']))
{
$this->getCommunityEvent()->setEventUpdatedAt(date('Y-m-d H:i:s', time()));
$this->setNumber(Doctrine::getTable('CommunityEventComment')->getMaxNumber($this->getCommunityEventId()) + 1);
}
}
public function preDelete($event)
{
foreach ($this->Images as $eventCommentImage)
{
$eventCommentImage->delete();
}
}
public function toggleEventMember($memberId)
{
$this->getCommunityEvent()->toggleEventMember($memberId);
}
}