titre = $titre; parent::__construct(); $this->AddPage(); $this->SetTextColor(0x00, 0x00, 0x00); $this->SetTextColor(0x00, 0x00, 0x00); $this->SetFont('Arial', '', 8); $datas = array_map("utf8_decode", $datas); } public function setPrestaSubscriptionData($datas) { foreach($datas as $key => $d) { switch ($key) { case 'card_lost': if($d != ''){ $this->cell(self::$CELL_LABEL_WIDTH, self::$TEXT_HEIGHT, utf8_decode(PrestataireAdhesionForm::$HASH_KEYS[$key]) , 0, 0, 'L', false); $this->cell(self::$CELL_WIDTH, self::$TEXT_HEIGHT, utf8_decode(PrestataireAdhesionForm::$HASH_CARD_LOST[$d]) , 0, 1, 'L', false); } break; case 'payment_mode': if($d != ''){ $this->cell(self::$CELL_LABEL_WIDTH, self::$TEXT_HEIGHT, utf8_decode(PrestataireAdhesionForm::$HASH_KEYS[$key]) , 0, 0, 'L', false); $this->cell(self::$CELL_WIDTH, self::$TEXT_HEIGHT, utf8_decode(PrestataireAdhesionForm::$HASH_PAYMENT_MODE[$d]) , 0, 1, 'L', false); } break; case 'payment_amount': if($d != ''){ $this->cell(self::$CELL_LABEL_WIDTH, self::$TEXT_HEIGHT, utf8_decode(PrestataireAdhesionForm::$HASH_KEYS[$key]) , 0, 0, 'L', false); $this->cell(self::$CELL_WIDTH, self::$TEXT_HEIGHT, utf8_decode(PrestataireAdhesionForm::$HASH_PAYMENT_AMOUNT[$d]) , 0, 1, 'L', false); } break; default: if(array_key_exists($key, PrestataireAdhesionForm::$HASH_KEYS)){ $this->cell(self::$CELL_LABEL_WIDTH, self::$TEXT_HEIGHT, utf8_decode(PrestataireAdhesionForm::$HASH_KEYS[$key]) , 0, 0, 'L', false); $this->cell(self::$CELL_WIDTH, self::$TEXT_HEIGHT, utf8_decode($d) , 0, 1, 'L', false); }else { $this->cell(self::$CELL_LABEL_WIDTH, self::$TEXT_HEIGHT, utf8_decode($key) , 0, 0, 'L', false); $this->cell(self::$CELL_WIDTH, self::$TEXT_HEIGHT, utf8_decode($d) , 0, 1, 'L', false); } } } } public function generateForm($formschema){ //var_dump($formschema); $labels = $formschema->getLabels(); $fields = $formschema->getFields(); foreach($labels as $key => $l){ // O $this->cell(self::$CELL_LABEL_WIDTH, self::$TEXT_HEIGHT, utf8_decode(PrestataireAdhesionForm::$HASH_KEYS[$key]." : " ), 0, 0, 'L', false); foreach($fields as $key2 => $f){ if($key == $key2){ $choices = $f->getOption('choices'); if($choices != null){ $this->cell(self::$CELL_WIDTH, self::$TEXT_HEIGHT, '', 0, 1); foreach ($choices as $c) { $this->SetX('50'); $this->cell(self::$CELL_WIDTH, self::$TEXT_HEIGHT, utf8_decode('[ ] '.$c) , 0, 1, 'L', false); } } else { $this->cell(self::$CELL_WIDTH, self::$TEXT_HEIGHT, utf8_decode('________________________') , 0, 1, 'l', false); } } } } } public function setAdherentSubscriptionDatas($datas){ $this->SetTextColor(50, 50, 50); foreach($datas as $key => $d) { switch ($key) { case 'user_payment_mode': if($d != ''){ $this->cell(self::$CELL_LABEL_WIDTH, self::$TEXT_HEIGHT, utf8_decode(AdherentSubscriptionForm::$HASH_KEYS[$key]) , 0, 0, 'L', false); foreach (AdherentSubscriptionForm::$HASH_PAYMENT_MODE as $cle => $payment_method) { if($cle != 0) { $this->cell(self::$CELL_LABEL_WIDTH, self::$TEXT_HEIGHT, '', 0, 0, 'L', false); } if($cle == $d) $this->cell(4, self::$TEXT_HEIGHT, '[x]', 0, 0, 'L', false); else $this->cell(4, self::$TEXT_HEIGHT, '[ ]', 0, 0, 'L', false); $this->cell(self::$CELL_WIDTH, self::$TEXT_HEIGHT, utf8_decode(AdherentSubscriptionForm::$HASH_PAYMENT_MODE[$cle]) , 0, 1, 'L', false); } $this->Ln(1); } break; case 'user_payment_amount': $this->cell(self::$CELL_LABEL_WIDTH, self::$TEXT_HEIGHT, utf8_decode(AdherentSubscriptionForm::$HASH_KEYS[$key]) , 0, 0, 'L', false); // $this->cell(self::$CELL_WIDTH, self::$TEXT_HEIGHT, utf8_decode(AdherentSubscriptionForm::$HASH_PAYMENT_AMOUNT[$d]) , 0, 1, 'L', false); foreach (AdherentSubscriptionForm::$HASH_PAYMENT_AMOUNT as $cle => $payment_amount) { ($cle==0)?:$this->cell(self::$CELL_LABEL_WIDTH, self::$TEXT_HEIGHT, '' , 0, 0, 'L', false); if($cle == $d) $this->cell(4, self::$TEXT_HEIGHT, '[x]', 0, 0, 'L', false); else $this->cell(4, self::$TEXT_HEIGHT, '[ ]', 0, 0, 'L', false); $this->cell(self::$CELL_WIDTH, self::$TEXT_HEIGHT, utf8_decode($payment_amount) , 0, 1, 'L', false); } $this->Ln(1); break; case 'user_payment_mode_cheque': if($d != ''){ $this->cell(self::$CELL_LABEL_WIDTH, self::$TEXT_HEIGHT, utf8_decode(AdherentSubscriptionForm::$HASH_KEYS[$key]) , 0, 0, 'L', false); $this->cell(self::$CELL_WIDTH, self::$TEXT_HEIGHT, utf8_decode($d) , 0, 1, 'L', false); $this->Ln(1); } break; case 'user_parraining': if($d != ''){ $this->cell(self::$CELL_LABEL_WIDTH, self::$TEXT_HEIGHT, utf8_decode(AdherentSubscriptionForm::$HASH_KEYS[$key]) , 0, 0, 'L', false); $this->cell(self::$CELL_WIDTH, self::$TEXT_HEIGHT, $d , 0, 1, 'L', false); $this->Ln(1); } break; case 'user_membercard_lost': $this->cell(self::$CELL_LABEL_WIDTH, self::$TEXT_HEIGHT, 'Carte perdue?' , 0, 0, 'L', false); $d=='on'? $this->cell(self::$CELL_WIDTH, self::$TEXT_HEIGHT, 'Oui' , 0, 1, 'L', false): $this->cell(self::$CELL_WIDTH, self::$TEXT_HEIGHT, 'Non' , 0, 1, 'L', false); $this->Ln(1); break; default: $this->SetFont('Arial','B',10); $this->cell(self::$CELL_LABEL_WIDTH, self::$TEXT_HEIGHT, utf8_decode(AdherentSubscriptionForm::$HASH_KEYS[$key]) , 0, 0, 'L', false); $this->cell(self::$CELL_WIDTH, self::$TEXT_HEIGHT, utf8_decode($d) , 0, 1, 'L', false); $this->Ln(1); } } } public function execute($fileName){ return $this->Output(sfConfig::get('sf_upload_dir').'/'.$fileName, 'F'); } public function Header() { $this->drawLogo(); $this->SetFont('Arial','B',20); $this->SetTextColor(100, 100, 100); $this->Cell(135,20, utf8_decode($this->titre),0,0,'C'); $this->Ln(40); } function drawLogo(){ $top = 10; $position = 10; $this->setXY($position, $top); $this->Image(sfConfig::get('sf_web_dir') . '/images/logo.gif', $position, 10, 15); } } ?>