本文整理汇总了PHP中ProspectList::load_relationships方法的典型用法代码示例。如果您正苦于以下问题:PHP ProspectList::load_relationships方法的具体用法?PHP ProspectList::load_relationships怎么用?PHP ProspectList::load_relationships使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProspectList
的用法示例。
在下文中一共展示了ProspectList::load_relationships方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkAccess
public function checkAccess($thisReport)
{
require_once 'modules/ProspectLists/ProspectList.php';
$newProspectList = new ProspectList();
// fill with results:
$newProspectList->load_relationships();
$linkedFields = $newProspectList->get_linked_fields();
$foundModule = false;
foreach ($linkedFields as $linkedField => $linkedFieldData) {
if ($newProspectList->{$linkedField}->_relationship->rhs_module == $thisReport->report_module) {
$foundModule = true;
}
}
return $foundModule ? true : false;
}
示例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;
$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);
}
}
}
}
示例3: 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);
}
}
}
}