function index() { $Member = Member::CurrentUser(); if ($Member == null) { //echo "do resgistration"; if ($RegistrationPage = DataObject::get_one('RegistrationPage')) { return $this->redirect($RegistrationPage->Link()); } } else { //echo "do edit registration"; if ($EditProfilePage = DataObject::get_one('EditProfilePage')) { return $this->redirect($EditProfilePage->Link()); } } }
function EditProfileForm() { //Create our fields $fields = new FieldList(new TextField('FirstName', '<span>*</span> Firstname'), new TextField('Surname', '<span>*</span> Surname'), new EmailField('Email', '<span>*</span> Email'), new TextField('JobTitle', 'Job Title'), new TextField('Website', 'Website (Without http://)'), new TextareaField('Blurb'), new ConfirmedPasswordField('Password', 'New Password')); // Create action $actions = new FieldList(new FormAction('SaveProfile', 'Save')); // Create action $validator = new RequiredFields('FirstName', 'Email'); //Create form $Form = new Form($this, 'EditProfileForm', $fields, $actions, $validator); //Populate the form with the current members data $Member = Member::CurrentUser(); $Form->loadDataFrom($Member->data()); //Return the form return $Form; }
function __construct($controller, $name, $use_actions = true) { $RatingField = new TextField('rating', ''); $RatingField->setValue(0); $TitleField = new TextField('title', 'Title'); $CommentField = new HtmlEditorField('comment', 'Comment'); $CommentField->setRows(8); $CompanyServiceIDField = new HiddenField('company_service_ID', ''); $CompanyServiceIDField->setValue($controller->company_service_ID); $LoggedInField = new HiddenField('logged_in', ''); if (Member::CurrentUser()) { $LoggedInField->setValue(1); } $fields = new FieldList($RatingField, $TitleField, $CommentField, $CompanyServiceIDField, $LoggedInField); // Create action $actions = new FieldList(); if ($use_actions) { $actions->push(new FormAction('saveReview', 'Submit')); } $this->addExtraClass('review-form'); parent::__construct($controller, $name, $fields, $actions); }
/** * @param ReviewMainInfo $info * @return void */ public function registerReviewMainInfo(ReviewMainInfo $info) { if ($this->Title != $info->getTitle() || $this->Comment != $info->getComment() || $this->Rating != $info->getRating()) { $this->Approved = 0; } $this->Title = $info->getTitle(); $this->Comment = $info->getComment(); $this->Rating = $info->getRating(); $this->setMember(Member::CurrentUser()); }
public function RegisterForEventByInvoice() { if ($member = Member::CurrentUser()) { $id = ""; $eventId = $this->myEvent['Id']; $contactId = $member->MagnetismID; $groupId = ""; $registrationDate = Date('Y-m-d'); $paymentDate = $registrationDate; $price = $this->myEvent['Price']; $statusReason = 1; $statusReasonName = "placeholder string"; $paid = false; $attended = true; $details = "placeholder string"; $sendArray = array("Id" => $id, "EventId" => $eventId, "ContactId" => $contactId, "GroupId" => $groupId, "RegistrationDate" => $registrationDate, "PaymentDate" => $paymentDate, "Price" => $price, "StatusReason" => $statusReason, "StatusReasonName" => $statusReasonName, "Paid" => $paid, "Attended" => $attended, "Details" => $details); $obj = MagnetismConnect::magnetism_connect_singleton(); $result = $obj->registerForEvent($sendArray); if ($result) { Controller::redirect($this->Link("?name={$this->myEventName}&success=1")); } } }
/** * Mark this Pipeline as aborted * * @return void */ public function markAborted() { $this->Status = 'Aborted'; $logMessage = sprintf("Pipeline processing aborted. %s (%s) aborted the pipeline", Member::CurrentUser()->Name, Member::CurrentUser()->Email); $this->log($logMessage); $this->write(); // Abort all running or queued steps. $steps = $this->Steps(); foreach ($steps as $step) { if ($step->isQueued() || $step->isRunning()) { $step->abort(); } } // Send notification to users about this event $this->sendMessage(self::ALERT_ABORT); }