当前位置: 首页>>代码示例>>PHP>>正文


PHP VardefManager::loadVardef方法代码示例

本文整理汇总了PHP中VardefManager::loadVardef方法的典型用法代码示例。如果您正苦于以下问题:PHP VardefManager::loadVardef方法的具体用法?PHP VardefManager::loadVardef怎么用?PHP VardefManager::loadVardef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VardefManager的用法示例。


在下文中一共展示了VardefManager::loadVardef方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

    public function setUp()
    {
        global $beanList, $beanFiles, $dictionary;
        //Add entries to simulate custom module
        $beanList['Bug44030_TestPerson'] = 'Bug44030_TestPerson';
        $beanFiles['Bug44030_TestPerson'] = 'modules/Bug44030_TestPerson/Bug44030_TestPerson.php';
        VardefManager::loadVardef('Contacts', 'Contact');
        $dictionary['Bug44030_TestPerson'] = $dictionary['Contact'];
        //Copy over custom SearchFields.php file
        if (!file_exists('custom/modules/Bug44030_TestPerson/metadata')) {
            mkdir_recursive('custom/modules/Bug44030_TestPerson/metadata');
        }
        if ($fh = @fopen('custom/modules/Bug44030_TestPerson/metadata/SearchFields.php', 'w+')) {
            $string = <<<EOQ
<?php
\$searchFields['Bug44030_TestPerson']['email'] = array(
'query_type' => 'default',
'operator' => 'subquery',
'subquery' => 'SELECT eabr.bean_id FROM email_addr_bean_rel eabr JOIN email_addresses ea ON (ea.id = eabr.email_address_id) WHERE eabr.deleted=0 AND ea.email_address LIKE',
'db_field' => array('id',),
'vname' =>'LBL_ANY_EMAIL',
);
?>
EOQ;
            fputs($fh, $string);
            fclose($fh);
        }
        //Remove the cached unified_search_modules.php file
        $this->unified_search_modules_file = $GLOBALS['sugar_config']['cache_dir'] . 'modules/unified_search_modules.php';
        if (file_exists($this->unified_search_modules_file)) {
            copy($this->unified_search_modules_file, $this->unified_search_modules_file . '.bak');
            unlink($this->unified_search_modules_file);
        }
    }
开发者ID:nickpro,项目名称:sugarcrm_dev,代码行数:34,代码来源:Bug44030Test.php

示例2: setUp

 public function setUp()
 {
     global $dictionary;
     $this->_view = 'editview';
     VardefManager::loadVardef('Contacts', 'Contact');
     $this->def = $dictionary['Contact']['fields']['email1'];
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:7,代码来源:Bug39729Test.php

示例3: testSaveUsersVardefs

 public function testSaveUsersVardefs()
 {
     global $dictionary;
     $dynamicField = new DynamicField('Users');
     VardefManager::loadVardef('Users', 'User');
     $dynamicField->saveToVardef('Users', $dictionary['User']['fields']);
     //Test that we have refreshed the Employees vardef
     $this->assertTrue(file_exists('cache/modules/Employees/Employeevardefs.php'), 'cache/modules/Employees/Emloyeevardefs.php file not created');
     //Test that status is not set to be required
     $this->assertFalse($dictionary['Employee']['fields']['status']['required'], 'status field set to required');
     //Test that the studio attribute is set to false for status field
     $this->assertFalse($dictionary['Employee']['fields']['status']['studio'], 'status field studio not set to false');
 }
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:13,代码来源:Bug47553Test.php

示例4: getCompareText

 /**
  * Generates field equality comparison PHP code
  *
  * @param WorkFlowTriggerShell $shell_object
  * @param bool $is_equal
  * @return string
  */
 private function getCompareText($shell_object, $is_equal)
 {
     global $dictionary;
     $parentWorkflow = $shell_object->get_workflow_type();
     if (empty($parentWorkflow->base_module)) {
         $GLOBALS['log']->error("WorkFlowTriggerShell ({$shell_object->id}) " . "parent WorkFlow ({$parentWorkflow->id}) has no base module set.");
     }
     $useStrict = true;
     $moduleName = $parentWorkflow->base_module;
     $objectName = BeanFactory::getObjectName($moduleName);
     $field = $shell_object->field;
     VardefManager::loadVardef($moduleName, $objectName);
     if (!empty($dictionary[$objectName]) && !empty($dictionary[$objectName]['fields'][$field])) {
         $vardef = $dictionary[$objectName]['fields'][$field];
         // Don't use strict for numerical types
         if (!empty($vardef['type']) && in_array($vardef['type'], array('currency', 'double', 'int'))) {
             $useStrict = false;
         }
         // Use to_display_date for Date fields
         if (!empty($vardef['type']) && in_array($vardef['type'], array('date'))) {
             $dateTimeFunction = 'to_display_date';
         }
         // Use to_display_date_time for DateTime fields
         if (!empty($vardef['type']) && in_array($vardef['type'], array('datetime', 'datetimecombo'))) {
             $dateTimeFunction = 'to_display_date_time';
         }
     }
     $sep = $is_equal ? '==' : '!=';
     if ($useStrict) {
         $sep .= '=';
     }
     $equalityCheck = "\$focus->fetched_row['" . $field . "'] " . $sep . " \$focus->" . $field;
     if (!empty($dateTimeFunction)) {
         $equalityCheck = "\$GLOBALS['timedate']->{$dateTimeFunction}(\$focus->fetched_row['" . $field . "'])" . " {$sep} " . "\$GLOBALS['timedate']->{$dateTimeFunction}(\$focus->" . $field . ")";
     }
     // Due to sidecar pushing unchanged fields, we need a check when that happens
     if (!$is_equal) {
         $equalityCheck .= " && !(\$focus->fetched_row['" . $field . "'] === null && strlen(\$focus->" . $field . ") === 0)";
     }
     return " (isset(\$focus->" . $field . ") && " . "(empty(\$focus->fetched_row) || array_key_exists('" . $field . "', \$focus->fetched_row)) " . "&& {$equalityCheck}) ";
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:48,代码来源:glue.php

示例5: saveToVardef

 /**
  * Updates the cached vardefs with the custom field information stored in result
  *
  * @param string $module
  * @param array $result
  * @param boolean saveCache Boolean value indicating whether or not to call VardefManager::saveCache, defaults to true
  */
 function saveToVardef($module, $result, $saveCache = true)
 {
     global $beanList;
     if (!empty($beanList[$module])) {
         $object = BeanFactory::getObjectName($module);
         if (empty($GLOBALS['dictionary'][$object]['fields'])) {
             //if the vardef isn't loaded let's try loading it.
             VardefManager::refreshVardefs($module, $object, null, false);
             //if it's still not loaded we really don't have anything useful to cache
             if (empty($GLOBALS['dictionary'][$object]['fields'])) {
                 return;
             }
         }
         if (!isset($GLOBALS['dictionary'][$object]['custom_fields'])) {
             $GLOBALS['dictionary'][$object]['custom_fields'] = false;
         }
         if (!empty($GLOBALS['dictionary'][$object])) {
             if (!empty($result)) {
                 // First loop to add
                 foreach ($result as $field) {
                     foreach ($field as $k => $v) {
                         //allows values for custom fields to be defined outside of the scope of studio
                         if (!isset($GLOBALS['dictionary'][$object]['fields'][$field['name']][$k])) {
                             $GLOBALS['dictionary'][$object]['fields'][$field['name']][$k] = $v;
                         }
                     }
                 }
                 // Second loop to remove
                 foreach ($GLOBALS['dictionary'][$object]['fields'] as $name => $fieldDef) {
                     if (isset($fieldDef['custom_module'])) {
                         if (!isset($result[$name])) {
                             unset($GLOBALS['dictionary'][$object]['fields'][$name]);
                         } else {
                             $GLOBALS['dictionary'][$object]['custom_fields'] = true;
                         }
                     }
                 }
                 //if
             }
         }
         $manager = new VardefManager();
         if ($saveCache) {
             $manager->saveCache($this->module, $object);
         }
         // Everything works off of vardefs, so let's have it save the users vardefs
         // to the employees module, because they both use the same table behind
         // the scenes
         if ($module == 'Users') {
             $manager->loadVardef('Employees', 'Employee', true);
             return;
         }
     }
 }
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:60,代码来源:DynamicField.php

示例6: buildRelationshipCache

 protected function buildRelationshipCache()
 {
     global $beanList, $dictionary, $buildingRelCache;
     if ($buildingRelCache) {
         return;
     }
     $buildingRelCache = true;
     include_once "modules/TableDictionary.php";
     if (empty($beanList)) {
         include "include/modules.php";
     }
     //Reload ALL the module vardefs....
     foreach ($beanList as $moduleName => $beanName) {
         VardefManager::loadVardef($moduleName, BeanFactory::getObjectName($moduleName));
     }
     $relationships = array();
     //Grab all the relationships from the dictionary.
     foreach ($dictionary as $key => $def) {
         if (!empty($def['relationships'])) {
             foreach ($def['relationships'] as $relKey => $relDef) {
                 if ($key == $relKey) {
                     //Relationship only entry, we need to capture everything
                     $relationships[$key] = array_merge(array('name' => $key), $def, $relDef);
                 } else {
                     $relationships[$relKey] = array_merge(array('name' => $relKey), $relDef);
                     if (!empty($relationships[$relKey]['join_table']) && empty($relationships[$relKey]['fields']) && isset($dictionary[$relationships[$relKey]['join_table']]['fields'])) {
                         $relationships[$relKey]['fields'] = $dictionary[$relationships[$relKey]['join_table']]['fields'];
                     }
                 }
             }
         }
     }
     //Save it out
     sugar_mkdir(dirname($this->getCacheFile()), null, true);
     $out = "<?php \n \$relationships=" . var_export($relationships, true) . ";";
     sugar_file_put_contents($this->getCacheFile(), $out);
     $this->relationships = $relationships;
     $buildingRelCache = false;
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:39,代码来源:RelationshipFactory.php

示例7: getVarDef

 /**
  * Gets vardef info for a given module.
  *
  * @param string $moduleName The name of the module to collect vardef information about.
  * @return array The vardef's $dictonary array.
  */
 public function getVarDef($moduleName)
 {
     require_once 'data/BeanFactory.php';
     $obj = BeanFactory::getObjectName($moduleName);
     if ($obj) {
         require_once 'include/SugarObjects/VardefManager.php';
         global $dictionary;
         VardefManager::loadVardef($moduleName, $obj);
         if (isset($dictionary[$obj])) {
             $data = $dictionary[$obj];
         }
         // vardefs are missing something, for consistency let's populate some arrays
         if (!isset($data['fields'])) {
             $data['fields'] = array();
         }
         if (!isset($data['relationships'])) {
             $data['relationships'] = array();
         }
         if (!isset($data['fields'])) {
             $data['fields'] = array();
         }
     }
     // Bug 56505 - multiselect fields default value wrapped in '^' character
     if (!empty($data['fields'])) {
         $data['fields'] = $this->getMetaDataHacks()->normalizeFieldDefs($data);
     }
     if (!isset($data['relationships'])) {
         $data['relationships'] = array();
     }
     return $data;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:37,代码来源:MetaDataManager.php

示例8: display

 function display()
 {
     $editModule = $_REQUEST['view_module'];
     if (!isset($_REQUEST['MB'])) {
         global $app_list_strings;
         $moduleNames = array_change_key_case($app_list_strings['moduleList']);
         $translatedEditModule = $moduleNames[strtolower($editModule)];
     }
     $selected_lang = !empty($_REQUEST['selected_lang']) ? $_REQUEST['selected_lang'] : $_SESSION['authenticated_user_language'];
     if (empty($selected_lang)) {
         $selected_lang = $GLOBALS['sugar_config']['default_language'];
     }
     $smarty = new Sugar_Smarty();
     global $mod_strings;
     $smarty->assign('mod_strings', $mod_strings);
     $smarty->assign('available_languages', get_languages());
     global $beanList;
     $objectName = $beanList[$editModule];
     if ($objectName == 'aCase') {
         $objectName = 'Case';
     }
     VardefManager::loadVardef($editModule, $objectName);
     global $dictionary;
     $vnames = array();
     //jchi 24557 . We should list all the lables in viewdefs(list,detail,edit,quickcreate) that the user can edit them.
     require_once 'modules/ModuleBuilder/parsers/views/ListLayoutMetaDataParser.php';
     $parser = new ListLayoutMetaDataParser(MB_LISTVIEW, $editModule);
     foreach ($parser->getLayout() as $key => $def) {
         if (isset($def['label'])) {
             $vnames[$def['label']] = $def['label'];
         }
     }
     require_once 'modules/ModuleBuilder/parsers/views/GridLayoutMetaDataParser.php';
     $variableMap = array(MB_EDITVIEW => 'EditView', MB_DETAILVIEW => 'DetailView', MB_QUICKCREATE => 'QuickCreate');
     if ($editModule == 'KBDocuments') {
         $variableMap = array();
     }
     foreach ($variableMap as $key => $value) {
         $gridLayoutMetaDataParserTemp = new GridLayoutMetaDataParser($value, $editModule);
         foreach ($gridLayoutMetaDataParserTemp->getLayout() as $panel) {
             foreach ($panel as $row) {
                 foreach ($row as $fieldArray) {
                     // fieldArray is an array('name'=>name,'label'=>label)
                     if (isset($fieldArray['label'])) {
                         $vnames[$fieldArray['label']] = $fieldArray['label'];
                     }
                 }
             }
         }
     }
     //end
     //Get Subpanel Labels:
     require_once 'include/SubPanel/SubPanel.php';
     $subList = SubPanel::getModuleSubpanels($editModule);
     foreach ($subList as $subpanel => $titleLabel) {
         $vnames[$titleLabel] = $titleLabel;
     }
     foreach ($dictionary[$objectName]['fields'] as $name => $def) {
         if (isset($def['vname'])) {
             $vnames[$def['vname']] = $def['vname'];
         }
     }
     $formatted_mod_strings = array();
     //we shouldn't set the $refresh=true here, or will lost template language mod_strings.
     //return_module_language($selected_lang, $editModule,false) : the mod_strings will be included from cache files here.
     foreach (return_module_language($selected_lang, $editModule, false) as $name => $label) {
         //#25294
         if (isset($vnames[$name]) || preg_match('/lbl_city|lbl_country|lbl_billing_address|lbl_alt_address|lbl_shipping_address|lbl_postal_code|lbl_state$/si', $name)) {
             $formatted_mod_strings[$name] = htmlentities($label, ENT_QUOTES, 'UTF-8');
         }
     }
     //Grab everything from the custom files
     $mod_bak = $mod_strings;
     $files = array("custom/modules/{$editModule}/language/{$selected_lang}.lang.php", "custom/modules/{$editModule}/Ext/Language/{$selected_lang}.lang.ext.php");
     foreach ($files as $langfile) {
         $mod_strings = array();
         if (is_file($langfile)) {
             include $langfile;
             foreach ($mod_strings as $key => $label) {
                 $formatted_mod_strings[$key] = htmlentities($label, ENT_QUOTES, 'UTF-8');
             }
         }
     }
     $mod_strings = $mod_bak;
     ksort($formatted_mod_strings);
     $smarty->assign('MOD', $formatted_mod_strings);
     $smarty->assign('view_module', $editModule);
     $smarty->assign('APP', $GLOBALS['app_strings']);
     $smarty->assign('selected_lang', $selected_lang);
     $smarty->assign('defaultHelp', 'labelsBtn');
     $smarty->assign('assistant', array('key' => 'labels', 'group' => 'module'));
     $ajax = new AjaxCompose();
     $ajax->addCrumb($mod_strings['LBL_STUDIO'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard")');
     $ajax->addCrumb($translatedEditModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $editModule . '")');
     $ajax->addCrumb($mod_strings['LBL_LABELS'], '');
     $html = $smarty->fetch('modules/ModuleBuilder/tpls/labels.tpl');
     $ajax->addSection('center', $GLOBALS['mod_strings']['LBL_SECTION_EDLABELS'], $html);
     echo $ajax->getJavascript();
 }
开发者ID:aldridged,项目名称:gtg-sugar,代码行数:99,代码来源:view.labels.php

示例9: mergeFields

 /**
  * Merges the fields together and stores them in $this->mergedFields
  *
  */
 protected function mergeFields()
 {
     if ($this->sugarMerge instanceof SugarMerge && is_file($this->sugarMerge->getNewPath() . 'modules/ModuleBuilder/parsers/views/ListLayoutMetaDataParser.php')) {
         require_once $this->sugarMerge->getNewPath() . 'modules/ModuleBuilder/parsers/views/ListLayoutMetaDataParser.php';
     } else {
         require_once 'modules/ModuleBuilder/parsers/views/ListLayoutMetaDataParser.php';
     }
     $objectName = BeanFactory::getBeanName($this->module);
     VardefManager::loadVardef($this->module, $objectName);
     foreach ($this->customFields as $field => $data) {
         $fieldName = strtolower($data['loc']['row']);
         if (!empty($GLOBALS['dictionary'][$objectName]['fields'][$fieldName])) {
             $data['data'] = array_merge(ListLayoutMetaDataParser::createViewDefsByFieldDefs($GLOBALS['dictionary'][$objectName]['fields'][$fieldName]), $data['data']);
         }
         //if we have this field in both the new fields and the original fields - it has existed since the last install/upgrade
         if (isset($this->newFields[$field]) && isset($this->originalFields[$field])) {
             //if both the custom field and the original match then we take the location of the custom field since it hasn't moved
             $loc = $this->customFields[$field]['loc'];
             $loc['source'] = 'custom';
             //echo var_export($loc, true);
             //but we still merge the meta data of the three
             $this->mergedFields[$field] = array('data' => $this->mergeField($this->originalFields[$field]['data'], $this->newFields[$field]['data'], $this->customFields[$field]['data']), 'loc' => $loc);
             //if it's not set in the new fields then it was a custom field or an original field so we take the custom fields data and set the location source to custom
         } else {
             if (!isset($this->newFields[$field])) {
                 $this->mergedFields[$field] = $data;
                 $this->mergedFields[$field]['loc']['source'] = 'custom';
             } else {
                 //otherwise  the field is in both new and custom but not in the orignal so we merge the new and custom data together and take the location from the custom
                 $this->mergedFields[$field] = array('data' => $this->mergeField('', $this->newFields[$field]['data'], $this->customFields[$field]['data']), 'loc' => $this->customFields[$field]['loc']);
                 $this->mergedFields[$field]['loc']['source'] = 'custom';
                 //echo var_export($this->mergedFields[$field], true);
             }
         }
         //then we clear out the field from
         unset($this->originalFields[$field]);
         unset($this->customFields[$field]);
         unset($this->newFields[$field]);
     }
     /**
      * These are fields that were removed by the customer
      */
     foreach ($this->originalFields as $field => $data) {
         unset($this->originalFields[$field]);
         unset($this->newFields[$field]);
     }
     foreach ($this->newFields as $field => $data) {
         $data['loc']['source'] = 'new';
         $this->mergedFields[$field] = array('data' => $data['data'], 'loc' => $data['loc']);
         unset($this->newFields[$field]);
     }
 }
开发者ID:MexinaD,项目名称:SuiteCRM,代码行数:56,代码来源:ListViewMerge.php

示例10: upgradeTeamColumn

/**
 * upgradeTeamColumn
 * Helper function to create a team_set_id column and also set team_set_id column
 * to have the value of the $column_name parameter
 * 
 * @param $bean SugarBean which we are adding team_set_id column to
 * @param $column_name The name of the column containing the default team_set_id value
 */
function upgradeTeamColumn($bean, $column_name)
{
    //first let's check to ensure that the team_set_id field is defined, if not it could be the case that this is an older
    //module that does not use the SugarObjects
    if (empty($bean->field_defs['team_set_id']) && $bean->module_dir != 'Trackers') {
        //at this point we could assume that since we have a team_id defined and not a team_set_id that we need to
        //add that field and the corresponding relationships
        $object = $bean->object_name;
        $module = $bean->module_dir;
        $object_name = $object;
        $_object_name = strtolower($object_name);
        if (!empty($GLOBALS['dictionary'][$object]['table'])) {
            $table_name = $GLOBALS['dictionary'][$object]['table'];
        } else {
            $table_name = strtolower($module);
        }
        $path = 'include/SugarObjects/implements/team_security/vardefs.php';
        require $path;
        //go through each entry in the vardefs from team_security and unset anything that is already set in the core module
        //this will ensure we have the proper ordering.
        $fieldDiff = array_diff_assoc($vardefs['fields'], $GLOBALS['dictionary'][$bean->object_name]['fields']);
        $file = 'custom/Extension/modules/' . $bean->module_dir . '/Ext/Vardefs/teams.php';
        $contents = "<?php\n";
        if (!empty($fieldDiff)) {
            foreach ($fieldDiff as $key => $val) {
                $contents .= "\n\$GLOBALS['dictionary']['" . $object . "']['fields']['" . $key . "']=" . var_export_helper($val) . ";";
            }
        }
        $relationshipDiff = array_diff_assoc($vardefs['relationships'], $GLOBALS['dictionary'][$bean->object_name]['relationships']);
        if (!empty($relationshipDiff)) {
            foreach ($relationshipDiff as $key => $val) {
                $contents .= "\n\$GLOBALS['dictionary']['" . $object . "']['relationships']['" . $key . "']=" . var_export_helper($val) . ";";
            }
        }
        $indexDiff = array_diff_assoc($vardefs['indices'], $GLOBALS['dictionary'][$bean->object_name]['indices']);
        if (!empty($indexDiff)) {
            foreach ($indexDiff as $key => $val) {
                $contents .= "\n\$GLOBALS['dictionary']['" . $object . "']['indices']['" . $key . "']=" . var_export_helper($val) . ";";
            }
        }
        if ($fh = @sugar_fopen($file, 'wt')) {
            fputs($fh, $contents);
            fclose($fh);
        }
        //we have written out the teams.php into custom/Extension/modules/{$module_dir}/Ext/Vardefs/teams.php'
        //now let's merge back into vardefs.ext.php
        require_once 'ModuleInstall/ModuleInstaller.php';
        $mi = new ModuleInstaller();
        $mi->merge_files('Ext/Vardefs/', 'vardefs.ext.php');
        VardefManager::loadVardef($bean->module_dir, $bean->object_name, true);
        $bean->field_defs = $GLOBALS['dictionary'][$bean->object_name]['fields'];
    }
    if (isset($bean->field_defs['team_set_id'])) {
        //Create the team_set_id column
        $FieldArray = $GLOBALS['db']->helper->get_columns($bean->table_name);
        if (!isset($FieldArray['team_set_id'])) {
            $GLOBALS['db']->addColumn($bean->table_name, $bean->field_defs['team_set_id']);
        }
        $indexArray = $GLOBALS['db']->helper->get_indices($bean->table_name);
        $indexDef = array(array('name' => 'idx_' . strtolower($bean->table_name) . '_tmst_id', 'type' => 'index', 'fields' => array('team_set_id')));
        if (!isset($indexArray['idx_' . strtolower($bean->table_name) . '_tmst_id'])) {
            $GLOBALS['db']->addIndexes($bean->table_name, $indexDef);
        }
        //Update the table's team_set_id column to have the same values as team_id
        $GLOBALS['db']->query("UPDATE {$bean->table_name} SET team_set_id = {$column_name}");
    }
}
开发者ID:Terradex,项目名称:sugar,代码行数:75,代码来源:uw_utils.php

示例11: repairSearchFields

/**
 * repairSearchFields
 *
 * This method goes through the list of SearchFields files based and calls TemplateRange::repairCustomSearchFields
 * method on the files in an attempt to ensure the range search attributes are properly set in SearchFields.php.
 *
 * @param $globString String value used for glob search defaults to searching for all SearchFields.php files in modules directory
 * @param $path String value used to point to log file should logging be required.  Defaults to empty.
 *
 */
function repairSearchFields($globString = 'modules/*/metadata/SearchFields.php', $path = '')
{
    if (!empty($path)) {
        logThis('Begin repairSearchFields', $path);
    }
    require_once 'include/dir_inc.php';
    require_once 'modules/DynamicFields/templates/Fields/TemplateRange.php';
    require 'include/modules.php';
    global $beanList;
    $searchFieldsFiles = glob($globString);
    foreach ($searchFieldsFiles as $file) {
        if (preg_match('/modules\\/(.*?)\\/metadata\\/SearchFields\\.php/', $file, $matches) && isset($beanList[$matches[1]])) {
            $module = $matches[1];
            $beanName = $beanList[$module];
            VardefManager::loadVardef($module, $beanName);
            if (isset($GLOBALS['dictionary'][$beanName]['fields'])) {
                if (!empty($path)) {
                    logThis('Calling TemplateRange::repairCustomSearchFields for module ' . $module, $path);
                }
                TemplateRange::repairCustomSearchFields($GLOBALS['dictionary'][$beanName]['fields'], $module);
            }
        }
    }
    if (!empty($path)) {
        logThis('End repairSearchFields', $path);
    }
}
开发者ID:omusico,项目名称:sugar_work,代码行数:37,代码来源:uw_utils.php

示例12: display

 function display()
 {
     global $locale;
     $editModule = $_REQUEST['view_module'];
     $allLabels = !empty($_REQUEST['labels']) && $_REQUEST['labels'] == 'all';
     if (!isset($_REQUEST['MB'])) {
         global $app_list_strings;
         $moduleNames = array_change_key_case($app_list_strings['moduleList']);
         $translatedEditModule = $moduleNames[strtolower($editModule)];
     }
     $selected_lang = null;
     if (!empty($_REQUEST['selected_lang'])) {
         $selected_lang = $_REQUEST['selected_lang'];
     } else {
         $selected_lang = $locale->getAuthenticatedUserLanguage();
     }
     $smarty = new Sugar_Smarty();
     global $mod_strings;
     $smarty->assign('mod_strings', $mod_strings);
     $smarty->assign('available_languages', get_languages());
     $objectName = BeanFactory::getObjectName($editModule);
     VardefManager::loadVardef($editModule, $objectName);
     global $dictionary;
     $vnames = array();
     //jchi 24557 . We should list all the lables in viewdefs(list,detail,edit,quickcreate) that the user can edit them.
     $parser = ParserFactory::getParser(MB_LISTVIEW, $editModule);
     foreach ($parser->getLayout() as $key => $def) {
         if (isset($def['label'])) {
             $vnames[$def['label']] = $def['label'];
         }
     }
     require_once 'modules/ModuleBuilder/parsers/views/GridLayoutMetaDataParser.php';
     $variableMap = $this->getVariableMap($editModule);
     foreach ($variableMap as $key => $value) {
         $gridLayoutMetaDataParserTemp = ParserFactory::getParser($key, $editModule);
         foreach ($gridLayoutMetaDataParserTemp->getLayout() as $panel) {
             foreach ($panel as $row) {
                 foreach ($row as $fieldArray) {
                     // fieldArray is an array('name'=>name,'label'=>label)
                     if (isset($fieldArray['label'])) {
                         $vnames[$fieldArray['label']] = $fieldArray['label'];
                     }
                 }
             }
         }
     }
     //end
     //Get Subpanel Labels:
     require_once 'include/SubPanel/SubPanel.php';
     $subList = SubPanel::getModuleSubpanels($editModule);
     foreach ($subList as $subpanel => $titleLabel) {
         $vnames[$titleLabel] = $titleLabel;
     }
     foreach ($dictionary[$objectName]['fields'] as $name => $def) {
         if (isset($def['vname'])) {
             $vnames[$def['vname']] = $def['vname'];
         }
     }
     $formatted_mod_strings = array();
     // we shouldn't set the $refresh=true here, or will lost template language
     // mod_strings.
     // return_module_language($selected_lang, $editModule,false) :
     // the mod_strings will be included from cache files here.
     foreach (return_module_language($selected_lang, $editModule, false) as $name => $label) {
         //#25294
         if ($allLabels || isset($vnames[$name]) || preg_match('/lbl_city|lbl_country|lbl_billing_address|lbl_alt_address|lbl_shipping_address|lbl_postal_code|lbl_state$/si', $name)) {
             // Bug 58174 - Escaped labels are sent to the client escaped
             // even in the label editor in studio
             $formatted_mod_strings[$name] = html_entity_decode($label, null, 'UTF-8');
         }
     }
     //Grab everything from the custom files
     $mod_bak = $mod_strings;
     $files = array("custom/modules/{$editModule}/language/{$selected_lang}.lang.php", "custom/modules/{$editModule}/Ext/Language/{$selected_lang}.lang.ext.php");
     foreach ($files as $langfile) {
         $mod_strings = array();
         if (is_file($langfile)) {
             include $langfile;
             foreach ($mod_strings as $key => $label) {
                 // Bug 58174 - Escaped labels are sent to the client escaped
                 // even in the label editor in studio
                 $formatted_mod_strings[$key] = html_entity_decode($label, null, 'UTF-8');
             }
         }
     }
     $mod_strings = $mod_bak;
     ksort($formatted_mod_strings);
     $smarty->assign('MOD', $formatted_mod_strings);
     $smarty->assign('view_module', $editModule);
     $smarty->assign('APP', $GLOBALS['app_strings']);
     $smarty->assign('selected_lang', $selected_lang);
     $smarty->assign('defaultHelp', 'labelsBtn');
     $smarty->assign('assistant', array('key' => 'labels', 'group' => 'module'));
     $smarty->assign('labels_choice', $mod_strings['labelTypes']);
     $smarty->assign('labels_current', $allLabels ? "all" : "");
     $ajax = new AjaxCompose();
     $ajax->addCrumb($mod_strings['LBL_STUDIO'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard")');
     $ajax->addCrumb($translatedEditModule, 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $editModule . '")');
     $ajax->addCrumb($mod_strings['LBL_LABELS'], '');
     $html = $smarty->fetch('modules/ModuleBuilder/tpls/labels.tpl');
//.........这里部分代码省略.........
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:101,代码来源:view.labels.php

示例13: display

 function display()
 {
     $smarty = new Sugar_Smarty();
     global $mod_strings;
     $bak_mod_strings = $mod_strings;
     $smarty->assign('mod_strings', $mod_strings);
     $module_name = $_REQUEST['view_module'];
     global $current_language;
     $module_strings = return_module_language($current_language, $module_name);
     $fieldsData = array();
     $customFieldsData = array();
     //use fieldTypes variable to map field type to displayed field type
     $fieldTypes = $mod_strings['fieldTypes'];
     //add datetimecombo type field from the vardef overrides to point to Datetime type
     $fieldTypes['datetime'] = $fieldTypes['datetimecombo'];
     if (!isset($_REQUEST['view_package']) || $_REQUEST['view_package'] == 'studio') {
         //$this->loadPackageHelp($module_name);
         $studioClass = new stdClass();
         $studioClass->name = $module_name;
         $objectName = BeanFactory::getObjectName($module_name);
         VardefManager::loadVardef($module_name, $objectName, true);
         global $dictionary;
         $f = array($mod_strings['LBL_HCUSTOM'] => array(), $mod_strings['LBL_HDEFAULT'] => array());
         foreach ($dictionary[$objectName]['fields'] as $def) {
             if (!$this->isValidStudioField($def)) {
                 continue;
             }
             if (!empty($def['vname'])) {
                 $def['label'] = translate($def['vname'], $module_name);
             } elseif (!empty($def['label'])) {
                 $def['label'] = translate($def['label'], $module_name);
             } else {
                 $def['label'] = $def['name'];
             }
             //Custom relate fields will have a non-db source, but custom_module set
             if (isset($def['source']) && $def['source'] == 'custom_fields' || isset($def['custom_module'])) {
                 $f[$mod_strings['LBL_HCUSTOM']][$def['name']] = $def;
                 $def['custom'] = true;
             } else {
                 $f[$mod_strings['LBL_HDEFAULT']][$def['name']] = $def;
                 $def['custom'] = false;
             }
             $def['type'] = isset($fieldTypes[$def['type']]) ? $fieldTypes[$def['type']] : ucfirst($def['type']);
             $fieldsData[] = $def;
             $customFieldsData[$def['name']] = $def['custom'];
         }
         $studioClass->mbvardefs->vardefs['fields'] = $f;
         $smarty->assign('module', $studioClass);
         $package = new stdClass();
         $package->name = '';
         $smarty->assign('package', $package);
         global $current_user;
         $sortPreferences = $current_user->getPreference('fieldsTableColumn', 'ModuleBuilder');
         $smarty->assign('sortPreferences', $sortPreferences);
         $smarty->assign('fieldsData', getJSONobj()->encode($fieldsData));
         $smarty->assign('customFieldsData', getJSONobj()->encode($customFieldsData));
         $smarty->assign('studio', true);
         $ajax = new AjaxCompose();
         $ajax->addCrumb($mod_strings['LBL_STUDIO'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard")');
         $ajax->addCrumb(translate($module_name), 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard&view_module=' . $module_name . '")');
         $ajax->addCrumb($mod_strings['LBL_FIELDS'], '');
         $ajax->addSection('center', $mod_strings['LBL_EDIT_FIELDS'], $smarty->fetch('modules/ModuleBuilder/tpls/MBModule/fields.tpl'));
         $_REQUEST['field'] = '';
         echo $ajax->getJavascript();
     } else {
         require_once 'modules/ModuleBuilder/MB/ModuleBuilder.php';
         $mb = new ModuleBuilder();
         $mb->getPackage($_REQUEST['view_package']);
         $package = $mb->packages[$_REQUEST['view_package']];
         $package->getModule($module_name);
         $this->mbModule = $package->modules[$module_name];
         // We need the type to determine true custom fields
         $moduleType = $this->mbModule->getModuleType();
         $this->loadPackageHelp($module_name);
         $this->mbModule->getVardefs(true);
         $this->mbModule->mbvardefs->vardefs['fields'] = array_reverse($this->mbModule->mbvardefs->vardefs['fields'], true);
         $loadedFields = array();
         if (file_exists($this->mbModule->path . '/language/' . $current_language . '.lang.php')) {
             include $this->mbModule->path . '/language/' . $current_language . '.lang.php';
             $this->mbModule->setModStrings($current_language, $mod_strings);
         } elseif (file_exists($this->mbModule->path . '/language/en_us.lang.php')) {
             include $this->mbModule->path . '/language/en_us.lang.php';
             $this->mbModule->setModStrings('en_us', $mod_strings);
         }
         foreach ($this->mbModule->mbvardefs->vardefs['fields'] as $k => $v) {
             if ($k != $this->mbModule->name) {
                 foreach ($v as $field => $def) {
                     if (in_array($field, array_keys($this->mbModule->mbvardefs->vardefs['fields'][$this->mbModule->name]))) {
                         $this->mbModule->mbvardefs->vardefs['fields'][$k][$field] = $this->mbModule->mbvardefs->vardefs['fields'][$this->mbModule->name][$field];
                         unset($this->mbModule->mbvardefs->vardefs['fields'][$this->mbModule->name][$field]);
                     }
                 }
             }
         }
         foreach ($this->mbModule->mbvardefs->vardefs['fields'] as $k => $v) {
             if ($k != $module_name) {
                 $titleLBL[$k] = translate("LBL_" . strtoupper($k), 'ModuleBuilder');
             } else {
                 $titleLBL[$k] = $k;
             }
//.........这里部分代码省略.........
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:101,代码来源:view.modulefields.php

示例14: setUp_dictionary

 /**
  * Registration of $dictionary in global scope
  *
  * @static
  * @return bool is variable setuped or not
  */
 protected static function setUp_dictionary()
 {
     self::setUp('beanFiles');
     self::setUp('beanList');
     self::$registeredVars['dictionary'] = true;
     global $dictionary;
     $dictionary = array();
     $moduleInstaller = new ModuleInstaller();
     $moduleInstaller->silent = true;
     $moduleInstaller->rebuild_tabledictionary();
     require 'modules/TableDictionary.php';
     foreach ($GLOBALS['beanList'] as $k => $v) {
         VardefManager::loadVardef($k, $v);
     }
     return true;
 }
开发者ID:sunmo,项目名称:snowlotus,代码行数:22,代码来源:SugarTestHelper.php

示例15: findFieldAttributes

 static function findFieldAttributes($attributes = array(), $modules = null, $byModule = false, $byType = false)
 {
     $fields = array();
     if (empty($modules)) {
         $modules = VardefBrowser::getModules();
     }
     foreach ($modules as $module) {
         if (!empty($GLOBALS['beanList'][$module])) {
             $object = $GLOBALS['beanList'][$module];
             if ($object == 'aCase') {
                 $object = 'Case';
             }
             VardefManager::loadVardef($module, $object);
             if (empty($GLOBALS['dictionary'][$object]['fields'])) {
                 continue;
             }
             foreach ($GLOBALS['dictionary'][$object]['fields'] as $name => $def) {
                 $fieldAttributes = !empty($attributes) ? $attributes : array_keys($def);
                 foreach ($fieldAttributes as $k) {
                     if (isset($def[$k])) {
                         $v = var_export($def[$k], true);
                         $key = is_array($def[$k]) ? null : $def[$k];
                         if ($k == 'type') {
                             if (isset($def['dbType'])) {
                                 $v = var_export($def['dbType'], true);
                             }
                         }
                         if ($byModule) {
                             $fields[$module][$object][$def['type']][$k][$key] = $v;
                         } else {
                             if ($byType) {
                                 $fields[$def['type']][$k][$key] = $v;
                             } else {
                                 if (!is_array($def[$k])) {
                                     if (isset($fields[$k][$key])) {
                                         $fields[$k][$key]['refs']++;
                                     } else {
                                         $fields[$k][$key] = array('attribute' => $v, 'refs' => 1);
                                     }
                                 } else {
                                     $fields[$k]['_array'][] = $def[$k];
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $fields;
 }
开发者ID:thsonvt,项目名称:sugarcrm_dev,代码行数:51,代码来源:view.metadata.php


注:本文中的VardefManager::loadVardef方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。