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


PHP Opportunity::model方法代码示例

本文整理汇总了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;
 }
开发者ID:tymiles003,项目名称:X2CRM,代码行数:9,代码来源:Opportunity.php

示例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;
 }
开发者ID:shuvro35,项目名称:X2CRM,代码行数:67,代码来源:WorkflowController.php


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