прайс-лист товаров
posuda-sklad.ruview->disableLevel(\Phalcon\Mvc\View::LEVEL_MAIN_LAYOUT); if( $this->request->isPost() ) { $sourceFileName = 'http://www.posuda-sklad.ru/products_seo.csv'; $origFileName = 'products_seo.csv'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $sourceFileName); curl_setopt($ch, CURLOPT_TIMEOUT, 300); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $st = curl_exec($ch); $fd = fopen($origFileName, "w"); fwrite($fd, $st); fclose($fd); curl_close($ch); $result = $this->ServiceExcel->getCSV_CharsetClean('products_seo.csv'); $type = $this->request->getPost('type'); if(is_array($result)){ if($type == 'pdf_1'){ $this->createNewPriceList($result); }else if($type == 'pdf_2'){ $this->createNewPriceListWL($result); } } else { die('файл с данными не получен'); } $cd = 'cd www/seo/www-backend'; exec($cd); $comand = 'wkhtmltopdf --margin-bottom 0 --margin-top 0 --margin-left 0 --margin-right 0 "http://storage.seo.dev.artwebua.com.ua/posuda_price_list/" catalog.pdf'; exec($comand); sleep(2); exec('chmod 664 catalog.pdf'); $file_dir = '/home/dev/www/seo/www-backend'; if (file_exists("$file_dir/catalog.pdf")) { header('Content-type: application/pdf'); header('Content-Disposition: attachment; filename="catalog.pdf"'); readfile("/home/dev/www/seo/www-backend/catalog.pdf"); unlink("$file_dir/catalog.pdf"); die(); } } } function createNewPriceList($result) { $route = STORAGE_PATH.'posuda_price_list/index.html'; $body = $this->getHeadData(); $body .= $this->getContent($result); $body .= $this->getFooterData(); $fd = @fopen($route, "w"); fwrite($fd, $body); @fclose($fd); } function createNewPriceListWL($result) { $route = STORAGE_PATH.'posuda_price_list/index.html'; $body = $this->getHeadDataWL(); $body .= $this->getContentWL($result); $fd = @fopen($route, "w"); fwrite($fd, $body); @fclose($fd); } function getHeadData(){ return $head = '
прайс-лист товаров
posuda-sklad.ruпрайс-лист товаров
'.$result[$d][1].'
'.$result[$d][2].' р.
'.$result[$d][1].'