コード例 #1
0
ファイル: PackageExport.php プロジェクト: hardikk/HNH
 /**
  * Export Custom views of the module
  * @access private
  */
 function export_CustomViews($moduleInstance)
 {
     global $adb;
     $customviewres = $adb->pquery("SELECT * FROM vtiger_customview WHERE entitytype = ?", array($moduleInstance->name));
     $customviewcount = $adb->num_rows($customviewres);
     if (empty($customviewcount)) {
         return;
     }
     $this->openNode('customviews');
     for ($cvindex = 0; $cvindex < $customviewcount; ++$cvindex) {
         $cvid = $adb->query_result($customviewres, $cvindex, 'cvid');
         $cvcolumnres = $adb->query("SELECT * FROM vtiger_cvcolumnlist WHERE cvid={$cvid}");
         $cvcolumncount = $adb->num_rows($cvcolumnres);
         $this->openNode('customview');
         $setdefault = $adb->query_result($customviewres, $cvindex, 'setdefault');
         $setdefault = $setdefault == 1 ? 'true' : 'false';
         $setmetrics = $adb->query_result($customviewres, $cvindex, 'setmetrics');
         $setmetrics = $setmetrics == 1 ? 'true' : 'false';
         $this->outputNode($adb->query_result($customviewres, $cvindex, 'viewname'), 'viewname');
         $this->outputNode($setdefault, 'setdefault');
         $this->outputNode($setmetrics, 'setmetrics');
         $this->openNode('fields');
         for ($index = 0; $index < $cvcolumncount; ++$index) {
             $cvcolumnindex = $adb->query_result($cvcolumnres, $index, 'columnindex');
             $cvcolumnname = $adb->query_result($cvcolumnres, $index, 'columnname');
             $cvcolumnnames = explode(':', $cvcolumnname);
             $cvfieldname = $cvcolumnnames[2];
             $this->openNode('field');
             $this->outputNode($cvfieldname, 'fieldname');
             $this->outputNode($cvcolumnindex, 'columnindex');
             $cvcolumnruleres = $adb->pquery("SELECT * FROM vtiger_cvadvfilter WHERE cvid=? AND columnname=?", array($cvid, $cvcolumnname));
             $cvcolumnrulecount = $adb->num_rows($cvcolumnruleres);
             if ($cvcolumnrulecount) {
                 $this->openNode('rules');
                 for ($rindex = 0; $rindex < $cvcolumnrulecount; ++$rindex) {
                     $cvcolumnruleindex = $adb->query_result($cvcolumnruleres, $rindex, 'columnindex');
                     $cvcolumnrulecomp = $adb->query_result($cvcolumnruleres, $rindex, 'comparator');
                     $cvcolumnrulevalue = $adb->query_result($cvcolumnruleres, $rindex, 'value');
                     $cvcolumnrulecomp = Vtiger_Filter::translateComparator($cvcolumnrulecomp, true);
                     $this->openNode('rule');
                     $this->outputNode($cvcolumnruleindex, 'columnindex');
                     $this->outputNode($cvcolumnrulecomp, 'comparator');
                     $this->outputNode($cvcolumnrulevalue, 'value');
                     $this->closeNode('rule');
                 }
                 $this->closeNode('rules');
             }
             $this->closeNode('field');
         }
         $this->closeNode('fields');
         $this->closeNode('customview');
     }
     $this->closeNode('customviews');
 }