本文整理匯總了PHP中Campaign::GetCampaignId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Campaign::GetCampaignId方法的具體用法?PHP Campaign::GetCampaignId怎麽用?PHP Campaign::GetCampaignId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Campaign
的用法示例。
在下文中一共展示了Campaign::GetCampaignId方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: GroupsForLayout
/**
* Get a list of group names for a layout
* @param <type> $layoutId
* @return <type>
*/
private function GroupsForLayout($layoutId)
{
$db =& $this->db;
Kit::ClassLoader('campaign');
$campaign = new Campaign($db);
$campaignId = $campaign->GetCampaignId($layoutId);
$SQL = '';
$SQL .= 'SELECT `group`.Group ';
$SQL .= ' FROM `group` ';
$SQL .= ' INNER JOIN lkcampaigngroup ';
$SQL .= ' ON `group`.GroupID = lkcampaigngroup.GroupID ';
$SQL .= ' WHERE lkcampaigngroup.CampaignID = %d ';
$SQL = sprintf($SQL, $campaignId);
if (!($results = $db->query($SQL))) {
trigger_error($db->error());
trigger_error(__('Unable to get group information for layout'), E_USER_ERROR);
}
$groups = '';
while ($row = $db->get_assoc_row($results)) {
$groups .= $row['Group'] . ', ';
}
$groups = trim($groups);
$groups = trim($groups, ',');
return $groups;
}
示例2: Delete
/**
* Deletes a layout
* @param <type> $layoutId
* @return <type>
*/
public function Delete($layoutId)
{
try {
$dbh = PDOConnect::init();
// Make sure the layout id is present
if ($layoutId == 0) {
$this->ThrowError(__('No Layout selected'));
}
// Untag
$this->unTagAll($layoutId);
// Security
$sth = $dbh->prepare('DELETE FROM lklayoutmediagroup WHERE layoutid = :layoutid');
$sth->execute(array('layoutid' => $layoutId));
$sth = $dbh->prepare('DELETE FROM lklayoutregiongroup WHERE layoutid = :layoutid');
$sth->execute(array('layoutid' => $layoutId));
// Media Links
$sth = $dbh->prepare('DELETE FROM lklayoutmedia WHERE layoutid = :layoutid');
$sth->execute(array('layoutid' => $layoutId));
// Handle the deletion of the campaign
$campaign = new Campaign();
$campaignId = $campaign->GetCampaignId($layoutId);
// Remove the Campaign (will remove links to this layout - orphaning the layout)
if (!$campaign->Delete($campaignId)) {
$this->ThrowError(25008, __('Unable to delete campaign'));
}
// Remove the Layout from any display defaults
$sth = $dbh->prepare('UPDATE `display` SET defaultlayoutid = 4 WHERE defaultlayoutid = :layoutid');
$sth->execute(array('layoutid' => $layoutId));
// Remove the Layout from any Campaigns
if (!$campaign->unlinkAllForLayout($layoutId)) {
$this->ThrowError($campaign->GetErrorMessage());
}
// Remove the Layout (now it is orphaned it can be deleted safely)
$sth = $dbh->prepare('DELETE FROM layout WHERE layoutid = :layoutid');
$sth->execute(array('layoutid' => $layoutId));
return true;
} catch (Exception $e) {
Debug::LogEntry('error', $e->getMessage());
if (!$this->IsError()) {
$this->SetError(25008, __('Unable to delete layout'));
}
return false;
}
}