本文整理汇总了PHP中ZurmoRedBean::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP ZurmoRedBean::getAll方法的具体用法?PHP ZurmoRedBean::getAll怎么用?PHP ZurmoRedBean::getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZurmoRedBean
的用法示例。
在下文中一共展示了ZurmoRedBean::getAll方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getData
/**
* Runs a query to get all the dates for meetings based on SearchAttributeData. Then the data is processed
* and @returns a data array of dates and quantity. Quantity stands for how many meetings in a given date.
* (non-PHPdoc)
* @see CalendarDataProvider::getData()
*/
public function getData()
{
$sql = $this->makeSqlQuery();
$rows = ZurmoRedBean::getAll($sql);
$data = array();
foreach ($rows as $row) {
$localTimeZoneAdjustedDate = DateTimeUtil::convertDbFormattedDateTimeToLocaleFormattedDisplay($row['startdatetime'], 'medium', null);
if (isset($data[$localTimeZoneAdjustedDate])) {
$data[$localTimeZoneAdjustedDate]['quantity'] = $data[$localTimeZoneAdjustedDate]['quantity'] + 1;
} else {
$data[$localTimeZoneAdjustedDate] = array('date' => $localTimeZoneAdjustedDate, 'quantity' => 1, 'dbDate' => $row['startdatetime']);
}
}
foreach ($data as $key => $item) {
if ($item['quantity'] == 1) {
$label = Zurmo::t('MeetingsModule', '{quantity} MeetingsModuleSingularLabel', array_merge(LabelUtil::getTranslationParamsForAllModules(), array('{quantity}' => $item['quantity'])));
} else {
$label = Zurmo::t('MeetingsModule', '{quantity} MeetingsModulePluralLabel', array_merge(LabelUtil::getTranslationParamsForAllModules(), array('{quantity}' => $item['quantity'])));
}
$data[$key]['label'] = $label;
if ($item['quantity'] > 5) {
$quantityClassSuffix = 6;
} else {
$quantityClassSuffix = $item['quantity'];
}
$data[$key]['className'] = 'calendar-events-' . $quantityClassSuffix;
}
return $data;
}
示例2: testProcessStatusAndMessagesForEachRow
public function testProcessStatusAndMessagesForEachRow()
{
Yii::app()->user->userModel = User::getByUsername('super');
$import = new Import();
$serializedData['importRulesType'] = 'ImportModelTestItem';
$import->serializedData = serialize($serializedData);
$this->assertTrue($import->save());
$testTableName = $import->getTempTableName();
$this->assertTrue(ImportTestHelper::createTempTableByFileNameAndTableName('importTest.csv', $testTableName, true));
$count = ImportDatabaseUtil::getCount($testTableName);
$this->assertEquals(5, $count);
//Now add import results.
$resultsUtil = new ImportResultsUtil($import);
$rowDataResultsUtil = new ImportRowDataResultsUtil(2);
$rowDataResultsUtil->setStatusToUpdated();
$rowDataResultsUtil->addMessage('the first message');
$resultsUtil->addRowDataResults($rowDataResultsUtil);
$rowDataResultsUtil = new ImportRowDataResultsUtil(3);
$rowDataResultsUtil->setStatusToCreated();
$rowDataResultsUtil->addMessage('the second message');
$resultsUtil->addRowDataResults($rowDataResultsUtil);
$rowDataResultsUtil = new ImportRowDataResultsUtil(4);
$rowDataResultsUtil->setStatusToError();
$rowDataResultsUtil->addMessage('the third message');
$resultsUtil->addRowDataResults($rowDataResultsUtil);
$resultsUtil->processStatusAndMessagesForEachRow();
$sql = 'select * from ' . $testTableName . ' where id != 1';
$tempTableData = ZurmoRedBean::getAll($sql);
$compareData = array(array('id' => 2, 'column_0' => 'abc', 'column_1' => '123', 'column_2' => 'a', 'status' => 1, 'serializedMessages' => serialize(array('the first message')), 'analysisStatus' => null, 'serializedAnalysisMessages' => null), array('id' => 3, 'column_0' => 'def', 'column_1' => '563', 'column_2' => 'b', 'status' => 2, 'serializedMessages' => serialize(array('the second message')), 'analysisStatus' => null, 'serializedAnalysisMessages' => null), array('id' => 4, 'column_0' => 'efg', 'column_1' => '456', 'column_2' => 'a', 'status' => 3, 'serializedMessages' => serialize(array('the third message')), 'analysisStatus' => null, 'serializedAnalysisMessages' => null), array('id' => 5, 'column_0' => 'we1s', 'column_1' => null, 'column_2' => 'b', 'status' => null, 'serializedMessages' => null, 'analysisStatus' => null, 'serializedAnalysisMessages' => null));
$this->assertEquals($compareData, $tempTableData);
}
示例3: makeCombinedData
/**
* @return array
*/
protected function makeCombinedData()
{
$combinedRows = array();
//todo: should fix and get proper table name of attribute instead of passing in item
$groupBy = $this->resolveGroupBy('EmailMessage', 'sentDateTime');
$beginDateTime = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeBeginningOfDay($this->beginDate);
$endDateTime = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeEndOfDay($this->endDate);
if ($this->marketingList == null) {
$searchAttributeData = static::makeCampaignsSearchAttributeData('createdDateTime', $beginDateTime, $endDateTime, $this->campaign);
$sql = static::makeCampaignsSqlQuery($searchAttributeData, $groupBy);
$rows = ZurmoRedBean::getAll($sql);
foreach ($rows as $row) {
$this->addNewRowToCombinedRows($row, $combinedRows);
}
}
if ($this->campaign == null) {
$searchAttributeData = static::makeAutorespondersSearchAttributeData('createdDateTime', $beginDateTime, $endDateTime, $this->marketingList);
$sql = static::makeAutorespondersSqlQuery($searchAttributeData, $groupBy);
$rows = ZurmoRedBean::getAll($sql);
foreach ($rows as $row) {
$this->addNewRowToCombinedRows($row, $combinedRows);
}
}
return $combinedRows;
}
示例4: findGameTableRowsThatAreDuplicatedByPersonKey
public static function findGameTableRowsThatAreDuplicatedByPersonKey($tableName)
{
assert('is_string($tableName)');
// Begin Not Coding Standard
$sql = "SELECT count(*) as count, person_item_id " . "FROM `" . $tableName . "` " . "GROUP BY person_item_id having count(person_item_id) > 1";
// End Not Coding Standard
return ZurmoRedBean::getAll($sql);
}
示例5: calculateTotalItemCount
/**
* @return int
*/
public function calculateTotalItemCount()
{
$selectQueryAdapter = new RedBeanModelSelectQueryAdapter();
$sql = $this->makeSqlQueryForFetchingTotalItemCount($selectQueryAdapter);
$rows = ZurmoRedBean::getAll($sql);
$count = count($rows);
return $count;
}
示例6: isCategoryInUseById
public static function isCategoryInUseById($categoryId)
{
$categories = Category::getById($categoryId);
$rows = ZurmoRedBean::getAll('SELECT * FROM customfieldvalue WHERE multiplevaluescustomfield_id IN (SELECT category_multiplevaluescustomfield_id FROM costbook) AND VALUE="' . $categories->name . '"');
if (count($rows) > 0) {
return true;
} else {
return false;
}
}
示例7: isUnitofmeasureInUseById
public static function isUnitofmeasureInUseById($unitofmeasureId)
{
$unitofmeasures = Unitofmeasure::getById($unitofmeasureId);
$rows = ZurmoRedBean::getAll('SELECT * FROM customfield WHERE id IN (SELECT unitofmeasure_customfield_id FROM costbook) AND VALUE="' . $unitofmeasures->name . '"');
if (count($rows) > 0) {
return true;
} else {
return false;
}
}
示例8: getByLayoutIdAndUserSortedById
public static function getByLayoutIdAndUserSortedById($layoutId, $userId)
{
$portletCollection = array();
assert('is_integer($userId) && $userId >= 1');
$quote = DatabaseCompatibilityUtil::getQuote();
$sql = "select id, {$quote}column{$quote}, position " . 'from portlet ' . "where layoutid = '" . DatabaseCompatibilityUtil::escape($layoutId) . "' and _user_id = " . DatabaseCompatibilityUtil::escape($userId) . ' order by id;';
foreach (ZurmoRedBean::getAll($sql) as $row) {
$portlet = Portlet::getById(intval($row['id']));
$portletCollection[$row['id']] = $portlet;
}
return $portletCollection;
}
示例9: getChartData
public function getChartData()
{
$customFieldData = CustomFieldDataModelUtil::getDataByModelClassNameAndAttributeName('Opportunity', 'stage');
$labels = CustomFieldDataUtil::getDataIndexedByDataAndTranslatedLabelsByLanguage($customFieldData, Yii::app()->language);
$sql = static::makeChartSqlQuery();
$rows = ZurmoRedBean::getAll($sql);
$chartData = array();
foreach ($rows as $row) {
$chartData[] = array('value' => $this->resolveCurrencyValueConversionRateForCurrentUserForDisplay($row['amount']), 'displayLabel' => static::resolveLabelByValueAndLabels($row['stage'], $labels));
}
return $chartData;
}
示例10: getAddProductSearchData
public static function getAddProductSearchData($category, $costOfGoods)
{
$allAssemblySql = 'SELECT A.*, D.value AS UnitOfMeasure,B.value AS Category FROM
costbook A
LEFT JOIN customfieldvalue AS B ON B.multiplevaluescustomfield_id=A.category_multiplevaluescustomfield_id
LEFT JOIN customfield AS C ON C.id =A.costofgoodssold_customfield_id
LEFT JOIN customfield AS D ON A.unitofmeasure_customfield_id =D.id
WHERE
IF("ALL"="' . $category . '",TRUE,B.VALUE="' . $category . '")
AND IF("ALL"="' . $costOfGoods . '",TRUE,C.VALUE="' . $costOfGoods . '")';
return ZurmoRedBean::getAll($allAssemblySql);
}
示例11: getUserLeaderboardData
/**
* @param string $type
* @param int $startingRank
* @param null|int $offset
* @param null|int $count
* @return array
*/
public static function getUserLeaderboardData($type, $startingRank = 1, $offset = null, $count = null, User $user = null)
{
assert('is_string($type)');
assert('$offset === null || is_integer($offset) && $offset >= 0');
assert('$count === null || is_integer($count) && $count >= 1');
$sql = static::makeUserLeaderboardSqlQuery($type, $offset, $count);
$rows = ZurmoRedBean::getAll($sql);
$rank = $startingRank;
$leaderboardData = array();
foreach ($rows as $row) {
if ($user == null || $user->id == $row['userid']) {
$leaderboardData[$row['userid']] = array('rank' => StringUtil::resolveOrdinalIntegerAsStringContent(intval($rank)), 'userLabel' => strval(User::getById(intval($row['userid']))), 'points' => intval($row['points']));
}
$rank++;
}
return $leaderboardData;
}
示例12: testASingleAttributeThatRunsFrozenQueryCorrectly
/**
* Make sure the query actually runs correctly.
*/
public function testASingleAttributeThatRunsFrozenQueryCorrectly()
{
$q = DatabaseCompatibilityUtil::getQuote();
$joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('ReportModelTestItem');
$builder = new FiltersReportQueryBuilder($joinTablesAdapter, '1');
$filter = new FilterForReportForm('AccountsModule', 'Account', Report::TYPE_ROWS_AND_COLUMNS);
$filter->attributeIndexOrDerivedType = 'ReadOptimization';
$content = $builder->makeQueryContent(array($filter));
$compareContent = "({$q}ownedsecurableitem{$q}.{$q}securableitem_id{$q} = (select securableitem_id " . "from {$q}account_read{$q} where {$q}securableitem_id{$q} = {$q}ownedsecurableitem" . "{$q}.{$q}securableitem_id{$q} and {$q}munge_id{$q} in ('U" . self::$superUserId . "', 'G" . self::$everyoneGroupId . "') limit 1))";
$this->assertEquals($compareContent, $content);
$this->assertEquals(1, $joinTablesAdapter->getFromTableJoinCount());
$this->assertEquals(0, $joinTablesAdapter->getLeftTableJoinCount());
$selectQueryAdapter = new RedBeanModelSelectQueryAdapter();
$selectQueryAdapter->addClause(Account::getTableName(), 'id');
$sql = SQLQueryUtil::makeQuery(Account::getTableName(), $selectQueryAdapter, $joinTablesAdapter, null, null, $content, null, null);
$rows = ZurmoRedBean::getAll($sql);
$this->assertEquals(0, count($rows));
}
开发者ID:KulturedKitsch,项目名称:kulturedkitsch.info,代码行数:21,代码来源:ReadOptimizationFiltersReportQueryBuilderTest.php
示例13: getCountDataByGroupByColumnName
public function getCountDataByGroupByColumnName($groupbyColumnName, $where = null)
{
assert(is_string($groupbyColumnName));
// Not Coding Standard
assert('is_string($where) || $where == null');
$sql = "select count(*) count, {$groupbyColumnName} from {$this->tableName} ";
$this->resolveWhereClause($where);
if ($where != null) {
$sql .= 'where ' . $where . ' ';
}
$sql .= 'group by ' . $groupbyColumnName;
return ZurmoRedBean::getAll($sql);
}
示例14: testOnCreateOwnerChangeAndDeleteAccountModel
public function testOnCreateOwnerChangeAndDeleteAccountModel()
{
$super = User::getByUsername('super');
$billy = self::$billy;
Yii::app()->user->userModel = $super;
$job = new ReadPermissionSubscriptionUpdateForAccountFromBuildTableJob();
Yii::app()->jobQueue->deleteAll();
// Clean contact table
$sql = "SELECT * FROM account_read_subscription";
$rows = ZurmoRedBean::getAll($sql);
$this->assertTrue(empty($rows));
$account1 = AccountTestHelper::createAccountByNameForOwner('First Account', $super);
sleep(1);
$queuedJobs = Yii::app()->jobQueue->getAll();
$this->assertEquals(1, count($queuedJobs[5]));
$this->assertEquals('ReadPermissionSubscriptionUpdateForAccountFromBuildTable', $queuedJobs[5][0]['jobType']);
Yii::app()->jobQueue->deleteAll();
$this->assertTrue($job->run());
$sql = "SELECT * FROM account_read_subscription order by userid";
$rows = ZurmoRedBean::getAll($sql);
$this->assertEquals(2, count($rows));
$this->assertEquals($super->id, $rows[0]['userid']);
$this->assertEquals($account1->id, $rows[0]['modelid']);
$this->assertEquals(ReadPermissionsSubscriptionUtil::TYPE_ADD, $rows[0]['subscriptiontype']);
$this->assertEquals($billy->id, $rows[1]['userid']);
$this->assertEquals($account1->id, $rows[1]['modelid']);
$this->assertEquals(ReadPermissionsSubscriptionUtil::TYPE_ADD, $rows[1]['subscriptiontype']);
sleep(1);
// Test deletion
$account1->delete();
sleep(1);
$queuedJobs = Yii::app()->jobQueue->getAll();
$this->assertEquals(1, count($queuedJobs[5]));
$this->assertEquals('ReadPermissionSubscriptionUpdateForAccountFromBuildTable', $queuedJobs[5][0]['jobType']);
Yii::app()->jobQueue->deleteAll();
$this->assertTrue($job->run());
$sql = "SELECT * FROM account_read_subscription order by userid";
$rows2 = ZurmoRedBean::getAll($sql);
$this->assertEquals(2, count($rows2));
$this->assertEquals($super->id, $rows2[0]['userid']);
$this->assertEquals($account1->id, $rows2[0]['modelid']);
$this->assertEquals(ReadPermissionsSubscriptionUtil::TYPE_DELETE, $rows2[0]['subscriptiontype']);
$this->assertNotEquals($rows[0]['modifieddatetime'], $rows2[0]['modifieddatetime']);
$this->assertEquals($billy->id, $rows2[1]['userid']);
$this->assertEquals($account1->id, $rows2[1]['modelid']);
$this->assertEquals(ReadPermissionsSubscriptionUtil::TYPE_DELETE, $rows2[1]['subscriptiontype']);
$this->assertNotEquals($rows[1]['modifieddatetime'], $rows2[1]['modifieddatetime']);
// Test owner change, but when both users have permissions to access the account
$sql = "DELETE FROM account_read_subscription";
ZurmoRedBean::exec($sql);
$sql = "SELECT * FROM account_read_subscription";
$rows = ZurmoRedBean::getAll($sql);
$this->assertTrue(empty($rows));
$account2 = AccountTestHelper::createAccountByNameForOwner('Second Account', $super);
sleep(1);
$queuedJobs = Yii::app()->jobQueue->getAll();
$this->assertEquals(1, count($queuedJobs[5]));
$this->assertEquals('ReadPermissionSubscriptionUpdateForAccountFromBuildTable', $queuedJobs[5][0]['jobType']);
Yii::app()->jobQueue->deleteAll();
$this->assertTrue($job->run());
$sql = "SELECT * FROM account_read_subscription order by userid";
$rows = ZurmoRedBean::getAll($sql);
$this->assertEquals(2, count($rows));
$this->assertEquals($super->id, $rows[0]['userid']);
$this->assertEquals($account2->id, $rows[0]['modelid']);
$this->assertEquals(ReadPermissionsSubscriptionUtil::TYPE_ADD, $rows[0]['subscriptiontype']);
$this->assertEquals($billy->id, $rows[1]['userid']);
$this->assertEquals($account2->id, $rows[1]['modelid']);
$this->assertEquals(ReadPermissionsSubscriptionUtil::TYPE_ADD, $rows[1]['subscriptiontype']);
sleep(1);
$account2->owner = self::$billy;
$this->assertTrue($account2->save());
sleep(1);
$queuedJobs = Yii::app()->jobQueue->getAll();
$this->assertEquals(1, count($queuedJobs[5]));
$this->assertEquals('ReadPermissionSubscriptionUpdateForAccountFromBuildTable', $queuedJobs[5][0]['jobType']);
Yii::app()->jobQueue->deleteAll();
$this->assertTrue($job->run());
$sql = "SELECT * FROM account_read_subscription order by userid";
$rows = ZurmoRedBean::getAll($sql);
$this->assertEquals(2, count($rows));
$this->assertEquals($super->id, $rows[0]['userid']);
$this->assertEquals($account2->id, $rows[0]['modelid']);
$this->assertEquals(ReadPermissionsSubscriptionUtil::TYPE_ADD, $rows[0]['subscriptiontype']);
$this->assertEquals(self::$billy->id, $rows[1]['userid']);
$this->assertEquals($account2->id, $rows[1]['modelid']);
$this->assertEquals(ReadPermissionsSubscriptionUtil::TYPE_ADD, $rows[1]['subscriptiontype']);
// Clean account table
$accounts = Account::getAll();
foreach ($accounts as $account) {
$account->delete();
}
$sql = "DELETE FROM account_read_subscription";
ZurmoRedBean::exec($sql);
$johnny = self::$johnny;
$account3 = AccountTestHelper::createAccountByNameForOwner('Third Account', $johnny);
sleep(1);
$queuedJobs = Yii::app()->jobQueue->getAll();
$this->assertEquals(1, count($queuedJobs[5]));
$this->assertEquals('ReadPermissionSubscriptionUpdateForAccountFromBuildTable', $queuedJobs[5][0]['jobType']);
//.........这里部分代码省略.........
示例15: testDateTimeHinting
public function testDateTimeHinting()
{
$bean = ZurmoRedBean::dispense("wukka");
// Not Coding Standard
$bean->setMeta("hint", array("prop" => "datetime"));
// Not Coding Standard
$bean->prop = "2010-01-01 10:00:00";
// Not Coding Standard
ZurmoRedBean::store($bean);
// Not Coding Standard
$rows = ZurmoRedBean::getAll('desc wukka');
$this->assertEquals('prop', $rows[3]['Field']);
$this->assertEquals('datetime', $rows[3]['Type']);
}