[ 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/Module.php'); 11 include_once ('vtlib/Vtiger/Menu.php'); 12 include_once ('vtlib/Vtiger/Event.php'); 13 include_once ('vtlib/Vtiger/Zip.php'); 14 include_once ('vtlib/Vtiger/Cron.php'); 15 /** 16 * Provides API to package vtiger CRM module and associated files. 17 * @package vtlib 18 */ 19 class Vtiger_PackageExport { 20 var $_export_tmpdir = 'test/vtlib'; 21 var $_export_modulexml_filename = null; 22 var $_export_modulexml_file = null; 23 24 /** 25 * Constructor 26 */ 27 function Vtiger_PackageExport() { 28 if(is_dir($this->_export_tmpdir) === FALSE) { 29 mkdir($this->_export_tmpdir); 30 } 31 } 32 33 /** Output Handlers */ 34 35 /** @access private */ 36 function openNode($node,$delimiter="\n") { 37 $this->__write("<$node>$delimiter"); 38 } 39 /** @access private */ 40 function closeNode($node,$delimiter="\n") { 41 $this->__write("</$node>$delimiter"); 42 } 43 /** @access private */ 44 function outputNode($value, $node='') { 45 if($node != '') $this->openNode($node,''); 46 $this->__write($value); 47 if($node != '') $this->closeNode($node); 48 } 49 /** @access private */ 50 function __write($value) { 51 fwrite($this->_export_modulexml_file, $value); 52 } 53 54 /** 55 * Set the module.xml file path for this export and 56 * return its temporary path. 57 * @access private 58 */ 59 function __getManifestFilePath() { 60 if(empty($this->_export_modulexml_filename)) { 61 // Set the module xml filename to be written for exporting. 62 $this->_export_modulexml_filename = "manifest-".time().".xml"; 63 } 64 return "$this->_export_tmpdir/$this->_export_modulexml_filename"; 65 } 66 67 /** 68 * Initialize Export 69 * @access private 70 */ 71 function __initExport($module, $moduleInstance) { 72 if($moduleInstance->isentitytype) { 73 // We will be including the file, so do a security check. 74 Vtiger_Utils::checkFileAccessForInclusion("modules/$module/$module.php"); 75 } 76 $this->_export_modulexml_file = fopen($this->__getManifestFilePath(), 'w'); 77 $this->__write("<?xml version='1.0'?>\n"); 78 } 79 80 /** 81 * Post export work. 82 * @access private 83 */ 84 function __finishExport() { 85 if(!empty($this->_export_modulexml_file)) { 86 fclose($this->_export_modulexml_file); 87 $this->_export_modulexml_file = null; 88 } 89 } 90 91 /** 92 * Clean up the temporary files created. 93 * @access private 94 */ 95 function __cleanupExport() { 96 if(!empty($this->_export_modulexml_filename)) { 97 unlink($this->__getManifestFilePath()); 98 } 99 } 100 101 /** 102 * Export Module as a zip file. 103 * @param Vtiger_Module Instance of module 104 * @param Path Output directory path 105 * @param String Zipfilename to use 106 * @param Boolean True for sending the output as download 107 */ 108 function export($moduleInstance, $todir='', $zipfilename='', $directDownload=false) { 109 110 $module = $moduleInstance->name; 111 112 $this->__initExport($module, $moduleInstance); 113 114 // Call module export function 115 $this->export_Module($moduleInstance); 116 117 $this->__finishExport(); 118 119 // Export as Zip 120 if($zipfilename == '') $zipfilename = "$module-" . date('YmdHis') . ".zip"; 121 $zipfilename = "$this->_export_tmpdir/$zipfilename"; 122 123 $zip = new Vtiger_Zip($zipfilename); 124 125 // Add manifest file 126 $zip->addFile($this->__getManifestFilePath(), "manifest.xml"); 127 128 // Copy module directory 129 $zip->copyDirectoryFromDisk("modules/$module"); 130 131 // Copy Settings/module directory 132 if(is_dir("modules/Settings/$module")) 133 $zip->copyDirectoryFromDisk("modules/Settings/$module", 'settings/'); 134 135 // Copy cron files of the module (if any) 136 if(is_dir("cron/modules/$module")) 137 $zip->copyDirectoryFromDisk("cron/modules/$module", "cron"); 138 139 //Copy module templates files 140 if(is_dir("layouts/vlayout/modules/$module")) 141 $zip->copyDirectoryFromDisk ("layouts/vlayout/modules/$module", "templates"); 142 143 //Copy Settings module templates files, if any 144 if(is_dir("layouts/vlayout/modules/Settings/$module")) 145 $zip->copyDirectoryFromDisk ("layouts/vlayout/modules/Settings/$module", "settings/templates"); 146 147 //Copy language files 148 $this->__copyLanguageFiles($zip, $module); 149 150 $zip->save(); 151 152 if($todir) { 153 copy($zipfilename, $todir); 154 } 155 156 if($directDownload) { 157 $zip->forceDownload($zipfilename); 158 unlink($zipfilename); 159 } 160 $this->__cleanupExport(); 161 } 162 163 /** 164 * Function copies language files to zip 165 * @param <Vtiger_Zip> $zip 166 * @param <String> $module 167 */ 168 function __copyLanguageFiles($zip, $module) { 169 $languageFolder = "languages"; 170 if($dir = @opendir($languageFolder)) { // open languages folder 171 while (($langName = readdir($dir)) !== false) { 172 if ($langName != ".." && $langName != "." && is_dir($languageFolder."/".$langName)) { 173 $langDir = @opendir($languageFolder. '/'.$langName); //open languages/en_us folder 174 while(($moduleLangFile = readdir($langDir)) !== false) { 175 $langFilePath = $languageFolder.'/'.$langName.'/'.$moduleLangFile; 176 if(is_file($langFilePath) && $moduleLangFile === $module.'.php') { //check if languages/en_us/module.php file exists 177 $zip->copyFileFromDisk ($languageFolder.'/'.$langName.'/', $languageFolder.'/'.$langName.'/', $moduleLangFile); 178 } else if(is_dir($langFilePath) && $moduleLangFile == 'Settings') { 179 $settingsLangDir = @opendir($langFilePath); 180 while($settingLangFileName = readdir($settingsLangDir)) { 181 $settingsLangFilePath = $languageFolder.'/'.$langName.'/'.$moduleLangFile.'/'.$settingLangFileName; 182 if(is_file($settingsLangFilePath) && $settingLangFileName === $module.'.php') { //check if languages/en_us/Settings/module.php file exists 183 $zip->copyFileFromDisk ($languageFolder.'/'.$langName.'/'.$moduleLangFile.'/', 184 $languageFolder.'/'.$langName.'/'.$moduleLangFile.'/', $settingLangFileName); 185 } 186 } 187 closedir($settingsLangDir); 188 } 189 } 190 closedir($langDir); 191 } 192 } 193 closedir($dir); 194 } 195 } 196 197 /** 198 * Export vtiger dependencies 199 * @access private 200 */ 201 function export_Dependencies($moduleInstance) { 202 global $vtiger_current_version, $adb; 203 $moduleid = $moduleInstance->id; 204 205 $sqlresult = $adb->pquery("SELECT * FROM vtiger_tab_info WHERE tabid = ?", array($moduleid)); 206 $vtigerMinVersion = $vtiger_current_version; 207 $vtigerMaxVersion = false; 208 $noOfPreferences = $adb->num_rows($sqlresult); 209 for($i=0; $i<$noOfPreferences; ++$i) { 210 $prefName = $adb->query_result($sqlresult,$i,'prefname'); 211 $prefValue = $adb->query_result($sqlresult,$i,'prefvalue'); 212 if($prefName == 'vtiger_min_version') { 213 $vtigerMinVersion = $prefValue; 214 } 215 if($prefName == 'vtiger_max_version') { 216 $vtigerMaxVersion = $prefValue; 217 } 218 219 } 220 221 $this->openNode('dependencies'); 222 $this->outputNode($vtigerMinVersion, 'vtiger_version'); 223 if($vtigerMaxVersion !== false) $this->outputNode($vtigerMaxVersion, 'vtiger_max_version'); 224 $this->closeNode('dependencies'); 225 } 226 227 /** 228 * Export Module Handler 229 * @access private 230 */ 231 function export_Module($moduleInstance) { 232 global $adb; 233 234 $moduleid = $moduleInstance->id; 235 236 $sqlresult = $adb->pquery("SELECT * FROM vtiger_parenttabrel WHERE tabid = ?", array($moduleid)); 237 $parenttabid = $adb->query_result($sqlresult, 0, 'parenttabid'); 238 $menu = Vtiger_Menu::getInstance($parenttabid); 239 $parent_name = $menu->label; 240 241 $sqlresult = $adb->pquery("SELECT * FROM vtiger_tab WHERE tabid = ?", array($moduleid)); 242 $tabresultrow = $adb->fetch_array($sqlresult); 243 244 $tabname = $tabresultrow['name']; 245 $tablabel= $tabresultrow['tablabel']; 246 $tabversion = isset($tabresultrow['version'])? $tabresultrow['version'] : false; 247 248 $this->openNode('module'); 249 $this->outputNode(date('Y-m-d H:i:s'),'exporttime'); 250 $this->outputNode($tabname, 'name'); 251 $this->outputNode($tablabel, 'label'); 252 $this->outputNode($parent_name, 'parent'); 253 254 if(!$moduleInstance->isentitytype) { 255 $this->outputNode('extension', 'type'); 256 } 257 258 if($tabversion) { 259 $this->outputNode($tabversion, 'version'); 260 } 261 262 // Export dependency information 263 $this->export_Dependencies($moduleInstance); 264 265 // Export module tables 266 $this->export_Tables($moduleInstance); 267 268 // Export module blocks 269 $this->export_Blocks($moduleInstance); 270 271 // Export module filters 272 $this->export_CustomViews($moduleInstance); 273 274 // Export Sharing Access 275 $this->export_SharingAccess($moduleInstance); 276 277 // Export Events 278 $this->export_Events($moduleInstance); 279 280 // Export Actions 281 $this->export_Actions($moduleInstance); 282 283 // Export Related Lists 284 $this->export_RelatedLists($moduleInstance); 285 286 // Export Custom Links 287 $this->export_CustomLinks($moduleInstance); 288 289 //Export cronTasks 290 $this->export_CronTasks($moduleInstance); 291 292 $this->closeNode('module'); 293 } 294 295 /** 296 * Export module base and related tables 297 * @access private 298 */ 299 function export_Tables($moduleInstance) { 300 301 $_exportedTables = Array(); 302 303 $modulename = $moduleInstance->name; 304 305 $this->openNode('tables'); 306 307 if($moduleInstance->isentitytype) { 308 $focus = CRMEntity::getInstance($modulename); 309 310 // Setup required module variables which is need for vtlib API's 311 vtlib_setup_modulevars($modulename, $focus); 312 313 $tables = Array ($focus->table_name); 314 if(!empty($focus->groupTable)) $tables[] = $focus->groupTable[0]; 315 if(!empty($focus->customFieldTable)) $tables[] = $focus->customFieldTable[0]; 316 317 foreach($tables as $table) { 318 $this->openNode('table'); 319 $this->outputNode($table, 'name'); 320 $this->outputNode('<![CDATA['.Vtiger_Utils::CreateTableSql($table).']]>', 'sql'); 321 $this->closeNode('table'); 322 323 $_exportedTables[] = $table; 324 } 325 326 } 327 328 // Now export table information recorded in schema file 329 if(file_exists("modules/$modulename/schema.xml")) { 330 $schema = simplexml_load_file("modules/$modulename/schema.xml"); 331 332 if(!empty($schema->tables) && !empty($schema->tables->table)) { 333 foreach($schema->tables->table as $tablenode) { 334 $table = trim($tablenode->name); 335 if(!in_array($table,$_exportedTables)) { 336 $this->openNode('table'); 337 $this->outputNode($table, 'name'); 338 $this->outputNode('<![CDATA['.Vtiger_Utils::CreateTableSql($table).']]>', 'sql'); 339 $this->closeNode('table'); 340 341 $_exportedTables[] = $table; 342 } 343 } 344 } 345 } 346 $this->closeNode('tables'); 347 } 348 349 /** 350 * Export module blocks with its related fields 351 * @access private 352 */ 353 function export_Blocks($moduleInstance) { 354 global $adb; 355 $sqlresult = $adb->pquery("SELECT * FROM vtiger_blocks WHERE tabid = ?", Array($moduleInstance->id)); 356 $resultrows= $adb->num_rows($sqlresult); 357 358 if(empty($resultrows)) return; 359 360 $this->openNode('blocks'); 361 for($index = 0; $index < $resultrows; ++$index) { 362 $blockid = $adb->query_result($sqlresult, $index, 'blockid'); 363 $blocklabel = $adb->query_result($sqlresult, $index, 'blocklabel'); 364 365 $this->openNode('block'); 366 $this->outputNode($blocklabel, 'label'); 367 // Export fields associated with the block 368 $this->export_Fields($moduleInstance, $blockid); 369 $this->closeNode('block'); 370 } 371 $this->closeNode('blocks'); 372 } 373 374 /** 375 * Export fields related to a module block 376 * @access private 377 */ 378 function export_Fields($moduleInstance, $blockid) { 379 global $adb; 380 381 $fieldresult = $adb->pquery("SELECT * FROM vtiger_field WHERE tabid=? AND block=?", Array($moduleInstance->id, $blockid)); 382 $fieldcount = $adb->num_rows($fieldresult); 383 384 if(empty($fieldcount)) return; 385 386 $entityresult = $adb->pquery("SELECT * FROM vtiger_entityname WHERE tabid=?", Array($moduleInstance->id)); 387 $entity_fieldname = $adb->query_result($entityresult, 0, 'fieldname'); 388 389 $this->openNode('fields'); 390 for($index = 0; $index < $fieldcount; ++$index) { 391 $this->openNode('field'); 392 $fieldresultrow = $adb->fetch_row($fieldresult); 393 394 $fieldname = $fieldresultrow['fieldname']; 395 $uitype = $fieldresultrow['uitype']; 396 $fieldid = $fieldresultrow['fieldid']; 397 398 $this->outputNode($fieldname, 'fieldname'); 399 $this->outputNode($uitype, 'uitype'); 400 $this->outputNode($fieldresultrow['columnname'],'columnname'); 401 $this->outputNode($fieldresultrow['tablename'], 'tablename'); 402 $this->outputNode($fieldresultrow['generatedtype'], 'generatedtype'); 403 $this->outputNode($fieldresultrow['fieldlabel'], 'fieldlabel'); 404 $this->outputNode($fieldresultrow['readonly'], 'readonly'); 405 $this->outputNode($fieldresultrow['presence'], 'presence'); 406 $this->outputNode($fieldresultrow['defaultvalue'], 'defaultvalue'); 407 $this->outputNode($fieldresultrow['sequence'], 'sequence'); 408 $this->outputNode($fieldresultrow['maximumlength'], 'maximumlength'); 409 $this->outputNode($fieldresultrow['typeofdata'], 'typeofdata'); 410 $this->outputNode($fieldresultrow['quickcreate'], 'quickcreate'); 411 $this->outputNode($fieldresultrow['quickcreatesequence'], 'quickcreatesequence'); 412 $this->outputNode($fieldresultrow['displaytype'], 'displaytype'); 413 $this->outputNode($fieldresultrow['info_type'], 'info_type'); 414 $this->outputNode('<![CDATA['.$fieldresultrow['helpinfo'].']]>', 'helpinfo'); 415 if(isset($fieldresultrow['masseditable'])) { 416 $this->outputNode($fieldresultrow['masseditable'], 'masseditable'); 417 } 418 if(isset($fieldresultrow['summaryfield'])){ 419 $this->outputNode($fieldresultrow['summaryfield'],'summaryfield'); 420 } 421 // Export Entity Identifier Information 422 if($fieldname == $entity_fieldname) { 423 $this->openNode('entityidentifier'); 424 $this->outputNode($adb->query_result($entityresult, 0, 'entityidfield'), 'entityidfield'); 425 $this->outputNode($adb->query_result($entityresult, 0, 'entityidcolumn'), 'entityidcolumn'); 426 $this->closeNode('entityidentifier'); 427 } 428 429 // Export picklist values for picklist fields 430 if($uitype == '15' || $uitype == '16' || $uitype == '111' || $uitype == '33' || $uitype == '55') { 431 432 if($uitype == '16') { 433 $picklistvalues = vtlib_getPicklistValues($fieldname); 434 } else { 435 $picklistvalues = vtlib_getPicklistValues_AccessibleToAll($fieldname); 436 } 437 $this->openNode('picklistvalues'); 438 foreach($picklistvalues as $picklistvalue) { 439 $this->outputNode($picklistvalue, 'picklistvalue'); 440 } 441 $this->closeNode('picklistvalues'); 442 } 443 444 // Export field to module relations 445 if($uitype == '10') { 446 $relatedmodres = $adb->pquery("SELECT * FROM vtiger_fieldmodulerel WHERE fieldid=?", Array($fieldid)); 447 $relatedmodcount = $adb->num_rows($relatedmodres); 448 if($relatedmodcount) { 449 $this->openNode('relatedmodules'); 450 for($relmodidx = 0; $relmodidx < $relatedmodcount; ++$relmodidx) { 451 $this->outputNode($adb->query_result($relatedmodres, $relmodidx, 'relmodule'), 'relatedmodule'); 452 } 453 $this->closeNode('relatedmodules'); 454 } 455 } 456 457 $this->closeNode('field'); 458 459 } 460 $this->closeNode('fields'); 461 } 462 463 /** 464 * Export Custom views of the module 465 * @access private 466 */ 467 function export_CustomViews($moduleInstance) { 468 global $adb; 469 470 $customviewres = $adb->pquery("SELECT * FROM vtiger_customview WHERE entitytype = ?", Array($moduleInstance->name)); 471 $customviewcount=$adb->num_rows($customviewres); 472 473 if(empty($customviewcount)) return; 474 475 $this->openNode('customviews'); 476 for($cvindex = 0; $cvindex < $customviewcount; ++$cvindex) { 477 478 $cvid = $adb->query_result($customviewres, $cvindex, 'cvid'); 479 480 $cvcolumnres = $adb->pquery("SELECT * FROM vtiger_cvcolumnlist WHERE cvid=?", array($cvid)); 481 $cvcolumncount=$adb->num_rows($cvcolumnres); 482 483 $this->openNode('customview'); 484 485 $setdefault = $adb->query_result($customviewres, $cvindex, 'setdefault'); 486 $setdefault = ($setdefault == 1)? 'true' : 'false'; 487 488 $setmetrics = $adb->query_result($customviewres, $cvindex, 'setmetrics'); 489 $setmetrics = ($setmetrics == 1)? 'true' : 'false'; 490 491 $this->outputNode($adb->query_result($customviewres, $cvindex, 'viewname'), 'viewname'); 492 $this->outputNode($setdefault, 'setdefault'); 493 $this->outputNode($setmetrics, 'setmetrics'); 494 495 $this->openNode('fields'); 496 for($index = 0; $index < $cvcolumncount; ++$index) { 497 $cvcolumnindex = $adb->query_result($cvcolumnres, $index, 'columnindex'); 498 $cvcolumnname = $adb->query_result($cvcolumnres, $index, 'columnname'); 499 $cvcolumnnames= explode(':', $cvcolumnname); 500 $cvfieldname = $cvcolumnnames[2]; 501 502 $this->openNode('field'); 503 $this->outputNode($cvfieldname, 'fieldname'); 504 $this->outputNode($cvcolumnindex,'columnindex'); 505 506 $cvcolumnruleres = $adb->pquery("SELECT * FROM vtiger_cvadvfilter WHERE cvid=? AND columnname=?", 507 Array($cvid, $cvcolumnname)); 508 $cvcolumnrulecount = $adb->num_rows($cvcolumnruleres); 509 510 if($cvcolumnrulecount) { 511 $this->openNode('rules'); 512 for($rindex = 0; $rindex < $cvcolumnrulecount; ++$rindex) { 513 $cvcolumnruleindex = $adb->query_result($cvcolumnruleres, $rindex, 'columnindex'); 514 $cvcolumnrulecomp = $adb->query_result($cvcolumnruleres, $rindex, 'comparator'); 515 $cvcolumnrulevalue = $adb->query_result($cvcolumnruleres, $rindex, 'value'); 516 $cvcolumnrulecomp = Vtiger_Filter::translateComparator($cvcolumnrulecomp, true); 517 518 $this->openNode('rule'); 519 $this->outputNode($cvcolumnruleindex, 'columnindex'); 520 $this->outputNode($cvcolumnrulecomp, 'comparator'); 521 $this->outputNode($cvcolumnrulevalue, 'value'); 522 $this->closeNode('rule'); 523 524 } 525 $this->closeNode('rules'); 526 } 527 528 $this->closeNode('field'); 529 } 530 $this->closeNode('fields'); 531 532 $this->closeNode('customview'); 533 } 534 $this->closeNode('customviews'); 535 } 536 537 /** 538 * Export Sharing Access of the module 539 * @access private 540 */ 541 function export_SharingAccess($moduleInstance) { 542 global $adb; 543 544 $deforgshare = $adb->pquery("SELECT * FROM vtiger_def_org_share WHERE tabid=?", Array($moduleInstance->id)); 545 $deforgshareCount = $adb->num_rows($deforgshare); 546 547 if(empty($deforgshareCount)) return; 548 549 $this->openNode('sharingaccess'); 550 if($deforgshareCount) { 551 for($index = 0; $index < $deforgshareCount; ++$index) { 552 $permission = $adb->query_result($deforgshare, $index, 'permission'); 553 $permissiontext = ''; 554 if($permission == '0') $permissiontext = 'public_readonly'; 555 if($permission == '1') $permissiontext = 'public_readwrite'; 556 if($permission == '2') $permissiontext = 'public_readwritedelete'; 557 if($permission == '3') $permissiontext = 'private'; 558 559 $this->outputNode($permissiontext, 'default'); 560 } 561 } 562 $this->closeNode('sharingaccess'); 563 } 564 565 /** 566 * Export Events of the module 567 * @access private 568 */ 569 function export_Events($moduleInstance) { 570 $events = Vtiger_Event::getAll($moduleInstance); 571 if(!$events) return; 572 573 $this->openNode('events'); 574 foreach($events as $event) { 575 $this->openNode('event'); 576 $this->outputNode($event->eventname, 'eventname'); 577 $this->outputNode('<![CDATA['.$event->classname.']]>', 'classname'); 578 $this->outputNode('<![CDATA['.$event->filename.']]>', 'filename'); 579 $this->outputNode('<![CDATA['.$event->condition.']]>', 'condition'); 580 $this->closeNode('event'); 581 } 582 $this->closeNode('events'); 583 } 584 585 /** 586 * Export actions (tools) associated with module. 587 * TODO: Need to pickup values based on status for all user (profile) 588 * @access private 589 */ 590 function export_Actions($moduleInstance) { 591 592 if(!$moduleInstance->isentitytype) return; 593 594 global $adb; 595 $result = $adb->pquery('SELECT distinct(actionname) FROM vtiger_profile2utility, vtiger_actionmapping 596 WHERE vtiger_profile2utility.activityid=vtiger_actionmapping.actionid and tabid=?', Array($moduleInstance->id)); 597 598 if($adb->num_rows($result)) { 599 $this->openNode('actions'); 600 while($resultrow = $adb->fetch_array($result)) { 601 $this->openNode('action'); 602 $this->outputNode('<![CDATA['. $resultrow['actionname'] .']]>', 'name'); 603 $this->outputNode('enabled', 'status'); 604 $this->closeNode('action'); 605 } 606 $this->closeNode('actions'); 607 } 608 } 609 610 /** 611 * Export related lists associated with module. 612 * @access private 613 */ 614 function export_RelatedLists($moduleInstance) { 615 616 if(!$moduleInstance->isentitytype) return; 617 618 global $adb; 619 $result = $adb->pquery("SELECT * FROM vtiger_relatedlists WHERE tabid = ?", Array($moduleInstance->id)); 620 if($adb->num_rows($result)) { 621 $this->openNode('relatedlists'); 622 623 for($index = 0; $index < $adb->num_rows($result); ++$index) { 624 $row = $adb->fetch_array($result); 625 $this->openNode('relatedlist'); 626 627 $this->outputNode($row['name'], 'function'); 628 $this->outputNode($row['label'], 'label'); 629 $this->outputNode($row['sequence'], 'sequence'); 630 $this->outputNode($row['presence'], 'presence'); 631 632 $action_text = $row['actions']; 633 if(!empty($action_text)) { 634 $this->openNode('actions'); 635 $actions = explode(',', $action_text); 636 foreach($actions as $action) { 637 $this->outputNode($action, 'action'); 638 } 639 $this->closeNode('actions'); 640 } 641 642 $relModuleInstance = Vtiger_Module::getInstance($row['related_tabid']); 643 $this->outputNode($relModuleInstance->name, 'relatedmodule'); 644 645 $this->closeNode('relatedlist'); 646 } 647 648 $this->closeNode('relatedlists'); 649 } 650 } 651 652 /** 653 * Export custom links of the module. 654 * @access private 655 */ 656 function export_CustomLinks($moduleInstance) { 657 $customlinks = $moduleInstance->getLinksForExport(); 658 if(!empty($customlinks)) { 659 $this->openNode('customlinks'); 660 foreach($customlinks as $customlink) { 661 $this->openNode('customlink'); 662 $this->outputNode($customlink->linktype, 'linktype'); 663 $this->outputNode($customlink->linklabel, 'linklabel'); 664 $this->outputNode("<![CDATA[$customlink->linkurl]]>", 'linkurl'); 665 $this->outputNode("<![CDATA[$customlink->linkicon]]>", 'linkicon'); 666 $this->outputNode($customlink->sequence, 'sequence'); 667 $this->outputNode("<![CDATA[$customlink->handler_path]]>", 'handler_path'); 668 $this->outputNode("<![CDATA[$customlink->handler_class]]>", 'handler_class'); 669 $this->outputNode("<![CDATA[$customlink->handler]]>", 'handler'); 670 $this->closeNode('customlink'); 671 } 672 $this->closeNode('customlinks'); 673 } 674 } 675 676 /** 677 * Export cron tasks for the module. 678 * @access private 679 */ 680 function export_CronTasks($moduleInstance){ 681 $cronTasks = Vtiger_Cron::listAllInstancesByModule($moduleInstance->name); 682 $this->openNode('crons'); 683 foreach($cronTasks as $cronTask){ 684 $this->openNode('cron'); 685 $this->outputNode($cronTask->getName(),'name'); 686 $this->outputNode($cronTask->getFrequency(),'frequency'); 687 $this->outputNode($cronTask->getStatus(),'status'); 688 $this->outputNode($cronTask->getHandlerFile(),'handler'); 689 $this->outputNode($cronTask->getSequence(),'sequence'); 690 $this->outputNode($cronTask->getDescription(),'description'); 691 $this->closeNode('cron'); 692 } 693 $this->closeNode('crons'); 694 } 695 696 /** 697 * Helper function to log messages 698 * @param String Message to log 699 * @param Boolean true appends linebreak, false to avoid it 700 * @access private 701 */ 702 static function log($message, $delim=true) { 703 Vtiger_Utils::Log($message, $delim); 704 } 705 } 706 ?>
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 |