/** * Creates a note for an action with a transition * @param Element\AbstractElement $element * @param string $type * @param string $title * @param string $description * @param array $noteData * @return Element\Note $note */ public static function createActionNote($element, $type, $title, $description, $noteData, $user = null) { //prepare some vars for creating the note if (!$user) { $user = \Pimcore\Tool\Admin::getCurrentUser(); } $note = new Element\Note(); $note->setElement($element); $note->setDate(time()); $note->setType($type); $note->setTitle($title); $note->setDescription($description); $note->setUser($user->getId()); if (is_array($noteData)) { foreach ($noteData as $row) { $note->addData($row['key'], $row['type'], $row['value']); } } $note->save(); return $note; }
/** * @param $code string * @return bool */ public function confirmParticipationByCode($code) { $participation = Participation::getByConfirmationCode($code, 1); if (is_object($participation)) { $participation->SetIpConfirmed($_SERVER['REMOTE_ADDR']); $participation->setConfirmed(true); $participation->save(); $note = new Note(); $note->setElement($participation); $note->setDate(time()); $note->setType("confirmation"); $note->setTitle("Code confirmed"); $note->addData("code", "text", $code); $note->setUser(0); $note->save(); return true; } return false; }