Пример #1
0
 /**
  * @param string $attribute
  * @param OfferingInterface $offering
  * @param TokenInterface $token
  * @return bool
  */
 protected function voteOnAttribute($attribute, $offering, TokenInterface $token)
 {
     $session = $offering->getSession();
     if (!$session) {
         return false;
     }
     // grant perms based on the owning session
     return parent::voteOnAttribute($attribute, $session, $token);
 }
Пример #2
0
 /**
  * @param string $attribute
  * @param OfferingInterface $offering
  * @param UserInterface|null $user
  * @return bool
  */
 protected function isGranted($attribute, $offering, $user = null)
 {
     // grant perms based on the owning session
     return parent::isGranted($attribute, $offering->getSession(), $user);
 }
Пример #3
0
 /**
  * @param OfferingInterface $offering
  */
 protected function createAlertForNewOffering(OfferingInterface $offering)
 {
     // create new alert for this offering
     $alertManager = $this->container->get('ilioscore.alert.manager');
     $alertChangeTypeManager = $this->container->get('ilioscore.alertchangetype.manager');
     $alert = $alertManager->create();
     $alert->addChangeType($alertChangeTypeManager->findOneBy(['id' => AlertChangeTypeInterface::CHANGE_TYPE_NEW_OFFERING]));
     $alert->addInstigator($this->getUser());
     $alert->addRecipient($offering->getSession()->getCourse()->getSchool());
     $alert->setTableName('offering');
     $alert->setTableRowId($offering->getId());
     $alertManager->update($alert, true, false);
 }