コード例 #1
0
 public function getSavedFormValues()
 {
     return DataHolder::getInstance($this->getHolderName())->getSavedFormValues();
 }
コード例 #2
0
ファイル: actions.class.php プロジェクト: vcgato29/poff
 protected function postSubmitActions()
 {
     # generate HTML content from submitted data
     $prods = DataHolder::getInstance('products')->getSavedFormValues();
     $prods = isset($prods['valitud tooted']) ? $prods['valitud tooted'] : array(-1);
     $htmlContent = $this->getPartial('query/pdfView', array('contact' => DataHolder::getInstance('contact')->getSavedFormValues(), 'dimensions' => DataHolder::getInstance('dimensions')->getSavedFormValues(), 'profiles' => DataHolder::getInstance('profiles')->getSavedFormValues(), 'attachments' => DataHolder::getInstance('attachments')->getSavedFormValues(), 'configuration' => $this->configuration, 'products' => array('savedValues' => DataHolder::getInstance('products')->getSavedFormValues(), 'products' => Doctrine::getTable('Product')->createQuery()->from('Product')->whereIn('id', $prods)->execute())));
     //				echo $htmlContent;
     //		exit;
     # create TMP HTML file
     $absoluteInvoicePath = tempnam(sfConfig::get('sf_web_dir') . '/queries', 'query_') . '.html';
     @mkdir(dirname($absoluteInvoicePath), 0777, true);
     // put html in file
     file_put_contents($absoluteInvoicePath, $htmlContent);
     # generate pdf file
     $site = $this->getRequest()->getHost() . '/queries/' . basename($absoluteInvoicePath);
     # ask html2pdf converter to convert HTML to PDF
     $url = "http://" . $this->getRequest()->getHost() . "/html2pdf/demo/html2ps.php?process_mode=single&URL=" . $site . "&proxy=&pixels=1024&scalepoints=1&renderimages=1&renderlinks=1&renderfields=1&media=Letter&cssmedia=Screen&leftmargin=30&rightmargin=15&topmargin=15&bottommargin=15&encoding=&headerhtml=&footerhtml=&watermarkhtml=&toc-location=before&smartpagebreak=1&pslevel=3&method=fpdf&pdfversion=1.3&output=0&convert=Convert+File";
     $pdfContent = file_get_contents($url);
     # mail PDF fail to site admin and user
     sfProjectConfiguration::getActive()->loadHelpers(array('I18N', 'Variable'));
     //send site administrator an email of query
     $this->sendMail(variable('system email', '*****@*****.**'), $pdfContent);
     // send user email if he wants it
     if (DataHolder::getInstance('contact')->sendCopyToUser()) {
         $this->sendMail(DataHolder::getInstance('contact')->getUserEmail(), $pdfContent);
     }
 }
コード例 #3
0
ファイル: data_holder_test.php プロジェクト: mbcraft/frozen
 function testLockedDataHolder()
 {
     $dh = new DataHolder(false, false);
     $this->assertFalse($dh->__locked(), "DataHolder lockato!");
     $this->assertFalse(isset($dh->prova), "isset vero per valore non impostato");
     $dh->prova = 10;
     $this->assertEqual(10, $dh->prova, "Valore non salvato");
     $this->assertTrue(isset($dh->prova), "isset false per valore impostato");
     $this->assertFalse(isset($dh->CICCIA), "isset vero per valore non impostato");
     $dh->CICCIA = "ok";
     $this->assertEqual("ok", $dh->CICCIA, "Valore non salvato");
     $this->assertTrue(isset($dh->CICCIA), "isset false per valore impostato");
     $this->assertFalse($dh->__locked(), "DataHolder lockato!");
     $dh->__lock();
     $this->assertTrue($dh->__locked(), "DataHolder non lockato!");
     try {
         $dh->CICCIA = 70;
         $this->fail("Scrittura variabili maiuscole dopo lock!");
     } catch (Exception $ex) {
     }
     try {
         $dh->prova = 20;
         $this->fail("Scrittura variabili minuscole dopo lock!");
     } catch (Exception $ex) {
     }
     try {
         $dh->bello = 20;
         $this->fail("Creazione nuove variabili minuscole dopo lock!");
     } catch (Exception $ex) {
     }
     try {
         $dh->BOMBA = 20;
         $this->fail("Creazione nuove variabili MAIUSCOLE dopo lock!");
     } catch (Exception $ex) {
     }
     try {
         unset($dh->prova);
         $this->fail("Rimozione variabili minuscole dopo il lock!");
     } catch (Exception $ex) {
     }
     try {
         unset($dh->CICCIA);
         $this->fail("Rimozione variabili maiuscole dopo il lock!");
     } catch (Exception $ex) {
     }
 }