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


PHP get_widget函数代码示例

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


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


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