本文整理汇总了PHP中Currency::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP Currency::getAll方法的具体用法?PHP Currency::getAll怎么用?PHP Currency::getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Currency
的用法示例。
在下文中一共展示了Currency::getAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionLoadContractsSampler
public function actionLoadContractsSampler()
{
if (!Group::isUserASuperAdministrator(Yii::app()->user->userModel)) {
throw new NotSupportedException();
}
for ($i = 0; $i < 11; $i++) {
$owner = Yii::app()->user->userModel;
$name = 'Mass Delete ' . $i;
$currencies = Currency::getAll();
$currencyValue = new CurrencyValue();
$currencyValue->value = 500.54;
$currencyValue->currency = $currencies[0];
$contract = new Contract();
$contract->owner = $owner;
$contract->name = $name;
$contract->amount = $currencyValue;
$contract->closeDate = '2011-01-01';
//eventually fix to make correct format
$contract->stage->value = 'Negotiating';
$saved = $contract->save();
if (!$saved) {
throw new NotSupportedException();
}
}
}
示例2: 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());
}
示例3: makeAll
/**
* @param Object $demoDataHelper
*/
public function makeAll(&$demoDataHelper)
{
assert('$demoDataHelper instanceof DemoDataHelper');
$currencies = Currency::getAll('id');
$productTemplates = array();
$productTemplateRandomData = self::getProductTemplatesRandomData();
for ($i = 0; $i < count($productTemplateRandomData['names']); $i++) {
$productTemplate = new ProductTemplate();
$currencyIndex = array_rand($currencies);
$currencyValue = new CurrencyValue();
$currencyValue->currency = $currencies[$currencyIndex];
$productTemplate->cost = $currencyValue;
$currencyValue = new CurrencyValue();
$currencyValue->currency = $currencies[$currencyIndex];
$productTemplate->listPrice = $currencyValue;
$currencyValue = new CurrencyValue();
$currencyValue->currency = $currencies[$currencyIndex];
$productTemplate->sellPrice = $currencyValue;
$this->populateModelData($productTemplate, $i);
$saved = $productTemplate->save();
assert('$saved');
$productTemplates[] = $productTemplate->id;
}
$demoDataHelper->setRangeByModelName('ProductTemplate', $productTemplates[0], $productTemplates[count($productTemplates) - 1]);
}
示例4: testGetExportValue
public function testGetExportValue()
{
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
$currencies = Currency::getAll();
$currencyValue = new CurrencyValue();
$currencyValue->value = 100;
$currencyValue->currency = $currencies[0];
$this->assertEquals('USD', $currencyValue->currency->code);
$data = array();
$model = new ExportTestModelItem();
$model->currencyValue = $currencyValue;
$model->lastName = "Smith";
$model->string = "Some Test String";
// We have to save model, to get correct currencyValue id.
$this->assertTrue($model->save());
$adapter = new CurrencyValueRedBeanModelAttributeValueToExportValueAdapter($model, 'currencyValue');
$adapter->resolveData($data);
$compareData = array($currencyValue->value, $currencyValue->currency->code);
$this->assertEquals($compareData, $data);
$data = array();
$adapter->resolveHeaderData($data);
$compareData = array($model->getAttributeLabel('currencyValue'), $model->getAttributeLabel('currencyValue') . " " . Zurmo::t('ZurmoModule', 'Currency'));
$this->assertEquals($compareData, $data);
$data = array();
$model = new ExportTestModelItem();
$adapter = new CurrencyValueRedBeanModelAttributeValueToExportValueAdapter($model, 'currencyValue');
$adapter->resolveData($data);
$compareData = array('', '');
$this->assertEquals($compareData, $data);
$data = array();
$adapter->resolveHeaderData($data);
$compareData = array($model->getAttributeLabel('currencyValue'), $model->getAttributeLabel('currencyValue') . " " . Zurmo::t('ZurmoModule', 'Currency'));
$this->assertEquals($compareData, $data);
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:35,代码来源:CurrencyValueRedBeanModelAttributeValueToExportValueAdapterTest.php
示例5: make
public function make()
{
$values = array(Zurmo::t('CustomField', 'Mr.'), Zurmo::t('CustomField', 'Mrs.'), Zurmo::t('CustomField', 'Ms.'), Zurmo::t('CustomField', 'Dr.'));
static::makeCustomFieldDataByValuesAndDefault('Titles', $values);
Currency::getAll();
//build base currency.
}
示例6: testGetExportValue
public function testGetExportValue()
{
$currencies = Currency::getAll();
$this->assertTrue(count($currencies) > 0);
$data = array();
$model = new ExportTestModelItem();
$model->currency = $currencies[0];
$adapter = new CurrencyRedBeanModelAttributeValueToExportValueAdapter($model, 'currency');
$adapter->resolveData($data);
$compareData = array($currencies[0]->code);
$this->assertEquals($compareData, $data);
$data = array();
$adapter->resolveHeaderData($data);
$compareData = array($model->getAttributeLabel('currency'));
$this->assertEquals($compareData, $data);
// Test when model doesn't contain currency data.
$data = array();
$model = new ExportTestModelItem();
$adapter = new CurrencyRedBeanModelAttributeValueToExportValueAdapter($model, 'currency');
$adapter->resolveData($data);
$compareData = array('');
$this->assertEquals($compareData, $data);
$data = array();
$adapter->resolveHeaderData($data);
$compareData = array($model->getAttributeLabel('currency'));
$this->assertEquals($compareData, $data);
}
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:27,代码来源:CurrencyRedBeanModelAttributeValueToExportValueAdapterTest.php
示例7: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ContactsModule::loadStartingData();
UserTestHelper::createBasicUser('bobby');
Currency::getAll();
//Ensure USD is present
}
示例8: testSimpleUserImportWhereAllRowsSucceed
public function testSimpleUserImportWhereAllRowsSucceed()
{
Yii::app()->user->userModel = User::getByUsername('super');
$import = new Import();
$serializedData['importRulesType'] = 'ProductTemplates';
$serializedData['firstRowIsHeaderRow'] = true;
$import->serializedData = serialize($serializedData);
$this->assertTrue($import->save());
ImportTestHelper::createTempTableByFileNameAndTableName('productTemplates.csv', $import->getTempTableName(), Yii::getPathOfAlias('application.modules.productTemplates.tests.unit.files'));
$this->assertEquals(3, ImportDatabaseUtil::getCount($import->getTempTableName()));
// includes header rows.
$currencies = Currency::getAll();
$mappingData = array('column_0' => ImportMappingUtil::makeStringColumnMappingData('name'), 'column_1' => ImportMappingUtil::makeTextAreaColumnMappingData('description'), 'column_2' => ImportMappingUtil::makeIntegerColumnMappingData('sellPriceFormula__type'), 'column_3' => ImportMappingUtil::makeFloatColumnMappingData('sellPriceFormula__discountOrMarkupPercentage'), 'column_4' => ImportMappingUtil::makeCurrencyColumnMappingData('cost', $currencies[0]), 'column_5' => ImportMappingUtil::makeCurrencyColumnMappingData('listPrice', $currencies[0]), 'column_6' => ImportMappingUtil::makeCurrencyColumnMappingData('sellPrice', $currencies[0]), 'column_7' => ImportMappingUtil::makeIntegerColumnMappingData('priceFrequency'), 'column_8' => ImportMappingUtil::makeIntegerColumnMappingData('type'), 'column_9' => ImportMappingUtil::makeIntegerColumnMappingData('status'));
$importRules = ImportRulesUtil::makeImportRulesByType('ProductTemplates');
$page = 0;
$config = array('pagination' => array('pageSize' => 50));
//This way all rows are processed.
$dataProvider = new ImportDataProvider($import->getTempTableName(), true, $config);
$dataProvider->getPagination()->setCurrentPage($page);
$importResultsUtil = new ImportResultsUtil($import);
$messageLogger = new ImportMessageLogger();
ImportUtil::importByDataProvider($dataProvider, $importRules, $mappingData, $importResultsUtil, new ExplicitReadWriteModelPermissions(), $messageLogger);
$importResultsUtil->processStatusAndMessagesForEachRow();
//Confirm that 3 models where created.
$productTemplates = ProductTemplate::getAll();
$this->assertEquals(2, count($productTemplates));
$productTemplates = ProductTemplate::getByName('A Gift of Monotheists import');
$this->assertEquals(1, count($productTemplates[0]));
$this->assertEquals('A Gift of Monotheists import', $productTemplates[0]->name);
$this->assertEquals(2, $productTemplates[0]->sellPriceFormula->type);
$this->assertEquals(10, $productTemplates[0]->sellPriceFormula->discountOrMarkupPercentage);
$this->assertEquals(180, $productTemplates[0]->sellPrice->value);
$this->assertEquals(200, $productTemplates[0]->listPrice->value);
$this->assertEquals(200, $productTemplates[0]->cost->value);
$this->assertEquals(2, $productTemplates[0]->priceFrequency);
$this->assertEquals(2, $productTemplates[0]->type);
$this->assertEquals(2, $productTemplates[0]->status);
$productTemplates[0]->delete();
$productTemplates = ProductTemplate::getByName('A Gift of Monotheists import Copy');
$this->assertEquals(1, count($productTemplates[0]));
$this->assertEquals('A Gift of Monotheists import Copy', $productTemplates[0]->name);
$this->assertEquals(2, $productTemplates[0]->sellPriceFormula->type);
$this->assertEquals(5, $productTemplates[0]->sellPriceFormula->discountOrMarkupPercentage);
$this->assertEquals(180, $productTemplates[0]->sellPrice->value);
$this->assertEquals(200, $productTemplates[0]->listPrice->value);
$this->assertEquals(200, $productTemplates[0]->cost->value);
$this->assertEquals(2, $productTemplates[0]->priceFrequency);
$this->assertEquals(2, $productTemplates[0]->type);
$this->assertEquals(2, $productTemplates[0]->status);
$productTemplates[0]->delete();
//Confirm that 2 rows were processed as 'updated'.
$this->assertEquals(0, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::UPDATED));
//Confirm 2 rows were processed as 'errors'.
$this->assertEquals(0, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::ERROR));
$beansWithErrors = ImportDatabaseUtil::getSubset($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::ERROR);
$this->assertEquals(0, count($beansWithErrors));
}
示例9: testGetAllMakesBaseCurrency
public function testGetAllMakesBaseCurrency()
{
$this->assertEquals(0, count(Currency::getAll(null, false, null, false)));
$currency = Yii::app()->currencyHelper;
$this->assertEquals('USD', $currency->getBaseCode());
$this->assertEquals(0, Currency::getCount());
$this->assertEquals(1, count(Currency::getAll()));
$this->assertEquals(1, Currency::getCount());
}
示例10: actionConfigurationList
public function actionConfigurationList()
{
$redirectUrlParams = array('/zurmo/' . $this->getId() . '/ConfigurationList');
$currency = new Currency();
$currency = $this->attemptToSaveModelFromPost($currency, $redirectUrlParams);
$messageBoxContent = $this->attemptToUpdateActiveCurrenciesFromPostAndGetMessageBoxContent();
$view = new CurrencyTitleBarConfigurationListAndCreateView($this->getId(), $this->getModule()->getId(), $currency, Currency::getAll(), $messageBoxContent);
$view = new ZurmoConfigurationPageView(ZurmoDefaultAdminViewUtil::makeStandardViewForCurrentUser($this, $view));
echo $view->render();
}
示例11: createEmptyPursesFor
private static function createEmptyPursesFor($userID)
{
$purse = new Purse();
$purse->setUserId($userID);
$purse->setValue(0.0);
$allCurrencies = Currency::getAll();
foreach ($allCurrencies as $currency) {
$purse->setCurrencyId($currency['id']);
$purse->insert();
}
}
示例12: actionConfigurationList
public function actionConfigurationList()
{
$breadCrumbLinks = array(Zurmo::t('ZurmoModule', 'Currencies'));
$redirectUrlParams = array('/zurmo/' . $this->getId() . '/ConfigurationList');
$currency = new Currency();
$currency = $this->attemptToSaveModelFromPost($currency, $redirectUrlParams);
$messageBoxContent = $this->attemptToUpdateActiveCurrenciesFromPostAndGetMessageBoxContent();
$view = new CurrencyTitleBarConfigurationListAndCreateView($this->getId(), $this->getModule()->getId(), $currency, Currency::getAll(), $messageBoxContent);
$view = new ZurmoConfigurationPageView(ZurmoDefaultAdminViewUtil::makeViewWithBreadcrumbsForCurrentUser($this, $view, $breadCrumbLinks, 'SettingsBreadCrumbView'));
echo $view->render();
}
示例13: testGetAllMakesBaseCurrency
public function testGetAllMakesBaseCurrency()
{
$this->assertEquals(0, count(Currency::getAll(null, false, null, false)));
$currency = Yii::app()->currencyHelper;
$this->assertEquals('USD', $currency->getBaseCode());
$this->assertEquals(0, Currency::getCount());
// do a getAll to ensure we create base currency
$baseCurrency = Currency::getAll();
$this->assertCount(1, $baseCurrency);
$this->assertEquals(1, Currency::getCount());
}
示例14: generate_currency_list
private function generate_currency_list()
{
$currencies = Currency::getAll();
echo '<select class="field" id="currency" name="currency">' . "\n";
if ($selected == '') {
echo '<option value="0" selected>Please select a currency</option>' . "\n";
}
foreach ($currencies as $currency) {
echo '<option value="' . $currency['symbol'] . '">' . $currency['currency'] . ' (' . $currency['symbol'] . ')</option>' . "\n";
}
echo '</select>' . "\n";
}
示例15: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
SecurityTestHelper::createSuperAdmin();
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
UserTestHelper::createBasicUser('jim');
AllPermissionsOptimizationUtil::rebuild();
ContractTestHelper::createContractStagesIfDoesNotExist();
ContractTestHelper::createContractSourcesIfDoesNotExist();
$currencies = Currency::getAll();
//Make Contracts for testing chart data.
$currencyValue = new CurrencyValue();
$currencyValue->value = 200;
$currencyValue->currency = $currencies[0];
$contract = new Contract();
$contract->owner = $super;
$contract->name = 'abc1';
$contract->amount = $currencyValue;
$contract->closeDate = '2011-01-01';
$contract->stage->value = 'Negotiating';
$contract->source->value = 'Outbound';
assert($contract->save());
// Not Coding Standard
$currencyValue = new CurrencyValue();
$currencyValue->value = 350;
$currencyValue->currency = $currencies[0];
$contract = new Contract();
$contract->owner = $super;
$contract->name = 'abc2';
$contract->amount = $currencyValue;
$contract->closeDate = '2011-01-01';
$contract->stage->value = 'Negotiating';
$contract->source->value = 'Trade Show';
assert($contract->save());
// Not Coding Standard
$currencyValue = new CurrencyValue();
$currencyValue->value = 100;
$currencyValue->currency = $currencies[0];
$contract = new Contract();
$contract->owner = $super;
$contract->name = 'abc2';
$contract->amount = $currencyValue;
$contract->closeDate = '2011-01-01';
$contract->stage->value = 'Verbal';
$contract->source->value = 'Trade Show';
assert($contract->save());
// Not Coding Standard
}