[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /*+********************************************************************************** 3 * The contents of this file are subject to the vtiger CRM Public License Version 1.1 4 * ("License"); You may not use this file except in compliance with the License 5 * The Original Code is: vtiger CRM Open Source 6 * The Initial Developer of the Original Code is vtiger. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 *************************************************************************************/ 10 11 class Campaigns_Record_Model extends Vtiger_Record_Model { 12 13 /** 14 * Function to get selected ids list of related module for send email 15 * @param <String> $relatedModuleName 16 * @param <array> $excludedIds 17 * @return <array> List of selected ids 18 */ 19 public function getSelectedIdsList($relatedModuleName, $excludedIds = false) { 20 $db = PearDatabase::getInstance(); 21 22 switch($relatedModuleName) { 23 case "Leads" : $tableName = "vtiger_campaignleadrel"; $fieldName = "leadid"; break; 24 case "Accounts" : $tableName = "vtiger_campaignaccountrel"; $fieldName = "accountid"; break; 25 case 'Contacts' : $tableName = "vtiger_campaigncontrel"; $fieldName = "contactid"; break; 26 } 27 28 $query = "SELECT $fieldName FROM $tableName 29 INNER JOIN vtiger_crmentity ON $tableName.$fieldName = vtiger_crmentity.crmid AND vtiger_crmentity.deleted = ? 30 WHERE campaignid = ?"; 31 if ($excludedIds) { 32 $query .= " AND $fieldName NOT IN (". implode(',', $excludedIds) .")"; 33 } 34 35 $result = $db->pquery($query, array(0, $this->getId())); 36 $numOfRows = $db->num_rows($result); 37 38 $selectedIdsList = array(); 39 for ($i=0; $i<$numOfRows; $i++) { 40 $selectedIdsList[] = $db->query_result($result, $i, $fieldName); 41 } 42 return $selectedIdsList; 43 } 44 } 45
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |