function getAcl($object) { global $members; switch (get_class($object)) { case 'Community': return opCommunityTopicAclBuilder::buildCollection($object, $members); case 'CommunityTopic': return opCommunityTopicAclBuilder::buildResource($object, $members); } }
/** * preExecute */ public function preExecute() { if ($this->getRoute() instanceof sfDoctrineRoute) { $object = $this->getRoute()->getObject(); if ($object instanceof Community) { $this->community = $object; $this->acl = opCommunityTopicAclBuilder::buildCollection($this->community, array($this->getUser()->getMember())); } elseif ($object instanceof CommunityTopic) { $this->communityTopic = $object; $this->community = $this->communityTopic->getCommunity(); $this->acl = opCommunityTopicAclBuilder::buildResource($this->communityTopic, array($this->getUser()->getMember())); } } }
<?php use_helper('Date'); $acl = opCommunityTopicAclBuilder::buildCollection($community, array($sf_user->getMember())); ?> <?php /* ** added for opNicePlugin ** */ include_customizes("topicDetailBox", "top"); ?> <div class="dparts topicDetailBox"><div class="parts"> <div class="partsHeading"> <h3><?php echo '[' . $community->getName() . '] ' . __('Topic'); ?> </h3> </div> <dl> <dt><?php echo nl2br(op_format_date($communityTopic->getCreatedAt(), 'XDateTimeJaBr')); ?> </dt> <dd> <div class="title"> <p><?php echo $communityTopic->getName(); ?> </p> </div> <div class="name">
protected function isAllowed(opDoctrineRecord $object, Member $member, $action) { if ($object instanceof Community) { $acl = opCommunityTopicAclBuilder::buildCollection($object, array($this->member)); } elseif ($object instanceof CommunityTopic || $object instanceof CommunityEvent) { $acl = opCommunityTopicAclBuilder::buildResource($object, array($this->member)); } return $acl->isAllowed($this->member->getId(), null, $action); }
protected function getCollectionAcl($community, $member) { return opCommunityTopicAclBuilder::buildCollection($community, array($member)); }