コード例 #1
0
 public function formCaptcha()
 {
     $captcha = $this->getCaptcha('mycaptcha');
     $id = $captcha->generate();
     $this->data->captcha = Manager::getDownloadURL('files', $id . '.png', true);
     $this->data->captchaId = $id;
     $this->render();
 }
コード例 #2
0
ファイル: mexporter.php プロジェクト: joshuacoddingyou/php
 public function execute($data)
 {
     $id = uniqid(md5(uniqid("")));
     // generate a unique id to avoid name conflicts
     $fileOutput = $id . "." . $this->fileType;
     // the report generated file
     $pathOut = Manager::getFilesPath($fileOutput, true);
     $output = $this->exporter->execute($data, $pathOut);
     return $output ?: \Manager::getDownloadURL('report', basename($fileOutput), true);
 }
コード例 #3
0
ファイル: mezpdfreport.php プロジェクト: joshuacoddingyou/php
 public function execute()
 {
     $pdfCode = $this->getOutput();
     $fileName = uniqid(md5(uniqid(""))) . '.pdf';
     $this->fileOutput = Manager::getFilesPath($fileName, true);
     $fp = fopen($this->fileOutput, 'x');
     fwrite($fp, $pdfCode);
     fclose($fp);
     $output = \Manager::getDownloadURL('report', $fileName, true);
     return $output;
 }
コード例 #4
0
ファイル: mpage.php プロジェクト: joshuacoddingyou/php
 public function addStyleSheetCode($code)
 {
     if (Manager::isAjaxCall()) {
         $fileName = md5($code) . '.css';
         $file = Manager::getFrameworkPath('var/files/' . $fileName);
         file_put_contents($file, $code);
         $url = Manager::getDownloadURL('cache', $fileName, true);
         $this->onLoad("dojo.create(\"link\", {href:'{$url}', type:'text/css', rel:'stylesheet'}, document.getElementsByTagName('head')[0]);");
     } else {
         $this->styleSheetCode .= "\n" . $code;
     }
 }
コード例 #5
0
ファイル: mfile.php プロジェクト: joshuacoddingyou/php
 public function setPath($file, $inline = true)
 {
     $this->path = $file;
     $this->url = \Manager::getDownloadURL('cache', basename($file), $inline);
 }
コード例 #6
0
 public function renderLot()
 {
     $grafico = new PHPlot(800, 600);
     $grafico->SetFileFormat("jpg");
     $grafico->SetIsInline(True);
     #Indicamos o títul do gráfico e o título dos dados no eixo X e Y do mesmo
     $grafico->SetTitle($this->data->titulo);
     $grafico->SetXTitle($this->data->eixoX);
     $grafico->SetYTitle($this->data->eixoY);
     #passamos o tipo de gráfico escolhido
     if (!$this->data->tipoLot) {
         $this->data->tipoLot = 'bars';
     }
     $grafico->SetPlotType($this->data->tipoLot);
     switch ($this->data->tipoLot) {
         case 'pie':
             $grafico->SetPieLabelType('index', 'custom', 'mycallback');
             $grafico->SetDataType('text-data-single');
             break;
         case 'stackedbars':
             $grafico->SetDataType('text-data-yx');
             break;
         case 'bubbles':
             $grafico->SetDataType('data-data-xyz');
             break;
     }
     $grafico->SetLegend($column_names);
     #Definimos os dados do gráfico
     switch ($this->data->tipoLot) {
         case 'pie':
             $dados = array(array($this->data->x1, $this->data->y11), array($this->data->x2, $this->data->y21), array($this->data->x3, $this->data->y31), array($this->data->x4, $this->data->y41));
             break;
         default:
             $dados = array(array($this->data->x1, $this->data->y11, $this->data->y12, $this->data->y13), array($this->data->x2, $this->data->y21, $this->data->y22, $this->data->y23), array($this->data->x3, $this->data->y31, $this->data->y32, $this->data->y33), array($this->data->x4, $this->data->y41, $this->data->y42, $this->data->y43));
             break;
     }
     $grafico->SetDataValues($dados);
     #Salvamos o gráfico
     $caminho = \Manager::getFilesPath();
     $fileName = uniqid() . '.jpg';
     $grafico->SetOutputFile($caminho . '/' . $fileName);
     $grafico->SetIsInline(True);
     $grafico->DrawGraph();
     #obtemos o endereco do grafico
     $this->data->locate = \Manager::getDownloadURL('files', basename($fileName), true);
 }
コード例 #7
0
 function fillDB($db, $fileInput, $fileOutput, $fileType, $parameters, $classPath, $save)
 {
     $params = $this->prepareParameters($parameters);
     $params->put('REPORT_LOCALE', new Java("java.util.Locale", 'pt', 'BR'));
     $extension = substr($fileInput, strrpos($fileInput, '.'));
     try {
         $sJfm = new JavaClass("net.sf.jasperreports.engine.JasperFillManager");
         if ($extension == ".jrxml") {
             $s1 = new JavaClass("net.sf.jasperreports.engine.xml.JRXmlLoader");
             $jasperDesign = $s1->load($fileInput);
             $sJcm = new JavaClass("net.sf.jasperreports.engine.JasperCompileManager");
             $report = $sJcm->compileReport($jasperDesign);
         } else {
             $report = $fileInput;
         }
         // Create the JDBC Connection
         $conn = new Java("org.altic.jasperReports.JdbcConnection");
         // Call the driver to be used
         $conn->setDriver(\Manager::getConf("db.{$db}.jdbc.driver"));
         // Connection URL
         $conn->setConnectString(\Manager::getConf("db.{$db}.jdbc.db"));
         // Server Connection Username
         $conn->setUser(\Manager::getConf("db.{$db}.user"));
         // Server Connection Password
         $conn->setPassword(\Manager::getConf("db.{$db}.password"));
         $print = $sJfm->fillReport($report, $params, $conn->getConnection());
         $sJem = new JavaClass("net.sf.jasperreports.engine.JasperExportManager");
         $output = \Manager::getDownloadURL('report', basename($this->fileOutput), true);
         $sJem->exportReportToPdfFile($print, $fileOutput);
     } catch (Exception $e) {
         dump_java_exception($e);
     }
     return $output;
 }