コード例 #1
0
ファイル: PDFLabel.php プロジェクト: tchern0/LabDB
 /**
  * Add label(s) to PDF
  *
  * @param mixed $entities
  */
 public function addLabel($entities, $alternative = false)
 {
     if (($entity = $entities) instanceof LabelInterface) {
         $barcode = $entity->getLabelBarcode();
         if ($entity instanceof AltLabelInterface && $alternative) {
             $text = $entity->getAltLabelText();
         } else {
             $text = $entity->getLabelText();
         }
         $owner = $this->om->getOwner($entity);
         $date = $entity instanceof LabelDateInterface ? $entity->getLabelDate()->format("d.m.Y") : null;
         $this->pdf->AddPage();
         $this->pdf->SetAutoPageBreak(false);
         $this->pdf->write2DBarcode($barcode, 'DATAMATRIX', 2, 2, 15, 15, $this->get2DBarcodeStyle());
         $this->pdf->setCellPaddings(0, 0, 0, 0);
         $this->pdf->setCellMargins(0, 0, 0, 0);
         $this->pdf->SetFont('DejaVuSans', 'B', 12);
         if ($text != '') {
             $this->pdf->MultiCell(30, 12.5, $text, 0, 'C', 0, 1, 20, 2, true, 0, false, true, 18.5, 'T', true);
         }
         $this->pdf->SetFont('DejaVuSans', '', 7);
         $this->pdf->MultiCell(15, 6, $barcode, 0, 'C', 0, 1, 2, 15, true, 0, false, true, 6, 'B', true);
         if (null !== $date) {
             $this->pdf->MultiCell(30, 6, $date, 0, 'C', 0, 1, 20, 18, true, 0, false, true, 6, 'B', true);
         }
         if (null !== $owner) {
             $this->pdf->MultiCell(25, 6, $owner, 0, 'L', 0, 1, 2, 18, true, 0, false, true, 6, 'B', true);
         }
     } elseif ($entities instanceof Collection) {
         foreach ($entities as $entity) {
             $this->addLabel($entity, $alternative);
         }
     } elseif (null === $entities) {
         throw new \ErrorException('Argument 1 must not be null');
     } else {
         throw new \ErrorException('Argument 1 must be an object of class
             VIB\\FliesBundle\\Label\\LabelInterface or Doctrine\\Common\\Collections\\Collection');
     }
 }
コード例 #2
0
ファイル: VialManager.php プロジェクト: tchern0/LabDB
 /**
  * 
  * @param type $object
  * @return type
  */
 public function getDefaultACL($object = null, $user = null)
 {
     $acl = parent::getDefaultACL($object, $user);
     if (($vial = $object) instanceof Vial) {
         $sourceVial = $vial->getParent();
         $acl = null !== $sourceVial && $this->securityContext->isGranted('OPERATOR', $sourceVial) ? $this->getACL($sourceVial) : $acl;
     }
     return $acl;
 }