本文整理汇总了PHP中Opportunity::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Opportunity::model方法的具体用法?PHP Opportunity::model怎么用?PHP Opportunity::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Opportunity
的用法示例。
在下文中一共展示了Opportunity::model方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getNames
public static function getNames()
{
$arr = Opportunity::model()->findAll();
$names = array(0 => 'None');
foreach ($arr as $opportunity) {
$names[$opportunity->id] = $opportunity->name;
}
return $names;
}
示例2: getStageMemberDataProviderMixed
/**
* Get a data provider with contacts, opportunities, and accounts
*/
public function getStageMemberDataProviderMixed($workflowId, $dateRange, $expectedCloseDateDateRange, $stage, $users, $modelType = '')
{
$dateRange = self::getDateRange();
$expectedCloseDateDateRange = self::getDateRange('expectedCloseDateStart', 'expectedCloseDateEnd', 'expectedCloseDateRange');
if (!is_numeric($workflowId) || !is_numeric($stage)) {
return new CActiveDataProvider();
}
$records = array();
$attrs = array();
// AuxLib::debugLogR ('$modelType = ');
// AuxLib::debugLogR ($modelType);
// AuxLib::debugLogR (gettype ( $modelType));
// AuxLib::debugLogR (strlen ($modelType));
// AuxLib::debugLogR ($modelType[0]);
// AuxLib::debugLogR ($modelType[1]);
if (!empty($modelType)) {
AuxLib::coerceToArray($modelType);
}
// AuxLib::debugLogR ('$modelType = ');
// AuxLib::debugLogR ($modelType);
// CActiveDataProviders are used for the purposes of reusing code.
if (empty($modelType) || in_array('contacts', $modelType)) {
$contactsDataProvider = $this->getStageMemberDataProvider('contacts', $workflowId, $dateRange, $expectedCloseDateDateRange, $stage, $users, false);
$records['contacts'] = $contactsDataProvider->data;
$attrs = array_merge($attrs, Contacts::model()->attributeNames());
}
if (empty($modelType) || in_array('opportunities', $modelType)) {
$opportunitiesDataProvider = $this->getStageMemberDataProvider('opportunities', $workflowId, $dateRange, $expectedCloseDateDateRange, $stage, $users, false);
$records['opportunities'] = $opportunitiesDataProvider->data;
$attrs = array_merge($attrs, Opportunity::model()->attributeNames());
}
if (empty($modelType) || in_array('accounts', $modelType)) {
$accountsDataProvider = $this->getStageMemberDataProvider('accounts', $workflowId, $dateRange, $expectedCloseDateDateRange, $stage, $users, false);
$records['accounts'] = $accountsDataProvider->data;
$attrs = array_merge($attrs, Accounts::model()->attributeNames());
}
// get union of attribute names
$attrUnion = array_unique($attrs);
$attrUnion[] = 'actionLastUpdated';
// used to sort records
$combinedRecords = Record::mergeMixedRecords($records, $attrUnion);
/*
Sort records by the in descending order by the last time their associated workflow action
was updated. This allows Workflow stage listviews to be updated without reloading the
entire page. Every time a user drags a record from one stage to the next, placing that
record at the top of the target stage's list maintains the correct record ordering.
*/
usort($combinedRecords, function ($a, $b) {
if ($a['actionLastUpdated'] > $b['actionLastUpdated']) {
return -1;
} else {
if ($a['actionLastUpdated'] < $b['actionLastUpdated']) {
return 1;
} else {
return 0;
}
}
});
$dataProvider = new CArrayDataProvider($combinedRecords, array('pagination' => array('pageSize' => 20)));
$dataProvider->pagination->route = '/workflow/workflow/view';
$dataProvider->pagination->params = $_GET;
unset($dataProvider->pagination->params['ajax']);
return $dataProvider;
}