fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [9997] property: integration


From: Sigurd Nes
Subject: [Fmsystem-commits] [9997] property: integration
Date: Thu, 13 Sep 2012 10:34:13 +0000

Revision: 9997
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9997
Author:   sigurdne
Date:     2012-09-13 10:34:12 +0000 (Thu, 13 Sep 2012)
Log Message:
-----------
property: integration

Modified Paths:
--------------
    trunk/property/inc/soap_client/braarkiv/soap.php

Modified: trunk/property/inc/soap_client/braarkiv/soap.php
===================================================================
--- trunk/property/inc/soap_client/braarkiv/soap.php    2012-09-12 14:31:02 UTC 
(rev 9996)
+++ trunk/property/inc/soap_client/braarkiv/soap.php    2012-09-13 10:34:12 UTC 
(rev 9997)
@@ -75,22 +75,24 @@
 
        require_once PHPGW_API_INC.'/functions.inc.php';
 
-
-
        $location_id    = phpgw::get_var('location_id', 'int');
        $section        = phpgw::get_var('section', 'string');
        $bygningsnr = (int) phpgw::get_var('bygningsnr', 'int');
+       $fileid = phpgw::get_var('fileid', 'string');
 
+       if(!$fileid && !$bygningsnr)
+       {
+               $GLOBALS['phpgw_info']['message']['errors'][] = 
"{$system_name}::Bygningsnr ikke angitt som innparameter";
+       }
+
        $c      = CreateObject('admin.soconfig',$location_id);
 
-
        $login = $c->config_data[$section]['anonymous_user'];
        $passwd = $c->config_data[$section]['anonymous_pass'];
-       $location_url = 
'http://braarkiv.adm.bgo/service/services.asmx';//$c->config_data['common']['location_url'];
+       $location_url = 
$c->config_data[$section]['location_url'];//'http://braarkiv.adm.bgo/service/services.asmx';
+       $braarkiv_user =  $c->config_data[$section]['braarkiv_user'];
+       $braarkiv_pass =  $c->config_data[$section]['braarkiv_pass'];
 
-//_debug_array($_REQUEST);
-//_debug_array($c->config_data[$section]);
-
        $_POST['submitit'] = "";
 
        $GLOBALS['sessionid'] = $GLOBALS['phpgw']->session->create($login, 
$passwd);
@@ -118,60 +120,64 @@
        require_once 'services.php';
 
        $options=array();
-       $options['soap_version']        = SOAP_1_1;
+       $options['soap_version']        = SOAP_1_2;
        $options['location']            = $location_url;
        $options['uri']                         = $location_url;
        $options['trace']                       = false;
-//     $options['proxy_host']          = $this->pswin_param['proxy_host'];
-//     $options['proxy_port']          = $this->pswin_param['proxy_port'];
        $options['encoding']            = 'UTF-8';
 
-       $wdsl = null;
-       $wdsl = 'http://braarkiv.adm.bgo/service/services.asmx?WSDL';
+       $wdsl = "{$location_url}?WSDL";
 
        $Services = new Services($wdsl, $options);
        
        $Login = new Login();
        
-       $Login->userName = 'hb776';
-       $Login->password = 'hb776';
+       $Login->userName = $braarkiv_user;
+       $Login->password = $braarkiv_pass;
 
        $LoginResponse = $Services->Login($Login);
-//_debug_array($LoginResponse);
+
        $secKey = $LoginResponse->LoginResult;
 
-/*
-       $searchDocument = new searchDocument();
-       $searchDocument->secKey = $secKey;
-       $searchDocument->baseclassname = 'Eiendomsarkiver';
-       $searchDocument->classname = 'Byggesak';
-       $searchDocument->where = "Byggnr = {$bygningsnr}";// AND Regdato > 
'2006-01-25'";
-//     $searchDocument->where = "Regdato > '2006-01-25'";
-       $searchDocument->maxhits = '1';
+       if($fileid)
+       {
+               $getAvailableFileVariants = new getAvailableFileVariants();
+               $getAvailableFileVariants->secKey = $secKey;
+               $getAvailableFileVariants->documentId = $fileid;
+               
+               $getAvailableFileVariantsResponse = 
$Services->getAvailableFileVariants($getAvailableFileVariants);
 
-_debug_array($searchDocument);
+               $getFileAsByteArray = new getFileAsByteArray();
+               $getFileAsByteArray->secKey = $secKey;
+               $getFileAsByteArray->documentId = $fileid;
+               $getFileAsByteArray->variant = 'PDFJPG80';
+               $getFileAsByteArray->versjon = 1;
+               
+               $getFileAsByteArrayResponse = 
$Services->getFileAsByteArray($getFileAsByteArray);
+               
+               $getFileAsByteArrayResult = 
$getFileAsByteArrayResponse->getFileAsByteArrayResult;
 
-       $searchDocumentResponse = $Services->searchDocument($searchDocument);
+               if($getFileAsByteArrayResult)
+               {
+                       $file = base64_decode($getFileAsByteArrayResult);
 
-       $searchDocumentResult = $searchDocumentResponse->searchDocumentResult;
+                       $browser = CreateObject('phpgwapi.browser');
+                       $browser->content_header("{$fileid}.pdf", 
'application/pdf');
 
+                       echo $file;
 
-_debug_array($searchDocumentResponse);
+                       $GLOBALS['phpgw']->common->phpgw_exit();
+               }
+       }
 
-*/
-
-
        $searchAndGetDocumentsWithVariants = new 
searchAndGetDocumentsWithVariants();
 
        $searchAndGetDocumentsWithVariants->secKey = $secKey;
        $searchAndGetDocumentsWithVariants->baseclassname = 'Eiendomsarkiver';
        $searchAndGetDocumentsWithVariants->classname = 'Byggesak';
        $searchAndGetDocumentsWithVariants->where = "Byggnr = {$bygningsnr}";// 
AND Regdato > '2006-01-25'";
-       $searchAndGetDocumentsWithVariants->maxhits = '20';
+       $searchAndGetDocumentsWithVariants->maxhits = '-1';
 
-
-//_debug_array($searchAndGetDocumentsWithVariants);
-
        $searchAndGetDocumentsWithVariantsResponse = 
$Services->searchAndGetDocumentsWithVariants($searchAndGetDocumentsWithVariants);
 
        $Result = 
$searchAndGetDocumentsWithVariantsResponse->searchAndGetDocumentsWithVariantsResult;
@@ -186,29 +192,69 @@
                $_result =array('ExtendedDocument' => 
$Result->ExtendedDocument);
        }
 
-//_debug_array($_result);
        $html =<<<HTML
        <table>
 HTML;
 
+       if(!$Result)
+       {
+               echo "<H2> Ingen treff </H2>";
+               $GLOBALS['phpgw']->common->phpgw_exit();
+       }
 
+       $Logout = new Logout();
+       $Logout->secKey = $secKey;
+       $Services->Logout($Logout);
+
+       $skip_field = array
+       (
+               'ASTA_Signatur',
+               'Adresse',
+               'Sakstype',
+               'Saksnr',
+               'Tiltakstype',
+               'Tiltaksart',
+               'Gradering',
+               'Skjerming',
+               'BrukerID',
+               'Team'
+       );
+
+       $html .='<th>';
+       $html .='Last ned';
+       $html .'</th>';
+
+       $location_id    = phpgw::get_var('location_id', 'int');
+       $section        = phpgw::get_var('section', 'string');
+
+       $base_url = 
$GLOBALS['phpgw']->link('/property/inc/soap_client/braarkiv/soap.php',array('domain'
 => $_GET['domain'], 'location_id' => $location_id, 'section' => $section));
+
        foreach($_result['ExtendedDocument'][0]->Attributes->Attribute as 
$attribute)
        {
+               if(in_array($attribute->Name, $skip_field))
+               {
+                       continue;
+               }
                $html .='<th>';
                $html .=$attribute->Name;
                $html .'</th>';
+
        }
 
        foreach ($_result['ExtendedDocument'] as $entry)
        {
                $html .= '<tr>';
-/*
                $html .='<td>';
-               $html .=$entry->Variants->Variant[0]->FileName;
+               $html .="<a href ='{$base_url}&fileid={$entry->ID}' title = 
'{$entry->Name}' target = '_blank'>{$entry->ID}</a>";
                $html .='</td>';
-*/
+
                foreach($entry->Attributes->Attribute as $attribute)
                {
+                       if(in_array($attribute->Name, $skip_field))
+                       {
+                               continue;
+                       }
+
                        $html .='<td>';
 
                        if(is_array($attribute->Value->anyType))
@@ -219,10 +265,20 @@
                                {
                                        $html .= '<tr>';
                                        $html .= '<td>';
-                                       $html .= $value->enc_value->GNr;
-                                       $html .= '/' . $value->enc_value->BNr;
+
+                                       if(isset($value->enc_stype) && 
$value->enc_stype == 'Matrikkel')
+                                       {
+                                               $html .= $value->enc_value->GNr;
+                                               $html .= '/' . 
$value->enc_value->BNr;
+                                       }
+                                       else
+                                       {
+                                               $html .= $value;                
                        
+                                       }
+
                                        $html .= '</td>';
                                        $html .= '</tr>';
+
                                }
                                $html .= '</table>';
                        }
@@ -240,8 +296,6 @@
        </table>
 HTML;
 
-
        echo $html;
 
-
        $GLOBALS['phpgw']->common->phpgw_exit();




reply via email to

[Prev in Thread] Current Thread [Next in Thread]