[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /*+********************************************************************************** 3 * The contents of this file are subject to the vtiger CRM Public License Version 1.0 4 * ("License"); You may not use this file except in compliance with the License 5 * The Original Code is: vtiger CRM Open Source 6 * The Initial Developer of the Original Code is vtiger. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 ************************************************************************************/ 10 include_once ('vtlib/Vtiger/LayoutExport.php'); 11 12 /** 13 * Provides API to import language into vtiger CRM 14 * @package vtlib 15 */ 16 class Vtiger_LayoutImport extends Vtiger_LayoutExport { 17 18 /** 19 * Constructor 20 */ 21 function __construct() { 22 parent::__construct(); 23 $this->_export_tmpdir; 24 } 25 26 /** 27 * Initialize Import 28 * @access private 29 */ 30 function initImport($zipfile, $overwrite) { 31 $this->__initSchema(); 32 $name = $this->getModuleNameFromZip($zipfile); 33 return $name; 34 } 35 36 /** 37 * Import Module from zip file 38 * @param String Zip file name 39 * @param Boolean True for overwriting existing module 40 */ 41 function import($zipfile, $overwrite=false) { 42 $this->initImport($zipfile, $overwrite); 43 44 // Call module import function 45 $this->import_Layout($zipfile); 46 } 47 48 /** 49 * Update Module from zip file 50 * @param Object Instance of Language (to keep Module update API consistent) 51 * @param String Zip file name 52 * @param Boolean True for overwriting existing module 53 */ 54 function update($instance, $zipfile, $overwrite=true) { 55 $this->import($zipfile, $overwrite); 56 } 57 58 /** 59 * Import Module 60 * @access private 61 */ 62 function import_Layout($zipfile) { 63 $name = $this->_modulexml->name; 64 $label = $this->_modulexml->label; 65 66 self::log("Importing $label ... STARTED"); 67 $unzip = new Vtiger_Unzip($zipfile); 68 $filelist = $unzip->getList(); 69 $vtiger6format = false; 70 71 foreach($filelist as $filename=>$fileinfo) { 72 if(!$unzip->isdir($filename)) { 73 74 if(strpos($filename, '/') === false) continue; 75 76 77 $targetdir = substr($filename, 0, strripos($filename,'/')); 78 $targetfile = basename($filename); 79 $dounzip = false; 80 // Case handling for jscalendar 81 if(stripos($targetdir, "layouts/$label/skins") === 0) { 82 $dounzip = true; 83 $vtiger6format = true; 84 } 85 // vtiger6 format 86 else if (stripos($targetdir, "layouts/$label/modules") === 0) { 87 $vtiger6format = true; 88 $dounzip = true; 89 } 90 if($dounzip) { 91 // vtiger6 format 92 if ($vtiger6format) { 93 $targetdir = "layouts/$label/" . str_replace("layouts/$label", "", $targetdir); 94 @mkdir($targetdir, 0777, true); 95 } 96 97 if($unzip->unzip($filename, "$targetdir/$targetfile") !== false) { 98 self::log("Copying file $filename ... DONE"); 99 } else { 100 self::log("Copying file $filename ... FAILED"); 101 } 102 } else { 103 self::log("Copying file $filename ... SKIPPED"); 104 } 105 } 106 } 107 if($unzip) $unzip->close(); 108 109 self::register($label, $name); 110 111 self::log("Importing $label [$prefix] ... DONE"); 112 113 return; 114 } 115 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |