public function renderPeople() { $ISmembers = $this->skautIS->org->PersonAllExport(array("ID_Unit" => 25634)); $this->template->person = []; $this->template->validMembers = []; $this->template->validISmembers = []; $this->template->invalidISmembers = []; $reg_numbers = []; foreach ($ISmembers as $ISmember) { $reg = $ISmember->RegistrationNumber; $member = $this->registrations->getBy(['registration_number' => $reg]); if ($member) { $this->template->person[] = $ISmember; $this->template->validMembers[] = $member; $this->template->validISmembers[] = $ISmember; $reg_numbers[] = $reg; } else { $this->template->invalidISmembers[] = $ISmember; } } if (count($this->template->validISmembers) === count($this->template->validMembers)) { $this->template->validSize = count($this->template->validISmembers); } else { $this->error('Došlo k chybě při komunikaci s IS skautem.', \Nette\Http\IResponse::S500_INTERNAL_SERVER_ERROR); } $this->template->invalidMembers = $this->registrations->findAll()->where('registration_number NOT ? OR registration_number IS NULL', $reg_numbers); }
/** * Form for editing the invitations to events * * @Action("edit") * @Privilege("edit") */ protected function createComponentEditEventForm() { $form = new Form(); $form->addProtection('Vypršel časový limit, odešlete formulář znovu'); $form->addHidden('id'); $form->addText('name', 'Název akce:')->setRequired('Vyplňte název akce'); $form->addTextarea('text', 'Úvodní text lístečku:')->setRequired('Vyplňte text lístečku')->setAttribute('rows', 5); $form->addDynamic('event_meeting', function (Container $container) { $container->addText('comment', 'Typ srazu:'); $container->addDateTimePicker('starttime', 'Datum a čas srazu:')->setRequired('Vyplňte čas srazu'); $container->addText('startplace', 'Místo srazu:')->setRequired('Vyplňte místo srazu'); $container->addDateTimePicker('endtime', 'Datum a čas návratu:')->setRequired('Vyplňte čas návratu'); $container->addText('endplace', 'Místo návratu:')->setRequired('Vyplňte místo návratu'); $container->addSubmit('remove', 'X')->setValidationScope(FALSE)->addRemoveOnClick(); //intentional, delete after whole form submit }, 1)->addSubmit('add', 'Přidat sraz')->setValidationScope(FALSE)->addCreateOnClick(TRUE); $form->addTextarea('equipment', 'S sebou:')->setRequired('Vyplňte co si s sebou vzít na akci')->setAttribute('rows', 5); $form->addTextarea('morse', 'Morseovka:')->setAttribute('rows', 5); //contact person $contacts = $this->registrations->findBy(['member_nickname IS NOT NULL'])->fetchPairs('member_nickname', 'member_nickname'); $form->addSelect('contactperson', 'Kontaktní osoba:', $contacts)->setRequired('Vyberte kontaktní osobu')->setPrompt('Kontaktní osoba'); if ($this->user->isAllowed('Admin:Default:Event', 'show')) { $form->addCheckbox('showevent', 'Zobrazit lísteček')->setDefaultValue(TRUE); } $form->addSubmit('send', 'Změnit'); $form->onSuccess[] = $this->editEventFormSucceded; return $form; }
/** * Processing of registration form * * @Privilege("create", "edit") * * @param \Nette\Application\UI\Form $form */ public function registrationFormSucceded(\Nette\Application\UI\Form $form) { $values = $form->getValues(TRUE); unset($values['send']); if (!array_key_exists('member_nickname', $values)) { // registration for new member $values['member_nickname'] = $values['nickname']; unset($values['nickname']); } $item = $this->registrations->get($values['member_nickname']); if ($item) { $item->update($values); $this->flashMessage('Záznam byl úspěšně editován'); } else { $this->registrations->insert($values); $this->flashMessage('Záznam byl úspěšně přidán'); } $this->redirect('default'); }
public function deleteUser() { $register = new Registration($this->user_id); $register->delete(); $this->delete(); /// redirect tologout }