private function populate($object, $element) { $i = 0; $attributes = $element->attributes; while ($attributes->item($i) != null) { $node = $attributes->item($i); /*String*/ $attrName = $node->nodeName; /*String*/ $attrValue = $node->nodeValue; DataUtils::setValue($object, $attrName, $attrValue); $i++; } }
public function initComponent($pdfWriter, $pdfDocument, $baseX, $baseY, $marginTop, $marginLeft, $marginRight, $marginBottom, $parentWidth, $parentHeight) { /*PDFMetadata*/ $metadata = $pdfDocument->metadata; if ($metadata != null) { /*Property[]*/ $properties = $metadata->getPropertiesByTarget($this->dataField); if (count($properties) != 0) { foreach ($properties as $property) { DataUtils::setValue($this, $property->name, (string) $property->value); } } } }
public function initComponent(Document $pdfDocument, PDF $pdfWriter, $baseX, $baseY, $marginTop, $marginLeft, $marginRight, $marginBottom, $parentWidth, $parentHeight) { //-------------------------------base options------------------------------- Log::log(LoggingConstants::MYDEBUG, "INIT COMPONENT: " . get_class($this) . " : " . $this->id); if ($pdfDocument != null) { $this->document = $pdfDocument; } if ($pdfWriter != null) { $this->componentPdfWriter = $pdfWriter; } //-------------------------------top, left, right, bottom------------------------------- if ($this->top != -1) { $this->y = $this->top; } // +marginTop + baseY; if ($this->left != -1) { $this->x = $this->left; } // +marginLeft + baseX; if ($this->right != -1) { if ($this->left != -1) { $this->width = $parentWidth - $this->x - $this->right; } else { $this->x = $parentWidth - $this->right - $this->width; } // - marginRight; } if ($this->bottom != -1) { if ($this->top != -1) { $this->height = $parentHeight - $this->y - $this->bottom; } else { $this->y = $parentHeight - $this->bottom - $this->height; } // -marginBottom; } //-------------------------------base coords------------------------------- if ($this->baseX != 0) { $this->x += $this->baseX; } if ($this->baseY != 0) { $this->y += $this->baseY; } //-------------------------------margins------------------------------- if ($marginTop != 0) { $this->y += $marginTop; } if ($marginLeft != 0) { $this->x += $marginLeft; } if ($this->right != -1) { if ($this->left != -1) { $this->width -= $marginLeft + $marginRight; } else { $this->x -= $marginRight; } } if ($this->bottom != -1) { if ($this->top != -1) { $this->height -= $marginTop + $marginBottom; } else { $this->y -= $marginBottom; } } //-------------------------------Meatadata------------------------------- if ($this->id != null && $this->id != "") { /*PDFMetadata*/ $metadata = $pdfDocument->metadata; if ($metadata != null) { /*Property[]*/ $properties = $metadata->getPropertiesByTarget($this->id); if (count($properties) != 0) { foreach ($properties as $property) { if ($property->name == Property::$SHOW_ON_ALL_PAGES) { $this->onEachPage = true; } else { if ($property->name == Property::$EXTEND_TO_PAGEBOTTOM) { $this->height = $parentHeight - $this->y - $marginBottom; if ($this->bottom != -1) { $this->height -= $this->bottom; } } else { if ($property->value == null || $property->value == "") { $property->value = true; } DataUtils::setValue($this, $property->name, $property->value); } } } } } } }