Hi
Tell me whatever do you think about thanks!
Salva

David Zülke escribió:
A renderer? interesting. I think most people just build the pdf in an executePdf() method in the view. Show it! :)




Am 18.01.2008 um 12:48 schrieb salva g p:

Hello everyone.
I have made a php render for agavi with FPDF class. I think it is usefull for pdf views.
Do you like to see it?
Salva

_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users


FPDF) { return $this->FPDF; } $this->FPDF = $this->getContext()->getModel('kidfpdf','kids',array($orientation,$unit,$format)); return $this->FPDF; } /** * Render the presentation and return the result. * * @param AgaviTemplateLayer The template layer to render. * @param array The template variables. * @param array The slots. * @param array Associative array of additional assigns. * * @return string A rendered result. * * @author Salva Glez <[EMAIL PROTECTED]> * @since 0 */ public function render(AgaviTemplateLayer $layer, array &$attributes = array(), array &$slots = array(), array &$moreAssigns = array()) { if(isset($attributes["orientation"])) $orientation = $attributes["orientation"]; else $orientation = "P"; if(isset($attributes["unit"])) $unit = $attributes["unit"]; else $unit = "mm"; if(isset($attributes["format"])) $format = $attributes["format"]; else $format = "A4"; $engine = $this->getEngine($orientation,$unit,$format); foreach ($attributes as $key=>$val){ if(method_exists($engine,'set'.$key)) $engine->{'set'.$key}($val); } $this->layer = $layer; $this->attributes =& $attributes; $this->slots =& $slots; foreach($moreAssigns as $moreAssignName => &$moreAssign) { if(isset($this->moreAssignNames[$moreAssignName])) { $moreAssignName = $this->moreAssignNames[$moreAssignName]; } $this->moreAssigns[$moreAssignName] =& $moreAssign; } unset($layer, $attributes, $slots, $moreAssigns); if($this->extractVars) { extract($this->attributes, EXTR_REFS | EXTR_PREFIX_INVALID, '_'); } else { ${$this->varName} =& $this->attributes; } ${$this->slotsVarName} =& $this->slots; foreach($this->assigns as $name => $getter) { ${$name} = $this->context->$getter(); } unset($name, $getter); extract($this->moreAssigns, EXTR_REFS); require($this->layer->getResourceStreamIdentifier()); return $engine->Output('','S'); } } ?>SetFont('Arial','B',14); $this->SetX(10); $this->SetDrawColor(0,80,180); $this->SetFillColor(255,255,255); $this->SetTextColor(0,0,0); $this->SetLineWidth(1); $w=$this->GetStringWidth($this->title)+6; $this->Cell($w,4,$this->title,0,1,'L',1); $this->Image($this->logo,275,5,15); $this->Ln(); $altofila=5; //Colores, ancho de línea y fuente en negrita $this->SetFillColor(255,0,0); $this->SetTextColor(255); $this->SetDrawColor(128,0,0); $this->SetLineWidth(.3); $this->SetFont('','B',5); } protected function Footer(){ //Pie de página $this->SetY(-15); $this->SetFont('Arial','I',8); $this->SetTextColor(128); $this->Cell(0,10,$this->pagetxt.$this->PageNo()." ".date("d/m/Y"),0,0,'C'); } } ?> getparameter('id'); $modelo = $this->getContext()->getModel("kids","kids",array('id'=>$id)); $this->setAttribute("kid",$modelo); $this->setAttribute("title",$modelo->title()); $this->setAttribute("format","A4"); $this->setAttribute("orientation","P"); $this->setAttribute("DisplayMode",'fullpage'); $ot = $this->container->getOutputType(); $this->setAttribute("logo","".AgaviConfig::get('core.modpub')."/".$ot->getParameter("http_headers[logo]", "logo.jpg")); $this->loadLayout("default"); } } ?>AddPage(); $engine->SetX(10); $engine->SetDrawColor(0,80,180); $engine->SetFillColor(255,255,255); $engine->SetTextColor(0,0,0); $engine->SetLineWidth(1); foreach ($kid->campos_edit as $k=>$c){ $w=$engine->GetStringWidth($c[0])+6; $engine->Cell($w,6,$c[0],0,0,'L',0); $txt = $kid->campo_valor($k); $engine->setx(40); $w=$engine->GetStringWidth($txt); $engine->Cell($w,6,$txt,0,1,'L',1); $foto = $kid->filename("foto"); $engine->image($foto,100,20,50); } ?>
_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users

Reply via email to