Esempio n. 1
0
 /**
  * @param TblCompany|TblPerson|Element $tblEntity
  *
  * @return Layout
  */
 public function frontendLayoutCompany(Element $tblEntity)
 {
     if ($tblEntity instanceof TblPerson) {
         $tblRelationshipAll = Relationship::useService()->getCompanyRelationshipAllByPerson($tblEntity);
     } else {
         if ($tblEntity instanceof TblCompany) {
             $tblRelationshipAll = Relationship::useService()->getCompanyRelationshipAllByCompany($tblEntity);
         } else {
             $tblRelationshipAll = false;
         }
     }
     if ($tblRelationshipAll !== false) {
         /** @noinspection PhpUnusedParameterInspection */
         array_walk($tblRelationshipAll, function (TblToCompany &$tblToCompany, $Index, Element $tblEntity) {
             $Panel = array($tblToCompany->getServiceTblPerson()->getFullName(), $tblToCompany->getServiceTblCompany()->getName());
             if ($tblToCompany->getRemark()) {
                 array_push($Panel, new Muted(new Small($tblToCompany->getRemark())));
             }
             $tblToCompany = new LayoutColumn(new Panel(new Building() . ' ' . new Link() . ' ' . $tblToCompany->getTblType()->getName(), $Panel, $tblEntity instanceof TblPerson ? Panel::PANEL_TYPE_INFO : Panel::PANEL_TYPE_DEFAULT, $tblEntity instanceof TblPerson ? new Standard('', '/Corporation/Company/Relationship/Edit', new Pencil(), array('Id' => $tblToCompany->getId()), 'Bearbeiten') . new Standard('', '/Corporation/Company/Relationship/Destroy', new Remove(), array('Id' => $tblToCompany->getId()), 'Löschen') . new Standard('', '/Corporation/Company', new Building(), array('Id' => $tblToCompany->getServiceTblCompany()->getId()), 'zur Firma') : new Standard('', '/People/Person', new PersonIcon(), array('Id' => $tblToCompany->getServiceTblPerson()->getId()), 'zur Person')), 3);
         }, $tblEntity);
     } else {
         $tblRelationshipAll = array(new LayoutColumn(new Warning('Keine Firmenbeziehungen hinterlegt')));
     }
     $LayoutRowList = array();
     $LayoutRowCount = 0;
     $LayoutRow = null;
     /**
      * @var LayoutColumn $tblRelationship
      */
     foreach ($tblRelationshipAll as $tblRelationship) {
         if ($LayoutRowCount % 4 == 0) {
             $LayoutRow = new LayoutRow(array());
             $LayoutRowList[] = $LayoutRow;
         }
         $LayoutRow->addColumn($tblRelationship);
         $LayoutRowCount++;
     }
     return new Layout(new LayoutGroup($LayoutRowList));
 }
Esempio n. 2
0
 public function LayoutCombine(TblCompany $tblCompany)
 {
     $tblAddressAll = Address::useService()->getAddressAllByCompany($tblCompany);
     $tblPhoneAll = Phone::useService()->getPhoneAllByCompany($tblCompany);
     $tblMailAll = Mail::useService()->getMailAllByCompany($tblCompany);
     $tblRelationshipAll = Relationship::useService()->getCompanyRelationshipAllByCompany($tblCompany);
     if ($tblAddressAll !== false) {
         array_walk($tblAddressAll, function (TblToCompany &$tblToCompany) {
             $Panel = array($tblToCompany->getTblAddress()->getLayout());
             if ($tblToCompany->getRemark()) {
                 array_push($Panel, new Muted(new Small($tblToCompany->getRemark())));
             }
             $tblToCompany = new LayoutColumn(new Panel(new MapMarker() . ' ' . $tblToCompany->getTblType()->getName(), $Panel, Panel::PANEL_TYPE_SUCCESS, new Standard('', '/Corporation/Company/Address/Edit', new Pencil(), array('Id' => $tblToCompany->getId()), 'Bearbeiten') . new Standard('', '/Corporation/Company/Address/Destroy', new Remove(), array('Id' => $tblToCompany->getId()), 'Löschen')), 3);
         });
     } else {
         $tblAddressAll = array(new LayoutColumn(new Warning('Keine Adressen hinterlegt')));
     }
     if ($tblPhoneAll !== false) {
         array_walk($tblPhoneAll, function (\SPHERE\Application\Contact\Phone\Service\Entity\TblToCompany &$tblToCompany) {
             $Panel = array($tblToCompany->getTblPhone()->getNumber());
             if ($tblToCompany->getRemark()) {
                 array_push($Panel, new Muted(new Small($tblToCompany->getRemark())));
             }
             $tblToCompany = new LayoutColumn(new Panel((preg_match('!Fax!is', $tblToCompany->getTblType()->getName() . ' ' . $tblToCompany->getTblType()->getDescription()) ? new PhoneFax() : (preg_match('!Mobil!is', $tblToCompany->getTblType()->getName() . ' ' . $tblToCompany->getTblType()->getDescription()) ? new PhoneMobil() : new PhoneIcon())) . ' ' . $tblToCompany->getTblType()->getName() . ' ' . $tblToCompany->getTblType()->getDescription(), $Panel, preg_match('!Notfall!is', $tblToCompany->getTblType()->getName() . ' ' . $tblToCompany->getTblType()->getDescription()) ? Panel::PANEL_TYPE_DANGER : Panel::PANEL_TYPE_SUCCESS, new Standard('', '/Corporation/Company/Phone/Edit', new Pencil(), array('Id' => $tblToCompany->getId()), 'Bearbeiten') . new Standard('', '/Corporation/Company/Phone/Destroy', new Remove(), array('Id' => $tblToCompany->getId()), 'Löschen')), 3);
         });
     } else {
         $tblPhoneAll = array(new LayoutColumn(new Warning('Keine Telefonnummern hinterlegt')));
     }
     if ($tblMailAll !== false) {
         array_walk($tblMailAll, function (\SPHERE\Application\Contact\Mail\Service\Entity\TblToCompany &$tblToCompany) {
             $Panel = array($tblToCompany->getTblMail()->getAddress());
             if ($tblToCompany->getRemark()) {
                 array_push($Panel, new Muted(new Small($tblToCompany->getRemark())));
             }
             $tblToCompany = new LayoutColumn(new Panel(new MailIcon() . ' ' . $tblToCompany->getTblType()->getName(), $Panel, Panel::PANEL_TYPE_SUCCESS, new Standard('', '/Corporation/Company/Mail/Edit', new Pencil(), array('Id' => $tblToCompany->getId()), 'Bearbeiten') . new Standard('', '/Corporation/Company/Mail/Destroy', new Remove(), array('Id' => $tblToCompany->getId()), 'Löschen')), 3);
         });
     } else {
         $tblMailAll = array(new LayoutColumn(new Warning('Keine E-Mail Adressen hinterlegt')));
     }
     if ($tblRelationshipAll !== false) {
         array_walk($tblRelationshipAll, function (\SPHERE\Application\People\Relationship\Service\Entity\TblToCompany &$tblToCompany, $Index, TblCompany $tblCompany) {
             $Panel = array($tblToCompany->getServiceTblPerson()->getFullName(), $tblToCompany->getServiceTblCompany()->getName());
             if ($tblToCompany->getRemark()) {
                 array_push($Panel, new Muted(new Small($tblToCompany->getRemark())));
             }
             $tblToCompany = new LayoutColumn(new Panel(new Building() . ' ' . new Link() . ' ' . $tblToCompany->getTblType()->getName(), $Panel, Panel::PANEL_TYPE_DEFAULT, new Standard('', '/People/Person', new PersonIcon(), array('Id' => $tblToCompany->getServiceTblPerson()->getId()), 'zur Person')), 3);
         }, $tblCompany);
     } else {
         $tblRelationshipAll = array(new LayoutColumn(new Warning('Keine Firmenbeziehungen hinterlegt')));
     }
     $LayoutRowList = array();
     $LayoutRowCount = 0;
     $LayoutRow = null;
     /**
      * @var LayoutColumn $tblAddress
      */
     foreach ($tblAddressAll as $tblAddress) {
         if ($LayoutRowCount % 50 == 0) {
             $LayoutRow = new LayoutRow(array());
             $LayoutRowList[] = $LayoutRow;
         }
         $LayoutRow->addColumn($tblAddress);
         $LayoutRowCount++;
     }
     /**
      * @var LayoutColumn $tblPhone
      */
     foreach ($tblPhoneAll as $tblPhone) {
         if ($LayoutRowCount % 50 == 0) {
             $LayoutRow = new LayoutRow(array());
             $LayoutRowList[] = $LayoutRow;
         }
         $LayoutRow->addColumn($tblPhone);
         $LayoutRowCount++;
     }
     /**
      * @var LayoutColumn $tblMail
      */
     foreach ($tblMailAll as $tblMail) {
         if ($LayoutRowCount % 50 == 0) {
             $LayoutRow = new LayoutRow(array());
             $LayoutRowList[] = $LayoutRow;
         }
         $LayoutRow->addColumn($tblMail);
         $LayoutRowCount++;
     }
     /**
      * @var LayoutColumn $tblRelationship
      */
     foreach ($tblRelationshipAll as $tblRelationship) {
         if ($LayoutRowCount % 50 == 0) {
             $LayoutRow = new LayoutRow(array());
             $LayoutRowList[] = $LayoutRow;
         }
         $LayoutRow->addColumn($tblRelationship);
         $LayoutRowCount++;
     }
     return new Layout(new LayoutGroup($LayoutRowList));
 }