/**
   * @inheritdoc
   */
  public function parse(FillPdfFormInterface $fillpdf_form) {
    /** @var FileInterface $file */
    $file = File::load($fillpdf_form->file->target_id);
    $content = file_get_contents($file->getFileUri());

    $require = drupal_get_path('module', 'fillpdf') . '/lib/JavaBridge/java/Java.inc';
    require_once DRUPAL_ROOT . '/' . $require;
    try {
      $fillpdf = new \java('com.ocdevel.FillpdfService', base64_encode($content), 'bytes');
      $fields = java_values($fillpdf->parse());
    }
    catch (\JavaException $e) {
      drupal_set_message(java_truncate((string) $e), 'error');
    }

    return $fields;
  }
Exemplo n.º 2
0
$exportType = $_REQUEST["export"];
error_reporting(E_ALL & ~E_NOTICE);
ini_set("allow_url_include", true);
if (isset($exportType)) {
    $varurl = 'http://localhost:8080/JavaBridge/java/Java.inc';
    require_once $varurl;
    //$System = java ( "java.lang.System" );
    // echo $System->getProperties();
    try {
        java("java.lang.Class")->forName("com.mysql.jdbc.Driver");
        $connection = java("java.sql.DriverManager")->getConnection("jdbc:mysql://localhost/eb", "root", "");
        $root = realpath(".");
        $in = $root . "\\well_test" . ($exportType == "Excel" ? "_excel" : "") . ".jrxml";
        $report = java("net.sf.jasperreports.engine.JasperCompileManager")->compileReport($in);
        $dateFormat = new java("java.text.SimpleDateFormat", "yy/MM/dd");
        $d = $dateFormat->parse($from_date);
        $params = new java("java.util.HashMap");
        $params->put("facility_id", intval($facility_id));
        // dây là 1 param
        $params->put("begin_date", new java("java.sql.Date", $d->getTime()));
        $params->put("report_time", $_REQUEST["report_time"]);
        $params->put("ROOT_DIR", $root);
        $print = java("net.sf.jasperreports.engine.JasperFillManager")->fillReport($report, $params, $connection);
        $contentType = "text/Html";
        $out = 'out.html';
        if ($exportType == "PDF") {
            java_set_file_encoding("ISO-8859-1");
            $contentType = "application/pdf";
            // export Pdf
            $out = $root . "/output.pdf";
            java("net.sf.jasperreports.engine.JasperExportManager")->exportReportToPdfFile($print, $out);
Exemplo n.º 3
0
    $exportType = $_REQUEST["export"];
}
ini_set("allow_url_include", true);
if (isset($exportType)) {
    $varurl = 'http://localhost:8080/JavaBridge/java/Java.inc';
    require_once $varurl;
    $System = java("java.lang.System");
    //echo $System->getProperties();
    try {
        java("java.lang.Class")->forName("com.mysql.jdbc.Driver");
        $connection = java("java.sql.DriverManager")->getConnection("jdbc:mysql://localhost/eb", "root", "");
        $root = realpath(".");
        $in = $root . "/NewMain.jrxml";
        $report = java("net.sf.jasperreports.engine.JasperCompileManager")->compileReport($in);
        $dateFormat = new java("java.text.SimpleDateFormat", "yy/MM/dd");
        $d = $dateFormat->parse($from_date);
        $d2 = $dateFormat->parse($to_date);
        $params = new java("java.util.HashMap");
        $params->put("facility_id", intval($facility_id));
        // dây là 1 param
        $params->put("begin_date", new java("java.sql.Date", $d->getTime()));
        $params->put("end_date", new java("java.sql.Date", $d2->getTime()));
        $params->put("SUBREPORT_DIR", $root . "/sub/");
        $print = java("net.sf.jasperreports.engine.JasperFillManager")->fillReport($report, $params, $connection);
        $contentType = "text/Html";
        $out = 'out.html';
        if ($exportType == "PDF") {
            java_set_file_encoding("ISO-8859-1");
            $contentType = "application/pdf";
            // export Pdf
            $out = $root . "/output.pdf";
if (!file_exists($indexpath) || is_dir(!$indexpath)) {
    die($indexpath . " does not exist or is not a directory. \n" . "Please configure com_search_lucene parameters in the administrator console.\n" . "And create index directory to use com_search_lucene\n\n");
}
if ($_SERVER['argc'] < 2) {
    echo "Usage: " . $_SERVER['argv'][0] . " searchkey1 searchkey2 searchkey3 ...";
    die;
}
$_q = "";
for ($i = 1; $i < $_SERVER['argc']; $i++) {
    $_q .= $_SERVER['argv'][$i] . " ";
}
$plugins = JPluginHelper::_load();
$analyzer = new java("org.apache.lucene.analysis.standard.StandardAnalyzer");
$resultList = new java("java.util.LinkedList");
$queryparser = new java("org.apache.lucene.queryParser.QueryParser", "title", $analyzer);
$_qobj = $queryparser->parse($_q);
foreach ($plugins as $plugin) {
    if ($plugin->type == 'SearchLucene') {
        $startDate = date('Y/m/d H:i');
        if (!isset($dispatcher) || !is_object($dispatcher)) {
            $dispatcher =& JDispatcher::getInstance();
        }
        $path = JPATH_PLUGINS . DS . $plugin->type . DS . $plugin->name . '.php';
        $className = 'plg' . $plugin->type . $plugin->name;
        require_once $path;
        $instance = new $className($dispatcher, $plugin);
        $pluginindex = $indexpath . DS . $plugin->name;
        $index = new java("java.io.File", $pluginindex);
        if (!$index->exists()) {
            continue;
        }
Exemplo n.º 5
0
 static function convertValue($value, $className)
 {
     // if we are a string, just use the normal conversion
     // methods from the java extension...
     //Revisar http://byte-consult.be/2008/08/16/phpjava-bridge-jasperreports/
     try {
         if ($className == 'java.lang.String') {
             $temp = new \java('java.lang.String', $value);
             return $temp;
         } else {
             if ($className == 'java.lang.Boolean' || $className == 'java.lang.Integer' || $className == 'java.lang.Long' || $className == 'java.lang.Short' || $className == 'java.lang.Double' || $className == 'java.math.BigDecimal') {
                 $temp = new \java($className, $value);
                 return $temp;
             } else {
                 if ($className == 'java.sql.Timestamp' || $className == 'java.sql.Time') {
                     $temp = new \java($className);
                     $javaObject = $temp->valueOf($value);
                     return $javaObject;
                 } else {
                     if ($className == 'java.util.Locale') {
                         $value_arr = explode("_", $value);
                         $temp = new \java($className, $value_arr[0], $value_arr[1]);
                         return $temp;
                     } else {
                         if ($className == "java.util.Date") {
                             $temp = new \java('java.text.DateFormat');
                             $javaObject = $temp->parse($value);
                             return $javaObject;
                         }
                     }
                 }
             }
         }
     } catch (Exception $err) {
         echo 'unable to convert value, ' . $value . ' could not be converted to ' . $className . ' ';
         return false;
     }
     echo 'unable to convert value, class name ' . $className . ' not recognised';
     return false;
 }