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


PHP CustomFieldData类代码示例

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


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

示例1: testCreateSourceValues

 public function testCreateSourceValues()
 {
     $sourceValues = array('Word of Mouth', 'Outbound', 'Trade Show');
     $sourceFieldData = CustomFieldData::getByName('LeadSources');
     $sourceFieldData->serializedData = serialize($sourceValues);
     $this->assertTrue($sourceFieldData->save());
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:7,代码来源:ContactTest.php

示例2: testLogAuditForOwnedMultipleValuesCustomField

 public function testLogAuditForOwnedMultipleValuesCustomField()
 {
     Yii::app()->user->userModel = User::getByUsername('jimmy');
     $beforeCount = AuditEvent::getCount();
     $values = array('A', 'B', 'C', 'CC', 'CCC');
     $customFieldData = CustomFieldData::getByName('MultipleIndustries');
     $customFieldData->serializedData = serialize($values);
     $saved = $customFieldData->save();
     $this->assertTrue($saved);
     $model = new TestOwnedCustomFieldsModel();
     $this->assertTrue($model->save());
     $this->assertEquals($beforeCount + 1, AuditEvent::getCount());
     $model = TestOwnedCustomFieldsModel::getById($model->id);
     $value = new CustomFieldValue();
     $value->value = 'C';
     $model->multipleIndustries->values->removeAll();
     //To remove the blank CustomFieldValue. This mimics
     //setValues($values) in MultipleValuesCustomField.
     $model->multipleIndustries->values->add($value);
     $this->assertTrue($model->save());
     $this->assertEquals($beforeCount + 2, AuditEvent::getCount());
     $model = TestOwnedCustomFieldsModel::getById($model->id);
     $value = new CustomFieldValue();
     $value->value = 'B';
     $model->multipleIndustries->values->add($value);
     $this->assertTrue($model->save());
     $this->assertEquals($beforeCount + 3, AuditEvent::getCount());
     $AuditEventsList = AuditEvent::getTailEvents(3);
     $this->assertRegExp('/[0-9]+\\/[0-9]+\\/[0-9]+ [0-9]+:[0-9]+ [AP]M, ' . 'James Boondog, Item Created, ' . 'TestOwnedCustomFieldsModel\\([0-9]+\\), \\(None\\)/', ZurmoModule::stringifyAuditEvent($AuditEventsList[0]));
     $this->assertRegExp('/[0-9]+\\/[0-9]+\\/[0-9]+ [0-9]+:[0-9]+ [AP]M, ' . 'James Boondog, Item Modified, ' . 'TestOwnedCustomFieldsModel\\([0-9]+\\), \\(None\\), ' . 'Changed Multiple Industries Values from  to C/', ZurmoModule::stringifyAuditEvent($AuditEventsList[1]));
     $this->assertRegExp('/[0-9]+\\/[0-9]+\\/[0-9]+ [0-9]+:[0-9]+ [AP]M, ' . 'James Boondog, Item Modified, ' . 'TestOwnedCustomFieldsModel\\([0-9]+\\), \\(None\\), ' . 'Changed Multiple Industries Values from C to C, B/', ZurmoModule::stringifyAuditEvent($AuditEventsList[2]));
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:32,代码来源:AuditingTest.php

示例3: testLoad

 public function testLoad()
 {
     $customFieldData = CustomFieldData::getByName('Titles');
     $this->assertEquals(0, count(unserialize($customFieldData->serializedData)));
     $customFieldData = CustomFieldData::getByName('AccountTypes');
     $this->assertEquals(0, count(unserialize($customFieldData->serializedData)));
     $customFieldData = CustomFieldData::getByName('LeadSources');
     $this->assertEquals(0, count(unserialize($customFieldData->serializedData)));
     $customFieldData = CustomFieldData::getByName('Industries');
     $this->assertEquals(0, count(unserialize($customFieldData->serializedData)));
     $customFieldData = CustomFieldData::getByName('MeetingCategories');
     $this->assertEquals(0, count(unserialize($customFieldData->serializedData)));
     $this->assertEquals(0, ContactState::getCount());
     // do a getAll to ensure we create base currency
     $baseCurrency = Currency::getAll();
     $this->assertCount(1, $baseCurrency);
     $this->assertEquals(1, Currency::getCount());
     $messageLogger = new MessageLogger();
     DefaultDataUtil::load($messageLogger);
     $customFieldData = CustomFieldData::getByName('Titles');
     $this->assertEquals(4, count(unserialize($customFieldData->serializedData)));
     $customFieldData = CustomFieldData::getByName('AccountTypes');
     $this->assertEquals(3, count(unserialize($customFieldData->serializedData)));
     $customFieldData = CustomFieldData::getByName('LeadSources');
     $this->assertEquals(4, count(unserialize($customFieldData->serializedData)));
     $customFieldData = CustomFieldData::getByName('Industries');
     $this->assertEquals(9, count(unserialize($customFieldData->serializedData)));
     $customFieldData = CustomFieldData::getByName('MeetingCategories');
     $this->assertEquals(2, count(unserialize($customFieldData->serializedData)));
     $this->assertEquals(6, ContactState::getCount());
     $this->assertEquals(1, Currency::getCount());
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:32,代码来源:DefaultDataUtilTest.php

示例4: renderControlEditable

 /**
  * Render a hidden input, a text input with an auto-complete
  * event, and a select button. These three items together
  * form the Opportunity Editable Element
  * @return The element's content as a string.
  */
 protected function renderControlEditable()
 {
     $content = null;
     $content .= ZurmoHtml::textField('stageToProbabilityMapping_notUsed', null, array('id' => $this->getEditableInputId(), 'style' => "display:none;"));
     $fieldData = CustomFieldData::getByName('SalesStages');
     if ($fieldData->serializedData != null) {
         $values = unserialize($fieldData->serializedData);
         if (!is_array($values)) {
             $values = array();
         }
     } else {
         $values = array();
     }
     $stagesToProbabilities = OpportunitiesModule::getStageToProbabilityMappingData();
     foreach ($values as $value) {
         if (isset($stagesToProbabilities[$value])) {
             $probability = $stagesToProbabilities[$value];
         } else {
             $probability = 0;
         }
         $htmlOptions = array('name' => $this->getNameForInputField($value), 'value' => $probability);
         $element = $this->form->textField($this->model, $this->attribute, $htmlOptions);
         $element .= ZurmoHtml::tag('span', array(), $value);
         $content .= ZurmoHtml::tag('div', array('class' => 'has-lang-label'), $element);
     }
     return $content;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:33,代码来源:StageToProbabilityMappingElement.php

示例5: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     ContactsModule::loadStartingData();
     //Need to instantiate a controller so the clipWidget can work properly in elements that utilize it.
     $controller = Yii::app()->createController('reports/default');
     list($controller, $actionId) = $controller;
     Yii::app()->setController($controller);
     $values = array('Test1', 'Test2', 'Test3', 'Sample', 'Demo');
     $customFieldData = CustomFieldData::getByName('ReportTestDropDown');
     $customFieldData->serializedData = serialize($values);
     $saved = $customFieldData->save();
     assert($saved);
     // Not Coding Standard
     $values = array('Multi 1', 'Multi 2', 'Multi 3');
     $customFieldData = CustomFieldData::getByName('ReportTestMultiDropDown');
     $customFieldData->serializedData = serialize($values);
     $saved = $customFieldData->save();
     assert($saved);
     // Not Coding Standard
     $values = array('Radio 1', 'Radio 2', 'Radio 3');
     $customFieldData = CustomFieldData::getByName('ReportTestRadioDropDown');
     $customFieldData->serializedData = serialize($values);
     $saved = $customFieldData->save();
     assert($saved);
     // Not Coding Standard
     $values = array('Cloud 1', 'Cloud 2', 'Cloud 3');
     $customFieldData = CustomFieldData::getByName('ReportTestTagCloud');
     $customFieldData->serializedData = serialize($values);
     $saved = $customFieldData->save();
     assert($saved);
     // Not Coding Standard
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:34,代码来源:ReportAttributeToElementAdapterTest.php

示例6: makeDropDownAttributeUsingAdapter

 public static function makeDropDownAttributeUsingAdapter($namePrefix, $valuesPrefix, RedBeanModel $modelTouse)
 {
     $values = array($valuesPrefix . '1', $valuesPrefix . '2', $valuesPrefix . '3', $valuesPrefix . '4');
     $labels = array('fr' => array($valuesPrefix . '1 fr', $valuesPrefix . '1 fr', $valuesPrefix . '1 fr', $valuesPrefix . '1 fr'), 'de' => array($valuesPrefix . '1 de', $valuesPrefix . '1 de', $valuesPrefix . '1 de', $valuesPrefix . '1 de'));
     $airplanesFieldData = CustomFieldData::getByName($namePrefix . 'TheData');
     $airplanesFieldData->serializedData = serialize($values);
     $saved = $airplanesFieldData->save();
     if (!$saved) {
         throw new NotSupportedException();
     }
     $attributeForm = new DropDownAttributeForm();
     $attributeForm->attributeName = $namePrefix;
     $attributeForm->attributeLabels = array('de' => $namePrefix . ' de', 'en' => $namePrefix . ' en', 'es' => $namePrefix . ' es', 'fr' => $namePrefix . ' fr', 'it' => $namePrefix . ' it');
     $attributeForm->isAudited = false;
     $attributeForm->isRequired = false;
     $attributeForm->defaultValueOrder = null;
     $attributeForm->customFieldDataData = $values;
     $attributeForm->customFieldDataName = $namePrefix . 'TheData';
     $attributeForm->customFieldDataLabels = $labels;
     $modelAttributesAdapterClassName = $attributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
     $adapter = new $modelAttributesAdapterClassName($modelTouse);
     try {
         $adapter->setAttributeMetadataFromForm($attributeForm);
     } catch (FailedDatabaseSchemaChangeException $e) {
         echo $e->getMessage();
         throw new NotSupportedException();
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:28,代码来源:DropDownModelAttributesAdapterTest.php

示例7: testGetExportValue

 public function testGetExportValue()
 {
     $values = array('Test1', 'Test2', 'Test3', 'Sample', 'Demo');
     $customFieldData = CustomFieldData::getByName('ExportTestRadioDropDown');
     $customFieldData->serializedData = serialize($values);
     $saved = $customFieldData->save();
     $this->assertTrue($saved);
     $data = array();
     $model = new ExportTestModelItem();
     $model->radioDropDown->value = $values[1];
     $model->lastName = "Smith";
     $model->string = "Some Test String";
     // We have to save model, to get correct currencyValue id.
     $this->assertTrue($model->save());
     $adapter = new RadioDropDownRedBeanModelAttributeValueToExportValueAdapter($model, 'radioDropDown');
     $adapter->resolveData($data);
     $compareData = array('Test2');
     $this->assertEquals($compareData, $data);
     $data = array();
     $adapter->resolveHeaderData($data);
     $compareData = array($model->getAttributeLabel('radioDropDown'));
     $this->assertEquals($compareData, $data);
     $data = array();
     $model = new ExportTestModelItem();
     $adapter = new RadioDropDownRedBeanModelAttributeValueToExportValueAdapter($model, 'radioDropDown');
     $adapter->resolveData($data);
     $compareData = array('');
     $this->assertEquals($compareData, $data);
     $data = array();
     $adapter->resolveHeaderData($data);
     $compareData = array($model->getAttributeLabel('radioDropDown'));
     $this->assertEquals($compareData, $data);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:33,代码来源:RadioDropDownRedBeanModelAttributeValueToExportValueAdapterTest.php

示例8: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $super = User::getByUsername('super');
     $bobby = UserTestHelper::createBasicUser('bobby');
     $sarah = UserTestHelper::createBasicUser('sarah');
     self::$superUserId = $super->id;
     self::$bobbyUserId = $bobby->id;
     self::$sarahUserId = $sarah->id;
     $currency = Currency::makeBaseCurrency();
     assert($currency->code == 'USD');
     // Not Coding Standard
     self::$baseCurrencyId = $currency->id;
     $currency = new Currency();
     $currency->code = 'EUR';
     $currency->rateToBase = 2;
     assert($currency->save());
     // Not Coding Standard
     self::$eurCurrencyId = $currency->id;
     $values = array('A1', 'B2', 'C3', 'D4', 'E5', 'F6');
     $fieldData = CustomFieldData::getByName('WorkflowTestDropDown');
     $fieldData->serializedData = serialize($values);
     $saved = $fieldData->save();
     assert($saved);
     // Not Coding Standard
     $values = array('A1', 'B2', 'C3', 'D4', 'E5', 'F6');
     $fieldData = CustomFieldData::getByName('WorkflowTestRadioDropDown');
     $fieldData->serializedData = serialize($values);
     $saved = $fieldData->save();
     assert($saved);
     // Not Coding Standard
     $values = array('M1', 'M2', 'M3', 'M4', 'M5', 'M6');
     $fieldData = CustomFieldData::getByName('WorkflowTestMultiDropDown');
     $fieldData->serializedData = serialize($values);
     $saved = $fieldData->save();
     assert($saved);
     // Not Coding Standard
     $values = array('M1', 'M2', 'M3', 'M4', 'M5', 'M6');
     $fieldData = CustomFieldData::getByName('WorkflowTestTagCloud');
     $fieldData->serializedData = serialize($values);
     $saved = $fieldData->save();
     assert($saved);
     // Not Coding Standard
     $loaded = ContactsModule::loadStartingData();
     assert($loaded);
     // Not Coding Standard
     $contactStates = ContactState::getByName('New');
     self::$newState = $contactStates[0];
     $contactStates = ContactState::getByName('In progress');
     self::$inProgressState = $contactStates[0];
     self::$groupTest = new Group();
     self::$groupTest->name = 'test';
     $saved = self::$groupTest->save();
     assert($saved);
     // Not Coding Standard
     $group = Group::getByName(Group::EVERYONE_GROUP_NAME);
     $saved = $group->save();
     assert($saved);
     // Not Coding Standard
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:60,代码来源:WorkflowActionAttributeFormResolveValueTest.php

示例9: getStageDropDownArray

 /**
  * Gets array for stages
  * @return array
  */
 protected function getStageDropDownArray()
 {
     $customFieldData = CustomFieldData::getByName('ProductStages');
     $customFieldIndexedData = CustomFieldDataUtil::getDataIndexedByDataAndTranslatedLabelsByLanguage($customFieldData, Yii::app()->language);
     $data = array_merge(array(ProductsConfigurationForm::FILTERED_BY_ALL_STAGES => Zurmo::t('Core', 'All')), $customFieldIndexedData);
     return $data;
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:11,代码来源:ProductStageFilterRadioElement.php

示例10: testConstructIncompleteIsNotNeeded

 /**
  * There previously was a problem with a model being created, then a new custom field added, then if you try
  * to access the available CustomFieldData it was not available on that model.  Since performance3 work
  * this has been resolve and this test confirms it works ok
  */
 public function testConstructIncompleteIsNotNeeded()
 {
     //First create AAA model and save
     $aaa = new AAA();
     $aaa->aaaMember = 'test';
     $saved = $aaa->save();
     $this->assertTrue($saved);
     $aaaId = $aaa->id;
     $aaa->forget();
     unset($aaa);
     //Second create customFieldData
     $values = array('Item 1', 'Item 2', 'Item 3');
     $labels = array('fr' => 'Item 1 fr', 'fr' => 'Item 2 fr', 'fr' => 'Item 3 fr');
     $customFieldData = CustomFieldData::getByName('Items');
     $customFieldData->serializedData = serialize($values);
     $customFieldData->serializedLabels = serialize($labels);
     $this->assertTrue($customFieldData->save());
     $id = $customFieldData->id;
     unset($customFieldData);
     //Third create a CustomField on AAA
     $metadata = AAA::getMetadata();
     $metadata['AAA']['customFields']['newCustomField'] = 'Items';
     $metadata['AAA']['relations']['newCustomField'] = array(RedBeanModel::HAS_ONE, 'CustomField');
     AAA::setMetadata($metadata);
     //Fourth make sure AAA can utilize CustomFieldData after being constructed
     $aaa = AAA::GetById($aaaId);
     $this->assertTrue($aaa->isAnAttribute('newCustomField'));
     $dropDownArray = unserialize($aaa->newCustomField->data->serializedData);
     $this->assertCount(3, $dropDownArray);
     //Fifth make sure a new model has the data available
     $aaa = new AAA();
     $this->assertTrue($aaa->isAnAttribute('newCustomField'));
     $dropDownArray = unserialize($aaa->newCustomField->data->serializedData);
     $this->assertCount(3, $dropDownArray);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:40,代码来源:CustomFieldsModelTest.php

示例11: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $super = SecurityTestHelper::createSuperAdmin();
     Yii::app()->user->userModel = $super;
     $jim = UserTestHelper::createBasicUser('jim');
     $values = array('Test1', 'Test2', 'Test3', 'Sample', 'Demo');
     $customFieldData = CustomFieldData::getByName('ImportTestDropDown');
     $customFieldData->serializedData = serialize($values);
     $saved = $customFieldData->save();
     assert($saved);
     // Not Coding Standard
     $values = array('Multi 1', 'Multi 2', 'Multi 3');
     $customFieldData = CustomFieldData::getByName('ImportTestMultiDropDown');
     $customFieldData->serializedData = serialize($values);
     $saved = $customFieldData->save();
     assert($saved);
     // Not Coding Standard
     $values = array('Cloud 1', 'Cloud 2', 'Cloud 3');
     $customFieldData = CustomFieldData::getByName('ImportTestTagCloud');
     $customFieldData->serializedData = serialize($values);
     $saved = $customFieldData->save();
     assert($saved);
     // Not Coding Standard
     //Ensure the external system id column is present.
     $userTableName = User::getTableName();
     ExternalSystemIdUtil::addExternalIdColumnIfMissing($userTableName);
     ExternalSystemIdUtil::updateByModel($super, 'A');
     ExternalSystemIdUtil::updateByModel($jim, 'B');
     ExternalSystemIdUtil::addExternalIdColumnIfMissing(ImportModelTestItem::getTableName());
     ExternalSystemIdUtil::addExternalIdColumnIfMissing(ImportModelTestItem2::getTableName());
     ExternalSystemIdUtil::addExternalIdColumnIfMissing(ImportModelTestItem3::getTableName());
     ExternalSystemIdUtil::addExternalIdColumnIfMissing(ImportModelTestItem4::getTableName());
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:34,代码来源:ImportDataAnalyzerTest.php

示例12: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $super = SecurityTestHelper::createSuperAdmin();
     Yii::app()->user->userModel = $super;
     $jim = UserTestHelper::createBasicUser('jim');
     $values = array('Test1', 'Test2', 'Test3', 'Sample', 'Demo');
     $customFieldData = CustomFieldData::getByName('ImportTestDropDown');
     $customFieldData->serializedData = serialize($values);
     $saved = $customFieldData->save();
     assert($saved);
     // Not Coding Standard
     $values = array('Multi 1', 'Multi 2', 'Multi 3');
     $customFieldData = CustomFieldData::getByName('ImportTestMultiDropDown');
     $customFieldData->serializedData = serialize($values);
     $saved = $customFieldData->save();
     assert($saved);
     // Not Coding Standard
     $values = array('Cloud 1', 'Cloud 2', 'Cloud 3');
     $customFieldData = CustomFieldData::getByName('ImportTestTagCloud');
     $customFieldData->serializedData = serialize($values);
     $saved = $customFieldData->save();
     assert($saved);
     // Not Coding Standard
     //Ensure the external system id column is present.
     $columnName = ExternalSystemIdUtil::EXTERNAL_SYSTEM_ID_COLUMN_NAME;
     RedBeanColumnTypeOptimizer::externalIdColumn(User::getTableName('User'), $columnName);
     $userTableName = User::getTableName('User');
     R::exec("update " . $userTableName . " set {$columnName} = 'A' where id = {$super->id}");
     R::exec("update " . $userTableName . " set {$columnName} = 'B' where id = {$jim->id}");
     RedBeanColumnTypeOptimizer::externalIdColumn(ImportModelTestItem::getTableName('ImportModelTestItem'), $columnName);
     RedBeanColumnTypeOptimizer::externalIdColumn(ImportModelTestItem2::getTableName('ImportModelTestItem2'), $columnName);
     RedBeanColumnTypeOptimizer::externalIdColumn(ImportModelTestItem3::getTableName('ImportModelTestItem3'), $columnName);
     RedBeanColumnTypeOptimizer::externalIdColumn(ImportModelTestItem4::getTableName('ImportModelTestItem4'), $columnName);
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:35,代码来源:ImportDataAnalyzerTest.php

示例13: resolveStageDefaultValue

 /**
  * Resolve stage default value
  * @param RedBeanModel $product
  * @return string
  */
 public function resolveStageDefaultValue($product)
 {
     $customFieldData = CustomFieldData::getByName('ProductStages');
     $dropDownArray = unserialize($customFieldData->serializedData);
     if ($product->stage->value == null) {
         $product->stage->value = $dropDownArray[0];
     }
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:13,代码来源:ProductZurmoControllerUtil.php

示例14: getTypeValues

 public static function getTypeValues()
 {
     $values = array('Prospect', 'Customer', 'Vendor');
     $typeFieldData = CustomFieldData::getByName('AccountTypes');
     $typeFieldData->serializedData = serialize($values);
     assert($typeFieldData->save());
     // Not Coding Standard
     return $values;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:9,代码来源:AccountListViewMergeTestHelper.php

示例15: createCategories

 public static function createCategories()
 {
     $values = array('Meeting', 'Call', 'Event');
     $typeFieldData = CustomFieldData::getByName('MeetingCategories');
     $typeFieldData->serializedData = serialize($values);
     $saved = $typeFieldData->save();
     if (!$saved) {
         throw new NotSupportedException();
     }
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:10,代码来源:MeetingTestHelper.php


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