當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。