• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_widget函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_widget函数的典型用法代码示例。如果您正苦于以下问题:PHP get_widget函数的具体用法?PHP get_widget怎么用?PHP get_widget使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: setUp

 public function setUp()
 {
     SugarTestHelper::setUp('beanList');
     SugarTestHelper::setUp('beanFiles');
     SugarTestHelper::setUp('app_strings');
     SugarTestHelper::setUp('app_list_strings');
     SugarTestHelper::setUp('mod_strings', array('ModuleBuilder'));
     SugarTestHelper::setUp('current_user', array(true, 1));
     $_POST = $_REQUEST = $this->getPostData();
     $this->accountFieldWidget = get_widget($_REQUEST['type']);
     $this->accountFieldWidget->populateFromPost();
     $module = $_REQUEST['view_module'];
     $this->accountField = new DynamicField($module);
     $class_name = $GLOBALS['beanList'][$module];
     require_once $GLOBALS['beanFiles'][$class_name];
     $mod = new $class_name();
     $this->accountField->setup($mod);
     $this->accountFieldWidget->save($this->accountField);
     $_POST['view_module'] = $_REQUEST['view_module'] = 'Opportunities';
     $this->opportunityFieldWidget = get_widget($_REQUEST['type']);
     $this->opportunityFieldWidget->populateFromPost();
     $module = $_REQUEST['view_module'];
     $this->opportunityField = new DynamicField($module);
     $class_name = $GLOBALS['beanList'][$module];
     require_once $GLOBALS['beanFiles'][$class_name];
     $mod = new $class_name();
     $this->opportunityField->setup($mod);
     $this->opportunityFieldWidget->save($this->opportunityField);
     $repair = new RepairAndClear();
     $repair->repairAndClearAll(array('rebuildExtensions', 'clearVardefs'), array($GLOBALS['beanList']['Accounts'], $GLOBALS['beanList']['Opportunities']), true, false);
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:31,代码来源:Bug56423Test.php


示例2: addFieldObject

 /**
  * Adds a custom field using a field object
  *
  * @param Field Object $field
  * @return boolean
  */
 function addFieldObject(&$field)
 {
     global $dictionary, $beanList;
     if (empty($beanList[$this->module])) {
         return false;
     }
     $bean_name = get_valid_bean_name($this->module);
     if (empty($dictionary[$bean_name]) || empty($dictionary[$bean_name]["fields"][$field->name])) {
         return false;
     }
     $currdef = $dictionary[$bean_name]["fields"][$field->name];
     $this->loadCustomDef($field->name);
     $newDef = $field->get_field_def();
     require_once 'modules/DynamicFields/FieldCases.php';
     $this->baseField = get_widget($field->type);
     foreach ($field->vardef_map as $property => $fmd_col) {
         if ($property == "action" || $property == "label_value" || $property == "label" || substr($property, 0, 3) == 'ext' && strlen($property) == 4) {
             continue;
         }
         // Bug 37043 - Avoid writing out vardef defintions that are the default value.
         if (isset($newDef[$property]) && (!isset($currdef[$property]) && !$this->isDefaultValue($property, $newDef[$property], $this->baseField) || isset($currdef[$property]) && $currdef[$property] != $newDef[$property])) {
             $this->custom_def[$property] = is_string($newDef[$property]) ? htmlspecialchars_decode($newDef[$property], ENT_QUOTES) : $newDef[$property];
         }
         if (isset($this->custom_def[$property]) && !isset($newDef[$property])) {
             unset($this->custom_def[$property]);
         }
     }
     if (isset($this->custom_def["duplicate_merge_dom_value"]) && !isset($this->custom_def["duplicate_merge"])) {
         unset($this->custom_def["duplicate_merge_dom_value"]);
     }
     $this->writeVardefExtension($bean_name, $field, $this->custom_def);
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:38,代码来源:StandardField.php


示例3: setUp

 /**
  * Creating new field, account, contact with filled custom field, relationship between them
  */
 public function setUp()
 {
     SugarTestHelper::setUp('beanList');
     SugarTestHelper::setUp('beanFiles');
     SugarTestHelper::setUp('current_user', array(true, true));
     $this->field = get_widget('varchar');
     $this->field->id = 'Contactstest_c';
     $this->field->name = 'test_c';
     $this->field->type = 'varchar';
     $this->field->len = 255;
     $this->field->importable = 'true';
     $this->field->label = '';
     $this->module = new Contact();
     $this->dynamicField = new DynamicField('Contacts');
     $this->dynamicField->setup($this->module);
     $this->dynamicField->addFieldObject($this->field);
     SugarTestHelper::setUp('dictionary');
     $GLOBALS['reload_vardefs'] = true;
     $this->account = SugarTestAccountUtilities::createAccount();
     $this->contact = SugarTestContactUtilities::createContact();
     $this->contact->account_id = $this->account->id;
     $this->contact->test_c = 'test value';
     $this->contact->load_relationship('accounts');
     $this->contact->accounts->add($this->account->id);
     $this->contact->save();
     $GLOBALS['db']->commit();
 }
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:30,代码来源:Bug58138Test.php


示例4: run

 public function run()
 {
     // this always needs to be ran
     // get the get_widget helper and the StandardField Helper
     require_once 'modules/DynamicFields/FieldCases.php';
     require_once 'modules/ModuleBuilder/parsers/StandardField.php';
     // we are working with opportunities
     $bean = BeanFactory::getBean('Opportunities');
     // get the field defs
     $field_defs = $bean->getFieldDefinition('sales_stage');
     // load the field type up
     $f = get_widget($field_defs['type']);
     // populate the row from the vardefs that were loaded
     $f->populateFromRow($field_defs);
     $this->log('Current Sales Stage Default is: ' . var_export($f->default, true));
     // lets always make sure that the default is in the list of options
     if (isset($f->options) && isset($GLOBALS['app_list_strings'][$f->options])) {
         if (!in_array($f->default, array_keys($GLOBALS['app_list_strings'][$f->options]))) {
             $this->log(var_export($f->default, true) . ' Is Not In The List Of Options');
             $f->default = array_shift(array_keys($GLOBALS['app_list_strings'][$f->options]));
             $f->default_value = array_shift(array_keys($GLOBALS['app_list_strings'][$f->options]));
             $this->log('New Sales Stage Default Is: ' . var_export($f->default, true));
             // save the changes to the field
             $df = new StandardField($bean->module_name);
             $df->setup($bean);
             $f->module = $bean;
             $f->save($df);
         }
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:30,代码来源:6_OpportunityFixSalesStageDefault.php


示例5: setUp

 public function setUp()
 {
     $this->field = get_widget('url');
     $this->field->id = $this->_modulename . 'foo_c';
     $this->field->name = 'foo_c';
     $this->field->vanme = 'LBL_Foo';
     $this->field->comments = NULL;
     $this->field->help = NULL;
     $this->field->custom_module = $this->_modulename;
     $this->field->type = 'url';
     $this->field->len = 255;
     $this->field->required = 0;
     $this->field->default_value = NULL;
     $this->field->date_modified = '2009-09-14 02:23:23';
     $this->field->deleted = 0;
     $this->field->audited = 0;
     $this->field->massupdate = 0;
     $this->field->duplicate_merge = 0;
     $this->field->reportable = 1;
     $this->field->importable = 'true';
     $this->field->ext1 = NULL;
     $this->field->ext2 = NULL;
     $this->field->ext3 = NULL;
     $this->field->ext4 = NULL;
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:25,代码来源:URLFieldTest.php


示例6: run

 public function run()
 {
     if (!$this->toFlavor('ent') && !$this->toFlavor('ult') || !version_compare($this->from_version, '7.0', '<')) {
         return;
     }
     $settings = Opportunity::getSettings();
     if ($settings['opps_view_by'] !== 'RevenueLineItems') {
         $this->log('Not using Revenue Line Items; Skipping Upgrade Script');
         return;
     }
     // get the get_widget helper and the StandardField Helper
     require_once 'modules/DynamicFields/FieldCases.php';
     require_once 'modules/ModuleBuilder/parsers/StandardField.php';
     // we are working with opportunities
     $module = 'Opportunities';
     $bean = BeanFactory::getBean('Opportunities');
     // the field set we need
     $fields = array('best_case', 'amount', 'worst_case', 'date_closed');
     // loop over each field
     foreach ($fields as $field) {
         // get the field defs
         $field_defs = $bean->getFieldDefinition($field);
         // load the field type up
         $f = get_widget($field_defs['type']);
         // populate the row from the vardefs that were loaded
         $f->populateFromRow($field_defs);
         // lets make sure that the calculated is true
         $f->calculated = true;
         // now lets save, since these are OOB field, we use StandardField
         $df = new StandardField($module);
         $df->setup($bean);
         $f->module = $bean;
         $f->save($df);
     }
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:35,代码来源:7_OpportunityFixCalculatedFields.php


示例7: fixRollupFormulas

 protected function fixRollupFormulas()
 {
     $oldFormula = 'rollupCurrencySum($revenuelineitems, "{{field}}")';
     $newFormula = 'rollupConditionalSum($revenuelineitems, "{{field}}", "sales_stage", forecastSalesStages(true, false))';
     // the field set we need
     $fields = array('best_case' => 'best_case', 'amount' => 'likely_case', 'worst_case' => 'worst_case');
     // get the get_widget helper and the StandardField Helper
     SugarAutoLoader::load('modules/DynamicFields/FieldCases.php');
     SugarAutoLoader::load('modules/ModuleBuilder/parsers/StandardField.php');
     // we are working with opportunities
     $bean = BeanFactory::getBean('Opportunities');
     // loop over each field
     foreach ($fields as $field => $rollup_field) {
         // get the field defs
         $field_defs = $bean->getFieldDefinition($field);
         // load the field type up
         $f = get_widget($field_defs['type']);
         // populate the row from the vardefs that were loaded
         $f->populateFromRow($field_defs);
         if ($f->formula == str_replace('{{field}}', $rollup_field, $oldFormula)) {
             $f->formula = str_replace('{{field}}', $rollup_field, $newFormula);
             // now lets save, since these are OOB field, we use StandardField
             $df = new StandardField($bean->module_name);
             $df->setup($bean);
             $f->module = $bean;
             $f->save($df);
         }
     }
     // lets fix up the data now to excluded closed lost
     $this->fixRollupAmountsToExcludeClosedLostValues();
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:31,代码来源:2_OpportunityWithRevenueLineItems.php


示例8: setUp

 public function setUp()
 {
     // Set Original Global dbType
     $this->_originaldbType = $GLOBALS['db']->dbType;
     $this->field = get_widget('currency');
     $this->field->id = $this->_modulename . 'foofighter_c';
     $this->field->name = 'foofighter_c';
     $this->field->vanme = 'LBL_Foo';
     $this->field->comments = NULL;
     $this->field->help = NULL;
     $this->field->custom_module = $this->_modulename;
     $this->field->type = 'currency';
     $this->field->len = 18;
     $this->field->precision = 6;
     $this->field->required = 0;
     $this->field->default_value = NULL;
     $this->field->date_modified = '2010-12-22 01:01:01';
     $this->field->deleted = 0;
     $this->field->audited = 0;
     $this->field->massupdate = 0;
     $this->field->duplicate_merge = 0;
     $this->field->reportable = 1;
     $this->field->importable = 'true';
     $this->field->ext1 = NULL;
     $this->field->ext2 = NULL;
     $this->field->ext3 = NULL;
     $this->field->ext4 = NULL;
 }
开发者ID:nickpro,项目名称:sugarcrm_dev,代码行数:28,代码来源:DynamicFieldsCurrencyTests.php


示例9: setUp

 public function setUp()
 {
     $this->markTestIncomplete("Skipping for now...");
     $this->field = get_widget('varchar');
     $this->field->id = $this->modulename . 'foo_c';
     $this->field->name = 'foo_c';
     $this->field->vanme = 'LBL_Foo';
     $this->field->comments = NULL;
     $this->field->help = NULL;
     $this->field->custom_module = $this->modulename;
     $this->field->type = 'varchar';
     $this->field->label = 'LBL_FOO';
     $this->field->len = 255;
     $this->field->required = 0;
     $this->field->default_value = NULL;
     $this->field->date_modified = '2009-09-14 02:23:23';
     $this->field->deleted = 0;
     $this->field->audited = 0;
     $this->field->massupdate = 0;
     $this->field->duplicate_merge = 0;
     $this->field->reportable = 1;
     $this->field->importable = 'true';
     $this->field->ext1 = NULL;
     $this->field->ext2 = NULL;
     $this->field->ext3 = NULL;
     $this->field->ext4 = NULL;
     $this->seed = new Account();
     $this->df = new DynamicField($this->modulename);
     $this->df->setup($this->seed);
     $this->field->save($this->df);
     $this->db = $GLOBALS['db'];
     $this->repairDictionary();
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:33,代码来源:RepairCustomFieldsTest.php


示例10: addFieldObject

 /**
  * Adds a custom field using a field object
  *
  * @param Field Object $field
  * @return boolean
  */
 function addFieldObject(&$field)
 {
     global $dictionary, $beanList;
     if (empty($beanList[$this->module])) {
         return false;
     }
     $bean_name = get_valid_bean_name($this->module);
     if (empty($dictionary[$bean_name]) || empty($dictionary[$bean_name]["fields"][$field->name])) {
         return false;
     }
     $currdef = $dictionary[$bean_name]["fields"][$field->name];
     // set $field->unified_search=true if field supports unified search
     // regarding #51427
     if ($field->supports_unified_search) {
         if (isset($dictionary[$bean_name]['unified_search_default_enabled']) && isset($dictionary[$bean_name]['unified_search']) && $dictionary[$bean_name]['unified_search_default_enabled'] && $dictionary[$bean_name]['unified_search']) {
             $currdef['unified_search'] = $field->unified_search = isset($currdef['unified_search']) ? $currdef['unified_search'] : true;
         }
     }
     // end #51427
     $this->loadCustomDef($field->name);
     $this->loadBaseDef($field->name);
     $newDef = $field->get_field_def();
     require_once 'modules/DynamicFields/FieldCases.php';
     $this->baseField = get_widget($field->type);
     foreach ($field->vardef_map as $property => $fmd_col) {
         if ($property == "action" || $property == "label_value" || $property == "label" || substr($property, 0, 3) == 'ext' && strlen($property) == 4) {
             continue;
         }
         // Bug 37043 - Avoid writing out vardef defintions that are the default value.
         if (isset($newDef[$property]) && (!isset($currdef[$property]) && !$this->isDefaultValue($property, $newDef[$property], $this->baseField) || isset($currdef[$property]) && $currdef[$property] !== $newDef[$property])) {
             $this->custom_def[$property] = is_string($newDef[$property]) ? htmlspecialchars_decode($newDef[$property], ENT_QUOTES) : $newDef[$property];
         }
         //Remove any orphaned entries
         if (isset($this->custom_def[$property]) && !isset($newDef[$property])) {
             unset($this->custom_def[$property]);
         }
         //Handle overrides of out of the box definitions with empty
         if (!empty($this->base_def[$property]) && !isset($newDef[$property])) {
             //Switch on type of the property to find what the correct 'empty' is.
             if (is_string($this->base_def[$property])) {
                 $this->custom_def[$property] = "";
             } else {
                 if (is_array($this->base_def[$property])) {
                     $this->custom_def[$property] = array();
                 } else {
                     if (is_bool($this->base_def[$property])) {
                         $this->custom_def[$property] = false;
                     } else {
                         $this->custom_def[$property] = null;
                     }
                 }
             }
         }
     }
     if (isset($this->custom_def["duplicate_merge_dom_value"]) && !isset($this->custom_def["duplicate_merge"])) {
         unset($this->custom_def["duplicate_merge_dom_value"]);
     }
     $this->writeVardefExtension($bean_name, $field, $this->custom_def);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:65,代码来源:StandardField.php


示例11: setUp

 public function setUp()
 {
     SugarTestHelper::setUp('current_user', array(true, 1));
     SugarTestHelper::setUp('beanFiles');
     SugarTestHelper::setUp('beanList');
     SugarTestHelper::setUp('app_list_strings');
     SugarTestHelper::setUp('app_strings');
     $_REQUEST = $this->keys;
     $_REQUEST['view_module'] = "Accounts";
     $_REQUEST['lhs_module'] = "Accounts";
     $_REQUEST['rhs_module'] = "Contacts";
     $_REQUEST['lhs_label'] = "Accounts";
     $_REQUEST['rhs_label'] = "Contacts";
     $relationAccountContact = new DeployedRelationships($_REQUEST['view_module']);
     $this->relationAccountContact = $relationAccountContact->addFromPost();
     $relationAccountContact->save();
     $relationAccountContact->build();
     $_REQUEST['view_module'] = "Contacts";
     $_REQUEST['lhs_module'] = "Contacts";
     $_REQUEST['rhs_module'] = "Accounts";
     $_REQUEST['lhs_label'] = "Contacts";
     $_REQUEST['rhs_label'] = "Accounts";
     $relationContactAccount = new DeployedRelationships($_REQUEST['view_module']);
     $this->relationContactAccount = $relationContactAccount->addFromPost();
     $relationContactAccount->save();
     $relationContactAccount->build();
     SugarTestHelper::setUp('relation', array('Contacts', 'Accounts'));
     //create a new field for accounts
     $this->field = get_widget('varchar');
     $this->field->id = 'Accountstest_45339333_c';
     $this->field->name = 'test_45339333_c';
     $this->field->vname = 'LBL_TEST_CUSTOM_C';
     $this->field->help = NULL;
     $this->field->custom_module = 'Accounts';
     $this->field->type = 'varchar';
     $this->field->label = 'LBL_TEST_CUSTOM_C';
     $this->field->len = 255;
     $this->field->required = 0;
     $this->field->default_value = NULL;
     $this->field->date_modified = '2012-10-31 02:23:23';
     $this->field->deleted = 0;
     $this->field->audited = 0;
     $this->field->massupdate = 0;
     $this->field->duplicate_merge = 0;
     $this->field->reportable = 1;
     $this->field->importable = 'true';
     $this->field->ext1 = NULL;
     $this->field->ext2 = NULL;
     $this->field->ext3 = NULL;
     $this->field->ext4 = NULL;
     //add field to metadata
     $this->df = new DynamicField('Accounts');
     $this->df->setup(new Account());
     $this->df->addFieldObject($this->field);
     $this->df->buildCache('Accounts');
     VardefManager::clearVardef();
     VardefManager::refreshVardefs('Accounts', 'Account');
     $this->mbPackage = new Bug45339MBPackageMock($this->packName);
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:59,代码来源:Bug45339Test.php


示例12: testFloatPrecisionMapping

 /**
  * @group bug35265
  */
 public function testFloatPrecisionMapping()
 {
     $_REQUEST = array('precision' => 2, 'type' => 'float');
     require_once 'modules/DynamicFields/FieldCases.php';
     $field = get_widget($_REQUEST['type']);
     $field->populateFromPost();
     $this->assertEquals($field->ext1, 2, 'Asserting that the ext1 value was set to the proper precision');
     $this->assertEquals($field->precision, 2, 'Asserting that the precision value was set to the proper precision');
 }
开发者ID:nickpro,项目名称:sugarcrm_dev,代码行数:12,代码来源:Bug39766Test.php


示例13: testDefaultInQuery

 /**
  * Test gets query for boolean field which should not contains default part
  * @dataProvider getDefaults
  * @group 52610
  * @return void
  */
 public function testDefaultInQuery($default)
 {
     $field = get_widget('bool');
     $field->name = 'bug52610_c';
     $field->type = 'bool';
     $field->default = $default;
     $field->default_value = '';
     $field->no_default = 1;
     $query = $field->get_db_add_alter_table('bug52610_cstm');
     $this->assertNotContains(" DEFAULT ", $query, "DEFAULT part is present in query");
 }
开发者ID:newLoki,项目名称:sugarcrm_dev,代码行数:17,代码来源:Bug52610Test.php


示例14: setUp

 public function setUp()
 {
     global $dictionary, $bean_list;
     $this->old_dictionary = $dictionary;
     $this->old_bean_list = $bean_list;
     $this->test_standart_field = new TestStandardField();
     $this->test_standart_field->module = 'Accounts';
     loadBean($this->test_standart_field->module);
     $this->test_field = get_widget('varchar');
     $this->test_field->name = 'name';
     $this->bean_name = get_valid_bean_name($this->test_standart_field->module);
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:12,代码来源:Bug51427Test.php


示例15: setUp

 public function setUp()
 {
     $beanList = array();
     $beanFiles = array();
     require 'include/modules.php';
     $GLOBALS['beanList'] = $beanList;
     $GLOBALS['beanFiles'] = $beanFiles;
     $GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser();
     $GLOBALS['current_user']->status = 'Active';
     $GLOBALS['current_user']->is_admin = 1;
     $GLOBALS['current_user']->save();
     $this->field = get_widget('varchar');
     $this->field->id = 'Accountstest_custom_c';
     $this->field->name = 'test_custom_c';
     $this->field->vanme = 'LBL_TEST_CUSTOM_C';
     $this->field->comments = NULL;
     $this->field->help = NULL;
     $this->field->custom_module = 'Accounts';
     $this->field->type = 'varchar';
     $this->field->label = 'LBL_TEST_CUSTOM_C';
     $this->field->len = 255;
     $this->field->required = 0;
     $this->field->default_value = NULL;
     $this->field->date_modified = '2009-09-14 02:23:23';
     $this->field->deleted = 0;
     $this->field->audited = 0;
     $this->field->massupdate = 0;
     $this->field->duplicate_merge = 0;
     $this->field->reportable = 1;
     $this->field->importable = 'true';
     $this->field->ext1 = NULL;
     $this->field->ext2 = NULL;
     $this->field->ext3 = NULL;
     $this->field->ext4 = NULL;
     $this->df = new DynamicField('Accounts');
     $this->mod = new Account();
     $this->df->setup($this->mod);
     $this->df->addFieldObject($this->field);
     $this->df->buildCache('Accounts');
     VardefManager::clearVardef();
     VardefManager::refreshVardefs('Accounts', 'Account');
     $this->mod->field_defs = $GLOBALS['dictionary']['Account']['fields'];
     $this->_contact = SugarTestContactUtilities::createContact();
     $this->_account = SugarTestAccountUtilities::createAccount();
     $this->_contact->load_relationship('accounts');
     $this->_contact->accounts->add($this->_account->id);
     $this->_account->test_custom_c = 'Custom Field';
     $this->_account->save();
     $GLOBALS['db']->commit();
     // Making sure we commit any changes
 }
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:51,代码来源:Bug41985Test.php


示例16: addField

 private function addField($name)
 {
     $labelName = 'LBL_' . strtoupper($name);
     $field = get_widget('relate');
     $field->audited = 0;
     $field->view = 'edit';
     $field->name = $name;
     $field->vname = $labelName;
     $field->label = $labelName;
     $field->ext2 = 'Opportunities';
     $field->label_value = $name;
     $field->save($this->dynamicField);
     $this->fields[] = $field;
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:14,代码来源:Bug46152_P2Test.php


示例17: addField

 private function addField($name)
 {
     $labelName = 'LBL_' . strtoupper($name);
     $field = get_widget('relate');
     $field->audited = 0;
     $field->view = 'edit';
     $field->name = $name;
     $field->vname = $labelName;
     $field->label = $labelName;
     $field->ext2 = $this->relatedModule;
     $field->label_value = $name;
     $field->save(self::$dynamicField);
     self::$field = $field;
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:14,代码来源:Bug61859_p2Test.php


示例18: testPopulateFromPost

 /**
  * @dataProvider provider
  */
 public function testPopulateFromPost($type, $request_data, $expected)
 {
     $tested_key = null;
     foreach ($request_data as $_key => $_data) {
         $_REQUEST[$_key] = $_data;
         $tested_key = $_key;
     }
     $field = get_widget($type);
     $field->populateFromPost();
     if (isset($field->{$tested_key})) {
         $this->assertEquals($expected, $field->{$tested_key});
     } else {
         $this->markTestSkipped();
     }
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:18,代码来源:Bug48826Test.php


示例19: createCustomField

 /**
  * Create the custom field with type 'relate'
  */
 protected function createCustomField()
 {
     $field = get_widget('relate');
     $field->id = 'Contacts' . $this->field_name_c;
     $field->name = $this->field_name_c;
     $field->type = 'relate';
     $field->label = 'LBL_' . strtoupper($this->field_name_c);
     $field->ext2 = 'Accounts';
     $field->view_module = 'Contacts';
     $this->relateField = $field;
     $this->bean = BeanFactory::getBean('Contacts');
     $this->df = new DynamicField($this->bean->module_name);
     $this->df->setup($this->bean);
     $field->save($this->df);
     $this->rc = new RepairAndClear();
     $this->rc->repairAndClearAll(array("rebuildExtensions", "clearVardefs"), array('Contact'), false, false);
 }
开发者ID:thsonvt,项目名称:sugarcrm_dev,代码行数:20,代码来源:Bug52173Test.php


示例20: createCustom

    public function createCustom()
    {
        //create new varchar widget and associate with Accounts
        $this->custField = get_widget('varchar');
        $this->custField->id = 'Accounts' . $this->custFieldName;
        $this->custField->name = $this->custFieldName;
        $this->custField->type = 'varchar';
        $this->custField->label = 'LBL_' . strtoupper($this->custFieldName);
        $this->custField->vname = 'LBL_' . strtoupper($this->custFieldName);
        $this->custField->len = 255;
        $this->custField->custom_module = 'Accounts';
        $this->custField->required = 0;
        $this->custField->default = 'goofy';
        $this->acc = new Account();
        $this->df = new DynamicField('Accounts');
        $this->df->setup($this->acc);
        $this->df->addFieldObject($this->custField);
        $this->df->buildCache('Accounts');
        $this->custField->save($this->df);
        VardefManager::clearVardef();
        VardefManager::refreshVardefs('Accounts', 'Account');
        //Now create the meta files to make this a Calculated Field.
        $fn = $this->custFieldName;
        $extensionContent = <<<EOQ
<?php
\$dictionary['Account']['fields']['{$fn}']['duplicate_merge_dom_value']=0;
\$dictionary['Account']['fields']['{$fn}']['calculated']='true';
\$dictionary['Account']['fields']['{$fn}']['formula']='related(\$assigned_user_link,"name")';
\$dictionary['Account']['fields']['{$fn}']['enforced']='true';
\$dictionary['Account']['fields']['{$fn}']['dependency']='';
\$dictionary['Account']['fields']['{$fn}']['type']='varchar';
\$dictionary['Account']['fields']['{$fn}']['name']='{$fn}';


EOQ;
        //create custom field file
        $this->custFileDirPath = create_custom_directory($this->custFileDirPath);
        $fileLoc = $this->custFileDirPath . 'sugarfield_' . $this->custFieldName . '.php';
        file_put_contents($fileLoc, $extensionContent);
        //run repair and clear to make sure the meta gets picked up
        $_REQUEST['repair_silent'] = 1;
        $rc = new RepairAndClear();
        $rc->repairAndClearAll(array("clearAll", "rebuildExtensions"), array("Accounts"), false, false);
        $fn = $this->custFieldName;
    }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:45,代码来源:Bug61734Test.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_width函数代码示例发布时间:2022-05-15
下一篇:
PHP get_where_sql函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap