public function setExistingChronicle(Chronicle $chronicle) { $this->setDefaults(array("id" => $chronicle->getId(), "title" => $chronicle->getTitle(), "keywords" => $chronicle->getKeywords(), "text" => $chronicle->getText(), "link" => $chronicle->getLink(), "link_type" => $chronicle->getLink_type(), "user_id" => $chronicle->getGroup()->getId(), "image" => $chronicle->getImage(), "type" => $chronicle->getType_id(), "user_id" => $chronicle->getUser()->getId(), "group_id" => $chronicle->getGroup()->getId())); if ($chronicle->getTag()) { $this->setDefault("tag_id", $chronicle->getTag()->getId()); } if ($chronicle->getBook()) { $this->setDefault("book_id", $chronicle->getBook()->getId()); } }
public function getGroup() { $this->__load(); return parent::getGroup(); }
private function checkUserCanEditChronicle(Chronicle $chronicle) { $globalContext = new \Sb\Context\Model\Context(); $chronicleGroupId = $chronicle->getGroup()->getId(); $found = false; foreach ($globalContext->getConnectedUser()->getGroupusers() as $groupUser) { /* @var $groupUser GroupUser */ if ($groupUser->getGroup()->getId() == $chronicleGroupId) { $found = true; break; } } if (!$found) { Flash::addItem(__("Vous ne pouvez pas éditer cette chronique.", "s1b")); HTTPHelper::redirectToReferer(); } }