[ Index ]
 

Code source de vtiger CRM 5.0.2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/modules/Utilities/ -> Merge.php (source)

   1  <html>
   2  <body>
   3  <?php
   4  /*********************************************************************************
   5  ** The contents of this file are subject to the vtiger CRM Public License Version 1.0
   6   * ("License"); You may not use this file except in compliance with the License
   7   * The Original Code is:  vtiger CRM Open Source
   8   * The Initial Developer of the Original Code is vtiger.
   9   * Portions created by vtiger are Copyright (C) vtiger.
  10   * All Rights Reserved.
  11  *
  12   ********************************************************************************/
  13  require_once ('include/database/PearDatabase.php');
  14  //echo 'id is ....... ' .$_REQUEST['record'];
  15  
  16  //echo 'merge file name is ...' .$_REQUEST['mergefile'];
  17  
  18  $mergeFileName = $_REQUEST['mergefile'];
  19  //get the particular file from db and store it in the local hard disk.
  20  //store the path to the location where the file is stored and pass it  as parameter to the method 
  21  $sql = "select filename,data,filesize from vtiger_wordtemplatestorage where filename='".$mergeFileName."'";
  22  
  23  $result = $adb->query($sql);
  24  $temparray = $adb->fetch_array($result);
  25  
  26  $fileContent = $temparray['data'];
  27  $filename=$temparray['filename'];
  28  $filesize=$temparray['filesize'];
  29  $wordtemplatedownloadpath =$_SERVER['DOCUMENT_ROOT'] ."/test/wordtemplatedownload/";
  30  
  31  //echo '<br> file name and size is ..'.$filename .'...'.$filesize;
  32  $handle = fopen($wordtemplatedownloadpath .$temparray['filename'],"wb") ;
  33  //chmod("/home/mickie/test/".$fileContent,0755);
  34  fwrite($handle,base64_decode($fileContent),$filesize);
  35  fclose($handle);
  36  
  37  
  38  $query = "SELECT * FROM " .$_REQUEST["module"] ." where id = '".$_REQUEST['record'] ."'";
  39  //echo $query;
  40  $result = $adb->query($query);
  41  
  42  $y=$adb->num_fields($result);
  43  
  44  for ($x=0; $x<$y; $x++)
  45  {
  46      $columnNames[$x] = "CONTACT_".strtoupper($adb->field_name($result, $x));
  47  } 
  48  
  49  $columnValues = $adb->fetch_array($result);
  50  for ($x=0; $x<$y; $x++)
  51  {
  52      $columnValString[$x] = $columnValues[$x];
  53  }
  54  
  55  $columnString = implode(",",$columnNames);
  56  $columnValString = implode(",",$columnValString);
  57  
  58  echo"<script type=\"text/javascript\">
  59  var dHdr = '$columnString';
  60  var dSrc = '$columnValString';
  61  </script>";
  62  ?>
  63  
  64  <OBJECT Name="vtigerVM" codebase="http://<?php echo $_SERVER["HTTP_HOST"] ?>/modules/Settings/vtigerVM.CAB#Version1,0,0,1"
  65  id="objMMPage" classid="clsid:42C50C38-1984-4393-A736-890357E7112B" width=0 height=0></object><!--METADATA TYPE="MsHtmlPageDesigner" endspan-->
  66  <Script>
  67          if(objMMPage.bDLTempDoc("http://"+"<?php echo $_SERVER["HTTP_HOST"] ?>/test/wordtemplatedownload/"+"<?php echo $filename?>","MMTemplate.doc"))
  68  {
  69      try
  70      {
  71          if(objMMPage.Init())
  72          {
  73              objMMPage.vLTemplateDoc();
  74              //objMMPage.vGetHDSrc(dHdr,dSrc);
  75              objMMPage.vBulkHDSrc(dHdr,dSrc);
  76             //objMMPage.vOpenDoc();
  77              objMMPage.vBulkOpenDoc();
  78              objMMPage.UnInit()
  79              document.write("Template Document Merged with selected contacts data");
  80          }        
  81      }catch(errorObject)
  82      {
  83      }
  84  }
  85  </Script>
  86  </body>
  87  </html>
  88  


Généré le : Sun Feb 25 10:22:19 2007 par Balluche grâce à PHPXref 0.7