Пример #1
0
 public static function registerApplication()
 {
     Common::registerModule();
     Prospect::registerModule();
     Student::registerModule();
     Custody::registerModule();
 }
Пример #2
0
 /**
  * @param TblPerson $tblPerson
  * @param array     $Meta
  *
  * @return Stage
  */
 public function frontendMeta(TblPerson $tblPerson = null, $Meta = array())
 {
     $Stage = new Stage();
     $Stage->setMessage(new Danger(new Info() . ' Es dürfen ausschließlich für die Schulverwaltung notwendige Informationen gespeichert werden.'));
     if (null !== $tblPerson) {
         $Global = $this->getGlobal();
         if (!isset($Global->POST['Meta'])) {
             /** @var TblCustody $tblCustody */
             $tblCustody = Custody::useService()->getCustodyByPerson($tblPerson);
             if ($tblCustody) {
                 $Global->POST['Meta']['Remark'] = $tblCustody->getRemark();
                 $Global->POST['Meta']['Occupation'] = $tblCustody->getOccupation();
                 $Global->POST['Meta']['Employment'] = $tblCustody->getEmployment();
                 $Global->savePost();
             }
         }
     }
     $Stage->setContent(Custody::useService()->createMeta((new Form(array(new FormGroup(array(new FormRow(array(new FormColumn(new Panel('Berufliches', array(new AutoCompleter('Meta[Occupation]', 'Beruf', 'Beruf', array(), new MapMarker()), new AutoCompleter('Meta[Employment]', 'Arbeitsstelle', 'Arbeitsstelle', array(), new Nameplate())), Panel::PANEL_TYPE_INFO), 6), new FormColumn(new Panel('Sonstiges', array(new TextArea('Meta[Remark]', 'Bemerkungen', 'Bemerkungen', new Pencil())), Panel::PANEL_TYPE_INFO), 6)))))), new Primary('Informationen speichern')))->setConfirm('Eventuelle Änderungen wurden noch nicht gespeichert.'), $tblPerson, $Meta));
     return $Stage;
 }
Пример #3
0
 /**
  * @param bool|false|string $TabActive
  *
  * @param null|int   $Id
  * @param null|array $Person
  * @param null|array $Meta
  *
  * @return Stage
  */
 public function frontendPerson($TabActive = 'Common', $Id = null, $Person = null, $Meta = null)
 {
     $Stage = new Stage('Personen', 'Datenblatt');
     if (!$Id) {
         $BasicTable = Person::useService()->createPerson($this->formPerson()->appendFormButton(new Primary('Grunddaten anlegen'))->setConfirm('Eventuelle Änderungen wurden noch nicht gespeichert'), $Person);
         $Stage->setContent(new Layout(array(new LayoutGroup(new LayoutRow(new LayoutColumn($BasicTable)), new Title(new PersonParent() . ' Grunddaten', 'der Person')))));
     } else {
         $tblPerson = Person::useService()->getPersonById($Id);
         $Global = $this->getGlobal();
         if (!isset($Global->POST['Person'])) {
             $Global->POST['Person']['Salutation'] = $tblPerson->getTblSalutation()->getId();
             $Global->POST['Person']['Title'] = $tblPerson->getTitle();
             $Global->POST['Person']['FirstName'] = $tblPerson->getFirstName();
             $Global->POST['Person']['SecondName'] = $tblPerson->getSecondName();
             $Global->POST['Person']['LastName'] = $tblPerson->getLastName();
             $tblGroupAll = Group::useService()->getGroupAllByPerson($tblPerson);
             if (!empty($tblGroupAll)) {
                 /** @var TblGroup $tblGroup */
                 foreach ((array) $tblGroupAll as $tblGroup) {
                     $Global->POST['Person']['Group'][$tblGroup->getId()] = $tblGroup->getId();
                 }
             }
             $Global->savePost();
         }
         $BasicTable = Person::useService()->updatePerson($this->formPerson()->appendFormButton(new Primary('Grunddaten speichern'))->setConfirm('Eventuelle Änderungen wurden noch nicht gespeichert'), $tblPerson, $Person);
         $MetaTabs = Group::useService()->getGroupAllByPerson($tblPerson);
         // Sort by Name
         usort($MetaTabs, function (TblGroup $ObjectA, TblGroup $ObjectB) {
             return strnatcmp($ObjectA->getName(), $ObjectB->getName());
         });
         // Create Tabs
         /** @noinspection PhpUnusedParameterInspection */
         array_walk($MetaTabs, function (TblGroup &$tblGroup, $Index, TblPerson $tblPerson) {
             switch (strtoupper($tblGroup->getMetaTable())) {
                 case 'COMMON':
                     $tblGroup = new LayoutTab('Personendaten', $tblGroup->getMetaTable(), array('Id' => $tblPerson->getId()));
                     break;
                 case 'PROSPECT':
                     $tblGroup = new LayoutTab('Interessent', $tblGroup->getMetaTable(), array('Id' => $tblPerson->getId()));
                     break;
                 case 'STUDENT':
                     $tblGroup = new LayoutTab('Schülerakte', $tblGroup->getMetaTable(), array('Id' => $tblPerson->getId()));
                     break;
                 case 'CUSTODY':
                     $tblGroup = new LayoutTab('Sorgerechtdaten', $tblGroup->getMetaTable(), array('Id' => $tblPerson->getId()));
                     break;
                 default:
                     $tblGroup = false;
             }
         }, $tblPerson);
         /** @var LayoutTab[] $MetaTabs */
         $MetaTabs = array_filter($MetaTabs);
         // Folded ?
         if (!empty($MetaTabs)) {
             if (!$TabActive || $TabActive == '#') {
                 array_unshift($MetaTabs, new LayoutTab(' ' . new ChevronRight() . ' ', '#', array('Id' => $tblPerson->getId())));
                 $MetaTabs[0]->setActive();
             } else {
                 if ($TabActive == 'Common') {
                     array_unshift($MetaTabs, new LayoutTab(' ' . new ChevronUp() . ' ', '#', array('Id' => $tblPerson->getId())));
                     $MetaTabs[1]->setActive();
                 } else {
                     array_unshift($MetaTabs, new LayoutTab(' ' . new ChevronUp() . ' ', '#', array('Id' => $tblPerson->getId())));
                 }
             }
         }
         switch (strtoupper($TabActive)) {
             case 'COMMON':
                 $MetaTable = Common::useFrontend()->frontendMeta($tblPerson, $Meta);
                 break;
             case 'PROSPECT':
                 $MetaTable = Prospect::useFrontend()->frontendMeta($tblPerson, $Meta);
                 break;
             case 'STUDENT':
                 $MetaTable = Student::useFrontend()->frontendMeta($tblPerson, $Meta);
                 break;
             case 'CUSTODY':
                 $MetaTable = Custody::useFrontend()->frontendMeta($tblPerson, $Meta);
                 break;
             default:
                 if (!empty($MetaTabs)) {
                     $MetaTable = new Well(new Muted('Bitte wählen Sie eine Rubrik'));
                 } else {
                     $MetaTable = new Well(new Warning('Keine Informationen verfügbar'));
                 }
         }
         $Stage->setContent(new Layout(array(new LayoutGroup(new LayoutRow(new LayoutColumn(array(new Panel(new PersonIcon() . ' Person', $tblPerson->getFullName(), Panel::PANEL_TYPE_SUCCESS), $BasicTable))), new Title(new PersonParent() . ' Grunddaten', 'der Person')), new LayoutGroup(array(new LayoutRow(new LayoutColumn(new LayoutTabs($MetaTabs))), new LayoutRow(new LayoutColumn($MetaTable))), new Title(new Tag() . ' Informationen', 'zur Person')), new LayoutGroup(array(new LayoutRow(new LayoutColumn(Address::useFrontend()->frontendLayoutPerson($tblPerson)))), (new Title(new TagList() . ' Adressdaten', 'der Person'))->addButton(new Standard('Adresse hinzufügen', '/People/Person/Address/Create', new ChevronDown(), array('Id' => $tblPerson->getId())))), new LayoutGroup(array(new LayoutRow(new LayoutColumn(Phone::useFrontend()->frontendLayoutPerson($tblPerson) . Mail::useFrontend()->frontendLayoutPerson($tblPerson)))), (new Title(new TagList() . ' Kontaktdaten', 'der Person'))->addButton(new Standard('Telefonnummer hinzufügen', '/People/Person/Phone/Create', new ChevronDown(), array('Id' => $tblPerson->getId())))->addButton(new Standard('E-Mail Adresse hinzufügen', '/People/Person/Mail/Create', new ChevronDown(), array('Id' => $tblPerson->getId())))), new LayoutGroup(array(new LayoutRow(new LayoutColumn(array(Relationship::useFrontend()->frontendLayoutPerson($tblPerson), Relationship::useFrontend()->frontendLayoutCompany($tblPerson))))), (new Title(new TagList() . ' Beziehungen', 'zu Personen und Firmen'))->addButton(new Standard('Personenbeziehung hinzufügen', '/People/Person/Relationship/Create', new ChevronDown(), array('Id' => $tblPerson->getId())))->addButton(new Standard('Firmenbeziehung hinzufügen', '/Corporation/Company/Relationship/Create', new ChevronDown(), array('Id' => $tblPerson->getId())))))));
     }
     return $Stage;
 }