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


PHP Campaign::load_relationships方法代码示例

本文整理汇总了PHP中Campaign::load_relationships方法的典型用法代码示例。如果您正苦于以下问题:PHP Campaign::load_relationships方法的具体用法?PHP Campaign::load_relationships怎么用?PHP Campaign::load_relationships使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Campaign的用法示例。


在下文中一共展示了Campaign::load_relationships方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createTargeList

 function createTargeList($listname, $campaign_id = '')
 {
     global $current_user, $db;
     $results = $this->getSelectionResults(array());
     if (count($results > 0)) {
         require_once 'modules/ProspectLists/ProspectList.php';
         $newProspectList = new ProspectList();
         $newProspectList->name = $listname;
         $newProspectList->list_type = 'default';
         $newProspectList->assigned_user_id = $current_user->id;
         $newProspectList->save();
         // add to campaign
         if ($campaign_id != '') {
             require_once 'modules/Campaigns/Campaign.php';
             $thisCampaign = new Campaign();
             $thisCampaign->retrieve($campaign_id);
             $thisCampaign->load_relationships();
             $campaignLinkedFields = $thisCampaign->get_linked_fields();
             foreach ($campaignLinkedFields as $linkedField => $linkedFieldData) {
                 if ($thisCampaign->{$linkedField}->_relationship->rhs_module == 'ProspectList') {
                     $thisCampaign->{$linkedField}->add($newProspectList->id);
                 }
             }
         }
         // fill with results:
         $newProspectList->load_relationships();
         $linkedFields = $newProspectList->get_linked_fields();
         foreach ($linkedFields as $linkedField => $linkedFieldData) {
             if ($newProspectList->{$linkedField}->_relationship->rhs_module == $this->report_module) {
                 foreach ($results as $thisRecord) {
                     $newProspectList->{$linkedField}->add($thisRecord['sugarRecordId']);
                 }
             } elseif ($newProspectList->{$linkedField}->_relationship->rhs_module == 'Campaigns' and $campaign_id != '') {
                 $newProspectList->{$linkedField}->add($campaign_id);
             }
         }
     }
 }
开发者ID:shoaib-fazal16,项目名称:dumpster,代码行数:38,代码来源:KReport.php

示例2: createTargeList

 function createTargeList($listname, $campaign_id = '')
 {
     global $current_user, $db;
     $results = $this->getSelectionResults(array());
     if (count($results > 0)) {
         require_once 'modules/ProspectLists/ProspectList.php';
         $newProspectList = new ProspectList();
         $newProspectList->name = $listname;
         $newProspectList->list_type = 'default';
         $newProspectList->assigned_user_id = $current_user->id;
         $db = DBManagerFactory::getInstance();
         /*
         $sugarQuery = new SugarQuery();
         $sugarQuery->select('id');
         $sugarQuery->from(BeanFactory::getBean('Accounts'));
         $sugarQuery->where()->equals('name',$newProspectList->name);
         $id_prospect = $sugarQuery->execute();
         $id_prospect = $id_prospect[0];         
         */
         $sql = "SELECT id, name from prospect_lists where deleted = '0' and name = '" . $newProspectList->name . "' limit 1";
         $result = $db->query($sql);
         if ($db->getRowCount($result) > 0) {
             if ($row = $db->fetchByAssoc($result)) {
                 $newProspectList->id = $row['id'];
             }
         }
         if ($newProspectList->save()) {
             /* Força update do campo da base de dados com o sql do relatório */
             $sql = 'UPDATE prospect_lists SET sql_query = "' . str_replace('"', "'", $_SESSION['kreport_sql']) . '" where id = "' . $newProspectList->id . '"';
             $result = $db->query($sql);
             if ($result) {
                 $GLOBALS['log']->debug("Atualizou prospect list sql");
             } else {
                 $GLOBALS['log']->debug("Falha ao atualizar prospect list sql");
             }
             /* Fim */
         }
         // add to campaign
         if ($campaign_id != '') {
             require_once 'modules/Campaigns/Campaign.php';
             $thisCampaign = new Campaign();
             $thisCampaign->retrieve($campaign_id);
             $thisCampaign->load_relationships();
             $campaignLinkedFields = $thisCampaign->get_linked_fields();
             foreach ($campaignLinkedFields as $linkedField => $linkedFieldData) {
                 if ($thisCampaign->{$linkedField}->_relationship->rhs_module == 'ProspectList') {
                     $thisCampaign->{$linkedField}->add($newProspectList->id);
                 }
             }
         }
         // fill with results:
         $newProspectList->load_relationships();
         $linkedFields = $newProspectList->get_linked_fields();
         foreach ($linkedFields as $linkedField => $linkedFieldData) {
             if ($newProspectList->{$linkedField}->_relationship->rhs_module == $this->report_module) {
                 foreach ($results as $thisRecord) {
                     $newProspectList->{$linkedField}->add($thisRecord['sugarRecordId']);
                 }
             } elseif ($newProspectList->{$linkedField}->_relationship->rhs_module == 'Campaigns' and $campaign_id != '') {
                 $newProspectList->{$linkedField}->add($campaign_id);
             }
         }
     }
 }
开发者ID:ambientelivre,项目名称:GeneratorTargetList,代码行数:64,代码来源:KReport.php


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